fmsystem-commits
[Top][All Lists]
Advanced

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

[Fmsystem-commits] [8595] property: custom filter at request


From: Sigurd Nes
Subject: [Fmsystem-commits] [8595] property: custom filter at request
Date: Tue, 17 Jan 2012 13:00:47 +0000

Revision: 8595
          http://svn.sv.gnu.org/viewvc/?view=rev&root=fmsystem&revision=8595
Author:   sigurdne
Date:     2012-01-17 13:00:45 +0000 (Tue, 17 Jan 2012)
Log Message:
-----------
property: custom filter at request

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  2012-01-17 09:15:43 UTC (rev 
8594)
+++ trunk/property/inc/class.borequest.inc.php  2012-01-17 13:00:45 UTC (rev 
8595)
@@ -43,6 +43,7 @@
                var $cat_id;
                public $sum_budget = 0;
                public $sum_consume = 0;
+               public $acl_location = '.project.request';
 
                var $public_functions = array
                        (
@@ -62,7 +63,7 @@
                        $this->cats                                     = 
CreateObject('phpgwapi.categories', -1,  'property', '.project');
                        $this->cats->supress_info       = true;
                        $this->custom                           = & 
$this->so->custom;
-
+//                     $this->acl_location                     = 
'.project.request';
                        if ($session)
                        {
                                $this->read_sessiondata();
@@ -412,12 +413,37 @@
 
                function read($data)
                {
+                       $custom = createObject('phpgwapi.custom_fields');
+                       $attrib_data = $custom->find('property', 
$this->acl_location, 0, '','','',true, true);
+
+                       $attrib_filter = array();
+                       if($attrib_data)
+                       {
+                               foreach ( $attrib_data as $attrib )
+                               {
+                                       if($attrib['datatype'] == 'LB' || 
$attrib['datatype'] == 'R')
+                                       {
+                                               if($_attrib_filter_value = 
phpgw::get_var($attrib['column_name'], 'int'))
+                                               {
+                                                       $attrib_filter[] = 
"fm_request.{$attrib['column_name']} = '{$_attrib_filter_value}'";
+                                               }
+                                       }
+                                       else if($attrib['datatype'] == 'CH')
+                                       {
+                                               if($_attrib_filter_value = 
phpgw::get_var($attrib['column_name'], 'int'))
+                                               {
+                                                       $attrib_filter[] = 
"fm_request.{$attrib['column_name']} {$GLOBALS['phpgw']->db->like} 
'%,{$_attrib_filter_value},%'";
+                                               }
+                                       }
+                               }
+                       }
+
                        $request = $this->so->read(array('start' => 
$this->start,'query' => $this->query,'sort' => $this->sort,'order' => 
$this->order,
                                'filter' => $this->filter,'district_id' => 
$this->district_id,'cat_id' => $this->cat_id,'status_id' => $this->status_id,
                                'project_id' => 
$data['project_id'],'allrows'=>$data['allrows'],'list_descr' => 
$data['list_descr'],
                                '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));
+                               'degree_id' => $this->degree_id, 
'attrib_filter' => $attrib_filter));
 
                        $this->total_records    = $this->so->total_records;
                        $this->sum_budget               = $this->so->sum_budget;

Modified: trunk/property/inc/class.sorequest.inc.php
===================================================================
--- trunk/property/inc/class.sorequest.inc.php  2012-01-17 09:15:43 UTC (rev 
8594)
+++ trunk/property/inc/class.sorequest.inc.php  2012-01-17 13:00:45 UTC (rev 
8595)
@@ -213,6 +213,7 @@
                        $end_date               = isset($data['end_date']) && 
$data['end_date'] ? phpgwapi_datetime::date_to_timestamp($data['end_date']) : 0;
                        $building_part  = isset($data['building_part']) && 
$data['building_part'] ? (int)$data['building_part'] : 0;
                        $degree_id              = $data['degree_id'];
+                       $attrib_filter  = $data['attrib_filter'] ? 
$data['attrib_filter'] : array();
 
                        $location_id = 
$GLOBALS['phpgw']->locations->get_id('property', '.project.request');
                        $attribute_table = 'phpgw_cust_attribute';
@@ -508,6 +509,12 @@
                                $where = 'AND';
                        }
 
+                       if ($attrib_filter)
+                       {
+                               $filtermethod .= " $where " . implode(' AND ', 
$attrib_filter);
+                               $where= 'AND';                  
+                       }
+
                        if ($project_id && !$status_id)// lookup requests not 
already allocated to projects
                        {
 //                             $filtermethod .= " $where project_id is NULL ";

Modified: trunk/property/inc/class.uirequest.inc.php
===================================================================
--- trunk/property/inc/class.uirequest.inc.php  2012-01-17 09:15:43 UTC (rev 
8594)
+++ trunk/property/inc/class.uirequest.inc.php  2012-01-17 13:00:45 UTC (rev 
8595)
@@ -72,7 +72,7 @@
                        $this->config                           = 
CreateObject('phpgwapi.config','property');
                        $this->config->read();
                        $this->acl                                      = & 
$GLOBALS['phpgw']->acl;
-                       $this->acl_location                     = 
'.project.request';
+                       $this->acl_location                     = 
$this->bo->acl_location;
                        $this->acl_read                         = 
$this->acl->check($this->acl_location, PHPGW_ACL_READ, 'property');
                        $this->acl_add                          = 
$this->acl->check($this->acl_location, PHPGW_ACL_ADD, 'property');
                        $this->acl_edit                         = 
$this->acl->check($this->acl_location, PHPGW_ACL_EDIT, 'property');




reply via email to

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