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

This commit is contained in:
vAugagneur
2012-11-29 18:16:56 +01:00
parent 317938d883
commit c8d63a7819
2 changed files with 5 additions and 4 deletions
+4 -3
View File
@@ -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)
@@ -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