phpgroupware-cvs
[Top][All Lists]
Advanced

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

[Phpgroupware-cvs] property/inc/custom oppdater_utgaatt_objekt.php, 1.6


From: sigurdne
Subject: [Phpgroupware-cvs] property/inc/custom oppdater_utgaatt_objekt.php, 1.6
Date: Wed, 25 May 2005 09:49:00 +0200

Update of property/inc/custom

Modified Files:
     Branch: MAIN
            oppdater_utgaatt_objekt.php lines: +27 -4

Log Message:
no message

====================================================
Index: property/inc/custom/oppdater_utgaatt_objekt.php
diff -u property/inc/custom/oppdater_utgaatt_objekt.php:1.5 
property/inc/custom/oppdater_utgaatt_objekt.php:1.6
--- property/inc/custom/oppdater_utgaatt_objekt.php:1.5 Thu May 12 21:26:27 2005
+++ property/inc/custom/oppdater_utgaatt_objekt.php     Wed May 25 07:49:20 2005
@@ -106,7 +106,6 @@

                        $m= count($location_types);

-                       $this->db->transaction_begin();

                        $this->db->query("UPDATE fm_location" . $m. " set       
status= 2  WHERE category=99",__LINE__,__FILE__);

@@ -147,9 +146,11 @@
                                        }
                                }

+                               $metadata = 
$this->db->metadata('fm_location'.($type_id-1));
                                $j=0;
                                for ($i=0; $i<count($update); $i++)
                                {
+                                       $this->db->transaction_begin();

                                        $sql = "SELECT category FROM 
$parent_table WHERE location_code= '" . $update[$i]['location_code'] ."'";

@@ -158,8 +159,29 @@

                                        if($this->db->f('category')!=99)
                                        {
+                                               $sql = "SELECT * from 
$parent_table WHERE location_code ='" . $update[$i]['location_code'] . "'";
+                                               
$this->db->query($sql,__LINE__,__FILE__);
+                                               $this->db->next_record();
+
+                                               for ($k=0; $k<count($metadata); 
$k++)
+                                               {
+                                                       $cols[] = 
$metadata[$k]['name'];
+                                                       $vals[] = 
$this->db->f($metadata[$k]['name']);
+                                               }
+
+                                               $cols[] = 'exp_date';
+                                               $vals[] = 
date($this->bocommon->datetimeformat,time());
+
+                                               $cols   =implode(",", $cols);
+                                               $vals = 
$this->bocommon->validate_db_insert($vals);
+
+                                               $sql = "INSERT INTO 
fm_location" . ($type_id-1) ."_history ($cols) VALUES ($vals)";
+                                               
$this->db->query($sql,__LINE__,__FILE__);
+                                               unset($cols);
+                                               unset($vals);
+
                                                $j++;
-                                               $this->db->query("UPDATE 
fm_location" . ($type_id-1). " set     status= 2, category=99  WHERE 
location_code= '" . $update[$i]['location_code'] ."'",__LINE__,__FILE__);
+                                               $this->db->query("UPDATE 
fm_location" . ($type_id-1). " set     status= 2, category=99, change_type=2  
WHERE location_code= '" . $update[$i]['location_code'] ."'",__LINE__,__FILE__);
                                                if($type_id == 2)
                                                {
                                                        
$this->db->query("UPDATE fm_location1 set kostra_id = NULL  WHERE 
location_code= '" . $update[$i]['location_code'] ."'",__LINE__,__FILE__);
@@ -174,9 +196,10 @@
                                unset($update);
                                unset($joinmethod);
                                unset($paranthesis);
+                               unset($metadata);
+                               $this->db->transaction_commit();
                        }

-                       $this->db->transaction_commit();

                        if(!$cron)
                        {






reply via email to

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