fmsystem-commits
[Top][All Lists]
Advanced

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

[Fmsystem-commits] [8501] property: list custom values


From: Sigurd Nes
Subject: [Fmsystem-commits] [8501] property: list custom values
Date: Thu, 05 Jan 2012 18:16:14 +0000

Revision: 8501
          http://svn.sv.gnu.org/viewvc/?view=rev&root=fmsystem&revision=8501
Author:   sigurdne
Date:     2012-01-05 18:16:12 +0000 (Thu, 05 Jan 2012)
Log Message:
-----------
property: list custom values

Modified Paths:
--------------
    trunk/property/inc/class.bocommon.inc.php
    trunk/property/inc/class.custom_fields.inc.php
    trunk/property/inc/class.sorequest.inc.php

Modified: trunk/property/inc/class.bocommon.inc.php
===================================================================
--- trunk/property/inc/class.bocommon.inc.php   2012-01-05 16:25:36 UTC (rev 
8500)
+++ trunk/property/inc/class.bocommon.inc.php   2012-01-05 18:16:12 UTC (rev 
8501)
@@ -1177,33 +1177,26 @@
                                $no_address     = true;
                        }
                        $this->type_id  = $type_id;
-
                        $_level = 1;
                        for ($i=0; $i<$type_id; $i++)
                        {
                                if($_level > 1)
                                {
-                                       for ($j = 2; $j < ($_level +1); $j++)
+                                       $joinmethod .= " {$this->join} 
fm_location{$_level}";
+                                       $paranthesis .='(';
+                                       $on = 'ON';
+                                       for ($k=($_level-1); $k>0; $k--)
                                        {
-                                               $joinmethod .= " {$this->join} 
fm_location{$j}";
-
-                                               $paranthesis .='(';
-
-                                               $on = 'ON';
-                                               for ($k=($j-1); $k>0; $k--)
+                                               $joinmethod .= " $on 
(fm_location{$_level}.loc{$k} = fm_location" . ($_level-1) . ".loc{$k})";
+                                               $on = 'AND';
+                                               if($k==1)
                                                {
-                                                       $joinmethod .= " $on 
(fm_location{$j}.loc{$k} = fm_location" . ($j-1) . ".loc{$k})";
-                                                       $on = 'AND';
-                                                       if($k==1)
-                                                       {
-                                                               $joinmethod .= 
")";
-                                                       }
+                                                       $joinmethod .= ")";
                                                }
                                        }
                                }
                                $_level ++;
 
-
                                $uicols['input_type'][]         = 'text';
                                $uicols['name'][]                       = 'loc' 
. $location_types[$i]['id'];
                                $uicols['descr'][]                      = 
$location_types[$i]['name'];

Modified: trunk/property/inc/class.custom_fields.inc.php
===================================================================
--- trunk/property/inc/class.custom_fields.inc.php      2012-01-05 16:25:36 UTC 
(rev 8500)
+++ trunk/property/inc/class.custom_fields.inc.php      2012-01-05 18:16:12 UTC 
(rev 8501)
@@ -434,7 +434,7 @@
                        $attribute_table = 'phpgw_cust_attribute';
                        $attribute_filter = " location_id = {$location_id}";
                        $contacts = CreateObject('phpgwapi.contacts');
-                       //_debug_array($values);
+//                     _debug_array($values);die();
                        $location = array();
                        $ret = array();
                        $j=0;
@@ -447,7 +447,7 @@
                                                $location = 
explode('-',$data['value']);
                                        }
 
-                                       if(($data['datatype']=='R' || 
$data['datatype']=='LB') && $data['value'])
+                                       if(($data['datatype']=='R' || 
$data['datatype']=='LB') && $data['value'] && $data['attrib_id'])
                                        {
                                                $sql="SELECT value FROM 
$choice_table WHERE $attribute_filter AND attrib_id=" .$data['attrib_id']. "  
AND id=" . $data['value'];
                                                $this->_db->query($sql);

Modified: trunk/property/inc/class.sorequest.inc.php
===================================================================
--- trunk/property/inc/class.sorequest.inc.php  2012-01-05 16:25:36 UTC (rev 
8500)
+++ trunk/property/inc/class.sorequest.inc.php  2012-01-05 18:16:12 UTC (rev 
8501)
@@ -372,16 +372,17 @@
                        $uicols['classname'][]          = '';
                        $uicols['sortable'][]           = true;
 
-
                        $this->db->query("SELECT * FROM $attribute_table WHERE 
list=1 AND $attribute_filter");
+                       $_attrib = array();
                        while ($this->db->next_record())
                        {
-                               $cols .= ",{$entity_table}." . 
$this->db->f('column_name');
+                               $_column_name = $this->db->f('column_name');
+                               $cols .= ",{$entity_table}.{$_column_name}";
 
-                               $cols_return[]                          = 
$this->db->f('column_name');
-                               $cols_group[]                           = 
$this->db->f('column_name');
+                               $cols_return[]                          = 
$_column_name;
+                               $cols_group[]                           = 
$_column_name;
                                $uicols['input_type'][]         = 'text';
-                               $uicols['name'][]                       = 
$this->db->f('column_name');
+                               $uicols['name'][]                       = 
$_column_name;
                                $uicols['descr'][]                      = 
$this->db->f('input_text',true);
                                $uicols['statustext'][]         = 
$this->db->f('statustext',true);
                                $uicols['exchange'][]           = '';
@@ -390,6 +391,8 @@
                                $uicols['formatter'][]          = '';
                                $uicols['classname'][]          = '';
                                $uicols['sortable'][]           = false;
+
+                               $_attrib[$_column_name] = $this->db->f('id');
                        }
 
                        $cols.= ",$entity_table.coordinator";
@@ -593,28 +596,30 @@
                                        $this->db->query($sql . 
$ordermethod,__LINE__,__FILE__);
                                }
                        }
-
+                       $_datatype = array();
+                       foreach($this->uicols['name'] as $key => $_name)
+                       {
+                               $_datatype[$_name] =  
$this->uicols['datatype'][$key];
+                       }
+                       $dataset = array();
                        $j=0;
-                       $request_list = array();
                        while ($this->db->next_record())
                        {
-                               for ($i=0;$i<count($cols_return);$i++)
+                               foreach($cols_return as $key => $field)
                                {
-                                       $request_list[$j][$cols_return[$i]] = 
$this->db->f($cols_return[$i], true);
+                                       $dataset[$j][$field] = array
+                                               (
+                                                       'value'         => 
$this->db->f($field),
+                                                       'datatype'      => 
$_datatype[$field],
+                                                       'attrib_id'     => 
$_attrib[$field]
+                                               );
                                }
+                               $j++;                           
+                       }
 
-                               $location_code= $this->db->f('location_code');
-                               $location = explode('-',$location_code);
-                               for ($m=0;$m<count($location);$m++)
-                               {
-                                       $request_list[$j]['loc' . ($m+1)] = 
$location[$m];
-                                       
$request_list[$j]['query_location']['loc' . ($m+1)]=implode("-", 
array_slice($location, 0, ($m+1)));
-                               }
+                       $values = $this->custom->translate_value($dataset, 
$location_id);
 
-                               $j++;
-                       }
-                       //_debug_array($request_list);
-                       return $request_list;
+                       return $values;
                }
 
                function read_single($request_id, $values = array())




reply via email to

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