diff --git a/classes/AdminTab.php b/classes/AdminTab.php index bbdee7225..f3a3a9bc0 100644 --- a/classes/AdminTab.php +++ b/classes/AdminTab.php @@ -787,7 +787,7 @@ abstract class AdminTabCore foreach ($category as $categ_id => $categ) if ($categ_id != 1) $rowList[] = array('id_category' => $categ_id, 'id_group' => $object->id); - Db::getInstance()->autoExecute(_DB_PREFIX_.'category_group', $rowList, 'INSERT'); + Db::getInstance()->insert('category_group', $rowList); } // Save and stay on same form if (Tools::isSubmit('submitAdd'.$this->table.'AndStay')) diff --git a/classes/Cart.php b/classes/Cart.php index cdc6abfc1..535194042 100644 --- a/classes/Cart.php +++ b/classes/Cart.php @@ -693,14 +693,10 @@ class CartCore extends ObjectModel public function addCartRule($id_cart_rule) { - return Db::getInstance()->AutoExecute( - _DB_PREFIX_.'cart_cart_rule', - array( - 'id_cart_rule' => (int)$id_cart_rule, - 'id_cart' => (int)$this->id - ), - 'INSERT' - ); + return Db::getInstance()->insert('cart_cart_rule', array( + 'id_cart_rule' => (int)$id_cart_rule, + 'id_cart' => (int)$this->id + )); } public function containsProduct($id_product, $id_product_attribute = 0, $id_customization = false, $id_address_delivery = 0) @@ -849,7 +845,7 @@ class CartCore extends ObjectModel if ((int)$quantity < $minimal_quantity) return -1; - $result_add = Db::getInstance()->AutoExecute(_DB_PREFIX_.'cart_product', array( + $result_add = Db::getInstance()->insert('cart_product', array( 'id_product' => (int)$id_product, 'id_product_attribute' => (int)$id_product_attribute, 'id_cart' => (int)$this->id, @@ -857,7 +853,7 @@ class CartCore extends ObjectModel 'id_shop' => $shop->getID(true), 'quantity' => (int)$quantity, 'date_add' => date('Y-m-d H:i:s') - ), 'INSERT'); + )); if (!$result_add) return false; diff --git a/classes/Category.php b/classes/Category.php index 4ff6e6992..db6dbf32d 100644 --- a/classes/Category.php +++ b/classes/Category.php @@ -987,7 +987,7 @@ class CategoryCore extends ObjectModel foreach ($groups as $group) { $row = array('id_category' => (int)$this->id, 'id_group' => (int)$group); - Db::getInstance()->AutoExecute(_DB_PREFIX_.'category_group', $row, 'INSERT'); + Db::getInstance()->insert('category_group', $row); } } diff --git a/classes/Configuration.php b/classes/Configuration.php index c50f0d40f..a2465a2c6 100644 --- a/classes/Configuration.php +++ b/classes/Configuration.php @@ -290,10 +290,10 @@ class ConfigurationCore extends ObjectModel if (!$lang) { // Update config not linked to lang - $result &= Db::getInstance()->AutoExecute(_DB_PREFIX_.'configuration', array( + $result &= Db::getInstance()->update('configuration', array( 'value' => pSQL($value, $html), 'date_upd' => date('Y-m-d H:i:s'), - ), 'UPDATE', '`name` = \''.pSQL($key).'\''.Configuration::sqlRestriction($shopGroupID, $shopID), true, true); + ), '`name` = \''.pSQL($key).'\''.Configuration::sqlRestriction($shopGroupID, $shopID), true, true); } else { @@ -330,12 +330,12 @@ class ConfigurationCore extends ObjectModel if ($lang) { - $result &= Db::getInstance()->autoExecute(_DB_PREFIX_.'configuration_lang', array( + $result &= Db::getInstance()->insert('configuration_lang', array( 'id_configuration' => $configID, 'id_lang' => $lang, 'value' => pSQL($value, $html), 'date_upd' => date('Y-m-d H:i:s'), - ), 'INSERT'); + )); } } @@ -346,12 +346,12 @@ class ConfigurationCore extends ObjectModel } /** - * Delete a configuration key in database (with or without language management) - * - * @param string $key Key to delete - * @return boolean Deletion result - */ - static public function deleteByName($key) + * Delete a configuration key in database (with or without language management) + * + * @param string $key Key to delete + * @return boolean Deletion result + */ + public static function deleteByName($key) { if (!Validate::isConfigName($key)) return false; diff --git a/classes/Connection.php b/classes/Connection.php index 24daeb993..59876b390 100644 --- a/classes/Connection.php +++ b/classes/Connection.php @@ -92,15 +92,11 @@ class ConnectionCore extends ObjectModel // The ending time will be updated by an ajax request when the guest will close the page $time_start = date('Y-m-d H:i:s'); - Db::getInstance()->AutoExecute( - _DB_PREFIX_.'connections_page', - array( - 'id_connections' => (int)$cookie->id_connections, - 'id_page' => (int)$id_page, - 'time_start' => $time_start - ), - 'INSERT' - ); + Db::getInstance()->insert('connections_page', array( + 'id_connections' => (int)$cookie->id_connections, + 'id_page' => (int)$id_page, + 'time_start' => $time_start + )); // This array is serialized and used by the ajax request to identify the page return array( diff --git a/classes/Customer.php b/classes/Customer.php index 4b20d6c19..0326eeb8d 100644 --- a/classes/Customer.php +++ b/classes/Customer.php @@ -535,7 +535,7 @@ class CustomerCore extends ObjectModel foreach ($groups as $group) { $row = array('id_customer' => (int)$this->id, 'id_group' => (int)$group); - Db::getInstance()->AutoExecute(_DB_PREFIX_.'customer_group', $row, 'INSERT'); + Db::getInstance()->insert('customer_group', $row); } } diff --git a/classes/Feature.php b/classes/Feature.php index c969ef7ab..474c2450c 100644 --- a/classes/Feature.php +++ b/classes/Feature.php @@ -161,11 +161,10 @@ class FeatureCore extends ObjectModel WHERE `'.$this->def['primary'].'` = '.(int)$this->id.' AND `id_lang` = '.(int)$field['id_lang']; $mode = Db::getInstance()->getRow($sql); - $result &= (!$mode) ? Db::getInstance()->AutoExecute(_DB_PREFIX_.$this->def['table'].'_lang', $field, 'INSERT') : - Db::getInstance()->AutoExecute( - _DB_PREFIX_.$this->def['table'].'_lang', + $result &= (!$mode) ? Db::getInstance()->insert($this->def['table'].'_lang', $field) : + Db::getInstance()->update( + $this->def['table'].'_lang', $field, - 'UPDATE', '`'.$this->def['primary'].'` = '.(int)$this->id.' AND `id_lang` = '.(int)$field['id_lang'] ); } diff --git a/classes/GroupReduction.php b/classes/GroupReduction.php index 66cd49d22..a44fc1aa6 100644 --- a/classes/GroupReduction.php +++ b/classes/GroupReduction.php @@ -113,9 +113,9 @@ class GroupReductionCore extends ObjectModel $result = true; if ($ids) - $result &= Db::getInstance()->autoExecute(_DB_PREFIX_.'product_group_reduction_cache', array( + $result &= Db::getInstance()->update('product_group_reduction_cache', array( 'reduction' => (float)$this->reduction, - ), 'UPDATE', 'id_product IN('.implode(', ', $ids).') AND id_group = '.(int)$this->id_group); + ), 'id_product IN('.implode(', ', $ids).') AND id_group = '.(int)$this->id_group); return $result; } diff --git a/classes/Image.php b/classes/Image.php index 2a0c52dd9..510e2ba92 100644 --- a/classes/Image.php +++ b/classes/Image.php @@ -106,12 +106,7 @@ class ImageCore extends ObjectModel foreach ($result as $row) { $row['position'] = $i++; - Db::getInstance()->AutoExecute( - _DB_PREFIX_.$this->def['table'], - $row, - 'UPDATE', - '`id_image` = '.(int)$row['id_image'], 1 - ); + Db::getInstance()->update($this->def['table'], $row, '`id_image` = '.(int)$row['id_image'], 1); } return true; diff --git a/classes/Module.php b/classes/Module.php index 9753bf977..dede2d973 100644 --- a/classes/Module.php +++ b/classes/Module.php @@ -215,7 +215,7 @@ abstract class ModuleCore } // Install module and retrieve the installation id - $result = Db::getInstance()->autoExecute(_DB_PREFIX_.$this->table, array('name' => $this->name, 'active' => 1, 'version' => $this->version), 'INSERT'); + $result = Db::getInstance()->insert($this->table, array('name' => $this->name, 'active' => 1, 'version' => $this->version)); if (!$result) { $this->_errors[] = $this->l('Technical error : PrestaShop could not installed this module.'); @@ -500,10 +500,10 @@ abstract class ModuleCore // Enable module in the shop where it is not enabled yet foreach ($list as $id) if (!in_array($id, $items)) - Db::getInstance()->autoExecute(_DB_PREFIX_.'module_shop', array( + Db::getInstance()->insert('module_shop', array( 'id_module' => $this->id, 'id_shop' => $id, - ), 'INSERT'); + )); return true; } @@ -630,12 +630,12 @@ abstract class ModuleCore $position = 0; // Register module in hook - $return &= Db::getInstance()->autoExecute(_DB_PREFIX_.'hook_module', array( + $return &= Db::getInstance()->insert('hook_module', array( 'id_module' => (int)$this->id, 'id_hook' => (int)$id_hook, 'id_shop' => (int)$shopID, 'position' => (int)($position + 1), - ), 'INSERT'); + )); } return $return; @@ -713,7 +713,7 @@ abstract class ModuleCore 'id_shop' => (int)$shopID, 'file_name' => pSQL($except), ); - $result = Db::getInstance()->autoExecute(_DB_PREFIX_.'hook_module_exceptions', $insertException, 'INSERT'); + $result = Db::getInstance()->insert('hook_module_exceptions', $insertException); if (!$result) return false; } diff --git a/classes/ObjectModel.php b/classes/ObjectModel.php index 395cd0598..e6a904813 100644 --- a/classes/ObjectModel.php +++ b/classes/ObjectModel.php @@ -383,9 +383,9 @@ abstract class ObjectModelCore // Database insertion if ($null_values) - $result = Db::getInstance()->autoExecuteWithNullValues(_DB_PREFIX_.$this->def['table'], $this->getFields(), 'INSERT'); + $result = Db::getInstance()->insert($this->def['table'], $this->getFields(), true); else - $result = Db::getInstance()->autoExecute(_DB_PREFIX_.$this->def['table'], $this->getFields(), 'INSERT'); + $result = Db::getInstance()->insert($this->def['table'], $this->getFields()); if (!$result) return false; @@ -412,11 +412,11 @@ abstract class ObjectModelCore foreach ($shops as $id_shop) { $field['id_shop'] = (int)$id_shop; - $result &= Db::getInstance()->AutoExecute(_DB_PREFIX_.$this->def['table'].'_lang', $field, 'INSERT'); + $result &= Db::getInstance()->insert($this->def['table'].'_lang', $field); } } else - $result &= Db::getInstance()->AutoExecute(_DB_PREFIX_.$this->def['table'].'_lang', $field, 'INSERT'); + $result &= Db::getInstance()->insert($this->def['table'].'_lang', $field); } } @@ -457,9 +457,9 @@ abstract class ObjectModelCore // Database update if ($null_values) - $result = Db::getInstance()->autoExecuteWithNullValues(_DB_PREFIX_.$this->def['table'], $this->getFields(), 'UPDATE', '`'.pSQL($this->def['primary']).'` = '.(int)($this->id)); + $result = Db::getInstance()->update($this->def['table'], $this->getFields(), '`'.pSQL($this->def['primary']).'` = '.(int)$this->id, 0, true); else - $result = Db::getInstance()->autoExecute(_DB_PREFIX_.$this->def['table'], $this->getFields(), 'UPDATE', '`'.pSQL($this->def['primary']).'` = '.(int)($this->id)); + $result = Db::getInstance()->update($this->def['table'], $this->getFields(), '`'.pSQL($this->def['primary']).'` = '.(int)$this->id); if (!$result) return false; @@ -487,9 +487,9 @@ abstract class ObjectModelCore .' AND id_shop = '.$field['id_shop']; if (Db::getInstance()->getValue('SELECT COUNT(*) FROM '.pSQL(_DB_PREFIX_.$this->def['table']).'_lang WHERE '.$where)) - $result &= Db::getInstance()->AutoExecute(_DB_PREFIX_.$this->def['table'].'_lang', $field, 'UPDATE', $where); + $result &= Db::getInstance()->update($this->def['table'].'_lang', $field, $where); else - $result &= Db::getInstance()->AutoExecute(_DB_PREFIX_.$this->def['table'].'_lang', $field, 'INSERT'); + $result &= Db::getInstance()->insert($this->def['table'].'_lang', $field); } } // If this table is not linked to multishop system ... @@ -498,9 +498,9 @@ abstract class ObjectModelCore $where = pSQL($this->def['primary']).' = '.(int)$this->id .' AND id_lang = '.(int)$field['id_lang']; if (Db::getInstance()->getValue('SELECT COUNT(*) FROM '.pSQL(_DB_PREFIX_.$this->def['table']).'_lang WHERE '.$where)) - $result &= Db::getInstance()->AutoExecute(_DB_PREFIX_.$this->def['table'].'_lang', $field, 'UPDATE', $where); + $result &= Db::getInstance()->update($this->def['table'].'_lang', $field, $where); else - $result &= Db::getInstance()->AutoExecute(_DB_PREFIX_.$this->def['table'].'_lang', $field, 'INSERT'); + $result &= Db::getInstance()->insert($this->def['table'].'_lang', $field, 'INSERT'); } } } @@ -977,11 +977,11 @@ abstract class ObjectModelCore if (!is_array($fields)) return false; - if (!Db::getInstance()->execute('DELETE FROM '._DB_PREFIX_.'required_field WHERE object_name = \''.pSQL(get_class($this)).'\'')) + if (!Db::getInstance()->execute('DELETE FROM '._DB_PREFIX_.'required_field WHERE object_name = \''.get_class($this).'\'')) return false; foreach ($fields AS $field) - if (!Db::getInstance()->AutoExecute(_DB_PREFIX_.'required_field', array('object_name' => pSQL(get_class($this)), 'field_name' => pSQL($field)), 'INSERT')) + if (!Db::getInstance()->insert('required_field', array('object_name' => get_class($this), 'field_name' => pSQL($field)))) return false; return true; } diff --git a/classes/Pack.php b/classes/Pack.php index dd20dce8e..cf13174d7 100644 --- a/classes/Pack.php +++ b/classes/Pack.php @@ -190,7 +190,7 @@ class PackCore extends Product public static function addItem($id_product, $id_item, $qty) { return Db::getInstance()->execute('UPDATE '._DB_PREFIX_.'product SET cache_is_pack = 1 WHERE id_product = '.(int)($id_product).' LIMIT 1') && - Db::getInstance()->AutoExecute(_DB_PREFIX_.'pack', array('id_product_pack' => (int)($id_product), 'id_product_item' => (int)($id_item), 'quantity' => (int)($qty)), 'INSERT') && + Db::getInstance()->insert('pack', array('id_product_pack' => (int)$id_product, 'id_product_item' => (int)$id_item, 'quantity' => (int)$qty)) && Configuration::updateGlobalValue('PS_PACK_FEATURE_ACTIVE', '1'); } diff --git a/classes/Page.php b/classes/Page.php index bb952cc8c..0480c554e 100644 --- a/classes/Page.php +++ b/classes/Page.php @@ -80,7 +80,7 @@ class PageCore extends ObjectModel if ($result['id_page']) return $result['id_page']; - Db::getInstance()->autoExecuteWithNullValues(_DB_PREFIX_.'page', $insertData, 'INSERT'); + Db::getInstance()->insert('page', $insertData, true); return Db::getInstance()->Insert_ID(); } @@ -97,9 +97,9 @@ class PageCore extends ObjectModel if ($value = Db::getInstance()->getValue($sql)) return $value; - Db::getInstance()->autoExecute(_DB_PREFIX_.'page_type', array( + Db::getInstance()->insert('page_type', array( 'name' => $name, - ), 'INSERT'); + )); return Db::getInstance()->Insert_ID(); } @@ -118,12 +118,12 @@ class PageCore extends ObjectModel // If no one has seen the page in this date range, it is added if (Db::getInstance()->Affected_Rows() == 0) - Db::getInstance()->autoExecute(_DB_PREFIX_.'page_viewed', array( + Db::getInstance()->insert('page_viewed', array( 'id_date_range' => (int)$id_date_range, 'id_page' => (int)$id_page, 'counter' => 1, 'id_shop' => (int)$context->shop->getID(), 'id_group_shop' => (int)$context->shop->getGroupID(), - ), 'INSERT'); + )); } } diff --git a/classes/Product.php b/classes/Product.php index ddcda3377..d9835cb69 100644 --- a/classes/Product.php +++ b/classes/Product.php @@ -2102,7 +2102,7 @@ class ProductCore extends ObjectModel AND id_shop = '.(int)$this->id_shop ); - Db::getInstance()->AutoExecute(_DB_PREFIX_.'product_carrier', $data, 'INSERT'); + Db::getInstance()->insert('product_carrier', $data); } /** @@ -2913,14 +2913,10 @@ class ProductCore extends ObjectModel public function changeAccessories($accessories_id) { foreach ($accessories_id as $id_product_2) - Db::getInstance()->AutoExecute( - _DB_PREFIX_.'accessory', - array( - 'id_product_1' => (int)$this->id, - 'id_product_2' => (int)$id_product_2 - ), - 'INSERT' - ); + Db::getInstance()->insert('accessory', array( + 'id_product_1' => (int)$this->id, + 'id_product_2' => (int)$id_product_2 + )); } /** @@ -2929,7 +2925,7 @@ class ProductCore extends ObjectModel public function addFeaturesCustomToDB($id_value, $lang, $cust) { $row = array('id_feature_value' => (int)$id_value, 'id_lang' => (int)$lang, 'value' => pSQL($cust)); - return Db::getInstance()->autoExecute(_DB_PREFIX_.'feature_value_lang', $row, 'INSERT'); + return Db::getInstance()->insert('feature_value_lang', $row); } public function addFeaturesToDB($id_feature, $id_value, $cust = 0) @@ -2937,11 +2933,11 @@ class ProductCore extends ObjectModel if ($cust) { $row = array('id_feature' => (int)$id_feature, 'custom' => 1); - Db::getInstance()->autoExecute(_DB_PREFIX_.'feature_value', $row, 'INSERT'); + Db::getInstance()->insert('feature_value', $row); $id_value = Db::getInstance()->Insert_ID(); } $row = array('id_feature' => (int)$id_feature, 'id_product' => (int)$this->id, 'id_feature_value' => (int)$id_value); - Db::getInstance()->autoExecute(_DB_PREFIX_.'feature_product', $row, 'INSERT'); + Db::getInstance()->insert('feature_product', $row); if ($id_value) return ($id_value); } @@ -3104,7 +3100,7 @@ class ProductCore extends ObjectModel $row['id_product'] = $id_product_new; unset($row['id_product_attribute']); - $return &= Db::getInstance()->AutoExecute(_DB_PREFIX_.'product_attribute', $row, 'INSERT'); + $return &= Db::getInstance()->insert('product_attribute', $row); $id_product_attribute_new = (int)Db::getInstance()->Insert_ID(); if ($result_images = Product::_getAttributeImageAssociations($id_product_attribute_old)) @@ -3115,7 +3111,7 @@ class ProductCore extends ObjectModel foreach ($result2 as $row2) { $row2['id_product_attribute'] = $id_product_attribute_new; - $return &= Db::getInstance()->AutoExecute(_DB_PREFIX_.'product_attribute_combination', $row2, 'INSERT'); + $return &= Db::getInstance()->insert('product_attribute_combination', $row2); } } return !$return ? false : $combination_images; @@ -3151,7 +3147,7 @@ class ProductCore extends ObjectModel $data = array( 'id_product_1' => (int)$id_product_new, 'id_product_2' => (int)$row['id_product_2']); - $return &= Db::getInstance()->AutoExecute(_DB_PREFIX_.'accessory', $data, 'INSERT'); + $return &= Db::getInstance()->insert('accessory', $data); } return $return; } @@ -3216,7 +3212,7 @@ class ProductCore extends ObjectModel { $old_id_feature_value = $result2['id_feature_value']; unset($result2['id_feature_value']); - $return &= Db::getInstance()->AutoExecute(_DB_PREFIX_.'feature_value', $result2, 'INSERT'); + $return &= Db::getInstance()->insert('feature_value', $result2); $max_fv = Db::getInstance()->getRow(' SELECT MAX(`id_feature_value`) AS nb FROM `'._DB_PREFIX_.'feature_value`'); @@ -3230,12 +3226,12 @@ class ProductCore extends ObjectModel WHERE `id_feature_value` = '.(int)$old_id_feature_value.' AND `id_lang` = '.(int)$language['id_lang']); $result3['id_feature_value'] = $new_id_feature_value; - $return &= Db::getInstance()->AutoExecute(_DB_PREFIX_.'feature_value_lang', $result3, 'INSERT'); + $return &= Db::getInstance()->insert('feature_value_lang', $result3); } $row['id_feature_value'] = $new_id_feature_value; } $row['id_product'] = $id_product_new; - $return &= Db::getInstance()->AutoExecute(_DB_PREFIX_.'feature_product', $row, 'INSERT'); + $return &= Db::getInstance()->insert('feature_product', $row); } return $return; } @@ -3301,11 +3297,7 @@ class ProductCore extends ObjectModel unset($customization_field['id_customization_field']); - if (!Db::getInstance()->AutoExecute( - _DB_PREFIX_.'customization_field', - $customization_field, - 'INSERT' - ) + if (!Db::getInstance()->insert('customization_field', $customization_field) || !$customization_field_id = Db::getInstance()->Insert_ID()) return false; diff --git a/classes/Referrer.php b/classes/Referrer.php index b9cad8f8b..01633c8d6 100644 --- a/classes/Referrer.php +++ b/classes/Referrer.php @@ -271,7 +271,7 @@ class ReferrerCore extends ObjectModel $registrations = $referrer->getRegistrations(null, $employee, $shop); $stats_sales = $referrer->getStatsSales(null, $employee, $shop); - Db::getInstance()->autoExecute(_DB_PREFIX_.'referrer_shop', array( + Db::getInstance()->update('referrer_shop', array( 'cache_visitors' => $stats_visits['uniqs'], 'cache_visits' => $stats_visits['visits'], 'cache_pages' => $stats_visits['pages'], @@ -280,7 +280,7 @@ class ReferrerCore extends ObjectModel 'cache_sales' => number_format($stats_sales['sales'], 2, '.', ''), 'cache_reg_rate' => $stats_visits['uniqs'] ? $registrations / $stats_visits['uniqs'] : 0, 'cache_order_rate' => $stats_visits['uniqs'] ? $stats_sales['orders'] / $stats_visits['uniqs'] : 0, - ), 'UPDATE', 'id_referrer = '.$referrer->id.' AND id_shop = '.$shop_id); + ), 'id_referrer = '.$referrer->id.' AND id_shop = '.$shop_id); } } diff --git a/classes/Scene.php b/classes/Scene.php index 1ba68c4cf..2c50c85dd 100644 --- a/classes/Scene.php +++ b/classes/Scene.php @@ -139,7 +139,7 @@ class SceneCore extends ObjectModel 'id_category' => (int)$category, ); } - return Db::getInstance()->autoExecute(_DB_PREFIX_.'scene_category', $data, 'INSERT'); + return Db::getInstance()->insert('scene_category', $data); } public function deleteCategories() @@ -173,7 +173,7 @@ class SceneCore extends ObjectModel ); } - return Db::getInstance()->autoExecute(_DB_PREFIX_.'scene_products', $data, 'INSERT'); + return Db::getInstance()->insert('scene_products', $data); } public function deleteZoneProducts() diff --git a/classes/SpecificPriceRule.php b/classes/SpecificPriceRule.php index 91dcd3c31..3a3f59d6f 100755 --- a/classes/SpecificPriceRule.php +++ b/classes/SpecificPriceRule.php @@ -81,21 +81,21 @@ class SpecificPriceRuleCore extends ObjectModel if (!is_array($conditions)) return; - $result = Db::getInstance()->autoExecute(_DB_PREFIX_.'specific_price_rule_condition_group', array( + $result = Db::getInstance()->insert('specific_price_rule_condition_group', array( 'id_specific_price_rule_condition_group' => '', 'id_specific_price_rule' => (int)$this->id - ), 'INSERT'); + )); if (!$result) return false; $id_specific_price_rule_condition_group = (int)Db::getInstance()->Insert_ID(); foreach ($conditions as $condition) { - $result = Db::getInstance()->autoExecute(_DB_PREFIX_.'specific_price_rule_condition', array( + $result = Db::getInstance()->insert('specific_price_rule_condition', array( 'id_specific_price_rule_condition' => '', 'id_specific_price_rule_condition_group' => (int)$id_specific_price_rule_condition_group, 'type' => $condition['type'], 'value' => $condition['value'], - ), 'INSERT'); + )); if (!$result) return false; } diff --git a/classes/db/Db.php b/classes/db/Db.php index f6d5ce9d7..cf05daa03 100644 --- a/classes/db/Db.php +++ b/classes/db/Db.php @@ -30,6 +30,13 @@ if (file_exists(dirname(__FILE__).'/../config/settings.inc.php')) abstract class DbCore { + /** + * Constants used by insert() method + */ + const INSERT = 1; + const INSERT_IGNORE = 2; + const REPLACE = 3; + /** * @var string Server (eg. localhost) */ @@ -105,7 +112,7 @@ abstract class DbCore abstract public function disconnect(); /** - * Execute a query and get result ressource + * Execute a query and get result resource * * @param string $sql * @return mixed @@ -125,7 +132,7 @@ abstract class DbCore abstract public function Insert_ID(); /** - * Get number of affected rows in previous databse operation + * Get number of affected rows in previous database operation */ abstract public function Affected_Rows(); @@ -167,7 +174,7 @@ abstract class DbCore /** * Get Db object instance * - * @param bool $master Decides wether the connection to be returned by the master server or the slave server + * @param bool $master Decides whether the connection to be returned by the master server or the slave server * @return Db instance */ public static function getInstance($master = true) @@ -246,86 +253,32 @@ abstract class DbCore } /** - * Filter SQL query within a blacklist - * - * @param string $table Table where insert/update data - * @param string $data Data to insert/update - * @param string $type INSERT or INSERT IGNORE or REPLACE or UPDATE - * @param string $where WHERE clause, only for UPDATE (optional) - * @param int $limit LIMIT clause (optional) - * @param bool $use_cache - * @param bool $use_null If true, replace empty strings and NULL by a NULL value - * @return mixed|boolean SQL query result + * @deprecated 1.5.0 use insert() or update() method instead */ public function autoExecute($table, $data, $type, $where = '', $limit = 0, $use_cache = true, $use_null = false) { - if (!$data) - return true; + Tools::displayAsDeprecated(); + if (substr($table, 0, strlen(_DB_PREFIX_)) == _DB_PREFIX_) + $table = substr($table, strlen(_DB_PREFIX_)); $type = strtoupper($type); - if ($type == 'INSERT' || $type == 'INSERT IGNORE' || $type == 'REPLACE') + switch ($type) { - // Check if $data is a list of row - $current = current($data); - if (!is_array($current) || isset($current['type'])) - $data = array($data); + case 'INSERT' : + return $this->insert($table, $data, $use_null, $use_cache, Db::INSERT); - $keys = array(); - $values_stringified = array(); - foreach ($data as $row_data) - { - $values = array(); - foreach ($row_data as $key => $value) - { - if (isset($keys_stringified)) - { - // Check if row array mapping are the same - if (!in_array("`$key`", $keys)) - throw new PrestaShopDatabaseException('Keys form $data subarray don\'t match'); - } - else - $keys[] = "`$key`"; + case 'INSERT IGNORE' : + return $this->insert($table, $data, $use_null, $use_cache, Db::INSERT_IGNORE); - if (!is_array($value)) - $value = array('type' => 'text', 'value' => $value); - if ($value['type'] == 'sql') - $values[] = $value['value']; - else - $values[] = $use_null && ($value['value'] === '' || is_null($value['value'])) ? 'NULL' : "'{$value['value']}'"; - } - $keys_stringified = implode(', ', $keys); - $values_stringified[] = '('.implode(', ', $values).')'; - } + case 'REPLACE' : + return $this->insert($table, $data, $use_null, $use_cache, Db::REPLACE); - $sql = $type.' INTO `'.$table.'` ('.$keys_stringified.') VALUES '.implode(', ', $values_stringified); - if ($limit) - $sql .= ' LIMIT '.(int)$limit; - return (bool)$this->q($sql, $use_cache); + case 'UPDATE' : + return $this->update($table, $data, $where, $limit, $use_null, $use_cache); + + default : + throw new PrestaShopDatabaseException('Wrong argument (miss type) in Db::autoExecute()'); } - else if ($type == 'UPDATE') - { - $sql = 'UPDATE `'.$table.'` SET '; - foreach ($data as $key => $value) - { - if (!is_array($value)) - $value = array('type' => 'text', 'value' => $value); - if ($value['type'] == 'sql') - $sql .= "`$key` = {$value['value']},"; - else - $sql .= ($use_null && ($value['value'] === '' || is_null($value['value']))) ? "`$key` = NULL," : "`$key` = '{$value['value']}',"; - } - - $sql = rtrim($sql, ','); - if ($where) - $sql .= ' WHERE '.$where; - if ($limit) - $sql .= ' LIMIT '.(int)$limit; - return (bool)$this->q($sql, $use_cache); - } - else - throw new PrestaShopDatabaseException('Wrong argument (miss type) in Db::autoExecute()'); - - return false; } /** @@ -360,6 +313,101 @@ abstract class DbCore return $result; } + /** + * Execute an INSERT query + * + * @param string $table Table name without prefix + * @param array $data Data to insert as associative array. If $data is a list of arrays, multiple insert will be done + * @param bool $null_values If we want to use NULL values instead of empty quotes + * @param bool $use_cache + * @param $type Must be Db::INSERT or Db::INSERT_IGNORE or Db::REPLACE + * @return bool + */ + public function insert($table, $data, $null_values = false, $use_cache = true, $type = Db::INSERT) + { + if (!$data) + return true; + + $table = _DB_PREFIX_.$table; + if ($type == Db::INSERT) + $insert_keyword = 'INSERT'; + else if ($type == Db::INSERT_IGNORE) + $insert_keyword = 'INSERT IGNORE'; + else if ($type == Db::REPLACE) + $insert_keyword = 'REPLACE'; + else + throw new PrestaShopDatabaseException('Bad keyword, must be Db::INSERT or Db::INSERT_IGNORE or Db::REPLACE'); + + // Check if $data is a list of row + $current = current($data); + if (!is_array($current) || isset($current['type'])) + $data = array($data); + + $keys = array(); + $values_stringified = array(); + foreach ($data as $row_data) + { + $values = array(); + foreach ($row_data as $key => $value) + { + if (isset($keys_stringified)) + { + // Check if row array mapping are the same + if (!in_array("`$key`", $keys)) + throw new PrestaShopDatabaseException('Keys form $data subarray don\'t match'); + } + else + $keys[] = "`$key`"; + + if (!is_array($value)) + $value = array('type' => 'text', 'value' => $value); + if ($value['type'] == 'sql') + $values[] = $value['value']; + else + $values[] = $null_values && ($value['value'] === '' || is_null($value['value'])) ? 'NULL' : "'{$value['value']}'"; + } + $keys_stringified = implode(', ', $keys); + $values_stringified[] = '('.implode(', ', $values).')'; + } + + $sql = $insert_keyword.' INTO `'.$table.'` ('.$keys_stringified.') VALUES '.implode(', ', $values_stringified); + return (bool)$this->q($sql, $use_cache); + } + + /** + * @param string $table Table name without prefix + * @param array $data Data to insert as associative array. If $data is a list of arrays, multiple insert will be done + * @param string $where WHERE condition + * @param int $limit + * @param bool $null_values If we want to use NULL values instead of empty quotes + * @param bool $use_cache + * @return bool + */ + public function update($table, $data, $where = '', $limit = 0, $null_values = false, $use_cache = true) + { + if (!$data) + return true; + + $table = _DB_PREFIX_.$table; + $sql = 'UPDATE `'.$table.'` SET '; + foreach ($data as $key => $value) + { + if (!is_array($value)) + $value = array('type' => 'text', 'value' => $value); + if ($value['type'] == 'sql') + $sql .= "`$key` = {$value['value']},"; + else + $sql .= ($null_values && ($value['value'] === '' || is_null($value['value']))) ? "`$key` = NULL," : "`$key` = '{$value['value']}',"; + } + + $sql = rtrim($sql, ','); + if ($where) + $sql .= ' WHERE '.$where; + if ($limit) + $sql .= ' LIMIT '.(int)$limit; + return (bool)$this->q($sql, $use_cache); + } + /** * Execute a DELETE query * diff --git a/classes/order/OrderReturn.php b/classes/order/OrderReturn.php index 93e892d87..5c8dfc8f3 100644 --- a/classes/order/OrderReturn.php +++ b/classes/order/OrderReturn.php @@ -68,15 +68,15 @@ class OrderReturnCore extends ObjectModel { /* Classic product return */ if ($orderDetailList) - foreach ($orderDetailList AS $key => $orderDetail) - if ($qty = (int)($productQtyList[$key])) - Db::getInstance()->AutoExecute(_DB_PREFIX_.'order_return_detail', array('id_order_return' => (int)($this->id), 'id_order_detail' => (int)($orderDetail), 'product_quantity' => $qty, 'id_customization' => 0), 'INSERT'); + foreach ($orderDetailList as $key => $orderDetail) + if ($qty = (int)$productQtyList[$key]) + Db::getInstance()->insert('order_return_detail', array('id_order_return' => (int)$this->id, 'id_order_detail' => (int)$orderDetail, 'product_quantity' => $qty, 'id_customization' => 0)); /* Customized product return */ if ($customizationIds) - foreach ($customizationIds AS $orderDetailId => $customizations) - foreach ($customizations AS $customizationId) - if ($quantity = (int)($customizationQtyInput[(int)($customizationId)])) - Db::getInstance()->AutoExecute(_DB_PREFIX_.'order_return_detail', array('id_order_return' => (int)($this->id), 'id_order_detail' => (int)($orderDetailId), 'product_quantity' => $quantity, 'id_customization' => (int)($customizationId)), 'INSERT'); + foreach ($customizationIds as $orderDetailId => $customizations) + foreach ($customizations as $customizationId) + if ($quantity = (int)$customizationQtyInput[(int)$customizationId]) + Db::getInstance()->insert('order_return_detail', array('id_order_return' => (int)$this->id, 'id_order_detail' => (int)$orderDetailId, 'product_quantity' => $quantity, 'id_customization' => (int)$customizationId)); } public function checkEnoughProduct($orderDetailList, $productQtyList, $customizationIds, $customizationQtyInput) diff --git a/classes/order/OrderSlip.php b/classes/order/OrderSlip.php index 3a230f85e..a0292cece 100644 --- a/classes/order/OrderSlip.php +++ b/classes/order/OrderSlip.php @@ -81,7 +81,11 @@ class OrderSlipCore extends ObjectModel foreach ($orderDetailList as $key => $orderDetail) { if ($qty = (int)($productQtyList[$key])) - Db::getInstance()->AutoExecute(_DB_PREFIX_.'order_slip_detail', array('id_order_slip' => (int)($this->id), 'id_order_detail' => (int)($orderDetail), 'product_quantity' => $qty), 'INSERT'); + Db::getInstance()->insert('order_slip_detail', array( + 'id_order_slip' => (int)$this->id, + 'id_order_detail' => (int)$orderDetail, + 'product_quantity' => $qty, + )); } } @@ -227,7 +231,7 @@ class OrderSlipCore extends ObjectModel 'amount_tax_excl' => (float)($tab['amount_tax_excl']), 'amount_tax_incl' => (float)($tab['amount_tax_incl']), ); - Db::getInstance()->autoExecute(_DB_PREFIX_.'order_slip_detail', $insertOrderSlip, 'INSERT'); + Db::getInstance()->insert('order_slip_detail', $insertOrderSlip); } } diff --git a/classes/shop/ShopUrl.php b/classes/shop/ShopUrl.php index 747afb838..0d3880dc9 100644 --- a/classes/shop/ShopUrl.php +++ b/classes/shop/ShopUrl.php @@ -99,8 +99,8 @@ class ShopUrlCore extends ObjectModel public function setMain() { - $res = Db::getInstance()->autoExecute(_DB_PREFIX_.'shop_url', array('main' => 0), 'UPDATE', 'id_shop = '.(int)$this->id_shop); - $res &= Db::getInstance()->autoExecute(_DB_PREFIX_.'shop_url', array('main' => 1), 'UPDATE', 'id_shop_url = '.(int)$this->id); + $res = Db::getInstance()->update('shop_url', array('main' => 0), 'id_shop = '.(int)$this->id_shop); + $res &= Db::getInstance()->update('shop_url', array('main' => 1), 'id_shop_url = '.(int)$this->id); $this->main = true; // Reset main URL for all shops to prevent problems @@ -112,7 +112,7 @@ class ShopUrlCore extends ObjectModel ) = 0 GROUP BY s1.id_shop'; foreach (Db::getInstance()->executeS($sql) as $row) - Db::getInstance()->autoExecute(_DB_PREFIX_.'shop_url', array('main' => 1), 'UPDATE', 'id_shop_url = '.$row['id_shop_url']); + Db::getInstance()->update('shop_url', array('main' => 1), 'id_shop_url = '.$row['id_shop_url']); return $res; } diff --git a/classes/stock/StockAvailable.php b/classes/stock/StockAvailable.php index 3c3d951c8..d5857b183 100644 --- a/classes/stock/StockAvailable.php +++ b/classes/stock/StockAvailable.php @@ -141,13 +141,12 @@ class StockAvailableCore extends ObjectModel { $quantity = $manager->getProductRealQuantities($id_product, $id_product_attribute, $warehouses, true); $query = array( - 'table' => _DB_PREFIX_.'stock_available', + 'table' => 'stock_available', 'data' => array('quantity' => $quantity), - 'type' => 'UPDATE', 'where' => 'id_product = '.(int)$id_product.' AND id_product_attribute = '.(int)$id_product_attribute. StockAvailable::addSqlShopRestriction(null, $id_shop) ); - Db::getInstance()->autoExecute($query['table'], $query['data'], $query['type'], $query['where']); + Db::getInstance()->update($query['table'], $query['data'], $query['where']); $product_quantity += $quantity; } @@ -155,13 +154,12 @@ class StockAvailableCore extends ObjectModel // updates // if $id_product has attributes, it also updates the sum for all attributes $query = array( - 'table' => _DB_PREFIX_.'stock_available', + 'table' => 'stock_available', 'data' => array('quantity' => $product_quantity), - 'type' => 'UPDATE', 'where' => 'id_product = '.(int)$id_product.' AND id_product_attribute = 0'. StockAvailable::addSqlShopRestriction(null, $id_shop) ); - Db::getInstance()->autoExecute($query['table'], $query['data'], $query['type'], $query['where']); + Db::getInstance()->update($query['table'], $query['data'], $query['where']); } } @@ -190,10 +188,9 @@ class StockAvailableCore extends ObjectModel if ($existing_id > 0) { - Db::getInstance()->autoExecute( - _DB_PREFIX_.'stock_available', + Db::getInstance()->update( + 'stock_available', array('depends_on_stock' => (int)(bool)$depends_on_stock), - 'UPDATE', 'id_product = '.(int)$id_product. StockAvailable::addSqlShopRestriction(null, $id_shop) ); @@ -208,11 +205,7 @@ class StockAvailableCore extends ObjectModel StockAvailable::addSqlShopParams($params, $id_shop); - Db::getInstance()->autoExecute( - _DB_PREFIX_.'stock_available', - $params, - 'INSERT' - ); + Db::getInstance()->insert('stock_available', $params); } // depends on stock.. hence synchronizes @@ -236,10 +229,9 @@ class StockAvailableCore extends ObjectModel if ($existing_id > 0) { - Db::getInstance()->autoExecute( - _DB_PREFIX_.'stock_available', + Db::getInstance()->update( + 'stock_available', array('out_of_stock' => (int)$out_of_stock), - 'UPDATE', 'id_product = '.(int)$id_product. StockAvailable::addSqlShopRestriction(null, $id_shop) ); @@ -254,11 +246,7 @@ class StockAvailableCore extends ObjectModel StockAvailable::addSqlShopParams($params, $id_shop); - Db::getInstance()->autoExecute( - _DB_PREFIX_.'stock_available', - $params, - 'INSERT' - ); + Db::getInstance()->insert('stock_available', $params); } } diff --git a/classes/stock/Warehouse.php b/classes/stock/Warehouse.php index 9e0cc378f..8e6394ca9 100644 --- a/classes/stock/Warehouse.php +++ b/classes/stock/Warehouse.php @@ -145,7 +145,7 @@ class WarehouseCore extends ObjectModel DELETE FROM '._DB_PREFIX_.'warehouse_shop WHERE '.$this->def['primary'].' = '.(int)$this->id); - Db::getInstance()->autoExecute(_DB_PREFIX_.'warehouse_shop', $row_to_insert, 'INSERT'); + Db::getInstance()->insert('warehouse_shop', $row_to_insert); } /** @@ -190,7 +190,7 @@ class WarehouseCore extends ObjectModel WHERE '.$this->def['primary'].' = '.(int)$this->id); if ($row_to_insert) - Db::getInstance()->autoExecute(_DB_PREFIX_.'warehouse_carrier', $row_to_insert, 'INSERT'); + Db::getInstance()->insert('warehouse_carrier', $row_to_insert); } /** @@ -263,7 +263,7 @@ class WarehouseCore extends ObjectModel 'location' => pSQL($location), ); - return Db::getInstance()->autoExecute(_DB_PREFIX_.'warehouse_product_location', $row_to_insert, 'INSERT'); + return Db::getInstance()->insert('warehouse_product_location', $row_to_insert); } /** diff --git a/modules/blockcms/blockcms.php b/modules/blockcms/blockcms.php index 57f5cca4b..08bb4b789 100755 --- a/modules/blockcms/blockcms.php +++ b/modules/blockcms/blockcms.php @@ -89,35 +89,35 @@ class BlockCms extends Module return false; // Install fixtures for blockcms - if (!Db::getInstance()->autoExecute(_DB_PREFIX_.'cms_block', array( + if (!Db::getInstance()->insert('cms_block', array( 'id_cms_category' => 1, 'location' => 0, 'position' => 0, - ), 'INSERT')) + ))) return false; $id_cms_block = Db::getInstance()->Insert_ID(); $result = true; $shops = Shop::getShops(true, null, true); foreach ($shops as $shop) - $result &= Db::getInstance()->autoExecute(_DB_PREFIX_.'cms_block_shop', array( + $result &= Db::getInstance()->insert('cms_block_shop', array( 'id_cms_block' => $id_cms_block, 'id_shop' => $shop - ), 'INSERT'); + )); foreach (Language::getLanguages(false) as $lang) - $result &= Db::getInstance()->autoExecute(_DB_PREFIX_.'cms_block_lang', array( + $result &= Db::getInstance()->insert('cms_block_lang', array( 'id_cms_block' => $id_cms_block, 'id_lang' => $lang['id_lang'], 'name' => $this->l('Information'), - ), 'INSERT'); + )); foreach (CMS::getCMSPages(null, 1) as $cms) - $result &= Db::getInstance()->autoExecute(_DB_PREFIX_.'cms_block_page', array( + $result &= Db::getInstance()->insert('cms_block_page', array( 'id_cms_block' => $id_cms_block, 'id_cms' => $cms['id_cms'], 'is_category' => 0, - ), 'INSERT'); + )); return $result; } @@ -740,10 +740,10 @@ class BlockCms extends Module Db::getInstance()->Execute('DELETE FROM '._DB_PREFIX_.'cms_block_shop WHERE id_cms_block='.(int)$id_cms_block); foreach ($assos_shop as $asso) foreach ($asso as $id_shop => $row) - Db::getInstance()->autoExecute(_DB_PREFIX_.'cms_block_shop', array( + Db::getInstance()->insert('cms_block_shop', array( 'id_cms_block' => (int)$id_cms_block, 'id_shop' => (int)$id_shop, - ), 'INSERT'); + )); } $cmsBoxes = Tools::getValue('cmsBox'); diff --git a/modules/blocklink/blocklink.php b/modules/blocklink/blocklink.php index ba90b2116..97c59668a 100644 --- a/modules/blocklink/blocklink.php +++ b/modules/blocklink/blocklink.php @@ -188,10 +188,10 @@ class BlockLink extends Module Db::getInstance()->Execute('DELETE FROM '._DB_PREFIX_.'blocklink_shop WHERE id_blocklink='.(int)$id_link); foreach ($assos_shop as $asso) foreach ($asso as $id_shop => $row) - Db::getInstance()->autoExecute(_DB_PREFIX_.'blocklink_shop', array( + Db::getInstance()->insert('blocklink_shop', array( 'id_blocklink' => (int)$id_link, 'id_shop' => (int)$id_shop, - ), 'INSERT'); + )); return true; } diff --git a/modules/blocktopmenu/menutoplinks.class.php b/modules/blocktopmenu/menutoplinks.class.php index 46cc739b4..0fd97f45b 100644 --- a/modules/blocktopmenu/menutoplinks.class.php +++ b/modules/blocktopmenu/menutoplinks.class.php @@ -49,27 +49,25 @@ class MenuTopLinks if(!is_array($label)) return false; - Db::getInstance()->autoExecute( - _DB_PREFIX_.'linksmenutop', + Db::getInstance()->insert( + 'linksmenutop', array( 'new_window'=>(int)$newWindow, 'link'=>pSQL($link), 'id_shop' => (int)$id_shop - ), - 'INSERT' + ) ); $id_linksmenutop = Db::getInstance()->Insert_ID(); foreach($label as $id_lang=>$label) { - Db::getInstance()->autoExecute( - _DB_PREFIX_.'linksmenutop_lang', + Db::getInstance()->insert( + 'linksmenutop_lang', array( 'id_linksmenutop'=>(int)$id_linksmenutop, 'id_lang'=>(int)$id_lang, 'id_shop'=>(int)$id_shop, 'label'=>pSQL($label) - ), - 'INSERT' + ) ); } } diff --git a/modules/editorial/editorial.php b/modules/editorial/editorial.php index 93658d3a9..86ea844c5 100644 --- a/modules/editorial/editorial.php +++ b/modules/editorial/editorial.php @@ -80,14 +80,14 @@ class Editorial extends Module { $id_editorial = Db::getInstance()->Insert_ID(); foreach (Language::getLanguages(false) as $lang) - $res &= Db::getInstance()->autoExecute(_DB_PREFIX_.'editorial_lang', array( + $res &= Db::getInstance()->insert('editorial_lang', array( 'id_editorial' => $id_editorial, 'id_lang' => $lang['id_lang'], 'body_title' => 'Lorem ipsum dolor sit amet', 'body_subheading' => 'Excepteur sint occaecat cupidatat non proident', 'body_paragraph' => '

Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum

