fmsystem-commits
[Top][All Lists]
Advanced

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

[Fmsystem-commits] [17200] more on helpdesk: support for top categories


From: sigurdne
Subject: [Fmsystem-commits] [17200] more on helpdesk: support for top categories
Date: Sat, 28 Oct 2017 07:07:01 -0400 (EDT)

Revision: 17200
          http://svn.sv.gnu.org/viewvc/?view=rev&root=fmsystem&revision=17200
Author:   sigurdne
Date:     2017-10-28 07:07:00 -0400 (Sat, 28 Oct 2017)
Log Message:
-----------
more on helpdesk: support for top categories

Modified Paths:
--------------
    trunk/helpdesk/inc/class.botts.inc.php
    trunk/helpdesk/inc/class.menu.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      2017-10-27 18:21:33 UTC (rev 
17199)
+++ trunk/helpdesk/inc/class.botts.inc.php      2017-10-28 11:07:00 UTC (rev 
17200)
@@ -39,6 +39,7 @@
                var $filter;
                var $sort;
                var $order;
+               var $parent_cat_id;
                var $cat_id;
                var $acl_location;
                var $uicols_related = array();
@@ -80,6 +81,7 @@
                        $this->user_id = phpgw::get_var('user_id', 'int');
                        $this->reported_by = phpgw::get_var('reported_by', 
'int');
                        $this->cat_id = phpgw::get_var('cat_id', 'int');
