Browse Source

Add notification for overdue tickets not assigned to me

merge-requests/1/head
Mike Koch 6 years ago
parent
commit
dd0481b452
  1. 8
      admin/manage_users.php
  2. 19
      admin/profile.php
  3. 22
      inc/profile_functions.inc.php
  4. 1
      install/mods-for-hesk/sql/installSql.php
  5. 1
      language/en/text.php

8
admin/manage_users.php

@ -88,6 +88,7 @@ $default_userdata = array(
'notify_note' => 1,
'notify_pm' => 1,
'notify_note_unassigned' => 1,
'notify_overdue_unassigned' => 0,
);
$modsForHesk_settings = mfh_getSettings();
@ -515,6 +516,7 @@ function new_user()
`notify_pm`,
`notify_note`,
`notify_note_unassigned`,
`notify_overdue_unassigned`,
`autorefresh`,
`permission_template`) VALUES (
'" . hesk_dbEscape($myuser['user']) . "',
@ -539,6 +541,7 @@ function new_user()
'" . ($myuser['notify_pm']) . "',
'" . ($myuser['notify_note']) . "',
'" . ($myuser['notify_note_unassigned']) . "',
'" . ($myuser['notify_overdue_unassigned']) . "',
" . intval($myuser['autorefresh']) . ",
" . intval($myuser['template']) . ")");
@ -581,6 +584,7 @@ function update_user()
$myuser['notify_pm'] = 0;
$myuser['notify_note'] = 0;
$myuser['notify_note_unassigned'] = 0;
$myuser['notify_overdue_unassigned'] = 0;
}
/* Check for duplicate usernames */
@ -662,6 +666,7 @@ function update_user()
`notify_pm`='" . ($myuser['notify_pm']) . "',
`notify_note`='" . ($myuser['notify_note']) . "',
`notify_note_unassigned`='" . ($myuser['notify_note_unassigned']) . "',
`notify_overdue_unassigned`='" . ($myuser['notify_overdue_unassigned']) . "',
`autorefresh`=" . intval($myuser['autorefresh']) . ",
`permission_template`=" . intval($myuser['template']) . "
WHERE `id`='" . intval($myuser['id']) . "' LIMIT 1");
@ -774,6 +779,7 @@ function hesk_validateUserInfo($pass_required = 1, $redirect_to = './manage_user
$myuser['notify_note'] = empty($_POST['notify_note']) ? 0 : 1;
$myuser['notify_pm'] = empty($_POST['notify_pm']) ? 0 : 1;
$myuser['notify_note_unassigned'] = empty($_POST['notify_note_unassigned']) ? 0 : 1;
$myuser['notify_overdue_unassigned'] = empty($_POST['notify_overdue_unassigned']) ? 0 : 1;
/* Save entered info in session so we don't loose it in case of errors */
$_SESSION['userdata'] = $myuser;
@ -890,7 +896,7 @@ function toggle_active()
hesk_dbQuery("UPDATE `" . hesk_dbEscape($hesk_settings['db_pfix']) . "categories` SET `manager` = 0 WHERE `manager` = " . intval($myuser));
$notificationSql = ", `autoassign` = 0, `notify_new_unassigned` = 0, `notify_new_my` = 0, `notify_reply_unassigned` = 0,
`notify_reply_my` = 0, `notify_assigned` = 0, `notify_pm` = 0, `notify_note` = 0, `notify_note_unassigned` = 0";
`notify_reply_my` = 0, `notify_assigned` = 0, `notify_pm` = 0, `notify_note` = 0, `notify_note_unassigned` = 0, `notify_overdue_unassigned` = 0";
}
hesk_dbQuery("UPDATE `" . hesk_dbEscape($hesk_settings['db_pfix']) . "users` SET `active` = '" . $active . "'" . $notificationSql . " WHERE `id` = '" . intval($myuser) . "'");

19
admin/profile.php

