fmsystem-commits
[Top][All Lists]
Advanced

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

[Fmsystem-commits] [8806] Changed column building_part_id on controller_


From: Erik Holm-Larsen
Subject: [Fmsystem-commits] [8806] Changed column building_part_id on controller_control_group freom int to varchar
Date: Wed, 08 Feb 2012 08:20:37 +0000

Revision: 8806
          http://svn.sv.gnu.org/viewvc/?view=rev&root=fmsystem&revision=8806
Author:   erikhl
Date:     2012-02-08 08:20:37 +0000 (Wed, 08 Feb 2012)
Log Message:
-----------
Changed column building_part_id on controller_control_group freom int to varchar

Modified Paths:
--------------
    trunk/controller/inc/class.socontrol_group.inc.php
    trunk/controller/setup/setup.inc.php
    trunk/controller/setup/tables_current.inc.php
    trunk/controller/setup/tables_update.inc.php

Modified: trunk/controller/inc/class.socontrol_group.inc.php
===================================================================
--- trunk/controller/inc/class.socontrol_group.inc.php  2012-02-08 07:41:08 UTC 
(rev 8805)
+++ trunk/controller/inc/class.socontrol_group.inc.php  2012-02-08 08:20:37 UTC 
(rev 8806)
@@ -68,7 +68,7 @@
                                
$this->marshal($control_group->get_group_name(), 'string'),
                                
$this->marshal($control_group->get_procedure_id(), 'int'),
                                
$this->marshal($control_group->get_control_area_id(), 'int'),
-                               
$this->marshal($control_group->get_building_part_id(), 'int'),
+                               
$this->marshal($control_group->get_building_part_id(), 'string'),
                        );
 
                        $result = $this->db->query('INSERT INTO 
controller_control_group (' . join(',', $cols) . ') VALUES (' . join(',', 
$values) . ')', __LINE__,__FILE__);
@@ -100,7 +100,7 @@
                                'group_name = ' . 
$this->marshal($control_group->get_group_name(), 'string'),
                                'procedure_id = '. 
$this->marshal($control_group->get_procedure_id(), 'int'),
                                'control_area_id = ' . 
$this->marshal($control_group->get_control_area_id(), 'int'),
-                               'building_part_id = ' . 
$this->marshal($control_group->get_building_part_id(), 'int')
+                               'building_part_id = ' . 
$this->marshal($control_group->get_building_part_id(), 'string')
                        );
 
                        //var_dump('UPDATE activity_activity SET ' . join(',', 
$values) . " WHERE id=$id");
@@ -119,7 +119,7 @@
                {
                        $id = (int)$id;
 
-                       $joins = "      {$this->left_join} fm_building_part ON 
(p.building_part_id = CAST(fm_building_part.id AS INT))";
+                       $joins = "      {$this->left_join} fm_building_part ON 
(p.building_part_id = fm_building_part.id)";
                        $joins .= "     {$this->left_join} controller_procedure 
ON (p.procedure_id = controller_procedure.id)";
                        //$joins .= "   {$this->left_join} 
controller_control_area ON (p.control_area_id = controller_control_area.id)";
 
@@ -135,7 +135,7 @@
                        $category = 
execMethod('phpgwapi.categories.return_single', 
$this->unmarshal($this->db->f('control_area_id', 'int')));
                        
$control_group->set_control_area_name($category[0]['name']);
                        
//$control_group->set_control_area_name($this->unmarshal($this->db->f('control_area_name'),
 'string'));
-                       
$control_group->set_building_part_id($this->unmarshal($this->db->f('building_part_id'),
 'int'));
+                       
$control_group->set_building_part_id($this->unmarshal($this->db->f('building_part_id'),
 'string'));
                        
$control_group->set_building_part_descr($this->unmarshal($this->db->f('building_part_descr'),
 'string'));
 
                        return $control_group;
@@ -304,7 +304,7 @@
                        $condition =  join(' AND ', $clauses);
 
                        $tables = "controller_control_group";
-                       $joins = "      {$this->left_join} fm_building_part ON 
(building_part_id = CAST(fm_building_part.id AS INT))";
+                       $joins = "      {$this->left_join} fm_building_part ON 
(building_part_id = fm_building_part.id)";
                        $joins .= "     {$this->left_join} controller_procedure 
ON (controller_control_group.procedure_id = controller_procedure.id)";
 //                     $joins .= "     {$this->left_join} 
controller_control_area ON (controller_control_group.control_area_id = 
controller_control_area.id)";
                        //$joins .= "   {$this->left_join} 
