* 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'];
|
$appointment = $post_data['appointment'];
|
||||||
$customer = $post_data['customer'];
|
$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);
|
$customer_id = $this->customers_model->add($customer);
|
||||||
$appointment['id_users_customer'] = $customer_id;
|
$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.
|
// When inserting a record the email address must be unique.
|
||||||
|
$admin_id = (isset($admin['id'])) ? $admin['id'] : '';
|
||||||
|
|
||||||
$num_rows = $this->db
|
$num_rows = $this->db
|
||||||
->select('*')
|
->select('*')
|
||||||
->from('ea_users')
|
->from('ea_users')
|
||||||
->join('ea_roles', 'ea_roles.id = ea_users.id_roles', 'inner')
|
->join('ea_roles', 'ea_roles.id = ea_users.id_roles', 'inner')
|
||||||
->where('ea_roles.slug', DB_SLUG_ADMIN)
|
->where('ea_roles.slug', DB_SLUG_ADMIN)
|
||||||
->where('ea_users.email', $admin['email'])
|
->where('ea_users.email', $admin['email'])
|
||||||
|
->where('ea_users.id <>', $admin_id)
|
||||||
->get()
|
->get()
|
||||||
->num_rows();
|
->num_rows();
|
||||||
|
|
||||||
if ($num_rows > 0 && !isset($admin['id'])) {
|
if ($num_rows > 0) {
|
||||||
throw new Exception('Given email address belongs to another admin record. '
|
throw new Exception('Given email address belongs to another admin record. '
|
||||||
. 'Please use a different email.');
|
. '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.
|
// When inserting a record the email address must be unique.
|
||||||
//$num_rows = $this->db
|
$customer_id = (isset($customer['id'])) ? $customer['id'] : '';
|
||||||
// ->select('*')
|
|
||||||
// ->from('ea_users')
|
$num_rows = $this->db
|
||||||
// ->join('ea_roles', 'ea_roles.id = ea_users.id_roles', 'inner')
|
->select('*')
|
||||||
// ->where('ea_roles.slug', DB_SLUG_CUSTOMER)
|
->from('ea_users')
|
||||||
// ->where('ea_users.email', $customer['email'])
|
->join('ea_roles', 'ea_roles.id = ea_users.id_roles', 'inner')
|
||||||
// ->get()
|
->where('ea_roles.slug', DB_SLUG_CUSTOMER)
|
||||||
// ->num_rows();
|
->where('ea_users.email', $customer['email'])
|
||||||
//
|
->where('ea_users.id <>', $customer_id)
|
||||||
//if ($num_rows > 0 && !isset($customer['id'])) {
|
->get()
|
||||||
// throw new Exception('Given email address belongs to another customer record. '
|
->num_rows();
|
||||||
// . 'Please use a different email.');
|
|
||||||
//}
|
if ($num_rows > 0) {
|
||||||
|
throw new Exception('Given email address belongs to another customer record. '
|
||||||
|
. 'Please use a different email.');
|
||||||
|
}
|
||||||
|
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
|
@ -251,16 +251,19 @@ class Providers_Model extends CI_Model {
|
||||||
}
|
}
|
||||||
|
|
||||||
// When inserting a record the email address must be unique.
|
// When inserting a record the email address must be unique.
|
||||||
|
$provider_id = (isset($provider['id'])) ? $provider['id'] : '';
|
||||||
|
|
||||||
$num_rows = $this->db
|
$num_rows = $this->db
|
||||||
->select('*')
|
->select('*')
|
||||||
->from('ea_users')
|
->from('ea_users')
|
||||||
->join('ea_roles', 'ea_roles.id = ea_users.id_roles', 'inner')
|
->join('ea_roles', 'ea_roles.id = ea_users.id_roles', 'inner')
|
||||||
->where('ea_roles.slug', DB_SLUG_PROVIDER)
|
->where('ea_roles.slug', DB_SLUG_PROVIDER)
|
||||||
->where('ea_users.email', $provider['email'])
|
->where('ea_users.email', $provider['email'])
|
||||||
|
->where('ea_users.id <>', $provider_id)
|
||||||
->get()
|
->get()
|
||||||
->num_rows();
|
->num_rows();
|
||||||
|
|
||||||
if ($num_rows > 0 && !isset($provider['id'])) {
|
if ($num_rows > 0) {
|
||||||
throw new Exception('Given email address belongs to another provider record. '
|
throw new Exception('Given email address belongs to another provider record. '
|
||||||
. 'Please use a different email.');
|
. '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.
|
// When inserting a record the email address must be unique.
|
||||||
|
$secretary_id = (isset($secretary['id'])) ? $secretary['id'] : '';
|
||||||
|
|
||||||
$num_rows = $this->db
|
$num_rows = $this->db
|
||||||
->select('*')
|
->select('*')
|
||||||
->from('ea_users')
|
->from('ea_users')
|
||||||
->join('ea_roles', 'ea_roles.id = ea_users.id_roles', 'inner')
|
->join('ea_roles', 'ea_roles.id = ea_users.id_roles', 'inner')
|
||||||
->where('ea_roles.slug', DB_SLUG_SECRETARY)
|
->where('ea_roles.slug', DB_SLUG_SECRETARY)
|
||||||
->where('ea_users.email', $secretary['email'])
|
->where('ea_users.email', $secretary['email'])
|
||||||
|
->where('ea_users.id <>', $secretary_id)
|
||||||
->get()
|
->get()
|
||||||
->num_rows();
|
->num_rows();
|
||||||
|
|
||||||
if ($num_rows > 0 && !isset($secretary['id'])) {
|
if ($num_rows > 0) {
|
||||||
throw new Exception('Given email address belongs to another secretary record. '
|
throw new Exception('Given email address belongs to another secretary record. '
|
||||||
. 'Please use a different email.');
|
. 'Please use a different email.');
|
||||||
}
|
}
|
||||||
|
|
|
@ -325,6 +325,8 @@
|
||||||
official Google Group for answers. You might also need to create a new issue
|
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.
|
on the Google Code page in order to help the development progress.
|
||||||
<br><br>
|
<br><br>
|
||||||
|
<a href="http://easyappointments.org">Official Website</a>
|
||||||
|
|
|
||||||
<a href="https://plus.google.com/communities/105333709485142846840">
|
<a href="https://plus.google.com/communities/105333709485142846840">
|
||||||
Google+ Community</a>
|
Google+ Community</a>
|
||||||
|
|
|
|
||||||
|
|
Loading…
Reference in a new issue