diff --git a/src/application/config/migration.php b/src/application/config/migration.php index 988cc798..b60a960f 100755 --- 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'] = 14; // current +$config['migration_version'] = 15; // current /* diff --git a/src/application/controllers/Appointments.php b/src/application/controllers/Appointments.php index 225bfb9f..3d6a44d9 100755 --- a/src/application/controllers/Appointments.php +++ b/src/application/controllers/Appointments.php @@ -77,6 +77,7 @@ class Appointments extends CI_Controller { $date_format = $this->settings_model->get_setting('date_format'); $time_format = $this->settings_model->get_setting('time_format'); $first_weekday = $this->settings_model->get_setting('first_weekday'); + $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'); @@ -149,6 +150,7 @@ class Appointments extends CI_Controller { 'date_format' => $date_format, 'time_format' => $time_format, 'first_weekday' => $first_weekday, + '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 b649a131..e1624254 100755 --- a/src/application/controllers/Backend.php +++ b/src/application/controllers/Backend.php @@ -135,6 +135,7 @@ class Backend extends CI_Controller { $view['date_format'] = $this->settings_model->get_setting('date_format'); $view['time_format'] = $this->settings_model->get_setting('time_format'); $view['first_weekday'] = $this->settings_model->get_setting('first_weekday'); + $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 0cf5406b..b6592f91 100755 --- a/src/application/language/arabic/translations_lang.php +++ b/src/application/language/arabic/translations_lang.php @@ -305,3 +305,5 @@ $lang['new_extra_period_title'] = ''; $lang['extra_period_saved'] = ''; $lang['add_extra_periods_during_each_day'] = ''; $lang['add_extra_period'] = ''; +$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 8b95baf5..ddc60363 100755 --- a/src/application/language/bulgarian/translations_lang.php +++ b/src/application/language/bulgarian/translations_lang.php @@ -305,3 +305,5 @@ $lang['new_extra_period_title'] = ''; $lang['extra_period_saved'] = ''; $lang['add_extra_periods_during_each_day'] = ''; $lang['add_extra_period'] = ''; +$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 b3f9f0d8..268173d2 100755 --- a/src/application/language/chinese/translations_lang.php +++ b/src/application/language/chinese/translations_lang.php @@ -305,3 +305,5 @@ $lang['new_extra_period_title'] = ''; $lang['extra_period_saved'] = ''; $lang['add_extra_periods_during_each_day'] = ''; $lang['add_extra_period'] = ''; +$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 7b901701..170057b3 100755 --- a/src/application/language/danish/translations_lang.php +++ b/src/application/language/danish/translations_lang.php @@ -305,3 +305,5 @@ $lang['new_extra_period_title'] = ''; $lang['extra_period_saved'] = ''; $lang['add_extra_periods_during_each_day'] = ''; $lang['add_extra_period'] = ''; +$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 d02bd3ad..316760d5 100755 --- a/src/application/language/dutch/translations_lang.php +++ b/src/application/language/dutch/translations_lang.php @@ -305,3 +305,5 @@ $lang['new_extra_period_title'] = ''; $lang['extra_period_saved'] = ''; $lang['add_extra_periods_during_each_day'] = ''; $lang['add_extra_period'] = ''; +$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 3aa67d2c..eab10493 100755 --- a/src/application/language/english/translations_lang.php +++ b/src/application/language/english/translations_lang.php @@ -305,3 +305,5 @@ $lang['new_extra_period_title'] = 'New working day'; $lang['extra_period_saved'] = 'New working day saved successfully!'; $lang['add_extra_periods_during_each_day'] = 'Add working days outside the working plan.'; $lang['add_extra_period'] = 'Add a working day'; +$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 a0763798..ada208ba 100755 --- a/src/application/language/finnish/translations_lang.php +++ b/src/application/language/finnish/translations_lang.php @@ -305,3 +305,5 @@ $lang['new_extra_period_title'] = ''; $lang['extra_period_saved'] = ''; $lang['add_extra_periods_during_each_day'] = ''; $lang['add_extra_period'] = ''; +$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 22301b3d..29dcfdf1 100755 --- a/src/application/language/french/translations_lang.php +++ b/src/application/language/french/translations_lang.php @@ -308,3 +308,5 @@ $lang['new_extra_period_title'] = ''; $lang['extra_period_saved'] = ''; $lang['add_extra_periods_during_each_day'] = ''; $lang['add_extra_period'] = ''; +$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 ba7ae975..77f675ae 100755 --- a/src/application/language/german/translations_lang.php +++ b/src/application/language/german/translations_lang.php @@ -305,3 +305,5 @@ $lang['new_extra_period_title'] = ''; $lang['extra_period_saved'] = ''; $lang['add_extra_periods_during_each_day'] = ''; $lang['add_extra_period'] = ''; +$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 3201e7c3..77027506 100755 --- a/src/application/language/greek/translations_lang.php +++ b/src/application/language/greek/translations_lang.php @@ -305,3 +305,6 @@ $lang['new_extra_period_title'] = ''; $lang['extra_period_saved'] = ''; $lang['add_extra_periods_during_each_day'] = ''; $lang['add_extra_period'] = ''; +$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 a83722e0..95332ef7 100755 --- a/src/application/language/hindi/translations_lang.php +++ b/src/application/language/hindi/translations_lang.php @@ -305,3 +305,5 @@ $lang['new_extra_period_title'] = ''; $lang['extra_period_saved'] = ''; $lang['add_extra_periods_during_each_day'] = ''; $lang['add_extra_period'] = ''; +$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 59112c9a..7e695326 100755 --- a/src/application/language/hungarian/translations_lang.php +++ b/src/application/language/hungarian/translations_lang.php @@ -305,3 +305,5 @@ $lang['new_extra_period_title'] = ''; $lang['extra_period_saved'] = ''; $lang['add_extra_periods_during_each_day'] = ''; $lang['add_extra_period'] = ''; +$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 ad7eef49..0e520228 100755 --- a/src/application/language/japanese/translations_lang.php +++ b/src/application/language/japanese/translations_lang.php @@ -305,3 +305,5 @@ $lang['new_extra_period_title'] = ''; $lang['extra_period_saved'] = ''; $lang['add_extra_periods_during_each_day'] = ''; $lang['add_extra_period'] = ''; +$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 9fb93532..3d53f965 100755 --- a/src/application/language/luxembourgish/translations_lang.php +++ b/src/application/language/luxembourgish/translations_lang.php @@ -305,3 +305,5 @@ $lang['new_extra_period_title'] = ''; $lang['extra_period_saved'] = ''; $lang['add_extra_periods_during_each_day'] = ''; $lang['add_extra_period'] = ''; +$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 813642c4..34d59f13 100755 --- a/src/application/language/polish/translations_lang.php +++ b/src/application/language/polish/translations_lang.php @@ -305,3 +305,5 @@ $lang['new_extra_period_title'] = ''; $lang['extra_period_saved'] = ''; $lang['add_extra_periods_during_each_day'] = ''; $lang['add_extra_period'] = ''; +$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 fee45f3f..48e6a57e 100755 --- a/src/application/language/portuguese-br/translations_lang.php +++ b/src/application/language/portuguese-br/translations_lang.php @@ -298,9 +298,6 @@ $lang['delete_personal_information_hint'] = 'Deletar toda informação pessoal d $lang['delete_personal_information'] = 'Deletar Informação Pessoal'; $lang['delete_personal_information_prompt'] = 'Tem certeza que deja deletar suas informações pessoais? Essa ação não pode ser desfeita.'; $lang['location'] = 'Location'; -$lang['availabilities_type'] = 'Availabilities Type'; -$lang['flexible'] = 'Flexible'; -$lang['fixed'] = 'Fixed'; $lang['extra_period'] = ''; $lang['extra_periods'] = ''; $lang['extra_periods_hint'] = ''; @@ -310,3 +307,5 @@ $lang['add_extra_periods_during_each_day'] = ''; $lang['add_extra_period'] = ''; $lang['first_weekday'] = 'First day of week'; $lang['first_weekday_hint'] = 'Set the first day of the calendar week.'; +$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 dc27b027..76e6f3f3 100755 --- a/src/application/language/portuguese/translations_lang.php +++ b/src/application/language/portuguese/translations_lang.php @@ -305,3 +305,5 @@ $lang['new_extra_period_title'] = ''; $lang['extra_period_saved'] = ''; $lang['add_extra_periods_during_each_day'] = ''; $lang['add_extra_period'] = ''; +$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 2c77ccbd..e26dbb12 100755 --- a/src/application/language/romanian/translations_lang.php +++ b/src/application/language/romanian/translations_lang.php @@ -305,3 +305,5 @@ $lang['new_extra_period_title'] = ''; $lang['extra_period_saved'] = ''; $lang['add_extra_periods_during_each_day'] = ''; $lang['add_extra_period'] = ''; +$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 d9c2130a..01c62df2 100755 --- a/src/application/language/russian/translations_lang.php +++ b/src/application/language/russian/translations_lang.php @@ -305,3 +305,5 @@ $lang['new_extra_period_title'] = ''; $lang['extra_period_saved'] = ''; $lang['add_extra_periods_during_each_day'] = ''; $lang['add_extra_period'] = ''; +$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 83a3538f..ebf32248 100755 --- a/src/application/language/slovak/translations_lang.php +++ b/src/application/language/slovak/translations_lang.php @@ -305,3 +305,5 @@ $lang['new_extra_period_title'] = ''; $lang['extra_period_saved'] = ''; $lang['add_extra_periods_during_each_day'] = ''; $lang['add_extra_period'] = ''; +$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 07d0cf50..4525e288 100755 --- a/src/application/language/spanish/translations_lang.php +++ b/src/application/language/spanish/translations_lang.php @@ -305,3 +305,5 @@ $lang['new_extra_period_title'] = ''; $lang['extra_period_saved'] = ''; $lang['add_extra_periods_during_each_day'] = ''; $lang['add_extra_period'] = ''; +$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 429416f2..d65fe990 100755 --- a/src/application/language/turkish/translations_lang.php +++ b/src/application/language/turkish/translations_lang.php @@ -305,3 +305,5 @@ $lang['new_extra_period_title'] = ''; $lang['extra_period_saved'] = ''; $lang['add_extra_periods_during_each_day'] = ''; $lang['add_extra_period'] = ''; +$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/015_add_require_phone_number_setting.php b/src/application/migrations/015_add_require_phone_number_setting.php new file mode 100644 index 00000000..c0753df4 --- /dev/null +++ b/src/application/migrations/015_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 04daa75f..bf606c52 100755 --- a/src/application/views/appointments/book.php +++ b/src/application/views/appointments/book.php @@ -223,8 +223,10 @@