', 'body_logo_subheading' => 'Lorem ipsum presta shop amet', - ), 'INSERT'); + )); } if (!$res) diff --git a/modules/followup/followup.php b/modules/followup/followup.php index 1ae730705..7dcbbb8fe 100644 --- a/modules/followup/followup.php +++ b/modules/followup/followup.php @@ -270,7 +270,7 @@ class Followup extends Module $values['id_cart'] = (int)($id_cart); if (!empty($id_customer)) $values['id_customer'] = (int)($id_customer); - Db::getInstance()->autoExecute(_DB_PREFIX_.'log_email', $values, 'INSERT'); + Db::getInstance()->insert('log_email', $values); } /* Each cart which wasn't transformed into an order */ diff --git a/modules/shopimporter/shopimporter.php b/modules/shopimporter/shopimporter.php index f04ca1241..c98568991 100644 --- a/modules/shopimporter/shopimporter.php +++ b/modules/shopimporter/shopimporter.php @@ -726,7 +726,7 @@ class shopimporter extends ImportModule $item['cart_products'][$k][$key] = $foreignKey[$key][$val]; else $item['cart_products'][$k][$key] = 0; - Db::getInstance()->autoExecute(_DB_PREFIX_.'cart_product', $item['cart_products'][$k],'INSERT'); + Db::getInstance()->insert('cart_product', $item['cart_products'][$k]); } foreach($item['order_products'] as $k => $order_products) { @@ -755,7 +755,7 @@ class shopimporter extends ImportModule $item['order_products'][$k][$key] = $foreignKey[$key][$val]; else $item['order_products'][$k][$key] = 0; - Db::getInstance()->autoExecute(_DB_PREFIX_.'order_detail', $item['order_products'][$k],'INSERT'); + Db::getInstance()->insert('order_detail', $item['order_products'][$k]); } //save order history foreach($item['order_history'] as $k => $order_history) @@ -767,7 +767,7 @@ class shopimporter extends ImportModule else $item['order_history'][$k][$key] = 0; - Db::getInstance()->autoExecute(_DB_PREFIX_.'order_history', $item['order_history'][$k],'INSERT'); + Db::getInstance()->insert('order_history', $item['order_history'][$k]); } } }