From fbc6ee252c74c7170538938401df9c48792fcecc Mon Sep 17 00:00:00 2001 From: mBertholino Date: Tue, 27 Dec 2011 13:46:52 +0000 Subject: [PATCH] [-] BO : PSTEST-200 : bug fixed : When an administrator made modifications on a customer about the newsletter option or the Opt-in option, customer's addresses were deleted --- controllers/admin/AdminCustomersController.php | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/controllers/admin/AdminCustomersController.php b/controllers/admin/AdminCustomersController.php index 6df94d3d9..472edf923 100644 --- a/controllers/admin/AdminCustomersController.php +++ b/controllers/admin/AdminCustomersController.php @@ -765,6 +765,18 @@ class AdminCustomersControllerCore extends AdminController parent::processSave($token); } + public function afterDelete($object, $oldId) + { + $customer = new Customer($oldId); + $addresses = $customer->getAddresses($this->default_form_language); + foreach ($addresses as $k => $v) + { + $address = new Address($v['id_address']); + $address->id_customer = $object->id; + $address->save(); + } + return true; + } /** * Transform a guest account into a registered customer account *