Do not take deleted records into concern

This commit is contained in:
Alex Tselegidis 2022-11-30 11:21:39 +01:00
parent 74df69b33a
commit 8c91c86508
3 changed files with 21 additions and 18 deletions

View file

@ -153,6 +153,7 @@ class Admins_model extends EA_Model {
->where('roles.slug', DB_SLUG_ADMIN) ->where('roles.slug', DB_SLUG_ADMIN)
->where('users.email', $admin['email']) ->where('users.email', $admin['email'])
->where('users.id !=', $admin_id) ->where('users.id !=', $admin_id)
->where('users.delete_datetime', NULL)
->get() ->get()
->num_rows(); ->num_rows();
@ -177,7 +178,7 @@ class Admins_model extends EA_Model {
$this->db->where('id_users !=', $admin_id); $this->db->where('id_users !=', $admin_id);
} }
return $this->db->get_where('user_settings', ['username' => $username])->num_rows() === 0; return $this->db->get_where('user_settings', ['username' => $username, 'delete_datetime' => NULL])->num_rows() === 0;
} }
/** /**

View file

@ -168,6 +168,7 @@ class Providers_model extends EA_Model {
->where('roles.slug', DB_SLUG_PROVIDER) ->where('roles.slug', DB_SLUG_PROVIDER)
->where('users.email', $provider['email']) ->where('users.email', $provider['email'])
->where('users.id !=', $provider_id) ->where('users.id !=', $provider_id)
->where('users.delete_datetime', NULL)
->get() ->get()
->num_rows(); ->num_rows();
@ -192,7 +193,7 @@ class Providers_model extends EA_Model {
$this->db->where('id_users !=', $provider_id); $this->db->where('id_users !=', $provider_id);
} }
return $this->db->get_where('user_settings', ['username' => $username])->num_rows() === 0; return $this->db->get_where('user_settings', ['username' => $username, 'delete_datetime' => NULL])->num_rows() === 0;
} }
/** /**

View file

@ -166,6 +166,7 @@ class Secretaries_model extends EA_Model {
->where('roles.slug', DB_SLUG_SECRETARY) ->where('roles.slug', DB_SLUG_SECRETARY)
->where('users.email', $secretary['email']) ->where('users.email', $secretary['email'])
->where('users.id !=', $secretary_id) ->where('users.id !=', $secretary_id)
->where('users.delete_datetime', NULL)
->get() ->get()
->num_rows(); ->num_rows();
@ -190,7 +191,7 @@ class Secretaries_model extends EA_Model {
$this->db->where('id_users !=', $secretary_id); $this->db->where('id_users !=', $secretary_id);
} }
return $this->db->get_where('user_settings', ['username' => $username])->num_rows() === 0; return $this->db->get_where('user_settings', ['username' => $username, 'delete_datetime' => NULL])->num_rows() === 0;
} }
/** /**