fmsystem-commits
[Top][All Lists]
Advanced

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

[Fmsystem-commits] [6988] property BIM: fix remove model


From: Sigurd Nes
Subject: [Fmsystem-commits] [6988] property BIM: fix remove model
Date: Tue, 15 Feb 2011 18:11:13 +0000

Revision: 6988
          http://svn.sv.gnu.org/viewvc/?view=rev&root=fmsystem&revision=6988
Author:   sigurdne
Date:     2011-02-15 18:11:13 +0000 (Tue, 15 Feb 2011)
Log Message:
-----------
property BIM: fix remove model

Modified Paths:
--------------
    branches/dev-bim2/property/inc/class.bobimmodel.inc.php
    branches/dev-bim2/property/inc/class.sobimmodel.inc.php
    branches/dev-bim2/property/js/yahoo/bim.modellist.js

Modified: branches/dev-bim2/property/inc/class.bobimmodel.inc.php
===================================================================
--- branches/dev-bim2/property/inc/class.bobimmodel.inc.php     2011-02-15 
17:13:48 UTC (rev 6987)
+++ branches/dev-bim2/property/inc/class.bobimmodel.inc.php     2011-02-15 
18:11:13 UTC (rev 6988)
@@ -225,4 +225,4 @@
        public function getModelName() {
                return $this->modelName;
        }
-}
\ No newline at end of file
+}

Modified: branches/dev-bim2/property/inc/class.sobimmodel.inc.php
===================================================================
--- branches/dev-bim2/property/inc/class.sobimmodel.inc.php     2011-02-15 
17:13:48 UTC (rev 6987)
+++ branches/dev-bim2/property/inc/class.sobimmodel.inc.php     2011-02-15 
18:11:13 UTC (rev 6988)
@@ -161,14 +161,28 @@
                }
                return true;
        }
-       private function removeBimModelDatabaseEntry() {
-               $sql = "delete from ".sobim::bimModelTable." where name = 
'$this->modelName' and vfs_file_id=$this->vfs_database_id";
+
+       private function removeBimModelDatabaseEntry()
+       {
+               $sql = "SELECT id FROM ".sobim::bimModelTable." WHERE name = 
'$this->modelName' AND vfs_file_id=$this->vfs_database_id";
+               $this->db->query($sql,__LINE__,__FILE__);
+               $this->db->next_record();
+               $model_id = (int)$this->db->f('id');
                
-               if(is_null($this->db->query($sql,__LINE__,__FILE__))) {
-                       throw new Exception('Query to delete model was 
unsuccessful');
-               } else {
-                       return ($this->db->num_rows() > 0);
+               $this->db->transaction_begin();
+               $sql = "DELETE FROM public.".sobim::bimItemTable." WHERE model 
= '$model_id'";
+               $this->db->query($sql,__LINE__,__FILE__);
+
+               $sql = "DELETE FROM ".sobim::bimModelTable." WHERE name = 
'$this->modelName' AND vfs_file_id=$this->vfs_database_id";
+               $this->db->query($sql,__LINE__,__FILE__);
+               if( $this->db->transaction_commit() )
+               {
+                       return ($this->db->num_rows() > 0);             
                }
+               else
+               {
+                       throw new Exception('Query to delete model was 
unsuccessful');          
+               }
        }
        
        private function checkArgs() {

Modified: branches/dev-bim2/property/js/yahoo/bim.modellist.js
===================================================================
--- branches/dev-bim2/property/js/yahoo/bim.modellist.js        2011-02-15 
17:13:48 UTC (rev 6987)
+++ branches/dev-bim2/property/js/yahoo/bim.modellist.js        2011-02-15 
18:11:13 UTC (rev 6988)
@@ -16,7 +16,7 @@
                var postUrl = phpGWLink('index.php',path_update);
                var modelDatabaseId = this.getAttribute("value"); // 
getAttribute("value");
                
-               var inputAlert = confirm("Are you sure you want to delete this 
model ?");
+               var inputAlert = confirm("Are you sure you want to delete this 
model(id:"+modelDatabaseId+") ?");
                if(inputAlert) {
                        deleteModel(postUrl, modelDatabaseId);
                }




reply via email to

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