fmsystem-commits
[Top][All Lists]
Advanced

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

[Fmsystem-commits] [17143] Multiple select on filter on heldesk


From: sigurdne
Subject: [Fmsystem-commits] [17143] Multiple select on filter on heldesk
Date: Fri, 6 Oct 2017 13:09:09 -0400 (EDT)

Revision: 17143
          http://svn.sv.gnu.org/viewvc/?view=rev&root=fmsystem&revision=17143
Author:   sigurdne
Date:     2017-10-06 13:09:08 -0400 (Fri, 06 Oct 2017)
Log Message:
-----------
Multiple select on filter on heldesk

Modified Paths:
--------------
    trunk/helpdesk/inc/class.sotts.inc.php
    trunk/helpdesk/inc/class.uitts.inc.php
    trunk/phpgwapi/templates/base/datatable_jquery.xsl
    trunk/phpgwapi/templates/portico/head.inc.php

Modified: trunk/helpdesk/inc/class.sotts.inc.php
===================================================================
--- trunk/helpdesk/inc/class.sotts.inc.php      2017-10-06 14:42:45 UTC (rev 
17142)
+++ trunk/helpdesk/inc/class.sotts.inc.php      2017-10-06 17:09:08 UTC (rev 
17143)
@@ -108,7 +108,8 @@
                {
                        $start                  = isset($data['start']) && 
$data['start'] ? $data['start']:0;
                        $status_id              = isset($data['status_id']) && 
$data['status_id'] ? $data['status_id']:'O'; //O='Open'
-                       $user_id                = isset($data['user_id']) && 
$data['user_id'] ? (int)$data['user_id']: 0;
+                       $user_id                = isset($data['user_id']) && 
$data['user_id'] ? $data['user_id']: 0;
+                       $reported_by    = isset($data['reported_by']) && 
$data['reported_by'] ? (int)$data['reported_by'] : 0;
                        $owner_id               = 
isset($data['owner_id'])?$data['owner_id']:'';
                        $query                  = 
isset($data['query'])?$data['query']:'';
                        $sort                   = isset($data['sort']) && 
$data['sort'] ? $data['sort']:'DESC';
@@ -296,15 +297,39 @@
                                $where = 'AND';
                        }
 
-                       if ($user_id > 0)
+                       if ($user_id)
                        {
-                               $filtermethod .= " {$where} 
(assignedto={$user_id}";
-                               $where = 'AND';
+                               if (is_array($user_id))
+                               {
+                                       foreach ($user_id as &$_user_id)
+                                       {
+                                               $_user_id = abs($_user_id);
+                                       }
+                                       $filtermethod .= " {$where} assignedto 
IN (" . implode(', ' ,$user_id) . ')';
+                                       $where = 'AND';
+                               }
+                               else if ($user_id > 0)
+                               {
+                                       $filtermethod .= " {$where} 
(assignedto={$user_id}";
+                                       $where = 'AND';
 
-                               $membership = 
$GLOBALS['phpgw']->accounts->membership($user_id);
-                               $filtermethod .= ' OR (assignedto IS NULL AND 
phpgw_helpdesk_tickets.group_id IN (' . implode(',',array_keys($membership)) . 
')))';
+                                       $membership = 
$GLOBALS['phpgw']->accounts->membership($user_id);
+                                       array_unshift($membership, array(-1));
+                                       $filtermethod .= ' OR (assignedto IS 
NULL AND phpgw_helpdesk_tickets.group_id IN (' . 
implode(',',array_keys($membership)) . ')))';
+                               }
+                               else if ($user_id < 0)
+                               {
+                                       $filtermethod .= " {$where} 
assignedto=" . (int)abs($user_id);
+                                       $where = 'AND';
+                               }
                        }
 
+                       if ($reported_by > 0)
+                       {
+                               $filtermethod .= " $where 
phpgw_helpdesk_tickets.user_id=" . (int)$reported_by;
+                               $where = 'AND';
+                       }
+
                        if ($owner_id > 0)
                        {
                                $filtermethod .= " $where 
phpgw_helpdesk_tickets.user_id=" . (int)$owner_id;

Modified: trunk/helpdesk/inc/class.uitts.inc.php
===================================================================
--- trunk/helpdesk/inc/class.uitts.inc.php      2017-10-06 14:42:45 UTC (rev 
17142)
+++ trunk/helpdesk/inc/class.uitts.inc.php      2017-10-06 17:09:08 UTC (rev 
17143)
@@ -738,10 +738,10 @@
                                        'name' => lang('my assigned tickets'),
                                        'selected'      => ((int)$this->user_id 
< 0  || (int)$filter_tts_assigned_to_me == 1) ? 1 : 0));
 
-                               array_unshift($values_combo_box[4], array('id' 
=> '', 'name' => lang('assigned to')));
+//                             array_unshift($values_combo_box[4], array('id' 
=> '', 'name' => lang('assigned to')));
                                $combos[] = array(
                                        'type' => 'filter',
-//                                     'multiple'      => true,
+                                       'multiple'      => true,
                                        'name' => 'user_id',
                                        'extra' => '',
                                        'text' => lang('assigned to'),
@@ -821,6 +821,7 @@
                                        var api = oTable.api();
                                        api.ajax.reload();
                        }, {$refreshinterval} );
+//                     $("#user_id").material_select();
 JS;
 
                                $GLOBALS['phpgw']->js->add_code('', $js, true);
@@ -830,6 +831,7 @@
                        self::add_javascript('phpgwapi', 'jquery', 
'editable/jquery.jeditable.js');
                        self::add_javascript('phpgwapi', 'jquery', 
'editable/jquery.dataTables.editable.js');
                        self::add_javascript('helpdesk', 'portico', 
'tts.index.js');
+//                     self::add_javascript('phpgwapi', 'materialize', 
'js/materialize.min.js');
 
                        $start_date = urldecode($this->start_date);
                        $end_date = urldecode($this->end_date);

