[1081] Add new settings in db

This commit is contained in:
Thomas S 2021-05-28 13:37:58 +02:00
parent 4f0b2c6c8f
commit 094b780fd8
3 changed files with 71 additions and 1 deletions

View file

@ -21,7 +21,7 @@ $config['migration_enabled'] = TRUE;
| be upgraded / downgraded to. | be upgraded / downgraded to.
| |
*/ */
$config['migration_version'] = 21; $config['migration_version'] = 22;
/* /*

View file

@ -66,6 +66,11 @@ class Appointments extends EA_Controller {
$time_format = $this->settings_model->get_setting('time_format'); $time_format = $this->settings_model->get_setting('time_format');
$first_weekday = $this->settings_model->get_setting('first_weekday'); $first_weekday = $this->settings_model->get_setting('first_weekday');
$require_phone_number = $this->settings_model->get_setting('require_phone_number'); $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'); $display_cookie_notice = $this->settings_model->get_setting('display_cookie_notice');
$cookie_notice_content = $this->settings_model->get_setting('cookie_notice_content'); $cookie_notice_content = $this->settings_model->get_setting('cookie_notice_content');
$display_terms_and_conditions = $this->settings_model->get_setting('display_terms_and_conditions'); $display_terms_and_conditions = $this->settings_model->get_setting('display_terms_and_conditions');

View file

@ -0,0 +1,65 @@
<?php defined('BASEPATH') or exit('No direct script access allowed');
/* ----------------------------------------------------------------------------
* Easy!Appointments - Open Source Web Scheduler
*
* @package EasyAppointments
* @author T. Saedt <https://github.com/Tthecreator>
* @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']);
}
}