fmsystem-commits
[Top][All Lists]
Advanced

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

[Fmsystem-commits] [14230] ticket: custom filters


From: Sigurd Nes
Subject: [Fmsystem-commits] [14230] ticket: custom filters
Date: Thu, 22 Oct 2015 16:30:23 +0000

Revision: 14230
          http://svn.sv.gnu.org/viewvc/?view=rev&root=fmsystem&revision=14230
Author:   sigurdne
Date:     2015-10-22 16:30:22 +0000 (Thu, 22 Oct 2015)
Log Message:
-----------
ticket: custom filters

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

Modified: trunk/property/inc/class.botts.inc.php
===================================================================
--- trunk/property/inc/class.botts.inc.php      2015-10-22 12:38:28 UTC (rev 
14229)
+++ trunk/property/inc/class.botts.inc.php      2015-10-22 16:30:22 UTC (rev 
14230)
@@ -56,6 +56,7 @@
                public $sum_difference  = 0;
                public $show_finnish_date = false;
                public $simple = false;
+               protected $custom_filters = array();
 
                var $public_functions = array
                (
@@ -334,8 +335,12 @@
                                        'name'=> $custom_col['input_text'],
                                        'datatype' => $custom_col['datatype'],
                                );
+                               if(($custom_col['datatype'] == 'LB' || 
$custom_col['datatype'] == 'CH' || $custom_col['datatype'] == 'R') && 
$custom_col['choice'])
+                               {
+                                       $this->custom_filters[] = 
$custom_col['column_name'];
+                               }
+
                        }
-
                        return $columns;
                }
 
@@ -507,13 +512,23 @@
                        $start_date     = 
$this->bocommon->date_to_timestamp($start_date);
                        $end_date       = 
$this->bocommon->date_to_timestamp($end_date);
 
+
+                       $custom_filtermethod = array();
+                       foreach($this->custom_filters as $custom_filter)
+                       {
+                               if($_REQUEST[$custom_filter]) //just testing..
+                               {
+                                       $custom_filtermethod[$custom_filter] = 
phpgw::get_var($custom_filter, 'int');
+                               }
+                       }
+
                        $tickets = $this->so->read(array('start' => 
$this->start,'query' => $this->query,'sort' => $this->sort,'order' => 
$this->order,
                                'status_id' => $this->status_id,'cat_id' => 
$this->cat_id,'district_id' => $this->district_id,
                                'part_of_town_id' => $this->part_of_town_id, 
'start_date'=>$start_date,'end_date'=>$end_date,
                                'allrows'=>$this->allrows,'user_id' => 
$this->user_id,'reported_by' => $this->reported_by, 'external'=>$external, 
'dry_run' => $dry_run,
                                'location_code' => $this->location_code, 
'p_num' => $this->p_num, 'vendor_id' => $this->vendor_id,
                                'ecodimb' => $this->ecodimb, 'b_account' => 
$this->b_account, 'building_part' => $this->building_part,
-                               'branch_id' => $this->branch_id ,'order_dim1' 
=> $this->order_dim1));
+                               'branch_id' => $this->branch_id ,'order_dim1' 
=> $this->order_dim1, 'custom_filtermethod' => $custom_filtermethod));
 
                        $this->total_records            = 
$this->so->total_records;
                        $this->sum_budget                       = 
$this->so->sum_budget;

Modified: trunk/property/inc/class.sotts.inc.php
===================================================================
--- trunk/property/inc/class.sotts.inc.php      2015-10-22 12:38:28 UTC (rev 
14229)
+++ trunk/property/inc/class.sotts.inc.php      2015-10-22 16:30:22 UTC (rev 
14230)
@@ -143,7 +143,9 @@
                        $building_part  = isset($data['building_part']) && 
$data['building_part'] ? $data['building_part']:'';
                        $branch_id              = isset($data['branch_id']) && 
$data['branch_id'] ? (int)$data['branch_id']:0;
                        $order_dim1             = isset($data['order_dim1']) && 
$data['order_dim1'] ? (int)$data['order_dim1']:0;
+                       $custom_filtermethod= 
isset($data['custom_filtermethod']) && $data['custom_filtermethod'] ? 
(array)$data['custom_filtermethod']:array();
 
+
                        $result_order_field = '';
                        if ($order)
                        {
@@ -426,6 +428,12 @@
                                $where= 'AND';
                        }
 
+                       foreach($custom_filtermethod as $custom_filter_key => 
$custom_filter_value)
+                       {
+                               $filtermethod .= " $where 
fm_tts_tickets.{$custom_filter_key} = '{$custom_filter_value}'";
+                               $where= 'AND';
+                       }
+
                        $location_id = 
$GLOBALS['phpgw']->locations->get_id('property', '.ticket');
 
                        $querymethod = '';

Modified: trunk/property/inc/class.uitts.inc.php
===================================================================
--- trunk/property/inc/class.uitts.inc.php      2015-10-22 12:38:28 UTC (rev 
14229)
+++ trunk/property/inc/class.uitts.inc.php      2015-10-22 16:30:22 UTC (rev 
14230)
@@ -743,7 +743,47 @@
                                                        )
                                                )
                                        );
