fmsystem-commits
[Top][All Lists]
Advanced

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

[Fmsystem-commits] [15600]


From: nelson . guerra
Subject: [Fmsystem-commits] [15600]
Date: Wed, 7 Sep 2016 00:52:43 +0000 (UTC)

Revision: 15600
          http://svn.sv.gnu.org/viewvc/?view=rev&root=fmsystem&revision=15600
Author:   nelson224
Date:     2016-09-07 00:52:42 +0000 (Wed, 07 Sep 2016)
Log Message:
-----------


Modified Paths:
--------------
    
branches/dev-syncromind-2/property/inc/import/class.import_update_components.inc.php

Modified: 
branches/dev-syncromind-2/property/inc/import/class.import_update_components.inc.php
===================================================================
--- 
branches/dev-syncromind-2/property/inc/import/class.import_update_components.inc.php
        2016-09-07 00:52:29 UTC (rev 15599)
+++ 
branches/dev-syncromind-2/property/inc/import/class.import_update_components.inc.php
        2016-09-07 00:52:42 UTC (rev 15600)
@@ -181,8 +181,42 @@
                        return $receipt['id'];
                }
                
-               public function add_entity_categories ($buildingpart_out_table)
+               public function add_attributes_to_categories 
($buildingpart_in_table, $template_id)
                {
+                       $template = explode("_", $template_id);
+                       $entity_id = $template[0];
+                       $cat_id = $template[1];
+                       
+                       $attributes = 
$this->custom->find($this->type_app[$this->type], 
".{$this->type}.{$entity_id}.{$cat_id}", 0, '', 'ASC', 'attrib_sort', true, 
true);
+
+                       $receipt = array();
+                       
+                       foreach ($buildingpart_in_table as $template)
+                       {       
+                               $appname = $this->type_app[$this->type];
+                               $location = 
".{$this->type}.{$template['entity_id']}.{$template['cat_id']}";
+                               $attrib_table = 
$GLOBALS['phpgw']->locations->get_attrib_table($appname, $location);
+                       
+                               foreach($attributes as $attrib)
+                               {
+                                       $id = $this->custom->add($attrib, 
$attrib_table);       
+                                       if ($id <= 0)
+                                       {
+                                               $receipt['error'][] = 
array('msg' => lang('Unable to add field'));
+                                       }
+                                       else if ($id == -1)
+                                       {
+                                               $receipt['error'][] = 
array('msg' => lang('field already exists, please choose another name'));
+                                               $receipt['error'][] = 
array('msg' => lang('Attribute has NOT been saved'));
+                                       }
+                               }
+                       }
+                       
+                       return $receipt;
+               }
+               
+               public function add_entity_categories ($buildingpart_out_table, 
$template_id)
+               {
                        $buildingparts = array();
                        
                        foreach ($buildingpart_out_table as $k => $name)
@@ -201,8 +235,14 @@
                                        }
                                }
 
+                               $template = explode("_", $template_id);
+                       
                                $cat_id = $this->template_cat_id[strlen($k)];
-                               $entity_id = '3';
+                               if (strlen($k) > 2)
+                               {
+                                       $cat_id = $template[1];
+                               }
+                               $entity_id = $template[0];
 
                                $category_id = $this->save_category($name, 
$parent_id, $cat_id);
 




reply via email to

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