diff --git a/src/application/config/migration.php b/src/application/config/migration.php index 5f8c03eb..988cc798 100644 --- a/src/application/config/migration.php +++ b/src/application/config/migration.php @@ -37,7 +37,7 @@ $config['migration_table'] = 'ea_migrations'; | 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 8ba95fdc..281d9bf7 100755 --- a/src/application/controllers/Appointments.php +++ b/src/application/controllers/Appointments.php @@ -76,6 +76,7 @@ class Appointments extends CI_Controller { $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 @@ class Appointments extends CI_Controller { '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 71ee1319..fde3f8c0 100755 --- a/src/application/controllers/Backend.php +++ b/src/application/controllers/Backend.php @@ -133,6 +133,7 @@ class Backend extends CI_Controller { $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 641ad909..ccec7b72 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_hint'] = 'Delete all personal information fro $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 38e182c3..2eef37ca 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_hint'] = 'Delete all personal information fro $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 7302958d..5a819ac4 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_hint'] = 'Delete all personal information fro $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 0d301b9b..45fb3093 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_hint'] = 'Delete all personal information fro $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 e9b0cdc7..d2acec5b 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_hint'] = 'Delete all personal information fro $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 33dc74e3..7061bc9f 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_hint'] = 'Delete all personal information fro $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 8ec16de6..3208072d 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_hint'] = 'Delete all personal information fro $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 36f5f59c..0060bc96 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_hint'] = 'Effacer toutes vos données personn $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 f252cd01..b4f23688 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_hint'] = 'Alle persönlichen Informationen au $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 b2e234a7..4ba0de50 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_hint'] = 'Διαγραφή όλων των π $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 abea1d55..bd6e86af 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_hint'] = 'Delete all personal information fro $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 4e074324..26413129 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_hint'] = 'Delete all personal information fro $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 b4625602..8978e913 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_hint'] = 'Delete all personal information fro $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 9087afe6..b580173d 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_hint'] = 'Delete all personal information fro $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 91dd0e14..18813c88 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_hint'] = 'Delete all personal information fro $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 d04c6533..69d3e46e 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_hint'] = 'Delete all personal information fro $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 390d25bb..f8f3cb68 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_hint'] = 'Delete all personal information fro $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 6a5ee8e4..ba330137 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_hint'] = 'Delete all personal information fro $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 cb06b90c..889c9499 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_hint'] = 'Delete all personal information fro $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 a1f4817a..0ba30219 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_hint'] = 'Delete all personal information fro $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 2f3214ae..41d32aad 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_hint'] = 'Delete all personal information fro $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 cffc8b93..98c3936e 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_hint'] = 'Delete all personal information fro $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 1e77b547..78f84903 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_hint'] = 'Delete all personal information fro $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 00000000..c0753df4 --- /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 b949df60..e6cb88ac 100644 --- a/src/application/models/Customers_model.php +++ b/src/application/models/Customers_model.php @@ -211,10 +211,14 @@ class Customers_Model extends CI_Model { . '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 20b99982..1f8bd35b 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 a73be762..0d3bcd71 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 65d9232b..81ea4dfc 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 6d20efe9..bdb75a86 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 e2c4fe4b..0e4e9e18 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 f5c4a93d..bda0e525 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');