fmsystem-commits
[Top][All Lists]
Advanced

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

[Fmsystem-commits] [10202] bim: add location_id to bim_item


From: Sigurd Nes
Subject: [Fmsystem-commits] [10202] bim: add location_id to bim_item
Date: Wed, 10 Oct 2012 14:16:11 +0000

Revision: 10202
          http://svn.sv.gnu.org/viewvc/?view=rev&root=fmsystem&revision=10202
Author:   sigurdne
Date:     2012-10-10 14:16:11 +0000 (Wed, 10 Oct 2012)
Log Message:
-----------
bim: add location_id to bim_item

Modified Paths:
--------------
    trunk/bim/inc/class.sobimtype.inc.php

Modified: trunk/bim/inc/class.sobimtype.inc.php
===================================================================
--- trunk/bim/inc/class.sobimtype.inc.php       2012-10-10 13:52:34 UTC (rev 
10201)
+++ trunk/bim/inc/class.sobimtype.inc.php       2012-10-10 14:16:11 UTC (rev 
10202)
@@ -58,14 +58,25 @@
                if($this->getBimObjectType($name) != null) {
                        throw new Exception('Type already exists!');
                }
-               if(is_null($description)) {
-                       $sql = "INSERT INTO ".self::bimTypeTable." (name) 
VALUES ('$name')";
-               } else {
-                       $sql = "INSERT INTO ".self::bimTypeTable." (name, 
description) VALUES ('$name', '$description')";
+
+                       $location_id = $GLOBALS['phpgw']->locations->add($name, 
$description ? $description : $name , 'bim');
+
+               if(is_null($description))
+               {
+                       $sql = "INSERT INTO ".self::bimTypeTable." 
(location_id, name) VALUES ($location_id, '$name')";
+               }
+               else
+               {
+                       $description = $this->db->db_addslashes($description);
+                       $sql = "INSERT INTO ".self::bimTypeTable." 
(location_id, name, description) VALUES ($location_id, '$name', 
'$description')";
                } 
-                       if(is_null($this->db->query($sql,__LINE__,__FILE__) )){
+
+                       if(is_null($this->db->query($sql,__LINE__,__FILE__) ))
+                       {
                                throw new Exception("Error adding object 
type!");
-                       } else {
+                       }
+                       else
+                       {
                                return true;
                        }
         }




reply via email to

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