fmsystem-commits
[Top][All Lists]
Advanced

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

[Fmsystem-commits] [8955] property: reuse roles for responsibilities


From: Sigurd Nes
Subject: [Fmsystem-commits] [8955] property: reuse roles for responsibilities
Date: Fri, 24 Feb 2012 15:35:41 +0000

Revision: 8955
          http://svn.sv.gnu.org/viewvc/?view=rev&root=fmsystem&revision=8955
Author:   sigurdne
Date:     2012-02-24 15:35:39 +0000 (Fri, 24 Feb 2012)
Log Message:
-----------
property: reuse roles for responsibilities

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

Modified: trunk/property/setup/setup.inc.php
===================================================================
--- trunk/property/setup/setup.inc.php  2012-02-24 09:51:01 UTC (rev 8954)
+++ trunk/property/setup/setup.inc.php  2012-02-24 15:35:39 UTC (rev 8955)
@@ -192,6 +192,7 @@
                'fm_responsibility',
                'fm_responsibility_role',
                'fm_responsibility_contact',
+               'fm_responsibility_module',
                'fm_action_pending',
                'fm_action_pending_category',
                'fm_jasper',

Modified: trunk/property/setup/tables_current.inc.php
===================================================================
--- trunk/property/setup/tables_current.inc.php 2012-02-24 09:51:01 UTC (rev 
8954)
+++ trunk/property/setup/tables_current.inc.php 2012-02-24 15:35:39 UTC (rev 
8955)
@@ -2128,9 +2128,6 @@
                                'id' => array('type' => 'auto','precision' => 
'4','nullable' => False),
                                'name' => array('type' => 'varchar', 
'precision' => 50,'nullable' => False),
                                'descr' => array('type' => 'varchar', 
'precision' => 255,'nullable' => True),
-                               'active' => array('type' => 'int','precision' 
=> 2,'nullable' => True),
-                               'location_id' => array('type' => 
'int','precision' => 4,'nullable' => True),
-                               'cat_id' => array('type' => 'int','precision' 
=> 4,'nullable' => True),
                                'created_on' => array('type' => 'int', 
'precision' => 4,'nullable' => False),
                                'created_by' => array('type' => 'int', 
'precision' => 4,'nullable' => False),
                        ),
@@ -2139,6 +2136,25 @@
                        'ix' => array(),
                        'uc' => array()
                ),
+               'fm_responsibility_module' => array(
+                       'fd' => array(
+                               'responsibility_id' => array('type' => 'int', 
'precision' => 4,'nullable' => True),
+                               'location_id' => array('type' => 
'int','precision' => 4,'nullable' => True),
+                               'cat_id' => array('type' => 'int','precision' 
=> 4,'nullable' => True),
+                               'active' => array('type' => 'int','precision' 
=> 2,'nullable' => True),
+                               'created_on' => array('type' => 'int', 
'precision' => 4,'nullable' => False),
+                               'created_by' => array('type' => 'int', 
'precision' => 4,'nullable' => False),
+                       ),
+                       'pk' => array('responsibility_id', 'location_id', 
'cat_id'),
+                       'fk' => array
+                                       (
+                                               'fm_responsibility' => 
array('responsibility_id' => 'id'),
+                                               'phpgw_locations'       => 
array('location_id' => 'location_id'),
+                                               'phpgw_categories'      => 
array('cat_id' => 'cat_id')
+                                       ),
+                       'ix' => array(),
+                       'uc' => array()
+               ),
                'fm_responsibility_role' => array(
                        'fd' => array(
                                'id' => array('type' => 'auto', 'precision' => 
4,'nullable' => False),

Modified: trunk/property/setup/tables_update.inc.php
===================================================================
--- trunk/property/setup/tables_update.inc.php  2012-02-24 09:51:01 UTC (rev 
8954)
+++ trunk/property/setup/tables_update.inc.php  2012-02-24 15:35:39 UTC (rev 
8955)
@@ -5908,7 +5908,79 @@
                }
        }
 
+
        /**
+       * Update property version from 0.9.17.633 to 0.9.17.634
+       * Add project budget per year
+       */
+
+       $test[] = '0.9.17.634';
+       function property_upgrade0_9_17_634()
+       {
+               $GLOBALS['phpgw_setup']->oProc->m_odb->transaction_begin();
+               $GLOBALS['phpgw_setup']->oProc->query("DELETE FROM fm_cache");
+
+               $GLOBALS['phpgw_setup']->oProc->CreateTable(
+                       'fm_responsibility_module', array(
+                               'fd' => array(
+                                       'responsibility_id' => array('type' => 
'int', 'precision' => 4,'nullable' => True),
+                                       'location_id' => array('type' => 
'int','precision' => 4,'nullable' => True),
+                                       'cat_id' => array('type' => 
'int','precision' => 4,'nullable' => True),
+                                       'active' => array('type' => 
'int','precision' => 2,'nullable' => True),
+                                       'created_on' => array('type' => 'int', 
'precision' => 4,'nullable' => False),
+                                       'created_by' => array('type' => 'int', 
'precision' => 4,'nullable' => False),
+                               ),
+                               'pk' => array('responsibility_id', 
'location_id', 'cat_id'),
+                               'fk' => array
+                                               (
+                                                       'fm_responsibility' => 
array('responsibility_id' => 'id'),
+                                                       'phpgw_locations'       
=> array('location_id' => 'location_id'),
+                                                       'phpgw_categories'      
=> array('cat_id' => 'cat_id')
+                                               ),
+                               'ix' => array(),
+                               'uc' => array()
+                       )
+               );
+
+               $sql = 'SELECT * FROM fm_responsibility';
+               $GLOBALS['phpgw_setup']->oProc->query($sql,__LINE__,__FILE__);
+               $responsibilities = array();
+               while ($GLOBALS['phpgw_setup']->oProc->next_record())
+               {
+                       if($cat_id = 
$GLOBALS['phpgw_setup']->oProc->f('cat_id'))
+                       {
+                               $responsibilities[] = array
+                               (
+                                       'responsibility_id' => 
$GLOBALS['phpgw_setup']->oProc->f('id'),
+                                       'location_id' => 
$GLOBALS['phpgw_setup']->oProc->f('location_id'),
+                                       'cat_id' => $cat_id,
+                                       'active' => 
$GLOBALS['phpgw_setup']->oProc->f('active'),
+                                       'created_on' => 
$GLOBALS['phpgw_setup']->oProc->f('created_on'),
+                                       'created_by' => 
$GLOBALS['phpgw_setup']->oProc->f('created_by')
+                               );
+                       }
+               }
+
+               foreach ($responsibilities as $value_set)
+               {
+                       $cols = implode(',', array_keys($value_set));
+                       $values = 
$GLOBALS['phpgw_setup']->oProc->validate_insert(array_values($value_set));
+                       $sql = "INSERT INTO fm_responsibility_module ({$cols}) 
VALUES ({$values})";
+                       
$GLOBALS['phpgw_setup']->oProc->query($sql,__LINE__,__FILE__);
+               }
+
+               
$GLOBALS['phpgw_setup']->oProc->DropColumn('fm_responsibility',array(),'location_id');
+               
$GLOBALS['phpgw_setup']->oProc->DropColumn('fm_responsibility',array(),'cat_id');
+               
$GLOBALS['phpgw_setup']->oProc->DropColumn('fm_responsibility',array(),'active');
+
+               if($GLOBALS['phpgw_setup']->oProc->m_odb->transaction_commit())
+               {
+                       $GLOBALS['setup_info']['property']['currentver'] = 
'0.9.17.635';
+                       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]