From dd0481b452610bd0fdfc47951ad4255ce639eae4 Mon Sep 17 00:00:00 2001 From: Mike Koch Date: Thu, 21 Apr 2016 22:05:45 -0400 Subject: [PATCH] Add notification for overdue tickets not assigned to me --- admin/manage_users.php | 8 +++++++- admin/profile.php | 19 +++++++++++-------- inc/profile_functions.inc.php | 22 +++++++++------------- install/mods-for-hesk/sql/installSql.php | 1 + language/en/text.php | 1 + 5 files changed, 29 insertions(+), 22 deletions(-) diff --git a/admin/manage_users.php b/admin/manage_users.php index 4e39212b..f11b9944 100644 --- a/admin/manage_users.php +++ b/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) . "'"); diff --git a/admin/profile.php b/admin/profile.php index 93637154..1928c66f 100644 --- a/admin/profile.php +++ b/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)) { diff --git a/inc/profile_functions.inc.php b/inc/profile_functions.inc.php index 8e0163e4..b15a6710 100644 --- a/inc/profile_functions.inc.php +++ b/inc/profile_functions.inc.php @@ -431,17 +431,6 @@ function hesk_profile_tab($session_array = 'new', $is_profile_page = true, $acti echo ' ' . $disabledText ?> /> - - - - -
+
+
+
+ diff --git a/install/mods-for-hesk/sql/installSql.php b/install/mods-for-hesk/sql/installSql.php index 8f6e8e2a..a07e9ee1 100644 --- a/install/mods-for-hesk/sql/installSql.php +++ b/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'"); } \ No newline at end of file diff --git a/language/en/text.php b/language/en/text.php index 5e07ad02..243894f1 100644 --- a/language/en/text.php +++ b/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';