+                                       $custom = 
createObject('phpgwapi.custom_fields');
+                                       $attrib_data = 
$custom->find('property',".ticket", 0, '','','',true, true);
+                                       $i = 12;
+                                       if($attrib_data)
+                                       {
+                                               foreach ( $attrib_data as 
$attrib )
+                                               {
+                                                       if(($attrib['datatype'] 
== 'LB' || $attrib['datatype'] == 'CH' || $attrib['datatype'] == 'R') && 
$attrib['choice'])
+                                                       {
+                                                               
$values_combo_box[$i][]  = array
+                                                               (
+                                                                       'id'    
=> '',
+                                                                       'name'  
=> lang('select') . " '{$attrib['input_text']}'"
+                                                               );
 
+                                                               
foreach($attrib['choice'] as $choice)
+                                                               {
+                                                                       
$values_combo_box[$i][]  = array
+                                                                       (
+                                                                               
'id'    => $choice['id'],
+                                                                               
'name'  => htmlspecialchars($choice['value'], ENT_QUOTES, 'UTF-8'),
+                                                                       );
+                                                               }
+
+                                                               
$datatable['actions']['form'][0]['fields']['field'][] = array
+                                                               (
+                                                                       'id' => 
"sel_{$attrib['column_name']}",
+                                                                       'name' 
=> $attrib['column_name'],
+                                                                       'value' 
=> $attrib['input_text'],
+                                                                       'type' 
=> 'select',
+                                                                       'style' 
=> 'filter',
+                                                                       
'values' => $values_combo_box[$i],
+                                                                       
'onchange'=> "onChangeSelect(\"{$attrib['column_name']}\");",
+                                                                       
'tab_index' => $i
+                                                               );
+                                                               $i++;
+                                                       }
+                                               }
+                                       }
+
+
                                        if($order_read)
                                        {
                                                
$datatable['actions']['form'][0]['fields']['field'][] = array
@@ -755,7 +795,7 @@
                                                                        'style' 
=> 'filter',
                                                                        
'values' => $this->bo->get_vendors($this->vendor_id),
                                                                        
'onchange'=> 'onChangeSelect("vendor_id");',
-                                                                       
'tab_index' => 12
+                                                                       
'tab_index' => $i++
                                                );
                                                
$datatable['actions']['form'][0]['fields']['field'][] = array
                                                (
@@ -766,7 +806,7 @@
                                                                        'style' 
=> 'filter',
                                                                        
'values' => $this->bo->get_ecodimb($this->ecodimb),
                                                                        
'onchange'=> 'onChangeSelect("ecodimb");',
-                                                                       
'tab_index' => 13
+                                                                       
'tab_index' => $i++
                                                );
                                                
$datatable['actions']['form'][0]['fields']['field'][] = array
                                                (
@@ -777,7 +817,7 @@
                                                                        'style' 
=> 'filter',
                                                                        
'values' => $this->bo->get_b_account($this->b_account),
                                                                        
'onchange'=> 'onChangeSelect("b_account");',
-                                                                       
'tab_index' => 14
+                                                                       
'tab_index' => $i++
                                                );
 
 
@@ -799,7 +839,7 @@
                                                                        
//'values' => $this->bo->get_building_part($this->building_part),
                                                                        
'values'        => $this->bocommon->select_category_list(array('type'=> 
'building_part','selected' =>$this->building_part, 'order' => 'id', 
'id_in_name' => 'num', 'filter' => $_filter_buildingpart)),
                                                                        
'onchange'=> 'onChangeSelect("building_part");',
-                                                                       
'tab_index' => 15
+                                                                       
'tab_index' => $i++
                                                );
 
                                                if ( 
isset($GLOBALS['phpgw_info']['user']['preferences']['property']['tts_branch_list'])
 && 
$GLOBALS['phpgw_info']['user']['preferences']['property']['tts_branch_list']==1)
@@ -813,7 +853,7 @@
                                                                        'style' 
=> 'filter',
                                                                        
'values' => $this->bo->get_branch($this->branch_id),
                                                                        
'onchange'=> 'onChangeSelect("branch_id");',
-                                                                       
'tab_index' => 16
+                                                                       
'tab_index' => $i++
                                                        );
                                                }
 
@@ -826,7 +866,7 @@
                                                                        'style' 
=> 'filter',
                                                                        
'values' => $this->bo->get_order_dim1($this->order_dim1),
                                                                        
'onchange'=> 'onChangeSelect("order_dim1");',
-                                                                       
'tab_index' => 17
+                                                                       
'tab_index' => $i++
                                                );
                                        }
                                }
@@ -897,6 +937,7 @@
                                }
                                $dry_run = true;
                        }
+                       $columns = $this->bo->get_columns();
 
                        $ticket_list = $this->bo->read($start_date, 
$end_date,'',$dry_run);
 
@@ -961,7 +1002,7 @@
                        $uicols['descr'][]      = lang('entry date');
 
                        $custom_cols = 
isset($GLOBALS['phpgw_info']['user']['preferences']['property']['ticket_columns'])
 && $GLOBALS['phpgw_info']['user']['preferences']['property']['ticket_columns'] 
? $GLOBALS['phpgw_info']['user']['preferences']['property']['ticket_columns'] : 
array();
-                       $columns = $this->bo->get_columns();
+//                     $columns = $this->bo->get_columns();
 
 //_debug_array($custom_cols);die();
                        foreach ($custom_cols as $col)




reply via email to

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