mirror of
https://github.com/alextselegidis/easyappointments.git
synced 2024-12-22 14:42:23 +03:00
Merge branch 'fix-validation' of https://github.com/DiGitHubCap/easyappointments into DiGitHubCap-fix-validation
# Conflicts: # src/application/models/Customers_model.php
This commit is contained in:
commit
57209cf157
1 changed files with 6 additions and 5 deletions
|
@ -68,7 +68,7 @@ class Customers_Model extends CI_Model {
|
|||
*/
|
||||
public function exists($customer)
|
||||
{
|
||||
if ( ! isset($customer['email']))
|
||||
if (empty($customer['email']))
|
||||
{
|
||||
throw new Exception('Customer\'s email is not provided.');
|
||||
}
|
||||
|
@ -163,7 +163,7 @@ class Customers_Model extends CI_Model {
|
|||
*/
|
||||
public function find_record_id($customer)
|
||||
{
|
||||
if ( ! isset($customer['email']))
|
||||
if (empty($customer['email']))
|
||||
{
|
||||
throw new Exception('Customer\'s email was not provided: '
|
||||
. print_r($customer, TRUE));
|
||||
|
@ -216,9 +216,10 @@ class Customers_Model extends CI_Model {
|
|||
$phone_number_required = $query->num_rows() > 0 ? $query->row() === '1' : false;
|
||||
|
||||
// Validate required fields
|
||||
if ( ! isset($customer['last_name'])
|
||||
|| ! isset($customer['email'])
|
||||
|| (!isset($customer['phone_number']) && $phone_number_required))
|
||||
if ( empty($customer['first_name'])
|
||||
|| empty($customer['last_name'])
|
||||
|| empty($customer['email'])
|
||||
|| (empty($customer['phone_number']) && $phone_number_required))
|
||||
{
|
||||
throw new Exception('Not all required fields are provided: '
|
||||
. print_r($customer, TRUE));
|
||||
|
|
Loading…
Reference in a new issue