@ -234,14 +234,17 @@ function update_profile()
$_SESSION['new']['autorefresh'] = isset($_POST['autorefresh']) ? $_POST['autorefresh'] : 0;
/* Notifications */
$_SESSION['new']['notify_new_unassigned'] = empty($_POST['notify_new_unassigned']) || !$can_view_unassigned ? 0 : 1;
$_SESSION['new']['notify_new_my'] = empty($_POST['notify_new_my']) ? 0 : 1;
$_SESSION['new']['notify_reply_unassigned'] = empty($_POST['notify_reply_unassigned']) || !$can_view_unassigned ? 0 : 1;
$_SESSION['new']['notify_reply_my'] = empty($_POST['notify_reply_my']) ? 0 : 1;
$_SESSION['new']['notify_assigned'] = empty($_POST['notify_assigned']) ? 0 : 1;
$_SESSION['new']['notify_note'] = empty($_POST['notify_note']) ? 0 : 1;
$_SESSION['new']['notify_note_unassigned'] = empty($_POST['notify_note_unassigned']) ? 0 : 1;
$_SESSION['new']['notify_pm'] = empty($_POST['notify_pm']) ? 0 : 1;
if ($_SESSION[$session_array]['isadmin'] || (isset($_SESSION[$session_array]['heskprivileges']) && strpos($_SESSION[$session_array]['heskprivileges'], 'can_change_notification_settings') !== false)) {
$_SESSION['new']['notify_new_unassigned'] = empty($_POST['notify_new_unassigned']) || !$can_view_unassigned ? 0 : 1;
$_SESSION['new']['notify_new_my'] = empty($_POST['notify_new_my']) ? 0 : 1;
$_SESSION['new']['notify_reply_unassigned'] = empty($_POST['notify_reply_unassigned']) || !$can_view_unassigned ? 0 : 1;
$_SESSION['new']['notify_reply_my'] = empty($_POST['notify_reply_my']) ? 0 : 1;
$_SESSION['new']['notify_assigned'] = empty($_POST['notify_assigned']) ? 0 : 1;
$_SESSION['new']['notify_note'] = empty($_POST['notify_note']) ? 0 : 1;
$_SESSION['new']['notify_note_unassigned'] = empty($_POST['notify_note_unassigned']) ? 0 : 1;
$_SESSION['new']['notify_pm'] = empty($_POST['notify_pm']) ? 0 : 1;
$_SESSION['new']['notify_overdue_unassigned'] = empty($_POST['notify_overdue_unassigned']) ? 0 : 1;
}
/* Any errors? */
if (strlen($hesk_error_buffer)) {

22
inc/profile_functions.inc.php

@ -431,17 +431,6 @@ function hesk_profile_tab($session_array = 'new', $is_profile_page = true, $acti
echo ' ' . $disabledText ?> /> <?php echo $hesklang['npms']; ?></label></div>
</div>
<?php
if ($disabledText == 'disabled') { ?>
<input type="hidden" name="notify_reply_my"
value="<?php echo !empty($_SESSION[$session_array]['notify_reply_my']) ? '1' : '0'; ?>">
<input type="hidden" name="notify_assigned"
value="<?php echo !empty($_SESSION[$session_array]['notify_assigned']) ? '1' : '0'; ?>">
<input type="hidden" name="notify_note"
value="<?php echo !empty($_SESSION[$session_array]['notify_note']) ? '1' : '0'; ?>">
<input type="hidden" name="notify_pm"
value="<?php echo !empty($_SESSION[$session_array]['notify_pm']) ? '1' : '0'; ?>">
<?php }
if ($_SESSION['isadmin']) { ?>
<div class="col-md-9 col-md-offset-3">
<div class="checkbox"><label><input type="checkbox" name="notify_note_unassigned"
@ -450,8 +439,15 @@ function hesk_profile_tab($session_array = 'new', $is_profile_page = true, $acti
} ?>> <?php echo $hesklang['notify_note_unassigned']; ?></label></div>
</div>
<?php
}
}
} ?>
<div class="col-md-9 col-md-offset-3">
<div class="checkbox"><label><input type="checkbox" name="notify_overdue_unassigned"
value="1" <?php if (!empty($_SESSION[$session_array]['notify_overdue_unassigned'])) {
echo 'checked="checked"';
}
echo ' ' . $disabledText ?> /> <?php echo $hesklang['notify_overdue_unassigned']; ?></label></div>
</div>
<?php }
?>
</div>

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

@ -740,5 +740,6 @@ function execute260Scripts()
executeQuery("ALTER TABLE `" . hesk_dbEscape($hesk_settings['db_pfix']) . "tickets` ADD COLUMN `overdue_email_sent` ENUM('0','1')");
executeQuery("ALTER TABLE `" . hesk_dbEscape($hesk_settings['db_pfix']) . "categories` ADD COLUMN `color` VARCHAR(7)");
executeQuery("ALTER TABLE `" . hesk_dbEscape($hesk_settings['db_pfix']) . "categories` ADD COLUMN `usage` INT NOT NULL DEFAULT 0");
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("UPDATE `" . hesk_dbEscape($hesk_settings['db_pfix']) . "settings` SET `Value` = '2.6.0' WHERE `Key` = 'modsForHeskVersion'");
}

1
language/en/text.php

@ -84,6 +84,7 @@ $hesklang['calendar_categories'] = 'Categories';
$hesklang['can_man_calendar'] = 'Can manage calendar events';
$hesklang['calendar_reminder'] = 'Upcoming Event: %%TITLE%%';
$hesklang['overdue_ticket'] = '[%%TRACKID%%] Ticket Overdue!';
$hesklang['notify_overdue_unassigned'] = 'A ticket is overdue not assigned to me';
// ADDED OR MODIFIED IN Mods for HESK 2.5.2
$hesklang['manage_statuses'] = 'Manage Statuses';

Loading…
Cancel
Save