fmsystem-commits
[Top][All Lists]
Advanced

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

[Fmsystem-commits] [13932] booking: backport from syncromind


From: Sigurd Nes
Subject: [Fmsystem-commits] [13932] booking: backport from syncromind
Date: Wed, 16 Sep 2015 11:27:02 +0000

Revision: 13932
          http://svn.sv.gnu.org/viewvc/?view=rev&root=fmsystem&revision=13932
Author:   sigurdne
Date:     2015-09-16 11:27:01 +0000 (Wed, 16 Sep 2015)
Log Message:
-----------
booking: backport from syncromind

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

Modified: trunk/booking/setup/tables_update.inc.php
===================================================================
--- trunk/booking/setup/tables_update.inc.php   2015-09-16 11:19:05 UTC (rev 
13931)
+++ trunk/booking/setup/tables_update.inc.php   2015-09-16 11:27:01 UTC (rev 
13932)
@@ -2998,4 +2998,63 @@
                        $GLOBALS['setup_info']['booking']['currentver'] = 
'0.2.20';
                        return $GLOBALS['setup_info']['booking']['currentver'];
                }
+       }
+
+       $test[] = '0.2.20';
+       /**
+        * Update booking version from 0.2.20 to 0.2.21
+        *
+        */
+       function booking_upgrade0_2_20()
+       {
+               $GLOBALS['phpgw_setup']->oProc->m_odb->transaction_begin();
+               $boactivity = CreateObject('booking.boactivity');
+               $activities = $boactivity->fetch_activities();
+               $activities = $boactivity->so->read(array('sort'=>'name', 
'dir'=>'ASC'));
+
+               $top_level = array();
+               foreach($activities['results'] as $activity)
+               {
+                       if(!$activity['parent_id'])
+                       {
+                               $top_level[] = $activity;
+                       }
+               }
+               unset($activity);
+
+               foreach($top_level as $activity)
+               {
+                       $location       = ".application.{$activity['id']}";
+                       $descr          = $activity['name'];
+
+                       $GLOBALS['phpgw']->locations->add(
+                               $location,
+                               $descr,
+                               $appname = 'booking',
+                               false, //$allow_grant
+                               null,//$custom_tbl
+                               false,//$c_function
+                               true//$c_attrib
+                       );
+
+                       $location       = ".resource.{$activity['id']}";
+                       $descr          = $activity['name'];
+
+                       $GLOBALS['phpgw']->locations->add(
+                               $location,
+                               $descr,
+                               $appname = 'booking',
+                               false, //$allow_grant
+                               null,//$custom_tbl
+                               false,//$c_function
+                               true//$c_attrib
+                       );
+
+               }
+
+               if($GLOBALS['phpgw_setup']->oProc->m_odb->transaction_commit())
+               {
+                       $GLOBALS['setup_info']['booking']['currentver'] = 
'0.2.21';
+                       return $GLOBALS['setup_info']['booking']['currentver'];
+               }
        }
\ No newline at end of file




reply via email to

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