fmsystem-commits
[Top][All Lists]
Advanced

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

[Fmsystem-commits] [13093] update to entity


From: Sigurd Nes
Subject: [Fmsystem-commits] [13093] update to entity
Date: Mon, 27 Apr 2015 11:44:01 +0000

Revision: 13093
          http://svn.sv.gnu.org/viewvc/?view=rev&root=fmsystem&revision=13093
Author:   sigurdne
Date:     2015-04-27 11:44:00 +0000 (Mon, 27 Apr 2015)
Log Message:
-----------
update to entity

Modified Paths:
--------------
    branches/dev-syncromind/property/inc/class.bocommon.inc.php
    branches/dev-syncromind/property/inc/class.boentity.inc.php
    branches/dev-syncromind/property/inc/class.soentity.inc.php
    branches/dev-syncromind/property/inc/class.uientity.inc.php

Modified: branches/dev-syncromind/property/inc/class.bocommon.inc.php
===================================================================
--- branches/dev-syncromind/property/inc/class.bocommon.inc.php 2015-04-24 
23:24:42 UTC (rev 13092)
+++ branches/dev-syncromind/property/inc/class.bocommon.inc.php 2015-04-27 
11:44:00 UTC (rev 13093)
@@ -1163,7 +1163,7 @@
                        $joinmethod             = 
isset($data['joinmethod'])?$data['joinmethod']:'';
                        $paranthesis            = 
isset($data['paranthesis'])?$data['paranthesis']:'';
                        $lookup                         = 
isset($data['lookup'])?$data['lookup']:'';
-                       $location_level         = 
isset($data['location_level']) && $data['location_level'] ? 
(int)$data['location_level'] : 0;
+                       $location_level         = 
isset($data['location_level']) && $data['location_level'] > 0 ? 
(int)$data['location_level'] : 0;
                        $no_address             = 
isset($data['no_address'])?$data['no_address']:'';
                        $uicol_address          = 
isset($data['uicol_address'])?$data['uicol_address']:'';
                        $force_location         = 
isset($data['force_location'])?$data['force_location']:'';
@@ -1171,8 +1171,16 @@
                        $cols_return_lookup     = array();
 
                        $GLOBALS['phpgw']->config->read();
-                       $list_location_level = 
isset($GLOBALS['phpgw']->config->config_data['list_location_level']) && 
$GLOBALS['phpgw']->config->config_data['list_location_level'] ? 
$GLOBALS['phpgw']->config->config_data['list_location_level'] : array();
 
+                       if($location_level)
+                       {
+                               $list_location_level = 
isset($GLOBALS['phpgw']->config->config_data['list_location_level']) && 
$GLOBALS['phpgw']->config->config_data['list_location_level'] ? 
$GLOBALS['phpgw']->config->config_data['list_location_level'] : array();
+                       }
+                       else
+                       {
+                               $list_location_level = array();
+                       }
+
                        if(!$list_location_level)
                        {
                                for ($i=0; $i<$location_level; $i++)

Modified: branches/dev-syncromind/property/inc/class.boentity.inc.php
===================================================================
--- branches/dev-syncromind/property/inc/class.boentity.inc.php 2015-04-24 
23:24:42 UTC (rev 13092)
+++ branches/dev-syncromind/property/inc/class.boentity.inc.php 2015-04-27 
11:44:00 UTC (rev 13093)
@@ -582,6 +582,12 @@
                                        }
                                        $entry['org_unit'] = 
$org_units_data[$entry['org_unit_id']]['name'];
                                }
+
+                               if(isset($entry['p_location_id']) && 
isset($entry['p_id']) && $entry['p_id'])
+                               {
+                                       //static cached within so-class
+                                       $entry['p_location'] = 
$this->so->get_short_description(array('location_id' => 
$entry['p_location_id'], 'id' => $entry['p_id']));
+                               }
                                
                                foreach($javascript_action as $_name => 
$_action)
                                {
@@ -654,6 +660,10 @@
                                
$values['p'][$p__location[2]]['p_entity_id']=$p__location[2];
                                
$values['p'][$p__location[2]]['p_cat_id']=$p__location[3];
                                $values['p'][$p__location[2]]['p_cat_name'] = 
$p_location['descr'];
+                               if($short_description = 
$this->so->get_short_description(array('location_id' => 
$values['p_location_id'], 'id' => $values['p_id'])))
+                               {
+                                       
$values['p'][$p__location[2]]['p_cat_name'] .= "::$short_description";
+                               }
                        }
 
                        $vfs = CreateObject('phpgwapi.vfs');

Modified: branches/dev-syncromind/property/inc/class.soentity.inc.php
===================================================================
--- branches/dev-syncromind/property/inc/class.soentity.inc.php 2015-04-24 
23:24:42 UTC (rev 13092)
+++ branches/dev-syncromind/property/inc/class.soentity.inc.php 2015-04-27 
11:44:00 UTC (rev 13093)
@@ -747,7 +747,7 @@
                                $sql_cnt_control_fields = '';
                        }
 
