From 66dfd36d6d6a1743fc4afc9673820661d6556407 Mon Sep 17 00:00:00 2001 From: Alex Tselegidis Date: Fri, 30 Jun 2023 19:04:35 +0200 Subject: [PATCH] Fix the booking settings require-notes setting application, as it should check on the appointment notes and not the customer ones --- application/models/Appointments_model.php | 4 ++++ application/models/Customers_model.php | 2 -- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/application/models/Appointments_model.php b/application/models/Appointments_model.php index 4a96eb3b..1c385d56 100644 --- a/application/models/Appointments_model.php +++ b/application/models/Appointments_model.php @@ -92,12 +92,16 @@ class Appointments_model extends EA_Model { } // Make sure all required fields are provided. + + $require_notes = filter_var(setting('require_notes'), FILTER_VALIDATE_BOOLEAN); + if ( empty($appointment['start_datetime']) || empty($appointment['end_datetime']) || empty($appointment['id_services']) || empty($appointment['id_users_provider']) || empty($appointment['id_users_customer']) + || (empty($appointment['notes']) && $require_notes) ) { throw new InvalidArgumentException('Not all required fields are provided: ' . print_r($appointment, TRUE)); diff --git a/application/models/Customers_model.php b/application/models/Customers_model.php index f00e1905..994034fc 100644 --- a/application/models/Customers_model.php +++ b/application/models/Customers_model.php @@ -101,7 +101,6 @@ class Customers_model extends EA_Model { $require_address = filter_var(setting('require_address'), FILTER_VALIDATE_BOOLEAN); $require_city = filter_var(setting('require_city'), FILTER_VALIDATE_BOOLEAN); $require_zip_code = filter_var(setting('require_zip_code'), FILTER_VALIDATE_BOOLEAN); - $require_notes = filter_var(setting('require_notes'), FILTER_VALIDATE_BOOLEAN); if ( (empty($customer['first_name']) && $require_first_name) @@ -111,7 +110,6 @@ class Customers_model extends EA_Model { || (empty($customer['address']) && $require_address) || (empty($customer['city']) && $require_city) || (empty($customer['zip_code']) && $require_zip_code) - || (empty($customer['notes']) && $require_notes) ) { throw new InvalidArgumentException('Not all required fields are provided: ' . print_r($customer, TRUE));