From 74bd18ae5fcd04aecb1a8665f51c699f09dc932e Mon Sep 17 00:00:00 2001 From: lLefevre Date: Thu, 11 Oct 2012 09:02:17 +0000 Subject: [PATCH] [-] BO : fix #PSCFV-4901 git-svn-id: http://dev.prestashop.com/svn/v1/branches/1.5.x@17832 b9a71923-0436-4b27-9f14-aed3839534dd --- controllers/admin/AdminImportController.php | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) diff --git a/controllers/admin/AdminImportController.php b/controllers/admin/AdminImportController.php index 4a930c930..0b8cdff54 100644 --- a/controllers/admin/AdminImportController.php +++ b/controllers/admin/AdminImportController.php @@ -1776,9 +1776,18 @@ class AdminImportControllerCore extends AdminController AdminImportController::setDefaultValues($info); + if (Tools::getValue('forceIDs') && isset($info['id']) && (int)$info['id']) + $customer = new Customer((int)$info['id']); + else + { + if (array_key_exists('id', $info) && (int)$info['id'] && Customer::customerIdExistsStatic((int)$info['id'])) + $customer = new Customer((int)$info['id']); + else + $customer = new Customer(); + } + if (array_key_exists('id', $info) && (int)$info['id'] && Customer::customerIdExistsStatic((int)$info['id'])) { - $customer = new Customer((int)$info['id']); $current_id_customer = $customer->id; $current_id_shop = $customer->id_shop; $current_id_shop_group = $customer->id_shop_group; @@ -1789,8 +1798,6 @@ class AdminImportControllerCore extends AdminController if ($group == $customer->id_default_group) unset($customer_groups[$key]); } - else - $customer = new Customer(); AdminImportController::arrayWalk($info, array('AdminImportController', 'fillInfo'), $customer); @@ -1847,7 +1854,6 @@ class AdminImportControllerCore extends AdminController else { - unset($customer->id); $res &= $customer->add(); if (isset($customer_groups)) $customer->addGroups($customer_groups); @@ -1872,7 +1878,6 @@ class AdminImportControllerCore extends AdminController } else { - unset($customer->id); $res &= $customer->add(); if (isset($customer_groups)) $customer->addGroups($customer_groups);