diff --git a/classes/Customer.php b/classes/Customer.php index c6eb3f70d..a3f28a894 100644 --- a/classes/Customer.php +++ b/classes/Customer.php @@ -298,7 +298,7 @@ class CustomerCore extends ObjectModel * @param string $passwd Password is also checked if specified * @return Customer instance */ - public function getByEmail($email, $passwd = null) + public function getByEmail($email, $passwd = null, $ignore_guest = true) { if (!Validate::isEmail($email) || ($passwd && !Validate::isPasswd($passwd))) die (Tools::displayError()); @@ -308,8 +308,9 @@ class CustomerCore extends ObjectModel WHERE `email` = \''.pSQL($email).'\' '.Shop::addSqlRestriction(Shop::SHARE_CUSTOMER).' '.(isset($passwd) ? 'AND `passwd` = \''.Tools::encrypt($passwd).'\'' : '').' - AND `deleted` = 0 - AND `is_guest` = 0'; + AND `deleted` = 0'. + ($ignore_guest ? ' AND `is_guest` = 0' : ''); + $result = Db::getInstance()->getRow($sql); if (!$result) diff --git a/controllers/admin/AdminAddressesController.php b/controllers/admin/AdminAddressesController.php index a59cf68f1..a47a4de05 100644 --- a/controllers/admin/AdminAddressesController.php +++ b/controllers/admin/AdminAddressesController.php @@ -307,7 +307,7 @@ class AdminAddressesControllerCore extends AdminController if (Validate::isEmail(Tools::getValue('email'))) { $customer = new Customer(); - $customer->getByEmail(Tools::getValue('email')); + $customer->getByEmail(Tools::getValue('email'), null, false); if (Validate::isLoadedObject($customer)) $_POST['id_customer'] = $customer->id; else