From e0e748c5d82fb878b87d8a123366619c72a5c496 Mon Sep 17 00:00:00 2001
From: Mike Koch
Date: Wed, 10 Aug 2016 23:57:37 -0400
Subject: [PATCH] Fixes #448 Set correct lock status, dont show open/close link
to clients when ticket is locked
---
admin/lock.php | 7 +++----
ticket.php | 13 ++++++++-----
2 files changed, 11 insertions(+), 9 deletions(-)
diff --git a/admin/lock.php b/admin/lock.php
index 672fc90c..9ba669a2 100644
--- a/admin/lock.php
+++ b/admin/lock.php
@@ -95,11 +95,10 @@ if (empty($_GET['locked'])) {
/* Update database */
$statusSql = 'SELECT `ID` FROM `' . hesk_dbEscape($hesk_settings['db_pfix']) . 'statuses` WHERE `LockedTicketStatus` = 1';
$statusRs = hesk_dbQuery($statusSql);
-$statusRow = hesk_dbFetchAssoc($statusSql);
+$statusRow = hesk_dbFetchAssoc($statusRs);
$statusId = $statusRow['ID'];
-hesk_dbQuery("UPDATE `" . hesk_dbEscape($hesk_settings['db_pfix']) . "tickets` SET `status`='{$statusId}',`locked`='{$status}' $closedby_sql , `history`=CONCAT(`history`,'" . hesk_dbEscape($revision) . "') WHERE `trackid`='" . hesk_dbEscape($trackingID) . "' LIMIT 1");
+hesk_dbQuery("UPDATE `" . hesk_dbEscape($hesk_settings['db_pfix']) . "tickets` SET `status`= {$statusId},`locked`='{$status}' $closedby_sql , `history`=CONCAT(`history`,'" . hesk_dbEscape($revision) . "') WHERE `trackid`='" . hesk_dbEscape($trackingID) . "' LIMIT 1");
/* Back to ticket page and show a success message */
-hesk_process_messages($tmp, 'admin_ticket.php?track=' . $trackingID . '&Refresh=' . rand(10000, 99999), 'SUCCESS');
-?>
+hesk_process_messages($tmp, 'admin_ticket.php?track=' . $trackingID . '&Refresh=' . rand(10000, 99999), 'SUCCESS');
\ No newline at end of file
diff --git a/ticket.php b/ticket.php
index 162e9ed2..e8fce7b8 100644
--- a/ticket.php
+++ b/ticket.php
@@ -275,11 +275,14 @@ if (!$show['show']) {
$status = hesk_dbFetchAssoc($statusRS);
$isClosable = $status['Closable'] == 'yes' || $status['Closable'] == 'conly';
$random = rand(10000, 99999);
- if ($ticket['isClosed'] == true && $ticket['locked'] != 1 && $hesk_settings['custopen']) {
- echo '' . $hesklang['open_action'] . '';
- } elseif ($hesk_settings['custclose'] && $isClosable) {
- echo '' . $hesklang['close_action'] . '';
- } ?>
+ if (!$ticket['locked']) {
+ if ($ticket['isClosed'] == true && $hesk_settings['custopen']) {
+ echo '' . $hesklang['open_action'] . '';
+ } elseif ($hesk_settings['custclose'] && $isClosable) {
+ echo '' . $hesklang['close_action'] . '';
+ }
+ }
+ ?>