Merge branch 'develop' into gli-2087

This commit is contained in:
Shreesh Arora
2024-07-05 13:18:23 +05:30
56 changed files with 919 additions and 455 deletions

View File

@@ -1061,23 +1061,28 @@ class AdminCustomersControllerCore extends AdminController
$customer = new Customer();
if (Validate::isEmail($customer_email)) {
$customer->getByEmail($customer_email);
}
if ($customer->id) {
$this->errors[] = Tools::displayError('An account already exists for this email address:').' '.$customer_email;
if ($customer->id) {
$this->errors[] = Tools::displayError('An account already exists for this email address:').' '.$customer_email;
$this->display = 'edit';
return $customer;
} elseif (trim(Tools::getValue('passwd')) == '') {
$this->validateRules();
$this->errors[] = Tools::displayError('Password can not be empty.');
$this->display = 'edit';
} elseif ($customer = parent::processAdd()) {
CartCustomerGuestDetail::updateCustomerPhoneNumber($customer->email, Tools::getValue('phone'));
$this->context->smarty->assign('new_customer', $customer);
return $customer;
}
} else {
$this->errors[] = Tools::displayError('Invalid email address.');
$this->display = 'edit';
return $customer;
} elseif (trim(Tools::getValue('passwd')) == '') {
$this->validateRules();
$this->errors[] = Tools::displayError('Password can not be empty.');
$this->display = 'edit';
} elseif ($customer = parent::processAdd()) {
CartCustomerGuestDetail::updateCustomerPhoneNumber($customer->email, Tools::getValue('phone'));
$this->context->smarty->assign('new_customer', $customer);
return $customer;
}
return false;
}
public function processUpdate()
{
if (Validate::isLoadedObject($this->object)) {
@@ -1088,7 +1093,10 @@ class AdminCustomersControllerCore extends AdminController
$customer = new Customer();
if (Validate::isEmail($customer_email)) {
$customer->getByEmail($customer_email);
} else {
$this->errors[] = Tools::displayError('Invalid email address.');
}
if (($customer->id) && ($customer->id != (int)$this->object->id)) {
$this->errors[] = Tools::displayError('An account already exists for this email address:').' '.$customer_email;
}