Browse Source

Add saving of settings

merge-requests/1/head
Mike Koch 6 years ago
parent
commit
7f4f5fff23
  1. 37
      admin/admin_settings.php
  2. 6
      admin/admin_settings_save.php
  3. 1
      install/mods-for-hesk/sql/installSql.php
  4. 6
      language/en/text.php

37
admin/admin_settings.php

@ -1983,11 +1983,11 @@ if (defined('HESK_DEMO')) {
<h6 class="bold"><?php echo $hesklang['calendar_settings']; ?></h6>
<div class="footerWithBorder blankSpace"></div>
<div class="form-group">
<label for="enable-calendar" class="col-sm-4 col-xs-12 control-label">
<label for="enable_calendar" class="col-sm-4 col-xs-12 control-label">
<?php echo $hesklang['enable_calendar']; ?>
<i class="fa fa-question-circle settingsquestionmark" data-toggle="popover"
title="<?php echo $hesklang['custom_field_setting']; ?>"
data-content="<?php echo $hesklang['custom_field_setting_help']; ?>"></i>
title="<?php echo $hesklang['enable_calendar']; ?>"
data-content="<?php echo $hesklang['enable_calendar_help']; ?>"></i>
</label>
<div class="col-sm-8 form-inline">
<?php
@ -1995,9 +1995,9 @@ if (defined('HESK_DEMO')) {
$off = $modsForHesk_settings['enable_calendar'] ? '' : 'checked="checked"';
$only = $modsForHesk_settings['enable_calendar'] == 2 ? 'checked="checked"' : '';
echo '
<div class="radio"><label><input type="radio" name="s_enable_calendar" value="1" ' . $on . ' /> ' . $hesklang['yes_enable_calendar'] . '</label></div><br>
<div class="radio"><label><input type="radio" name="s_enable_calendar" value="2" ' . $only . ' /> ' . $hesklang['yes_enable_calendar_staff_only'] . '</label></div><br>
<div class="radio"><label><input type="radio" name="s_enable_calendar" value="0" ' . $off . ' /> ' . $hesklang['no_disable_calendar'] . '</label></div>';
<div class="radio"><label><input type="radio" name="enable_calendar" value="1" ' . $on . ' /> ' . $hesklang['yes_enable_calendar'] . '</label></div><br>
<div class="radio"><label><input type="radio" name="enable_calendar" value="2" ' . $only . ' /> ' . $hesklang['yes_enable_calendar_staff_only'] . '</label></div><br>
<div class="radio"><label><input type="radio" name="enable_calendar" value="0" ' . $off . ' /> ' . $hesklang['no_disable_calendar'] . '</label></div>';
?>
</div>
</div>
@ -2005,8 +2005,8 @@ if (defined('HESK_DEMO')) {
<label for="first-day-of-week" class="col-sm-4 col-xs-12 control-label">
<?php echo $hesklang['first_day_of_week']; ?>
<i class="fa fa-question-circle settingsquestionmark" data-toggle="popover"
title="<?php echo $hesklang['custom_field_setting']; ?>"
data-content="<?php echo $hesklang['custom_field_setting_help']; ?>"></i>
title="<?php echo $hesklang['first_day_of_week']; ?>"
data-content="<?php echo $hesklang['first_day_of_week_help']; ?>"></i>
</label>
<div class="col-sm-8 col-xs-12">
<select name="first-day-of-week" class="form-control">
@ -2034,6 +2034,27 @@ if (defined('HESK_DEMO')) {
</select>
</div>
</div>
<div class="form-group">
<label for="default-view" class="col-sm-4 col-xs-12 control-label">
<?php echo $hesklang['default_view']; ?>
<i class="fa fa-question-circle settingsquestionmark" data-toggle="popover"
title="<?php echo $hesklang['default_view']; ?>"
data-content="<?php echo $hesklang['default_view_help']; ?>"></i>
</label>
<div class="col-sm-8 col-xs-12">
<select name="default-view" class="form-control">
<option value="month" <?php if ($modsForHesk_settings['default_calendar_view'] == 'month') { echo 'selected'; } ?>>
<?php echo $hesklang['month']; ?>
</option>
<option value="week" <?php if ($modsForHesk_settings['default_calendar_view'] == 'week') { echo 'selected'; } ?>>
<?php echo $hesklang['week']; ?>
</option>
<option value="agenda" <?php if ($modsForHesk_settings['default_calendar_view'] == 'agenda') { echo 'selected'; } ?>>
<?php echo $hesklang['agenda']; ?>
</option>
</select>
</div>
</div>
</div>
<!-- Custom Fields Tab -->

6
admin/admin_settings_save.php

@ -497,6 +497,9 @@ $set['statuses_order_column'] = empty($_POST['statuses_order_column']) ? 'sort'
$set['kb_attach_dir'] = hesk_POST('kb_attach_dir', 'attachments');
$set['display_user_agent_information'] = empty($_POST['display_user_agent_information']) ? 0 : 1;
$set['navbar_title_url'] = hesk_POST('navbar_title_url');
$set['enable_calendar'] = hesk_checkMinMax(intval(hesk_POST('enable_calendar')), 0, 2, 2);
$set['first_day_of_week'] = hesk_POST('first-day-of-week', 0);
$set['default_view'] = hesk_POST('default-view', 'month');
if ($set['customer-email-verification-required']) {
//-- Don't allow multiple emails if verification is required
@ -544,6 +547,9 @@ mfh_updateSetting('navbar_title_url', $set['navbar_title_url'], true);
mfh_updateSetting('mailgun_api_key', $set['mailgun_api_key'], true);
mfh_updateSetting('mailgun_domain', $set['mailgun_domain'], true);
mfh_updateSetting('use_mailgun', $set['use_mailgun'], false);
mfh_updateSetting('enable_calendar', $set['enable_calendar'], false);
mfh_updateSetting('first_day_of_week', $set['first_day_of_week'], false);
mfh_updateSetting('default_calendar_view', $set['default_view'], true);
// Prepare settings file and save it
$settings_file_content = '<?php

1
install/mods-for-hesk/sql/installSql.php

@ -743,5 +743,6 @@ function execute260Scripts()
executeQuery("ALTER TABLE `" . hesk_dbEscape($hesk_settings['db_pfix']) . "users` ADD COLUMN `notify_overdue_unassigned` ENUM('0', '1') NOT NULL DEFAULT '0' AFTER `notify_note_unassigned`");
executeQuery("INSERT INTO `" . hesk_dbEscape($hesk_settings['db_pfix']) . "settings` (`Key`, `Value`) VALUES ('enable_calendar', '1')");
executeQuery("INSERT INTO `" . hesk_dbEscape($hesk_settings['db_pfix']) . "settings` (`Key`, `Value`) VALUES ('first_day_of_week', '0')");
executeQuery("INSERT INTO `" . hesk_dbEscape($hesk_settings['db_pfix']) . "settings` (`Key`, `Value`) VALUES ('default_calendar_view', 'month')");
executeQuery("UPDATE `" . hesk_dbEscape($hesk_settings['db_pfix']) . "settings` SET `Value` = '2.6.0' WHERE `Key` = 'modsForHeskVersion'");
}

6
language/en/text.php

@ -87,11 +87,17 @@ $hesklang['overdue_ticket'] = '[%%TRACKID%%] Ticket Overdue!';
$hesklang['notify_overdue_unassigned'] = 'A ticket is overdue not assigned to me';
$hesklang['calendar_settings'] = 'Calendar Settings';
$hesklang['enable_calendar'] = 'Enable calendar';
$hesklang['enable_calendar_help'] = 'Setting to enable / disable the calendar. The calendar can be shown to everyone, staff only, or disable the calendar entirely.';
$hesklang['yes_enable_calendar'] = '<b>YES</b>, enable calendar';
$hesklang['yes_enable_calendar_staff_only'] = '<b>YES</b>, enable calendar, but only for staff';
$hesklang['no_disable_calendar'] = '<b>NO</b>, disable calendar';
$hesklang['first_day_of_week'] = 'First day of week';
$hesklang['first_day_of_week_help'] = 'This setting decides which day of the week to show first per week.';
$hesklang['calendar_disabled'] = 'The calendar is disabled';
$hesklang['default_view'] = 'Default view';
$hesklang['default_view_help'] = 'Decide which view will be shown to customers and staff by default when viewing the calendar. Staff can change this setting via their own profile.';
$hesklang['week'] = 'Week';
$hesklang['agenda'] = 'Agenda';
// ADDED OR MODIFIED IN Mods for HESK 2.5.2
$hesklang['manage_statuses'] = 'Manage Statuses';

Loading…
Cancel
Save