rental_contract_composite ON (rental_contract_composite.composite_id = 
rental_composite.id)";
@@ -340,7 +340,7 @@
                                $category = 
execMethod('phpgwapi.categories.return_single', 
$this->unmarshal($this->db->f('control_area_id', 'int')));
                                
$control_group->set_control_area_name($category[0]['name']);
                                
//$control_group->set_control_area_name($this->unmarshal($this->db->f('control_area_name'),
 'string'));
-                               
$control_group->set_building_part_id($this->unmarshal($this->db->f('building_part_id'),
 'int'));
+                               
$control_group->set_building_part_id($this->unmarshal($this->db->f('building_part_id'),
 'string'));
                                
$control_group->set_building_part_descr($this->unmarshal($this->db->f('building_part_descr'),
 'string'));
                        }
                        //var_dump($control_group);
@@ -364,7 +364,7 @@
                                $category = 
execMethod('phpgwapi.categories.return_single', 
$this->unmarshal($this->db->f('control_area_id', 'int')));
                                
$control_group->set_control_area_name($category[0]['name']);
                                
//$control_group->set_control_area_name($this->unmarshal($this->db->f('control_area_name'),
 'string'));
-                               
$control_group->set_building_part_id($this->unmarshal($this->db->f('building_part_id'),
 'int'));
+                               
$control_group->set_building_part_id($this->unmarshal($this->db->f('building_part_id'),
 'string'));
                                
$control_group->set_building_part_descr($this->unmarshal($this->db->f('building_part_descr'),
 'string'));
 
                                $control_groups_array[] = 
$control_group->toArray();

Modified: trunk/controller/setup/setup.inc.php
===================================================================
--- trunk/controller/setup/setup.inc.php        2012-02-08 07:41:08 UTC (rev 
8805)
+++ trunk/controller/setup/setup.inc.php        2012-02-08 08:20:37 UTC (rev 
8806)
@@ -1,6 +1,6 @@
 <?php
        $setup_info['controller']['name'] = 'controller';
-       $setup_info['controller']['version'] = '0.1.26';
+       $setup_info['controller']['version'] = '0.1.27';
        $setup_info['controller']['app_order'] = 100;
        $setup_info['controller']['enable'] = 1;
        $setup_info['controller']['app_group']  = 'office';

Modified: trunk/controller/setup/tables_current.inc.php
===================================================================
--- trunk/controller/setup/tables_current.inc.php       2012-02-08 07:41:08 UTC 
(rev 8805)
+++ trunk/controller/setup/tables_current.inc.php       2012-02-08 08:20:37 UTC 
(rev 8806)
@@ -111,7 +111,7 @@
                                'group_name' => array('type' => 
'varchar','precision' => '255','nullable' => false),
                                'procedure_id' => array('type' => 'int', 
'precision' => 4, 'nullable' => True),
                                'control_area_id' => array('type' => 'int', 
'precision' => 4, 'nullable' => True),
-                               'building_part_id' => array('type' => 'int', 
'precision' => 4, 'nullable' => True)
+                               'building_part_id' => array('type' => 
'varchar', 'precision' => 30, 'nullable' => True)
                        ),
                        'pk' => array('id'),
                        'fk' => array(),

Modified: trunk/controller/setup/tables_update.inc.php
===================================================================
--- trunk/controller/setup/tables_update.inc.php        2012-02-08 07:41:08 UTC 
(rev 8805)
+++ trunk/controller/setup/tables_update.inc.php        2012-02-08 08:20:37 UTC 
(rev 8806)
@@ -554,3 +554,24 @@
                $GLOBALS['setup_info']['controller']['currentver'] = '0.1.26';
                return $GLOBALS['setup_info']['controller']['currentver'];
        }
+       
+       $test[] = '0.1.26';
+       function controller_upgrade0_1_26()
+       {
+
+               $GLOBALS['phpgw_setup']->oProc->m_odb->transaction_begin();
+               //Drop and reinsert because og the datatype int can't be 
altered to varchar
+               
$GLOBALS['phpgw_setup']->oProc->DropColumn('controller_control_group', array(), 
'building_part_id');
+
+               
$GLOBALS['phpgw_setup']->oProc->AddColumn('controller_control_group','building_part_id',array(
+                       'type' => 'varchar',
+                       'precision' => 30,
+                       'nullable' => true
+               ));
+
+               if($GLOBALS['phpgw_setup']->oProc->m_odb->transaction_commit())
+               {
+                       $GLOBALS['setup_info']['controller']['currentver'] = 
'0.1.27';
+                       return 
$GLOBALS['setup_info']['controller']['currentver'];
+               }               
+       }




reply via email to

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