From b41c724e9746355da45bfba8aa7f2011a319f92d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?R=C3=A9mi=20Gaillard?= Date: Wed, 17 Jul 2013 11:43:54 +0200 Subject: [PATCH] // fix validation rules --- classes/Carrier.php | 17 +++++++++++++++++ .../admin/AdminCarrierWizardController.php | 6 +++++- 2 files changed, 22 insertions(+), 1 deletion(-) diff --git a/classes/Carrier.php b/classes/Carrier.php index dcc976fb1..0b163b0e9 100644 --- a/classes/Carrier.php +++ b/classes/Carrier.php @@ -463,6 +463,23 @@ class CarrierCore extends ObjectModel return $carriers; } + + public static function getIdTaxRulesGroupMostUsed() + { + return Db::getInstance()->getValue(' + SELECT id_tax_rules_group + FROM ( + SELECT COUNT(*) n, carrier_shop.id_tax_rules_group + FROM '._DB_PREFIX_.'carrier c + '.Shop::addSqlAssociation('carrier', 'c').' + JOIN '._DB_PREFIX_.'tax_rules_group trg ON (carrier_shop.id_tax_rules_group = trg.id_tax_rules_group) + WHERE trg.active = 1 + GROUP BY carrier.id_tax_rules_group + ORDER BY n DESC + LIMIT 1 + ) most_used' + ); + } public static function getDeliveredCountries($id_lang, $active_countries = false, $active_carriers = false, $contain_states = null) { diff --git a/controllers/admin/AdminCarrierWizardController.php b/controllers/admin/AdminCarrierWizardController.php index d6848f3fb..8b8cbabe3 100644 --- a/controllers/admin/AdminCarrierWizardController.php +++ b/controllers/admin/AdminCarrierWizardController.php @@ -672,7 +672,11 @@ class AdminCarrierWizardControllerCore extends AdminController if (Shop::isFeatureActive()) { $multistore_field = array(array('shop')); - array_splice($step_fields, 1, 0, $multistore_field); + $tmp = $step_fields; + $step_fields = array(1 => $tmp[1]) + $multistore_field; + array_shift($tmp); + foreach ($tmp as $row) + $step_field[] = $row; } $rules = array();