fmsystem-commits
[Top][All Lists]
Advanced

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

[Fmsystem-commits] [6883] property: added filter on tickets (vendor)


From: Sigurd Nes
Subject: [Fmsystem-commits] [6883] property: added filter on tickets (vendor)
Date: Mon, 31 Jan 2011 14:19:40 +0000

Revision: 6883
          http://svn.sv.gnu.org/viewvc/?view=rev&root=fmsystem&revision=6883
Author:   sigurdne
Date:     2011-01-31 14:19:39 +0000 (Mon, 31 Jan 2011)
Log Message:
-----------
property: added filter on tickets (vendor)

Modified Paths:
--------------
    trunk/property/inc/class.botts.inc.php
    trunk/property/inc/class.sotts.inc.php
    trunk/property/inc/class.uitts.inc.php
    trunk/property/js/yahoo/tts.index.js

Modified: trunk/property/inc/class.botts.inc.php
===================================================================
--- trunk/property/inc/class.botts.inc.php      2011-01-31 12:01:00 UTC (rev 
6882)
+++ trunk/property/inc/class.botts.inc.php      2011-01-31 14:19:39 UTC (rev 
6883)
@@ -92,8 +92,8 @@
                        $start_date                             = 
phpgw::get_var('start_date', 'string');
                        $end_date                               = 
phpgw::get_var('end_date', 'string');
                        $location_code                  = 
phpgw::get_var('location_code');
+                       $vendor_id                              = 
phpgw::get_var('vendor_id', 'int');
 
-
 //                     $this->start                    = $start                
                                        ? $start                        : 0;
 
                        $this->start                    = 
isset($_REQUEST['start'])             ? $start                        : 
$this->start;
@@ -109,7 +109,7 @@
                        $this->start_date               = 
isset($_REQUEST['start_date'])        ? $start_date           : 
$this->start_date;
                        $this->end_date                 = 
isset($_REQUEST['end_date'])          ? $end_date                     : 
$this->end_date;
                        $this->location_code    = isset($location_code) && 
$location_code ? $location_code : '';
-
+                       $this->vendor_id                = 
isset($_REQUEST['vendor_id'])         ? $vendor_id            : 
$this->vendor_id;
                        $this->p_num                    = 
phpgw::get_var('p_num');
                }
 
@@ -138,6 +138,7 @@
                        $this->allrows                  = 
isset($data['allrows'])?$data['allrows']:'';
                        $this->start_date               = 
isset($data['start_date'])?$data['start_date']:'';
                        $this->end_date                 = 
isset($data['end_date'])?$data['end_date']:'';
+                       $this->vendor_id                = 
isset($data['vendor_id'])?$data['vendor_id']:'';
                }
 
                function column_list($selected = 
array(),$type_id='',$allrows='')
@@ -306,7 +307,7 @@
                                '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,'external'=>$external, 'dry_run' => $dry_run,
-                               'location_code' => $this->location_code, 
'p_num' => $this->p_num));
+                               'location_code' => $this->location_code, 
'p_num' => $this->p_num, 'vendor_id' => $this->vendor_id));
 
                        $this->total_records = $this->so->total_records;
                        $this->sum_budget = $this->so->sum_budget;
@@ -407,7 +408,7 @@
                                        }
                                }
                                if( $ticket['vendor_id'])
-                               {
+                               {;
                                        
if(isset($vendor_cache[$ticket['vendor_id']]))
                                        {
                                                $ticket['vendor'] = 
$vendor_cache[$ticket['vendor_id']];
@@ -430,7 +431,6 @@
                                        }
                                }
                        }
-
                        return $tickets;
                }
 
@@ -996,4 +996,25 @@
                        $this->fields_updated = $this->so->fields_updated;      
        
                        return $receipt;
                }
+
+               public function get_vendors($selected)
+               {
+                       $vendors = $this->so->get_vendors();
+                       foreach ($vendors as &$vendor)
+                       {
+                               if($vendor['id'] == $selected)
+                               {
+                                       $vendor['selected'] = 1;
+                                       break;
+                               }
+                       }
+
+                       $default_value = array
+                       (
+                               'id'    => '',
+                               'name'  => lang('vendor')
+                       );
+                       array_unshift($vendors,$default_value);
+                       return $vendors;
+               }
        }

