From 043422b10132ed6f3928ce9927469a63c387282e Mon Sep 17 00:00:00 2001 From: "Michael Kaufmann (d00p)" Date: Fri, 17 May 2013 09:50:22 +0200 Subject: [PATCH] show customer name with su-link on ticket view for admins, and just as plaintext for customers, fixes #1045 Signed-off-by: Michael Kaufmann (d00p) --- admin_tickets.php | 49 ++++++++++++++++++++++++++++++++++---------- customer_tickets.php | 11 ++++++++-- 2 files changed, 47 insertions(+), 13 deletions(-) diff --git a/admin_tickets.php b/admin_tickets.php index 94f5c7f7..f5d5480f 100644 --- a/admin_tickets.php +++ b/admin_tickets.php @@ -326,13 +326,20 @@ if($page == 'tickets' $isclosed = 1; } - if($mainticket->Get('by') == '1') + if ($mainticket->Get('by') == '1') { $by = $lng['ticket']['staff']; } else { - $by = $lng['ticket']['customer']; + $cid = $mainticket->Get('customer'); + $usr = $db->query_first('SELECT `customerid`, `firstname`, `name`, `company`, `loginname` + FROM `' . TABLE_PANEL_CUSTOMERS . '` + WHERE `customerid` = "' . (int)$cid . '"' + ); + $by = ''; + $by .= getCorrectFullUserDetails($usr).''; + //$by = $lng['ticket']['customer']; } $subject = $mainticket->Get('subject'); @@ -354,7 +361,14 @@ if($page == 'tickets' } else { - $by = $lng['ticket']['customer']; + $cid = $subticket->Get('customer'); + $usr = $db->query_first('SELECT `customerid`, `firstname`, `name`, `company`, `loginname` + FROM `' . TABLE_PANEL_CUSTOMERS . '` + WHERE `customerid` = "' . (int)$cid . '"' + ); + $by = ''; + $by .= getCorrectFullUserDetails($usr).''; + //$by = $lng['ticket']['customer']; } $subject = $subticket->Get('subject'); @@ -816,11 +830,18 @@ elseif($page == 'archive' } else { - $by = $lng['ticket']['customer']; + $cid = $mainticket->Get('customer'); + $usr = $db->query_first('SELECT `customerid`, `firstname`, `name`, `company`, `loginname` + FROM `' . TABLE_PANEL_CUSTOMERS . '` + WHERE `customerid` = "' . (int)$cid . '"' + ); + $by = ''; + $by .= getCorrectFullUserDetails($usr).''; + //$by = $lng['ticket']['customer']; } - $subject = htmlentities($mainticket->Get('subject')); - $message = htmlentities($mainticket->Get('message')); + $subject = $mainticket->Get('subject'); + $message = $mainticket->Get('message'); eval("\$ticket_replies.=\"" . getTemplate("tickets/tickets_tickets_main") . "\";"); $result = $db->query('SELECT `name` FROM `' . TABLE_PANEL_TICKET_CATS . '` WHERE `id`="' . (int)$mainticket->Get('category') . '"'); @@ -838,22 +859,28 @@ elseif($page == 'archive' } else { - $by = $lng['ticket']['customer']; + $cid = $subticket->Get('customer'); + $usr = $db->query_first('SELECT `customerid`, `firstname`, `name`, `company`, `loginname` + FROM `' . TABLE_PANEL_CUSTOMERS . '` + WHERE `customerid` = "' . (int)$cid . '"' + ); + $by = ''; + $by .= getCorrectFullUserDetails($usr).''; + //$by = $lng['ticket']['customer']; } - $subject = htmlentities($subticket->Get('subject')); - $message = htmlentities($subticket->Get('message')); + $subject = $subticket->Get('subject'); + $message = $subticket->Get('message'); eval("\$ticket_replies.=\"" . getTemplate("tickets/tickets_tickets_list") . "\";"); } $priorities = makeoption($lng['ticket']['high'], '1', htmlentities($mainticket->Get('priority')), true, true); $priorities.= makeoption($lng['ticket']['normal'], '2', htmlentities($mainticket->Get('priority')), true, true); $priorities.= makeoption($lng['ticket']['low'], '3', htmlentities($mainticket->Get('priority')), true, true); - $subject = htmlentities($mainticket->Get('subject')); + $subject = $mainticket->Get('subject'); $ticket_replies_count = $db->num_rows($andere) + 1; // don't forget the main-ticket! - eval("echo \"" . getTemplate("tickets/tickets_view") . "\";"); } elseif($action == 'delete' diff --git a/customer_tickets.php b/customer_tickets.php index 51ade7ab..9ae92718 100644 --- a/customer_tickets.php +++ b/customer_tickets.php @@ -340,7 +340,13 @@ elseif($page == 'tickets') } else { - $by = $lng['ticket']['customer']; + $cid = $mainticket->Get('customer'); + $usr = $db->query_first('SELECT `customerid`, `firstname`, `name`, `company`, `loginname` + FROM `' . TABLE_PANEL_CUSTOMERS . '` + WHERE `customerid` = "' . (int)$cid . '"' + ); + $by = getCorrectFullUserDetails($usr); + //$by = $lng['ticket']['customer']; } $subject = $mainticket->Get('subject'); @@ -362,7 +368,8 @@ elseif($page == 'tickets') } else { - $by = $lng['ticket']['customer']; + $by = getCorrectFullUserDetails($usr); + //$by = $lng['ticket']['customer']; } $subject = $subticket->Get('subject');