fmsystem-commits
[Top][All Lists]
Advanced

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

[Fmsystem-commits] [7273] property: sync locations on respect on deleted


From: Sigurd Nes
Subject: [Fmsystem-commits] [7273] property: sync locations on respect on deleted items
Date: Mon, 09 May 2011 10:51:39 +0000

Revision: 7273
          http://svn.sv.gnu.org/viewvc/?view=rev&root=fmsystem&revision=7273
Author:   sigurdne
Date:     2011-05-09 10:51:38 +0000 (Mon, 09 May 2011)
Log Message:
-----------
property: sync locations on respect on deleted items

Modified Paths:
--------------
    trunk/property/setup/setup.inc.php
    trunk/property/setup/tables_update.inc.php

Modified: trunk/property/setup/setup.inc.php
===================================================================
--- trunk/property/setup/setup.inc.php  2011-05-09 09:53:54 UTC (rev 7272)
+++ trunk/property/setup/setup.inc.php  2011-05-09 10:51:38 UTC (rev 7273)
@@ -12,7 +12,7 @@
        */
 
        $setup_info['property']['name']                 = 'property';
-       $setup_info['property']['version']              = '0.9.17.617';
+       $setup_info['property']['version']              = '0.9.17.618';
        $setup_info['property']['app_order']    = 8;
        $setup_info['property']['enable']               = 1;
        $setup_info['property']['app_group']    = 'office';

Modified: trunk/property/setup/tables_update.inc.php
===================================================================
--- trunk/property/setup/tables_update.inc.php  2011-05-09 09:53:54 UTC (rev 
7272)
+++ trunk/property/setup/tables_update.inc.php  2011-05-09 10:51:38 UTC (rev 
7273)
@@ -5244,6 +5244,45 @@
 
 
        /**
+       * Update property version from 0.9.17.616 to 0.9.17.617
+       * Sync fm_locations with fm_locationX
+       * 
+       */
+
+       $test[] = '0.9.17.617';
+       function property_upgrade0_9_17_617()
+       {
+               $GLOBALS['phpgw_setup']->oProc->m_odb->transaction_begin();
+
+               $GLOBALS['phpgw_setup']->oProc->query("SELECT max(level) as 
level FROM fm_locations",__LINE__,__FILE__);
+               $GLOBALS['phpgw_setup']->oProc->next_record();
+               $level = $GLOBALS['phpgw_setup']->oProc->f('level');
+               $ids = array();
+               for($i=1;$i<($level+1);$i++)
+               {
+                       $sql = "SELECT id FROM fm_locations LEFT JOIN 
fm_location{$i} ON fm_locations.location_code = fm_location{$i}.location_code"
+                                       . " WHERE fm_location{$i}.location_code 
IS NULL AND LEVEL = {$i}";
+                       
$GLOBALS['phpgw_setup']->oProc->query($sql,__LINE__,__FILE__);
+                       while($GLOBALS['phpgw_setup']->oProc->next_record())
+                       {
+                               $ids[] = 
$GLOBALS['phpgw_setup']->oProc->f('id');
+                       }
+               }
+
+               if($ids)
+               {
+                       $sql = 'DELETE FROM fm_locations WHERE id IN(' . 
implode(',', $ids) . ')';
+                       
$GLOBALS['phpgw_setup']->oProc->query($sql,__LINE__,__FILE__);
+               }
+
+               if($GLOBALS['phpgw_setup']->oProc->m_odb->transaction_commit())
+               {
+                       $GLOBALS['setup_info']['property']['currentver'] = 
'0.9.17.618';
+                       return $GLOBALS['setup_info']['property']['currentver'];
+               }
+       }
+
+       /**
        * Update property version from 0.9.17.607 to 0.9.17.608
        * Add more room for address at tickets
        * 




reply via email to

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