From 75bd00770c6ad8e2633932a7a808be47e201e2d0 Mon Sep 17 00:00:00 2001 From: OpenXE <> Date: Mon, 22 May 2023 18:42:20 +0200 Subject: [PATCH] ticket system show user's tickets and all tickets separately in sidebar --- www/eproosystem.php | 7 +++++-- www/lib/class.erpapi.php | 9 ++++++++- 2 files changed, 13 insertions(+), 3 deletions(-) diff --git a/www/eproosystem.php b/www/eproosystem.php index 107dd3d0..84d51898 100644 --- a/www/eproosystem.php +++ b/www/eproosystem.php @@ -440,12 +440,15 @@ class erpooSystem extends Application ); } - // Creates user specific items + + $offene_tickets = $this->erp->AnzahlOffeneTickets(false); + $offene_tickets_user = $this->erp->AnzahlOffeneTickets(true); + $possibleUserItems = [ 'Tickets' => [ 'link' => 'index.php?module=ticket&action=list', - 'counter' => $this->erp->AnzahlOffeneTickets() + 'counter' => ($offene_tickets+$offene_tickets_user > 0)?$offene_tickets_user."/".$offene_tickets:"" ], 'Aufgaben' => [ 'link' => 'index.php?module=aufgaben&action=list', diff --git a/www/lib/class.erpapi.php b/www/lib/class.erpapi.php index 8139a52d..061202d9 100644 --- a/www/lib/class.erpapi.php +++ b/www/lib/class.erpapi.php @@ -2696,7 +2696,14 @@ public function NavigationHooks(&$menu) public function AnzahlOffeneTickets($eigene=true) { - $sql = "SELECT COUNT(t.id) FROM ticket t WHERE t.status = 'neu' AND ((t.warteschlange = '') OR (t.warteschlange IN (SELECT w.label FROM warteschlangen w WHERE w.adresse = '".$this->app->User->GetAdresse()."')))"; + + if ($eigene) { + $sql = "SELECT COUNT(t.id) FROM ticket t WHERE t.status = 'neu' AND (t.warteschlange IN (SELECT w.label FROM warteschlangen w WHERE w.adresse = '".$this->app->User->GetAdresse()."'))"; + } else + { + $sql = "SELECT COUNT(t.id) FROM ticket t WHERE t.status = 'neu' AND (t.warteschlange = '')"; + } + return (int)$this->app->DB->Select($sql); }