protected function moveSiteConfigToEcommerceDBConfig_140()
 {
     $explanation = "\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";
     if ($this->retrieveInfoOnly) {
         return $explanation;
     } else {
         echo $explanation;
     }
     $fields = array("ShopClosed", "ShopPricesAreTaxExclusive", "ShopPhysicalAddress", "ReceiptEmail", "PostalCodeURL", "PostalCodeLabel", "NumberOfProductsPerPage", "OnlyShowProductsThatCanBePurchased", "ProductsHaveWeight", "ProductsHaveModelNames", "ProductsHaveQuantifiers", "ProductsAlsoInOtherGroups", "EmailLogoID", "DefaultProductImageID");
     $ecomConfig = EcommerceDBConfig::get()->First();
     if (!$ecomConfig) {
         $ecomConfig = EcommerceDBConfig::create();
         $ecomConfig->write();
     }
     $sc = SiteConfig::current_site_config();
     if ($ecomConfig && $sc) {
         foreach ($fields as $field) {
             if ($this->hasTableAndField("SiteConfig", $field)) {
                 if (!$this->hasTableAndField("EcommerceDBConfig", $field)) {
                     $this->DBAlterationMessageNow("Could not find EcommerceDBConfig.{$field} - this is unexpected!", "deleted");
                 } else {
                     $this->DBAlterationMessageNow("Migrated SiteConfig.{$field}", "created");
                     $ecomConfig->{$field} = DB::query("SELECT \"{$field}\" FROM \"SiteConfig\" WHERE \"ID\" = " . $sc->ID)->value();
                     $ecomConfig->write();
                     $this->makeFieldObsolete("SiteConfig", $field);
                 }
             } else {
                 $this->DBAlterationMessageNow("SiteConfig.{$field} has been moved");
             }
         }
     } else {
         $this->DBAlterationMessageNow("ERROR: SiteConfig or EcommerceDBConfig are not available", "deleted");
     }
     return 0;
 }
 /**
  * standard SS method
  */
 function onAfterWrite()
 {
     if ($this->UseThisOne) {
         $configs = EcommerceDBConfig::get()->Filter(array("UseThisOne" => 1))->Exclude(array("ID" => $this->ID));
         if ($configs->count()) {
             foreach ($configs as $config) {
                 $config->UseThisOne = 0;
                 $config->write();
             }
         }
     }
     $configs = EcommerceDBConfig::get()->Filter(array("Title" => $this->Title))->Exclude(array("ID" => $this->ID));
     if ($configs->count()) {
         foreach ($configs as $key => $config) {
             $config->Title = $config->Title . "_" . $config->ID;
             $config->write();
         }
     }
 }