Fix the booking settings require-notes setting application, as it should check on the appointment notes and not the customer ones

This commit is contained in:
Alex Tselegidis 2023-06-30 19:04:35 +02:00
parent 80d91779d7
commit 66dfd36d6d
2 changed files with 4 additions and 2 deletions

View file

@ -92,12 +92,16 @@ class Appointments_model extends EA_Model {
} }
// Make sure all required fields are provided. // Make sure all required fields are provided.
$require_notes = filter_var(setting('require_notes'), FILTER_VALIDATE_BOOLEAN);
if ( if (
empty($appointment['start_datetime']) empty($appointment['start_datetime'])
|| empty($appointment['end_datetime']) || empty($appointment['end_datetime'])
|| empty($appointment['id_services']) || empty($appointment['id_services'])
|| empty($appointment['id_users_provider']) || empty($appointment['id_users_provider'])
|| empty($appointment['id_users_customer']) || empty($appointment['id_users_customer'])
|| (empty($appointment['notes']) && $require_notes)
) )
{ {
throw new InvalidArgumentException('Not all required fields are provided: ' . print_r($appointment, TRUE)); throw new InvalidArgumentException('Not all required fields are provided: ' . print_r($appointment, TRUE));

View file

@ -101,7 +101,6 @@ class Customers_model extends EA_Model {
$require_address = filter_var(setting('require_address'), FILTER_VALIDATE_BOOLEAN); $require_address = filter_var(setting('require_address'), FILTER_VALIDATE_BOOLEAN);
$require_city = filter_var(setting('require_city'), 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_zip_code = filter_var(setting('require_zip_code'), FILTER_VALIDATE_BOOLEAN);
$require_notes = filter_var(setting('require_notes'), FILTER_VALIDATE_BOOLEAN);
if ( if (
(empty($customer['first_name']) && $require_first_name) (empty($customer['first_name']) && $require_first_name)
@ -111,7 +110,6 @@ class Customers_model extends EA_Model {
|| (empty($customer['address']) && $require_address) || (empty($customer['address']) && $require_address)
|| (empty($customer['city']) && $require_city) || (empty($customer['city']) && $require_city)
|| (empty($customer['zip_code']) && $require_zip_code) || (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)); throw new InvalidArgumentException('Not all required fields are provided: ' . print_r($customer, TRUE));