Modified: trunk/property/inc/class.sotts.inc.php
===================================================================
--- trunk/property/inc/class.sotts.inc.php      2011-01-31 12:01:00 UTC (rev 
6882)
+++ trunk/property/inc/class.sotts.inc.php      2011-01-31 14:19:39 UTC (rev 
6883)
@@ -122,7 +122,7 @@
                        $query                  = 
isset($data['query'])?$data['query']:'';
                        $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;
+                       $cat_id                 = isset($data['cat_id']) && 
$data['cat_id'] ? (int)$data['cat_id']:0;
                        $district_id    = isset($data['district_id']) && 
$data['district_id'] ? (int)$data['district_id']:0;
                        $part_of_town_id= isset($data['part_of_town_id']) && 
$data['part_of_town_id'] ? (int)$data['part_of_town_id']:0;
                        $allrows                = 
isset($data['allrows'])?$data['allrows']:'';
@@ -133,6 +133,7 @@
                        $new                    = isset($data['new']) ? 
$data['new'] : '';
                        $location_code  = isset($data['location_code']) ? 
$data['location_code'] : '';
                        $p_num                  = isset($data['p_num']) ? 
$data['p_num'] : '';
+                       $vendor_id              = isset($data['vendor_id']) && 
$data['vendor_id'] ? (int)$data['vendor_id']:0;
 
                        $this->grants   = 
$GLOBALS['phpgw']->session->appsession('grants_ticket','property');
 
@@ -307,6 +308,12 @@
                                $where = 'AND';
                        }
 
+                       if ($vendor_id > 0)
+                       {
+                               $filtermethod .= " $where vendor_id=" . 
(int)$vendor_id;
+                               $where = 'AND';
+                       }
+
                        if ($user_id > 0)
                        {
                                $filtermethod .= " {$where} 
(assignedto={$user_id}";
@@ -1247,4 +1254,23 @@
                                return false;
                        }
                }
+
+               public function get_vendors()
+               {
+                       $vendors = array();
+                       $sql = "SELECT DISTINCT fm_vendor.id, 
fm_vendor.org_name FROM fm_tts_tickets {$this->join} fm_vendor ON 
fm_tts_tickets.vendor_id = fm_vendor.id ORDER BY org_name ASC";
+                       
+                       $this->db->query($sql, __LINE__,__FILE__);
+
+                       while ($this->db->next_record())
+                       {
+                               $vendors[] = array
+                               (
+                                       'id'    => $this->db->f('id'),
+                                       'name'  => $this->db->f('org_name', 
true)
+                               );
+                       }
+       
+                       return $vendors;
+               }
        }

Modified: trunk/property/inc/class.uitts.inc.php
===================================================================
--- trunk/property/inc/class.uitts.inc.php      2011-01-31 12:01:00 UTC (rev 
6882)
+++ trunk/property/inc/class.uitts.inc.php      2011-01-31 14:19:39 UTC (rev 
6883)
@@ -97,6 +97,7 @@
                        $this->status_id                        = 
$this->bo->status_id;
                        $this->user_id                          = 
$this->bo->user_id;
                        $this->cat_id                           = 
$this->bo->cat_id;
+                       $this->vendor_id                        = 
$this->bo->vendor_id;
                        $this->district_id                      = 
$this->bo->district_id;
                        $this->part_of_town_id          = 
$this->bo->part_of_town_id;
                        $this->allrows                          = 
$this->bo->allrows;
@@ -140,6 +141,7 @@
                                        'status_id'             => 
$this->status_id,
                                        'user_id'               => 
$this->user_id,
                                        'cat_id'                => 
$this->cat_id,
+                                       'vendor_id'             => 
$this->vendor_id,
                                        'district_id'   => $this->district_id,
                                        'part_of_town_id'=> 
$this->part_of_town_id,
                                        'allrows'               => 
$this->allrows,
@@ -441,6 +443,7 @@
                        $allrows                = phpgw::get_var('allrows', 
'bool');
 
                        $datatable = array();
