fmsystem-commits
[Top][All Lists]
Advanced

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

[Fmsystem-commits] [11297] property: Request : add filter on recommended


From: Sigurd Nes
Subject: [Fmsystem-commits] [11297] property: Request : add filter on recommended_year
Date: Tue, 17 Sep 2013 11:48:03 +0000

Revision: 11297
          http://svn.sv.gnu.org/viewvc/?view=rev&root=fmsystem&revision=11297
Author:   sigurdne
Date:     2013-09-17 11:48:02 +0000 (Tue, 17 Sep 2013)
Log Message:
-----------
property: Request : add filter on recommended_year

Modified Paths:
--------------
    trunk/property/inc/class.borequest.inc.php
    trunk/property/inc/class.sorequest.inc.php
    trunk/property/inc/class.uirequest.inc.php

Modified: trunk/property/inc/class.borequest.inc.php
===================================================================
--- trunk/property/inc/class.borequest.inc.php  2013-09-17 06:31:57 UTC (rev 
11296)
+++ trunk/property/inc/class.borequest.inc.php  2013-09-17 11:48:02 UTC (rev 
11297)
@@ -90,6 +90,7 @@
                        $end_date                       = 
phpgw::get_var('end_date');
                        $building_part          = 
phpgw::get_var('building_part');
                        $responsible_unit       = 
phpgw::get_var('responsible_unit', 'int');
+                       $recommended_year       = 
phpgw::get_var('recommended_year', 'int');
 
                        $this->condition_survey_id = 
phpgw::get_var('condition_survey_id', 'int', 'REQUEST', 0);
 
@@ -148,6 +149,12 @@
                                $this->responsible_unit = $responsible_unit;
                        }
 
+                       if(isset($_POST['recommended_year']) || 
isset($_GET['recommended_year']))
+                       {
+                               $this->recommended_year = $recommended_year;
+                       }
+
+
                        if($allrows)
                        {
                                $this->allrows = $allrows;
@@ -188,6 +195,7 @@
                        $this->degree_id                = $data['degree_id'];
                        $this->building_part    = $data['building_part'];
                        $this->responsible_unit = $data['responsible_unit'];
+                       $this->recommended_year = $data['recommended_year'];
                        $this->start_date               = 
isset($data['start_date']) ? $data['start_date']: '';
                        $this->end_date                 = 
isset($data['end_date']) ? $data['end_date']: '';
                }
@@ -489,7 +497,7 @@
                                'dry_run'=>$data['dry_run'], 'p_num' => 
$this->p_num,'start_date'=>$this->start_date,'end_date'=>$this->end_date,
                                'property_cat_id' => $this->property_cat_id, 
'building_part' => $this->building_part,
                                'degree_id' => $this->degree_id, 
'attrib_filter' => $attrib_filter, 'condition_survey_id' => 
$this->condition_survey_id,
-                               'responsible_unit' => $this->responsible_unit));
+                               'responsible_unit' => $this->responsible_unit, 
'recommended_year' => $this->recommended_year));
 
                        $this->total_records                    = 
$this->so->total_records;
                        $this->sum_investment                   = 
$this->so->sum_investment;
@@ -767,4 +775,9 @@
                {
                        return $this->so->get_user_list();
                }
+               public function get_recommended_year_list($selected = 0)
+               {
+                       $recommended_year_list = 
$this->so->get_recommended_year_list();
+                       return 
$this->bocommon->select_list($selected,$recommended_year_list);
+               }
        }

Modified: trunk/property/inc/class.sorequest.inc.php
===================================================================
--- trunk/property/inc/class.sorequest.inc.php  2013-09-17 06:31:57 UTC (rev 
11296)
+++ trunk/property/inc/class.sorequest.inc.php  2013-09-17 11:48:02 UTC (rev 
11297)
@@ -323,6 +323,7 @@
                        $attrib_filter                  = 
$data['attrib_filter'] ? $data['attrib_filter'] : array();
                        $condition_survey_id    = $data['condition_survey_id'] 
