[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Phpgroupware-cvs] property setup/tables_update.inc.php setup/setu...
From: |
Sigurd Nes |
Subject: |
[Phpgroupware-cvs] property setup/tables_update.inc.php setup/setu... |
Date: |
Wed, 25 Jan 2006 18:19:12 +0000 |
CVSROOT: /sources/phpgroupware
Module name: property
Branch:
Changes by: Sigurd Nes <address@hidden> 06/01/25 18:19:12
Modified files:
setup : tables_update.inc.php setup.inc.php
inc/export : Agresso
inc : class.boXport.inc.php class.uiXport.inc.php
templates/base : invoice.xsl
templates/default: invoice.xsl
Log message:
no message
CVSWeb URLs:
http://cvs.savannah.gnu.org/viewcvs/phpgroupware/property/setup/tables_update.inc.php.diff?tr1=1.19&tr2=1.20&r1=text&r2=text
http://cvs.savannah.gnu.org/viewcvs/phpgroupware/property/setup/setup.inc.php.diff?tr1=1.24&tr2=1.25&r1=text&r2=text
http://cvs.savannah.gnu.org/viewcvs/phpgroupware/property/inc/export/Agresso.diff?tr1=1.27&tr2=1.28&r1=text&r2=text
http://cvs.savannah.gnu.org/viewcvs/phpgroupware/property/inc/class.boXport.inc.php.diff?tr1=1.9&tr2=1.10&r1=text&r2=text
http://cvs.savannah.gnu.org/viewcvs/phpgroupware/property/inc/class.uiXport.inc.php.diff?tr1=1.13&tr2=1.14&r1=text&r2=text
http://cvs.savannah.gnu.org/viewcvs/phpgroupware/property/templates/base/invoice.xsl.diff?tr1=1.4&tr2=1.5&r1=text&r2=text
http://cvs.savannah.gnu.org/viewcvs/phpgroupware/property/templates/default/invoice.xsl.diff?tr1=1.11&tr2=1.12&r1=text&r2=text
Patches:
Index: property/inc/class.boXport.inc.php
diff -u property/inc/class.boXport.inc.php:1.9
property/inc/class.boXport.inc.php:1.10
--- property/inc/class.boXport.inc.php:1.9 Thu May 12 21:26:28 2005
+++ property/inc/class.boXport.inc.php Wed Jan 25 18:19:12 2006
@@ -8,7 +8,7 @@
* @internal Development of this application was funded by
http://www.bergen.kommune.no/bbb_/ekstern/
* @package property
* @subpackage admin
- * @version $Id: class.boXport.inc.php,v 1.9 2005/05/12 21:26:28
sigurdne Exp $
+ * @version $Id: class.boXport.inc.php,v 1.10 2006/01/25 18:19:12
sigurdne Exp $
*/
/**
@@ -251,11 +251,12 @@
$conv_type = $data['conv_type'];
$download = $data['download'];
$pre_transfer = $data['pre_transfer'];
+ $force_period_year = $data['force_period_year'];
include(PHPGW_SERVER_ROOT.'/'.'property'.'/inc/export/'
. $conv_type);
$invoice = new export_conv;
- $buffer = $invoice->overfor($download,$pre_transfer);
+ $buffer =
$invoice->overfor($download,$pre_transfer,$force_period_year);
return $buffer;
}
Index: property/inc/class.uiXport.inc.php
diff -u property/inc/class.uiXport.inc.php:1.13
property/inc/class.uiXport.inc.php:1.14
--- property/inc/class.uiXport.inc.php:1.13 Mon Oct 31 18:58:12 2005
+++ property/inc/class.uiXport.inc.php Wed Jan 25 18:19:12 2006
@@ -8,7 +8,7 @@
* @internal Development of this application was funded by
http://www.bergen.kommune.no/bbb_/ekstern/
* @package property
* @subpackage admin
- * @version $Id: class.uiXport.inc.php,v 1.13 2005/10/31 18:58:12
sigurdne Exp $
+ * @version $Id: class.uiXport.inc.php,v 1.14 2006/01/25 18:19:12
sigurdne Exp $
*/
/**
@@ -524,7 +524,7 @@
}
elseif($values['conv_type'] &&
!$values['file']):
{
- $receipt =
$this->bo->export(array('conv_type'=>$values['conv_type'],'download'=>$values['download']));
+ $receipt =
$this->bo->export(array('conv_type'=>$values['conv_type'],'download'=>$values['download'],'force_period_year'=>$values['force_period_year']));
if(!$values['download'])
{
$GLOBALS['phpgw_info']['flags'][noheader] = True;
@@ -551,9 +551,17 @@
$msgbox_data = $this->bocommon->msgbox_data($receipt);
+ $force_period_year= array(
+ 'id' => date(Y) -1
+ );
+
$data = array
(
'msgbox_data'
=> $GLOBALS['phpgw']->common->msgbox($msgbox_data),
+ 'force_period_year'
=> $force_period_year,
+ 'lang_force_period_year' =>
lang('Force year for period'),
+ 'lang_force_period_year_statustext'
=> lang('Force year for period'),
+ 'lang_select_year'
=> lang('select year'),
'links'
=> $links,
'lang_select_conv'
=> lang('Select conversion'),
'conv_list'
=> $this->bo->select_export_conv($values['conv_type']),
Index: property/inc/export/Agresso
diff -u property/inc/export/Agresso:1.27 property/inc/export/Agresso:1.28
--- property/inc/export/Agresso:1.27 Mon Oct 31 18:58:12 2005
+++ property/inc/export/Agresso Wed Jan 25 18:19:12 2006
@@ -8,7 +8,7 @@
* @internal Development of this application was funded by
http://www.bergen.kommune.no/bbb_/ekstern/
* @package property
* @subpackage export
- * @version $Id: Agresso,v 1.27 2005/10/31 18:58:12 sigurdne Exp $
+ * @version $Id: Agresso,v 1.28 2006/01/25 18:19:12 sigurdne Exp $
*/
/**
@@ -287,7 +287,7 @@
}
- function overfor($download,$pre_transfer='')
+ function
overfor($download,$pre_transfer='',$force_period_year='')
{
// $download = 'on';
@@ -326,7 +326,7 @@
for ($i=0;$i<count($periode);$i++)
{
- $receipt['message'][]= array('msg' =>
$this->OverforPeriode($batchid,$periode[$i],$download,$pre_transfer));
+ $receipt['message'][]= array('msg' =>
$this->OverforPeriode($batchid,$periode[$i],$download,$pre_transfer,$force_period_year));
}
@@ -502,7 +502,7 @@
return False;
}
- function
OverforPeriode($batchid,$periode,$download,$pre_transfer='')
+ function
OverforPeriode($batchid,$periode,$download,$pre_transfer='',$force_period_year='')
{
$BilagId = 'NULL';
@@ -611,7 +611,16 @@
}
else
{
- $Periode =
sprintf("%06s",date(Y,strtotime($oRsBilag[$k]['fakturadato'])) .
sprintf("%02d",$periode));// verdi: Periode, type: i4, plass: 276 - 281
+
+ if($force_period_year)
+ {
+ $Periode =
sprintf("%06s",$force_period_year . sprintf("%02d",$periode));// verdi:
Periode, type: i4, plass: 276 - 281
+ }
+ else
+ {
+ $Periode =
sprintf("%06s",date(Y,strtotime($oRsBilag[$k]['fakturadato'])) .
sprintf("%02d",$periode));// verdi: Periode, type: i4, plass: 276 - 281
+ }
+
$Bilagsart =
sprintf("%2s",'FD');// verdi: , type: c2, plass: 15 - 16
$Forfall =
date(Ymd,strtotime($oRsBilag[$k]['forfallsdato']));// verdi: Forfallsdato ,
type: date, plass: 298 - 305
}
Index: property/setup/setup.inc.php
diff -u property/setup/setup.inc.php:1.24 property/setup/setup.inc.php:1.25
--- property/setup/setup.inc.php:1.24 Mon Oct 31 18:58:12 2005
+++ property/setup/setup.inc.php Wed Jan 25 18:19:12 2006
@@ -8,12 +8,12 @@
* @internal Development of this application was funded by
http://www.bergen.kommune.no/bbb_/ekstern/
* @package property
* @subpackage setup
- * @version $Id: setup.inc.php,v 1.24 2005/10/31 18:58:12 sigurdne Exp $
+ * @version $Id: setup.inc.php,v 1.25 2006/01/25 18:19:12 sigurdne Exp $
*/
$setup_info['property']['name'] = 'property';
$setup_info['property']['title'] = 'Property';
- $setup_info['property']['version'] = '0.9.17.510';
+ $setup_info['property']['version'] = '0.9.17.511';
$setup_info['property']['app_order'] = 8;
$setup_info['property']['enable'] = 1;
Index: property/setup/tables_update.inc.php
diff -u property/setup/tables_update.inc.php:1.19
property/setup/tables_update.inc.php:1.20
--- property/setup/tables_update.inc.php:1.19 Mon Oct 31 19:02:12 2005
+++ property/setup/tables_update.inc.php Wed Jan 25 18:19:12 2006
@@ -1,760 +1,773 @@
-<?php
- /**
- * phpGroupWare - property: a Facilities Management System.
- *
- * @author Sigurd Nes <address@hidden>
- * @copyright Copyright (C) 2003-2005 Free Software Foundation, Inc.
http://www.fsf.org/
- * @license http://www.gnu.org/licenses/gpl.html GNU General Public
License
- * @internal Development of this application was funded by
http://www.bergen.kommune.no/bbb_/ekstern/
- * @package property
- * @subpackage setup
- * @version $Id: tables_update.inc.php,v 1.19 2005/10/31 19:02:12
sigurdne Exp $
- */
-
- /**
- * Update property version from 0.9.17.500 to 0.9.17.501
- */
-
- $test[] = '0.9.17.500';
- function property_upgrade0_9_17_500()
- {
- $GLOBALS['phpgw_setup']->oProc->CreateTable(
- 'fm_origin', array(
- 'fd' => array(
- 'origin' => array('type' =>
'varchar','precision' => '12','nullable' => False),
- 'origin_id' => array('type' =>
'int','precision' => '4','nullable' => False),
- 'destination' => array('type' =>
'varchar','precision' => '12','nullable' => False),
- 'destination_id' => array('type' =>
'int','precision' => '4','nullable' => False),
- 'user_id' => array('type' =>
'int','precision' => '4','nullable' => True),
- 'entry_date' => array('type' =>
'int','precision' => '4','nullable' => True)
- ),
- 'pk' =>
array('origin','origin_id','destination','destination_id'),
- 'fk' => array(),
- 'ix' => array(),
- 'uc' => array()
- )
- );
-
- $GLOBALS['phpgw_setup']->oProc->query("SELECT * FROM
fm_request_origin");
- while ($GLOBALS['phpgw_setup']->oProc->next_record())
- {
- $origin[]=array(
- 'origin' =>
$GLOBALS['phpgw_setup']->oProc->f('origin'),
- 'origin_id' =>
$GLOBALS['phpgw_setup']->oProc->f('origin_id'),
- 'destination'=> 'request',
- 'destination_id' =>
$GLOBALS['phpgw_setup']->oProc->f('request_id'),
- 'entry_date' =>
$GLOBALS['phpgw_setup']->oProc->f('entry_date'),
- );
- }
-
-
- $GLOBALS['phpgw_setup']->oProc->query("SELECT * FROM
fm_project_origin");
- while ($GLOBALS['phpgw_setup']->oProc->next_record())
- {
- $origin[]=array(
- 'origin' =>
$GLOBALS['phpgw_setup']->oProc->f('origin'),
- 'origin_id' =>
$GLOBALS['phpgw_setup']->oProc->f('origin_id'),
- 'destination'=> 'project',
- 'destination_id' =>
$GLOBALS['phpgw_setup']->oProc->f('project_id'),
- 'entry_date' =>
$GLOBALS['phpgw_setup']->oProc->f('entry_date'),
- );
- }
-
- $GLOBALS['phpgw_setup']->oProc->query("SELECT * FROM
fm_entity_origin");
- while ($GLOBALS['phpgw_setup']->oProc->next_record())
- {
- $origin[]=array(
- 'origin' =>
$GLOBALS['phpgw_setup']->oProc->f('origin'),
- 'origin_id' =>
$GLOBALS['phpgw_setup']->oProc->f('origin_id'),
- 'destination'=> 'entity_' .
$GLOBALS['phpgw_setup']->oProc->f('entity_id') . '_' .
$GLOBALS['phpgw_setup']->oProc->f('cat_id'),
- 'destination_id' =>
$GLOBALS['phpgw_setup']->oProc->f('id'),
- 'entry_date' =>
$GLOBALS['phpgw_setup']->oProc->f('entry_date'),
- );
- }
-
- $rec_count = count($origin);
-
-
- for($i=0;$i<$rec_count;$i++)
- {
- $GLOBALS['phpgw_setup']->oProc->query("INSERT INTO
fm_origin(origin,origin_id,destination,destination_id,entry_date) "
- . "VALUES('"
- .$origin[$i]['origin']."','"
- .$origin[$i]['origin_id']."','"
- .$origin[$i]['destination']."','"
- .$origin[$i]['destination_id']."','"
- .$origin[$i]['entry_date']."')");
- }
-
- $GLOBALS['phpgw_setup']->oProc->DropTable('fm_request_origin');
- $GLOBALS['phpgw_setup']->oProc->DropTable('fm_project_origin');
- $GLOBALS['phpgw_setup']->oProc->DropTable('fm_entity_origin');
-
- $GLOBALS['setup_info']['property']['currentver'] = '0.9.17.501';
- return $GLOBALS['setup_info']['property']['currentver'];
- }
-
- /**
- * Update property version from 0.9.17.501 to 0.9.17.502
- */
-
- $test[] = '0.9.17.501';
- function property_upgrade0_9_17_501()
- {
-
$GLOBALS['phpgw_setup']->oProc->AlterColumn('fm_request','descr',array('type'
=> 'text','nullable' => True));
- $GLOBALS['setup_info']['property']['currentver'] = '0.9.17.502';
- return $GLOBALS['setup_info']['property']['currentver'];
- }
-
- /**
- * Update property version from 0.9.17.502 to 0.9.17.503
- */
-
- $test[] = '0.9.17.502';
- function property_upgrade0_9_17_502()
- {
-
$GLOBALS['phpgw_setup']->oProc->AlterColumn('fm_acl_location','id',array('type'
=> 'varchar','precision' => '20','nullable' => False));
- $GLOBALS['phpgw_setup']->oProc->query("INSERT INTO
fm_acl_location (id, descr) VALUES ('.tenant_claim', 'Tenant claim')");
-
- $GLOBALS['phpgw_setup']->oProc->CreateTable(
- 'fm_tenant_claim_category', array(
- 'fd' => array(
- 'id' => array('type' =>
'int','precision' => '4','nullable' => False),
- 'descr' => array('type' =>
'varchar','precision' => '255','nullable' => True)
- ),
- 'pk' => array('id'),
- 'fk' => array(),
- 'ix' => array(),
- 'uc' => array()
- )
- );
-
- $GLOBALS['phpgw_setup']->oProc->query("INSERT INTO
fm_tenant_claim_category (id, descr) VALUES (1, 'Type 1')");
- $GLOBALS['phpgw_setup']->oProc->query("INSERT INTO
fm_tenant_claim_category (id, descr) VALUES (2, 'Type 2')");
-
- $GLOBALS['phpgw_setup']->oProc->CreateTable(
- 'fm_tenant_claim', array(
- 'fd' => array(
- 'id' => array('type' =>
'auto','precision' => '4','nullable' => False),
- 'project_id' => array('type' =>
'int','precision' => '4','nullable' => False),
- 'tenant_id' => array('type' =>
'int','precision' => '4','nullable' => False),
- 'amount' => array('type' =>
'decimal','precision' => '20','scale' => '2','default' => '0','nullable' =>
True),
- 'b_account_id' => array('type' =>
'int','precision' => '4','nullable' => True),
- 'category' => array('type' =>
'int','precision' => '4','nullable' => False),
- 'status' => array('type' =>
'varchar','precision' => '8','nullable' => True),
- 'remark' => array('type' =>
'text','nullable' => True),
- 'user_id' => array('type' =>
'int','precision' => '4','nullable' => False),
- 'entry_date' => array('type' =>
'int','precision' => '4','nullable' => True)
- ),
- 'pk' => array('id'),
- 'fk' => array(),
- 'ix' => array(),
- 'uc' => array()
- )
- );
-
-
$GLOBALS['phpgw_setup']->oProc->AddColumn('fm_workorder','claim_issued',array('type'
=> 'int','precision' => 2,'nullable' => True));
-
- $GLOBALS['setup_info']['property']['currentver'] = '0.9.17.503';
- return $GLOBALS['setup_info']['property']['currentver'];
- }
-
- /**
- * Update property version from 0.9.17.503 to 0.9.17.504
- */
-
- $test[] = '0.9.17.503';
- function property_upgrade0_9_17_503()
- {
-
$GLOBALS['phpgw_setup']->oProc->AddColumn('fm_location_type','pk',array('type'
=> 'text','nullable' => True));
-
$GLOBALS['phpgw_setup']->oProc->AddColumn('fm_location_type','ix',array('type'
=> 'text','nullable' => True));
-
$GLOBALS['phpgw_setup']->oProc->AddColumn('fm_location_type','uc',array('type'
=> 'text','nullable' => True));
-
$GLOBALS['phpgw_setup']->oProc->AddColumn('fm_location_attrib','custom',array('type'
=> 'int','precision' => 4,'nullable' => True));
-
- $GLOBALS['phpgw_setup']->oProc->query("UPDATE
fm_location_attrib SET custom = 1");
-
- $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(id)
as id FROM fm_location_attrib WHERE type_id = $location_type");
- $GLOBALS['phpgw_setup']->oProc->next_record();
- $id = $GLOBALS['phpgw_setup']->oProc->f('id');
- $id++;
-
- $default_attrib['id'][]= $id;
- $default_attrib['column_name'][]= 'location_code';
- $default_attrib['type'][]='V';
- $default_attrib['precision'][] =4*$location_type;
- $default_attrib['nullable'][] ='False';
- $default_attrib['input_text'][] ='dummy';
- $default_attrib['statustext'][] ='dummy';
- $default_attrib['custom'][] ='NULL';
- $id++;
-
- $default_attrib['id'][]= $id;
- $default_attrib['column_name'][]= 'loc' .
$location_type . '_name';
- $default_attrib['type'][]='V';
- $default_attrib['precision'][] =50;
- $default_attrib['nullable'][] ='True';
- $default_attrib['input_text'][] ='dummy';
- $default_attrib['statustext'][] ='dummy';
- $default_attrib['custom'][] ='NULL';
- $id++;
-
- $default_attrib['id'][]= $id;
- $default_attrib['column_name'][]= 'entry_date';
- $default_attrib['type'][]='I';
- $default_attrib['precision'][] =4;
- $default_attrib['nullable'][] ='True';
- $default_attrib['input_text'][] ='dummy';
- $default_attrib['statustext'][] ='dummy';
- $default_attrib['custom'][] ='NULL';
- $id++;
-
- $default_attrib['id'][]= $id;
- $default_attrib['column_name'][]= 'category';
- $default_attrib['type'][]='I';
- $default_attrib['precision'][] =4;
- $default_attrib['nullable'][] ='False';
- $default_attrib['input_text'][] ='dummy';
- $default_attrib['statustext'][] ='dummy';
- $default_attrib['custom'][] ='NULL';
- $id++;
-
- $default_attrib['id'][]= $id;
- $default_attrib['column_name'][]= 'user_id';
- $default_attrib['type'][]='I';
- $default_attrib['precision'][] =4;
- $default_attrib['nullable'][] ='False';
- $default_attrib['input_text'][] ='dummy';
- $default_attrib['statustext'][] ='dummy';
- $default_attrib['custom'][] ='NULL';
- $id++;
-
- $default_attrib['id'][]= $id;
- $default_attrib['column_name'][]= 'remark';
- $default_attrib['type'][]='T';
- $default_attrib['precision'][] = 'NULL';
- $default_attrib['nullable'][] ='False';
- $default_attrib['input_text'][] ='dummy';
- $default_attrib['statustext'][] ='dummy';
- $default_attrib['custom'][] ='NULL';
- $id++;
-
- for ($i=1; $i<$location_type+1; $i++)
- {
- $pk[$i-1]= 'loc' . $i;
-
- $default_attrib['id'][]= $id;
- $default_attrib['column_name'][]= 'loc' . $i;
- $default_attrib['type'][]='V';
- $default_attrib['precision'][] =4;
- $default_attrib['nullable'][] ='False';
- $default_attrib['input_text'][] ='dummy';
- $default_attrib['statustext'][] ='dummy';
- $default_attrib['custom'][] ='NULL';
- $id++;
- }
-
- if ($location_type==1)
- {
- $default_attrib['id'][]= $id;
- $default_attrib['column_name'][]= 'mva';
- $default_attrib['type'][]='I';
- $default_attrib['precision'][] =4;
- $default_attrib['nullable'][] ='True';
- $default_attrib['input_text'][] ='mva';
- $default_attrib['statustext'][] ='mva';
- $default_attrib['custom'][] = 1;
- $id++;
-
- $default_attrib['id'][]= $id;
- $default_attrib['column_name'][]= 'kostra_id';
- $default_attrib['type'][]='I';
- $default_attrib['precision'][] =4;
- $default_attrib['nullable'][] ='True';
- $default_attrib['input_text'][] ='kostra_id';
- $default_attrib['statustext'][] ='kostra_id';
- $default_attrib['custom'][] = 1;
- $id++;
-
- $default_attrib['id'][]= $id;
- $default_attrib['column_name'][]=
'part_of_town_id';
- $default_attrib['type'][]='I';
- $default_attrib['precision'][] =4;
- $default_attrib['nullable'][] ='True';
- $default_attrib['input_text'][] ='dummy';
- $default_attrib['statustext'][] ='dummy';
- $default_attrib['custom'][] ='NULL';
- $id++;
-
- $default_attrib['id'][]= $id;
- $default_attrib['column_name'][]= 'owner_id';
- $default_attrib['type'][]='I';
- $default_attrib['precision'][] =4;
- $default_attrib['nullable'][] ='True';
- $default_attrib['input_text'][] ='dummy';
- $default_attrib['statustext'][] ='dummy';
- $default_attrib['custom'][] ='NULL';
- $id++;
- }
-
- if($location_type>1)
- {
- $fk_table='fm_location'. ($location_type-1);
-
- for ($i=1; $i<$standard['id']; $i++)
- {
- $fk['loc' . $i] = $fk_table . '.loc' .
$i;
- }
- }
-
- $ix = array('location_code');
-
- $GLOBALS['phpgw_setup']->oProc->query("UPDATE
fm_location_type SET "
- . "pk ='" . implode(',',$pk) . "',"
- . "ix ='" . implode(',',$ix) . "' WHERE id =
$location_type");
-
-
- for ($i=0;$i<count($default_attrib['id']);$i++)
- {
- $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,'"
- . $default_attrib['id'][$i] . "','"
- . $default_attrib['column_name'][$i] .
"','"
- . $default_attrib['type'][$i] . "',"
- . $default_attrib['precision'][$i] .
",'"
- . $default_attrib['input_text'][$i] .
"','"
- . $default_attrib['statustext'][$i] .
"','"
- . $default_attrib['nullable'][$i] . "',"
- . $default_attrib['custom'][$i] . ")");
- }
-
- unset($pk);
- unset($ix);
- unset($default_attrib);
- }
-
- $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'];
- }
-
- /**
- * Update property version from 0.9.17.505 to 0.9.17.506
- */
-
- $test[] = '0.9.17.505';
- function property_upgrade0_9_17_505()
- {
-
$GLOBALS['phpgw_setup']->oProc->AddColumn('fm_wo_hours','category',array('type'
=> 'int','precision' => 4,'nullable' => True));
-
- $GLOBALS['phpgw_setup']->oProc->CreateTable(
- 'fm_wo_hours_category', array(
- 'fd' => array(
- 'id' => array('type' =>
'int','precision' => '4','nullable' => False),
- 'descr' => array('type' =>
'varchar','precision' => '255','nullable' => False)
- ),
- 'pk' => array('id'),
- 'fk' => array(),
- 'ix' => array(),
- 'uc' => array()
- )
- );
-
- $GLOBALS['setup_info']['property']['currentver'] = '0.9.17.506';
- return $GLOBALS['setup_info']['property']['currentver'];
- }
- /**
- * Update property version from 0.9.17.506 to 0.9.17.507
- */
-
- $test[] = '0.9.17.506';
- function property_upgrade0_9_17_506()
- {
-
$GLOBALS['phpgw_setup']->oProc->AlterColumn('fm_request','d_safety',array('type'
=> 'int','precision' => '4','default' => '0','nullable' => True));
-
$GLOBALS['phpgw_setup']->oProc->AlterColumn('fm_request','d_aesthetics',array('type'
=> 'int','precision' => '4','default' => '0','nullable' => True));
-
$GLOBALS['phpgw_setup']->oProc->AlterColumn('fm_request','d_indoor_climate',array('type'
=> 'int','precision' => '4','default' => '0','nullable' => True));
-
$GLOBALS['phpgw_setup']->oProc->AlterColumn('fm_request','d_consequential_damage',array('type'
=> 'int','precision' => '4','default' => '0','nullable' => True));
-
$GLOBALS['phpgw_setup']->oProc->AlterColumn('fm_request','d_user_gratification',array('type'
=> 'int','precision' => '4','default' => '0','nullable' => True));
-
$GLOBALS['phpgw_setup']->oProc->AlterColumn('fm_request','d_residential_environment',array('type'
=> 'int','precision' => '4','default' => '0','nullable' => True));
-
$GLOBALS['phpgw_setup']->oProc->AlterColumn('fm_request','p_safety',array('type'
=> 'int','precision' => '4','default' => '0','nullable' => True));
-
$GLOBALS['phpgw_setup']->oProc->AlterColumn('fm_request','p_aesthetics',array('type'
=> 'int','precision' => '4','default' => '0','nullable' => True));
-
$GLOBALS['phpgw_setup']->oProc->AlterColumn('fm_request','p_indoor_climate',array('type'
=> 'int','precision' => '4','default' => '0','nullable' => True));
-
$GLOBALS['phpgw_setup']->oProc->AlterColumn('fm_request','p_consequential_damage',array('type'
=> 'int','precision' => '4','default' => '0','nullable' => True));
-
$GLOBALS['phpgw_setup']->oProc->AlterColumn('fm_request','p_user_gratification',array('type'
=> 'int','precision' => '4','default' => '0','nullable' => True));
-
$GLOBALS['phpgw_setup']->oProc->AlterColumn('fm_request','p_residential_environment',array('type'
=> 'int','precision' => '4','default' => '0','nullable' => True));
-
$GLOBALS['phpgw_setup']->oProc->AlterColumn('fm_request','c_safety',array('type'
=> 'int','precision' => '4','default' => '0','nullable' => True));
-
$GLOBALS['phpgw_setup']->oProc->AlterColumn('fm_request','c_aesthetics',array('type'
=> 'int','precision' => '4','default' => '0','nullable' => True));
-
$GLOBALS['phpgw_setup']->oProc->AlterColumn('fm_request','c_indoor_climate',array('type'
=> 'int','precision' => '4','default' => '0','nullable' => True));
-
$GLOBALS['phpgw_setup']->oProc->AlterColumn('fm_request','c_consequential_damage',array('type'
=> 'int','precision' => '4','default' => '0','nullable' => True));
-
$GLOBALS['phpgw_setup']->oProc->AlterColumn('fm_request','c_user_gratification',array('type'
=> 'int','precision' => '4','default' => '0','nullable' => True));
-
$GLOBALS['phpgw_setup']->oProc->AlterColumn('fm_request','c_residential_environment',array('type'
=> 'int','precision' => '4','default' => '0','nullable' => True));
-
$GLOBALS['phpgw_setup']->oProc->AlterColumn('fm_request','authorities_demands',array('type'
=> 'int','precision' => '2','default' => '0','nullable' => True));
-
$GLOBALS['phpgw_setup']->oProc->AlterColumn('fm_request','score',array('type'
=> 'int','precision' => '4','default' => '0','nullable' => True));
-
- $GLOBALS['phpgw_setup']->oProc->query("UPDATE fm_request SET
d_safety = 0 WHERE d_safety IS NULL ");
- $GLOBALS['phpgw_setup']->oProc->query("UPDATE fm_request SET
d_aesthetics = 0 WHERE d_aesthetics IS NULL ");
- $GLOBALS['phpgw_setup']->oProc->query("UPDATE fm_request SET
d_indoor_climate = 0 WHERE d_indoor_climate IS NULL ");
- $GLOBALS['phpgw_setup']->oProc->query("UPDATE fm_request SET
d_consequential_damage = 0 WHERE d_consequential_damage IS NULL ");
- $GLOBALS['phpgw_setup']->oProc->query("UPDATE fm_request SET
d_user_gratification = 0 WHERE d_user_gratification IS NULL ");
- $GLOBALS['phpgw_setup']->oProc->query("UPDATE fm_request SET
d_residential_environment = 0 WHERE d_residential_environment IS NULL ");
- $GLOBALS['phpgw_setup']->oProc->query("UPDATE fm_request SET
p_safety = 0 WHERE p_safety IS NULL ");
- $GLOBALS['phpgw_setup']->oProc->query("UPDATE fm_request SET
p_aesthetics = 0 WHERE p_aesthetics IS NULL ");
- $GLOBALS['phpgw_setup']->oProc->query("UPDATE fm_request SET
p_indoor_climate = 0 WHERE p_indoor_climate IS NULL ");
- $GLOBALS['phpgw_setup']->oProc->query("UPDATE fm_request SET
p_consequential_damage = 0 WHERE p_consequential_damage IS NULL ");
- $GLOBALS['phpgw_setup']->oProc->query("UPDATE fm_request SET
p_user_gratification = 0 WHERE p_user_gratification IS NULL ");
- $GLOBALS['phpgw_setup']->oProc->query("UPDATE fm_request SET
p_residential_environment = 0 WHERE p_residential_environment IS NULL ");
- $GLOBALS['phpgw_setup']->oProc->query("UPDATE fm_request SET
c_safety = 0 WHERE c_safety IS NULL ");
- $GLOBALS['phpgw_setup']->oProc->query("UPDATE fm_request SET
c_aesthetics = 0 WHERE c_aesthetics IS NULL ");
- $GLOBALS['phpgw_setup']->oProc->query("UPDATE fm_request SET
c_indoor_climate = 0 WHERE c_indoor_climate IS NULL ");
- $GLOBALS['phpgw_setup']->oProc->query("UPDATE fm_request SET
c_consequential_damage = 0 WHERE c_consequential_damage IS NULL ");
- $GLOBALS['phpgw_setup']->oProc->query("UPDATE fm_request SET
c_user_gratification = 0 WHERE c_user_gratification IS NULL ");
- $GLOBALS['phpgw_setup']->oProc->query("UPDATE fm_request SET
c_residential_environment = 0 WHERE c_residential_environment IS NULL ");
- $GLOBALS['phpgw_setup']->oProc->query("UPDATE fm_request SET
authorities_demands = 0 WHERE authorities_demands IS NULL ");
- $GLOBALS['phpgw_setup']->oProc->query("UPDATE fm_request SET
score = 0 WHERE score IS NULL ");
- $GLOBALS['phpgw_setup']->oProc->query("UPDATE fm_workorder SET
act_mtrl_cost = 0 WHERE act_mtrl_cost IS NULL ");
- $GLOBALS['phpgw_setup']->oProc->query("UPDATE fm_workorder SET
act_vendor_cost = 0 WHERE act_vendor_cost IS NULL ");
-
- $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'];
-
-
-
- $sql = "SELECT sum(priority_key * ( degree *
probability * ( consequence +1 ))) AS score FROM fm_request_condition"
- . " JOIN fm_request_condition_type ON
(fm_request_condition.condition_type = fm_request_condition_type.id) WHERE
request_id = $id";
-
-
$GLOBALS['phpgw_setup']->oProc->query($sql,__LINE__,__FILE__);
-
- $GLOBALS['phpgw_setup']->oProc->next_record();
- $score = $GLOBALS['phpgw_setup']->oProc->f('score');
- $GLOBALS['phpgw_setup']->oProc->query("UPDATE
fm_request SET score = $score WHERE 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'];
- }
-
- /**
- * Update property version from 0.9.17.508 to 0.9.17.509
- */
-
- $test[] = '0.9.17.508';
- function property_upgrade0_9_17_508()
- {
- $GLOBALS['phpgw_setup']->oProc->CreateTable(
- 'fm_custom_function', array(
- 'fd' => array(
- 'acl_location' => array('type' =>
'varchar','precision' => '50','nullable' => False),
- 'id' => array('type' =>
'int','precision' => '4','nullable' => False),
- 'descr' => array('type' =>
'text','nullable' => True),
- 'file_name ' => array('type' =>
'varchar','precision' => '50','nullable' => False),
- 'active' => array('type' =>
'int','precision' => '2','nullable' => True),
- 'custom_sort' => array('type' =>
'int','precision' => '4','nullable' => True)
- ),
- 'pk' => array('acl_location','id'),
- 'fk' => array(),
- 'ix' => array(),
- 'uc' => array()
- )
- );
-
- $GLOBALS['setup_info']['property']['currentver'] = '0.9.17.509';
- return $GLOBALS['setup_info']['property']['currentver'];
- }
-
- /**
- * Update property version from 0.9.17.509 to 0.9.17.510
- */
-
- $test[] = '0.9.17.509';
- function property_upgrade0_9_17_509()
- {
-
$GLOBALS['phpgw_setup']->oProc->AddColumn('fm_ecobilag','item_type',array('type'
=> 'int','precision' => 4,'nullable' => True));
-
$GLOBALS['phpgw_setup']->oProc->AddColumn('fm_ecobilag','item_id',array('type'
=> 'varchar','precision' => 20,'nullable' => True));
-
$GLOBALS['phpgw_setup']->oProc->AddColumn('fm_ecobilagoverf','item_type',array('type'
=> 'int','precision' => 4,'nullable' => True));
-
$GLOBALS['phpgw_setup']->oProc->AddColumn('fm_ecobilagoverf','item_id',array('type'
=> 'varchar','precision' => 20,'nullable' => True));
-
- $GLOBALS['setup_info']['property']['currentver'] = '0.9.17.510';
- return $GLOBALS['setup_info']['property']['currentver'];
- }
-
-?>
+<?php
+ /**
+ * phpGroupWare - property: a Facilities Management System.
+ *
+ * @author Sigurd Nes <address@hidden>
+ * @copyright Copyright (C) 2003-2005 Free Software Foundation, Inc.
http://www.fsf.org/
+ * @license http://www.gnu.org/licenses/gpl.html GNU General Public
License
+ * @internal Development of this application was funded by
http://www.bergen.kommune.no/bbb_/ekstern/
+ * @package property
+ * @subpackage setup
+ * @version $Id: tables_update.inc.php,v 1.20 2006/01/25 18:19:12
sigurdne Exp $
+ */
+
+ /**
+ * Update property version from 0.9.17.500 to 0.9.17.501
+ */
+
+ $test[] = '0.9.17.500';
+ function property_upgrade0_9_17_500()
+ {
+ $GLOBALS['phpgw_setup']->oProc->CreateTable(
+ 'fm_origin', array(
+ 'fd' => array(
+ 'origin' => array('type' =>
'varchar','precision' => '12','nullable' => False),
+ 'origin_id' => array('type' =>
'int','precision' => '4','nullable' => False),
+ 'destination' => array('type' =>
'varchar','precision' => '12','nullable' => False),
+ 'destination_id' => array('type' =>
'int','precision' => '4','nullable' => False),
+ 'user_id' => array('type' =>
'int','precision' => '4','nullable' => True),
+ 'entry_date' => array('type' =>
'int','precision' => '4','nullable' => True)
+ ),
+ 'pk' =>
array('origin','origin_id','destination','destination_id'),
+ 'fk' => array(),
+ 'ix' => array(),
+ 'uc' => array()
+ )
+ );
+
+ $GLOBALS['phpgw_setup']->oProc->query("SELECT * FROM
fm_request_origin");
+ while ($GLOBALS['phpgw_setup']->oProc->next_record())
+ {
+ $origin[]=array(
+ 'origin' =>
$GLOBALS['phpgw_setup']->oProc->f('origin'),
+ 'origin_id' =>
$GLOBALS['phpgw_setup']->oProc->f('origin_id'),
+ 'destination'=> 'request',
+ 'destination_id' =>
$GLOBALS['phpgw_setup']->oProc->f('request_id'),
+ 'entry_date' =>
$GLOBALS['phpgw_setup']->oProc->f('entry_date'),
+ );
+ }
+
+
+ $GLOBALS['phpgw_setup']->oProc->query("SELECT * FROM
fm_project_origin");
+ while ($GLOBALS['phpgw_setup']->oProc->next_record())
+ {
+ $origin[]=array(
+ 'origin' =>
$GLOBALS['phpgw_setup']->oProc->f('origin'),
+ 'origin_id' =>
$GLOBALS['phpgw_setup']->oProc->f('origin_id'),
+ 'destination'=> 'project',
+ 'destination_id' =>
$GLOBALS['phpgw_setup']->oProc->f('project_id'),
+ 'entry_date' =>
$GLOBALS['phpgw_setup']->oProc->f('entry_date'),
+ );
+ }
+
+ $GLOBALS['phpgw_setup']->oProc->query("SELECT * FROM
fm_entity_origin");
+ while ($GLOBALS['phpgw_setup']->oProc->next_record())
+ {
+ $origin[]=array(
+ 'origin' =>
$GLOBALS['phpgw_setup']->oProc->f('origin'),
+ 'origin_id' =>
$GLOBALS['phpgw_setup']->oProc->f('origin_id'),
+ 'destination'=> 'entity_' .
$GLOBALS['phpgw_setup']->oProc->f('entity_id') . '_' .
$GLOBALS['phpgw_setup']->oProc->f('cat_id'),
+ 'destination_id' =>
$GLOBALS['phpgw_setup']->oProc->f('id'),
+ 'entry_date' =>
$GLOBALS['phpgw_setup']->oProc->f('entry_date'),
+ );
+ }
+
+ $rec_count = count($origin);
+
+
+ for($i=0;$i<$rec_count;$i++)
+ {
+ $GLOBALS['phpgw_setup']->oProc->query("INSERT INTO
fm_origin(origin,origin_id,destination,destination_id,entry_date) "
+ . "VALUES('"
+ .$origin[$i]['origin']."','"
+ .$origin[$i]['origin_id']."','"
+ .$origin[$i]['destination']."','"
+ .$origin[$i]['destination_id']."','"
+ .$origin[$i]['entry_date']."')");
+ }
+
+ $GLOBALS['phpgw_setup']->oProc->DropTable('fm_request_origin');
+ $GLOBALS['phpgw_setup']->oProc->DropTable('fm_project_origin');
+ $GLOBALS['phpgw_setup']->oProc->DropTable('fm_entity_origin');
+
+ $GLOBALS['setup_info']['property']['currentver'] = '0.9.17.501';
+ return $GLOBALS['setup_info']['property']['currentver'];
+ }
+
+ /**
+ * Update property version from 0.9.17.501 to 0.9.17.502
+ */
+
+ $test[] = '0.9.17.501';
+ function property_upgrade0_9_17_501()
+ {
+
$GLOBALS['phpgw_setup']->oProc->AlterColumn('fm_request','descr',array('type'
=> 'text','nullable' => True));
+ $GLOBALS['setup_info']['property']['currentver'] = '0.9.17.502';
+ return $GLOBALS['setup_info']['property']['currentver'];
+ }
+
+ /**
+ * Update property version from 0.9.17.502 to 0.9.17.503
+ */
+
+ $test[] = '0.9.17.502';
+ function property_upgrade0_9_17_502()
+ {
+
$GLOBALS['phpgw_setup']->oProc->AlterColumn('fm_acl_location','id',array('type'
=> 'varchar','precision' => '20','nullable' => False));
+ $GLOBALS['phpgw_setup']->oProc->query("INSERT INTO
fm_acl_location (id, descr) VALUES ('.tenant_claim', 'Tenant claim')");
+
+ $GLOBALS['phpgw_setup']->oProc->CreateTable(
+ 'fm_tenant_claim_category', array(
+ 'fd' => array(
+ 'id' => array('type' =>
'int','precision' => '4','nullable' => False),
+ 'descr' => array('type' =>
'varchar','precision' => '255','nullable' => True)
+ ),
+ 'pk' => array('id'),
+ 'fk' => array(),
+ 'ix' => array(),
+ 'uc' => array()
+ )
+ );
+
+ $GLOBALS['phpgw_setup']->oProc->query("INSERT INTO
fm_tenant_claim_category (id, descr) VALUES (1, 'Type 1')");
+ $GLOBALS['phpgw_setup']->oProc->query("INSERT INTO
fm_tenant_claim_category (id, descr) VALUES (2, 'Type 2')");
+
+ $GLOBALS['phpgw_setup']->oProc->CreateTable(
+ 'fm_tenant_claim', array(
+ 'fd' => array(
+ 'id' => array('type' =>
'auto','precision' => '4','nullable' => False),
+ 'project_id' => array('type' =>
'int','precision' => '4','nullable' => False),
+ 'tenant_id' => array('type' =>
'int','precision' => '4','nullable' => False),
+ 'amount' => array('type' =>
'decimal','precision' => '20','scale' => '2','default' => '0','nullable' =>
True),
+ 'b_account_id' => array('type' =>
'int','precision' => '4','nullable' => True),
+ 'category' => array('type' =>
'int','precision' => '4','nullable' => False),
+ 'status' => array('type' =>
'varchar','precision' => '8','nullable' => True),
+ 'remark' => array('type' =>
'text','nullable' => True),
+ 'user_id' => array('type' =>
'int','precision' => '4','nullable' => False),
+ 'entry_date' => array('type' =>
'int','precision' => '4','nullable' => True)
+ ),
+ 'pk' => array('id'),
+ 'fk' => array(),
+ 'ix' => array(),
+ 'uc' => array()
+ )
+ );
+
+
$GLOBALS['phpgw_setup']->oProc->AddColumn('fm_workorder','claim_issued',array('type'
=> 'int','precision' => 2,'nullable' => True));
+
+ $GLOBALS['setup_info']['property']['currentver'] = '0.9.17.503';
+ return $GLOBALS['setup_info']['property']['currentver'];
+ }
+
+ /**
+ * Update property version from 0.9.17.503 to 0.9.17.504
+ */
+
+ $test[] = '0.9.17.503';
+ function property_upgrade0_9_17_503()
+ {
+
$GLOBALS['phpgw_setup']->oProc->AddColumn('fm_location_type','pk',array('type'
=> 'text','nullable' => True));
+
$GLOBALS['phpgw_setup']->oProc->AddColumn('fm_location_type','ix',array('type'
=> 'text','nullable' => True));
+
$GLOBALS['phpgw_setup']->oProc->AddColumn('fm_location_type','uc',array('type'
=> 'text','nullable' => True));
+
$GLOBALS['phpgw_setup']->oProc->AddColumn('fm_location_attrib','custom',array('type'
=> 'int','precision' => 4,'nullable' => True));
+
+ $GLOBALS['phpgw_setup']->oProc->query("UPDATE
fm_location_attrib SET custom = 1");
+
+ $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(id)
as id FROM fm_location_attrib WHERE type_id = $location_type");
+ $GLOBALS['phpgw_setup']->oProc->next_record();
+ $id = $GLOBALS['phpgw_setup']->oProc->f('id');
+ $id++;
+
+ $default_attrib['id'][]= $id;
+ $default_attrib['column_name'][]= 'location_code';
+ $default_attrib['type'][]='V';
+ $default_attrib['precision'][] =4*$location_type;
+ $default_attrib['nullable'][] ='False';
+ $default_attrib['input_text'][] ='dummy';
+ $default_attrib['statustext'][] ='dummy';
+ $default_attrib['custom'][] ='NULL';
+ $id++;
+
+ $default_attrib['id'][]= $id;
+ $default_attrib['column_name'][]= 'loc' .
$location_type . '_name';
+ $default_attrib['type'][]='V';
+ $default_attrib['precision'][] =50;
+ $default_attrib['nullable'][] ='True';
+ $default_attrib['input_text'][] ='dummy';
+ $default_attrib['statustext'][] ='dummy';
+ $default_attrib['custom'][] ='NULL';
+ $id++;
+
+ $default_attrib['id'][]= $id;
+ $default_attrib['column_name'][]= 'entry_date';
+ $default_attrib['type'][]='I';
+ $default_attrib['precision'][] =4;
+ $default_attrib['nullable'][] ='True';
+ $default_attrib['input_text'][] ='dummy';
+ $default_attrib['statustext'][] ='dummy';
+ $default_attrib['custom'][] ='NULL';
+ $id++;
+
+ $default_attrib['id'][]= $id;
+ $default_attrib['column_name'][]= 'category';
+ $default_attrib['type'][]='I';
+ $default_attrib['precision'][] =4;
+ $default_attrib['nullable'][] ='False';
+ $default_attrib['input_text'][] ='dummy';
+ $default_attrib['statustext'][] ='dummy';
+ $default_attrib['custom'][] ='NULL';
+ $id++;
+
+ $default_attrib['id'][]= $id;
+ $default_attrib['column_name'][]= 'user_id';
+ $default_attrib['type'][]='I';
+ $default_attrib['precision'][] =4;
+ $default_attrib['nullable'][] ='False';
+ $default_attrib['input_text'][] ='dummy';
+ $default_attrib['statustext'][] ='dummy';
+ $default_attrib['custom'][] ='NULL';
+ $id++;
+
+ $default_attrib['id'][]= $id;
+ $default_attrib['column_name'][]= 'remark';
+ $default_attrib['type'][]='T';
+ $default_attrib['precision'][] = 'NULL';
+ $default_attrib['nullable'][] ='False';
+ $default_attrib['input_text'][] ='dummy';
+ $default_attrib['statustext'][] ='dummy';
+ $default_attrib['custom'][] ='NULL';
+ $id++;
+
+ for ($i=1; $i<$location_type+1; $i++)
+ {
+ $pk[$i-1]= 'loc' . $i;
+
+ $default_attrib['id'][]= $id;
+ $default_attrib['column_name'][]= 'loc' . $i;
+ $default_attrib['type'][]='V';
+ $default_attrib['precision'][] =4;
+ $default_attrib['nullable'][] ='False';
+ $default_attrib['input_text'][] ='dummy';
+ $default_attrib['statustext'][] ='dummy';
+ $default_attrib['custom'][] ='NULL';
+ $id++;
+ }
+
+ if ($location_type==1)
+ {
+ $default_attrib['id'][]= $id;
+ $default_attrib['column_name'][]= 'mva';
+ $default_attrib['type'][]='I';
+ $default_attrib['precision'][] =4;
+ $default_attrib['nullable'][] ='True';
+ $default_attrib['input_text'][] ='mva';
+ $default_attrib['statustext'][] ='mva';
+ $default_attrib['custom'][] = 1;
+ $id++;
+
+ $default_attrib['id'][]= $id;
+ $default_attrib['column_name'][]= 'kostra_id';
+ $default_attrib['type'][]='I';
+ $default_attrib['precision'][] =4;
+ $default_attrib['nullable'][] ='True';
+ $default_attrib['input_text'][] ='kostra_id';
+ $default_attrib['statustext'][] ='kostra_id';
+ $default_attrib['custom'][] = 1;
+ $id++;
+
+ $default_attrib['id'][]= $id;
+ $default_attrib['column_name'][]=
'part_of_town_id';
+ $default_attrib['type'][]='I';
+ $default_attrib['precision'][] =4;
+ $default_attrib['nullable'][] ='True';
+ $default_attrib['input_text'][] ='dummy';
+ $default_attrib['statustext'][] ='dummy';
+ $default_attrib['custom'][] ='NULL';
+ $id++;
+
+ $default_attrib['id'][]= $id;
+ $default_attrib['column_name'][]= 'owner_id';
+ $default_attrib['type'][]='I';
+ $default_attrib['precision'][] =4;
+ $default_attrib['nullable'][] ='True';
+ $default_attrib['input_text'][] ='dummy';
+ $default_attrib['statustext'][] ='dummy';
+ $default_attrib['custom'][] ='NULL';
+ $id++;
+ }
+
+ if($location_type>1)
+ {
+ $fk_table='fm_location'. ($location_type-1);
+
+ for ($i=1; $i<$standard['id']; $i++)
+ {
+ $fk['loc' . $i] = $fk_table . '.loc' .
$i;
+ }
+ }
+
+ $ix = array('location_code');
+
+ $GLOBALS['phpgw_setup']->oProc->query("UPDATE
fm_location_type SET "
+ . "pk ='" . implode(',',$pk) . "',"
+ . "ix ='" . implode(',',$ix) . "' WHERE id =
$location_type");
+
+
+ for ($i=0;$i<count($default_attrib['id']);$i++)
+ {
+ $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,'"
+ . $default_attrib['id'][$i] . "','"
+ . $default_attrib['column_name'][$i] .
"','"
+ . $default_attrib['type'][$i] . "',"
+ . $default_attrib['precision'][$i] .
",'"
+ . $default_attrib['input_text'][$i] .
"','"
+ . $default_attrib['statustext'][$i] .
"','"
+ . $default_attrib['nullable'][$i] . "',"
+ . $default_attrib['custom'][$i] . ")");
+ }
+
+ unset($pk);
+ unset($ix);
+ unset($default_attrib);
+ }
+
+ $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'];
+ }
+
+ /**
+ * Update property version from 0.9.17.505 to 0.9.17.506
+ */
+
+ $test[] = '0.9.17.505';
+ function property_upgrade0_9_17_505()
+ {
+
$GLOBALS['phpgw_setup']->oProc->AddColumn('fm_wo_hours','category',array('type'
=> 'int','precision' => 4,'nullable' => True));
+
+ $GLOBALS['phpgw_setup']->oProc->CreateTable(
+ 'fm_wo_hours_category', array(
+ 'fd' => array(
+ 'id' => array('type' =>
'int','precision' => '4','nullable' => False),
+ 'descr' => array('type' =>
'varchar','precision' => '255','nullable' => False)
+ ),
+ 'pk' => array('id'),
+ 'fk' => array(),
+ 'ix' => array(),
+ 'uc' => array()
+ )
+ );
+
+ $GLOBALS['setup_info']['property']['currentver'] = '0.9.17.506';
+ return $GLOBALS['setup_info']['property']['currentver'];
+ }
+ /**
+ * Update property version from 0.9.17.506 to 0.9.17.507
+ */
+
+ $test[] = '0.9.17.506';
+ function property_upgrade0_9_17_506()
+ {
+
$GLOBALS['phpgw_setup']->oProc->AlterColumn('fm_request','d_safety',array('type'
=> 'int','precision' => '4','default' => '0','nullable' => True));
+
$GLOBALS['phpgw_setup']->oProc->AlterColumn('fm_request','d_aesthetics',array('type'
=> 'int','precision' => '4','default' => '0','nullable' => True));
+
$GLOBALS['phpgw_setup']->oProc->AlterColumn('fm_request','d_indoor_climate',array('type'
=> 'int','precision' => '4','default' => '0','nullable' => True));
+
$GLOBALS['phpgw_setup']->oProc->AlterColumn('fm_request','d_consequential_damage',array('type'
=> 'int','precision' => '4','default' => '0','nullable' => True));
+
$GLOBALS['phpgw_setup']->oProc->AlterColumn('fm_request','d_user_gratification',array('type'
=> 'int','precision' => '4','default' => '0','nullable' => True));
+
$GLOBALS['phpgw_setup']->oProc->AlterColumn('fm_request','d_residential_environment',array('type'
=> 'int','precision' => '4','default' => '0','nullable' => True));
+
$GLOBALS['phpgw_setup']->oProc->AlterColumn('fm_request','p_safety',array('type'
=> 'int','precision' => '4','default' => '0','nullable' => True));
+
$GLOBALS['phpgw_setup']->oProc->AlterColumn('fm_request','p_aesthetics',array('type'
=> 'int','precision' => '4','default' => '0','nullable' => True));
+
$GLOBALS['phpgw_setup']->oProc->AlterColumn('fm_request','p_indoor_climate',array('type'
=> 'int','precision' => '4','default' => '0','nullable' => True));
+
$GLOBALS['phpgw_setup']->oProc->AlterColumn('fm_request','p_consequential_damage',array('type'
=> 'int','precision' => '4','default' => '0','nullable' => True));
+
$GLOBALS['phpgw_setup']->oProc->AlterColumn('fm_request','p_user_gratification',array('type'
=> 'int','precision' => '4','default' => '0','nullable' => True));
+
$GLOBALS['phpgw_setup']->oProc->AlterColumn('fm_request','p_residential_environment',array('type'
=> 'int','precision' => '4','default' => '0','nullable' => True));
+
$GLOBALS['phpgw_setup']->oProc->AlterColumn('fm_request','c_safety',array('type'
=> 'int','precision' => '4','default' => '0','nullable' => True));
+
$GLOBALS['phpgw_setup']->oProc->AlterColumn('fm_request','c_aesthetics',array('type'
=> 'int','precision' => '4','default' => '0','nullable' => True));
+
$GLOBALS['phpgw_setup']->oProc->AlterColumn('fm_request','c_indoor_climate',array('type'
=> 'int','precision' => '4','default' => '0','nullable' => True));
+
$GLOBALS['phpgw_setup']->oProc->AlterColumn('fm_request','c_consequential_damage',array('type'
=> 'int','precision' => '4','default' => '0','nullable' => True));
+
$GLOBALS['phpgw_setup']->oProc->AlterColumn('fm_request','c_user_gratification',array('type'
=> 'int','precision' => '4','default' => '0','nullable' => True));
+
$GLOBALS['phpgw_setup']->oProc->AlterColumn('fm_request','c_residential_environment',array('type'
=> 'int','precision' => '4','default' => '0','nullable' => True));
+
$GLOBALS['phpgw_setup']->oProc->AlterColumn('fm_request','authorities_demands',array('type'
=> 'int','precision' => '2','default' => '0','nullable' => True));
+
$GLOBALS['phpgw_setup']->oProc->AlterColumn('fm_request','score',array('type'
=> 'int','precision' => '4','default' => '0','nullable' => True));
+
+ $GLOBALS['phpgw_setup']->oProc->query("UPDATE fm_request SET
d_safety = 0 WHERE d_safety IS NULL ");
+ $GLOBALS['phpgw_setup']->oProc->query("UPDATE fm_request SET
d_aesthetics = 0 WHERE d_aesthetics IS NULL ");
+ $GLOBALS['phpgw_setup']->oProc->query("UPDATE fm_request SET
d_indoor_climate = 0 WHERE d_indoor_climate IS NULL ");
+ $GLOBALS['phpgw_setup']->oProc->query("UPDATE fm_request SET
d_consequential_damage = 0 WHERE d_consequential_damage IS NULL ");
+ $GLOBALS['phpgw_setup']->oProc->query("UPDATE fm_request SET
d_user_gratification = 0 WHERE d_user_gratification IS NULL ");
+ $GLOBALS['phpgw_setup']->oProc->query("UPDATE fm_request SET
d_residential_environment = 0 WHERE d_residential_environment IS NULL ");
+ $GLOBALS['phpgw_setup']->oProc->query("UPDATE fm_request SET
p_safety = 0 WHERE p_safety IS NULL ");
+ $GLOBALS['phpgw_setup']->oProc->query("UPDATE fm_request SET
p_aesthetics = 0 WHERE p_aesthetics IS NULL ");
+ $GLOBALS['phpgw_setup']->oProc->query("UPDATE fm_request SET
p_indoor_climate = 0 WHERE p_indoor_climate IS NULL ");
+ $GLOBALS['phpgw_setup']->oProc->query("UPDATE fm_request SET
p_consequential_damage = 0 WHERE p_consequential_damage IS NULL ");
+ $GLOBALS['phpgw_setup']->oProc->query("UPDATE fm_request SET
p_user_gratification = 0 WHERE p_user_gratification IS NULL ");
+ $GLOBALS['phpgw_setup']->oProc->query("UPDATE fm_request SET
p_residential_environment = 0 WHERE p_residential_environment IS NULL ");
+ $GLOBALS['phpgw_setup']->oProc->query("UPDATE fm_request SET
c_safety = 0 WHERE c_safety IS NULL ");
+ $GLOBALS['phpgw_setup']->oProc->query("UPDATE fm_request SET
c_aesthetics = 0 WHERE c_aesthetics IS NULL ");
+ $GLOBALS['phpgw_setup']->oProc->query("UPDATE fm_request SET
c_indoor_climate = 0 WHERE c_indoor_climate IS NULL ");
+ $GLOBALS['phpgw_setup']->oProc->query("UPDATE fm_request SET
c_consequential_damage = 0 WHERE c_consequential_damage IS NULL ");
+ $GLOBALS['phpgw_setup']->oProc->query("UPDATE fm_request SET
c_user_gratification = 0 WHERE c_user_gratification IS NULL ");
+ $GLOBALS['phpgw_setup']->oProc->query("UPDATE fm_request SET
c_residential_environment = 0 WHERE c_residential_environment IS NULL ");
+ $GLOBALS['phpgw_setup']->oProc->query("UPDATE fm_request SET
authorities_demands = 0 WHERE authorities_demands IS NULL ");
+ $GLOBALS['phpgw_setup']->oProc->query("UPDATE fm_request SET
score = 0 WHERE score IS NULL ");
+ $GLOBALS['phpgw_setup']->oProc->query("UPDATE fm_workorder SET
act_mtrl_cost = 0 WHERE act_mtrl_cost IS NULL ");
+ $GLOBALS['phpgw_setup']->oProc->query("UPDATE fm_workorder SET
act_vendor_cost = 0 WHERE act_vendor_cost IS NULL ");
+
+ $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'];
+
+
+
+ $sql = "SELECT sum(priority_key * ( degree *
probability * ( consequence +1 ))) AS score FROM fm_request_condition"
+ . " JOIN fm_request_condition_type ON
(fm_request_condition.condition_type = fm_request_condition_type.id) WHERE
request_id = $id";
+
+
$GLOBALS['phpgw_setup']->oProc->query($sql,__LINE__,__FILE__);
+
+ $GLOBALS['phpgw_setup']->oProc->next_record();
+ $score = $GLOBALS['phpgw_setup']->oProc->f('score');
+ $GLOBALS['phpgw_setup']->oProc->query("UPDATE
fm_request SET score = $score WHERE 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'];
+ }
+
+ /**
+ * Update property version from 0.9.17.508 to 0.9.17.509
+ */
+
+ $test[] = '0.9.17.508';
+ function property_upgrade0_9_17_508()
+ {
+ $GLOBALS['phpgw_setup']->oProc->CreateTable(
+ 'fm_custom_function', array(
+ 'fd' => array(
+ 'acl_location' => array('type' =>
'varchar','precision' => '50','nullable' => False),
+ 'id' => array('type' =>
'int','precision' => '4','nullable' => False),
+ 'descr' => array('type' =>
'text','nullable' => True),
+ 'file_name ' => array('type' =>
'varchar','precision' => '50','nullable' => False),
+ 'active' => array('type' =>
'int','precision' => '2','nullable' => True),
+ 'custom_sort' => array('type' =>
'int','precision' => '4','nullable' => True)
+ ),
+ 'pk' => array('acl_location','id'),
+ 'fk' => array(),
+ 'ix' => array(),
+ 'uc' => array()
+ )
+ );
+
+ $GLOBALS['setup_info']['property']['currentver'] = '0.9.17.509';
+ return $GLOBALS['setup_info']['property']['currentver'];
+ }
+
+ /**
+ * Update property version from 0.9.17.509 to 0.9.17.510
+ */
+
+ $test[] = '0.9.17.509';
+ function property_upgrade0_9_17_509()
+ {
+
$GLOBALS['phpgw_setup']->oProc->AddColumn('fm_ecobilag','item_type',array('type'
=> 'int','precision' => 4,'nullable' => True));
+
$GLOBALS['phpgw_setup']->oProc->AddColumn('fm_ecobilag','item_id',array('type'
=> 'varchar','precision' => 20,'nullable' => True));
+
$GLOBALS['phpgw_setup']->oProc->AddColumn('fm_ecobilagoverf','item_type',array('type'
=> 'int','precision' => 4,'nullable' => True));
+
$GLOBALS['phpgw_setup']->oProc->AddColumn('fm_ecobilagoverf','item_id',array('type'
=> 'varchar','precision' => 20,'nullable' => True));
+
+ $GLOBALS['setup_info']['property']['currentver'] = '0.9.17.510';
+ return $GLOBALS['setup_info']['property']['currentver'];
+ }
+
+ /**
+ * Update property version from 0.9.17.510 to 0.9.17.511
+ */
+
+ $test[] = '0.9.17.510';
+ function property_upgrade0_9_17_510()
+ {
+
$GLOBALS['phpgw_setup']->oProc->RenameColumn('fm_custom','sql','sql_text');
+
+ $GLOBALS['setup_info']['property']['currentver'] = '0.9.17.511';
+ return $GLOBALS['setup_info']['property']['currentver'];
+ }
+
+?>
Index: property/templates/base/invoice.xsl
diff -u property/templates/base/invoice.xsl:1.4
property/templates/base/invoice.xsl:1.5
--- property/templates/base/invoice.xsl:1.4 Fri Aug 26 12:03:56 2005
+++ property/templates/base/invoice.xsl Wed Jan 25 18:19:12 2006
@@ -1,4 +1,4 @@
-<!-- $Id: invoice.xsl,v 1.4 2005/08/26 12:03:56 sigurdne Exp $ -->
+<!-- $Id: invoice.xsl,v 1.5 2006/01/25 18:19:12 sigurdne Exp $ -->
<xsl:template name="app_data">
<xsl:choose>
@@ -2066,6 +2066,18 @@
</td>
</tr>
<tr>
+ <td valign="top">
+ <xsl:value-of
select="lang_force_period_year"/>
+ </td>
+ <td valign="top">
+ <xsl:variable
name="lang_force_period_year_statustext"><xsl:value-of
select="lang_force_period_year_statustext"/></xsl:variable>
+ <select
name="values[force_period_year]" class="forms"
onMouseover="window.status='{$lang_force_period_year_statustext}'; return
true;" onMouseout="window.status='';return true;">
+ <option value=""><xsl:value-of
select="lang_select_year"/></option>
+ <xsl:apply-templates
select="force_period_year"/>
+ </select>
+ </td>
+ </tr>
+ <tr>
<td>
<xsl:value-of
select="lang_export_to_file"/>
</td>
@@ -2517,3 +2529,14 @@
</tr>
</xsl:template>
+ <xsl:template match="force_period_year">
+ <xsl:variable name="id"><xsl:value-of select="id"/></xsl:variable>
+ <xsl:choose>
+ <xsl:when test="selected='selected'">
+ <option value="{$id}"
selected="selected"><xsl:value-of disable-output-escaping="yes"
select="id"/></option>
+ </xsl:when>
+ <xsl:otherwise>
+ <option value="{$id}"><xsl:value-of
disable-output-escaping="yes" select="id"/></option>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:template>
Index: property/templates/default/invoice.xsl
diff -u property/templates/default/invoice.xsl:1.11
property/templates/default/invoice.xsl:1.12
--- property/templates/default/invoice.xsl:1.11 Fri Aug 26 12:03:56 2005
+++ property/templates/default/invoice.xsl Wed Jan 25 18:19:12 2006
@@ -1,4 +1,4 @@
-<!-- $Id: invoice.xsl,v 1.11 2005/08/26 12:03:56 sigurdne Exp $ -->
+<!-- $Id: invoice.xsl,v 1.12 2006/01/25 18:19:12 sigurdne Exp $ -->
<xsl:template name="app_data">
<xsl:choose>
@@ -2066,6 +2066,18 @@
</td>
</tr>
<tr>
+ <td valign="top">
+ <xsl:value-of
select="lang_force_period_year"/>
+ </td>
+ <td valign="top">
+ <xsl:variable
name="lang_force_period_year_statustext"><xsl:value-of
select="lang_force_period_year_statustext"/></xsl:variable>
+ <select
name="values[force_period_year]" class="forms"
onMouseover="window.status='{$lang_force_period_year_statustext}'; return
true;" onMouseout="window.status='';return true;">
+ <option value=""><xsl:value-of
select="lang_select_year"/></option>
+ <xsl:apply-templates
select="force_period_year"/>
+ </select>
+ </td>
+ </tr>
+ <tr>
<td>
<xsl:value-of
select="lang_export_to_file"/>
</td>
@@ -2517,3 +2529,14 @@
</tr>
</xsl:template>
+ <xsl:template match="force_period_year">
+ <xsl:variable name="id"><xsl:value-of select="id"/></xsl:variable>
+ <xsl:choose>
+ <xsl:when test="selected='selected'">
+ <option value="{$id}"
selected="selected"><xsl:value-of disable-output-escaping="yes"
select="id"/></option>
+ </xsl:when>
+ <xsl:otherwise>
+ <option value="{$id}"><xsl:value-of
disable-output-escaping="yes" select="id"/></option>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:template>
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Phpgroupware-cvs] property setup/tables_update.inc.php setup/setu...,
Sigurd Nes <=