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); }