private function runecommercedefaults()
 {
     $request = true;
     $buildTask = new EcommerceTaskCreateMemberGroups($request);
     $buildTask->run($request);
     $obj = new EcommerceDBConfig();
     $obj->Title = "Test Configuration";
     $obj->UseThisOne = 1;
     $obj->write();
 }
 /**
  * standard SS Method
  */
 public function requireDefaultRecords()
 {
     parent::requireDefaultRecords();
     if (!self::current_ecommerce_db_config()) {
         $obj = new EcommerceDBConfig();
         $obj->write();
     }
     DB::alteration_message("\n\t\t\t<hr /><hr /><hr /><hr /><hr />\n\t\t\t<h1 style=\"color: darkRed\">Please make sure to review your <a href=\"/dev/ecommerce/\">e-commerce settings</a>.</h1>\n\t\t\t<hr /><hr /><hr /><hr /><hr />", "edited");
 }
 protected function moveSiteConfigToEcommerceDBConfig_140()
 {
     DB::alteration_message("\r\n\t\t\t<h1>140. Move Site Config fields to Ecommerce DB Config</h1>\r\n\t\t\t<p>Moving the general config fields from the SiteConfig to the EcommerceDBConfig.</p>\r\n\t\t");
     $fields = array("ShopClosed", "ShopPricesAreTaxExclusive", "ShopPhysicalAddress", "ReceiptEmail", "PostalCodeURL", "PostalCodeLabel", "NumberOfProductsPerPage", "OnlyShowProductsThatCanBePurchased", "ProductsHaveWeight", "ProductsHaveModelNames", "ProductsHaveQuantifiers", "ProductsAlsoInOtherGroups", "ProductsHaveVariations", "EmailLogoID", "DefaultProductImageID");
     $ecomConfig = DataObject::get_one("EcommerceDBConfig");
     if (!$ecomConfig) {
         $ecomConfig = new EcommerceDBConfig();
         $ecomConfig->write();
     }
     $sc = SiteConfig::current_site_config();
     if ($ecomConfig && $sc) {
         foreach ($fields as $field) {
             if ($this->hasTableAndField("SiteConfig", $field)) {
                 if (!$this->hasTableAndField("EcommerceDBConfig", $field)) {
                     DB::alteration_message("Could not find EcommerceDBConfig.{$field} - this is unexpected!", "deleted");
                 } else {
                     DB::alteration_message("Migrated SiteConfig.{$field}", "created");
                     $ecomConfig->{$field} = DB::query("SELECT \"{$field}\" FROM \"SiteConfig\" WHERE \"ID\" = " . $sc->ID)->value();
                     $ecomConfig->write();
                     $this->makeFieldObsolete("SiteConfig", $field);
                 }
             } else {
                 DB::alteration_message("SiteConfig.{$field} has been moved");
             }
         }
     } else {
         DB::alteration_message("ERROR: SiteConfig or EcommerceDBConfig are not available", "deleted");
     }
     return 0;
 }