From 4b104f2358bec335d4e2b4adf1d5a59fbfe16980 Mon Sep 17 00:00:00 2001 From: gRoussac Date: Mon, 7 Jan 2013 18:02:01 +0100 Subject: [PATCH] [-] FO : Fix Exception when invoice address is empty in OPC --- controllers/front/AddressController.php | 17 +++++++++++++++-- 1 file changed, 15 insertions(+), 2 deletions(-) diff --git a/controllers/front/AddressController.php b/controllers/front/AddressController.php index 51f8d4b3d..490e361c6 100644 --- a/controllers/front/AddressController.php +++ b/controllers/front/AddressController.php @@ -214,10 +214,23 @@ class AddressControllerCore extends FrontController } } } - + + if ($this->ajax && Tools::getValue('type') == 'invoice' && Configuration::get('PS_ORDER_PROCESS_TYPE')) + { + $this->errors = array_unique(array_merge($this->errors, $address->validateController())); + if (count($this->errors)) + { + $return = array( + 'hasError' => (bool)$this->errors, + 'errors' => $this->errors + ); + die(Tools::jsonEncode($return)); + } + } + // Save address if ($result = $address->save()) - { + { // Update id address of the current cart if necessary if (isset($address_old) && $address_old->isUsed()) $this->context->cart->updateAddressId($address_old->id, $address->id);