From e6264ba698c36fffdfefa7f0fee5d48ef9017c4b Mon Sep 17 00:00:00 2001 From: rMalie Date: Wed, 30 May 2012 08:06:57 +0000 Subject: [PATCH] // Automatically duplicate some shop data if the primary data is checked (E.g. export carriers langs if carrier is checked) #PSCFV-2616 --- classes/shop/Shop.php | 25 +++++++++++++++++++++++ controllers/admin/AdminShopController.php | 8 -------- 2 files changed, 25 insertions(+), 8 deletions(-) diff --git a/classes/shop/Shop.php b/classes/shop/Shop.php index 4d97ad846..c8352dcf8 100644 --- a/classes/shop/Shop.php +++ b/classes/shop/Shop.php @@ -797,9 +797,34 @@ class ShopCore extends ObjectModel public function copyShopData($old_id, $tables_import = false, $deleted = false) { + // If we duplicate some specific data, automatically duplicate other data linked to the first + // E.g. if carriers are duplicated for the shop, duplicate carriers langs too if (isset($tables_import['carrier'])) + { $tables_import['carrier_tax_rules_group_shop'] = true; + $tables_import['carrier_lang'] = true; + } + if (isset($tables_import['carrier'])) + $tables_import['category_lang'] = true; + + if (isset($tables_import['product'])) + $tables_import['product_lang'] = true; + + if (isset($tables_import['module'])) + { + $tables_import['module_currency'] = true; + $tables_import['module_country'] = true; + $tables_import['module_group'] = true; + } + + if (isset($tables_import['hook_module'])) + $tables_import['hook_module_exceptions'] = true; + + if (isset($tables_import['attribute_group'])) + $tables_import['attribute'] = true; + + // Browse and duplicate data foreach (Shop::getAssoTables() as $table_name => $row) { if ($tables_import && !isset($tables_import[$table_name])) diff --git a/controllers/admin/AdminShopController.php b/controllers/admin/AdminShopController.php index 82b876d17..7f8d26d36 100755 --- a/controllers/admin/AdminShopController.php +++ b/controllers/admin/AdminShopController.php @@ -442,8 +442,6 @@ class AdminShopControllerCore extends AdminController $import_data = array( 'carrier' => $this->l('Carriers'), - 'carrier_lang' => $this->l('Carriers lang'), - 'category_lang' => $this->l('Category lang'), 'cms' => $this->l('CMS page'), 'contact' => $this->l('Contact'), 'country' => $this->l('Countries'), @@ -455,20 +453,14 @@ class AdminShopControllerCore extends AdminController 'manufacturer' => $this->l('Manufacturers'), 'module' => $this->l('Modules'), 'hook_module' => $this->l('Module hooks'), - 'hook_module_exceptions' => $this->l('Module hook exceptions'), 'meta_lang' => $this->l('Meta'), - 'module_country' => $this->l('Payment module country restrictions'), - 'module_group' => $this->l('Payment module customer group restrictions'), - 'module_currency' => $this->l('Payment module currency restrictions'), 'product' => $this->l('Products'), 'product_attribute' => $this->l('Combinations'), - 'product_lang' => $this->l('Products lang'), 'scene' => $this->l('Scenes'), 'stock_available' => $this->l('Available quantities for sale'), 'store' => $this->l('Stores'), 'warehouse' => $this->l('Warehouse'), 'webservice_account' => $this->l('Webservice accounts'), - 'attribute' => $this->l('Attributes'), 'attribute_group' => $this->l('Attribute groups'), 'feature' => $this->l('Features'), 'group' => $this->l('Customer groups'),