[-] BO : fixed bug #PSCFV-5501 - Can't edit Guest AccountAddress in Custumer -> Addresses

This commit is contained in:
vAugagneur committed 2012-11-29 18:16:56 +01:00
1 parent 317938d883
commit c8d63a7819
2 files changed
+5 -4

No files matched your search

+4 -3
View File
@@ -298,7 +298,7 @@ class CustomerCore extends ObjectModel
* @param string $passwd Password is also checked if specified * @param string $passwd Password is also checked if specified
* @return Customer instance * @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))) if (!Validate::isEmail($email) || ($passwd && !Validate::isPasswd($passwd)))
die (Tools::displayError()); die (Tools::displayError());
@@ -308,8 +308,9 @@ class CustomerCore extends ObjectModel
WHERE `email` = \''.pSQL($email).'\' WHERE `email` = \''.pSQL($email).'\'
'.Shop::addSqlRestriction(Shop::SHARE_CUSTOMER).' '.Shop::addSqlRestriction(Shop::SHARE_CUSTOMER).'
'.(isset($passwd) ? 'AND `passwd` = \''.Tools::encrypt($passwd).'\'' : '').' '.(isset($passwd) ? 'AND `passwd` = \''.Tools::encrypt($passwd).'\'' : '').'
AND `deleted` = 0 AND `deleted` = 0'.
AND `is_guest` = 0'; ($ignore_guest ? ' AND `is_guest` = 0' : '');
$result = Db::getInstance()->getRow($sql); $result = Db::getInstance()->getRow($sql);
if (!$result) if (!$result)
@@ -307,7 +307,7 @@ class AdminAddressesControllerCore extends AdminController
if (Validate::isEmail(Tools::getValue('email'))) if (Validate::isEmail(Tools::getValue('email')))
{ {
$customer = new Customer(); $customer = new Customer();
$customer->getByEmail(Tools::getValue('email')); $customer->getByEmail(Tools::getValue('email'), null, false);
if (Validate::isLoadedObject($customer)) if (Validate::isLoadedObject($customer))
$_POST['id_customer'] = $customer->id; $_POST['id_customer'] = $customer->id;
else else