diff --git a/src/application/config/constants.php b/src/application/config/constants.php index d9265a83..cd2f8507 100644 --- a/src/application/config/constants.php +++ b/src/application/config/constants.php @@ -81,5 +81,8 @@ define('ANY_PROVIDER', 'any-provider'); define('CALENDAR_VIEW_DEFAULT', 'default'); define('CALENDAR_VIEW_TABLE', 'table'); +define('AVAILABILITIES_TYPE_FLEXIBLE', 'flexible'); +define('AVAILABILITIES_TYPE_FIXED', 'fixed'); + /* End of file constants.php */ /* Location: ./application/config/constants.php */ diff --git a/src/application/models/Services_model.php b/src/application/models/Services_model.php index c3c840ab..9f582599 100644 --- a/src/application/models/Services_model.php +++ b/src/application/models/Services_model.php @@ -135,6 +135,13 @@ class Services_Model extends CI_Model { } } + // Availabilities type must have the correct value. + if ($service['availabilities_type'] !== NULL && $service['availabilities_type'] !== AVAILABILITIES_TYPE_FLEXIBLE + && $service['availabilities_type'] !== AVAILABILITIES_TYPE_FIXED) { + throw new Exception('Service availabilities type must be either ' . AVAILABILITIES_TYPE_FLEXIBLE + . ' or ' . AVAILABILITIES_TYPE_FIXED . ' (given ' . $service['availabilities_type'] . ')'); + } + return TRUE; } diff --git a/src/application/views/backend/services.php b/src/application/views/backend/services.php index 2258700c..d408f538 100644 --- a/src/application/views/backend/services.php +++ b/src/application/views/backend/services.php @@ -119,6 +119,18 @@ +