[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Phpgroupware-cvs] property/setup tables_current.inc.php, 1.31 setup.inc
From: |
sigurdne |
Subject: |
[Phpgroupware-cvs] property/setup tables_current.inc.php, 1.31 setup.inc.php, 1.19 tables_update.inc.php, 1.10 default_records.inc.php, 1.15 |
Date: |
Wed, 18 May 2005 18:05:00 +0200 |
Update of property/setup
Modified Files:
Branch: MAIN
tables_current.inc.php lines: +94 -7
setup.inc.php lines: +6 -2
tables_update.inc.php lines: +134 -2
default_records.inc.php lines: +7 -3
Log Message:
History for locations
====================================================
Index: property/setup/tables_current.inc.php
diff -u property/setup/tables_current.inc.php:1.30
property/setup/tables_current.inc.php:1.31
--- property/setup/tables_current.inc.php:1.30 Fri May 13 12:17:25 2005
+++ property/setup/tables_current.inc.php Wed May 18 16:05:54 2005
@@ -232,13 +232,36 @@
'status' => array('type' => 'int','precision'
=> '4','nullable' => True),
'mva' => array('type' => 'int','precision' =>
'4','nullable' => True),
'remark' => array('type' => 'text','nullable'
=> True),
- 'kostra_id' => array('type' =>
'int','precision' => '4','nullable' => True)
+ 'kostra_id' => array('type' =>
'int','precision' => '4','nullable' => True),
+ 'change_type' => array('type' =>
'int','precision' => '4','nullable' => True),
),
'pk' => array('loc1'),
'fk' => array(),
'ix' => array('location_code'),
'uc' => array()
),
+ 'fm_location1_history' => array(
+ 'fd' => array(
+ 'location_code' => array('type' =>
'varchar','precision' => '16','nullable' => False),
+ 'loc1' => array('type' => 'varchar','precision'
=> '4','nullable' => False),
+ 'loc1_name' => array('type' =>
'varchar','precision' => '50','nullable' => True),
+ 'part_of_town_id' => array('type' =>
'int','precision' => '4','nullable' => True),
+ 'entry_date' => array('type' =>
'int','precision' => '4','nullable' => True),
+ 'category' => array('type' => 'int','precision'
=> '4','nullable' => True),
+ 'user_id' => array('type' => 'int','precision'
=> '4','nullable' => True),
+ 'owner_id' => array('type' => 'int','precision'
=> '4','nullable' => True),
+ 'status' => array('type' => 'int','precision'
=> '4','nullable' => True),
+ 'mva' => array('type' => 'int','precision' =>
'4','nullable' => True),
+ 'remark' => array('type' => 'text','nullable'
=> True),
+ 'kostra_id' => array('type' =>
'int','precision' => '4','nullable' => True),
+ 'change_type' => array('type' =>
'int','precision' => '4','nullable' => True),
+ 'exp_date' => array('type' =>
'timestamp','nullable' => True,'default' => 'current_timestamp')
+ ),
+ 'pk' => array(),
+ 'fk' => array(),
+ 'ix' => array(),
+ 'uc' => array()
+ ),
'fm_location1_category' => array(
'fd' => array(
'id' => array('type' => 'int','precision' =>
'4','nullable' => False),
@@ -259,13 +282,33 @@
'category' => array('type' => 'int','precision'
=> '4','nullable' => True),
'user_id' => array('type' => 'int','precision'
=> '4','nullable' => True),
'status' => array('type' => 'int','precision'
=> '4','nullable' => True),
- 'remark' => array('type' => 'text','nullable'
=> True)
+ 'remark' => array('type' => 'text','nullable'
=> True),
+ 'change_type' => array('type' =>
'int','precision' => '4','nullable' => True),
),
'pk' => array('loc1','loc2'),
'fk' => array('loc1' => 'fm_location1.loc1'),
'ix' => array('location_code'),
'uc' => array()
),
+ 'fm_location2_history' => array(
+ 'fd' => array(
+ 'location_code' => array('type' =>
'varchar','precision' => '50','nullable' => False),
+ 'loc1' => array('type' => 'varchar','precision'
=> '4','nullable' => False),
+ 'loc2' => array('type' => 'varchar','precision'
=> '4','nullable' => False),
+ 'loc2_name' => array('type' =>
'varchar','precision' => '50','nullable' => True),
+ 'entry_date' => array('type' =>
'int','precision' => '4','nullable' => True),
+ 'category' => array('type' => 'int','precision'
=> '4','nullable' => True),
+ 'user_id' => array('type' => 'int','precision'
=> '4','nullable' => True),
+ 'status' => array('type' => 'int','precision'
=> '4','nullable' => True),
+ 'remark' => array('type' => 'text','nullable'
=> True),
+ 'change_type' => array('type' =>
'int','precision' => '4','nullable' => True),
+ 'exp_date' => array('type' =>
'timestamp','nullable' => True,'default' => 'current_timestamp')
+ ),
+ 'pk' => array(),
+ 'fk' => array(),
+ 'ix' => array(),
+ 'uc' => array()
+ ),
'fm_location2_category' => array(
'fd' => array(
'id' => array('type' => 'int','precision' =>
'4','nullable' => False),
@@ -287,13 +330,34 @@
'category' => array('type' => 'int','precision'
=> '4','nullable' => True),
'user_id' => array('type' => 'int','precision'
=> '4','nullable' => True),
'status' => array('type' => 'int','precision'
=> '4','nullable' => True),
- 'remark' => array('type' => 'text','nullable'
=> True)
+ 'remark' => array('type' => 'text','nullable'
=> True),
+ 'change_type' => array('type' =>
'int','precision' => '4','nullable' => True),
),
'pk' => array('loc1','loc2','loc3'),
'fk' => array('loc1' => 'fm_location2.loc1','loc2' =>
'fm_location2.loc2'),
'ix' => array('location_code'),
'uc' => array()
),
+ 'fm_location3_history' => array(
+ 'fd' => array(
+ 'location_code' => array('type' =>
'varchar','precision' => '50','nullable' => False),
+ 'loc1' => array('type' => 'varchar','precision'
=> '4','nullable' => False),
+ 'loc2' => array('type' => 'varchar','precision'
=> '4','nullable' => False),
+ 'loc3' => array('type' => 'varchar','precision'
=> '4','nullable' => False),
+ 'loc3_name' => array('type' =>
'varchar','precision' => '50','nullable' => True),
+ 'entry_date' => array('type' =>
'int','precision' => '4','nullable' => True),
+ 'category' => array('type' => 'int','precision'
=> '4','nullable' => True),
+ 'user_id' => array('type' => 'int','precision'
=> '4','nullable' => True),
+ 'status' => array('type' => 'int','precision'
=> '4','nullable' => True),
+ 'remark' => array('type' => 'text','nullable'
=> True),
+ 'change_type' => array('type' =>
'int','precision' => '4','nullable' => True),
+ 'exp_date' => array('type' =>
'timestamp','nullable' => True,'default' => 'current_timestamp')
+ ),
+ 'pk' => array(),
+ 'fk' => array(),
+ 'ix' => array(),
+ 'uc' => array()
+ ),
'fm_location3_category' => array(
'fd' => array(
'id' => array('type' => 'int','precision' =>
'4','nullable' => False),
@@ -320,15 +384,38 @@
'user_id' => array('type' => 'int','precision'
=> '4','nullable' => True),
'tenant_id' => array('type' =>
'int','precision' => '4','nullable' => True),
'status' => array('type' => 'int','precision'
=> '4','nullable' => True),
- 'remark' => array('type' => 'text','nullable'
=> True)
+ 'remark' => array('type' => 'text','nullable'
=> True),
+ 'change_type' => array('type' =>
'int','precision' => '4','nullable' => True),
),
'pk' => array('loc1','loc2','loc3','loc4'),
'fk' => array('loc1' => 'fm_location3.loc1','loc2' =>
'fm_location3.loc2','loc3' => 'fm_location3.loc3'),
'ix' => array('location_code'),
'uc' => array()
),
-
-
+ 'fm_location4_history' => array(
+ 'fd' => array(
+ 'location_code' => array('type' =>
'varchar','precision' => '50','nullable' => False),
+ 'loc1' => array('type' => 'varchar','precision'
=> '4','nullable' => False),
+ 'loc2' => array('type' => 'varchar','precision'
=> '4','nullable' => False),
+ 'loc3' => array('type' => 'varchar','precision'
=> '4','nullable' => False),
+ 'loc4' => array('type' => 'varchar','precision'
=> '4','nullable' => False),
+ 'loc4_name' => array('type' =>
'varchar','precision' => '50','nullable' => True),
+ 'entry_date' => array('type' =>
'int','precision' => '4','nullable' => True),
+ 'category' => array('type' => 'int','precision'
=> '4','nullable' => True),
+ 'street_id' => array('type' =>
'int','precision' => '4','nullable' => True),
+ 'street_number' => array('type' =>
'varchar','precision' => '10','nullable' => True),
+ 'user_id' => array('type' => 'int','precision'
=> '4','nullable' => True),
+ 'tenant_id' => array('type' =>
'int','precision' => '4','nullable' => True),
+ 'status' => array('type' => 'int','precision'
=> '4','nullable' => True),
+ 'remark' => array('type' => 'text','nullable'
=> True),
+ 'change_type' => array('type' =>
'int','precision' => '4','nullable' => True),
+ 'exp_date' => array('type' =>
'timestamp','nullable' => True,'default' => 'current_timestamp')
+ ),
+ 'pk' => array(),
+ 'fk' => array(),
+ 'ix' => array(),
+ 'uc' => array()
+ ),
'fm_location4_category' => array(
'fd' => array(
'id' => array('type' => 'int','precision' =>
'4','nullable' => False),
====================================================
Index: property/setup/setup.inc.php
diff -u property/setup/setup.inc.php:1.18 property/setup/setup.inc.php:1.19
--- property/setup/setup.inc.php:1.18 Sun May 15 14:36:08 2005
+++ property/setup/setup.inc.php Wed May 18 16:05:54 2005
@@ -13,7 +13,7 @@
$setup_info['property']['name'] = 'property';
$setup_info['property']['title'] = 'Property';
- $setup_info['property']['version'] = '0.9.17.504';
+ $setup_info['property']['version'] = '0.9.17.505';
$setup_info['property']['app_order'] = 8;
$setup_info['property']['enable'] = 1;
@@ -85,12 +85,16 @@
'fm_district',
'fm_location1',
'fm_location1_category',
+ 'fm_location1_history',
'fm_location2',
'fm_location2_category',
+ 'fm_location2_history',
'fm_location3',
'fm_location3_category',
+ 'fm_location3_history',
'fm_location4',
'fm_location4_category',
+ 'fm_location4_history',
'fm_location_type',
'fm_location_attrib',
'fm_location_choice',
====================================================
Index: property/setup/tables_update.inc.php
diff -u property/setup/tables_update.inc.php:1.9
property/setup/tables_update.inc.php:1.10
--- property/setup/tables_update.inc.php:1.9 Thu May 12 21:26:28 2005
+++ property/setup/tables_update.inc.php Wed May 18 16:05:54 2005
@@ -177,7 +177,6 @@
$GLOBALS['phpgw_setup']->oProc->next_record();
$locations = $GLOBALS['phpgw_setup']->oProc->f(0);
-
for ($location_type=1; $location_type<($locations+1);
$location_type++)
{
$GLOBALS['phpgw_setup']->oProc->query("SELECT max(id)
as id FROM fm_location_attrib WHERE type_id = $location_type");
@@ -342,6 +341,139 @@
$GLOBALS['setup_info']['property']['currentver'] = '0.9.17.504';
return $GLOBALS['setup_info']['property']['currentver'];
}
+ /**
+ * Update property version from 0.9.17.504 to 0.9.17.505
+ */
+
+ $test[] = '0.9.17.504';
+ function property_upgrade0_9_17_504()
+ {
+ $GLOBALS['phpgw_setup']->oProc->query("UPDATE
fm_location_attrib SET custom = 1, input_text = 'Remark', statustext='Remark'
WHERE column_name = 'remark'");
+ $GLOBALS['phpgw_setup']->oProc->query("UPDATE
fm_location_attrib SET input_text = column_name, statustext = column_name WHERE
custom IS NULL");
+
+ $datatype_precision = array(
+ 'R' => 4,
+ 'LB' => 4,
+ 'AB' => 4,
+ 'VENDOR' => 4,
+ 'email' => 64
+ );
+
+ $datatype_text = array(
+ 'V' => 'varchar',
+ 'I' => 'int',
+ 'C' => 'char',
+ 'N' => 'decimal',
+ 'D' => 'timestamp',
+ 'T' => 'text',
+ 'R' => 'int',
+ 'CH' => 'text',
+ 'LB' => 'int',
+ 'AB' => 'int',
+ 'VENDOR' => 'int',
+ 'email' => 'varchar'
+ );
+
+ $datatype_text[$datatype];
+
+ $GLOBALS['phpgw_setup']->oProc->query("SELECT count(*) FROM
fm_location_type");
+ $GLOBALS['phpgw_setup']->oProc->next_record();
+ $locations = $GLOBALS['phpgw_setup']->oProc->f(0);
+
+ for ($location_type=1; $location_type<($locations+1);
$location_type++)
+ {
+ $GLOBALS['phpgw_setup']->oProc->query("SELECT
max(attrib_sort) as attrib_sort FROM fm_location_attrib WHERE type_id =
$location_type AND column_name = 'remark' AND attrib_sort IS NOT NULL");
+
+ $GLOBALS['phpgw_setup']->oProc->next_record();
+ $attrib_sort =
$GLOBALS['phpgw_setup']->oProc->f('attrib_sort')+1;
+
+
+ $GLOBALS['phpgw_setup']->oProc->query("UPDATE
fm_location_attrib SET attrib_sort = $attrib_sort WHERE type_id =
$location_type AND column_name = 'remark'");
+
+ if($location_type==1)
+ {
+ $attrib_sort++;
+
+ $GLOBALS['phpgw_setup']->oProc->query("UPDATE
fm_location_attrib SET attrib_sort = $attrib_sort WHERE type_id =
$location_type AND column_name = 'mva'");
+ $attrib_sort++;
+
+ $GLOBALS['phpgw_setup']->oProc->query("UPDATE
fm_location_attrib SET attrib_sort = $attrib_sort WHERE type_id =
$location_type AND column_name = 'kostra_id'");
+ }
+
+ $GLOBALS['phpgw_setup']->oProc->AddColumn('fm_location'
. $location_type,'change_type',array('type' => 'int','precision' =>
4,'nullable' => True));
+
+ $GLOBALS['phpgw_setup']->oProc->query("SELECT max(id)
as attrib_id FROM fm_location_attrib WHERE type_id = $location_type");
+
+ $GLOBALS['phpgw_setup']->oProc->next_record();
+ $attrib_id =
$GLOBALS['phpgw_setup']->oProc->f('attrib_id')+1;
+
+ $GLOBALS['phpgw_setup']->oProc->query("INSERT INTO
fm_location_attrib
(type_id,id,column_name,datatype,precision_,input_text,statustext,nullable,custom)"
+ . " VALUES ( $location_type,$attrib_id,
'change_type', 'I', 4, 'change_type','change_type','True',NULL)");
+
+ if($location_type==4)
+ {
+ $attrib_id++;
+ $GLOBALS['phpgw_setup']->oProc->query("INSERT
INTO fm_location_attrib
(type_id,id,column_name,datatype,precision_,input_text,statustext,nullable,custom)"
+ . " VALUES ( $location_type,$attrib_id,
'street_id', 'I', 4, 'street_id','street_id','True',NULL)");
+
+
+ $attrib_id++;
+ $GLOBALS['phpgw_setup']->oProc->query("INSERT
INTO fm_location_attrib
(type_id,id,column_name,datatype,precision_,input_text,statustext,nullable,custom)"
+ . " VALUES ( $location_type,$attrib_id,
'street_number', 'V', 10, 'street_number','street_number','True',NULL)");
+
+ $attrib_id++;
+ $GLOBALS['phpgw_setup']->oProc->query("INSERT
INTO fm_location_attrib
(type_id,id,column_name,datatype,precision_,input_text,statustext,nullable,custom)"
+ . " VALUES ( $location_type,$attrib_id,
'tenant_id', 'I', 4, 'tenant_id','tenant_id','True',NULL)");
+ }
+
+ $metadata =
$GLOBALS['phpgw_setup']->db->metadata('fm_location'.$location_type);
+
+ for ($i=0; $i<count($metadata); $i++)
+ {
+ $sql = "SELECT * FROM fm_location_attrib WHERE
type_id=$location_type AND column_name = '" . $metadata[$i]['name'] . "'";
+
$GLOBALS['phpgw_setup']->oProc->query($sql,__LINE__,__FILE__);
+
if($GLOBALS['phpgw_setup']->oProc->next_record())
+ {
+ if(!$precision =
$GLOBALS['phpgw_setup']->oProc->f('precision_'))
+ {
+ $precision =
$datatype_precision[$GLOBALS['phpgw_setup']->oProc->f('datatype')];
+ }
+
+
if($GLOBALS['phpgw_setup']->oProc->f('nullable')=='True')
+ {
+ $nullable=True;
+ }
+
+ $fd[$metadata[$i]['name']] = array(
+ 'type' =>
$datatype_text[$GLOBALS['phpgw_setup']->oProc->f('datatype')],
+ 'precision' =>
$precision,
+ 'nullable' => $nullable,
+ 'default' =>
stripslashes($GLOBALS['phpgw_setup']->oProc->f('default_value')),
+ 'scale' =>
$GLOBALS['phpgw_setup']->oProc->f('scale')
+ );
+ unset($precision);
+ unset($nullable);
+ }
+ }
+
+ $fd['exp_date'] = array('type' =>
'timestamp','nullable' => True,'default' => 'current_timestamp');
+
+ $GLOBALS['phpgw_setup']->oProc->CreateTable(
+ 'fm_location' . $location_type . '_history',
array(
+ 'fd' => $fd,
+ 'pk' => array(),
+ 'fk' => array(),
+ 'ix' => array(),
+ 'uc' => array()
+ )
+ );
+
+ unset($fd);
+ }
+
+ $GLOBALS['setup_info']['property']['currentver'] = '0.9.17.505';
+ return $GLOBALS['setup_info']['property']['currentver'];
+ }
?>
====================================================
Index: property/setup/default_records.inc.php
diff -u property/setup/default_records.inc.php:1.14
property/setup/default_records.inc.php:1.15
--- property/setup/default_records.inc.php:1.14 Fri May 13 12:17:25 2005
+++ property/setup/default_records.inc.php Wed May 18 16:05:54 2005
@@ -552,8 +552,12 @@
$GLOBALS['phpgw_setup']->oProc->query("INSERT INTO fm_location_attrib (
type_id, id, column_name, input_text, statustext, datatype, list, attrib_sort,
size, precision_, scale, default_value, nullable,custom) VALUES (1, 10, 'mva',
'mva', 'Status', 'I', NULL, 3, NULL, 4, NULL, NULL, 'True', 1)");
$GLOBALS['phpgw_setup']->oProc->query("INSERT INTO fm_location_attrib (
type_id, id, column_name, input_text, statustext, datatype, list, attrib_sort,
size, precision_, scale, default_value, nullable,custom) VALUES (1, 11,
'kostra_id', 'kostra_id', 'kostra_id', 'I', NULL, 4, NULL, 4, NULL, NULL,
'True', 1)");
-$GLOBALS['phpgw_setup']->oProc->query("INSERT INTO fm_location_attrib (
type_id, id, column_name, input_text, statustext, datatype, list, attrib_sort,
size, precision_, scale, default_value, nullable,custom) VALUES (1, 12,
'part_of_town_id', 'dummy', 'dummy', 'I', NULL, 5, NULL, 4, NULL, NULL, 'True',
NULL)");
-$GLOBALS['phpgw_setup']->oProc->query("INSERT INTO fm_location_attrib (
type_id, id, column_name, input_text, statustext, datatype, list, attrib_sort,
size, precision_, scale, default_value, nullable,custom) VALUES (1, 13,
'owner_id', 'dummy', 'dummy', 'I', NULL, 6, NULL, 4, NULL, NULL, 'True',
NULL)");
+$GLOBALS['phpgw_setup']->oProc->query("INSERT INTO fm_location_attrib (
type_id, id, column_name, input_text, statustext, datatype, list, attrib_sort,
size, precision_, scale, default_value, nullable,custom) VALUES (1, 12,
'part_of_town_id', 'part_of_town_id', 'part_of_town_id', 'I', NULL, 5, NULL, 4,
NULL, NULL, 'True', NULL)");
+$GLOBALS['phpgw_setup']->oProc->query("INSERT INTO fm_location_attrib (
type_id, id, column_name, input_text, statustext, datatype, list, attrib_sort,
size, precision_, scale, default_value, nullable,custom) VALUES (1, 13,
'owner_id', 'owner_id', 'owner_id', 'I', NULL, 6, NULL, 4, NULL, NULL, 'True',
NULL)");
+
+$GLOBALS['phpgw_setup']->oProc->query("INSERT INTO fm_location_attrib (
type_id, id, column_name, input_text, statustext, datatype, list, attrib_sort,
size, precision_, scale, default_value, nullable,custom) VALUES (4, 13,
'street_id', 'street_id', 'street_id', 'I', NULL, NULL, NULL, 4, NULL, NULL,
'True', NULL)");
+$GLOBALS['phpgw_setup']->oProc->query("INSERT INTO fm_location_attrib (
type_id, id, column_name, input_text, statustext, datatype, list, attrib_sort,
size, precision_, scale, default_value, nullable,custom) VALUES (4, 13,
'street_number', 'street_number', 'street_number', 'I', NULL, NULL, NULL, 4,
NULL, NULL, 'True', NULL)");
+$GLOBALS['phpgw_setup']->oProc->query("INSERT INTO fm_location_attrib (
type_id, id, column_name, input_text, statustext, datatype, list, attrib_sort,
size, precision_, scale, default_value, nullable,custom) VALUES (4, 13,
'tenant_id', 'tenant_id', 'tenant_id', 'I', NULL, NULL, NULL, 4, NULL, NULL,
'True', NULL)");
#
# Dumping data for table fm_location_choice
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Phpgroupware-cvs] property/setup tables_current.inc.php, 1.31 setup.inc.php, 1.19 tables_update.inc.php, 1.10 default_records.inc.php, 1.15,
sigurdne <=