? (int) $data['condition_survey_id'] : 0;
                        $responsible_unit               = 
(int)$data['responsible_unit'];
+                       $recommended_year               = 
(int)$data['recommended_year'];
 
                        $location_id = 
$GLOBALS['phpgw']->locations->get_id('property', '.project.request');
                        $attribute_table = 'phpgw_cust_attribute';
@@ -645,6 +646,12 @@
                                $where = 'AND';
                        }
 
+                       if ($recommended_year > 0)
+                       {
+                               $filtermethod .= " $where 
fm_request.recommended_year = {$recommended_year}";
+                               $where = 'AND';
+                       }
+
                        if ($condition_survey_id > 0)
                        {
                                $filtermethod .= " $where 
fm_request.condition_survey_id = '{$condition_survey_id}'";
@@ -1392,4 +1399,24 @@
 
                }
 
+               public function get_recommended_year_list()
+               {
+                       $sql = "SELECT DISTINCT recommended_year FROM 
fm_request"
+                       . " WHERE recommended_year IS NOT NULL AND 
recommended_year > 0"
+                       . " ORDER BY recommended_year ASC";
+                       $this->_db->query($sql,__LINE__,__FILE__);
+
+                       $values = array();
+                       while($this->_db->next_record())
+                       {
+                               $year   = $this->_db->f('recommended_year');
+                               $values[] = array
+                               (
+                                       'id'    => $year,
+                                       'name'  => $year
+                               );
+                       }
+                       return $values;
+               }
+
        }

Modified: trunk/property/inc/class.uirequest.inc.php
===================================================================
--- trunk/property/inc/class.uirequest.inc.php  2013-09-17 06:31:57 UTC (rev 
11296)
+++ trunk/property/inc/class.uirequest.inc.php  2013-09-17 11:48:02 UTC (rev 
11297)
@@ -99,7 +99,9 @@
                        $this->condition_survey_id      = 
$this->bo->condition_survey_id;
                        $this->nonavbar                         = 
phpgw::get_var('nonavbar', 'bool');
                        $this->responsible_unit         = 
$this->bo->responsible_unit;
+                       $this->recommended_year         = 
$this->bo->recommended_year;
 
+
                        if( $this->nonavbar )
                        {
                                $GLOBALS['phpgw_info']['flags']['nonavbar']     
        = true;
@@ -127,7 +129,8 @@
                                'end_date'                      => 
$this->end_date,
                                'property_cat_id'       => 
$this->property_cat_id,
                                'building_part'         => $this->building_part,
-                               'responsible_unit'      => 
$this->responsible_unit
+                               'responsible_unit'      => 
$this->responsible_unit,
+                               'recommended_year'      => 
$this->recommended_year
                        );
                        $this->bo->save_sessiondata($data);
                }
@@ -307,6 +310,9 @@
                                $responsible_unit_list  = 
$this->bocommon->select_category_list(array('type'=> 
'request_responsible_unit','selected' =>$this->responsible_unit, 'order' => 
'id', 'fields' => array('descr')));
                                array_unshift ($responsible_unit_list,array 
('id'=>'0','name'=> lang('responsible unit')));
 
+                               $recommended_year_list  = 
$this->bo->get_recommended_year_list($this->recommended_year);
+                               array_unshift ($recommended_year_list,array 
('id'=>'0','name'=> lang('recommended year')));
+
                                $_filter_buildingpart = array();
                                $filter_buildingpart = 
isset($this->bo->config->config_data['filter_buildingpart']) ? 
$this->bo->config->config_data['filter_buildingpart'] : array();
 
@@ -341,6 +347,7 @@
                                                                'end_date'      
                => $this->end_date,
                                                                'building_part' 
        => $this->building_part,
                                                                
'responsible_unit'      => $this->responsible_unit,
+                                                               
'recommended_year'      => $this->recommended_year,
                                                        )
                                                ),
                                                'fields'        => array
