diff --git a/.gitignore b/.gitignore index e0de0c53..f8d1dd06 100644 --- a/.gitignore +++ b/.gitignore @@ -22,7 +22,7 @@ !/storage/sessions/.htaccess !/storage/sessions/index.html /storage/uploads/* -/!storage/uploads/index.html +!/storage/uploads/index.html /vendor/ /metafile .DS_Store diff --git a/CHANGELOG.md b/CHANGELOG.md index 1a66ca83..26e38e4c 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -3,8 +3,73 @@ This file contains the code changes that were introduced into each release (starting from v1.1.0) so that is easy for developers to maintain and readjust their custom modifications on the main project codebase. -The format is based on [Keep a Changelog](http://keepachangelog.com/en/1.0.0) -and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.html). +## [1.4.0] - TBA + +### Added + +- #203: Appointment location / 12-hour format / sync notes and location in Google Calendar. +- #221: Fixed/Improved sort breaks increasingly by hour within day. +- #247: Add new system-wide setting for removing the "Any Provider" option of the booking page. +- #251: Automatically populate the appointment end datetime in API. +- #301: Automatically reload the backend calendar events. +- #313: How to set the timezone from the user booking the appointment. +- #365: Only allow appointments for a few weeks in advance. +- #431: Add support for working plan exceptions. +- #471: Add new system-wide setting that enable users to choose the first day of the week. +- #496: Add pagination on every backend page in order to make filter requests faster. +- #501: Integrate script for assets minification. +- #502: Config::DEBUG value toggles the use of normal or minified asset files. +- #546: Add appointment edit link in the backend customers page. +- #550: Multi-Lang Front-End selection popup not working on mobile. +- #551: Front-End booking calendar not syncing with business logic working plan. +- #572: Ensure the database structure is compatible to at least MySQL 5.5. +- #576: Appointment cancelled exception not showing properly. +- #610: Token based authentication for the Rest API. +- #648: Add a warning when customers delete their personal information. +- #655: Creating an appointment requires user to enter their phone number enhancement. +- #659: Automatically detect browser language enhancement. +- #663: Language selector not working under legacy iOS (v.10.3.1). +- #680: Generate new password in the generate_random_string function may create duplicate passwords, plus it is not secure enough. +- #739: Enhance the table view mode by replacing the tables with fullcalendar instances. +- #770: Store customer's language and use it with notifications or when the customer manages and existing appointment. +- #889: Notify admins and secretaries on appointment changes. + + +### Changed + +- #386: Service price should be optional. +- #428: Enable book advance timeout values in days. +- #568: Sort providers alphabetically in the booking page. +- #745: Add appointment notes preview in the event popover. + + +### Fixed + +- #171: Google calendar sync - wrong timezone for appointments. +- #195: Fix Google calendar sync activation error (JavaScript). +- #298: Provider availability issue when selecting the "Any Provider" option. +- #396: Start and end time do not update correctly during calendar time selection on iPad (and other Safari based devices). +- #447: Captcha error using docker (500 error). +- #506: Working plan created in version v1.2.1 wrongly displayed in backend with version v1.3.1. +- #507: Need to manually clean the cache when migrating from v1.2.1 to v1.3.1. +- #541: Can't remove (empty) customer notes field. +- #549: Querying appointments API endpoint with the q parmeter produces PHP warnings. +- #557: App not connecting to MySQL with fresh docker run. +- #562: Unavailability periods with length of more than 1 day are not handled correctly. +- #563: Description field overflows with long text. +- #600: Unable to select Language on mobile phones. +- #611: Double replacement when using translation to other languages. +- #664: Easy!Appointments v1.3.2 allows sensitive information disclosure (username and password hash). +- #687: Errors when the provider modifies an appointment. +- #705: The alert notification of the installation is not being displayed on error. +- #757: Corrected display of datetimepickers when editing events. +- #801: Invalid time duration during appointment registration could lead to DOS of the service. +- #813: Hyperlinks are not being displayed correctly inside legal contents (they are escaped). +- #839: Provider is missing on appointment modal opened after a click on the link sent with the provider email confirmation. +- #840: Start/end datetime are not correctly initialized on Safari when the appointment modal is opened after a click in the backend calendar. +- #883: Appointment date is wrongly changed to today in some case. +- #903: Notification not working when creating/updating/deleting an appointment from the REST API. + ## [1.3.2] - 2018-07-29 diff --git a/README.md b/README.md index e028d322..ae2c6473 100644 --- a/README.md +++ b/README.md @@ -11,7 +11,7 @@

- A powerful Open Source Web Scheduler that can be installed on your server. + A powerful Open Source Appointment Scheduler that can be installed on your server.

diff --git a/application/config/config.php b/application/config/config.php index a6a841bb..689728e4 100644 --- a/application/config/config.php +++ b/application/config/config.php @@ -185,7 +185,7 @@ $config['enable_hooks'] = TRUE; | http://codeigniter.com/user_guide/general/creating_libraries.html | */ -$config['subclass_prefix'] = 'MY_'; +$config['subclass_prefix'] = 'EA_'; /* diff --git a/application/controllers/Appointments.php b/application/controllers/Appointments.php index 5a6c117d..1caba10f 100755 --- a/application/controllers/Appointments.php +++ b/application/controllers/Appointments.php @@ -6,42 +6,17 @@ * @package EasyAppointments * @author A.Tselegidis * @copyright Copyright (c) 2013 - 2020, Alex Tselegidis - * @license http://opensource.org/licenses/GPL-3.0 - GPLv3 - * @link http://easyappointments.org + * @license https://opensource.org/licenses/GPL-3.0 - GPLv3 + * @link https://easyappointments.org * @since v1.0.0 * ---------------------------------------------------------------------------- */ /** * Appointments Controller * - * @property CI_Session $session - * @property CI_Loader $load - * @property CI_Input $input - * @property CI_Output $output - * @property CI_Config $config - * @property CI_Lang $lang - * @property CI_Cache $cache - * @property CI_DB_query_builder $db - * @property CI_Security $security - * @property Google_Sync $google_sync - * @property Ics_file $ics_file - * @property Appointments_Model $appointments_model - * @property Providers_Model $providers_model - * @property Services_Model $services_model - * @property Customers_Model $customers_model - * @property Settings_Model $settings_model - * @property Roles_Model $roles_model - * @property Secretaries_Model $secretaries_model - * @property Admins_Model $admins_model - * @property User_Model $user_model - * @property Timezones $timezones - * @property Synchronization $synchronization - * @property Notifications $notifications - * @property Availability $availability - * * @package Controllers */ -class Appointments extends CI_Controller { +class Appointments extends EA_Controller { /** * Class Constructor */ @@ -51,6 +26,7 @@ class Appointments extends CI_Controller { $this->load->helper('installation'); $this->load->helper('google_analytics'); + $this->load->model('appointments_model'); $this->load->model('providers_model'); $this->load->model('admins_model'); @@ -58,12 +34,15 @@ class Appointments extends CI_Controller { $this->load->model('services_model'); $this->load->model('customers_model'); $this->load->model('settings_model'); + $this->load->library('session'); $this->load->library('timezones'); $this->load->library('synchronization'); $this->load->library('notifications'); $this->load->library('availability'); + $this->load->driver('cache', ['adapter' => 'file']); + if ($this->session->userdata('language')) { // Set the user's selected language. @@ -175,8 +154,6 @@ class Appointments extends CI_Controller { $customer_token = md5(uniqid(mt_rand(), TRUE)); - $this->load->driver('cache', ['adapter' => 'file']); - // Save the token for 10 minutes. $this->cache->save('customer-token-' . $customer_token, $customer['id'], 600); } @@ -307,7 +284,6 @@ class Appointments extends CI_Controller { unset($appointment['notes']); $provider = $this->providers_model->get_row($appointment['id_users_provider']); - unset($provider['settings'], $provider['notes']); $service = $this->services_model->get_row($appointment['id_services']); @@ -318,7 +294,13 @@ class Appointments extends CI_Controller { $view = [ 'appointment_data' => $appointment, - 'provider_data' => $provider, + 'provider_data' => [ + 'id' => $provider['id'], + 'first_name' => $provider['first_name'], + 'last_name' => $provider['last_name'], + 'email' => $provider['email'], + 'timezone' => $provider['timezone'], + ], 'service_data' => $service, 'company_name' => $company_name, ]; @@ -365,7 +347,7 @@ class Appointments extends CI_Controller { // that will provide the requested service. if ($provider_id === ANY_PROVIDER) { - $provider_id = $this->search_any_provider($service_id, $selected_date); + $provider_id = $this->search_any_provider($selected_date, $service_id); if ($provider_id === NULL) { @@ -451,16 +433,6 @@ class Appointments extends CI_Controller { { try { - $this->load->model('appointments_model'); - $this->load->model('providers_model'); - $this->load->model('admins_model'); - $this->load->model('secretaries_model'); - $this->load->model('services_model'); - $this->load->model('customers_model'); - $this->load->model('settings_model'); - $this->load->library('notifications'); - $this->load->library('synchronization'); - $post_data = $this->input->post('post_data'); $captcha = $this->input->post('captcha'); $manage_mode = filter_var($post_data['manage_mode'], FILTER_VALIDATE_BOOLEAN); @@ -578,23 +550,15 @@ class Appointments extends CI_Controller { $provider = $this->providers_model->get_row($appointment['id_users_provider']); - $available_periods = $this->availability->get_available_periods($date, $provider, $exclude_appointment_id); + $available_hours = $this->availability->get_available_hours($date, $service, $provider, $exclude_appointment_id); $is_still_available = FALSE; - foreach ($available_periods as $available_period) + $appointment_hour = date('H:i', strtotime($appointment['start_datetime'])); + + foreach ($available_hours as $available_hour) { - $appointment_start = new DateTime($appointment['start_datetime']); - $appointment_start = $appointment_start->format('H:i'); - - $appointment_end = new DateTime($appointment['start_datetime']); - $appointment_end->add(new DateInterval('PT' . $service['duration'] . 'M')); - $appointment_end = $appointment_end->format('H:i'); - - $available_period_start = date('H:i', strtotime($available_period['start'])); - $available_period_end = date('H:i', strtotime($available_period['end'])); - - if ($available_period_start <= $appointment_start && $available_period_end >= $appointment_end) + if ($appointment_hour === $available_hour) { $is_still_available = TRUE; break; @@ -617,9 +581,6 @@ class Appointments extends CI_Controller { { try { - $this->load->model('providers_model'); - $this->load->model('services_model'); - $provider_id = $this->input->get('provider_id'); $service_id = $this->input->get('service_id'); $appointment_id = $this->input->get_post('appointment_id'); @@ -702,7 +663,6 @@ class Appointments extends CI_Controller { */ protected function search_providers_by_service($service_id) { - $this->load->model('providers_model'); $available_providers = $this->providers_model->get_available_providers(); $provider_list = []; diff --git a/application/controllers/Backend.php b/application/controllers/Backend.php index 10036304..3b81b1f8 100755 --- a/application/controllers/Backend.php +++ b/application/controllers/Backend.php @@ -6,8 +6,8 @@ * @package EasyAppointments * @author A.Tselegidis * @copyright Copyright (c) 2013 - 2020, Alex Tselegidis - * @license http://opensource.org/licenses/GPL-3.0 - GPLv3 - * @link http://easyappointments.org + * @license https://opensource.org/licenses/GPL-3.0 - GPLv3 + * @link https://easyappointments.org * @since v1.0.0 * ---------------------------------------------------------------------------- */ @@ -15,37 +15,30 @@ * Backend Controller * * @property CI_Session $session - * @property CI_Loader $load - * @property CI_Input $input - * @property CI_Output $output - * @property CI_Config $config - * @property CI_Lang $lang - * @property CI_Cache $cache - * @property CI_DB_query_builder $db - * @property CI_Security $security - * @property Google_Sync $google_sync - * @property Ics_file $ics_file - * @property Appointments_Model $appointments_model - * @property Providers_Model $providers_model - * @property Services_Model $services_model - * @property Customers_Model $customers_model - * @property Settings_Model $settings_model - * @property Timezones $timezones - * @property Roles_Model $roles_model - * @property Secretaries_Model $secretaries_model - * @property Admins_Model $admins_model - * @property User_Model $user_model * * @package Controllers */ -class Backend extends CI_Controller { +class Backend extends EA_Controller { /** * Class Constructor */ public function __construct() { parent::__construct(); + + $this->load->model('appointments_model'); + $this->load->model('providers_model'); + $this->load->model('services_model'); + $this->load->model('customers_model'); + $this->load->model('settings_model'); + $this->load->model('roles_model'); + $this->load->model('user_model'); + $this->load->model('secretaries_model'); + $this->load->model('admins_model'); + + $this->load->library('timezones'); $this->load->library('session'); + $this->load->library('migration'); if ($this->session->userdata('language')) { @@ -80,16 +73,6 @@ class Backend extends CI_Controller { return; } - $this->load->model('appointments_model'); - $this->load->model('providers_model'); - $this->load->model('services_model'); - $this->load->model('customers_model'); - $this->load->model('settings_model'); - $this->load->model('roles_model'); - $this->load->model('user_model'); - $this->load->model('secretaries_model'); - $this->load->library('timezones'); - $calendar_view_query_param = $this->input->get('view'); $user_id = $this->session->userdata('user_id'); @@ -196,9 +179,6 @@ class Backend extends CI_Controller { */ protected function set_user_data(&$view) { - $this->load->model('roles_model'); - - // Get privileges $view['user_id'] = $this->session->userdata('user_id'); $view['user_email'] = $this->session->userdata('user_email'); $view['timezone'] = $this->session->userdata('timezone'); @@ -220,14 +200,6 @@ class Backend extends CI_Controller { return; } - $this->load->model('providers_model'); - $this->load->model('customers_model'); - $this->load->model('secretaries_model'); - $this->load->model('services_model'); - $this->load->model('settings_model'); - $this->load->model('user_model'); - $this->load->library('timezones'); - $view['base_url'] = $this->config->item('base_url'); $view['page_title'] = lang('customers'); $view['user_display_name'] = $this->user_model->get_user_display_name($this->session->userdata('user_id')); @@ -276,12 +248,6 @@ class Backend extends CI_Controller { return; } - $this->load->model('customers_model'); - $this->load->model('services_model'); - $this->load->model('settings_model'); - $this->load->model('user_model'); - $this->load->library('timezones'); - $view['base_url'] = $this->config->item('base_url'); $view['page_title'] = lang('services'); $view['user_display_name'] = $this->user_model->get_user_display_name($this->session->userdata('user_id')); @@ -315,14 +281,6 @@ class Backend extends CI_Controller { return; } - $this->load->model('providers_model'); - $this->load->model('secretaries_model'); - $this->load->model('admins_model'); - $this->load->model('services_model'); - $this->load->model('settings_model'); - $this->load->model('user_model'); - $this->load->library('timezones'); - $view['base_url'] = $this->config->item('base_url'); $view['page_title'] = lang('users'); $view['user_display_name'] = $this->user_model->get_user_display_name($this->session->userdata('user_id')); @@ -361,11 +319,6 @@ class Backend extends CI_Controller { return; } - $this->load->model('settings_model'); - $this->load->model('user_model'); - $this->load->library('timezones'); - - $this->load->library('session'); $user_id = $this->session->userdata('user_id'); $view['base_url'] = $this->config->item('base_url'); @@ -412,8 +365,6 @@ class Backend extends CI_Controller { throw new Exception('You do not have the required privileges for this task!'); } - $this->load->library('migration'); - if ( ! $this->migration->current()) { throw new Exception($this->migration->error_string()); diff --git a/application/controllers/Backend_api.php b/application/controllers/Backend_api.php index 5a6e7896..d12cdd1d 100755 --- a/application/controllers/Backend_api.php +++ b/application/controllers/Backend_api.php @@ -6,8 +6,8 @@ * @package EasyAppointments * @author A.Tselegidis * @copyright Copyright (c) 2013 - 2020, Alex Tselegidis - * @license http://opensource.org/licenses/GPL-3.0 - GPLv3 - * @link http://easyappointments.org + * @license https://opensource.org/licenses/GPL-3.0 - GPLv3 + * @link https://easyappointments.org * @since v1.0.0 * ---------------------------------------------------------------------------- */ @@ -21,33 +21,9 @@ use EA\Engine\Types\Url; * * Contains all the backend AJAX callbacks. * - * @property CI_Session $session - * @property CI_Loader $load - * @property CI_Input $input - * @property CI_Output $output - * @property CI_Config $config - * @property CI_Lang $lang - * @property CI_Cache $cache - * @property CI_DB_query_builder $db - * @property CI_Security $security - * @property Google_Sync $google_sync - * @property Ics_file $ics_file - * @property Appointments_Model $appointments_model - * @property Providers_Model $providers_model - * @property Services_Model $services_model - * @property Customers_Model $customers_model - * @property Settings_Model $settings_model - * @property Timezones $timezones - * @property Synchronization $synchronization - * @property Notifications $notifications - * @property Roles_Model $roles_model - * @property Secretaries_Model $secretaries_model - * @property Admins_Model $admins_model - * @property User_Model $user_model - * * @package Controllers */ -class Backend_api extends CI_Controller { +class Backend_api extends EA_Controller { /** * @var array */ @@ -455,7 +431,7 @@ class Backend_api extends CI_Controller { if ((bool)$send_provider === TRUE) { - $email->sendDeleteAppointment($appointment, $provider, + $email->send_delete_appointment($appointment, $provider, $service, $customer, $settings, new Email($provider['email']), new Text($this->input->post('delete_reason'))); } @@ -464,7 +440,7 @@ class Backend_api extends CI_Controller { if ((bool)$send_customer === TRUE) { - $email->sendDeleteAppointment($appointment, $provider, + $email->send_delete_appointment($appointment, $provider, $service, $customer, $settings, new Email($customer['email']), new Text($this->input->post('delete_reason'))); } @@ -479,7 +455,7 @@ class Backend_api extends CI_Controller { continue; } - $email->sendDeleteAppointment($appointment, $provider, + $email->send_delete_appointment($appointment, $provider, $service, $customer, $settings, new Email($admin['email']), new Text($this->input->post('cancel_reason'))); } @@ -499,7 +475,7 @@ class Backend_api extends CI_Controller { continue; } - $email->sendDeleteAppointment($appointment, $provider, + $email->send_delete_appointment($appointment, $provider, $service, $customer, $settings, new Email($secretary['email']), new Text($this->input->post('cancel_reason'))); } @@ -1565,7 +1541,15 @@ class Backend_api extends CI_Controller { $this->load->model('user_model'); - $this->user_model->save_user(json_decode($this->input->post('settings'), TRUE)); + $settings = json_decode($this->input->post('settings'), TRUE); + + $this->user_model->save_user($settings); + + $this->session->set_userdata([ + 'user_email' => $settings['email'], + 'username' => $settings['settings']['username'], + 'timezone' => $settings['timezone'], + ]); } } diff --git a/application/controllers/Captcha.php b/application/controllers/Captcha.php index 897aa0fa..a1b1d79f 100644 --- a/application/controllers/Captcha.php +++ b/application/controllers/Captcha.php @@ -6,39 +6,17 @@ * @package EasyAppointments * @author A.Tselegidis * @copyright Copyright (c) 2013 - 2020, Alex Tselegidis - * @license http://opensource.org/licenses/GPL-3.0 - GPLv3 - * @link http://easyappointments.org + * @license https://opensource.org/licenses/GPL-3.0 - GPLv3 + * @link https://easyappointments.org * @since v1.0.0 * ---------------------------------------------------------------------------- */ /** * Captcha Controller * - * @property CI_Session $session - * @property CI_Loader $load - * @property CI_Input $input - * @property CI_Output $output - * @property CI_Config $config - * @property CI_Lang $lang - * @property CI_Cache $cache - * @property CI_DB_query_builder $db - * @property CI_Security $security - * @property Google_Sync $google_sync - * @property Ics_file $ics_file - * @property Appointments_Model $appointments_model - * @property Providers_Model $providers_model - * @property Services_Model $services_model - * @property Customers_Model $customers_model - * @property Settings_Model $settings_model - * @property Timezones $timezones - * @property Roles_Model $roles_model - * @property Secretaries_Model $secretaries_model - * @property Admins_Model $admins_model - * @property User_Model $user_model - * * @package Controllers */ -class Captcha extends CI_Controller { +class Captcha extends EA_Controller { /** * Class Constructor */ diff --git a/application/controllers/Consents.php b/application/controllers/Consents.php index bd8e4fb2..7a13215b 100644 --- a/application/controllers/Consents.php +++ b/application/controllers/Consents.php @@ -6,8 +6,8 @@ * @package EasyAppointments * @author A.Tselegidis * @copyright Copyright (c) 2013 - 2020, Alex Tselegidis - * @license http://opensource.org/licenses/GPL-3.0 - GPLv3 - * @link http://easyappointments.org + * @license https://opensource.org/licenses/GPL-3.0 - GPLv3 + * @link https://easyappointments.org * @since v1.3.2 * ---------------------------------------------------------------------------- */ @@ -16,32 +16,9 @@ * * Handles user consent related operations. * - * @property CI_Session $session - * @property CI_Loader $load - * @property CI_Input $input - * @property CI_Output $output - * @property CI_Config $config - * @property CI_Lang $lang - * @property CI_Cache $cache - * @property CI_DB_query_builder $db - * @property CI_Security $security - * @property Google_Sync $google_sync - * @property Ics_file $ics_file - * @property Appointments_Model $appointments_model - * @property Providers_Model $providers_model - * @property Services_Model $services_model - * @property Customers_Model $customers_model - * @property Consents_Model consents_model - * @property Settings_Model $settings_model - * @property Timezones $timezones - * @property Roles_Model $roles_model - * @property Secretaries_Model $secretaries_model - * @property Admins_Model $admins_model - * @property User_Model $user_model - * * @package Controllers */ -class Consents extends CI_Controller { +class Consents extends EA_Controller { /** * Save the user's consent. */ diff --git a/application/controllers/Console.php b/application/controllers/Console.php index afea3f9c..3fc51917 100644 --- a/application/controllers/Console.php +++ b/application/controllers/Console.php @@ -6,8 +6,8 @@ * @package EasyAppointments * @author A.Tselegidis * @copyright Copyright (c) 2013 - 2020, Alex Tselegidis - * @license http://opensource.org/licenses/GPL-3.0 - GPLv3 - * @link http://easyappointments.org + * @license https://opensource.org/licenses/GPL-3.0 - GPLv3 + * @link https://easyappointments.org * @since v1.3.2 * ---------------------------------------------------------------------------- */ @@ -17,11 +17,8 @@ require_once __DIR__ .'/Google.php'; * Class Console * * CLI commands of Easy!Appointments, can only be executed from a terminal and not with a direct request. - * - * @property CI_Migration $migration - * @property Providers_model $providers_model */ -class Console extends CI_Controller { +class Console extends EA_Controller { /** * Console constructor. */ diff --git a/application/controllers/Errors.php b/application/controllers/Errors.php index 425a35ed..2ac03765 100644 --- a/application/controllers/Errors.php +++ b/application/controllers/Errors.php @@ -6,39 +6,17 @@ * @package EasyAppointments * @author A.Tselegidis * @copyright Copyright (c) 2013 - 2020, Alex Tselegidis - * @license http://opensource.org/licenses/GPL-3.0 - GPLv3 - * @link http://easyappointments.org + * @license https://opensource.org/licenses/GPL-3.0 - GPLv3 + * @link https://easyappointments.org * @since v1.0.0 * ---------------------------------------------------------------------------- */ /** * Errors Controller * - * @property CI_Session $session - * @property CI_Loader $load - * @property CI_Input $input - * @property CI_Output $output - * @property CI_Config $config - * @property CI_Lang $lang - * @property CI_Cache $cache - * @property CI_DB_query_builder $db - * @property CI_Security $security - * @property Google_Sync $google_sync - * @property Ics_file $ics_file - * @property Appointments_Model $appointments_model - * @property Providers_Model $providers_model - * @property Services_Model $services_model - * @property Customers_Model $customers_model - * @property Settings_Model $settings_model - * @property Timezones $timezones - * @property Roles_Model $roles_model - * @property Secretaries_Model $secretaries_model - * @property Admins_Model $admins_model - * @property User_Model $user_model - * * @package Controllers */ -class Errors extends CI_Controller { +class Errors extends EA_Controller { /** * Class Constructor */ diff --git a/application/controllers/Google.php b/application/controllers/Google.php index 455d8908..6b217157 100644 --- a/application/controllers/Google.php +++ b/application/controllers/Google.php @@ -6,8 +6,8 @@ * @package EasyAppointments * @author A.Tselegidis * @copyright Copyright (c) 2013 - 2020, Alex Tselegidis - * @license http://opensource.org/licenses/GPL-3.0 - GPLv3 - * @link http://easyappointments.org + * @license https://opensource.org/licenses/GPL-3.0 - GPLv3 + * @link https://easyappointments.org * @since v1.0.0 * ---------------------------------------------------------------------------- */ @@ -16,31 +16,9 @@ * * This controller handles the Google Calendar synchronization operations. * - * @property CI_Session $session - * @property CI_Loader $load - * @property CI_Input $input - * @property CI_Output $output - * @property CI_Config $config - * @property CI_Lang $lang - * @property CI_Cache $cache - * @property CI_DB_query_builder $db - * @property CI_Security $security - * @property Google_Sync $google_sync - * @property Ics_file $ics_file - * @property Appointments_Model $appointments_model - * @property Providers_Model $providers_model - * @property Services_Model $services_model - * @property Customers_Model $customers_model - * @property Settings_Model $settings_model - * @property Timezones $timezones - * @property Roles_Model $roles_model - * @property Secretaries_Model $secretaries_model - * @property Admins_Model $admins_model - * @property User_Model $user_model - * * @package Controllers */ -class Google extends CI_Controller { +class Google extends EA_Controller { /** * Class Constructor */ diff --git a/application/controllers/Installation.php b/application/controllers/Installation.php index bfb2c5a6..f7c75abc 100644 --- a/application/controllers/Installation.php +++ b/application/controllers/Installation.php @@ -6,8 +6,8 @@ * @package EasyAppointments * @author A.Tselegidis * @copyright Copyright (c) 2013 - 2020, Alex Tselegidis - * @license http://opensource.org/licenses/GPL-3.0 - GPLv3 - * @link http://easyappointments.org + * @license https://opensource.org/licenses/GPL-3.0 - GPLv3 + * @link https://easyappointments.org * @since v1.1.0 * ---------------------------------------------------------------------------- */ @@ -16,32 +16,9 @@ * * This controller will handle the installation procedure of Easy!Appointments. * - * @property CI_Session $session - * @property CI_Loader $load - * @property CI_Input $input - * @property CI_Output $output - * @property CI_Config $config - * @property CI_Lang $lang - * @property CI_Cache $cache - * @property CI_DB_query_builder $db - * @property CI_Security $security - * @property CI_Migration migration - * @property Google_Sync $google_sync - * @property Ics_file $ics_file - * @property Appointments_Model $appointments_model - * @property Providers_Model $providers_model - * @property Services_Model $services_model - * @property Customers_Model $customers_model - * @property Settings_Model $settings_model - * @property Timezones $timezones - * @property Roles_Model $roles_model - * @property Secretaries_Model $secretaries_model - * @property Admins_Model $admins_model - * @property User_Model $user_model - * * @package Controllers */ -class Installation extends CI_Controller { +class Installation extends EA_Controller { /** * Class Constructor */ @@ -72,7 +49,7 @@ class Installation extends CI_Controller { { if (is_app_installed()) { - redirect('appointments/index'); + redirect('appointments'); return; } diff --git a/application/controllers/Privacy.php b/application/controllers/Privacy.php index cf8647f3..08073a0d 100644 --- a/application/controllers/Privacy.php +++ b/application/controllers/Privacy.php @@ -6,39 +6,17 @@ * @package EasyAppointments * @author A.Tselegidis * @copyright Copyright (c) 2013 - 2020, Alex Tselegidis - * @license http://opensource.org/licenses/GPL-3.0 - GPLv3 - * @link http://easyappointments.org + * @license https://opensource.org/licenses/GPL-3.0 - GPLv3 + * @link https://easyappointments.org * @since v1.3.2 * ---------------------------------------------------------------------------- */ /** * Class Privacy * - * @property CI_Session $session - * @property CI_Loader $load - * @property CI_Input $input - * @property CI_Output $output - * @property CI_Config $config - * @property CI_Lang $lang - * @property CI_Cache $cache - * @property CI_DB_query_builder $db - * @property CI_Security $security - * @property Google_Sync $google_sync - * @property Ics_file $ics_file - * @property Appointments_Model $appointments_model - * @property Providers_Model $providers_model - * @property Services_Model $services_model - * @property Customers_Model $customers_model - * @property Settings_Model $settings_model - * @property Timezones $timezones - * @property Roles_Model $roles_model - * @property Secretaries_Model $secretaries_model - * @property Admins_Model $admins_model - * @property User_Model $user_model - * * @package Controllers */ -class Privacy extends CI_Controller { +class Privacy extends EA_Controller { /** * Remove all customer data (including appointments from the system). */ diff --git a/application/controllers/User.php b/application/controllers/User.php index 4223773e..6895f5a4 100644 --- a/application/controllers/User.php +++ b/application/controllers/User.php @@ -6,8 +6,8 @@ * @package EasyAppointments * @author A.Tselegidis * @copyright Copyright (c) 2013 - 2020, Alex Tselegidis - * @license http://opensource.org/licenses/GPL-3.0 - GPLv3 - * @link http://easyappointments.org + * @license https://opensource.org/licenses/GPL-3.0 - GPLv3 + * @link https://easyappointments.org * @since v1.0.0 * ---------------------------------------------------------------------------- */ @@ -18,31 +18,9 @@ use EA\Engine\Types\NonEmptyText; /** * User Controller * - * @property CI_Session $session - * @property CI_Loader $load - * @property CI_Input $input - * @property CI_Output $output - * @property CI_Config $config - * @property CI_Lang $lang - * @property CI_Cache $cache - * @property CI_DB_query_builder $db - * @property CI_Security $security - * @property Google_Sync $google_sync - * @property Ics_file $ics_file - * @property Appointments_Model $appointments_model - * @property Providers_Model $providers_model - * @property Services_Model $services_model - * @property Customers_Model $customers_model - * @property Settings_Model $settings_model - * @property Timezones $timezones - * @property Roles_Model $roles_model - * @property Secretaries_Model $secretaries_model - * @property Admins_Model $admins_model - * @property User_Model $user_model - * * @package Controllers */ -class User extends CI_Controller { +class User extends EA_Controller { /** * Class Constructor */ @@ -226,7 +204,7 @@ class User extends CI_Controller { 'company_email' => $this->settings_model->get_setting('company_email') ]; - $email->sendPassword(new NonEmptyText($new_password), new Email($this->input->post('email')), + $email->send_password(new NonEmptyText($new_password), new Email($this->input->post('email')), $company_settings); } diff --git a/application/controllers/api/v1/API_V1_Controller.php b/application/controllers/api/v1/API_V1_Controller.php index 4107d45f..f242d44f 100644 --- a/application/controllers/api/v1/API_V1_Controller.php +++ b/application/controllers/api/v1/API_V1_Controller.php @@ -6,8 +6,8 @@ * @package EasyAppointments * @author A.Tselegidis * @copyright Copyright (c) 2013 - 2020, Alex Tselegidis - * @license http://opensource.org/licenses/GPL-3.0 - GPLv3 - * @link http://easyappointments.org + * @license https://opensource.org/licenses/GPL-3.0 - GPLv3 + * @link https://easyappointments.org * @since v1.2.0 * ---------------------------------------------------------------------------- */ @@ -22,7 +22,7 @@ use EA\Engine\Types\NonEmptyText; * * @package Controllers */ -class API_V1_Controller extends CI_Controller { +class API_V1_Controller extends EA_Controller { /** * Class Constructor * @@ -150,7 +150,7 @@ class API_V1_Controller extends CI_Controller { ]; $header = $exception instanceof \EA\Engine\Api\V1\Exception - ? $exception->getCode() . ' ' . $exception->getHeader() + ? $exception->getCode() . ' ' . $exception->get_header() : '500 Internal Server Error'; header('HTTP/1.0 ' . $header); diff --git a/application/controllers/api/v1/Admins.php b/application/controllers/api/v1/Admins.php index d2dcaf51..c67c4aff 100644 --- a/application/controllers/api/v1/Admins.php +++ b/application/controllers/api/v1/Admins.php @@ -6,8 +6,8 @@ * @package EasyAppointments * @author A.Tselegidis * @copyright Copyright (c) 2013 - 2020, Alex Tselegidis - * @license http://opensource.org/licenses/GPL-3.0 - GPLv3 - * @link http://easyappointments.org + * @license https://opensource.org/licenses/GPL-3.0 - GPLv3 + * @link https://easyappointments.org * @since v1.2.0 * ---------------------------------------------------------------------------- */ @@ -20,28 +20,6 @@ use EA\Engine\Types\NonEmptyText; /** * Admins Controller * - * @property CI_Session $session - * @property CI_Loader $load - * @property CI_Input $input - * @property CI_Output $output - * @property CI_Config $config - * @property CI_Lang $lang - * @property CI_Cache $cache - * @property CI_DB_query_builder $db - * @property CI_Security $security - * @property Google_Sync $google_sync - * @property Ics_file $ics_file - * @property Appointments_Model $appointments_model - * @property Providers_Model $providers_model - * @property Services_Model $services_model - * @property Customers_Model $customers_model - * @property Settings_Model $settings_model - * @property Timezones $timezones - * @property Roles_Model $roles_model - * @property Secretaries_Model $secretaries_model - * @property Admins_Model $admins_model - * @property User_Model $user_model - * * @package Controllers */ class Admins extends API_V1_Controller { @@ -105,7 +83,7 @@ class Admins extends API_V1_Controller { { // Insert the admin to the database. $request = new Request(); - $admin = $request->getBody(); + $admin = $request->get_body(); $this->parser->decode($admin); if (isset($admin['id'])) @@ -145,7 +123,7 @@ class Admins extends API_V1_Controller { } $request = new Request(); - $updatedAdmin = $request->getBody(); + $updatedAdmin = $request->get_body(); $baseAdmin = $batch[0]; $this->parser->decode($updatedAdmin, $baseAdmin); $updatedAdmin['id'] = $id; diff --git a/application/controllers/api/v1/Appointments.php b/application/controllers/api/v1/Appointments.php index 4a7ae2b8..09297b54 100644 --- a/application/controllers/api/v1/Appointments.php +++ b/application/controllers/api/v1/Appointments.php @@ -6,8 +6,8 @@ * @package EasyAppointments * @author A.Tselegidis * @copyright Copyright (c) 2013 - 2020, Alex Tselegidis - * @license http://opensource.org/licenses/GPL-3.0 - GPLv3 - * @link http://easyappointments.org + * @license https://opensource.org/licenses/GPL-3.0 - GPLv3 + * @link https://easyappointments.org * @since v1.2.0 * ---------------------------------------------------------------------------- */ @@ -20,30 +20,6 @@ use EA\Engine\Types\NonEmptyText; /** * Appointments Controller * - * @property CI_Session $session - * @property CI_Loader $load - * @property CI_Input $input - * @property CI_Output $output - * @property CI_Config $config - * @property CI_Lang $lang - * @property CI_Cache $cache - * @property CI_DB_query_builder $db - * @property CI_Security $security - * @property Google_Sync $google_sync - * @property Ics_file $ics_file - * @property Appointments_Model $appointments_model - * @property Providers_Model $providers_model - * @property Services_Model $services_model - * @property Customers_Model $customers_model - * @property Settings_Model $settings_model - * @property Timezones $timezones - * @property Notifications $notifications - * @property Synchronization $synchronization - * @property Roles_Model $roles_model - * @property Secretaries_Model $secretaries_model - * @property Admins_Model $admins_model - * @property User_Model $user_model - * * @package Controllers */ class Appointments extends API_V1_Controller { @@ -121,7 +97,7 @@ class Appointments extends API_V1_Controller { { // Insert the appointment to the database. $request = new Request(); - $appointment = $request->getBody(); + $appointment = $request->get_body(); $this->parser->decode($appointment); if (isset($appointment['id'])) @@ -188,7 +164,7 @@ class Appointments extends API_V1_Controller { } $request = new Request(); - $updated_appointment = $request->getBody(); + $updated_appointment = $request->get_body(); $base_appointment = $batch[0]; $this->parser->decode($updated_appointment, $base_appointment); $updated_appointment['id'] = $id; diff --git a/application/controllers/api/v1/Availabilities.php b/application/controllers/api/v1/Availabilities.php index a7840228..9bf00d1a 100644 --- a/application/controllers/api/v1/Availabilities.php +++ b/application/controllers/api/v1/Availabilities.php @@ -6,8 +6,8 @@ * @package EasyAppointments * @author A.Tselegidis * @copyright Copyright (c) 2013 - 2020, Alex Tselegidis - * @license http://opensource.org/licenses/GPL-3.0 - GPLv3 - * @link http://easyappointments.org + * @license https://opensource.org/licenses/GPL-3.0 - GPLv3 + * @link https://easyappointments.org * @since v1.2.0 * ---------------------------------------------------------------------------- */ @@ -19,28 +19,6 @@ use EA\Engine\Types\UnsignedInteger; /** * Availabilities Controller * - * @property CI_Session $session - * @property CI_Loader $load - * @property CI_Input $input - * @property CI_Output $output - * @property CI_Config $config - * @property CI_Lang $lang - * @property CI_Cache $cache - * @property CI_DB_query_builder $db - * @property CI_Security $security - * @property Google_Sync $google_sync - * @property Ics_file $ics_file - * @property Appointments_Model $appointments_model - * @property Providers_Model $providers_model - * @property Services_Model $services_model - * @property Customers_Model $customers_model - * @property Settings_Model $settings_model - * @property Timezones $timezones - * @property Roles_Model $roles_model - * @property Secretaries_Model $secretaries_model - * @property Admins_Model $admins_model - * @property User_Model $user_model - * * @package Controllers */ class Availabilities extends API_V1_Controller { diff --git a/application/controllers/api/v1/Categories.php b/application/controllers/api/v1/Categories.php index 3e1c8b86..619a8851 100644 --- a/application/controllers/api/v1/Categories.php +++ b/application/controllers/api/v1/Categories.php @@ -6,8 +6,8 @@ * @package EasyAppointments * @author A.Tselegidis * @copyright Copyright (c) 2013 - 2020, Alex Tselegidis - * @license http://opensource.org/licenses/GPL-3.0 - GPLv3 - * @link http://easyappointments.org + * @license https://opensource.org/licenses/GPL-3.0 - GPLv3 + * @link https://easyappointments.org * @since v1.2.0 * ---------------------------------------------------------------------------- */ @@ -20,28 +20,6 @@ use EA\Engine\Types\NonEmptyText; /** * Categories Controller * - * @property CI_Session $session - * @property CI_Loader $load - * @property CI_Input $input - * @property CI_Output $output - * @property CI_Config $config - * @property CI_Lang $lang - * @property CI_Cache $cache - * @property CI_DB_query_builder $db - * @property CI_Security $security - * @property Google_Sync $google_sync - * @property Ics_file $ics_file - * @property Appointments_Model $appointments_model - * @property Providers_Model $providers_model - * @property Services_Model $services_model - * @property Customers_Model $customers_model - * @property Settings_Model $settings_model - * @property Timezones $timezones - * @property Roles_Model $roles_model - * @property Secretaries_Model $secretaries_model - * @property Admins_Model $admins_model - * @property User_Model $user_model - * * @package Controllers */ class Categories extends API_V1_Controller { @@ -71,7 +49,7 @@ class Categories extends API_V1_Controller { { try { - $condition = $id !== NULL ? 'id = ' . $id : ''; + $condition = $id !== NULL ? 'id = ' . $id : NULL; $categories = $this->services_model->get_all_categories($condition); if ($id !== NULL && count($categories) === 0) @@ -105,7 +83,7 @@ class Categories extends API_V1_Controller { { // Insert the category to the database. $request = new Request(); - $category = $request->getBody(); + $category = $request->get_body(); $this->parser->decode($category); if (isset($category['id'])) @@ -145,7 +123,7 @@ class Categories extends API_V1_Controller { } $request = new Request(); - $updated_category = $request->getBody(); + $updated_category = $request->get_body(); $base_category = $batch[0]; $this->parser->decode($updated_category, $base_category); $updated_category['id'] = $id; diff --git a/application/controllers/api/v1/Customers.php b/application/controllers/api/v1/Customers.php index ce95ea8e..40d0464d 100644 --- a/application/controllers/api/v1/Customers.php +++ b/application/controllers/api/v1/Customers.php @@ -6,8 +6,8 @@ * @package EasyAppointments * @author A.Tselegidis * @copyright Copyright (c) 2013 - 2020, Alex Tselegidis - * @license http://opensource.org/licenses/GPL-3.0 - GPLv3 - * @link http://easyappointments.org + * @license https://opensource.org/licenses/GPL-3.0 - GPLv3 + * @link https://easyappointments.org * @since v1.2.0 * ---------------------------------------------------------------------------- */ @@ -20,28 +20,6 @@ use EA\Engine\Types\NonEmptyText; /** * Customers Controller * - * @property CI_Session $session - * @property CI_Loader $load - * @property CI_Input $input - * @property CI_Output $output - * @property CI_Config $config - * @property CI_Lang $lang - * @property CI_Cache $cache - * @property CI_DB_query_builder $db - * @property CI_Security $security - * @property Google_Sync $google_sync - * @property Ics_file $ics_file - * @property Appointments_Model $appointments_model - * @property Providers_Model $providers_model - * @property Services_Model $services_model - * @property Customers_Model $customers_model - * @property Settings_Model $settings_model - * @property Timezones $timezones - * @property Roles_Model $roles_model - * @property Secretaries_Model $secretaries_model - * @property Admins_Model $admins_model - * @property User_Model $user_model - * * @package Controllers */ class Customers extends API_V1_Controller { @@ -105,7 +83,7 @@ class Customers extends API_V1_Controller { { // Insert the customer to the database. $request = new Request(); - $customer = $request->getBody(); + $customer = $request->get_body(); $this->parser->decode($customer); if (isset($customer['id'])) @@ -145,7 +123,7 @@ class Customers extends API_V1_Controller { } $request = new Request(); - $updated_customer = $request->getBody(); + $updated_customer = $request->get_body(); $base_customer = $batch[0]; $this->parser->decode($updated_customer, $base_customer); $updated_customer['id'] = $id; diff --git a/application/controllers/api/v1/Providers.php b/application/controllers/api/v1/Providers.php index fe342cbb..68394e2a 100644 --- a/application/controllers/api/v1/Providers.php +++ b/application/controllers/api/v1/Providers.php @@ -6,8 +6,8 @@ * @package EasyAppointments * @author A.Tselegidis * @copyright Copyright (c) 2013 - 2020, Alex Tselegidis - * @license http://opensource.org/licenses/GPL-3.0 - GPLv3 - * @link http://easyappointments.org + * @license https://opensource.org/licenses/GPL-3.0 - GPLv3 + * @link https://easyappointments.org * @since v1.2.0 * ---------------------------------------------------------------------------- */ @@ -20,28 +20,6 @@ use EA\Engine\Types\NonEmptyText; /** * Providers Controller * - * @property CI_Session $session - * @property CI_Loader $load - * @property CI_Input $input - * @property CI_Output $output - * @property CI_Config $config - * @property CI_Lang $lang - * @property CI_Cache $cache - * @property CI_DB_query_builder $db - * @property CI_Security $security - * @property Google_Sync $google_sync - * @property Ics_file $ics_file - * @property Appointments_Model $appointments_model - * @property Providers_Model $providers_model - * @property Services_Model $services_model - * @property Customers_Model $customers_model - * @property Settings_Model $settings_model - * @property Timezones $timezones - * @property Roles_Model $roles_model - * @property Secretaries_Model $secretaries_model - * @property Admins_Model $admins_model - * @property User_Model $user_model - * * @package Controllers */ class Providers extends API_V1_Controller { @@ -105,7 +83,7 @@ class Providers extends API_V1_Controller { { // Insert the provider to the database. $request = new Request(); - $provider = $request->getBody(); + $provider = $request->get_body(); $this->parser->decode($provider); if (isset($provider['id'])) @@ -145,7 +123,7 @@ class Providers extends API_V1_Controller { } $request = new Request(); - $updated_provider = $request->getBody(); + $updated_provider = $request->get_body(); $base_provider = $batch[0]; $this->parser->decode($updated_provider, $base_provider); $updated_provider['id'] = $id; diff --git a/application/controllers/api/v1/Secretaries.php b/application/controllers/api/v1/Secretaries.php index fcff6060..066abec1 100644 --- a/application/controllers/api/v1/Secretaries.php +++ b/application/controllers/api/v1/Secretaries.php @@ -6,8 +6,8 @@ * @package EasyAppointments * @author A.Tselegidis * @copyright Copyright (c) 2013 - 2020, Alex Tselegidis - * @license http://opensource.org/licenses/GPL-3.0 - GPLv3 - * @link http://easyappointments.org + * @license https://opensource.org/licenses/GPL-3.0 - GPLv3 + * @link https://easyappointments.org * @since v1.2.0 * ---------------------------------------------------------------------------- */ @@ -20,28 +20,6 @@ use EA\Engine\Types\NonEmptyText; /** * Secretaries Controller * - * @property CI_Session $session - * @property CI_Loader $load - * @property CI_Input $input - * @property CI_Output $output - * @property CI_Config $config - * @property CI_Lang $lang - * @property CI_Cache $cache - * @property CI_DB_query_builder $db - * @property CI_Security $security - * @property Google_Sync $google_sync - * @property Ics_file $ics_file - * @property Appointments_Model $appointments_model - * @property Providers_Model $providers_model - * @property Services_Model $services_model - * @property Customers_Model $customers_model - * @property Settings_Model $settings_model - * @property Timezones $timezones - * @property Roles_Model $roles_model - * @property Secretaries_Model $secretaries_model - * @property Admins_Model $admins_model - * @property User_Model $user_model - * * @package Controllers */ class Secretaries extends API_V1_Controller { @@ -105,7 +83,7 @@ class Secretaries extends API_V1_Controller { { // Insert the secretary to the database. $request = new Request(); - $secretary = $request->getBody(); + $secretary = $request->get_body(); $this->parser->decode($secretary); if (isset($secretary['id'])) @@ -145,7 +123,7 @@ class Secretaries extends API_V1_Controller { } $request = new Request(); - $updated_secretary = $request->getBody(); + $updated_secretary = $request->get_body(); $base_secretary = $batch[0]; $this->parser->decode($updated_secretary, $base_secretary); $updated_secretary['id'] = $id; diff --git a/application/controllers/api/v1/Services.php b/application/controllers/api/v1/Services.php index 0aace4a0..e2083c22 100644 --- a/application/controllers/api/v1/Services.php +++ b/application/controllers/api/v1/Services.php @@ -6,8 +6,8 @@ * @package EasyAppointments * @author A.Tselegidis * @copyright Copyright (c) 2013 - 2020, Alex Tselegidis - * @license http://opensource.org/licenses/GPL-3.0 - GPLv3 - * @link http://easyappointments.org + * @license https://opensource.org/licenses/GPL-3.0 - GPLv3 + * @link https://easyappointments.org * @since v1.2.0 * ---------------------------------------------------------------------------- */ @@ -20,28 +20,6 @@ use EA\Engine\Types\NonEmptyText; /** * Services Controller * - * @property CI_Session $session - * @property CI_Loader $load - * @property CI_Input $input - * @property CI_Output $output - * @property CI_Config $config - * @property CI_Lang $lang - * @property CI_Cache $cache - * @property CI_DB_query_builder $db - * @property CI_Security $security - * @property Google_Sync $google_sync - * @property Ics_file $ics_file - * @property Appointments_Model $appointments_model - * @property Providers_Model $providers_model - * @property Services_Model $services_model - * @property Customers_Model $customers_model - * @property Settings_Model $settings_model - * @property Timezones $timezones - * @property Roles_Model $roles_model - * @property Secretaries_Model $secretaries_model - * @property Admins_Model $admins_model - * @property User_Model $user_model - * * @package Controllers */ class Services extends API_V1_Controller { @@ -105,7 +83,7 @@ class Services extends API_V1_Controller { { // Insert the service to the database. $request = new Request(); - $service = $request->getBody(); + $service = $request->get_body(); $this->parser->decode($service); if (isset($service['id'])) @@ -145,7 +123,7 @@ class Services extends API_V1_Controller { } $request = new Request(); - $updated_service = $request->getBody(); + $updated_service = $request->get_body(); $base_service = $batch[0]; $this->parser->decode($updated_service, $base_service); $updated_service['id'] = $id; diff --git a/application/controllers/api/v1/Settings.php b/application/controllers/api/v1/Settings.php index 2936d4f4..7a9732de 100644 --- a/application/controllers/api/v1/Settings.php +++ b/application/controllers/api/v1/Settings.php @@ -6,8 +6,8 @@ * @package EasyAppointments * @author A.Tselegidis * @copyright Copyright (c) 2013 - 2020, Alex Tselegidis - * @license http://opensource.org/licenses/GPL-3.0 - GPLv3 - * @link http://easyappointments.org + * @license https://opensource.org/licenses/GPL-3.0 - GPLv3 + * @link https://easyappointments.org * @since v1.2.0 * ---------------------------------------------------------------------------- */ @@ -19,28 +19,6 @@ use EA\Engine\Api\V1\Response; /** * Settings Controller * - * @property CI_Session $session - * @property CI_Loader $load - * @property CI_Input $input - * @property CI_Output $output - * @property CI_Config $config - * @property CI_Lang $lang - * @property CI_Cache $cache - * @property CI_DB_query_builder $db - * @property CI_Security $security - * @property Google_Sync $google_sync - * @property Ics_file $ics_file - * @property Appointments_Model $appointments_model - * @property Providers_Model $providers_model - * @property Services_Model $services_model - * @property Customers_Model $customers_model - * @property Settings_Model $settings_model - * @property Timezones $timezones - * @property Roles_Model $roles_model - * @property Secretaries_Model $secretaries_model - * @property Admins_Model $admins_model - * @property User_Model $user_model - * * @package Controllers */ class Settings extends API_V1_Controller { @@ -124,7 +102,7 @@ class Settings extends API_V1_Controller { try { $request = new Request(); - $value = $request->getBody()['value']; + $value = $request->get_body()['value']; $this->settings_model->set_setting($name, $value); // Fetch the updated object from the database and return it to the client. diff --git a/application/controllers/api/v1/Unavailabilities.php b/application/controllers/api/v1/Unavailabilities.php index c1d81b9c..7ae391c7 100644 --- a/application/controllers/api/v1/Unavailabilities.php +++ b/application/controllers/api/v1/Unavailabilities.php @@ -6,8 +6,8 @@ * @package EasyAppointments * @author A.Tselegidis * @copyright Copyright (c) 2013 - 2020, Alex Tselegidis - * @license http://opensource.org/licenses/GPL-3.0 - GPLv3 - * @link http://easyappointments.org + * @license https://opensource.org/licenses/GPL-3.0 - GPLv3 + * @link https://easyappointments.org * @since v1.2.0 * ---------------------------------------------------------------------------- */ @@ -20,28 +20,6 @@ use EA\Engine\Types\NonEmptyText; /** * Unavailabilities Controller * - * @property CI_Session $session - * @property CI_Loader $load - * @property CI_Input $input - * @property CI_Output $output - * @property CI_Config $config - * @property CI_Lang $lang - * @property CI_Cache $cache - * @property CI_DB_query_builder $db - * @property CI_Security $security - * @property Google_Sync $google_sync - * @property Ics_file $ics_file - * @property Appointments_Model $appointments_model - * @property Providers_Model $providers_model - * @property Services_Model $services_model - * @property Customers_Model $customers_model - * @property Settings_Model $settings_model - * @property Timezones $timezones - * @property Roles_Model $roles_model - * @property Secretaries_Model $secretaries_model - * @property Admins_Model $admins_model - * @property User_Model $user_model - * * @package Controllers */ class Unavailabilities extends API_V1_Controller { @@ -105,7 +83,7 @@ class Unavailabilities extends API_V1_Controller { { // Insert the appointment to the database. $request = new Request(); - $unavailability = $request->getBody(); + $unavailability = $request->get_body(); $this->parser->decode($unavailability); if (isset($unavailability['id'])) @@ -145,7 +123,7 @@ class Unavailabilities extends API_V1_Controller { } $request = new Request(); - $updatedUnavailability = $request->getBody(); + $updatedUnavailability = $request->get_body(); $baseUnavailability = $batch[0]; $this->parser->decode($updatedUnavailability, $baseUnavailability); $updatedUnavailability['id'] = $id; diff --git a/application/core/EA_Controller.php b/application/core/EA_Controller.php new file mode 100644 index 00000000..36bad2d6 --- /dev/null +++ b/application/core/EA_Controller.php @@ -0,0 +1,48 @@ + + * @copyright Copyright (c) 2013 - 2020, Alex Tselegidis + * @license https://opensource.org/licenses/GPL-3.0 - GPLv3 + * @link https://easyappointments.org + * @since v1.4.0 + * ---------------------------------------------------------------------------- */ + +/** + * Class MY_Controller + * + * @property CI_Loader $load + * @property CI_Input $input + * @property CI_Output $output + * @property CI_Config $config + * @property CI_Lang $lang + * @property CI_Cache $cache + * @property CI_DB_query_builder $db + * @property CI_Session $session + * @property CI_Security $security + * @property CI_Migration $migration + + * @property Admins_model $admins_model + * @property Appointments_model $appointments_model + * @property Consents_model $consents_model + * @property Customers_model $customers_model + * @property Providers_model $providers_model + * @property Roles_model $roles_model + * @property Secretaries_model $secretaries_model + * @property Services_model $services_model + * @property Settings_model $settings_model + * @property User_model $user_model + * + * @property Availability $availability + * @property Google_Sync $google_sync + * @property Ics_file $ics_file + * @property Notifications $notifications + * @property Synchronization $synchronization + * @property Timezones $timezones + */ +class EA_Controller extends CI_Controller { + // +} diff --git a/application/core/EA_Model.php b/application/core/EA_Model.php new file mode 100644 index 00000000..b8c0fddd --- /dev/null +++ b/application/core/EA_Model.php @@ -0,0 +1,48 @@ + + * @copyright Copyright (c) 2013 - 2020, Alex Tselegidis + * @license https://opensource.org/licenses/GPL-3.0 - GPLv3 + * @link https://easyappointments.org + * @since v1.4.0 + * ---------------------------------------------------------------------------- */ + +/** + * Class MY_Model + * + * @property CI_Loader $load + * @property CI_Input $input + * @property CI_Output $output + * @property CI_Config $config + * @property CI_Lang $lang + * @property CI_Cache $cache + * @property CI_DB_query_builder $db + * @property CI_Session $session + * @property CI_Security $security + * @property CI_Migration $migration + * + * @property Admins_model $admins_model + * @property Appointments_model $appointments_model + * @property Consents_model $consents_model + * @property Customers_model $customers_model + * @property Providers_model $providers_model + * @property Roles_model $roles_model + * @property Secretaries_model $secretaries_model + * @property Services_model $services_model + * @property Settings_model $settings_model + * @property User_model $user_model + * + * @property Availability $availability + * @property Google_Sync $google_sync + * @property Ics_file $ics_file + * @property Notifications $notifications + * @property Synchronization $synchronization + * @property Timezones $timezones + */ +class EA_Model extends CI_Model { + // +} diff --git a/application/language/german/translations_lang.php b/application/language/german/translations_lang.php index 2e366490..258132e7 100755 --- a/application/language/german/translations_lang.php +++ b/application/language/german/translations_lang.php @@ -166,7 +166,7 @@ $lang['go_to_booking_page'] = 'Gehe zu Buchungsseite'; $lang['settings_saved'] = 'Einstellungen erfolgreich gesichert.'; $lang['general'] = 'Allgemeines'; $lang['business_logic'] = 'Unternehmerische Logik'; -$lang['current_user'] = 'Laufender Nutzer'; +$lang['current_user'] = 'Aktueller Nutzer'; $lang['about_app'] = 'Über Easy!Appointments'; $lang['edit_working_plan_hint'] = 'Bitte notieren Sie im folgenden die Tage und Zeiten für die das Unternehmen Termine anbietet. Sie können Termine auch für Feiertage festlegen, aber die Kunden können an diesen Tagen keine Buchung durchführen. Dieser Arbeitsplan ist voreingestellt für alle neuen Einschreibungen von Dienstleistern, aber Sie haben die Möglichkeit den Arbeitsplan zu ändern und zwar für jeden Anbieter gesondert, indem Sie seine Einschreibung bearbeiten. Danach fügen Sie die Zeiträume der Pausen hinzu.'; $lang['edit_breaks_hint'] = 'Fügen Sie die betrieblichen Pausen je Tag hinzu. Diese Pausen werden für alle neuen Dienstleister angewendet.'; @@ -301,26 +301,26 @@ $lang['delete_personal_information_hint'] = 'Entfernen Sie alle Ihre Termine und $lang['delete_personal_information'] = 'Persönlichen Informationen löschen'; $lang['delete_personal_information_prompt'] = 'Sind Sie sicher, dass Sie Ihre persönlichen Daten löschen möchten? Diese Aktion kann nicht rückgängig gemacht werden.'; $lang['location'] = 'Ort'; -$lang['working_plan_exception'] = 'Working Plan Exception'; -$lang['working_plan_exceptions'] = 'Working Plan Exceptions'; -$lang['working_plan_exceptions_hint'] = 'Add a working plan exception day, outside the working plan.'; -$lang['new_working_plan_exception_title'] = 'New Working Plan Exception'; -$lang['working_plan_exception_saved'] = 'Working plan exception saved successfully.'; -$lang['working_plan_exception_deleted'] = 'Working plan exception deleted successfully.'; -$lang['add_working_plan_exceptions_during_each_day'] = 'Add working plan exceptions, outside the working plan.'; -$lang['add_working_plan_exception'] = 'Add Working Plan Exception'; -$lang['require_phone_number'] = 'Require phone number'; -$lang['require_phone_number_hint'] = 'When enabled, customers and users will need to enter the customer\'s phone number when booking an appointment'; -$lang['check_spam_folder'] = 'Please check your spam folder if the email does not arrive within a few minutes.'; -$lang['api_token_hint'] = 'Set a secret token in order to enable the token based authentication of the Easy!Appointments API.'; -$lang['timezone'] = 'Timezone'; -$lang['overwrite_existing_working_plans'] = 'This will overwrite the existing provider working plans, are you sure that you want to continue?'; -$lang['working_plans_got_updated'] = 'All the working plans got updated.'; -$lang['apply_to_all_providers'] = 'Apply To All Providers'; -$lang['display_any_provider'] = 'Display Any Provider Option'; -$lang['display_any_provider_hint'] = 'The booking page will get an additional option that allows customers to book without specifying a provider.'; -$lang['load_more'] = 'Load More'; -$lang['list'] = 'List'; -$lang['default'] = 'Default'; -$lang['table'] = 'Table'; -$lang['date'] = 'Date'; +$lang['working_plan_exception'] = 'Arbeitsplan Ausnahme'; +$lang['working_plan_exceptions'] = 'Arbeitsplan Ausnahmen'; +$lang['working_plan_exceptions_hint'] = 'Fügt einen Ausnahmetag außerhalb des Arbeitsplans hinzu.'; +$lang['new_working_plan_exception_title'] = 'Neue Ausnahme vom Arbeitsplan'; +$lang['working_plan_exception_saved'] = 'Ausnahme vom Arbeitsplan erfolgreich gespeichert.'; +$lang['working_plan_exception_deleted'] = 'Ausnahme vom Arbeitsplan erfolgreich gelöscht.'; +$lang['add_working_plan_exceptions_during_each_day'] = 'Ausnahmen vom Arbeitsplan für jeden Tag hinzufügen.'; +$lang['add_working_plan_exception'] = 'Ausnahme vom Arbeitsplan hinzufügen'; +$lang['require_phone_number'] = 'Telefonnummer benötigt'; +$lang['require_phone_number_hint'] = 'Wenn aktiviert, müssen Kunden und Benutzer die Telefonnummer des Kunden beim Buchen eines Termins eingeben'; +$lang['check_spam_folder'] = 'Bitte kontrollieren Sie Ihren Spam-Ordner, falss die Email nicht innerhalb weniger Minuten eintrifft.'; +$lang['api_token_hint'] = 'Setze einen geheimen Token um die tokenbasierte Authentifizierung für die Easy!Appointments API zu aktivieren.'; +$lang['timezone'] = 'Zeitzone'; +$lang['overwrite_existing_working_plans'] = 'Dies wird bestehende Arbeitspläne von Anbietern überschreiben. Sind sie sicher?'; +$lang['working_plans_got_updated'] = 'Alle Arbeitspläne wurden aktualisiert.'; +$lang['apply_to_all_providers'] = 'Auf alle Anbieter anwenden'; +$lang['display_any_provider'] = 'Option zum Anzeigen aller Anbieter'; +$lang['display_any_provider_hint'] = 'Es wird eine zusätzliche Option zur Buchungsseite hinzugefügt, die es Kunden ermöglicht zu buchen ohne eine spezifischen Anbieter auszuwählen.'; +$lang['load_more'] = 'Mehr laden'; +$lang['list'] = 'Liste'; +$lang['default'] = 'Standard'; +$lang['table'] = 'Tabelle'; +$lang['date'] = 'Datum'; diff --git a/application/language/spanish/translations_lang.php b/application/language/spanish/translations_lang.php index 5c2ac1f6..960e32cd 100755 --- a/application/language/spanish/translations_lang.php +++ b/application/language/spanish/translations_lang.php @@ -117,7 +117,7 @@ $lang['description'] = 'Descripción'; $lang['categories'] = 'Categorías'; $lang['admins'] = 'Administradores'; $lang['providers'] = 'Proveedores'; -$lang['secretaries'] = 'Secretarias'; +$lang['secretaries'] = 'Secretarios/as'; $lang['mobile_number'] = 'Número de teléfono móvil'; $lang['state'] = 'Estado'; $lang['username'] = 'Nombre de usuario'; @@ -142,15 +142,15 @@ $lang['working_plan'] = 'Esquema del horario laboral'; $lang['reset_plan'] = 'Restaurar el esquema del horario laboral'; $lang['monday'] = 'Lunes'; $lang['tuesday'] = 'Martes'; -$lang['wednesday'] = 'Miercoles'; +$lang['wednesday'] = 'Miércoles'; $lang['thursday'] = 'Jueves'; $lang['friday'] = 'Viernes'; -$lang['saturday'] = 'Sabado'; +$lang['saturday'] = 'Sábado'; $lang['sunday'] = 'Domingo'; $lang['breaks'] = 'Periodos de descanso'; $lang['add_breaks_during_each_day'] = 'Agregar periodos de descanso para cada día. Durante los periodos de descanso los proveedores no podrán aceptar ninguna cita.'; $lang['day'] = 'Día'; -$lang['days'] = 'Days'; +$lang['days'] = 'Días'; $lang['actions'] = 'Acciones'; $lang['reset_working_plan_hint'] = 'Restaurar el esquema del horario laboral a los valores por defecto.'; $lang['company_name'] = 'Nombre de la empresa'; @@ -273,12 +273,12 @@ $lang['date_format'] = 'Formato de Fecha'; $lang['date_format_hint'] = 'Cambia el formato de fecha para mostrar (D - Día, M - Mes, Y - Año).'; $lang['time_format'] = ''; $lang['time_format_hint'] = ''; -$lang['first_weekday'] = 'First day of week'; -$lang['first_weekday_hint'] = 'Set the first day of the calendar week.'; +$lang['first_weekday'] = 'Primer día de la semana'; +$lang['first_weekday_hint'] = 'Defina el primer día de la semana en el calendario.'; $lang['google_analytics_code_hint'] = 'Agrega tu ID de Google Analytics para ser incluido en la página de reservas.'; $lang['availabilities_type'] = 'Tipos disponibles'; $lang['flexible'] = 'Flexible'; -$lang['fixed'] = 'Fixed'; +$lang['fixed'] = 'Fijo'; $lang['attendants_number'] = 'Número de Atenciones'; $lang['reset_working_plan'] = 'Reinicia el plan de trabajo a los valores por defecto.'; $lang['legal_contents'] = 'Contenidos legales'; @@ -297,27 +297,27 @@ $lang['read_and_agree_to_privacy_policy'] = 'He leido y estoy de acuerdo con {$l $lang['delete_personal_information_hint'] = 'Borrar toda la información personal del sistema.'; $lang['delete_personal_information'] = 'Borrar información personal'; $lang['delete_personal_information_prompt'] = '¿Estás seguro que quieres borrar tu información personal? Esta acción no se puede deshacer.'; -$lang['location'] = 'Location'; -$lang['working_plan_exception'] = 'Working Plan Exception'; -$lang['working_plan_exceptions'] = 'Working Plan Exceptions'; -$lang['working_plan_exceptions_hint'] = 'Add a working plan exception day, outside the working plan.'; -$lang['new_working_plan_exception_title'] = 'New Working Plan Exception'; -$lang['working_plan_exception_saved'] = 'Working plan exception saved successfully.'; -$lang['working_plan_exception_deleted'] = 'Working plan exception deleted successfully.'; -$lang['add_working_plan_exceptions_during_each_day'] = 'Add working plan exceptions, outside the working plan.'; -$lang['add_working_plan_exception'] = 'Add Working Plan Exception'; -$lang['require_phone_number'] = 'Require phone number'; -$lang['require_phone_number_hint'] = 'When enabled, customers and users will need to enter the customer\'s phone number when booking an appointment'; -$lang['check_spam_folder'] = 'Please check your spam folder if the email does not arrive within a few minutes.'; -$lang['api_token_hint'] = 'Set a secret token in order to enable the token based authentication of the Easy!Appointments API.'; -$lang['timezone'] = 'Timezone'; -$lang['overwrite_existing_working_plans'] = 'This will overwrite the existing provider working plans, are you sure that you want to continue?'; -$lang['working_plans_got_updated'] = 'All the working plans got updated.'; -$lang['apply_to_all_providers'] = 'Apply To All Providers'; -$lang['display_any_provider'] = 'Display Any Provider Option'; -$lang['display_any_provider_hint'] = 'The booking page will get an additional option that allows customers to book without specifying a provider.'; -$lang['load_more'] = 'Load More'; -$lang['list'] = 'List'; -$lang['default'] = 'Default'; -$lang['table'] = 'Table'; -$lang['date'] = 'Date'; +$lang['location'] = 'Ubicación'; +$lang['working_plan_exception'] = 'Excepción al plan de trabajo'; +$lang['working_plan_exceptions'] = 'Excepciones al plan de trabajo'; +$lang['working_plan_exceptions_hint'] = 'Agregar un día de excepción al plan de trabajo, fuera del plan de trabajo.'; +$lang['new_working_plan_exception_title'] = 'Nueva excepción al plan de trabajo.'; +$lang['working_plan_exception_saved'] = 'Plan de trabajo eliminado exitosamente.'; +$lang['working_plan_exception_deleted'] = 'Plan de trabajo eliminado exitosamente.'; +$lang['add_working_plan_exceptions_during_each_day'] = 'Agregar excepciones al plan de trabajo, fuera del plan de trabajo.'; +$lang['add_working_plan_exception'] = 'Agregar excepción al plan de trabajo'; +$lang['require_phone_number'] = 'Requerir número de teléfono'; +$lang['require_phone_number_hint'] = 'Cuando está habilitado, clientes y usuarios deberán ingresar el número de teléfono del cliente al registrar una cita.'; +$lang['check_spam_folder'] = 'Por favor, verifique su carpeta de correo no deseado si el correo no llega dentro de unos minutos.'; +$lang['api_token_hint'] = 'Defina un token secreto para habilitar la autentificación por token mediante la API de Easy!Appointments.'; +$lang['timezone'] = 'Zona horaria'; +$lang['overwrite_existing_working_plans'] = 'Esto sobreescribirá los planes de trabajo existentes del proveedor. ¿Seguro que desea continuar?'; +$lang['working_plans_got_updated'] = 'Todos los planes de trabajo fueron actualizados.'; +$lang['apply_to_all_providers'] = 'Aplicar a todos los proveedores'; +$lang['display_any_provider'] = 'Opción de mostrar cualquier proveedor'; +$lang['display_any_provider_hint'] = 'La página de reserva tendrá una opción adicional que permitirá que los clientes se anoten sin específicar un proveedor.'; +$lang['load_more'] = 'Cargar más'; +$lang['list'] = 'Lista'; +$lang['default'] = 'Predeterminado'; +$lang['table'] = 'Tabla'; +$lang['date'] = 'Fecha'; diff --git a/application/libraries/Availability.php b/application/libraries/Availability.php index 08daad31..4a4e2b96 100644 --- a/application/libraries/Availability.php +++ b/application/libraries/Availability.php @@ -19,7 +19,7 @@ */ class Availability { /** - * @var CI_Controller + * @var EA_Controller */ protected $CI; @@ -79,7 +79,7 @@ class Availability { * * @throws Exception */ - public function get_available_periods( + protected function get_available_periods( $date, $provider, $exclude_appointment_id = NULL @@ -345,6 +345,11 @@ class Availability { $working_day = strtolower(date('l', strtotime($date))); $working_hours = $working_plan[$working_day]; + if ( ! $working_hours) + { + return []; + } + $periods = [ [ 'start' => new DateTime($date . ' ' . $working_hours['start']), diff --git a/application/libraries/Google_sync.php b/application/libraries/Google_sync.php index 00cfaa13..f32e25fc 100644 --- a/application/libraries/Google_sync.php +++ b/application/libraries/Google_sync.php @@ -24,9 +24,9 @@ class Google_Sync { /** * CodeIgniter Instance * - * @var CI_Controller + * @var EA_Controller */ - protected $framework; + protected $CI; /** * Google API Client @@ -50,17 +50,17 @@ class Google_Sync { */ public function __construct() { - $this->framework =& get_instance(); + $this->CI =& get_instance(); - $this->framework->load->library('session'); + $this->CI->load->library('session'); // Initialize google client and calendar service. $this->client = new Google_Client(); - $this->client->setApplicationName($this->framework->config->item('google_application_name')); - $this->client->setClientId($this->framework->config->item('google_client_id')); - $this->client->setClientSecret($this->framework->config->item('google_client_secret')); - $this->client->setDeveloperKey($this->framework->config->item('google_api_key')); + $this->client->setApplicationName($this->CI->config->item('google_application_name')); + $this->client->setClientId($this->CI->config->item('google_client_id')); + $this->client->setClientSecret($this->CI->config->item('google_client_secret')); + $this->client->setDeveloperKey($this->CI->config->item('google_api_key')); $this->client->setRedirectUri(site_url('google/oauth_callback')); $this->client->setAccessType('offline'); $this->client->addScope([ @@ -145,7 +145,7 @@ class Google_Sync { */ public function add_appointment($appointment, $provider, $service, $customer, $settings) { - $this->framework->load->helper('general'); + $this->CI->load->helper('general'); $event = new Google_Service_Calendar_Event(); $event->setSummary(($service != NULL) ? $service['name'] : 'Unavailable'); @@ -199,7 +199,7 @@ class Google_Sync { */ public function update_appointment($appointment, $provider, $service, $customer, $settings) { - $this->framework->load->helper('general'); + $this->CI->load->helper('general'); $event = $this->service->events->get($provider['settings']['google_calendar'], $appointment['id_google_calendar']); @@ -268,7 +268,7 @@ class Google_Sync { */ public function add_unavailable($provider, $unavailable) { - $this->framework->load->helper('general'); + $this->CI->load->helper('general'); $event = new Google_Service_Calendar_Event(); $event->setSummary('Unavailable'); @@ -299,7 +299,7 @@ class Google_Sync { */ public function update_unavailable($provider, $unavailable) { - $this->framework->load->helper('general'); + $this->CI->load->helper('general'); $event = $this->service->events->get($provider['settings']['google_calendar'], $unavailable['id_google_calendar']); @@ -362,7 +362,7 @@ class Google_Sync { */ public function get_sync_events($google_calendar, $start, $end) { - $this->framework->load->helper('general'); + $this->CI->load->helper('general'); $params = [ 'timeMin' => date3339($start), diff --git a/application/libraries/Ics_file.php b/application/libraries/Ics_file.php index 28056de8..bfdcea95 100644 --- a/application/libraries/Ics_file.php +++ b/application/libraries/Ics_file.php @@ -156,7 +156,7 @@ class Ics_file { $calendar ->setProdId('-//EasyAppointments//Open Source Web Scheduler//EN') - ->setTimezone(new DateTimeZone(date_default_timezone_get())) + ->setTimezone(new DateTimeZone($provider['timezone'])) ->addEvent($event); // Setup exporter. diff --git a/application/libraries/Notifications.php b/application/libraries/Notifications.php index 1b675669..2188f022 100644 --- a/application/libraries/Notifications.php +++ b/application/libraries/Notifications.php @@ -23,7 +23,7 @@ use EA\Engine\Types\Url; */ class Notifications { /** - * @var CI_Controller + * @var EA_Controller */ protected $CI; @@ -33,13 +33,18 @@ class Notifications { public function __construct() { $this->CI =& get_instance(); + $this->CI->load->model('providers_model'); $this->CI->load->model('secretaries_model'); $this->CI->load->model('secretaries_model'); $this->CI->load->model('admins_model'); $this->CI->load->model('appointments_model'); $this->CI->load->model('settings_model'); + $this->CI->load->library('ics_file'); + $this->CI->load->library('timezones'); + + $this->CI->config->load('email'); } /** @@ -54,44 +59,39 @@ class Notifications { */ public function notify_appointment_saved($appointment, $service, $provider, $customer, $settings, $manage_mode = FALSE) { - // Send email notifications to customer and provider. try { - $this->CI->config->load('email'); - $email = new EmailClient($this->CI, $this->CI->config->config); - if ($manage_mode === FALSE) - { - $customer_title = new Text(lang('appointment_booked')); - $customer_message = new Text(lang('thank_you_for_appointment')); - $provider_title = new Text(lang('appointment_added_to_your_plan')); - $provider_message = new Text(lang('appointment_link_description')); - - } - else + if ($manage_mode) { $customer_title = new Text(lang('appointment_changes_saved')); $customer_message = new Text(''); $provider_title = new Text(lang('appointment_details_changed')); $provider_message = new Text(''); } + else + { + $customer_title = new Text(lang('appointment_booked')); + $customer_message = new Text(lang('thank_you_for_appointment')); + $provider_title = new Text(lang('appointment_added_to_your_plan')); + $provider_message = new Text(lang('appointment_link_description')); + } $customer_link = new Url(site_url('appointments/index/' . $appointment['hash'])); $provider_link = new Url(site_url('backend/index/' . $appointment['hash'])); + $ics_stream = $this->CI->ics_file->get_stream($appointment, $service, $provider, $customer); + $send_customer = filter_var( $this->CI->settings_model->get_setting('customer_notifications'), FILTER_VALIDATE_BOOLEAN); - - $ics_stream = $this->CI->ics_file->get_stream($appointment, $service, $provider, $customer); - if ($send_customer === TRUE) { - $email->sendAppointmentDetails($appointment, $provider, + $email->send_appointment_details($appointment, $provider, $service, $customer, $settings, $customer_title, - $customer_message, $customer_link, new Email($customer['email']), new Text($ics_stream)); + $customer_message, $customer_link, new Email($customer['email']), new Text($ics_stream), $customer['timezone']); } $send_provider = filter_var( @@ -100,9 +100,9 @@ class Notifications { if ($send_provider === TRUE) { - $email->sendAppointmentDetails($appointment, $provider, + $email->send_appointment_details($appointment, $provider, $service, $customer, $settings, $provider_title, - $provider_message, $provider_link, new Email($provider['email']), new Text($ics_stream)); + $provider_message, $provider_link, new Email($provider['email']), new Text($ics_stream), $provider['timezone']); } // Notify admins @@ -110,14 +110,14 @@ class Notifications { foreach ($admins as $admin) { - if ( ! $admin['settings']['notifications'] === '0') + if ($admin['settings']['notifications'] === '0') { continue; } - $email->sendAppointmentDetails($appointment, $provider, + $email->send_appointment_details($appointment, $provider, $service, $customer, $settings, $provider_title, - $provider_message, $provider_link, new Email($admin['email']), new Text($ics_stream)); + $provider_message, $provider_link, new Email($admin['email']), new Text($ics_stream), $admin['timezone']); } // Notify secretaries @@ -125,7 +125,7 @@ class Notifications { foreach ($secretaries as $secretary) { - if ( ! $secretary['settings']['notifications'] === '0') + if ($secretary['settings']['notifications'] === '0') { continue; } @@ -135,9 +135,9 @@ class Notifications { continue; } - $email->sendAppointmentDetails($appointment, $provider, + $email->send_appointment_details($appointment, $provider, $service, $customer, $settings, $provider_title, - $provider_message, $provider_link, new Email($secretary['email']), new Text($ics_stream)); + $provider_message, $provider_link, new Email($secretary['email']), new Text($ics_stream), $secretary['timezone']); } } catch (Exception $exception) @@ -168,7 +168,7 @@ class Notifications { if ($send_provider === TRUE) { - $email->sendDeleteAppointment($appointment, $provider, + $email->send_delete_appointment($appointment, $provider, $service, $customer, $settings, new Email($provider['email']), new Text($this->CI->input->post('cancel_reason'))); } @@ -179,7 +179,7 @@ class Notifications { if ($send_customer === TRUE) { - $email->sendDeleteAppointment($appointment, $provider, + $email->send_delete_appointment($appointment, $provider, $service, $customer, $settings, new Email($customer['email']), new Text($this->CI->input->post('cancel_reason'))); } @@ -194,7 +194,7 @@ class Notifications { continue; } - $email->sendDeleteAppointment($appointment, $provider, + $email->send_delete_appointment($appointment, $provider, $service, $customer, $settings, new Email($admin['email']), new Text($this->CI->input->post('cancel_reason'))); } @@ -214,7 +214,7 @@ class Notifications { continue; } - $email->sendDeleteAppointment($appointment, $provider, + $email->send_delete_appointment($appointment, $provider, $service, $customer, $settings, new Email($secretary['email']), new Text($this->CI->input->post('cancel_reason'))); } diff --git a/application/libraries/Synchronization.php b/application/libraries/Synchronization.php index a8a0100d..b9cf0f62 100644 --- a/application/libraries/Synchronization.php +++ b/application/libraries/Synchronization.php @@ -18,7 +18,7 @@ */ class Synchronization { /** - * @var CI_Controller + * @var EA_Controller */ protected $CI; diff --git a/application/libraries/Timezones.php b/application/libraries/Timezones.php index 0a28c6ac..b4b24166 100644 --- a/application/libraries/Timezones.php +++ b/application/libraries/Timezones.php @@ -20,9 +20,9 @@ */ class Timezones { /** - * @var CI_Controller + * @var EA_Controller */ - protected $framework; + protected $CI; /** * @var string @@ -464,13 +464,16 @@ class Timezones { ], ]; + /** + * Timezones constructor. + */ public function __construct() { - $this->framework = & get_instance(); + $this->CI = & get_instance(); - $this->framework->load->model('user_model'); + $this->CI->load->model('user_model'); - $this->framework->load->library('session'); + $this->CI->load->library('session'); } /** @@ -499,7 +502,7 @@ class Timezones { throw new Exception('The provided event does not have the required properties: ' . print_r($event)); } - $user_timezone = $this->framework->user_model->get_user_timezone($event['id_users_provider']); + $user_timezone = $this->CI->user_model->get_user_timezone($event['id_users_provider']); $session_timezone = $this->get_session_timezone(); @@ -522,8 +525,8 @@ class Timezones { { $default_timezone = $this->get_default_timezone(); - return $this->framework->session->has_userdata('timezone') - ? $this->framework->session->userdata('timezone') + return $this->CI->session->has_userdata('timezone') + ? $this->CI->session->userdata('timezone') : $default_timezone; } diff --git a/application/migrations/001_specific_calendar_sync.php b/application/migrations/001_specific_calendar_sync.php index d7a190ae..8b701146 100644 --- a/application/migrations/001_specific_calendar_sync.php +++ b/application/migrations/001_specific_calendar_sync.php @@ -18,7 +18,7 @@ * SQL are not required. * * @property CI_DB_query_builder $db - * @property CI_DB_forge dbforge + * @property CI_DB_forge $dbforge */ class Migration_Specific_calendar_sync extends CI_Migration { /** diff --git a/application/migrations/002_add_google_analytics_setting.php b/application/migrations/002_add_google_analytics_setting.php index e39402c8..74950d28 100644 --- a/application/migrations/002_add_google_analytics_setting.php +++ b/application/migrations/002_add_google_analytics_setting.php @@ -15,7 +15,7 @@ * Class Migration_Add_google_analytics_setting * * @property CI_DB_query_builder $db - * @property CI_DB_forge dbforge + * @property CI_DB_forge $dbforge */ class Migration_Add_google_analytics_setting extends CI_Migration { /** diff --git a/application/migrations/003_add_customer_notifications_setting.php b/application/migrations/003_add_customer_notifications_setting.php index a90d33b5..0eab1da0 100644 --- a/application/migrations/003_add_customer_notifications_setting.php +++ b/application/migrations/003_add_customer_notifications_setting.php @@ -15,7 +15,7 @@ * Class Migration_Add_customer_notifications_setting * * @property CI_DB_query_builder $db - * @property CI_DB_forge dbforge + * @property CI_DB_forge $dbforge */ class Migration_Add_customer_notifications_setting extends CI_Migration { /** diff --git a/application/migrations/004_add_date_format_setting.php b/application/migrations/004_add_date_format_setting.php index 5dd22026..8ebc46ce 100644 --- a/application/migrations/004_add_date_format_setting.php +++ b/application/migrations/004_add_date_format_setting.php @@ -15,7 +15,7 @@ * Class Migration_Add_date_format_setting * * @property CI_DB_query_builder $db - * @property CI_DB_forge dbforge + * @property CI_DB_forge $dbforge */ class Migration_Add_date_format_setting extends CI_Migration { /** diff --git a/application/migrations/005_add_require_captcha_setting.php b/application/migrations/005_add_require_captcha_setting.php index 84867be8..fc69ae16 100644 --- a/application/migrations/005_add_require_captcha_setting.php +++ b/application/migrations/005_add_require_captcha_setting.php @@ -15,7 +15,7 @@ * Class Migration_Add_require_captcha_setting * * @property CI_DB_query_builder $db - * @property CI_DB_forge dbforge + * @property CI_DB_forge $dbforge */ class Migration_Add_require_captcha_setting extends CI_Migration { /** diff --git a/application/migrations/006_add_calendar_view_setting.php b/application/migrations/006_add_calendar_view_setting.php index e7ad51f5..2cffaeb7 100644 --- a/application/migrations/006_add_calendar_view_setting.php +++ b/application/migrations/006_add_calendar_view_setting.php @@ -15,7 +15,7 @@ * Class Migration_Add_calendar_view_setting * * @property CI_DB_query_builder $db - * @property CI_DB_forge dbforge + * @property CI_DB_forge $dbforge */ class Migration_Add_calendar_view_setting extends CI_Migration { /** diff --git a/application/migrations/007_add_service_availabilities_type.php b/application/migrations/007_add_service_availabilities_type.php index 14d824ec..74773858 100644 --- a/application/migrations/007_add_service_availabilities_type.php +++ b/application/migrations/007_add_service_availabilities_type.php @@ -15,7 +15,7 @@ * Class Migration_Add_service_availabilities_type * * @property CI_DB_query_builder $db - * @property CI_DB_forge dbforge + * @property CI_DB_forge $dbforge */ class Migration_Add_service_availabilities_type extends CI_Migration { /** diff --git a/application/migrations/008_add_service_attendants_number.php b/application/migrations/008_add_service_attendants_number.php index 728abcb9..547dbeba 100644 --- a/application/migrations/008_add_service_attendants_number.php +++ b/application/migrations/008_add_service_attendants_number.php @@ -15,7 +15,7 @@ * Class Migration_Add_service_attendants_number * * @property CI_DB_query_builder $db - * @property CI_DB_forge dbforge + * @property CI_DB_forge $dbforge */ class Migration_Add_service_attendants_number extends CI_Migration { /** diff --git a/application/migrations/009_change_column_types.php b/application/migrations/009_change_column_types.php index 05b8bbca..fe104601 100644 --- a/application/migrations/009_change_column_types.php +++ b/application/migrations/009_change_column_types.php @@ -15,7 +15,7 @@ * Class Migration_Change_column_types * * @property CI_DB_query_builder $db - * @property CI_DB_forge dbforge + * @property CI_DB_forge $dbforge */ class Migration_Change_column_types extends CI_Migration { /** diff --git a/application/migrations/010_add_time_format_setting.php b/application/migrations/010_add_time_format_setting.php index e7f09463..f1f32f5e 100644 --- a/application/migrations/010_add_time_format_setting.php +++ b/application/migrations/010_add_time_format_setting.php @@ -15,7 +15,7 @@ * Class Migration_Add_time_format_setting * * @property CI_DB_query_builder $db - * @property CI_DB_forge dbforge + * @property CI_DB_forge $dbforge */ class Migration_Add_time_format_setting extends CI_Migration { /** diff --git a/application/migrations/011_remove_prefix_from_fkey_constraints.php b/application/migrations/011_remove_prefix_from_fkey_constraints.php index 92a8f499..78426890 100644 --- a/application/migrations/011_remove_prefix_from_fkey_constraints.php +++ b/application/migrations/011_remove_prefix_from_fkey_constraints.php @@ -15,7 +15,7 @@ * Class Migration_Remove_prefix_from_foreign_keys * * @property CI_DB_query_builder $db - * @property CI_DB_forge dbforge + * @property CI_DB_forge $dbforge */ class Migration_Remove_prefix_from_fkey_constraints extends CI_Migration { /** diff --git a/application/migrations/012_legal_contents.php b/application/migrations/012_legal_contents.php index 7235e786..ed7a0823 100644 --- a/application/migrations/012_legal_contents.php +++ b/application/migrations/012_legal_contents.php @@ -15,7 +15,7 @@ * Class Migration_Create_consents_table * * @property CI_DB_query_builder $db - * @property CI_DB_forge dbforge + * @property CI_DB_forge $dbforge */ class Migration_Legal_contents extends CI_Migration { /** diff --git a/application/migrations/013_add_weekday_start_setting.php b/application/migrations/013_add_weekday_start_setting.php index df568e76..4f38da8d 100644 --- a/application/migrations/013_add_weekday_start_setting.php +++ b/application/migrations/013_add_weekday_start_setting.php @@ -15,7 +15,7 @@ * Class Migration_Add_weekday_start_setting * * @property CI_DB_query_builder $db - * @property CI_DB_forge dbforge + * @property CI_DB_forge $dbforge */ class Migration_Add_weekday_start_setting extends CI_Migration { /** diff --git a/application/migrations/014_create_appointment_location_column.php b/application/migrations/014_create_appointment_location_column.php index d41119c7..47fa18b4 100644 --- a/application/migrations/014_create_appointment_location_column.php +++ b/application/migrations/014_create_appointment_location_column.php @@ -15,7 +15,7 @@ * Class Migration_Create_appointment_location_column * * @property CI_DB_query_builder $db - * @property CI_DB_forge dbforge + * @property CI_DB_forge $dbforge */ class Migration_Create_appointment_location_column extends CI_Migration { /** diff --git a/application/migrations/015_add_working_plan_exceptions_to_user_settings.php b/application/migrations/015_add_working_plan_exceptions_to_user_settings.php index 0039ee43..31214d26 100644 --- a/application/migrations/015_add_working_plan_exceptions_to_user_settings.php +++ b/application/migrations/015_add_working_plan_exceptions_to_user_settings.php @@ -15,7 +15,7 @@ * Class Migration_Add_working_plan_exceptions_to_user_settings * * @property CI_DB_query_builder $db - * @property CI_DB_forge dbforge + * @property CI_DB_forge $dbforge */ class Migration_Add_working_plan_exceptions_to_user_settings extends CI_Migration { /** diff --git a/application/migrations/016_add_require_phone_number_setting.php b/application/migrations/016_add_require_phone_number_setting.php index 92d3676d..42f7712a 100644 --- a/application/migrations/016_add_require_phone_number_setting.php +++ b/application/migrations/016_add_require_phone_number_setting.php @@ -15,7 +15,7 @@ * Class Migration_Add_require_phone_number_setting * * @property CI_DB_query_builder $db - * @property CI_DB_forge dbforge + * @property CI_DB_forge $dbforge */ class Migration_Add_require_phone_number_setting extends CI_Migration { /** diff --git a/application/migrations/017_add_api_token_setting.php b/application/migrations/017_add_api_token_setting.php index 71a4dcf6..7ba49e5a 100644 --- a/application/migrations/017_add_api_token_setting.php +++ b/application/migrations/017_add_api_token_setting.php @@ -15,7 +15,7 @@ * Class Migration_Add_api_token_setting * * @property CI_DB_query_builder $db - * @property CI_DB_forge dbforge + * @property CI_DB_forge $dbforge */ class Migration_Add_api_token_setting extends CI_Migration { /** diff --git a/application/migrations/018_add_timezone_to_users.php b/application/migrations/018_add_timezone_to_users.php index add3aac0..000f9876 100644 --- a/application/migrations/018_add_timezone_to_users.php +++ b/application/migrations/018_add_timezone_to_users.php @@ -15,7 +15,7 @@ * Class Migration_Add_timezone_to_users * * @property CI_DB_query_builder $db - * @property CI_DB_forge dbforge + * @property CI_DB_forge $dbforge */ class Migration_Add_timezone_to_users extends CI_Migration { /** diff --git a/application/migrations/019_add_display_any_provider_setting.php b/application/migrations/019_add_display_any_provider_setting.php index 5827ce52..015dada9 100644 --- a/application/migrations/019_add_display_any_provider_setting.php +++ b/application/migrations/019_add_display_any_provider_setting.php @@ -15,7 +15,7 @@ * Class Migration_Add_display_any_provider_setting * * @property CI_DB_query_builder $db - * @property CI_DB_forge dbforge + * @property CI_DB_forge $dbforge */ class Migration_Add_display_any_provider_setting extends CI_Migration { /** diff --git a/application/migrations/020_add_language_to_users.php b/application/migrations/020_add_language_to_users.php index 329b74df..bede7aab 100644 --- a/application/migrations/020_add_language_to_users.php +++ b/application/migrations/020_add_language_to_users.php @@ -14,8 +14,8 @@ /** * Class Migration_Add_language_to_users * - * @property CI_DB_query_builder db - * @property CI_DB_forge dbforge + * @property CI_DB_query_builder $db + * @property CI_DB_forge $dbforge */ class Migration_Add_language_to_users extends CI_Migration { /** diff --git a/application/models/Admins_model.php b/application/models/Admins_model.php index 37b5a540..033ed6cc 100644 --- a/application/models/Admins_model.php +++ b/application/models/Admins_model.php @@ -16,12 +16,17 @@ * * Handles the database actions for admin users management. * - * @property CI_DB_query_builder $db - * @property CI_Loader $load - * * @package Models */ -class Admins_Model extends CI_Model { +class Admins_model extends EA_Model { + public function __construct() + { + parent::__construct(); + + $this->load->helper('general'); + $this->load->helper('data_validation'); + } + /** * Add (insert or update) an admin user record into database. * @@ -63,8 +68,6 @@ class Admins_Model extends CI_Model { */ public function validate($admin) { - $this->load->helper('data_validation'); - // If a record id is provided then check whether the record exists in the database. if (isset($admin['id'])) { @@ -153,7 +156,7 @@ class Admins_Model extends CI_Model { { $num_rows = $this->db->get_where('user_settings', ['username' => $username, 'id_users <> ' => $user_id])->num_rows(); - return ($num_rows > 0) ? FALSE : TRUE; + return $num_rows > 0 ? FALSE : TRUE; } /** @@ -227,8 +230,6 @@ class Admins_Model extends CI_Model { */ protected function insert($admin) { - $this->load->helper('general'); - $admin['id_roles'] = $this->get_admin_role_id(); $settings = $admin['settings']; unset($admin['settings']); @@ -278,8 +279,6 @@ class Admins_Model extends CI_Model { */ protected function update($admin) { - $this->load->helper('general'); - $settings = $admin['settings']; unset($admin['settings']); $settings['id_users'] = $admin['id']; diff --git a/application/models/Appointments_model.php b/application/models/Appointments_model.php index 5f86f8c5..d7fbcb88 100644 --- a/application/models/Appointments_model.php +++ b/application/models/Appointments_model.php @@ -14,12 +14,21 @@ /** * Appointments Model * - * @property CI_DB_query_builder $db - * @property CI_Loader $load - * * @package Models */ -class Appointments_Model extends CI_Model { +class Appointments_model extends EA_Model { + /** + * Appointments_Model constructor. + */ + public function __construct() + { + parent::__construct(); + + $this->load->helper('data_validation'); + + $this->load->library('timezones'); + } + /** * Add an appointment record to the database. * @@ -61,8 +70,6 @@ class Appointments_Model extends CI_Model { */ public function validate($appointment) { - $this->load->helper('data_validation'); - // If a appointment id is given, check whether the record exists in the database. if (isset($appointment['id'])) { @@ -225,7 +232,7 @@ class Appointments_Model extends CI_Model { ]) ->num_rows(); - return ($num_rows > 0) ? TRUE : FALSE; + return $num_rows > 0; } /** @@ -310,8 +317,6 @@ class Appointments_Model extends CI_Model { $appointment = $this->db->get_where('appointments', ['id' => $appointment_id])->row_array(); - $this->load->library('timezones'); - $appointment = $this->timezones->convert_event_timezone($appointment); return $appointment; @@ -356,8 +361,6 @@ class Appointments_Model extends CI_Model { throw new Exception('The given field name does not exist in the database: ' . $field_name); } - $this->load->library('timezones'); - $row_data = $this->timezones->convert_event_timezone($row_data); return $row_data[$field_name]; @@ -378,6 +381,7 @@ class Appointments_Model extends CI_Model { * @param bool $aggregates (OPTIONAL) Defines whether to add aggregations or not. * * @return array Returns the rows from the database. + * @throws Exception */ public function get_batch($where = NULL, $order_by = NULL, $limit = NULL, $offset = NULL, $aggregates = FALSE) { @@ -393,8 +397,6 @@ class Appointments_Model extends CI_Model { $appointments = $this->db->get('appointments', $limit, $offset)->result_array(); - $this->load->library('timezones'); - foreach ($appointments as &$appointment) { $appointment = $this->timezones->convert_event_timezone($appointment); diff --git a/application/models/Consents_model.php b/application/models/Consents_model.php index 49d0e524..b28432f7 100644 --- a/application/models/Consents_model.php +++ b/application/models/Consents_model.php @@ -14,12 +14,9 @@ /** * Class Consents_model * - * @property CI_DB_query_builder $db - * @property CI_Loader $load - * * @package Models */ -class Consents_model extends CI_Model { +class Consents_model extends EA_Model { /** * Add a consent record to the database. * diff --git a/application/models/Customers_model.php b/application/models/Customers_model.php index d11fa165..51a7bccf 100644 --- a/application/models/Customers_model.php +++ b/application/models/Customers_model.php @@ -14,12 +14,19 @@ /** * Customers Model * - * @property CI_DB_query_builder $db - * @property CI_Loader $load - * * @package Models */ -class Customers_Model extends CI_Model { +class Customers_model extends EA_Model { + /** + * Customers_Model constructor. + */ + public function __construct() + { + parent::__construct(); + + $this->load->helper('data_validation'); + } + /** * Add a customer record to the database. * @@ -37,14 +44,14 @@ class Customers_Model extends CI_Model { // Validate the customer data before doing anything. $this->validate($customer); - // :: CHECK IF CUSTOMER ALREADY EXIST (FROM EMAIL). + // Check if a customer already exists (by email). if ($this->exists($customer) && ! isset($customer['id'])) { // Find the customer id from the database. $customer['id'] = $this->find_record_id($customer); } - // :: INSERT OR UPDATE CUSTOMER RECORD + // Insert or update the customer record. if ( ! isset($customer['id'])) { $customer['id'] = $this->insert($customer); @@ -68,10 +75,7 @@ class Customers_Model extends CI_Model { */ public function validate($customer) { - $this->load->helper('data_validation'); - - // If a customer id is provided, check whether the record - // exist in the database. + // If a customer id is provided, check whether the record exist in the database. if (isset($customer['id'])) { $num_rows = $this->db->get_where('users', @@ -154,7 +158,7 @@ class Customers_Model extends CI_Model { ->where('roles.slug', DB_SLUG_CUSTOMER) ->get()->num_rows(); - return ($num_rows > 0) ? TRUE : FALSE; + return $num_rows > 0; } /** @@ -348,7 +352,7 @@ class Customers_Model extends CI_Model { * $this->Model->getBatch('id = ' . $recordId); * * @param mixed|null $where - * @param midex|null $order_by + * @param mixed|null $order_by * @param int|null $limit * @param int|null $offset * @return array Returns the rows from the database. diff --git a/application/models/Providers_model.php b/application/models/Providers_model.php index cf354cd8..18eaf95c 100755 --- a/application/models/Providers_model.php +++ b/application/models/Providers_model.php @@ -16,12 +16,20 @@ * * Contains the database operations for the service provider users of Easy!Appointments. * - * @property CI_DB_query_builder $db - * @property CI_Loader $load - * * @package Models */ -class Providers_Model extends CI_Model { +class Providers_model extends EA_Model { + /** + * Providers_Model constructor. + */ + public function __construct() + { + parent::__construct(); + + $this->load->helper('data_validation'); + $this->load->helper('general'); + } + /** * Add (insert - update) a service provider record. * @@ -66,7 +74,6 @@ class Providers_Model extends CI_Model { */ public function validate($provider) { - $this->load->helper('data_validation'); // If a provider id is present, check whether the record exist in the database. if (isset($provider['id'])) @@ -180,7 +187,7 @@ class Providers_Model extends CI_Model { { $num_rows = $this->db->get_where('user_settings', ['username' => $username, 'id_users <> ' => $user_id])->num_rows(); - return ($num_rows > 0) ? FALSE : TRUE; + return $num_rows > 0 ? FALSE : TRUE; } /** @@ -208,7 +215,7 @@ class Providers_Model extends CI_Model { ->where('roles.slug', DB_SLUG_PROVIDER) ->get()->num_rows(); - return ($num_rows > 0) ? TRUE : FALSE; + return $num_rows > 0; } /** @@ -254,7 +261,6 @@ class Providers_Model extends CI_Model { */ protected function insert($provider) { - $this->load->helper('general'); // Get provider role id. $provider['id_roles'] = $this->get_providers_role_id(); @@ -326,7 +332,14 @@ class Providers_Model extends CI_Model { if ($name === 'working_plan_exceptions') { $value = json_decode($value, TRUE); + + if (!$value) + { + $value = []; + } + krsort($value); + $value = json_encode($value); } @@ -342,6 +355,8 @@ class Providers_Model extends CI_Model { * @param string $setting_name The setting's name. * @param string $value The setting's value. * @param int $provider_id The selected provider id. + * + * @return bool */ public function set_setting($setting_name, $value, $provider_id) { @@ -394,8 +409,6 @@ class Providers_Model extends CI_Model { */ protected function update($provider) { - $this->load->helper('general'); - // Store service and settings (must not be present on the $provider array). $services = $provider['services']; unset($provider['services']); @@ -425,7 +438,7 @@ class Providers_Model extends CI_Model { /** * Delete an existing provider record from the database. * - * @param int $customer_id The record id to be deleted. + * @param $provider_id * * @return bool Returns the delete operation result. * diff --git a/application/models/Roles_model.php b/application/models/Roles_model.php index e7b7caa5..766552c5 100644 --- a/application/models/Roles_model.php +++ b/application/models/Roles_model.php @@ -14,12 +14,9 @@ /** * Roles Model * - * @property CI_DB_query_builder $db - * @property CI_Loader $load - * * @package Models */ -class Roles_Model extends CI_Model { +class Roles_model extends EA_Model { /** * Get the record id of a particular role. * diff --git a/application/models/Secretaries_model.php b/application/models/Secretaries_model.php index 861a20a0..a7af7f46 100644 --- a/application/models/Secretaries_model.php +++ b/application/models/Secretaries_model.php @@ -16,12 +16,20 @@ * * Handles the db actions that have to do with secretaries. * - * @property CI_DB_query_builder $db - * @property CI_Loader $load - * * @package Models */ -class Secretaries_Model extends CI_Model { +class Secretaries_model extends EA_Model { + /** + * Secretaries_Model constructor. + */ + public function __construct() + { + parent::__construct(); + + $this->load->helper('general'); + $this->load->helper('data_validation'); + } + /** * Add (insert or update) a secretary user record into database. * @@ -63,8 +71,6 @@ class Secretaries_Model extends CI_Model { */ public function validate($secretary) { - $this->load->helper('data_validation'); - // If a record id is provided then check whether the record exists in the database. if (isset($secretary['id'])) { @@ -159,7 +165,7 @@ class Secretaries_Model extends CI_Model { { $num_rows = $this->db->get_where('user_settings', ['username' => $username, 'id_users <> ' => $user_id])->num_rows(); - return ($num_rows > 0) ? FALSE : TRUE; + return $num_rows > 0 ? FALSE : TRUE; } /** @@ -187,7 +193,7 @@ class Secretaries_Model extends CI_Model { ->where('roles.slug', DB_SLUG_SECRETARY) ->get()->num_rows(); - return ($num_rows > 0) ? TRUE : FALSE; + return $num_rows > 0; } /** @@ -233,8 +239,6 @@ class Secretaries_Model extends CI_Model { */ protected function insert($secretary) { - $this->load->helper('general'); - $providers = $secretary['providers']; unset($secretary['providers']); $settings = $secretary['settings']; @@ -340,6 +344,8 @@ class Secretaries_Model extends CI_Model { * @param string $setting_name The setting's name. * @param string $value The setting's value. * @param int $secretary_id The selected provider id. + * + * @return bool */ public function set_setting($setting_name, $value, $secretary_id) { @@ -358,8 +364,6 @@ class Secretaries_Model extends CI_Model { */ protected function update($secretary) { - $this->load->helper('general'); - $providers = $secretary['providers']; unset($secretary['providers']); $settings = $secretary['settings']; diff --git a/application/models/Services_model.php b/application/models/Services_model.php index df6d101a..31de1865 100644 --- a/application/models/Services_model.php +++ b/application/models/Services_model.php @@ -14,12 +14,19 @@ /** * Services Model * - * @property CI_DB_query_builder $db - * @property CI_Loader $load - * * @package Models */ -class Services_Model extends CI_Model { +class Services_model extends EA_Model { + /** + * Services_Model constructor. + */ + public function __construct() + { + parent::__construct(); + + $this->load->helper('data_validation'); + } + /** * Add (insert or update) a service record on the database * @@ -55,14 +62,11 @@ class Services_Model extends CI_Model { */ public function validate($service) { - $this->load->helper('data_validation'); - - // If record id is provided we need to check whether the record exists - // in the database. + // If record id is provided we need to check whether the record exists in the database. if (isset($service['id'])) { - $num_rows = $this->db->get_where('services', ['id' => $service['id']]) - ->num_rows(); + $num_rows = $this->db->get_where('services', ['id' => $service['id']])->num_rows(); + if ($num_rows == 0) { throw new Exception('Provided service id does not exist in the database.'); @@ -182,17 +186,19 @@ class Services_Model extends CI_Model { 'price' => $service['price'] ])->num_rows(); - return ($num_rows > 0) ? TRUE : FALSE; + return $num_rows > 0; } /** * Get the record id of an existing record. * - * NOTICE: The record must exist, otherwise an exception will be raised. + * Notice: The record must exist, otherwise an exception will be raised. * * @param array $service Contains the service record data. Name, duration and price values are mandatory for this * method to complete. * + * @return int + * * @throws Exception If required fields are missing. * @throws Exception If requested service was not found. */ @@ -308,12 +314,16 @@ class Services_Model extends CI_Model { /** * Get all, or specific records from service's table. * - * @param string $whereClause (OPTIONAL) The WHERE clause of - * the query to be executed. DO NOT INCLUDE 'WHERE' KEYWORD. + * Example: + * + * $this->model->get_batch(['id' => $record_id]); + * + * @param mixed $where + * @param mixed $order_by + * @param int|null $limit + * @param int|null $offset * * @return array Returns the rows from the database. - * @example $this->Model->getBatch('id = ' . $recordId); - * */ public function get_batch($where = NULL, $order_by = NULL, $limit = NULL, $offset = NULL) { @@ -471,6 +481,11 @@ class Services_Model extends CI_Model { /** * Get all service category records from database. * + * @param mixed $where + * @param mixed $order_by + * @param int|null $limit + * @param int|null $offset + * * @return array Returns an array that contains all the service category records. */ public function get_all_categories($where = NULL, $order_by = NULL, $limit = NULL, $offset = NULL) diff --git a/application/models/Settings_model.php b/application/models/Settings_model.php index 396f9045..530c1f66 100644 --- a/application/models/Settings_model.php +++ b/application/models/Settings_model.php @@ -14,12 +14,9 @@ /** * Settings Model * - * @property CI_DB_query_builder $db - * @property CI_Loader $load - * * @package Models */ -class Settings_Model extends CI_Model { +class Settings_model extends EA_Model { /** * Get setting value from database. * diff --git a/application/models/User_model.php b/application/models/User_model.php index 417734aa..00e31655 100644 --- a/application/models/User_model.php +++ b/application/models/User_model.php @@ -16,12 +16,22 @@ * * Contains current user's methods. * - * @property CI_DB_query_builder $db - * @property CI_Loader $load - * * @package Models */ -class User_Model extends CI_Model { +class User_model extends EA_Model { + /** + * User_Model constructor. + */ + public function __construct() + { + parent::__construct(); + + $this->load->library('timezones'); + + $this->load->helper('general'); + $this->load->helper('string'); + } + /** * Returns the user from the database for the "settings" page. * @@ -53,7 +63,6 @@ class User_Model extends CI_Model { // Prepare user password (hash). if (isset($user_settings['password'])) { - $this->load->helper('general'); $salt = $this->db->get_where('user_settings', ['id_users' => $user['id']])->row()->salt; $user_settings['password'] = hash_password($salt, $user_settings['password']); } @@ -81,7 +90,6 @@ class User_Model extends CI_Model { */ public function check_login($username, $password) { - $this->load->helper('general'); $salt = $this->get_salt($username); $password = hash_password($salt, $password); @@ -109,8 +117,6 @@ class User_Model extends CI_Model { return NULL; } - $this->load->library('timezones'); - $default_timezone = $this->timezones->get_default_timezone(); return [ @@ -167,9 +173,6 @@ class User_Model extends CI_Model { */ public function regenerate_password($username, $email) { - $this->load->helper('general'); - $this->load->helper('string'); - $result = $this->db ->select('users.id') ->from('users') diff --git a/application/views/appointments/book.php b/application/views/appointments/book.php index ec8a3e7f..3115ccaf 100755 --- a/application/views/appointments/book.php +++ b/application/views/appointments/book.php @@ -206,7 +206,7 @@

-
+
diff --git a/application/views/backend/calendar.php b/application/views/backend/calendar.php index 00af0857..bc472cb1 100755 --- a/application/views/backend/calendar.php +++ b/application/views/backend/calendar.php @@ -82,7 +82,8 @@ - + session->userdata('role_slug') !== 'admin' ? 'hidden' : '' ?>> diff --git a/application/views/general/installation.php b/application/views/general/installation.php index 67a3e925..6d08baec 100755 --- a/application/views/general/installation.php +++ b/application/views/general/installation.php @@ -22,7 +22,7 @@
-
+

Welcome to the Easy!Appointments installation page.

diff --git a/application/views/user/login.php b/application/views/user/login.php index 4cffdddc..45c52e19 100644 --- a/application/views/user/login.php +++ b/application/views/user/login.php @@ -15,6 +15,11 @@ + + + + + - - - - -

diff --git a/assets/js/backend_calendar_default_view.js b/assets/js/backend_calendar_default_view.js index aaca4e7d..c29558b5 100755 --- a/assets/js/backend_calendar_default_view.js +++ b/assets/js/backend_calendar_default_view.js @@ -1245,7 +1245,8 @@ window.BackendCalendarDefaultView = window.BackendCalendarDefaultView || {}; var calendarDate = calendarView.start.clone(); while (calendarDate < calendarView.end) { - weekdayName = calendarDate.format('dddd').toLowerCase(); + weekdayNumber = parseInt(calendarDate.format('d')) + weekdayName = GeneralFunctions.getWeekdayName(weekdayNumber); weekdayDate = calendarDate.format('YYYY-MM-DD'); // Add working plan exception event. diff --git a/assets/js/backend_calendar_table_view.js b/assets/js/backend_calendar_table_view.js index a4562e4b..fd2742db 100755 --- a/assets/js/backend_calendar_table_view.js +++ b/assets/js/backend_calendar_table_view.js @@ -413,32 +413,38 @@ window.BackendCalendarTableView = window.BackendCalendarTableView || {}; }); // Create providers and service filters. - if (GlobalVariables.user.role_slug !== Backend.DB_SLUG_PROVIDER) { - $('