fmsystem-commits
[Top][All Lists]
Advanced

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

[Fmsystem-commits] [8758] changed datatype of column location_code in co


From: Erik Holm-Larsen
Subject: [Fmsystem-commits] [8758] changed datatype of column location_code in controller_check_list from int to varchar
Date: Thu, 02 Feb 2012 11:22:50 +0000

Revision: 8758
          http://svn.sv.gnu.org/viewvc/?view=rev&root=fmsystem&revision=8758
Author:   erikhl
Date:     2012-02-02 11:22:50 +0000 (Thu, 02 Feb 2012)
Log Message:
-----------
changed datatype of column location_code in controller_check_list from int to 
varchar

Modified Paths:
--------------
    trunk/controller/inc/class.socheck_list.inc.php
    trunk/controller/inc/hook_home.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.socheck_list.inc.php
===================================================================
--- trunk/controller/inc/class.socheck_list.inc.php     2012-02-02 10:31:12 UTC 
(rev 8757)
+++ trunk/controller/inc/class.socheck_list.inc.php     2012-02-02 11:22:50 UTC 
(rev 8758)
@@ -2,7 +2,7 @@
        /**
        * phpGroupWare - controller: a part of a Facilities Management System.
        *
-       * @author Erink Holm-Larsen <address@hidden>
+       * @author Erik Holm-Larsen <address@hidden>
        * @author Torstein Vadla <address@hidden>
        * @copyright Copyright (C) 2011,2012 Free Software Foundation, Inc. 
http://www.fsf.org/
        * This file is part of phpGroupWare.
@@ -261,13 +261,14 @@
                }
        }
        
-               function get_planned_check_lists_for_control($control_id){
+       function get_planned_check_lists_for_control($control_id, 
$location_code){
                $sql = "SELECT cl.id as cl_id, cl.status as cl_status, 
cl.comment as cl_comment, deadline, planned_date, "; 
                $sql .= "completed_date, component_id, location_code, 
num_open_cases ";
                $sql .= "FROM controller_check_list cl ";
-               $sql .= "WHERE cl.control_id = $control_id "; 
+               $sql .= "WHERE cl.control_id = $control_id ";
+               $sql .= "AND cl.location_code = '{$location_code}' "; 
                $sql .= "ORDER BY cl.id;";
-               
+               //var_dump($sql);
                $this->db->query($sql);
                
                $check_list_id = 0;
@@ -386,7 +387,7 @@
                $sql .= "cl.component_id as cl_component_id, cl.location_code 
as cl_location_code, num_open_cases "; 
                $sql .= "FROM controller_control c ";
                $sql .= "LEFT JOIN controller_check_list cl on cl.control_id = 
c.id ";
-               $sql .= "WHERE cl.location_code = $location_code ";
+               $sql .= "WHERE cl.location_code = '{$location_code}' ";
                $sql .= "AND c.repeat_type = $repeat_type ";
                $sql .= "AND deadline BETWEEN $from_date_ts AND $to_date_ts ";
                $sql .= "ORDER BY c.id;";
@@ -447,7 +448,7 @@
                $sql .= "cl.component_id as cl_component_id, cl.location_code 
as cl_location_code, num_open_cases "; 
                $sql .= "FROM controller_control c ";
                $sql .= "LEFT JOIN controller_check_list cl on cl.control_id = 
c.id ";
-               $sql .= "WHERE cl.location_code = $location_code ";
+               $sql .= "WHERE cl.location_code = '{$location_code} ";
                
                if( is_numeric($repeat_type) )
                        $sql .= "AND c.repeat_type = $repeat_type ";

Modified: trunk/controller/inc/hook_home.inc.php
===================================================================
--- trunk/controller/inc/hook_home.inc.php      2012-02-02 10:31:12 UTC (rev 
8757)
+++ trunk/controller/inc/hook_home.inc.php      2012-02-02 11:22:50 UTC (rev 
8758)
@@ -129,7 +129,8 @@
        {
                $curr_location = $control_instance[0];
                $current_control = $control_instance[1];
-               $check_lists = 
$so->get_planned_check_lists_for_control($current_control->get_id());
+               $check_lists = 
$so->get_planned_check_lists_for_control($current_control->get_id(), 
$curr_location);
+               //_debug_array($check_lists);
                $location_array = execMethod('property.bolocation.read_single', 
array('location_code' => $curr_location));
                $location_name = $location_array["loc1_name"];
                foreach($control_areas['cat_list'] as $area)
@@ -202,7 +203,7 @@
        {
                $curr_location = $control_instance[0];
                $current_control = $control_instance[1];
-               $check_lists = 
$so->get_planned_check_lists_for_control($current_control->get_id());
+               $check_lists = 
$so->get_planned_check_lists_for_control($current_control->get_id(), 
$curr_location);
                //$control_location = 
$so_control->getLocationCodeFromControl($current_control->get_id());
                $location_array = execMethod('property.bolocation.read_single', 
array('location_code' => $curr_location));
                $location_name = $location_array["loc1_name"];
@@ -233,7 +234,7 @@
                                                ($current_date, array
                                                (
                                                        'text' => 
"{$location_name} - {$control_area_name} - {$current_control->get_title()} :: 
{$next_date}",
-                                                       'link' => 
$GLOBALS['phpgw']->link('/index.php', array('menuaction' => 
'controller.uicheck_list.add_check_list', 'date' => $current_date, 'control_id' 
=> $current_control->get_id(), 'location_code' => '1101'))
+                                                       'link' => 
$GLOBALS['phpgw']->link('/index.php', array('menuaction' => 
'controller.uicheck_list.add_check_list', 'date' => $current_date, 'control_id' 
=> $current_control->get_id(), 'location_code' => $curr_location))
                                                ));
                                        }
                                }
@@ -245,7 +246,7 @@
                                ($current_date, array
                                (
                                        'text' => "{$location_name} - 
{$control_area_name} - {$current_control->get_title()} :: {$next_date}",
-                                       'link' => 
$GLOBALS['phpgw']->link('/index.php', array('menuaction' => 
'controller.uicheck_list.add_check_list', 'date' => $current_date, 'control_id' 
=> $current_control->get_id(), 'location_code' => '1101'))
+                                       'link' => 
$GLOBALS['phpgw']->link('/index.php', array('menuaction' => 
'controller.uicheck_list.add_check_list', 'date' => $current_date, 'control_id' 
=> $current_control->get_id(), 'location_code' => $curr_location))
                                ));                                     
                        }
                }

Modified: trunk/controller/setup/setup.inc.php
===================================================================
--- trunk/controller/setup/setup.inc.php        2012-02-02 10:31:12 UTC (rev 
8757)
+++ trunk/controller/setup/setup.inc.php        2012-02-02 11:22:50 UTC (rev 
8758)
@@ -1,6 +1,6 @@
 <?php
        $setup_info['controller']['name'] = 'controller';
-       $setup_info['controller']['version'] = '0.1.24';
+       $setup_info['controller']['version'] = '0.1.25';
        $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-02 10:31:12 UTC 
(rev 8757)
+++ trunk/controller/setup/tables_current.inc.php       2012-02-02 11:22:50 UTC 
(rev 8758)
@@ -76,7 +76,7 @@
                                'planned_date' => array('type' => 'int', 
'precision' => 8, 'nullable' => True),
                                'completed_date' => array('type' => 'int', 
'precision' => 8, 'nullable' => True),
                                'component_id' => array('type' => 'int', 
'precision' => 4, 'nullable' => True),
-                               'location_code' => array('type' => 'int', 
'precision' => 4, 'nullable' => True),
+                               'location_code' => array('type' => 'varchar', 
'precision' => 30, 'nullable' => false),
                                'num_open_cases' => array('type' => 'int', 
'precision' => 4, 'nullable' => True)
                        ),
                        'pk' => array('id'),

Modified: trunk/controller/setup/tables_update.inc.php
===================================================================
--- trunk/controller/setup/tables_update.inc.php        2012-02-02 10:31:12 UTC 
(rev 8757)
+++ trunk/controller/setup/tables_update.inc.php        2012-02-02 11:22:50 UTC 
(rev 8758)
@@ -508,3 +508,24 @@
                $GLOBALS['setup_info']['controller']['currentver'] = '0.1.24';
                return $GLOBALS['setup_info']['controller']['currentver'];
        }
+       
+       $test[] = '0.1.24';
+       function controller_upgrade0_1_24()
+       {
+
+               $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_check_list', array(), 
'location_code');
+
+               
$GLOBALS['phpgw_setup']->oProc->AddColumn('controller_check_list','location_code',array(
+                       'type' => 'varchar',
+                       'precision' => 30,
+                       'nullable' => true
+               ));
+
+               if($GLOBALS['phpgw_setup']->oProc->m_odb->transaction_commit())
+               {
+                       $GLOBALS['setup_info']['controller']['currentver'] = 
'0.1.25';
+                       return 
$GLOBALS['setup_info']['controller']['currentver'];
+               }               
+       }




reply via email to

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