@@ -368,7 +375,6 @@
                                                                array
                                                                ( //boton       
CATEGORY
                                                                        'id' => 
'btn_cat_id',
-
                                                                        'name' 
=> 'cat_id',
                                                                        'value' 
=> lang('Category'),
                                                                        'type' 
=> 'button',
@@ -416,27 +422,38 @@
                                                                        
'tab_index' => 7
                                                                ),
                                                                array
+                                                               (
+                                                                       'id' => 
'sel_recommended_year',
+                                                                       'name' 
=> 'recommended_year',
+                                                                       'value' 
=> lang('responsible unit'),
+                                                                       'type' 
=> 'select',
+                                                                       'style' 
=> 'filter',
+                                                                       
'values'        => $recommended_year_list,
+                                                                       
'onchange'=> 'onChangeSelect("recommended_year");',
+                                                                       
'tab_index' => 8
+                                                               ),
+                                                               array
                                                                ( //boton       
FILTER
                                                                        'id' => 
'btn_user_id',
                                                                        'name' 
=> 'filter',
                                                                        'value' 
=> lang('User'),
                                                                        'type' 
=> 'button',
                                                                        'style' 
=> 'filter',
-                                                                       
'tab_index' => 8
+                                                                       
'tab_index' => 9
                                                                ),
                                                                array
                                                                (
                                                                        'type'  
=> 'button',
                                                                        'id'    
=> 'btn_update',
                                                                        'value' 
=> lang('Update project'),
-                                                                       
'tab_index' => 16
+                                                                       
'tab_index' => 17
                                                                ),
                                                                array
                                                                (
                                                                        'type'  
=> 'button',
                                                                        'id'    
=> 'btn_export',
                                                                        'value' 
=> lang('download'),
-                                                                       
'tab_index' => 15
+                                                                       
'tab_index' => 16
                                                                ),
 
                                                                array
@@ -444,7 +461,7 @@
                                                                        'type'  
=> 'button',
                                                                        'id'    
=> 'btn_new',
                                                                        'value' 
=> lang('add'),
-                                                                       
'tab_index' => 14
+                                                                       
'tab_index' => 15
                                                                ),
                                                                array
                                                                (
@@ -472,7 +489,7 @@
                                                                                
'menuaction' => 'property.uiproject.date_search')
                                                                        
)."','','width=350,height=250')",
                                                                        'value' 
=> lang('Date search'),
-                                                                       
'tab_index' => 13
+                                                                       
'tab_index' => 14
                                                                ),
 
                                                                array
@@ -482,7 +499,7 @@
                                                                        'value' 
   => lang('search'),
                                                                        
'onkeypress' => 'return pulsar(event)',
                                                                        'type' 
=> 'button',
-                                                                       
'tab_index' => 12
+                                                                       
'tab_index' => 13
                                                                ),
                                                                array
                                                                ( //hidden 
request
@@ -499,7 +516,7 @@
                                                                        'type' 
=> 'text',
                                                                        'size'  
  => 28,
                                                                        
'onkeypress' => 'return pulsar(event)',
-                                                                       
'tab_index' => 11
+                                                                       
'tab_index' => 12
                                                                ),
                                                                array
                                                                (
@@ -563,17 +580,17 @@
 
                                if(!$this->acl_manage)//priority_key
                                {
-                                       
unset($datatable['actions']['form'][0]['fields']['field'][18]);
+                                       
unset($datatable['actions']['form'][0]['fields']['field'][19]);
                                }
 
                                if(!$this->acl_add) //add
                                {
-                                       
unset($datatable['actions']['form'][0]['fields']['field'][10]);
+                                       
unset($datatable['actions']['form'][0]['fields']['field'][11]);
                                }
 
                                if(!$project_id) // update project
                                {
-                                       
unset($datatable['actions']['form'][0]['fields']['field'][8]);
+                                       
unset($datatable['actions']['form'][0]['fields']['field'][9]);
                                }
 
 




reply via email to

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