diff --git a/adm/helpers/HelperFormBootstrap.php b/adm/helpers/HelperFormBootstrap.php index 2e87417c..4c6b6497 100644 --- a/adm/helpers/HelperFormBootstrap.php +++ b/adm/helpers/HelperFormBootstrap.php @@ -296,7 +296,7 @@ class HelperFormBootstrap{
- +
'; } @@ -674,13 +674,14 @@ class HelperFormBootstrap{ $class = isset($p['class']) && $p['class'] ? $p['class'] : false; if($label) { $this->_html .= '
- '; + +
'; } $this->_html .= ' '; if($label) { - $this->_html .= '
'; + $this->_html .= '
'; } } diff --git a/modules/ant_configurations/AdminAntConfigurations.php b/modules/ant_configurations/AdminAntConfigurations.php index 903e1ca0..fd310ca6 100644 --- a/modules/ant_configurations/AdminAntConfigurations.php +++ b/modules/ant_configurations/AdminAntConfigurations.php @@ -11,7 +11,16 @@ class AdminAntConfigurations extends AdminTab { public function postProcess() { global $cookie; - if(Tools::isSubmit('submitProductSaleCache')) { + if(Tools::isSubmit('submitUpdateConfigurations')) { + + Configuration::updateValue('ANT_CARRIER_DROP', Tools::getValue('carrier_dropshipping')); + Configuration::updateValue('ANT_CARRIER_DOM', Tools::getValue('carrier_domicile')); + Configuration::updateValue('ANT_CARRIERS_SOCOL', Tools::getValue('carriers_socol')); + Configuration::updateValue('ANT_CARRIERS_OOH', Tools::getValue('carriers_ooh')); + + HelperFormBootstrap::echoConfirmation($this->l('Configurations mises à jour')); + + } elseif(Tools::isSubmit('submitProductSaleCache')) { $fileName = 'cron_sale_cache.php'; $output = shell_exec("ps -ax | grep $fileName | wc -l"); $hour = (int) date('H'); @@ -177,6 +186,9 @@ class AdminAntConfigurations extends AdminTab .button:focus{ background-color: rgba(86,84,133,0.6); } + .control-label { + padding: 0; + } '; $id_sale_options = array(); @@ -268,10 +280,44 @@ class AdminAntConfigurations extends AdminTab array( 'type' => 'submit', 'class' => 'btn-default', + 'label-class' => 'col-md-6', + 'input-class' => 'col-md-4', 'name' => 'submitUpdateLoyaltyOrders', - 'label' => $this->l('Credit fidélité ').($nb_credits>0?'('.$nb_credits.')':'').': ', + 'label' => $this->l('Credit fidélité ').($nb_credits>0?'('.$nb_credits.')':'').' : ', 'value' => $this->l('Mettre à jour'), ), + array( + 'type' => 'simpleText', + 'name' => 'carrier_dropshipping', + 'label-class' => 'col-md-6', + 'input-class' => 'col-md-4', + 'label' => $this->l('Transporteur Dropshipping :'), + 'default' => Configuration::get('ANT_CARRIER_DROP') + ), + array( + 'type' => 'simpleText', + 'name' => 'carrier_domicile', + 'label-class' => 'col-md-6', + 'input-class' => 'col-md-4', + 'label' => $this->l('Transporteur domicile :'), + 'default' => Configuration::get('ANT_CARRIER_DOM') + ), + array( + 'type' => 'simpleText', + 'name' => 'carriers_socol', + 'label-class' => 'col-md-6', + 'input-class' => 'col-md-4', + 'label' => $this->l('Transporteur socol :'), + 'default' => Configuration::get('ANT_CARRIERS_SOCOL') + ), + array( + 'type' => 'simpleText', + 'name' => 'carriers_ooh', + 'label-class' => 'col-md-6', + 'input-class' => 'col-md-4', + 'label' => $this->l('Transporteur OOH :'), + 'default' => Configuration::get('ANT_CARRIERS_OOH') + ), ), ), array( @@ -303,6 +349,15 @@ class AdminAntConfigurations extends AdminTab 'actions-class' => 'text-right', ), ), + 'actions' => array( + array( + 'type' => 'submit', + 'class' => 'btn-primary', + 'name' => 'submitUpdateConfigurations', + 'value' => $this->l('Mettre à jour les configurations') + ) + ), + 'actions-class' => 'text-center', ); } diff --git a/modules/privatesales/AdminPrivateSalesSales.php b/modules/privatesales/AdminPrivateSalesSales.php index 27a26515..2c163a94 100755 --- a/modules/privatesales/AdminPrivateSalesSales.php +++ b/modules/privatesales/AdminPrivateSalesSales.php @@ -500,12 +500,14 @@ class AdminPrivateSalesSales extends AdminTab { carriers_info += "

"+$(el).data("carrier-name")+"

"; carriers_selected.push($(el).val()); }); + var config_carriers_socol = ['.Configuration::get('ANT_CARRIERS_SOCOL').']; + var is_equal = carriers_selected.length==config_carriers_socol.length && carriers_selected.every(function(v,i) { return ($.inArray(v,config_carriers_socol) != -1)}) $(".carriers_info div.info").html(carriers_info); - if ($.inArray("45",carriers_selected)!= -1 && $.inArray("47",carriers_selected)!= -1 && $.inArray("48",carriers_selected)!= -1) { + if (is_equal) { $("#delivery_mode option[value=\'1\']").attr("selected","selected"); - } else if ($.inArray("45",carriers_selected)!= -1) { + } else if ($.inArray("'.Configuration::get('ANT_CARRIER_DOM').'",carriers_selected)!= -1) { $("#delivery_mode option[value=\'2\']").attr("selected","selected"); - } else if ($.inArray("22",carriers_selected)!= -1) { + } else if ($.inArray("'.Configuration::get('ANT_CARRIER_DROP').'",carriers_selected)!= -1) { $("#delivery_mode option[value=\'3\']").attr("selected","selected"); } @@ -516,11 +518,11 @@ class AdminPrivateSalesSales extends AdminTab { }); var selected_carriers = []; if($(this).val() == 1) { - selected_carriers = ["45", "47", "48"]; + selected_carriers = ["'.str_replace(',','","',Configuration::get('ANT_CARRIERS_SOCOL')).'"]; } else if($(this).val() == 2) { - selected_carriers = ["45"]; + selected_carriers = ["'.Configuration::get('ANT_CARRIER_DOM').'"]; } else if($(this).val() == 3) { - selected_carriers = ["22"]; + selected_carriers = ["'.Configuration::get('ANT_CARRIER_DROP').'"]; } $("input[name=\'m_carriers[]\']").each(function(){ if ($.inArray($(this).val(),selected_carriers) != -1){ diff --git a/override/controllers/ParentOrderController.php b/override/controllers/ParentOrderController.php index 4b1494d6..2ff28bdd 100755 --- a/override/controllers/ParentOrderController.php +++ b/override/controllers/ParentOrderController.php @@ -51,6 +51,8 @@ class ParentOrderController extends ParentOrderControllerCore { $sale_delivery = array(); // Restriction du choix du transporteur if(Module::isInstalled('privatesales')) { + $carrier_dropshipping = (int)Configuration::get('ANT_CARRIER_DROP'); + $carrier_dom = (int)Configuration::get('ANT_CARRIER_DOM'); if(Configuration::get('PRIVATESALES_CARRIERFENCE') ) { $cart_products = self::$cart->getProducts(); if(count($cart_products) > 0) { @@ -82,7 +84,7 @@ class ParentOrderController extends ParentOrderControllerCore { && !in_array($carrier['id_carrier'], $carrier_uniq)) { $_carriers[] = $carrier; $carrier_uniq[] = $carrier['id_carrier']; - if((int)$carrier['id_carrier'] == 22) { + if((int)$carrier['id_carrier'] == $carrier_dropshipping) { $dropshipping = true; } } @@ -153,7 +155,7 @@ class ParentOrderController extends ParentOrderControllerCore { // Gestion carrier socolissimo (soflexibilite) $carriers_socol = array(); foreach ($_carriers as $key => $carrier) { - if($dropshipping && $carrier['id_carrier'] == 22) { + if($dropshipping && $carrier['id_carrier'] == $carrier_dropshipping) { $carrier_drop = $carrier; } if ($carrier['external_module_name'] == "soflexibilite") { @@ -185,24 +187,14 @@ class ParentOrderController extends ParentOrderControllerCore { // distinction "at home" et "out of home" $carriers_ah = array(); $carriers_ooh = array(); - $config_carrier_ooh = array(88,89); // prod - //$config_carrier_ooh = array(47,48); // dev - //$config_carrier_ooh = array(40,45); // local + $config_carrier_ooh = array_map('intval',explode(',', Configuration::get('ANT_CARRIERS_OOH'))); foreach ($carriers as $carrier) { - if($shipping_only_athome && $carrier['id_carrier'] != 87) { // prod - //if($shipping_only_athome && $carrier['id_carrier'] != 45) { // dev - //if($shipping_only_athome && $carrier['id_carrier'] != 38) { // local + if($shipping_only_athome && $carrier['id_carrier'] != $carrier_dom) { continue; } - if($carrier['id_carrier'] != 87 - && isset($count_carriers[(int)$carrier['id_carrier']]) && isset($count_carriers[87]) - && $count_carriers[(int)$carrier['id_carrier']] < $count_carriers[87]) { // prod - // if($carrier['id_carrier'] != 45 - // && isset($count_carriers[(int)$carrier['id_carrier']]) && isset($count_carriers[45]) - // && $count_carriers[(int)$carrier['id_carrier']] < $count_carriers[45]) { // dev - // if($carrier['id_carrier'] != 38 - // && isset($count_carriers[(int)$carrier['id_carrier']]) && isset($count_carriers[38]) - // && $count_carriers[(int)$carrier['id_carrier']] < $count_carriers[38]) { //local + if($carrier['id_carrier'] != $carrier_dom + && isset($count_carriers[(int)$carrier['id_carrier']]) && isset($count_carriers[$carrier_dom]) + && $count_carriers[(int)$carrier['id_carrier']] < $count_carriers[$carrier_dom]) { continue; } if (in_array($carrier['id_carrier'], $config_carrier_ooh) ){