phpgroupware-cvs
[Top][All Lists]
Advanced

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

[Phpgroupware-cvs] property/setup tables_update.inc.php, 1.14 tables_cur


From: sigurdne
Subject: [Phpgroupware-cvs] property/setup tables_update.inc.php, 1.14 tables_current.inc.php, 1.34 setup.inc.php, 1.22 default_records.inc.php, 1.18
Date: Wed, 21 Sep 2005 16:18:00 +0200

Update of property/setup

Modified Files:
     Branch: MAIN
            tables_update.inc.php lines: +151 -1
            tables_current.inc.php lines: +19 -27
            setup.inc.php lines: +4 -3
            default_records.inc.php lines: +8 -3

Log Message:
no message

====================================================
Index: property/setup/tables_update.inc.php
diff -u property/setup/tables_update.inc.php:1.13 
property/setup/tables_update.inc.php:1.14
--- property/setup/tables_update.inc.php:1.13   Tue Sep 13 14:11:52 2005
+++ property/setup/tables_update.inc.php        Wed Sep 21 14:18:16 2005
@@ -555,4 +555,154 @@
                $GLOBALS['setup_info']['property']['currentver'] = '0.9.17.507';
                return $GLOBALS['setup_info']['property']['currentver'];
        }
+       /**
+       * Update property version from 0.9.17.507 to 0.9.17.508
+       */
+
+       $test[] = '0.9.17.507';
+       function property_upgrade0_9_17_507()
+       {
+               $GLOBALS['phpgw_setup']->oProc->CreateTable(
+                       'fm_request_condition_type', array(
+                               'fd' => array(
+                                       'id' => array('type' => 
'int','precision' => '4','nullable' => False),
+                                       'descr' => array('type' => 
'varchar','precision' => '50','nullable' => False),
+                                       'priority_key' => array('type' => 
'int','precision' => '4','default' => '0','nullable' => True)
+                               ),
+                               'pk' => array('id'),
+                               'fk' => array(),
+                               'ix' => array(),
+                               'uc' => array()
+                       )
+               );
+
+               $GLOBALS['phpgw_setup']->oProc->CreateTable(
+                       'fm_request_condition', array(
+                               'fd' => array(
+                                       'request_id' => array('type' => 
'int','precision' => '4','nullable' => False),
+                                       'condition_type' => array('type' => 
'int','precision' => '4','nullable' => False),
+                                       'degree' => array('type' => 
'int','precision' => '4','default' => '0','nullable' => True),
+                                       'probability' => array('type' => 
'int','precision' => '4','default' => '0','nullable' => True),
+                                       'consequence' => array('type' => 
'int','precision' => '4','default' => '0','nullable' => True),
+                                       'user_id' => array('type' => 
'int','precision' => '4','nullable' => True),
+                                       'entry_date' => array('type' => 
'int','precision' => '4','nullable' => True)
+                               ),
+                               'pk' => array('request_id','condition_type'),
+                               'fk' => array(),
+                               'ix' => array(),
+                               'uc' => array()
+                       )
+               );
+
+               $GLOBALS['phpgw_setup']->oProc->query("INSERT INTO 
fm_request_condition_type (id, descr, priority_key) VALUES (1, 'safety', 10)");
+               $GLOBALS['phpgw_setup']->oProc->query("INSERT INTO 
fm_request_condition_type (id, descr, priority_key) VALUES (2, 'aesthetics', 
2)");
+               $GLOBALS['phpgw_setup']->oProc->query("INSERT INTO 
fm_request_condition_type (id, descr, priority_key) VALUES (3, 'indoor 
climate', 5)");
+               $GLOBALS['phpgw_setup']->oProc->query("INSERT INTO 
fm_request_condition_type (id, descr, priority_key) VALUES (4, 'consequential 
damage', 5)");
+               $GLOBALS['phpgw_setup']->oProc->query("INSERT INTO 
fm_request_condition_type (id, descr, priority_key) VALUES (5, 'user 
gratification', 4)");
+               $GLOBALS['phpgw_setup']->oProc->query("INSERT INTO 
fm_request_condition_type (id, descr, priority_key) VALUES (6, 'residential 
environment', 6)");
+
+
+               $GLOBALS['phpgw_setup']->oProc->query("SELECT * FROM 
fm_request");
+
+               while ($GLOBALS['phpgw_setup']->oProc->next_record())
+               {
+                       $condition[] = array(
+                               'request_id' => 
$GLOBALS['phpgw_setup']->oProc->f('id'),
+                               'user_id' => 
(int)$GLOBALS['phpgw_setup']->oProc->f('owner'),
+                               'entry_date' => 
(int)$GLOBALS['phpgw_setup']->oProc->f('entry_date'),
+                               'd_safety' => 
(int)$GLOBALS['phpgw_setup']->oProc->f('d_safety'),
+                               'd_aesthetics' => 
(int)$GLOBALS['phpgw_setup']->oProc->f('d_aesthetics'),
+                               'd_indoor_climate' => 
(int)$GLOBALS['phpgw_setup']->oProc->f('d_indoor_climate'),
+                               'd_consequential_damage' => 
(int)$GLOBALS['phpgw_setup']->oProc->f('d_consequential_damage'),
+                               'd_user_gratification' => 
(int)$GLOBALS['phpgw_setup']->oProc->f('d_user_gratification'),
+                               'd_residential_environment' => 
(int)$GLOBALS['phpgw_setup']->oProc->f('d_residential_environment'),
+                               'p_safety' => 
(int)$GLOBALS['phpgw_setup']->oProc->f('p_safety'),
+                               'p_aesthetics' => 
(int)$GLOBALS['phpgw_setup']->oProc->f('p_aesthetics'),
+                               'p_indoor_climate' => 
(int)$GLOBALS['phpgw_setup']->oProc->f('p_indoor_climate'),
+                               'p_consequential_damage' => 
(int)$GLOBALS['phpgw_setup']->oProc->f('p_consequential_damage'),
+                               'p_user_gratification' => 
(int)$GLOBALS['phpgw_setup']->oProc->f('p_user_gratification'),
+                               'p_residential_environment' => 
(int)$GLOBALS['phpgw_setup']->oProc->f('p_residential_environment'),
+                               'c_safety' => 
(int)$GLOBALS['phpgw_setup']->oProc->f('c_safety'),
+                               'c_aesthetics' => 
(int)$GLOBALS['phpgw_setup']->oProc->f('c_aesthetics'),
+                               'c_indoor_climate' => 
(int)$GLOBALS['phpgw_setup']->oProc->f('c_indoor_climate'),
+                               'c_consequential_damage' => 
(int)$GLOBALS['phpgw_setup']->oProc->f('c_consequential_damage'),
+                               'c_user_gratification' => 
(int)$GLOBALS['phpgw_setup']->oProc->f('c_user_gratification'),
+                               'c_residential_environment' => 
(int)$GLOBALS['phpgw_setup']->oProc->f('c_residential_environment')
+                       );
+               }
+
+               while (is_array($condition) && list(,$value) = each($condition))
+               {
+                       $GLOBALS['phpgw_setup']->oProc->query("INSERT INTO 
fm_request_condition 
(request_id,condition_type,degree,probability,consequence,user_id,entry_date) "
+                               . "VALUES ('"
+                               . $value['request_id']. "','"
+                               . 1 . "',"
+                               . $value['d_safety']. ","
+                               . $value['p_safety']. ","
+                               . $value['c_safety']. ","
+                               . $value['user_id']. ","
+                               . $value['entry_date']. ")",__LINE__,__FILE__);
+
+                       $GLOBALS['phpgw_setup']->oProc->query("INSERT INTO 
fm_request_condition 
(request_id,condition_type,degree,probability,consequence,user_id,entry_date) "
+                               . "VALUES ('"
+                               . $value['request_id']. "','"
+                               . 2 . "',"
+                               . $value['d_aesthetics']. ","
+                               . $value['p_aesthetics']. ","
+                               . $value['c_aesthetics']. ","
+                               . $value['user_id']. ","
+                               . $value['entry_date']. ")",__LINE__,__FILE__);
+
+                       $GLOBALS['phpgw_setup']->oProc->query("INSERT INTO 
fm_request_condition 
(request_id,condition_type,degree,probability,consequence,user_id,entry_date) "
+                               . "VALUES ('"
+                               . $value['request_id']. "','"
+                               . 3 . "',"
+                               . $value['d_indoor_climate']. ","
+                               . $value['p_indoor_climate']. ","
+                               . $value['c_indoor_climate']. ","
+                               . $value['user_id']. ","
+                               . $value['entry_date']. ")",__LINE__,__FILE__);
+
+                       $GLOBALS['phpgw_setup']->oProc->query("INSERT INTO 
fm_request_condition 
(request_id,condition_type,degree,probability,consequence,user_id,entry_date) "
+                               . "VALUES ('"
+                               . $value['request_id']. "','"
+                               . 4 . "',"
+                               . $value['d_consequential_damage']. ","
+                               . $value['p_consequential_damage']. ","
+                               . $value['c_consequential_damage']. ","
+                               . $value['user_id']. ","
+                               . $value['entry_date']. ")",__LINE__,__FILE__);
+
+                       $GLOBALS['phpgw_setup']->oProc->query("INSERT INTO 
fm_request_condition 
(request_id,condition_type,degree,probability,consequence,user_id,entry_date) "
+                               . "VALUES ('"
+                               . $value['request_id']. "','"
+                               . 5 . "',"
+                               . $value['d_user_gratification']. ","
+                               . $value['p_user_gratification']. ","
+                               . $value['c_user_gratification']. ","
+                               . $value['user_id']. ","
+                               . $value['entry_date']. ")",__LINE__,__FILE__);
+
+                       $GLOBALS['phpgw_setup']->oProc->query("INSERT INTO 
fm_request_condition 
(request_id,condition_type,degree,probability,consequence,user_id,entry_date) "
+                               . "VALUES ('"
+                               . $value['request_id']. "','"
+                               . 6 . "',"
+                               . $value['d_residential_environment']. ","
+                               . $value['p_residential_environment']. ","
+                               . $value['c_residential_environment']. ","
+                               . $value['user_id']. ","
+                               . $value['entry_date']. ")",__LINE__,__FILE__);
+
+                       $id = $value['request_id'];
+
+                       $GLOBALS['phpgw_setup']->oProc->query("UPDATE 
fm_request SET score = (SELECT sum 
(priority_key*(degree*probability*(consequence+1))) from fm_request_condition"
+                                . " JOIN fm_request_condition_type ON 
(fm_request_condition.condition_type = fm_request_condition_type.id) WHERE 
request_id = $id) WHERE fm_request.id = $id",__LINE__,__FILE__);
+
+               }
+
+               
$GLOBALS['phpgw_setup']->oProc->DropTable('fm_request_priority_key');
+
+               $GLOBALS['setup_info']['property']['currentver'] = '0.9.17.508';
+               return $GLOBALS['setup_info']['property']['currentver'];
+       }
 ?>

====================================================
Index: property/setup/tables_current.inc.php
diff -u property/setup/tables_current.inc.php:1.33 
property/setup/tables_current.inc.php:1.34
--- property/setup/tables_current.inc.php:1.33  Tue Sep 13 13:33:37 2005
+++ property/setup/tables_current.inc.php       Wed Sep 21 14:18:16 2005
@@ -850,24 +850,6 @@
                                'status' => array('type' => 
'varchar','precision' => '10','nullable' => True),
                                'branch_id' => array('type' => 
'int','precision' => '4','nullable' => True),
                                'coordinator' => array('type' => 
'int','precision' => '4','nullable' => True),
-                               'd_safety' => array('type' => 'int','precision' 
=> '4','default' => '0','nullable' => True),
-                               'd_aesthetics' => array('type' => 
'int','precision' => '4','default' => '0','nullable' => True),
-                               'd_indoor_climate' => array('type' => 
'int','precision' => '4','default' => '0','nullable' => True),
-                               'd_consequential_damage' => array('type' => 
'int','precision' => '4','default' => '0','nullable' => True),
-                               'd_user_gratification' => array('type' => 
'int','precision' => '4','default' => '0','nullable' => True),
-                               'd_residential_environment' => array('type' => 
'int','precision' => '4','default' => '0','nullable' => True),
-                               'p_safety' => array('type' => 'int','precision' 
=> '4','default' => '0','nullable' => True),
-                               'p_aesthetics' => array('type' => 
'int','precision' => '4','default' => '0','nullable' => True),
-                               'p_indoor_climate' => array('type' => 
'int','precision' => '4','default' => '0','nullable' => True),
-                               'p_consequential_damage' => array('type' => 
'int','precision' => '4','default' => '0','nullable' => True),
-                               'p_user_gratification' => array('type' => 
'int','precision' => '4','default' => '0','nullable' => True),
-                               'p_residential_environment' => array('type' => 
'int','precision' => '4','default' => '0','nullable' => True),
-                               'c_safety' => array('type' => 'int','precision' 
=> '4','default' => '0','nullable' => True),
-                               'c_aesthetics' => array('type' => 
'int','precision' => '4','default' => '0','nullable' => True),
-                               'c_indoor_climate' => array('type' => 
'int','precision' => '4','default' => '0','nullable' => True),
-                               'c_consequential_damage' => array('type' => 
'int','precision' => '4','default' => '0','nullable' => True),
-                               'c_user_gratification' => array('type' => 
'int','precision' => '4','default' => '0','nullable' => True),
-                               'c_residential_environment' => array('type' => 
'int','precision' => '4','default' => '0','nullable' => True),
                                'authorities_demands' => array('type' => 
'int','precision' => '2','default' => '0','nullable' => True),
                                'score' => array('type' => 'int','precision' => 
'4','default' => '0','nullable' => True)
                        ),
@@ -876,6 +858,21 @@
                        'ix' => array('location_code'),
                        'uc' => array()
                ),
+               'fm_request_condition' => array(
+                       'fd' => array(
+                               'request_id' => array('type' => 
'int','precision' => '4','nullable' => False),
+                               'condition_type' => array('type' => 
'int','precision' => '4','nullable' => False),
+                               'degree' => array('type' => 'int','precision' 
=> '4','default' => '0','nullable' => True),
+                               'probability' => array('type' => 
'int','precision' => '4','default' => '0','nullable' => True),
+                               'consequence' => array('type' => 
'int','precision' => '4','default' => '0','nullable' => True),
+                               'user_id' => array('type' => 'int','precision' 
=> '4','nullable' => True),
+                               'entry_date' => array('type' => 
'int','precision' => '4','nullable' => True)
+                       ),
+                       'pk' => array('request_id','condition_type'),
+                       'fk' => array(),
+                       'ix' => array(),
+                       'uc' => array()
+               ),
                'fm_request_status' => array(
                        'fd' => array(
                                'id' => array('type' => 'varchar','precision' 
=> '20','nullable' => False),
@@ -1188,16 +1185,11 @@
                        'ix' => array(),
                        'uc' => array()
                ),
-               'fm_request_priority_key' => array(
+               'fm_request_condition_type' => array(
                        'fd' => array(
                                'id' => array('type' => 'int','precision' => 
'4','nullable' => False),
-                               'safety' => array('type' => 'int','precision' 
=> '4','nullable' => True),
-                               'aesthetics' => array('type' => 
'int','precision' => '4','nullable' => True),
-                               'indoor_climate' => array('type' => 
'int','precision' => '4','nullable' => True),
-                               'consequential_damage' => array('type' => 
'int','precision' => '4','nullable' => True),
-                               'user_gratification' => array('type' => 
'int','precision' => '4','nullable' => True),
-                               'residential_environment' => array('type' => 
'int','precision' => '4','nullable' => True),
-                               'authorities_demands' => array('type' => 
'int','precision' => '4','nullable' => True)
+                               'descr' => array('type' => 
'varchar','precision' => '50','nullable' => False),
+                               'priority_key' => array('type' => 
'int','precision' => '4','default' => '0','nullable' => True)
                        ),
                        'pk' => array('id'),
                        'fk' => array(),

====================================================
Index: property/setup/setup.inc.php
diff -u property/setup/setup.inc.php:1.21 property/setup/setup.inc.php:1.22
--- property/setup/setup.inc.php:1.21   Tue Sep 13 13:33:37 2005
+++ property/setup/setup.inc.php        Wed Sep 21 14:18:16 2005
@@ -13,7 +13,7 @@

        $setup_info['property']['name']      = 'property';
        $setup_info['property']['title']         = 'Property';
-       $setup_info['property']['version']   = '0.9.17.507';
+       $setup_info['property']['version']   = '0.9.17.508';
        $setup_info['property']['app_order'] = 8;
        $setup_info['property']['enable']    = 1;

@@ -119,7 +119,8 @@
                'fm_wo_h_deviation',
                'fm_key_loc',
                'fm_request',
-               'fm_request_priority_key',
+               'fm_request_condition_type',
+               'fm_request_condition',
                'fm_request_status',
                'fm_request_category',
                'fm_request_history',

====================================================
Index: property/setup/default_records.inc.php
diff -u property/setup/default_records.inc.php:1.17 
property/setup/default_records.inc.php:1.18
--- property/setup/default_records.inc.php:1.17 Fri May 20 13:13:45 2005
+++ property/setup/default_records.inc.php      Wed Sep 21 14:18:15 2005
@@ -111,10 +111,15 @@


 #
-# fm_request_priority_key
+# fm_request_condition_type
 #

-$GLOBALS['phpgw_setup']->oProc->query("INSERT INTO fm_request_priority_key 
(id, safety, aesthetics, indoor_climate, consequential_damage, 
user_gratification, residential_environment, authorities_demands) VALUES (0, 
12, 3, 4, 5, 6, 2, 50)");
+$GLOBALS['phpgw_setup']->oProc->query("INSERT INTO fm_request_condition_type 
(id, descr, priority_key) VALUES (1, 'safety', 10)");
+$GLOBALS['phpgw_setup']->oProc->query("INSERT INTO fm_request_condition_type 
(id, descr, priority_key) VALUES (2, 'aesthetics', 2)");
+$GLOBALS['phpgw_setup']->oProc->query("INSERT INTO fm_request_condition_type 
(id, descr, priority_key) VALUES (3, 'indoor climate', 5)");
+$GLOBALS['phpgw_setup']->oProc->query("INSERT INTO fm_request_condition_type 
(id, descr, priority_key) VALUES (4, 'consequential damage', 5)");
+$GLOBALS['phpgw_setup']->oProc->query("INSERT INTO fm_request_condition_type 
(id, descr, priority_key) VALUES (5, 'user gratification', 4)");
+$GLOBALS['phpgw_setup']->oProc->query("INSERT INTO fm_request_condition_type 
(id, descr, priority_key) VALUES (6, 'residential environment', 6)");


 #






reply via email to

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