From 6b738a1ea56a54790fc3d56137643c4749eaf202 Mon Sep 17 00:00:00 2001 From: Alex Tselegidis Date: Tue, 10 May 2022 14:28:51 +0200 Subject: [PATCH] Check only in the non-deleted customers, when validating the email address (#1246) --- application/models/Customers_model.php | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/application/models/Customers_model.php b/application/models/Customers_model.php index f6f33cb2..7008de7b 100644 --- a/application/models/Customers_model.php +++ b/application/models/Customers_model.php @@ -133,6 +133,7 @@ class Customers_model extends EA_Model { ->select() ->from('users') ->join('roles', 'roles.id = users.id_roles', 'inner') + ->where('users.delete_datetime', NULL) ->where('roles.slug', DB_SLUG_CUSTOMER) ->where('users.email', $customer['email']) ->where('users.id !=', $customer_id) @@ -181,7 +182,7 @@ class Customers_model extends EA_Model { protected function update(array $customer): int { $customer['update_datetime'] = date('Y-m-d H:i:s'); - + if ( ! $this->db->update('users', $customer, ['id' => $customer['id']])) { throw new RuntimeException('Could not update customer.'); @@ -359,6 +360,7 @@ class Customers_model extends EA_Model { ->from('users') ->join('roles', 'roles.id = users.id_roles', 'inner') ->where('users.email', $customer['email']) + ->where('users.delete_datetime', NULL) ->where('roles.slug', DB_SLUG_CUSTOMER) ->get() ->num_rows(); @@ -388,6 +390,7 @@ class Customers_model extends EA_Model { ->from('users') ->join('roles', 'roles.id = users.id_roles', 'inner') ->where('users.email', $customer['email']) + ->where('users.delete_datetime', NULL) ->where('roles.slug', DB_SLUG_CUSTOMER) ->get() ->row_array();