From 9a70ff3a778be10050e5bab30b183ebdc6ea70b5 Mon Sep 17 00:00:00 2001 From: rGaillard Date: Mon, 30 Jan 2012 13:21:12 +0000 Subject: [PATCH] // Fix PSTEST-396 --- .../template/controllers/orders/form.tpl | 82 +++++++++---------- classes/AdminController.php | 9 +- 2 files changed, 45 insertions(+), 46 deletions(-) diff --git a/admin-dev/themes/default/template/controllers/orders/form.tpl b/admin-dev/themes/default/template/controllers/orders/form.tpl index 89b1d1d48..602f9c737 100755 --- a/admin-dev/themes/default/template/controllers/orders/form.tpl +++ b/admin-dev/themes/default/template/controllers/orders/form.tpl @@ -431,10 +431,20 @@ function updateCarrierList(carriers) { var html = ''; - $.each(carriers, function() { - html += ''; - }); - $('#id_carrier').html(html); + if (carriers.length > 0) + { + $.each(carriers, function() { + html += ''; + }); + $('#carrier_form').show(); + $('#id_carrier').html(html); + $('#carriers_err').hide(); + } + else + { + $('#carrier_form').hide(); + $('#carriers_err').show().html('{l s='No carrier can be applied to this order'}'); + } } function searchProducts() @@ -551,11 +561,11 @@ updateCartVouchers(jsonSummary.summary.discounts); updateAddressesList(jsonSummary.addresses, jsonSummary.cart.id_address_delivery, jsonSummary.cart.id_address_invoice); - if (!jsonSummary.summary.products.length || !jsonSummary.addresses.length) + if (!jsonSummary.summary.products.length || !jsonSummary.addresses.length || !jsonSummary.cart.id_carrier) $('#carriers_part,#summary_part').hide(); else $('#carriers_part,#summary_part').show(); - + updateCarrierList(jsonSummary.carriers); if (jsonSummary.cart.gift == 1) @@ -746,7 +756,6 @@ var addresses_invoice_options = ''; var address_invoice_detail = ''; var address_delivery_detail = ''; - $.each(addresses, function() { if (this.id_address == id_address_invoice) address_invoice_detail = this.company+' '+this.firstname+' '+this.lastname+'
'+this.address1+'
'+this.address2+'
'+this.postcode+' '+this.city+' '+this.country; @@ -782,27 +791,10 @@ success : function(res) { displaySummary(res); - var x; - for(x in res.addresses) - { - if (res.addresses[x].id_address == $('#id_address_delivery option:selected').val()) - displayAddressDetail('address_delivery_detail', res.addresses[x]); - else if (res.addresses[x].id_address == $('#id_address_invoice option:selected').val()) - displayAddressDetail('address_invoice_detail', res.addresses[x]); - } } }); } - function displayAddressDetail(id, address) - { - var address_detail = address.company+' '+address.firstname+' '+address.lastname+'
'; - address_detail += address.address1+'
'; - address_detail += address.address2+'
'; - address_detail += address.postcode+' '+address.city+' '+address.country; - $('#'+id).html(address_detail); - } - {if $show_toolbar}
@@ -990,25 +982,29 @@

diff --git a/classes/AdminController.php b/classes/AdminController.php index 8460e26e3..6163ea38e 100644 --- a/classes/AdminController.php +++ b/classes/AdminController.php @@ -1604,12 +1604,15 @@ class AdminControllerCore extends Controller _PS_JS_DIR_.'toggle.js', _PS_JS_DIR_.'tools.js', _PS_JS_DIR_.'ajax.js', - _PS_JS_DIR_.'notifications.js', _PS_JS_DIR_.'toolbar.js' )); - if (Configuration::get('PS_HELPBOX')) - $this->addJS(_PS_JS_DIR_.'helpAccess.js'); + if (!Tools::getValue('submitFormAjax')) + { + $this->addJs(_PS_JS_DIR_.'notifications.js'); + if (Configuration::get('PS_HELPBOX')) + $this->addJS(_PS_JS_DIR_.'helpAccess.js'); + } } /** * use translations files to replace english expression.