fmsystem-commits
[Top][All Lists]
Advanced

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

[Fmsystem-commits] [6886] property: add filters to helpdesk


From: Sigurd Nes
Subject: [Fmsystem-commits] [6886] property: add filters to helpdesk
Date: Mon, 31 Jan 2011 19:01:32 +0000

Revision: 6886
          http://svn.sv.gnu.org/viewvc/?view=rev&root=fmsystem&revision=6886
Author:   sigurdne
Date:     2011-01-31 19:01:31 +0000 (Mon, 31 Jan 2011)
Log Message:
-----------
property: add filters to helpdesk

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      2011-01-31 15:05:03 UTC (rev 
6885)
+++ trunk/property/inc/class.botts.inc.php      2011-01-31 19:01:31 UTC (rev 
6886)
@@ -93,7 +93,13 @@
                        $end_date                               = 
phpgw::get_var('end_date', 'string');
                        $location_code                  = 
phpgw::get_var('location_code');
                        $vendor_id                              = 
phpgw::get_var('vendor_id', 'int');
+                       $ecodimb                                = 
phpgw::get_var('ecodimb', 'int');
+                       $b_account                              = 
phpgw::get_var('b_account', 'string');
+                       $building_part                  = 
phpgw::get_var('building_part', 'string');
+                       $branch_id                              = 
phpgw::get_var('branch_id', 'int');
+                       $order_dim1                             = 
phpgw::get_var('order_dim1', 'int');
 
+
 //                     $this->start                    = $start                
                                        ? $start                        : 0;
 
                        $this->start                    = 
isset($_REQUEST['start'])             ? $start                        : 
$this->start;
@@ -111,6 +117,11 @@
                        $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');
+                       $this->ecodimb                  = 
isset($_REQUEST['ecodimb'])           ? $ecodimb                      : 
$this->ecodimb;
+                       $this->b_account                = 
isset($_REQUEST['b_account'])         ? $b_account            : 
$this->b_account;
+                       $this->building_part    = 
isset($_REQUEST['building_part']) ? $building_part    : $this->building_part;
+                       $this->branch_id                = 
isset($_REQUEST['branch_id'])         ? $branch_id            : 
$this->branch_id;
+                       $this->order_dim1               = 
isset($_REQUEST['order_dim1'])        ? $order_dim1           : 
$this->order_dim1;
                }
 
 
@@ -307,7 +318,9 @@
                                '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, 'vendor_id' => $this->vendor_id));
+                               '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));
 
                        $this->total_records = $this->so->total_records;
                        $this->sum_budget = $this->so->sum_budget;
@@ -1017,4 +1030,104 @@
                        array_unshift($vendors,$default_value);
                        return $vendors;
                }
+               public function get_ecodimb($selected)
+               {
+                       $values = $this->so->get_ecodimb();
+                       foreach ($values as &$value)
+                       {
+                               if($value['id'] == $selected)
+                               {
+                                       $value['selected'] = 1;
+                                       break;
+                               }
+                       }
+
+                       $default_value = array
+                       (
+                               'id'    => '',
+                               'name'  => lang('dimb')
+                       );
+                       array_unshift($values,$default_value);
+                       return $values;
+               }
+               public function get_b_account($selected)
+               {
+                       $values = $this->so->get_b_account();
+                       foreach ($values as &$value)
+                       {
+                               if($value['id'] == $selected)
+                               {
+                                       $value['selected'] = 1;
+                                       break;
+                               }
+                       }
+
+                       $default_value = array
+                       (
+                               'id'    => '',
+                               'name'  => lang('budget account')
+                       );
+                       array_unshift($values,$default_value);
+                       return $values;
+               }
+               public function get_building_part($selected)
+               {
+                       $values = $this->so->get_building_part();
+                       foreach ($values as &$value)
+                       {
+                               if($value['id'] == $selected)
+                               {
+                                       $value['selected'] = 1;
+                                       break;
+                               }
+                       }
+
+                       $default_value = array
+                       (
+                               'id'    => '',
+                               'name'  => lang('building part')
+                       );
+                       array_unshift($values,$default_value);
+                       return $values;
+               }
+               public function get_branch($selected)
+               {
+                       $values = $this->so->get_branch();
+                       foreach ($values as &$value)
+                       {
+                               if($value['id'] == $selected)
+                               {
+                                       $value['selected'] = 1;
+                                       break;
+                               }
+                       }
+
+                       $default_value = array
+                       (
+                               'id'    => '',
+                               'name'  => lang('branch')
+                       );
+                       array_unshift($values,$default_value);
+                       return $values;
+               }
+               public function get_order_dim1($selected)
+               {
+                       $values = $this->so->get_order_dim1();
+                       foreach ($values as &$value)
+                       {
+                               if($value['id'] == $selected)
+                               {
+                                       $value['selected'] = 1;
+                                       break;
+                               }
+                       }
+
+                       $default_value = array
+                       (
+                               'id'    => '',
+                               'name'  => lang('order_dim1')
+                       );
+                       array_unshift($values,$default_value);
+                       return $values;
+               }
        }

