mirror of
https://github.com/alextselegidis/easyappointments.git
synced 2024-11-22 07:52:29 +03:00
* Updated user models and settings view file.
This commit is contained in:
parent
8ccbc0a89e
commit
21aba5d4da
6 changed files with 33 additions and 16 deletions
|
@ -88,6 +88,9 @@ class Appointments extends CI_Controller {
|
|||
$appointment = $post_data['appointment'];
|
||||
$customer = $post_data['customer'];
|
||||
|
||||
if ($this->customers_model->exists($customer))
|
||||
$customer['id'] = $this->customers_model->find_record_id($customer);
|
||||
|
||||
$customer_id = $this->customers_model->add($customer);
|
||||
$appointment['id_users_customer'] = $customer_id;
|
||||
|
||||
|
|
|
@ -221,16 +221,19 @@ class Admins_Model extends CI_Model {
|
|||
}
|
||||
|
||||
// When inserting a record the email address must be unique.
|
||||
$admin_id = (isset($admin['id'])) ? $admin['id'] : '';
|
||||
|
||||
$num_rows = $this->db
|
||||
->select('*')
|
||||
->from('ea_users')
|
||||
->join('ea_roles', 'ea_roles.id = ea_users.id_roles', 'inner')
|
||||
->where('ea_roles.slug', DB_SLUG_ADMIN)
|
||||
->where('ea_users.email', $admin['email'])
|
||||
->where('ea_users.id <>', $admin_id)
|
||||
->get()
|
||||
->num_rows();
|
||||
|
||||
if ($num_rows > 0 && !isset($admin['id'])) {
|
||||
if ($num_rows > 0) {
|
||||
throw new Exception('Given email address belongs to another admin record. '
|
||||
. 'Please use a different email.');
|
||||
}
|
||||
|
|
|
@ -182,19 +182,22 @@ class Customers_Model extends CI_Model {
|
|||
}
|
||||
|
||||
// When inserting a record the email address must be unique.
|
||||
//$num_rows = $this->db
|
||||
// ->select('*')
|
||||
// ->from('ea_users')
|
||||
// ->join('ea_roles', 'ea_roles.id = ea_users.id_roles', 'inner')
|
||||
// ->where('ea_roles.slug', DB_SLUG_CUSTOMER)
|
||||
// ->where('ea_users.email', $customer['email'])
|
||||
// ->get()
|
||||
// ->num_rows();
|
||||
//
|
||||
//if ($num_rows > 0 && !isset($customer['id'])) {
|
||||
// throw new Exception('Given email address belongs to another customer record. '
|
||||
// . 'Please use a different email.');
|
||||
//}
|
||||
$customer_id = (isset($customer['id'])) ? $customer['id'] : '';
|
||||
|
||||
$num_rows = $this->db
|
||||
->select('*')
|
||||
->from('ea_users')
|
||||
->join('ea_roles', 'ea_roles.id = ea_users.id_roles', 'inner')
|
||||
->where('ea_roles.slug', DB_SLUG_CUSTOMER)
|
||||
->where('ea_users.email', $customer['email'])
|
||||
->where('ea_users.id <>', $customer_id)
|
||||
->get()
|
||||
->num_rows();
|
||||
|
||||
if ($num_rows > 0) {
|
||||
throw new Exception('Given email address belongs to another customer record. '
|
||||
. 'Please use a different email.');
|
||||
}
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
|
|
@ -251,16 +251,19 @@ class Providers_Model extends CI_Model {
|
|||
}
|
||||
|
||||
// When inserting a record the email address must be unique.
|
||||
$provider_id = (isset($provider['id'])) ? $provider['id'] : '';
|
||||
|
||||
$num_rows = $this->db
|
||||
->select('*')
|
||||
->from('ea_users')
|
||||
->join('ea_roles', 'ea_roles.id = ea_users.id_roles', 'inner')
|
||||
->where('ea_roles.slug', DB_SLUG_PROVIDER)
|
||||
->where('ea_users.email', $provider['email'])
|
||||
->where('ea_users.id <>', $provider_id)
|
||||
->get()
|
||||
->num_rows();
|
||||
|
||||
if ($num_rows > 0 && !isset($provider['id'])) {
|
||||
if ($num_rows > 0) {
|
||||
throw new Exception('Given email address belongs to another provider record. '
|
||||
. 'Please use a different email.');
|
||||
}
|
||||
|
|
|
@ -219,16 +219,19 @@ class Secretaries_Model extends CI_Model {
|
|||
}
|
||||
|
||||
// When inserting a record the email address must be unique.
|
||||
$secretary_id = (isset($secretary['id'])) ? $secretary['id'] : '';
|
||||
|
||||
$num_rows = $this->db
|
||||
->select('*')
|
||||
->from('ea_users')
|
||||
->join('ea_roles', 'ea_roles.id = ea_users.id_roles', 'inner')
|
||||
->where('ea_roles.slug', DB_SLUG_SECRETARY)
|
||||
->where('ea_users.email', $secretary['email'])
|
||||
->where('ea_users.id <>', $secretary_id)
|
||||
->get()
|
||||
->num_rows();
|
||||
|
||||
if ($num_rows > 0 && !isset($secretary['id'])) {
|
||||
if ($num_rows > 0) {
|
||||
throw new Exception('Given email address belongs to another secretary record. '
|
||||
. 'Please use a different email.');
|
||||
}
|
||||
|
|
|
@ -325,6 +325,8 @@
|
|||
official Google Group for answers. You might also need to create a new issue
|
||||
on the Google Code page in order to help the development progress.
|
||||
<br><br>
|
||||
<a href="http://easyappointments.org">Official Website</a>
|
||||
|
|
||||
<a href="https://plus.google.com/communities/105333709485142846840">
|
||||
Google+ Community</a>
|
||||
|
|
||||
|
|
Loading…
Reference in a new issue