+                       $this->parent_cat_id = phpgw::get_var('parent_cat_id', 
'int');
                        $this->allrows = phpgw::get_var('allrows', 'bool');
                        $this->start_date = phpgw::get_var('filter_start_date', 
'string');
                        $this->end_date = phpgw::get_var('filter_end_date', 
'string');
@@ -1238,7 +1240,7 @@
 
                public function get_reported_by( $selected = 0 )
                {
-                       $values = $this->so->get_reported_by();
+                       $values = 
$this->so->get_reported_by($this->parent_cat_id);
 
                        foreach ($values as &$entry)
                        {

Modified: trunk/helpdesk/inc/class.menu.inc.php
===================================================================
--- trunk/helpdesk/inc/class.menu.inc.php       2017-10-27 18:21:33 UTC (rev 
17199)
+++ trunk/helpdesk/inc/class.menu.inc.php       2017-10-28 11:07:00 UTC (rev 
17200)
@@ -146,13 +146,51 @@
 
                        if ( $acl->check('.ticket',PHPGW_ACL_READ, 'helpdesk') )
                        {
-                               $menus['navigation']['helpdesk'] = array
-                                       (
-                                               'url'   => 
$GLOBALS['phpgw']->link('/index.php',array('menuaction'=> 
'helpdesk.uitts.index')),
-                                               'text'  => lang('inbox'),
-                                               'image'         => 
array('helpdesk', 'helpdesk')
-                                       );
+                               $categories     = 
CreateObject('phpgwapi.categories', -1, 'helpdesk', '.ticket');
+                               $categories->supress_info       = true;
+
+                               $_cats = $categories->return_sorted_array(0, 
false, '', '', '', false, false);
+                               $_categories = array();
+                               $subs = false;
+                               foreach ($_cats as $_cat)
+                               {
+                                       if ($_cat['level'] == 0 && 
$_cat['active'] != 2)
+                                       {
+                                               $_categories[] = $_cat;
+                                       }
+                                       else
+                                       {
+                                               $subs = true;
+                                       }
+                               }
+
+                               if($subs)
+                               {
+                                       foreach ($_categories as $_category)
+                                       {
+                                               
$menus['navigation']["helpdesk_{$_category['id']}"] = array
+                                                       (
+                                                               'url'   => 
$GLOBALS['phpgw']->link('/index.php',array('menuaction'=> 
'helpdesk.uitts.index', 'parent_cat_id' => $_category['id'])),
+                                                               'text'  => 
$_category['name'],
+                                                               'image'         
=> array('helpdesk', 'helpdesk')
+                                                       );
+                                               }
+
+                               }
+                               else
+                               {
+                                       $menus['navigation']['helpdesk'] = array
+                                               (
+                                                       'url'   => 
$GLOBALS['phpgw']->link('/index.php',array('menuaction'=> 
'helpdesk.uitts.index')),
+                                                       'text'  => 
lang('inbox'),
+                                                       'image'         => 
array('helpdesk', 'helpdesk')
+                                               );
+
+                               }
                        }
+
+
+
                        if ( $acl->check('.ticket',PHPGW_ACL_PRIVATE, 
'helpdesk') ) //manage
                        {
                                $menus['navigation']['response_template'] = 
array

Modified: trunk/helpdesk/inc/class.sotts.inc.php
===================================================================
--- trunk/helpdesk/inc/class.sotts.inc.php      2017-10-27 18:21:33 UTC (rev 
17199)
+++ trunk/helpdesk/inc/class.sotts.inc.php      2017-10-28 11:07:00 UTC (rev 
17200)
@@ -115,6 +115,7 @@
                        $sort                   = isset($data['sort']) && 
$data['sort'] ? $data['sort']:'DESC';
                        $order                  = 
isset($data['order'])?$data['order']:'';
                        $cat_id                 = isset($data['cat_id']) && 
$data['cat_id'] ? $data['cat_id']:0;
+                       $parent_cat_id  = isset($data['parent_cat_id']) && 
$data['parent_cat_id'] ? $data['parent_cat_id']:0;
                        $start_date             = isset($data['start_date']) && 
$data['start_date'] ? (int)$data['start_date'] : 0;
                        $end_date               = isset($data['end_date']) && 
$data['end_date'] ? (int)$data['end_date'] : 0;
                        $results                = isset($data['results']) && 
$data['results'] ? (int)$data['results'] : 0;
@@ -170,11 +171,25 @@
 
                        $where= 'WHERE';
 
+                       if($parent_cat_id)
+                       {
+                               $_cats  = CreateObject('phpgwapi.categories', 
-1, 'helpdesk', '.ticket')->return_sorted_array(0, false, '', '', '', false, 
$parent_cat_id);
+                               $_filter_cat = array($parent_cat_id);
+                               foreach ($_cats as $_cat)
+                               {
+                                       $_filter_cat[] = $_cat['id'];
+
+                               }
+
+                               $filtermethod = ' WHERE cat_id IN (' . 
implode(',', $_filter_cat) . ')';
+                               $where= 'AND';
+                       }
+
                        $GLOBALS['phpgw']->config->read();
 
                        
if(isset($GLOBALS['phpgw']->config->config_data['acl_at_tts_category']) && 
$GLOBALS['phpgw']->config->config_data['acl_at_tts_category'])
                        {
-                               $filtermethod = " WHERE 
phpgw_helpdesk_tickets.cat_id IN (" . implode(",", $grant_category) . ")";
+                               $filtermethod .= " {$where} 
phpgw_helpdesk_tickets.cat_id IN (" . implode(",", $grant_category) . ")";
                                $where= 'AND';
                        }
 
@@ -1200,11 +1215,29 @@
                        }
                }
 
-               public function get_reported_by()
+               public function get_reported_by($parent_cat_id = 0)
                {
+                       $filtermethod = '';
+
+                       if($parent_cat_id)
+                       {
+                               $categories     = 
CreateObject('phpgwapi.categories', -1, 'helpdesk', '.ticket');
+                               $categories->supress_info       = true;
+                               $_cats = $categories->return_sorted_array(0, 
false, '', '', '', false, $parent_cat_id);
+                               $_filter_cat = array($parent_cat_id);
+                               foreach ($_cats as $_cat)
+                               {
+                                       $_filter_cat[] = $_cat['id'];
+                       
+                               }
+
+                               $filtermethod = ' WHERE cat_id IN (' . 
implode(',', $_filter_cat) . ')';
+                       }
+
                        $values = array();
                        $sql = "SELECT DISTINCT user_id as id , 
account_lastname, account_firstname FROM phpgw_helpdesk_tickets"
                                . " {$this->join} phpgw_accounts ON 
phpgw_helpdesk_tickets.user_id = phpgw_accounts.account_id"
+                               . " {$filtermethod}"
                                . " ORDER BY account_lastname ASC";
 
                        $this->db->query($sql, __LINE__, __FILE__);

Modified: trunk/helpdesk/inc/class.uitts.inc.php
===================================================================
--- trunk/helpdesk/inc/class.uitts.inc.php      2017-10-27 18:21:33 UTC (rev 
17199)
+++ trunk/helpdesk/inc/class.uitts.inc.php      2017-10-28 11:07:00 UTC (rev 
17200)
@@ -67,6 +67,7 @@
                var $status;
                var $filter;
                var $user_filter;
+               var $parent_cat_id;
 
                public function __construct()
                {
@@ -101,6 +102,7 @@
                        $this->status_id                        = 
$this->bo->status_id;
                        $this->user_id                          = 
$this->bo->user_id;
                        $this->cat_id                           = 
$this->bo->cat_id;
+                       $this->parent_cat_id            = 
$this->bo->parent_cat_id;
                        $this->district_id                      = 
$this->bo->district_id;
                        $this->allrows                          = 
$this->bo->allrows;
                        $this->start_date                       = 
$this->bo->start_date;
@@ -108,6 +110,10 @@
                        $this->location_code            = 
$this->bo->location_code;
                        $this->p_num                            = 
$this->bo->p_num;
 
+                       if($this->parent_cat_id)
+                       {
+                               
$GLOBALS['phpgw_info']['flags']['menu_selection'] = 
"helpdesk::helpdesk_$this->parent_cat_id";
+                       }
 
                        $default_interface = 
isset($this->bo->config->config_data['tts_default_interface']) ? 
$this->bo->config->config_data['tts_default_interface'] : '';
 
@@ -241,6 +247,7 @@
                                'branch_id' => phpgw::get_var('branch_id'),
                                'order_dim1' => phpgw::get_var('order_dim1'),
                                'check_date_type' => 
phpgw::get_var('check_date_type', 'int'),
+                               'parent_cat_id' => $this->parent_cat_id
                        );
 
                        return $params;
@@ -287,11 +294,11 @@
                        $result_data['sum_budget'] = $this->bo->sum_budget;
                        $result_data['sum_actual_cost'] = 
$this->bo->sum_actual_cost;
                        $result_data['sum_difference'] = 
$this->bo->sum_difference;
-                       $result_data['draw'] = $draw;
+                       $result_data['draw'] = phpgw::get_var('draw', 'int');
 
                        $link_data = array
                                (
-                               'menuaction' => 'helpdesk.uitts.view',
+                               'menuaction' => 'helpdesk.uitts.view', 
'parent_cat_id' => $this->parent_cat_id
                        );
 
                        array_walk($result_data['results'], array($this, 
'_add_links'), $link_data);
@@ -711,17 +718,36 @@
 
                        if(!$this->_simple)
                        {
-                               $values_combo_box[0] = 
$this->cats->formatted_xslt_list(array('format' => 'filter',
-                                       'selected' => $this->cat_id, 'globals' 
=> true, 'use_acl' => $this->_category_acl));
-                               $default_value = array('cat_id' => '', 'name' 
=> lang('no category'));
-                               array_unshift($values_combo_box[0]['cat_list'], 
$default_value);
-
-                               $_categories = array();
-                               foreach ($values_combo_box[0]['cat_list'] as 
$_category)
+                               if($this->parent_cat_id)
                                {
-                                       $_categories[] = array('id' => 
$_category['cat_id'], 'name' => $_category['name']);
+                                       $_cats = 
$this->cats->return_sorted_array(0, false, '', '', '', false, 
$this->parent_cat_id);
+                                       $_categories = array();
+                                       foreach ($_cats as $_cat)
+                                       {
+                                               if($_cat['parent'] == 
$this->parent_cat_id)
+                                               {
+                                                       if ($_cat['active'] != 
2)
+                                                       {
+                                                               $_categories[] 
= $_cat;
+                                                       }
+                                               }
+                                       }
                                }
+                               else
+                               {
+                                       $values_combo_box[0] = 
$this->cats->formatted_xslt_list(array('format' => 'filter',
+                                               'selected' => $this->cat_id, 
'globals' => true, 'use_acl' => $this->_category_acl));
 
+                                       $_categories = array();
+                                       foreach 
($values_combo_box[0]['cat_list'] as $_category)
+                                       {
+                                               $_categories[] = array('id' => 
$_category['cat_id'], 'name' => $_category['name']);
+                                       }
+
+                               }
+
+                               array_unshift($_categories, array('id' => '', 
'name' => lang('no category')));
+
                                $combos[] = array('type' => 'filter',
                                        'name' => 'cat_id',
                                        'extra' => '',
@@ -840,6 +866,13 @@
                        
$GLOBALS['phpgw']->jqcal->add_listener('filter_end_date');
 
                        $appname = $this->lang_app_name;
+
+                       if($this->parent_cat_id)
+                       {
+                               $parent_category =  
CreateObject('phpgwapi.categories', -1, 'helpdesk', 
'.ticket')->return_single($this->parent_cat_id);
+                               $appname = $parent_category[0]['name'];
+                       }
+
                        $function_msg = lang('list ticket');
 
                        $data = array(
@@ -867,13 +900,13 @@
                                        ),
                                ),
                                'datatable' => array(
-                                       'source' => 
self::link(array('menuaction' => 'helpdesk.uitts.index',
+                                       'source' => 
self::link(array('menuaction' => 'helpdesk.uitts.index', 'parent_cat_id' => 
$this->parent_cat_id,
                                                'phpgw_return_as' => 'json')),
                                        'download' => 
self::link(array('menuaction' => 'helpdesk.uitts.download',
                                                'export' => true, 'allrows' => 
true)),
                                        'allrows' => true,
                                        "columns" => array('onclick' => 
"JqueryPortico.openPopup({menuaction:'helpdesk.uitts.columns'}, 
{closeAction:'reload'})"),
-                                       'new_item' => 
self::link(array('menuaction' => 'helpdesk.uitts.add')),
+                                       'new_item' => 
self::link(array('menuaction' => 'helpdesk.uitts.add', 'parent_cat_id' => 
$this->parent_cat_id)),
                                        'editor_action' => 
self::link(array('menuaction' => 'helpdesk.uitts.edit_survey_title')),
                                        'field' => $this->_get_fields(),
                                        'query' => phpgw::get_var('query')
@@ -902,7 +935,8 @@
                                'text' => lang('view'),
                                'action' => 
$GLOBALS['phpgw']->link('/index.php', array
                                        (
-                                       'menuaction' => 'helpdesk.uitts.view'
+                                       'menuaction' => 'helpdesk.uitts.view',
+                                       'parent_cat_id' => $this->parent_cat_id
                                )),
                                'parameters' => json_encode($parameters)
                        );
@@ -915,6 +949,7 @@
                                'action' => 
$GLOBALS['phpgw']->link('/index.php', array
                                        (
                                        'menuaction' => 'helpdesk.uitts._print',
+                                       'parent_cat_id' => $this->parent_cat_id
                                )),
                                'target' => '_blank',
                                'parameters' => json_encode($parameters)
@@ -933,6 +968,7 @@
                                                'action' => 
$GLOBALS['phpgw']->link('/index.php', array
                                                        (
                                                        'menuaction' => 
'helpdesk.uijasper.view',
+                                                       'parent_cat_id' => 
$this->parent_cat_id,
                                                        'jasper_id' => 
$report['id'],
                                                )),
                                                'target' => '_blank',
@@ -1102,7 +1138,7 @@
                        $values['contact_id'] = phpgw::get_var('contact', 
'int', 'POST');
                        if ((isset($values['cancel']) && $values['cancel']))
                        {
-                               $GLOBALS['phpgw']->redirect_link('/index.php', 
array('menuaction' => 'helpdesk.uitts.index'));
+                               $GLOBALS['phpgw']->redirect_link('/index.php', 
array('menuaction' => 'helpdesk.uitts.index','parent_cat_id' => 
$this->parent_cat_id));
                        }
 
                        $values_attribute = phpgw::get_var('values_attribute');
@@ -1302,11 +1338,11 @@
 
                                        if ((isset($values['save']) && 
$values['save']))
                                        {
-                                               
$GLOBALS['phpgw']->redirect_link('/index.php', array('menuaction' => 
'helpdesk.uitts.index'));
+                                               
$GLOBALS['phpgw']->redirect_link('/index.php', array('menuaction' => 
'helpdesk.uitts.index', 'parent_cat_id' => $this->parent_cat_id));
                                        }
                                        else
                                        {
-                                               
$GLOBALS['phpgw']->redirect_link('/index.php', array('menuaction' => 
'helpdesk.uitts.view',
+                                               
$GLOBALS['phpgw']->redirect_link('/index.php', array('menuaction' => 
'helpdesk.uitts.view', 'parent_cat_id' => $this->parent_cat_id,
                                                        'id' => $receipt['id'], 
'tab' => 'general'));
                                        }
                                }
@@ -1349,7 +1385,7 @@
                                'type' => 'form'));
 
                        $link_data = array(
-                               'menuaction' => 'helpdesk.uitts.add'
+                               'menuaction' => 'helpdesk.uitts.add', 
'parent_cat_id' => $this->parent_cat_id
                        );
 
                        if (!isset($values['assignedto']))
@@ -1389,7 +1425,27 @@
                        $tabs['add'] = array('label' => lang('Add'), 'link' => 
'#add');
                        $active_tab = 'add';
 
+                       $cat_select = 
$this->cats->formatted_xslt_list(array('select_name' => 'values[cat_id]',
+                                       'selected' => $this->cat_id, 'use_acl' 
=> $this->_category_acl, 'required' => true,'class'=>'pure-input-1-2'));
 
+                       /**overide*/
+                       if($this->parent_cat_id)
+                       {
+                               $cat_select['cat_list'] = array();
+
+                               $_cats = $this->cats->return_sorted_array(0, 
false, '', '', '', false, $this->parent_cat_id);
+                               foreach ($_cats as $_cat)
+                               {
+                                       $cat_select['cat_list'][] = array
+                                       (
+                                               'cat_id'        => $_cat['id'],
+                                               'name'          => 
$_cat['name'],
+                                               'selected'      => $_cat['id'] 
== $this->cat_id ? 'selected' : '',
+                                               'description' => 
$_cat['description']
+                                       );
+                               }
+                       }
+
                        $data = array(
                                'my_groups' => json_encode($my_groups),
                                'custom_attributes' => array('attributes' => 
$values['attributes']),
@@ -1430,8 +1486,7 @@
                                'lang_town_statustext' => lang('Select the part 
of town the building belongs to. To do not use a part of town -  select NO PART 
OF TOWN'),
                                'lang_part_of_town' => lang('Part of town'),
                                'lang_no_part_of_town' => lang('No part of 
town'),
-                               'cat_select' => 
$this->cats->formatted_xslt_list(array('select_name' => 'values[cat_id]',
-                                       'selected' => $this->cat_id, 'use_acl' 
=> $this->_category_acl, 'required' => true,'class'=>'pure-input-1-2')),
+                               'cat_select' => $cat_select,
                                'pref_send_mail' => 
(isset($GLOBALS['phpgw_info']['user']['preferences']['helpdesk']['tts_user_mailnotification'])
 ? 
$GLOBALS['phpgw_info']['user']['preferences']['helpdesk']['tts_user_mailnotification']
 : ''),
                                'fileupload' => 
true,//(isset($this->bo->config->config_data['fmttsfileupload']) ? 
$this->bo->config->config_data['fmttsfileupload'] : ''),
                                'tabs' => 
phpgwapi_jquery::tabview_generate($tabs, $active_tab)
@@ -1750,7 +1805,7 @@
 
                        if(!$ticket)
                        {
-                               $GLOBALS['phpgw']->redirect_link('/index.php', 
array('menuaction' => 'helpdesk.uitts.index'));
+                               $GLOBALS['phpgw']->redirect_link('/index.php', 
array('menuaction' => 'helpdesk.uitts.index', 'parent_cat_id' => 
$this->parent_cat_id));
                        }
                        if (isset($ticket['attributes']) && 
is_array($ticket['attributes']))
                        {
@@ -1774,6 +1829,7 @@
 
                        $form_link = array(
                                'menuaction' => 'helpdesk.uitts.view',
+                               'parent_cat_id' => $this->parent_cat_id,
                                'id' => $id
                        );
 
@@ -1955,6 +2011,25 @@
                        $cat_select = 
$this->cats->formatted_xslt_list(array('select_name' => 'values[cat_id]',
                                'selected' => $this->cat_id, 'use_acl' => 
$this->_category_acl, 'required' => true,'class'=>'pure-input-1-2'));
 
+                       /**overide*/
+                       if($this->parent_cat_id)
+                       {
+                               $cat_select['cat_list'] = array();
+
+                               $_cats = $this->cats->return_sorted_array(0, 
false, '', '', '', false, $this->parent_cat_id);
+                               foreach ($_cats as $_cat)
+                               {
+                                       $cat_select['cat_list'][] = array
+                                       (
+                                               'cat_id'        => $_cat['id'],
+                                               'name'          => 
$_cat['name'],
+                                               'selected'      => $_cat['id'] 
== $this->cat_id ? 'selected' : '',
+                                               'description' => 
$_cat['description']
+                                       );
+                               }
+                       }
+
+
                        $_ticket_cat_found = false;
                        if (isset($cat_select['cat_list']) && 
is_array($cat_select['cat_list']))
                        {
@@ -1986,10 +2061,6 @@
                        }
 
 
-//                     $this->cats->set_appname('property','.project');
-//                     $order_catetory = 
$this->cats->formatted_xslt_list(array('select_name' => 
'values[order_cat_id]','selected' => $ticket['order_cat_id']));
-
-
                        $membership = 
$GLOBALS['phpgw']->accounts->membership($this->account);
                        $my_groups = array();
                        foreach ($membership as $group_id => $group)
@@ -2048,7 +2119,7 @@
                                'cat_select' => $cat_select,
                                'value_category_name' => 
$ticket['category_name'],
                                'form_action' => 
$GLOBALS['phpgw']->link('/index.php', $form_link),
-                               'done_action' => 
$GLOBALS['phpgw']->link('/index.php', array('menuaction' => 
'helpdesk.uitts.index')),
+                               'done_action' => 
$GLOBALS['phpgw']->link('/index.php', array('menuaction' => 
'helpdesk.uitts.index','parent_cat_id' => $this->parent_cat_id)),
                                'value_subject' => $ticket['subject'],
                                'value_id' => '[ #' . $id . ' ] - ',
                                'id'            => $id,
@@ -2088,7 +2159,7 @@
                                'tabs' => 
phpgwapi_jquery::tabview_generate($tabs, $active_tab),
                                'set_user' => ($ticket['user_id'] != 
$ticket['reverse_id'] && $ticket['assignedto'] ==  $this->account) ? true : 
false
                        );
- 
+
                        phpgwapi_jquery::load_widget('numberformat');
                        phpgwapi_jquery::load_widget('autocomplete');
                        self::add_javascript('helpdesk', 'portico', 
'tts.view.js');




reply via email to

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