[-] FO : remove "Invalid address warning" when not "same" an no invoice address

This commit is contained in:
gRoussac
2013-03-11 14:43:37 +01:00
parent 9be5d8ac64
commit eb48c91eac
+7 -3
View File
@@ -249,15 +249,19 @@ class OrderControllerCore extends ParentOrderController
{
if (!Tools::getValue('multi-shipping'))
$this->context->cart->setNoMultishipping();
$same = Tools::isSubmit('same');
if(!Tools::getValue('id_address_invoice', false) && !$same)
$same = true;
if (!Customer::customerHasAddress($this->context->customer->id, (int)Tools::getValue('id_address_delivery'))
|| (!Tools::isSubmit('same') && Tools::getValue('id_address_delivery') != Tools::getValue('id_address_invoice')
|| (!$same && Tools::getValue('id_address_delivery') != Tools::getValue('id_address_invoice')
&& !Customer::customerHasAddress($this->context->customer->id, (int)Tools::getValue('id_address_invoice'))))
$this->errors[] = Tools::displayError('Invalid address', !Tools::getValue('ajax'));
else
{
$this->context->cart->id_address_delivery = (int)Tools::getValue('id_address_delivery');
$this->context->cart->id_address_invoice = Tools::isSubmit('same') ? $this->context->cart->id_address_delivery : (int)Tools::getValue('id_address_invoice');
$this->context->cart->id_address_invoice = $same ? $this->context->cart->id_address_delivery : (int)Tools::getValue('id_address_invoice');
CartRule::autoRemoveFromCart($this->context);
CartRule::autoAddToCart($this->context);