fmsystem-commits
[Top][All Lists]
Advanced

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

[Fmsystem-commits] [15027] property: item id at location


From: sigurdne
Subject: [Fmsystem-commits] [15027] property: item id at location
Date: Fri, 13 May 2016 11:43:56 +0000 (UTC)

Revision: 15027
          http://svn.sv.gnu.org/viewvc/?view=rev&root=fmsystem&revision=15027
Author:   sigurdne
Date:     2016-05-13 11:43:56 +0000 (Fri, 13 May 2016)
Log Message:
-----------
property: item id at location

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

Modified: trunk/property/setup/tables_update.inc.php
===================================================================
--- trunk/property/setup/tables_update.inc.php  2016-05-13 11:43:53 UTC (rev 
15026)
+++ trunk/property/setup/tables_update.inc.php  2016-05-13 11:43:56 UTC (rev 
15027)
@@ -9020,7 +9020,7 @@
        }
 
        /**
-       * Update property version from 0.9.17.696 to 0.9.17.697
+       * Update property version from 0.9.17.697 to 0.9.17.698
        * Add parametres for integration with e-commerse platforms
        */
        $test[] = '0.9.17.697';
@@ -9038,7 +9038,7 @@
        }
 
        /**
-       * Update property version from 0.9.17.696 to 0.9.17.697
+       * Update property version from 0.9.17.698 to 0.9.17.699
        * Add parametres for integration with e-commerse platforms
        */
        $test[] = '0.9.17.698';
@@ -9096,7 +9096,7 @@
        }
 
        /**
-       * Update property version from 0.9.17.696 to 0.9.17.697
+       * Update property version from 0.9.17.699 to 0.9.17.700
        * Add parametres for integration with e-commerse platforms
        */
        $test[] = '0.9.17.699';
@@ -9127,7 +9127,7 @@
        }
 
        /**
-       * Update property version from 0.9.17.696 to 0.9.17.697
+       * Update property version from 0.9.17.700 to 0.9.17.701
        *
        */
        $test[] = '0.9.17.700';
@@ -9150,3 +9150,54 @@
                        return $GLOBALS['setup_info']['property']['currentver'];
                }
        }
+
+       /**
+       * Update property version from 0.9.17.701 to 0.9.17.702
+       *
+       */
+       $test[] = '0.9.17.701';
+
+       function property_upgrade0_9_17_701()
+       {
+               $GLOBALS['phpgw_setup']->oProc->m_odb->transaction_begin();
+
+               $GLOBALS['phpgw_setup']->oProc->query("SELECT count(*) as cnt 
FROM fm_location_type");
+               $GLOBALS['phpgw_setup']->oProc->next_record();
+               $locations = $GLOBALS['phpgw_setup']->oProc->f('cnt');
+
+               for($location_type = 1; $location_type < ($locations + 1); 
$location_type++)
+               {
+
+                       
$GLOBALS['phpgw_setup']->oProc->AddColumn("fm_location{$location_type}", 'id', 
array(
+                               'type' => 'int',
+                               'precision' => 4,
+                               'nullable' => true,
+                               )
+                       );
+
+                       
$GLOBALS['phpgw_setup']->oProc->AddColumn("fm_location{$location_type}_history",
 'id', array(
+                               'type' => 'int',
+                               'precision' => 4,
+                               'nullable' => true,
+                               )
+                       );
+
+                       $location_id = 
$GLOBALS['phpgw']->locations->get_id('property', ".location.{$location_type}");
+
+                       $GLOBALS['phpgw_setup']->oProc->query("SELECT max(id) 
as id FROM phpgw_cust_attribute WHERE location_id = {$location_id}");
+                       $GLOBALS['phpgw_setup']->oProc->next_record();
+                       $attrib_id = $GLOBALS['phpgw_setup']->oProc->f('id') +1;
+
+                       $GLOBALS['phpgw_setup']->oProc->query("INSERT INTO 
phpgw_cust_attribute (location_id, 
id,column_name,datatype,precision_,input_text,statustext,nullable,custom)"
+                       . " VALUES ( {$location_id}, {$attrib_id}, 'id', 'I', 
4, 'id', 'id', 'true', NULL)");
+
+               }
+
+               execMethod('property.solocation.update_location');
+
+               if($GLOBALS['phpgw_setup']->oProc->m_odb->transaction_commit())
+               {
+                       $GLOBALS['setup_info']['property']['currentver'] = 
'0.9.17.702';
+                       return $GLOBALS['setup_info']['property']['currentver'];
+               }
+       }




reply via email to

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