Modified: trunk/property/inc/class.sotts.inc.php
===================================================================
--- trunk/property/inc/class.sotts.inc.php      2011-01-31 15:05:03 UTC (rev 
6885)
+++ trunk/property/inc/class.sotts.inc.php      2011-01-31 19:01:31 UTC (rev 
6886)
@@ -134,6 +134,11 @@
                        $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;
+                       $ecodimb                = isset($data['ecodimb']) && 
$data['ecodimb'] ? (int)$data['ecodimb']:0;
+                       $b_account              = isset($data['b_account']) && 
$data['b_account'] ? $data['b_account']:'';
+                       $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;
 
                        $this->grants   = 
$GLOBALS['phpgw']->session->appsession('grants_ticket','property');
 
@@ -313,6 +318,31 @@
                                $filtermethod .= " $where vendor_id=" . 
(int)$vendor_id;
                                $where = 'AND';
                        }
+                       if ($ecodimb > 0)
+                       {
+                               $filtermethod .= " $where ecodimb=" . 
(int)$ecodimb;
+                               $where = 'AND';
+                       }
+                       if ($b_account > 0)
+                       {
+                               $filtermethod .= " $where 
b_account_id='{$b_account}'";
+                               $where = 'AND';
+                       }
+                       if ($building_part)
+                       {
+                               $filtermethod .= " $where 
building_part='{$building_part}'";
+                               $where = 'AND';
+                       }
+                       if ($branch_id > 0)
+                       {
+                               $filtermethod .= " $where branch_id=" . 
(int)$branch_id;
+                               $where = 'AND';
+                       }
+                       if ($order_dim1 > 0)
+                       {
+                               $filtermethod .= " $where order_dim1=" . 
(int)$order_dim1;
+                               $where = 'AND';
+                       }
 
                        if ($user_id > 0)
                        {
@@ -1257,20 +1287,111 @@
 
                public function get_vendors()
                {
-                       $vendors = array();
+                       $values = 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
+                               $values[] = array
                                (
                                        'id'    => $this->db->f('id'),
                                        'name'  => $this->db->f('org_name', 
true)
                                );
                        }
        
-                       return $vendors;
+                       return $values;
                }
+               public function get_ecodimb()
+               {
+                       $values = array();
+                       $sql = "SELECT DISTINCT fm_ecodimb.id, fm_ecodimb.descr 
as name FROM fm_tts_tickets {$this->join} fm_ecodimb ON fm_tts_tickets.ecodimb 
= fm_ecodimb.id ORDER BY name ASC";
+                       
+                       $this->db->query($sql, __LINE__,__FILE__);
+
+                       while ($this->db->next_record())
+                       {
+                               $values[] = array
+                               (
+                                       'id'    => $this->db->f('id'),
+                                       'name'  => $this->db->f('name', true)
+                               );
+                       }
+       
+                       return $values;
+               }
+               public function get_b_account()
+               {
+                       $values = array();
+                       $sql = "SELECT DISTINCT fm_b_account.id, 
fm_b_account.descr as name FROM fm_tts_tickets {$this->join} fm_b_account ON 
fm_tts_tickets.b_account_id = fm_b_account.id ORDER BY id ASC";
+                       
+                       $this->db->query($sql, __LINE__,__FILE__);
+
+                       while ($this->db->next_record())
+                       {
+                               $values[] = array
+                               (
+                                       'id'    => $this->db->f('id'),
+                                       'name'  => $this->db->f('name', true)
+                               );
+                       }
+       
+                       return $values;
+               }
+               public function get_building_part()
+               {
+                       $values = array();
+                       $sql = "SELECT DISTINCT fm_building_part.id, 
fm_building_part.descr as name FROM fm_tts_tickets {$this->join} 
fm_building_part ON fm_tts_tickets.building_part = fm_building_part.id ORDER BY 
id ASC";
+                       
+                       $this->db->query($sql, __LINE__,__FILE__);
+
+                       while ($this->db->next_record())
+                       {
+                               $id     = $this->db->f('id');
+                               $values[] = array
+                               (
+                                       'id'    => $id,
+                                       'name'  => $id . ' ' . 
$this->db->f('name', true)
+                               );
+                       }
+       
+                       return $values;
+               }
+               public function get_branch()
+               {
+                       $values = array();
+                       $sql = "SELECT DISTINCT fm_branch.id, fm_branch.descr 
as name FROM fm_tts_tickets {$this->join} fm_branch ON fm_tts_tickets.branch_id 
= fm_branch.id ORDER BY name ASC";
+                       
+                       $this->db->query($sql, __LINE__,__FILE__);
+
+                       while ($this->db->next_record())
+                       {
+                               $values[] = array
+                               (
+                                       'id'    => $this->db->f('id'),
+                                       'name'  => $this->db->f('name', true)
+                               );
+                       }
+       
+                       return $values;
+               }
+               public function get_order_dim1()
+               {
+                       $values = array();
+                       $sql = "SELECT DISTINCT fm_order_dim1.id, 
fm_order_dim1.descr as name FROM fm_tts_tickets {$this->join} fm_order_dim1 ON 
fm_tts_tickets.order_dim1 = fm_order_dim1.id ORDER BY name ASC";
+                       
+                       $this->db->query($sql, __LINE__,__FILE__);
+
+                       while ($this->db->next_record())
+                       {
+                               $values[] = array
+                               (
+                                       'id'    => $this->db->f('id'),
+                                       'name'  => $this->db->f('name', true)
+                               );
+                       }
+       
+                       return $values;
+               }
        }

