From 094b780fd854dc89abf92ddd260465f3b5e7622a Mon Sep 17 00:00:00 2001 From: Thomas S Date: Fri, 28 May 2021 13:37:58 +0200 Subject: [PATCH] [1081] Add new settings in db --- application/config/migration.php | 2 +- application/controllers/Appointments.php | 5 ++ .../022_add_show_fields_setting.php | 65 +++++++++++++++++++ 3 files changed, 71 insertions(+), 1 deletion(-) create mode 100644 application/migrations/022_add_show_fields_setting.php diff --git a/application/config/migration.php b/application/config/migration.php index b2d763b4..f98b1f39 100755 --- a/application/config/migration.php +++ b/application/config/migration.php @@ -21,7 +21,7 @@ $config['migration_enabled'] = TRUE; | be upgraded / downgraded to. | */ -$config['migration_version'] = 21; +$config['migration_version'] = 22; /* diff --git a/application/controllers/Appointments.php b/application/controllers/Appointments.php index 8406fea7..67a0dc66 100755 --- a/application/controllers/Appointments.php +++ b/application/controllers/Appointments.php @@ -66,6 +66,11 @@ class Appointments extends EA_Controller { $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'); + $show_field['phone-number'] = $this->settings_model->get_setting('show_phone_number'); + $show_field['address'] = $this->settings_model->get_setting('show_address'); + $show_field['city'] = $this->settings_model->get_setting('show_city'); + $show_field['zip-code'] = $this->settings_model->get_setting('show_zip_code'); + $show_field['notes'] = $this->settings_model->get_setting('show_notes'); $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'); diff --git a/application/migrations/022_add_show_fields_setting.php b/application/migrations/022_add_show_fields_setting.php new file mode 100644 index 00000000..03e393d7 --- /dev/null +++ b/application/migrations/022_add_show_fields_setting.php @@ -0,0 +1,65 @@ + + * @copyright Copyright (c) 2013 - 2020, Alex Tselegidis + * @license http://opensource.org/licenses/GPL-3.0 - GPLv3 + * @link http://easyappointments.org + * @since v1.4.2 + * ---------------------------------------------------------------------------- */ + +/** + * Class Migration_Add_show_fields_setting + * + * @property CI_DB_query_builder $db + * @property CI_DB_forge $dbforge + */ +class Migration_Add_show_fields_setting extends CI_Migration { + /** + * Upgrade method. + */ + public function up() + { + $this->db->insert('settings', [ + 'name' => 'show_phone_number', + 'value' => '1' + ]); + + $this->db->insert('settings', [ + 'name' => 'show_address', + 'value' => '1' + ]); + + $this->db->insert('settings', [ + 'name' => 'show_city', + 'value' => '1' + ]); + + $this->db->insert('settings', [ + 'name' => 'show_zip_code', + 'value' => '1' + ]); + + $this->db->insert('settings', [ + 'name' => 'show_notes', + 'value' => '1' + ]); + + + } + + /** + * Downgrade method. + */ + public function down() + { + $this->db->delete('settings', ['name' => 'show_phone_number']); + $this->db->delete('settings', ['name' => 'show_address']); + $this->db->delete('settings', ['name' => 'show_city']); + $this->db->delete('settings', ['name' => 'show_zip_code']); + $this->db->delete('settings', ['name' => 'show_notes']); + } +}