Modified: trunk/phpgwapi/templates/base/datatable_jquery.xsl
===================================================================
--- trunk/phpgwapi/templates/base/datatable_jquery.xsl  2017-10-06 14:42:45 UTC 
(rev 17142)
+++ trunk/phpgwapi/templates/base/datatable_jquery.xsl  2017-10-06 17:09:08 UTC 
(rev 17143)
@@ -1079,7 +1079,7 @@
                                        var temp = {};
                                        temp[menuaction] = {}
                                        oControls.each(function() {
-                                               if ( $(this).attr('name') && 
$(this).val() != null)
+                                               if ( $(this).attr('name') && 
$(this).val() != null && $(this).val().constructor != Array)
                                                {
                                                        sValue[ 
$(this).attr('name') ] = $(this).val().replace('"', '"');
                                                        temp[ 
$(this).attr('name') ] = $(this).val().replace('"', '"');
@@ -1156,8 +1156,10 @@
 //                                     console.log(oControls);
                                        oControls.each(function()
                                        {
-//                                             if ( $(this).attr('name') )
-                                               if ( $(this).attr('name') && 
$(this).val() != null)
+                                               var test = $(this).val();
+                                               console.log(test);
+                                               console.log(test.constructor);
+                                               if ( $(this).attr('name') && 
test != null && test.constructor !== Array)
                                                {
                                                        value = 
$(this).val().replace('"', '"');
                                                        aoData[ 
$(this).attr('name') ] = value;

Modified: trunk/phpgwapi/templates/portico/head.inc.php
===================================================================
--- trunk/phpgwapi/templates/portico/head.inc.php       2017-10-06 14:42:45 UTC 
(rev 17142)
+++ trunk/phpgwapi/templates/portico/head.inc.php       2017-10-06 17:09:08 UTC 
(rev 17143)
@@ -45,6 +45,7 @@
 
 
        $stylesheets = array();
+//     $stylesheets[] = "/phpgwapi/js/materialize/css/materialize.min.css";
        $stylesheets[] = "/phpgwapi/templates/pure/css/global.css";
 //     $stylesheets[] = "/phpgwapi/templates/pure/css/demo_mmenu.css";
        $stylesheets[] = "/phpgwapi/templates/pure/css/pure-min.css";




reply via email to

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