From 8e2d396ee9863592ca4151329cd4bbd791195d4d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jaros=C5=82aw=20K=C5=82opotek=20-=20INTERDUO?= Date: Mon, 22 Jul 2024 14:44:27 +0200 Subject: [PATCH] bugfix: bad location was displayed in assigned events tab/rtticketview form (event location was always customer register location address, no matter what we choose in event location) --- lib/LMSManagers/LMSHelpdeskManager.php | 25 ++++++++----------------- 1 file changed, 8 insertions(+), 17 deletions(-) diff --git a/lib/LMSManagers/LMSHelpdeskManager.php b/lib/LMSManagers/LMSHelpdeskManager.php index d1d6139824..eae3bf02ce 100644 --- a/lib/LMSManagers/LMSHelpdeskManager.php +++ b/lib/LMSManagers/LMSHelpdeskManager.php @@ -760,24 +760,15 @@ public function GetQueueNameByTicketId($id) public function GetEventsByTicketId($id) { - $events = $this->db->GetAll('SELECT events.id as id, title, description, note, date, begintime, endtime, ' - . 'userid, customerid, private, closed, closeddate, closeduserid, events.type, ticketid, va.location, ' - . $this->db->Concat('customers.lastname', "' '", 'customers.name').' AS customername, ' - . $this->db->Concat('users.firstname', "' '", 'users.lastname').' AS username, ' - . $this->db->Concat('u.firstname', "' '", 'u.lastname').' AS closedusername, vn.name AS node_name, ' - . $this->db->Concat('c.city', "', '", 'c.address') . ' AS customerlocation, vn.location AS node_location ' - . 'FROM events ' - . 'LEFT JOIN customers ON (customerid = customers.id) ' - . 'LEFT JOIN users ON (userid = users.id) ' - . 'LEFT JOIN users u ON (closeduserid = u.id) ' - . 'LEFT JOIN vaddresses va ON va.id = events.address_id ' - . 'LEFT JOIN vnodes as vn ON (nodeid = vn.id) ' - . 'LEFT JOIN customerview c ON (events.customerid = c.id) ' - . 'WHERE ticketid = ? ORDER BY events.id ASC', array($id)); - - if (is_array($events)) { + $event_manager = new LMSEventManager($this->db, $this->auth, $this->cache); + $events = $this->db->GetAll( + 'SELECT id FROM events WHERE ticketid = ? ORDER BY id ASC', + array($id) + ); + + if (!empty($events)) { foreach ($events as $idx => $row) { - $events[$idx]['userlist'] = $this->db->GetAll("SELECT vu.name,userid AS ul FROM eventassignments AS e LEFT JOIN vusers vu ON vu.id = e.userid WHERE eventid = $row[id]"); + $events[$idx] = $event_manager->GetEvent($row); } }