diff --git a/src/application/config/migration.php b/src/application/config/migration.php index 5f8c03eb37..988cc798c2 100644 --- a/src/application/config/migration.php +++ b/src/application/config/migration.php @@ -37,7 +37,7 @@ | be upgraded / downgraded to. | */ -$config['migration_version'] = 13; // current +$config['migration_version'] = 14; // current /* diff --git a/src/application/controllers/Appointments.php b/src/application/controllers/Appointments.php index 8ba95fdc96..281d9bf7ee 100755 --- a/src/application/controllers/Appointments.php +++ b/src/application/controllers/Appointments.php @@ -76,6 +76,7 @@ public function index($appointment_hash = '') $company_name = $this->settings_model->get_setting('company_name'); $date_format = $this->settings_model->get_setting('date_format'); $time_format = $this->settings_model->get_setting('time_format'); + $require_phone_number = $this->settings_model->get_setting('require_phone_number'); $display_cookie_notice = $this->settings_model->get_setting('display_cookie_notice'); $cookie_notice_content = $this->settings_model->get_setting('cookie_notice_content'); $display_terms_and_conditions = $this->settings_model->get_setting('display_terms_and_conditions'); @@ -147,6 +148,7 @@ public function index($appointment_hash = '') 'customer_token' => $customer_token, 'date_format' => $date_format, 'time_format' => $time_format, + 'require_phone_number' => $require_phone_number, 'appointment_data' => $appointment, 'provider_data' => $provider, 'customer_data' => $customer, diff --git a/src/application/controllers/Backend.php b/src/application/controllers/Backend.php index 71ee131977..fde3f8c00e 100755 --- a/src/application/controllers/Backend.php +++ b/src/application/controllers/Backend.php @@ -133,6 +133,7 @@ public function customers() $view['company_name'] = $this->settings_model->get_setting('company_name'); $view['date_format'] = $this->settings_model->get_setting('date_format'); $view['time_format'] = $this->settings_model->get_setting('time_format'); + $view['require_phone_number'] = $this->settings_model->get_setting('require_phone_number'); $view['customers'] = $this->customers_model->get_batch(); $view['available_providers'] = $this->providers_model->get_available_providers(); $view['available_services'] = $this->services_model->get_available_services(); diff --git a/src/application/language/arabic/translations_lang.php b/src/application/language/arabic/translations_lang.php index 641ad909de..ccec7b7222 100755 --- a/src/application/language/arabic/translations_lang.php +++ b/src/application/language/arabic/translations_lang.php @@ -298,3 +298,5 @@ $lang['delete_personal_information'] = 'Delete Personal Information'; $lang['delete_personal_information_prompt'] = 'Are you sure that you want to delete your personal information? This action cannot be undone.'; $lang['location'] = 'Location'; +$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'; diff --git a/src/application/language/bulgarian/translations_lang.php b/src/application/language/bulgarian/translations_lang.php index 38e182c378..2eef37ca0c 100755 --- a/src/application/language/bulgarian/translations_lang.php +++ b/src/application/language/bulgarian/translations_lang.php @@ -298,3 +298,5 @@ $lang['delete_personal_information'] = 'Delete Personal Information'; $lang['delete_personal_information_prompt'] = 'Are you sure that you want to delete your personal information? This action cannot be undone.'; $lang['location'] = 'Location'; +$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'; diff --git a/src/application/language/chinese/translations_lang.php b/src/application/language/chinese/translations_lang.php index 7302958d4a..5a819ac418 100755 --- a/src/application/language/chinese/translations_lang.php +++ b/src/application/language/chinese/translations_lang.php @@ -298,3 +298,5 @@ $lang['delete_personal_information'] = 'Delete Personal Information'; $lang['delete_personal_information_prompt'] = 'Are you sure that you want to delete your personal information? This action cannot be undone.'; $lang['location'] = 'Location'; +$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'; diff --git a/src/application/language/danish/translations_lang.php b/src/application/language/danish/translations_lang.php index 0d301b9bf0..45fb309353 100755 --- a/src/application/language/danish/translations_lang.php +++ b/src/application/language/danish/translations_lang.php @@ -298,3 +298,5 @@ $lang['delete_personal_information'] = 'Delete Personal Information'; $lang['delete_personal_information_prompt'] = 'Are you sure that you want to delete your personal information? This action cannot be undone.'; $lang['location'] = 'Location'; +$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'; diff --git a/src/application/language/dutch/translations_lang.php b/src/application/language/dutch/translations_lang.php index e9b0cdc770..d2acec5bd5 100755 --- a/src/application/language/dutch/translations_lang.php +++ b/src/application/language/dutch/translations_lang.php @@ -298,3 +298,5 @@ $lang['delete_personal_information'] = 'Delete Personal Information'; $lang['delete_personal_information_prompt'] = 'Are you sure that you want to delete your personal information? This action cannot be undone.'; $lang['location'] = 'Location'; +$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'; diff --git a/src/application/language/english/translations_lang.php b/src/application/language/english/translations_lang.php index 33dc74e362..7061bc9f36 100755 --- a/src/application/language/english/translations_lang.php +++ b/src/application/language/english/translations_lang.php @@ -298,3 +298,5 @@ $lang['delete_personal_information'] = 'Delete Personal Information'; $lang['delete_personal_information_prompt'] = 'Are you sure that you want to delete your personal information? This action cannot be undone.'; $lang['location'] = 'Location'; +$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'; diff --git a/src/application/language/finnish/translations_lang.php b/src/application/language/finnish/translations_lang.php index 8ec16de63d..3208072d7b 100755 --- a/src/application/language/finnish/translations_lang.php +++ b/src/application/language/finnish/translations_lang.php @@ -298,3 +298,5 @@ $lang['delete_personal_information'] = 'Delete Personal Information'; $lang['delete_personal_information_prompt'] = 'Are you sure that you want to delete your personal information? This action cannot be undone.'; $lang['location'] = 'Location'; +$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'; diff --git a/src/application/language/french/translations_lang.php b/src/application/language/french/translations_lang.php index 36f5f59c46..0060bc969d 100755 --- a/src/application/language/french/translations_lang.php +++ b/src/application/language/french/translations_lang.php @@ -298,3 +298,5 @@ $lang['delete_personal_information'] = 'Effacer toutes mes données personnelles'; $lang['delete_personal_information_prompt'] = 'Etes-vous sûr(e) de vouloir effacer toutes vos données personnelles ? Cette action est irréversible.'; $lang['location'] = 'Location'; +$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'; diff --git a/src/application/language/german/translations_lang.php b/src/application/language/german/translations_lang.php index f252cd013e..b4f23688b8 100755 --- a/src/application/language/german/translations_lang.php +++ b/src/application/language/german/translations_lang.php @@ -298,3 +298,5 @@ $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['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'; diff --git a/src/application/language/greek/translations_lang.php b/src/application/language/greek/translations_lang.php index b2e234a7c1..4ba0de50e6 100755 --- a/src/application/language/greek/translations_lang.php +++ b/src/application/language/greek/translations_lang.php @@ -298,3 +298,6 @@ $lang['delete_personal_information'] = 'Διαγραφή Προσωπικών Πληροφοριών'; $lang['delete_personal_information_prompt'] = 'Είστε σίγουρος ότι θέλετε να διαγράψετε τις προσωπικές σας πληροφορίες; Αυτή η ενέργεια δεν μπορεί να αναιρεθεί.'; $lang['location'] = 'Τοποθεσία'; +$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'; + diff --git a/src/application/language/hindi/translations_lang.php b/src/application/language/hindi/translations_lang.php index abea1d553f..bd6e86af9c 100755 --- a/src/application/language/hindi/translations_lang.php +++ b/src/application/language/hindi/translations_lang.php @@ -298,3 +298,5 @@ $lang['delete_personal_information'] = 'Delete Personal Information'; $lang['delete_personal_information_prompt'] = 'Are you sure that you want to delete your personal information? This action cannot be undone.'; $lang['location'] = 'Location'; +$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'; diff --git a/src/application/language/hungarian/translations_lang.php b/src/application/language/hungarian/translations_lang.php index 4e074324f7..26413129b0 100755 --- a/src/application/language/hungarian/translations_lang.php +++ b/src/application/language/hungarian/translations_lang.php @@ -298,3 +298,5 @@ $lang['delete_personal_information'] = 'Delete Personal Information'; $lang['delete_personal_information_prompt'] = 'Are you sure that you want to delete your personal information? This action cannot be undone.'; $lang['location'] = 'Location'; +$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'; diff --git a/src/application/language/italian/translations_lang.php b/src/application/language/italian/translations_lang.php index b462560253..8978e913fe 100755 --- a/src/application/language/italian/translations_lang.php +++ b/src/application/language/italian/translations_lang.php @@ -298,3 +298,5 @@ $lang['delete_personal_information'] = 'Delete Personal Information'; $lang['delete_personal_information_prompt'] = 'Are you sure that you want to delete your personal information? This action cannot be undone.'; $lang['location'] = 'Location'; +$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'; diff --git a/src/application/language/japanese/translations_lang.php b/src/application/language/japanese/translations_lang.php index 9087afe6c7..b580173ddd 100755 --- a/src/application/language/japanese/translations_lang.php +++ b/src/application/language/japanese/translations_lang.php @@ -298,3 +298,5 @@ $lang['delete_personal_information'] = 'Delete Personal Information'; $lang['delete_personal_information_prompt'] = 'Are you sure that you want to delete your personal information? This action cannot be undone.'; $lang['location'] = 'Location'; +$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'; diff --git a/src/application/language/luxembourgish/translations_lang.php b/src/application/language/luxembourgish/translations_lang.php index 91dd0e14c6..18813c8877 100755 --- a/src/application/language/luxembourgish/translations_lang.php +++ b/src/application/language/luxembourgish/translations_lang.php @@ -298,3 +298,5 @@ $lang['delete_personal_information'] = 'Delete Personal Information'; $lang['delete_personal_information_prompt'] = 'Are you sure that you want to delete your personal information? This action cannot be undone.'; $lang['location'] = 'Location'; +$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'; diff --git a/src/application/language/polish/translations_lang.php b/src/application/language/polish/translations_lang.php index d04c653331..69d3e46e7c 100755 --- a/src/application/language/polish/translations_lang.php +++ b/src/application/language/polish/translations_lang.php @@ -298,3 +298,5 @@ $lang['delete_personal_information'] = 'Delete Personal Information'; $lang['delete_personal_information_prompt'] = 'Are you sure that you want to delete your personal information? This action cannot be undone.'; $lang['location'] = 'Location'; +$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'; diff --git a/src/application/language/portuguese-br/translations_lang.php b/src/application/language/portuguese-br/translations_lang.php index 390d25bb17..f8f3cb68dc 100755 --- a/src/application/language/portuguese-br/translations_lang.php +++ b/src/application/language/portuguese-br/translations_lang.php @@ -298,3 +298,5 @@ $lang['delete_personal_information'] = 'Delete Personal Information'; $lang['delete_personal_information_prompt'] = 'Are you sure that you want to delete your personal information? This action cannot be undone.'; $lang['location'] = 'Location'; +$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'; diff --git a/src/application/language/portuguese/translations_lang.php b/src/application/language/portuguese/translations_lang.php index 6a5ee8e4c5..ba330137ae 100755 --- a/src/application/language/portuguese/translations_lang.php +++ b/src/application/language/portuguese/translations_lang.php @@ -298,3 +298,5 @@ $lang['delete_personal_information'] = 'Delete Personal Information'; $lang['delete_personal_information_prompt'] = 'Are you sure that you want to delete your personal information? This action cannot be undone.'; $lang['location'] = 'Location'; +$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'; diff --git a/src/application/language/romanian/translations_lang.php b/src/application/language/romanian/translations_lang.php index cb06b90c87..889c9499f5 100755 --- a/src/application/language/romanian/translations_lang.php +++ b/src/application/language/romanian/translations_lang.php @@ -298,3 +298,5 @@ $lang['delete_personal_information'] = 'Delete Personal Information'; $lang['delete_personal_information_prompt'] = 'Are you sure that you want to delete your personal information? This action cannot be undone.'; $lang['location'] = 'Location'; +$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'; diff --git a/src/application/language/russian/translations_lang.php b/src/application/language/russian/translations_lang.php index a1f4817afa..0ba302198f 100755 --- a/src/application/language/russian/translations_lang.php +++ b/src/application/language/russian/translations_lang.php @@ -298,3 +298,5 @@ $lang['delete_personal_information'] = 'Delete Personal Information'; $lang['delete_personal_information_prompt'] = 'Are you sure that you want to delete your personal information? This action cannot be undone.'; $lang['location'] = 'Location'; +$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'; diff --git a/src/application/language/slovak/translations_lang.php b/src/application/language/slovak/translations_lang.php index 2f3214aedc..41d32aad8e 100755 --- a/src/application/language/slovak/translations_lang.php +++ b/src/application/language/slovak/translations_lang.php @@ -298,3 +298,5 @@ $lang['delete_personal_information'] = 'Delete Personal Information'; $lang['delete_personal_information_prompt'] = 'Are you sure that you want to delete your personal information? This action cannot be undone.'; $lang['location'] = 'Location'; +$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'; diff --git a/src/application/language/spanish/translations_lang.php b/src/application/language/spanish/translations_lang.php index cffc8b9309..98c3936e09 100755 --- a/src/application/language/spanish/translations_lang.php +++ b/src/application/language/spanish/translations_lang.php @@ -298,3 +298,5 @@ $lang['delete_personal_information'] = 'Delete Personal Information'; $lang['delete_personal_information_prompt'] = 'Are you sure that you want to delete your personal information? This action cannot be undone.'; $lang['location'] = 'Location'; +$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'; diff --git a/src/application/language/turkish/translations_lang.php b/src/application/language/turkish/translations_lang.php index 1e77b54738..78f84903bf 100755 --- a/src/application/language/turkish/translations_lang.php +++ b/src/application/language/turkish/translations_lang.php @@ -298,3 +298,5 @@ $lang['delete_personal_information'] = 'Delete Personal Information'; $lang['delete_personal_information_prompt'] = 'Are you sure that you want to delete your personal information? This action cannot be undone.'; $lang['location'] = 'Location'; +$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'; diff --git a/src/application/migrations/014_add_require_phone_number_setting.php b/src/application/migrations/014_add_require_phone_number_setting.php new file mode 100644 index 0000000000..c0753df4fa --- /dev/null +++ b/src/application/migrations/014_add_require_phone_number_setting.php @@ -0,0 +1,35 @@ + + * @copyright Copyright (c) 2013 - 2018, Alex Tselegidis + * @license http://opensource.org/licenses/GPL-3.0 - GPLv3 + * @link http://easyappointments.org + * @since v1.4.0 + * ---------------------------------------------------------------------------- */ + +class Migration_Add_require_phone_number_setting extends CI_Migration { + public function up() + { + $this->load->model('settings_model'); + + try + { + $this->settings_model->get_setting('require_phone_number'); + } + catch (Exception $exception) + { + $this->settings_model->set_setting('require_phone_number', '1'); + } + } + + public function down() + { + $this->load->model('settings_model'); + + $this->settings_model->remove_setting('require_phone_number'); + } +} diff --git a/src/application/models/Customers_model.php b/src/application/models/Customers_model.php index b949df6005..e6cb88ace0 100644 --- a/src/application/models/Customers_model.php +++ b/src/application/models/Customers_model.php @@ -211,10 +211,14 @@ public function validate($customer) . 'exist in the database.'); } } + + $query = $this->db->get_where('ea_settings', ['name' => 'require_phone_number']); + $phone_number_required = $query->num_rows() > 0 ? $query->row() === '1' : false; + // Validate required fields if ( ! isset($customer['last_name']) || ! isset($customer['email']) - || ! isset($customer['phone_number'])) + || (!isset($customer['phone_number']) && $phone_number_required)) { throw new Exception('Not all required fields are provided: ' . print_r($customer, TRUE)); diff --git a/src/application/views/appointments/book.php b/src/application/views/appointments/book.php index 20b999822b..1f8bd35ba7 100755 --- a/src/application/views/appointments/book.php +++ b/src/application/views/appointments/book.php @@ -223,8 +223,10 @@
- - + +
diff --git a/src/application/views/backend/customers.php b/src/application/views/backend/customers.php index a73be76276..0d3bcd7158 100755 --- a/src/application/views/backend/customers.php +++ b/src/application/views/backend/customers.php @@ -109,8 +109,10 @@
- - + +
diff --git a/src/application/views/backend/settings.php b/src/application/views/backend/settings.php index 65d9232bb1..81ea4dfc04 100755 --- a/src/application/views/backend/settings.php +++ b/src/application/views/backend/settings.php @@ -159,6 +159,19 @@
+
+ +
+ + + + +
diff --git a/src/assets/js/backend_settings.js b/src/assets/js/backend_settings.js index 6d20efe91c..bdb75a86e2 100644 --- a/src/assets/js/backend_settings.js +++ b/src/assets/js/backend_settings.js @@ -71,6 +71,10 @@ window.BackendSettings = window.BackendSettings || {}; $('#require-captcha').addClass('active'); } + if (setting.name === 'require_phone_number' && setting.value === '1') { + $('#require-phone-number').addClass('active'); + } + if (setting.name === 'display_cookie_notice') { $('#display-cookie-notice').prop('checked', setting.value === '1'); } diff --git a/src/assets/js/backend_settings_system.js b/src/assets/js/backend_settings_system.js index e2c4fe4b75..0e4e9e1845 100644 --- a/src/assets/js/backend_settings_system.js +++ b/src/assets/js/backend_settings_system.js @@ -82,6 +82,12 @@ value: $('#require-captcha').hasClass('active') === true ? '1' : '0' }); + settings.push({ + name: 'require_phone_number', + value: $('#require-phone-number').hasClass('active') === true ? '1' : '0' + }); + + // Business Logic Tab settings.push({ name: 'company_working_plan', diff --git a/src/assets/sql/data.sql b/src/assets/sql/data.sql index f5c4a93d04..bda0e52519 100644 --- a/src/assets/sql/data.sql +++ b/src/assets/sql/data.sql @@ -22,6 +22,7 @@ VALUES ('display_terms_and_conditions', '0'), ('terms_and_conditions_content', 'Terms and conditions content.'), ('display_privacy_policy', '0'), - ('privacy_policy_content', 'Privacy policy content.'); + ('privacy_policy_content', 'Privacy policy content.'), + ('require_phone_number', '1'); -INSERT INTO `ea_migrations` VALUES ('13'); +INSERT INTO `ea_migrations` VALUES ('14');