Modified: trunk/property/inc/class.uitts.inc.php
===================================================================
--- trunk/property/inc/class.uitts.inc.php      2011-01-31 15:05:03 UTC (rev 
6885)
+++ trunk/property/inc/class.uitts.inc.php      2011-01-31 19:01:31 UTC (rev 
6886)
@@ -717,7 +717,7 @@
                                        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'),
@@ -726,7 +726,62 @@
                                                                        
'values' => $this->bo->get_vendors($this->vendor_id),
                                                                        
'onchange'=> 'onChangeSelect("vendor_id");',
                                                                        
'tab_index' => 12
-                                                       );
+                                               );
+                                               
$datatable['actions']['form'][0]['fields']['field'][] = array
+                                               (
+                                                                       'id' => 
'sel_ecodimb', // testing traditional listbox for long list
+                                                                       'name' 
=> 'ecodimb',
+                                                                       'value' 
=> lang('dimb'),
+                                                                       'type' 
=> 'select',
+                                                                       'style' 
=> 'filter',
+                                                                       
'values' => $this->bo->get_ecodimb($this->ecodimb),
+                                                                       
'onchange'=> 'onChangeSelect("ecodimb");',
+                                                                       
'tab_index' => 13
+                                               );
+                                               
$datatable['actions']['form'][0]['fields']['field'][] = array
+                                               (
+                                                                       'id' => 
'sel_b_account', // testing traditional listbox for long list
+                                                                       'name' 
=> 'b_account',
+                                                                       'value' 
=> lang('budget account'),
+                                                                       'type' 
=> 'select',
+                                                                       'style' 
=> 'filter',
+                                                                       
'values' => $this->bo->get_b_account($this->b_account),
+                                                                       
'onchange'=> 'onChangeSelect("b_account");',
+                                                                       
'tab_index' => 14
+                                               );
+                                               
$datatable['actions']['form'][0]['fields']['field'][] = array
+                                               (
+                                                                       'id' => 
'sel_building_part', // testing traditional listbox for long list
+                                                                       'name' 
=> 'building_part',
+                                                                       'value' 
=> lang('building part'),
+                                                                       'type' 
=> 'select',
+                                                                       'style' 
=> 'filter',
+                                                                       
'values' => $this->bo->get_building_part($this->building_part),
+                                                                       
'onchange'=> 'onChangeSelect("building_part");',
+                                                                       
'tab_index' => 15
+                                               );
+                                               
$datatable['actions']['form'][0]['fields']['field'][] = array
+                                               (
+                                                                       'id' => 
'sel_branch_id', // testing traditional listbox for long list
+                                                                       'name' 
=> 'branch_id',
+                                                                       'value' 
=> lang('branch'),
+                                                                       'type' 
=> 'select',
+                                                                       'style' 
=> 'filter',
+                                                                       
'values' => $this->bo->get_branch($this->branch_id),
+                                                                       
'onchange'=> 'onChangeSelect("branch_id");',
+                                                                       
'tab_index' => 16
+                                               );
+                                               
$datatable['actions']['form'][0]['fields']['field'][] = array
+                                               (
+                                                                       'id' => 
'sel_order_dim1', // testing traditional listbox for long list
+                                                                       'name' 
=> 'order_dim1',
+                                                                       'value' 
=> lang('order_dim1'),
+                                                                       'type' 
=> 'select',
+                                                                       'style' 
=> 'filter',
+                                                                       
'values' => $this->bo->get_order_dim1($this->order_dim1),
+                                                                       
'onchange'=> 'onChangeSelect("order_dim1");',
+                                                                       
'tab_index' => 17
+                                               );
                                        }
                                }
                                else




reply via email to

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