fmsystem-commits
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Fmsystem-commits] [15504] more on helpdesk


From: sigurdne
Subject: [Fmsystem-commits] [15504] more on helpdesk
Date: Thu, 25 Aug 2016 09:13:21 +0000 (UTC)

Revision: 15504
          http://svn.sv.gnu.org/viewvc/?view=rev&root=fmsystem&revision=15504
Author:   sigurdne
Date:     2016-08-25 09:13:21 +0000 (Thu, 25 Aug 2016)
Log Message:
-----------
more on helpdesk

Modified Paths:
--------------
    trunk/helpdesk/inc/class.botts.inc.php
    trunk/helpdesk/inc/class.sotts.inc.php
    trunk/helpdesk/inc/class.uitts.inc.php

Modified: trunk/helpdesk/inc/class.botts.inc.php
===================================================================
--- trunk/helpdesk/inc/class.botts.inc.php      2016-08-25 08:20:09 UTC (rev 
15503)
+++ trunk/helpdesk/inc/class.botts.inc.php      2016-08-25 09:13:21 UTC (rev 
15504)
@@ -442,7 +442,10 @@
                        $this->so->update_view($id);
 
                        $values['attributes'] = $this->get_custom_cols();
-                       $ticket = $this->so->read_single($id, $values);
+                       if(!$ticket = $this->so->read_single($id, $values))
+                       {
+                               return array();
+                       }
                        $ticket = $this->custom->prepare($ticket, 'helpdesk', 
'.ticket', $view);
 
                        $ticket['user_lid'] = 
$GLOBALS['phpgw']->accounts->id2name($ticket['user_id']);

Modified: trunk/helpdesk/inc/class.sotts.inc.php
===================================================================
--- trunk/helpdesk/inc/class.sotts.inc.php      2016-08-25 08:20:09 UTC (rev 
15503)
+++ trunk/helpdesk/inc/class.sotts.inc.php      2016-08-25 09:13:21 UTC (rev 
15504)
@@ -430,8 +430,72 @@
                function read_single($id, $values = array() )
                {
                        $id = (int) $id;
-                       $sql = "SELECT * FROM phpgw_helpdesk_tickets WHERE id = 
{$id}";
 
+
+                       $GLOBALS['phpgw']->acl->set_account_id($this->account);
+                       $this->grants   = 
$GLOBALS['phpgw']->acl->get_grants2('helpdesk','.ticket');
+
+                       $acl_join = "{$this->join} phpgw_accounts ON 
phpgw_helpdesk_tickets.user_id=phpgw_accounts.account_id";
+                       $acl_join .= " {$this->join} phpgw_group_map ON 
(phpgw_accounts.account_id = phpgw_group_map.account_id)";
+
+                       $categories = 
$GLOBALS['phpgw']->locations->get_subs('helpdesk', '.ticket.category');
+
+                       $grant_category = array();
+                       foreach ($categories as $location)
+                       {
+                               if ($GLOBALS['phpgw']->acl->check($location, 
PHPGW_ACL_READ, 'helpdesk'))
+                               {
+                                       $category = explode('.',$location);
+                                       $grant_category[] = $category[3];
+                               }
+                       }
+
+                       $grant_category[] = -1;//If no one found - not breaking 
the query
+
+
+                       $GLOBALS['phpgw']->config->read();
+
+                       $filtermethod = '';
+                       
if(isset($GLOBALS['phpgw']->config->config_data['acl_at_tts_category']) && 
$GLOBALS['phpgw']->config->config_data['acl_at_tts_category'])
+                       {
+                               $filtermethod = " AND 
phpgw_helpdesk_tickets.cat_id IN (" . implode(",", $grant_category) . ")";
+                       }
+
+
+                       if (is_array($this->grants))
+                       {
+                               $public_user_list = array();
+                               if (is_array($this->grants['accounts']) && 
$this->grants['accounts'])
+                               {
+                                       foreach($this->grants['accounts'] as 
$user => $_right)
+                                       {
+                                               $public_user_list[] = $user;
+                                       }
+                                       unset($user);
+                                       reset($public_user_list);
+                                       $filtermethod .= " AND 
(phpgw_helpdesk_tickets.user_id IN(" . implode(',', $public_user_list) . ")";
+                               }
+
+                               $public_group_list = array();
+                               if (is_array($this->grants['groups']) && 
$this->grants['groups'])
+                               {
+                                       foreach($this->grants['groups'] as 
$user => $_right)
+                                       {
+                                               $public_group_list[] = $user;
+                                       }
+                                       unset($user);
+                                       reset($public_group_list);
+                                       $where = $public_user_list ? 'OR' : 
'AND';
+                                       $filtermethod .= " $where 
phpgw_group_map.group_id IN(" . implode(',', $public_group_list) . "))";
+                               }
+                               if($public_user_list && !$public_group_list)
+                               {
+                                       $filtermethod .=')';
+                               }
+                       }
+
+                       $sql = "SELECT * FROM phpgw_helpdesk_tickets 
{$acl_join} WHERE id = {$id} {$filtermethod}";
+
                        $this->db->query($sql,__LINE__,__FILE__);
 
                        if ($this->db->next_record())

Modified: trunk/helpdesk/inc/class.uitts.inc.php
===================================================================
--- trunk/helpdesk/inc/class.uitts.inc.php      2016-08-25 08:20:09 UTC (rev 
15503)
+++ trunk/helpdesk/inc/class.uitts.inc.php      2016-08-25 09:13:21 UTC (rev 
15504)
@@ -1502,6 +1502,10 @@
 
                        $ticket = $this->bo->read_single($id, $values);
 
+                       if(!$ticket)
+                       {
+                               $GLOBALS['phpgw']->redirect_link('/index.php', 
array('menuaction' => 'helpdesk.uitts.index'));
+                       }
                        if (isset($ticket['attributes']) && 
is_array($ticket['attributes']))
                        {
                                foreach ($ticket['attributes'] as & $attribute)




reply via email to

[Prev in Thread] Current Thread [Next in Thread]