+                       $order_read     = $this->acl->check('.ticket.order', 
PHPGW_ACL_READ, 'property');
 
                        if( phpgw::get_var('phpgw_return_as') != 'json' )
                        {
@@ -464,6 +467,7 @@
                                        ."sort: '{$this->sort}',"
                                        ."order: '{$this->order}',"
                                        ."cat_id:'{$this->cat_id}',"
+                                       ."vendor_id:'{$this->vendor_id}',"
                                        ."status_id: '{$this->status_id}',"
                                        ."user_id: '{$this->user_id}',"
                                        ."query: '{$this->query}',"
@@ -482,6 +486,7 @@
                                                'sort'                          
=> $this->sort,
                                                'order'                         
=> $this->order,
                                                'cat_id'                        
=> $this->cat_id,
+                                               'vendor_id'                     
=> $this->vendor_id,
                                                'status_id'                     
=> $this->status_id,
                                                'user_id'                       
=> $this->user_id,
                                                'query'                         
=> $this->query,
@@ -548,6 +553,7 @@
                                                                        
'district_id'       => $this->district_id,
                                                                        
'part_of_town_id'   => $this->part_of_town_id,
                                                                        
'cat_id'                => $this->cat_id,
+                                                                       
'vendor_id'             => $this->vendor_id,
                                                                        
'status'                        => $this->status
                                                                )
                                                        ),
@@ -600,7 +606,7 @@
                                                                                
'type' => 'select',
                                                                                
'style' => 'filter',
                                                                                
'values' => $values_combo_box[4],
-                                                                               
'onchange'=> 'onChangeSelect();',
+                                                                               
'onchange'=> 'onChangeSelect("user_id");',
                                                                                
'tab_index' => 5
                                                                        ),
                                                                        array
@@ -707,6 +713,21 @@
                                                        )
                                                )
                                        );
+
+                                       if($order_read)
+                                       {
+                                               
$datatable['actions']['form'][0]['fields']['field'][] = array
+                                                       (
+                                                                       'id' => 
'sel_vendor_id', // testing traditional listbox for long list
+                                                                       'name' 
=> 'vendor_id',
+                                                                       'value' 
=> lang('vendor'),
+                                                                       'type' 
=> 'select',
+                                                                       'style' 
=> 'filter',
+                                                                       
'values' => $this->bo->get_vendors($this->vendor_id),
+                                                                       
'onchange'=> 'onChangeSelect("vendor_id");',
+                                                                       
'tab_index' => 12
+                                                       );
+                                       }
                                }
                                else
                                {
@@ -828,7 +849,7 @@
                        $uicols['name'][] = 'status';
                        $uicols['descr'][]      = lang('status');
 
-                       if( $this->acl->check('.ticket.order', PHPGW_ACL_READ, 
'property') )
+                       if( $order_read )
                        {
                                $uicols['name'][] = 'order_id';
                                $uicols['descr'][]      = lang('order id');
@@ -1441,6 +1462,7 @@
                                        (
                                                'sort'  => $this->sort,
                                                'var'   => 'finnish_date',
+
                                                'order' => $this->order,
                                                'extra' => array
                                                (

Modified: trunk/property/js/yahoo/tts.index.js
===================================================================
--- trunk/property/js/yahoo/tts.index.js        2011-01-31 12:01:00 UTC (rev 
6882)
+++ trunk/property/js/yahoo/tts.index.js        2011-01-31 14:19:39 UTC (rev 
6883)
@@ -47,9 +47,9 @@
                elCell.innerHTML = "<P align=\"right\">"+oData+"</p>";
        }
 
-       this.onChangeSelect = function()
+       this.onChangeSelect = function(type)
        {
-               var myselect=document.getElementById("sel_user_id");
+               var myselect=document.getElementById("sel_"+ type);
                for (var i=0; i<myselect.options.length; i++)
                {
                        if (myselect.options[i].selected==true)
@@ -57,7 +57,7 @@
                                break;
                        }
                }
-               eval("path_values.user_id='"+myselect.options[i].value+"'");
+               eval("path_values." +type +"='"+myselect.options[i].value+"'");
                execute_ds();
        }
 




reply via email to

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