fmsystem-commits
[Top][All Lists]
Advanced

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

[Fmsystem-commits] [15497]


From: nelson . guerra
Subject: [Fmsystem-commits] [15497]
Date: Sat, 20 Aug 2016 01:52:55 +0000 (UTC)

Revision: 15497
          http://svn.sv.gnu.org/viewvc/?view=rev&root=fmsystem&revision=15497
Author:   nelson224
Date:     2016-08-20 01:52:55 +0000 (Sat, 20 Aug 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-08-20 01:52:43 UTC (rev 15496)
+++ 
branches/dev-syncromind-2/property/inc/import/class.import_update_components.inc.php
        2016-08-20 01:52:55 UTC (rev 15497)
@@ -36,6 +36,7 @@
 
                }
                
+               /*
                public function set_parent_category($buildingpart)
                {
                        for($x = 1;  $x <= (strlen($buildingpart)-1); $x++) 
@@ -67,7 +68,18 @@
                        
                        return $parentID;
                }
+               */
+                
+               public function get_parent_category($buildingpart)
+               {
+                       $$buildingpart = substr($buildingpart, 0, 
strlen($buildingpart)-1);
+                       
+                       $values = 
$this->get_entity_categories(array('buildingpart' => $buildingpart));
+
+                       return $values[$buildingpart]['id'];
+               }
                
+               
                public function get_entity_categories ($data = array())
                {
                        $querymethod = '';
@@ -169,26 +181,40 @@
                {
                        $buildingparts = array();
                                
-                       foreach ($buildingpart_out_table as $k => $v)
+                       $template_cat_id = array(
+                               '1' =>  '309',
+                               '2' => '310',
+                               '3' => '1',
+                               '4' =>  '1' /*  Id of "211 Klargjøring av tomt" 
*/
+                       );
+                       
+                       foreach ($buildingpart_out_table as $k => $name)
                        {       
-                                       $parent_id = 
(empty($v['parent']['id'])) ? $this->set_parent_category($k) : 
$v['parent']['id'];
-                                       if (empty($parent_id))
+                                       if (strlen($k) == 1) 
                                        {
-                                               $buildingparts['not_added'][$k] 
= array('name' => $v['name']);
-                                               break; 
+                                               $parent_id = '';
+                                       } 
+                                       else 
+                                       {
+                                               $parent_id = 
$this->get_parent_category($k);
+                                               if (empty($parent_id))
+                                               {
+                                                       
$buildingparts['not_added'][$k] = array('name' => $name);
+                                                       break; 
+                                               }
                                        }
                                
-                                       $cat_id = '1'; /*  Id of "211 
Klargjøring av tomt" */
+                                       $cat_id = $template_cat_id[strlen($k)];
                                        $entity_id = '3';
                                        
-                                       $category_id = 
$this->save_category($v['name'], $parent_id, $cat_id);
+                                       $category_id = 
$this->save_category($name, $parent_id, $cat_id);
 
                                        if ($category_id)
                                        {
-                                               $buildingparts['added'][$k] = 
array('id' => $category_id, 'entity_id' => $entity_id, 'name' => $v['name']);
+                                               $buildingparts['added'][$k] = 
array('id' => $category_id, 'entity_id' => $entity_id, 'name' => $name);
                                        }
                                        else {
-                                               $buildingparts['not_added'][$k] 
= array('name' => $v['name']);
+                                               $buildingparts['not_added'][$k] 
= array('name' => $name);
                                        }
                        }
                        




reply via email to

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