-                       if(isset($category['location_level']) && 
$category['location_level'])
+                       if(isset($category['location_level']) && 
$category['location_level'] > 0)
                        {
                                $sql .= "{$this->join} fm_location1 ON 
(fm_bim_item.loc1 = fm_location1.loc1)";
                                $sql .= "{$this->join} fm_part_of_town ON 
(fm_location1.part_of_town_id = fm_part_of_town.part_of_town_id)";
@@ -854,7 +854,7 @@
                        $cols_return = $uicols['name'];
 //                     $cols_return = $this->cols_return;
                        $dataset = array();
-
+//_debug_array($uicols);
                        while ($this->db->next_record())
                        {
                                $xmldata = $this->db->f('xml_representation');
@@ -901,7 +901,20 @@
                                                'datatype'      => false,
                                                'attrib_id'     => false
                                        );
+                               $dataset[$j]['p_id'] = array
+                                       (
+                                               'value'         => 
$this->db->f('p_id'),
+                                               'datatype'      => false,
+                                               'attrib_id'     => false,
+                                       );
 
+                               $dataset[$j]['p_location_id'] = array
+                                       (
+                                               'value'         => 
$this->db->f('p_location_id'),
+                                               'datatype'      => false,
+                                               'attrib_id'     => false,
+                                       );
+
                                if($lookup)
                                {
                                        $dataset[$j]["entity_num_{$entity_id}"] 
= array
@@ -959,7 +972,12 @@
 
                        if(!$this->uicols)
                        {
+                               $admin_entity   = 
CreateObject('property.soadmin_entity');
+                               $admin_entity->type = $this->type;
 
+                               $entity = 
$admin_entity->read_single($entity_id);
+
+
                                $cols_return_extra      = array();
                                $cols_return            = array();
                                $uicols                         = array();
@@ -989,6 +1007,20 @@
                                $uicols['formatter'][]          = $lookup ? '' 
: 'linktToEntity';
                                $uicols['classname'][]          = '';
 
+                               if (isset($entity['lookup_entity']) && 
is_array($entity['lookup_entity']))
+                               {
+                                       $uicols['input_type'][]         = 
'text';
+                                       $uicols['name'][]                       
= 'p_location';
+                                       $uicols['descr'][]                      
= lang('location');
+                                       $uicols['statustext'][]         = 
lang('location');
+                                       $uicols['align'][]                      
= '';
+                                       $uicols['datatype'][]           = '';
+                                       $uicols['sortable'][]           = true;
+                                       $uicols['exchange'][]           = false;
+                                       $uicols['formatter'][]          = '';
+                                       $uicols['classname'][]          = '';
+                               }
+
                                $cols_return[]                          = 'id';
                                $uicols['input_type'][]         = 'hidden';
                                $uicols['name'][]                       = 'id';
@@ -1064,6 +1096,17 @@
                                        $uicols['exchange'][]           = false;
                                        $uicols['formatter'][]          = '';
                                        $uicols['classname'][]          = '';
+
+                                       $uicols['input_type'][]         = 
'hidden';
+                                       $uicols['name'][]                       
= 'org_unit_id';
+                                       $uicols['descr'][]                      
= 'dummy';
+                                       $uicols['statustext'][]         = 
'dummy';
+                                       $uicols['align'][]                      
= '';
+                                       $uicols['datatype'][]           = '';
+                                       $uicols['sortable'][]           = false;
+                                       $uicols['exchange'][]           = false;
+                                       $uicols['formatter'][]          = '';
+                                       $uicols['classname'][]          = '';
                                }
 
                //              $cols .= ", {$entity_table}.user_id";

Modified: branches/dev-syncromind/property/inc/class.uientity.inc.php
===================================================================
--- branches/dev-syncromind/property/inc/class.uientity.inc.php 2015-04-24 
23:24:42 UTC (rev 13092)
+++ branches/dev-syncromind/property/inc/class.uientity.inc.php 2015-04-27 
11:44:00 UTC (rev 13093)
@@ -137,7 +137,7 @@
                /*
                * Overrides with incoming data from POST
                */
-               private function _populate()
+               private function _populate($data = array())
                {
                        $values                         = 
phpgw::get_var('values');
                        $values_attribute       = 
phpgw::get_var('values_attribute');
@@ -195,13 +195,15 @@
                        if($category['org_unit'])
                        {
                                $values['extra']['org_unit_id'] = 
phpgw::get_var('org_unit_id', 'int');
+                               $values['org_unit_id']  = 
$values['extra']['org_unit_id'];
+                               $values['org_unit_name'] = 
phpgw::get_var('org_unit_name', 'string');
                        }
                        if($GLOBALS['phpgw']->session->is_repost())
                        {
                                
$this->receipt['error'][]=array('msg'=>lang('Hmm... looks like a repost!'));
                        }
 
-                       if(!$values['location'] && 
isset($category['location_level']) && $category['location_level'])
+                       if((!$values['location'] && !$values['p']) && 
isset($category['location_level']) && $category['location_level'])
                        {
                                
$this->receipt['error'][]=array('msg'=>lang('Please select a location !'));
                        }
@@ -221,8 +223,8 @@
                                        }
                                }
                        }
-                       
-                       if ($this->receipt['error']) 
+
+                       if ($this->receipt['error'])
                        {
                                if($values['location'])
                                {
@@ -242,10 +244,17 @@
                        
                        $values['attributes'] = $values_attribute;
 
+                       foreach($data as $key => $original_value)
+                       {
+                               if((!isset($values['attributes']) || 
!$values['attributes']) && $data[$key] )
+                               {
+                                       $values[$key] = $original_value;
+                               }
+                       }
                        return $values;
                }
+
                
-               
                private function _handle_files($values)
                {
                        $id = (int)$values['id'];
@@ -584,7 +593,12 @@
                        /*
                        * Overrides with incoming data from POST
                        */
-                       $data = $this->_populate();
+                       if ($id)
+                       {
+                               $data   = 
$this->bo->read_single(array('entity_id'=>$this->entity_id,'cat_id'=>$this->cat_id,'id'=>$id));
+                       }
+
+                       $data = $this->_populate($data);
                        $values = $data;
                        $attributes = $data['attributes'];
                        unset($values['attributes']);




reply via email to

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