fmsystem-commits
[Top][All Lists]
Advanced

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

[Fmsystem-commits] [9555] eav


From: Sigurd Nes
Subject: [Fmsystem-commits] [9555] eav
Date: Tue, 12 Jun 2012 09:32:40 +0000

Revision: 9555
          http://svn.sv.gnu.org/viewvc/?view=rev&root=fmsystem&revision=9555
Author:   sigurdne
Date:     2012-06-12 09:32:40 +0000 (Tue, 12 Jun 2012)
Log Message:
-----------
eav

Modified Paths:
--------------
    trunk/property/inc/class.soentity.inc.php

Modified: trunk/property/inc/class.soentity.inc.php
===================================================================
--- trunk/property/inc/class.soentity.inc.php   2012-06-12 06:55:39 UTC (rev 
9554)
+++ trunk/property/inc/class.soentity.inc.php   2012-06-12 09:32:40 UTC (rev 
9555)
@@ -1814,6 +1814,11 @@
                {
                        $location_id = (int) $location_id;
                        $id = (int) $id;
+
+                       $this->db->query("SELECT id as type FROM fm_bim_type 
WHERE location_id = {$location_id}",__LINE__,__FILE__);
+                       $this->db->next_record();
+                       $type = (int)$this->db->f('type');
+
                        $location_name = str_replace('.', '_', $location_name); 
                
 
                        phpgw::import_class('phpgwapi.xmlhelper');
@@ -1848,7 +1853,7 @@
                        );
 
                        $value_set      = 
$this->db->validate_update($value_set);
-                       return $this->db->query("UPDATE fm_bim_item SET 
$value_set WHERE id = $id",__LINE__,__FILE__);
+                       return $this->db->query("UPDATE fm_bim_item SET 
$value_set WHERE id = $id AND type = {$type}",__LINE__,__FILE__);
                }
 
                function edit($values,$values_attribute,$entity_id,$cat_id)
@@ -2007,6 +2012,8 @@
                        $cat_id         = (int) $cat_id;
                        $id                     = (int) $id;
 
+                       $location2_id   = 
$GLOBALS['phpgw']->locations->get_id($this->type_app[$this->type], 
".{$this->type}.{$entity_id}.{$cat_id}");  
+
                        $admin_entity   = 
CreateObject('property.soadmin_entity');
                        $admin_entity->type = $this->type;
                        $category = 
$admin_entity->read_single_category($entity_id, $cat_id);
@@ -2015,7 +2022,10 @@
 
                        if($category['is_eav'])
                        {
-                               $this->db->query("DELETE FROM fm_bim_item WHERE 
id = $id",__LINE__,__FILE__);
+                               $this->db->query("SELECT id as type FROM 
fm_bim_type WHERE location_id = {$location_id}",__LINE__,__FILE__);
+                               $this->db->next_record();
+                               $type = (int)$this->db->f('type');
+                               $this->db->query("DELETE FROM fm_bim_item WHERE 
id = $id AND type = {$type}",__LINE__,__FILE__);
                        }
                        else
                        {
@@ -2023,7 +2033,7 @@
                                $this->db->query("DELETE FROM $table WHERE id = 
$id",__LINE__,__FILE__);
                        }
 
-                       $location2_id   = 
$GLOBALS['phpgw']->locations->get_id($this->type_app[$this->type], 
".{$this->type}.{$entity_id}.{$cat_id}");                  
+
                        $this->db->query("DELETE FROM phpgw_interlink WHERE 
location2_id ={$location2_id} AND location2_item_id = {$id}",__LINE__,__FILE__);
                        $this->db->transaction_commit();
                }




reply via email to

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