phpgroupware-cvs
[Top][All Lists]
Advanced

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

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


From: sigurdne
Subject: [Phpgroupware-cvs] property/setup tables_update.inc.php, 1.17 setup.inc.php, 1.23 tables_current.inc.php, 1.35
Date: Mon, 24 Oct 2005 12:44:00 +0200

Update of property/setup

Modified Files:
     Branch: MAIN
            tables_update.inc.php lines: +744 -715
            setup.inc.php lines: +221 -220
            tables_current.inc.php lines: +1975 -1961

Log Message:
Enable custom functions to be performed within an acl_location

====================================================
Index: property/setup/tables_update.inc.php
diff -u property/setup/tables_update.inc.php:1.16 
property/setup/tables_update.inc.php:1.17
--- property/setup/tables_update.inc.php:1.16   Thu Sep 22 08:42:49 2005
+++ property/setup/tables_update.inc.php        Mon Oct 24 10:44:27 2005
@@ -1,715 +1,744 @@
-<?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$
-       */
-
-       /**
-       * 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'];
-       }
-?>
+<?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$
+       */
+
+       /**
+       * 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'];
+       }
+
+?>

====================================================
Index: property/setup/setup.inc.php
diff -u property/setup/setup.inc.php:1.22 property/setup/setup.inc.php:1.23
--- property/setup/setup.inc.php:1.22   Wed Sep 21 14:18:16 2005
+++ property/setup/setup.inc.php        Mon Oct 24 10:44:27 2005
@@ -1,220 +1,221 @@
-<?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$
-       */
-
-       $setup_info['property']['name']      = 'property';
-       $setup_info['property']['title']         = 'Property';
-       $setup_info['property']['version']   = '0.9.17.508';
-       $setup_info['property']['app_order'] = 8;
-       $setup_info['property']['enable']    = 1;
-
-       $setup_info['property']['author'][] = array
-       (
-               'name'  => 'Sigurd Nes',
-               'email' => 'address@hidden'
-       );
-
-       $setup_info['property']['maintainer'] = array
-       (
-               'name'  => 'Sigurd Nes',
-               'email' => 'address@hidden'
-       );
-
-       $setup_info['property']['license']  = 'GPL';
-       $setup_info['property']['description'] =
-       '<div align="left">
-
-       <b>FM</b> (Facilities-management) providing:
-       <ol>
-               <li>Helpdesk</li>
-               <li>Property register - with drawing and 
document-archive(vfs)</li>
-               <li>Equipment register</li>
-               <li>Vendor register (using Addressbook)</li>
-               <li>Tenant register</li>
-               <li>Project/workorder by email/pdf with ability to save 
workorders as templates for later use</li>
-                       <ol>
-                       <li>From vendors prizebook - or</li>
-                       <li>from templates - or</li>
-                       <li> by custom definition as (optional) tender for 
bidding based on (for the moment) norwegian building standards.</li>
-                       </ol>
-               <li>Service agreements with prizebook with historical prizing 
per vendor</li>
-               <li>Invoice handling</li>
-                       <ol>
-                       <li>Import from file (currently Three different 
formats)</li>
-            <li>Approval per Role</li>
-                               <ol>
-                               <li>Janitor</li>
-               <li>Supervisor</li>
-               <li>Budget responsible</li>
-                               </ol>
-            <li>Eksport to payment system / accounting system</li>
-                       </ol>
-       </ol>
-
-
-       <b>Property</b> is organized as a set of submodules - each with theis 
own set of user permission-settings.
-       <br>
-       <b>Workorder</b> can be used as a general tool for producing tender for 
bidding - the document is presented as a pdf-document.
-       </div>';
-
-       $setup_info['property']['note'] =
-               'I am also planning to add maintenance planning as events in 
the calendar app.';
-
-
-       $setup_info['property']['tables'] = array(
-               'fm_part_of_town',
-               'fm_gab_location',
-               'fm_streetaddress',
-               'fm_tenant',
-               'fm_tenant_category',
-               'fm_tenant_attribute',
-               'fm_tenant_choice',
-               'fm_vendor',
-               'fm_vendor_category',
-               'fm_vendor_attribute',
-               'fm_vendor_choice',
-               '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',
-               'fm_location_config',
-               'fm_building_part',
-               'fm_b_account',
-               'fm_dim_d',
-               'fm_workorder',
-               'fm_workorder_category',
-               'fm_workorder_history',
-               'fm_workorder_status',
-               'fm_activities',
-               'fm_agreement_group',
-               'fm_agreement',
-               'fm_agreement_status',
-               'fm_agreement_attribute',
-               'fm_agreement_choice',
-               'fm_activity_price_index',
-               'fm_branch',
-               'fm_wo_hours',
-               'fm_wo_hours_category',
-               'fm_wo_h_deviation',
-               'fm_key_loc',
-               'fm_request',
-               'fm_request_condition_type',
-               'fm_request_condition',
-               'fm_request_status',
-               'fm_request_category',
-               'fm_request_history',
-               'fm_template',
-               'fm_template_hours',
-               'fm_chapter',
-               'fm_ns3420',
-               'fm_project',
-               'fm_projectbranch',
-               'fm_project_history',
-               'fm_tts_tickets',
-               'fm_tts_category',
-               'fm_tts_history',
-               'fm_tts_views',
-               'fm_ecoart',
-               'fm_ecoavvik',
-               'fm_ecobilag',
-               'fm_ecobilagkilde',
-               'fm_ecobilagoverf',
-               'fm_ecobilagtype',
-               'fm_ecodimb',
-               'fm_ecodimd',
-               'fm_ecologg',
-               'fm_ecomva',
-               'fm_ecouser',
-               'fm_acl2',
-               'fm_investment',
-               'fm_investment_value',
-               'fm_event_receipt',
-               'fm_idgenerator',
-               'fm_document',
-               'fm_document_category',
-               'fm_document_history',
-               'fm_document_status',
-               'fm_acl_location',
-               'fm_standard_unit',
-               'fm_owner',
-               'fm_owner_category',
-               'fm_owner_attribute',
-               'fm_owner_choice',
-               'fm_cache',
-               'fm_entity',
-               'fm_entity_attribute',
-               'fm_entity_category',
-               'fm_entity_choice',
-               'fm_entity_lookup',
-               'fm_entity_1_1',
-               'fm_entity_1_2',
-               'fm_entity_1_3',
-               'fm_entity_2_1',
-               'fm_entity_2_2',
-               'fm_custom',
-               'fm_custom_cols',
-               'fm_orders',
-               'fm_s_agreement',
-               'fm_s_agreement_attribute',
-               'fm_s_agreement_category',
-               'fm_s_agreement_choice',
-               'fm_s_agreement_detail',
-               'fm_s_agreement_pricing',
-               'fm_async_method',
-               'fm_cron_log',
-               'fm_origin',
-               'fm_tenant_claim',
-               'fm_tenant_claim_category'
-       );
-
-       /* The hooks this app includes, needed for hooks registration */
-       $setup_info['property']['hooks'] = array
-       (
-//             'home',
-               'add_def_pref',
-               'deleteaccount',
-               'manual',
-               'settings',
-               'preferences',
-               'admin',
-               'help'
-       );
-
-       /* Dependencies for this app to work */
-       $setup_info['property']['depends'][] = array
-       (
-               'appname'  => 'phpgwapi',
-               'versions' => Array('0.9.15', '0.9.16', '0.9.17', '0.9.18')
-       );
-
-       $setup_info['property']['depends'][] = array(
-               'appname'  => 'admin',
-               'versions' => Array('0.9.13', '0.9.14', '0.9.15', '0.9.16', 
'0.9.17', '0.9.18')
-       );
-
-       $setup_info['property']['depends'][] = array(
-               'appname'  => 'preferences',
-               'versions' => Array('0.9.13', '0.9.14', '0.9.15', '0.9.16', 
'0.9.17', '0.9.18')
-       );
-?>
+<?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$
+       */
+
+       $setup_info['property']['name']      = 'property';
+       $setup_info['property']['title']         = 'Property';
+       $setup_info['property']['version']   = '0.9.17.509';
+       $setup_info['property']['app_order'] = 8;
+       $setup_info['property']['enable']    = 1;
+
+       $setup_info['property']['author'][] = array
+       (
+               'name'  => 'Sigurd Nes',
+               'email' => 'address@hidden'
+       );
+
+       $setup_info['property']['maintainer'] = array
+       (
+               'name'  => 'Sigurd Nes',
+               'email' => 'address@hidden'
+       );
+
+       $setup_info['property']['license']  = 'GPL';
+       $setup_info['property']['description'] =
+       '<div align="left">
+
+       <b>FM</b> (Facilities-management) providing:
+       <ol>
+               <li>Helpdesk</li>
+               <li>Property register - with drawing and 
document-archive(vfs)</li>
+               <li>Equipment register</li>
+               <li>Vendor register (using Addressbook)</li>
+               <li>Tenant register</li>
+               <li>Project/workorder by email/pdf with ability to save 
workorders as templates for later use</li>
+                       <ol>
+                       <li>From vendors prizebook - or</li>
+                       <li>from templates - or</li>
+                       <li> by custom definition as (optional) tender for 
bidding based on (for the moment) norwegian building standards.</li>
+                       </ol>
+               <li>Service agreements with prizebook with historical prizing 
per vendor</li>
+               <li>Invoice handling</li>
+                       <ol>
+                       <li>Import from file (currently Three different 
formats)</li>
+            <li>Approval per Role</li>
+                               <ol>
+                               <li>Janitor</li>
+               <li>Supervisor</li>
+               <li>Budget responsible</li>
+                               </ol>
+            <li>Eksport to payment system / accounting system</li>
+                       </ol>
+       </ol>
+
+
+       <b>Property</b> is organized as a set of submodules - each with theis 
own set of user permission-settings.
+       <br>
+       <b>Workorder</b> can be used as a general tool for producing tender for 
bidding - the document is presented as a pdf-document.
+       </div>';
+
+       $setup_info['property']['note'] =
+               'I am also planning to add maintenance planning as events in 
the calendar app.';
+
+
+       $setup_info['property']['tables'] = array(
+               'fm_part_of_town',
+               'fm_gab_location',
+               'fm_streetaddress',
+               'fm_tenant',
+               'fm_tenant_category',
+               'fm_tenant_attribute',
+               'fm_tenant_choice',
+               'fm_vendor',
+               'fm_vendor_category',
+               'fm_vendor_attribute',
+               'fm_vendor_choice',
+               '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',
+               'fm_location_config',
+               'fm_building_part',
+               'fm_b_account',
+               'fm_dim_d',
+               'fm_workorder',
+               'fm_workorder_category',
+               'fm_workorder_history',
+               'fm_workorder_status',
+               'fm_activities',
+               'fm_agreement_group',
+               'fm_agreement',
+               'fm_agreement_status',
+               'fm_agreement_attribute',
+               'fm_agreement_choice',
+               'fm_activity_price_index',
+               'fm_branch',
+               'fm_wo_hours',
+               'fm_wo_hours_category',
+               'fm_wo_h_deviation',
+               'fm_key_loc',
+               'fm_request',
+               'fm_request_condition_type',
+               'fm_request_condition',
+               'fm_request_status',
+               'fm_request_category',
+               'fm_request_history',
+               'fm_template',
+               'fm_template_hours',
+               'fm_chapter',
+               'fm_ns3420',
+               'fm_project',
+               'fm_projectbranch',
+               'fm_project_history',
+               'fm_tts_tickets',
+               'fm_tts_category',
+               'fm_tts_history',
+               'fm_tts_views',
+               'fm_ecoart',
+               'fm_ecoavvik',
+               'fm_ecobilag',
+               'fm_ecobilagkilde',
+               'fm_ecobilagoverf',
+               'fm_ecobilagtype',
+               'fm_ecodimb',
+               'fm_ecodimd',
+               'fm_ecologg',
+               'fm_ecomva',
+               'fm_ecouser',
+               'fm_acl2',
+               'fm_investment',
+               'fm_investment_value',
+               'fm_event_receipt',
+               'fm_idgenerator',
+               'fm_document',
+               'fm_document_category',
+               'fm_document_history',
+               'fm_document_status',
+               'fm_acl_location',
+               'fm_standard_unit',
+               'fm_owner',
+               'fm_owner_category',
+               'fm_owner_attribute',
+               'fm_owner_choice',
+               'fm_cache',
+               'fm_entity',
+               'fm_entity_attribute',
+               'fm_entity_category',
+               'fm_entity_choice',
+               'fm_entity_lookup',
+               'fm_entity_1_1',
+               'fm_entity_1_2',
+               'fm_entity_1_3',
+               'fm_entity_2_1',
+               'fm_entity_2_2',
+               'fm_custom_function',
+               'fm_custom',
+               'fm_custom_cols',
+               'fm_orders',
+               'fm_s_agreement',
+               'fm_s_agreement_attribute',
+               'fm_s_agreement_category',
+               'fm_s_agreement_choice',
+               'fm_s_agreement_detail',
+               'fm_s_agreement_pricing',
+               'fm_async_method',
+               'fm_cron_log',
+               'fm_origin',
+               'fm_tenant_claim',
+               'fm_tenant_claim_category'
+       );
+
+       /* The hooks this app includes, needed for hooks registration */
+       $setup_info['property']['hooks'] = array
+       (
+//             'home',
+               'add_def_pref',
+               'deleteaccount',
+               'manual',
+               'settings',
+               'preferences',
+               'admin',
+               'help'
+       );
+
+       /* Dependencies for this app to work */
+       $setup_info['property']['depends'][] = array
+       (
+               'appname'  => 'phpgwapi',
+               'versions' => Array('0.9.15', '0.9.16', '0.9.17', '0.9.18')
+       );
+
+       $setup_info['property']['depends'][] = array(
+               'appname'  => 'admin',
+               'versions' => Array('0.9.13', '0.9.14', '0.9.15', '0.9.16', 
'0.9.17', '0.9.18')
+       );
+
+       $setup_info['property']['depends'][] = array(
+               'appname'  => 'preferences',
+               'versions' => Array('0.9.13', '0.9.14', '0.9.15', '0.9.16', 
'0.9.17', '0.9.18')
+       );
+?>

====================================================
Index: property/setup/tables_current.inc.php
diff -u property/setup/tables_current.inc.php:1.34 
property/setup/tables_current.inc.php:1.35
--- property/setup/tables_current.inc.php:1.34  Wed Sep 21 14:18:16 2005
+++ property/setup/tables_current.inc.php       Mon Oct 24 10:44:27 2005
@@ -1,1961 +1,1975 @@
-<?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$
-       */
-
-       $phpgw_baseline = array(
-               'fm_part_of_town' => array(
-                       'fd' => array(
-                               'part_of_town_id' => array('type' => 
'auto','precision' => '2','nullable' => False),
-                               'name' => array('type' => 'varchar','precision' 
=> '20','nullable' => True),
-                               'district_id' => array('type' => 
'int','precision' => '2','nullable' => True)
-                       ),
-                       'pk' => array('part_of_town_id'),
-                       'fk' => array(),
-                       'ix' => array(),
-                       'uc' => array()
-               ),
-
-
-               'fm_gab_location' => array(
-                       'fd' => array(
-                               'location_code' => array('type' => 
'varchar','precision' => '16','nullable' => False),
-                               'gab_id' => array('type' => 
'varchar','precision' => '20','nullable' => False),
-                               'user_id' => array('type' => 'int','precision' 
=> '4','nullable' => True),
-                               'entry_date' => array('type' => 
'int','precision' => '4','nullable' => True),
-                               'loc1' => array('type' => 'varchar','precision' 
=> '4','nullable' => True),
-                               'loc2' => array('type' => 'varchar','precision' 
=> '4','nullable' => True),
-                               'loc3' => array('type' => 'varchar','precision' 
=> '4','nullable' => True),
-                               'loc4' => array('type' => 'varchar','precision' 
=> '4','nullable' => True),
-                               'address' => array('type' => 
'varchar','precision' => '150','nullable' => True),
-                               'split' => array('type' => 'int','precision' => 
'2','nullable' => True),
-                               'remark' => array('type' => 
'varchar','precision' => '50','nullable' => True),
-                               'owner' => array('type' => 
'varchar','precision' => '5','nullable' => True),
-                               'Spredning' => array('type' => 
'int','precision' => '4','nullable' => True)
-                       ),
-                       'pk' => array('gab_id','location_code'),
-                       'fk' => array(),
-                       'ix' => array('location_code'),
-                       'uc' => array()
-               ),
-               'fm_streetaddress' => array(
-                       'fd' => array(
-                               'id' => array('type' => 'int','precision' => 
'4','nullable' => False),
-                               'descr' => array('type' => 
'varchar','precision' => '150','nullable' => False)
-                       ),
-                       'pk' => array('id'),
-                       'fk' => array(),
-                       'ix' => array(),
-                       'uc' => array()
-               ),
-               'fm_tenant' => array(
-                       'fd' => array(
-                               'id' => array('type' => 'int','precision' => 
'4','nullable' => False),
-                               'member_of' => array('type' => 
'varchar','precision' => '255','nullable' => True),
-                               'entry_date' => array('type' => 
'int','precision' => '4','nullable' => True),
-                               'first_name' => array('type' => 
'varchar','precision' => '30','nullable' => True),
-                               'last_name' => array('type' => 
'varchar','precision' => '30','nullable' => True),
-                               'contact_phone' => array('type' => 
'varchar','precision' => '20','nullable' => True),
-                               'category' => array('type' => 'int','precision' 
=> '4','nullable' => True)
-                       ),
-                       'pk' => array('id'),
-                       'fk' => array(),
-                       'ix' => array(),
-                       'uc' => array()
-               ),
-               'fm_tenant_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()
-               ),
-               'fm_tenant_attribute' => array(
-                       'fd' => array(
-                               'id' => array('type' => 'int','precision' => 
'4','nullable' => False),
-                               'column_name' => array('type' => 
'varchar','precision' => '20','nullable' => False),
-                               'input_text' => array('type' => 
'varchar','precision' => '20','nullable' => False),
-                               'list' => array('type' => 'int','precision' => 
'2','nullable' => True),
-                               'location_form' => array('type' => 
'int','precision' => '2','nullable' => True),
-                               'lookup_form' => array('type' => 
'int','precision' => '2','nullable' => True),
-                               'search' => array('type' => 'int','precision' 
=> '2','nullable' => True),
-                               'statustext' => array('type' => 
'varchar','precision' => '100','nullable' => False),
-                               'size' => array('type' => 'int','precision' => 
'4','nullable' => True),
-                               'datatype' => array('type' => 
'varchar','precision' => '10','nullable' => True),
-                               'attrib_sort' => array('type' => 
'int','precision' => '4','nullable' => True),
-                               'precision_' => array('type' => 
'int','precision' => '4','nullable' => True),
-                               'scale' => array('type' => 'int','precision' => 
'4','nullable' => True),
-                               'default_value' => array('type' => 
'varchar','precision' => '20','nullable' => True),
-                               'nullable' => array('type' => 
'varchar','precision' => '5','nullable' => False,'default' => 'True')
-                       ),
-                       'pk' => array('id'),
-                       'fk' => array(),
-                       'ix' => array(),
-                       'uc' => array()
-               ),
-
-               'fm_tenant_choice' => array(
-                       'fd' => array(
-                               'attrib_id' => array('type' => 
'int','precision' => '4','nullable' => False),
-                               'id' => array('type' => 'int','precision' => 
'4','nullable' => False),
-                               'value' => array('type' => 'text','nullable' => 
False)
-                       ),
-                       'pk' => array('attrib_id','id'),
-                       'fk' => array(),
-                       'ix' => array(),
-                       'uc' => array()
-               ),
-
-               'fm_vendor' => array(
-                       'fd' => array(
-                               'id' => array('type' => 'int','precision' => 
'4','nullable' => False),
-                               'entry_date' => array('type' => 
'int','precision' => '4','nullable' => True),
-                               'org_name' => array('type' => 
'varchar','precision' => '100','nullable' => True),
-                               'email' => array('type' => 
'varchar','precision' => '64','nullable' => True),
-                               'contact_phone' => array('type' => 
'varchar','precision' => '20','nullable' => True),
-                               'klasse' => array('type' => 
'varchar','precision' => '10','nullable' => True),
-                               'member_of' => array('type' => 
'varchar','precision' => '255','nullable' => True),
-                               'category' => array('type' => 'int','precision' 
=> '2','nullable' => True),
-                               'mva' => array('type' => 'int','precision' => 
'4','nullable' => True)
-                       ),
-                       'pk' => array('id'),
-                       'fk' => array(),
-                       'ix' => array(),
-                       'uc' => array()
-               ),
-               'fm_vendor_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()
-               ),
-               'fm_vendor_attribute' => array(
-                       'fd' => array(
-                               'id' => array('type' => 'int','precision' => 
'4','nullable' => False),
-                               'column_name' => array('type' => 
'varchar','precision' => '20','nullable' => False),
-                               'input_text' => array('type' => 
'varchar','precision' => '20','nullable' => False),
-                               'list' => array('type' => 'int','precision' => 
'2','nullable' => True),
-                               'location_form' => array('type' => 
'int','precision' => '2','nullable' => True),
-                               'lookup_form' => array('type' => 
'int','precision' => '2','nullable' => True),
-                               'search' => array('type' => 'int','precision' 
=> '2','nullable' => True),
-                               'statustext' => array('type' => 
'varchar','precision' => '100','nullable' => False),
-                               'size' => array('type' => 'int','precision' => 
'4','nullable' => True),
-                               'datatype' => array('type' => 
'varchar','precision' => '10','nullable' => True),
-                               'attrib_sort' => array('type' => 
'int','precision' => '4','nullable' => True),
-                               'precision_' => array('type' => 
'int','precision' => '4','nullable' => True),
-                               'scale' => array('type' => 'int','precision' => 
'4','nullable' => True),
-                               'default_value' => array('type' => 
'varchar','precision' => '20','nullable' => True),
-                               'nullable' => array('type' => 
'varchar','precision' => '5','nullable' => False,'default' => 'True')
-                       ),
-                       'pk' => array('id'),
-                       'fk' => array(),
-                       'ix' => array(),
-                       'uc' => array()
-               ),
-
-               'fm_vendor_choice' => array(
-                       'fd' => array(
-                               'attrib_id' => array('type' => 
'int','precision' => '4','nullable' => False),
-                               'id' => array('type' => 'int','precision' => 
'4','nullable' => False),
-                               'value' => array('type' => 'text','nullable' => 
False)
-                       ),
-                       'pk' => array('attrib_id','id'),
-                       'fk' => array(),
-                       'ix' => array(),
-                       'uc' => array()
-               ),
-
-
-               'fm_district' => array(
-                       'fd' => array(
-                               'id' => array('type' => 'int','precision' => 
'2','nullable' => False),
-                               'descr' => array('type' => 
'varchar','precision' => '20','nullable' => True)
-                       ),
-                       'pk' => array('id'),
-                       'fk' => array(),
-                       'ix' => array(),
-                       'uc' => array()
-               ),
-
-               'fm_standard_unit' => array(
-                       'fd' => array(
-                               'id' => array('type' => 'varchar','precision' 
=> '20','nullable' => False),
-                               'descr' => array('type' => 
'varchar','precision' => '255','nullable' => False)
-                       ),
-                       'pk' => array('id'),
-                       'fk' => array(),
-                       'ix' => array(),
-                       'uc' => array()
-               ),
-
-               'fm_location_type' => array(
-                       'fd' => array(
-                               'id' => array('type' => 'int','precision' => 
'4','nullable' => False),
-                               'name' => array('type' => 'varchar','precision' 
=> '20','nullable' => True),
-                               'descr' => array('type' => 
'varchar','precision' => '50','nullable' => True),
-                               'prefix' => array('type' => 
'varchar','precision' => '8','nullable' => True),
-                               'pk' => array('type' => 'text','nullable' => 
True),
-                               'ix' => array('type' => 'text','nullable' => 
True),
-                               'uc' => array('type' => 'text','nullable' => 
True),
-                       ),
-                       'pk' => array('id'),
-                       'fk' => array(),
-                       'ix' => array(),
-                       'uc' => array()
-               ),
-
-               'fm_location1' => 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),
-                       ),
-                       '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),
-                               'descr' => array('type' => 
'varchar','precision' => '255','nullable' => False)
-                       ),
-                       'pk' => array('id'),
-                       'fk' => array(),
-                       'ix' => array(),
-                       'uc' => array()
-               ),
-               'fm_location2' => 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),
-                       ),
-                       '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),
-                               'descr' => array('type' => 
'varchar','precision' => '255','nullable' => False)
-                       ),
-                       'pk' => array('id'),
-                       'fk' => array(),
-                       'ix' => array(),
-                       'uc' => array()
-               ),
-               'fm_location3' => 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),
-                       ),
-                       '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),
-                               'descr' => array('type' => 
'varchar','precision' => '255','nullable' => False)
-                       ),
-                       'pk' => array('id'),
-                       'fk' => array(),
-                       'ix' => array(),
-                       'uc' => array()
-               ),
-
-               'fm_location4' => 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),
-                       ),
-                       '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),
-                               'descr' => array('type' => 
'varchar','precision' => '255','nullable' => False)
-                       ),
-                       'pk' => array('id'),
-                       'fk' => array(),
-                       'ix' => array(),
-                       'uc' => array()
-               ),
-
-               'fm_location_config' => array(
-                       'fd' => array(
-                               'column_name' => array('type' => 
'varchar','precision' => '20','nullable' => False),
-                               'location_type' => array('type' => 
'int','precision' => '4','nullable' => False),
-                               'input_text' => array('type' => 
'varchar','precision' => '20','nullable' => True),
-                               'lookup_form' => array('type' => 
'int','precision' => '2','nullable' => True),
-                               'f_key' => array('type' => 'int','precision' => 
'2','nullable' => True),
-                               'ref_to_category' => array('type' => 
'int','precision' => '2','nullable' => True),
-                               'query_value' => array('type' => 
'int','precision' => '2','nullable' => True),
-                               'reference_table' => array('type' => 
'varchar','precision' => '30','nullable' => True),
-                               'reference_id' => array('type' => 
'varchar','precision' => '15','nullable' => True),
-                               'datatype' => array('type' => 
'varchar','precision' => '10','nullable' => True),
-                               'precision_' => array('type' => 
'int','precision' => '4','nullable' => True),
-                               'scale' => array('type' => 'int','precision' => 
'4','nullable' => True),
-                               'default_value' => array('type' => 
'varchar','precision' => '20','nullable' => True),
-                               'nullable' => array('type' => 
'varchar','precision' => '5','nullable' => False,'default' => 'True')
-                       ),
-                       'pk' => array('column_name'),
-                       'fk' => array(),
-                       'ix' => array(),
-                       'uc' => array()
-               ),
-
-               'fm_location_attrib' => array(
-                       'fd' => array(
-                               'type_id' => array('type' => 'int','precision' 
=> '4','nullable' => False),
-                               'id' => array('type' => 'int','precision' => 
'4','nullable' => False),
-                               'custom' => array('type' => 'int','precision' 
=> '4','nullable' => True),
-                               'column_name' => array('type' => 
'varchar','precision' => '20','nullable' => False),
-                               'input_text' => array('type' => 
'varchar','precision' => '20','nullable' => False),
-                               'list' => array('type' => 'int','precision' => 
'2','nullable' => True),
-                               'location_form' => array('type' => 
'int','precision' => '2','nullable' => True),
-                               'lookup_form' => array('type' => 
'int','precision' => '2','nullable' => True),
-                               'statustext' => array('type' => 
'varchar','precision' => '100','nullable' => False),
-                               'size' => array('type' => 'int','precision' => 
'4','nullable' => True),
-                               'datatype' => array('type' => 
'varchar','precision' => '10','nullable' => True),
-                               'attrib_sort' => array('type' => 
'int','precision' => '4','nullable' => True),
-                               'precision_' => array('type' => 
'int','precision' => '4','nullable' => True),
-                               'scale' => array('type' => 'int','precision' => 
'4','nullable' => True),
-                               'default_value' => array('type' => 
'varchar','precision' => '20','nullable' => True),
-                               'nullable' => array('type' => 
'varchar','precision' => '5','nullable' => False,'default' => 'True')
-                       ),
-                       'pk' => array('type_id','id'),
-                       'fk' => array(),
-                       'ix' => array(),
-                       'uc' => array()
-               ),
-
-               'fm_location_choice' => array(
-                       'fd' => array(
-                               'type_id' => array('type' => 'int','precision' 
=> '4','nullable' => False),
-                               'attrib_id' => array('type' => 
'int','precision' => '4','nullable' => False),
-                               'id' => array('type' => 'int','precision' => 
'4','nullable' => False),
-                               'value' => array('type' => 'text','nullable' => 
False)
-                       ),
-                       'pk' => array('type_id','attrib_id','id'),
-                       'fk' => array(),
-                       'ix' => array(),
-                       'uc' => array()
-               ),
-
-               'fm_building_part' => array(
-                       'fd' => array(
-                               'id' => array('type' => 'varchar','precision' 
=> '4','nullable' => False),
-                               'descr' => array('type' => 
'varchar','precision' => '50','nullable' => True)
-                       ),
-                       'pk' => array('id'),
-                       'fk' => array(),
-                       'ix' => array(),
-                       'uc' => array()
-               ),
-               'fm_b_account' => array(
-                       'fd' => array(
-                               'id' => array('type' => 'varchar','precision' 
=> '20','nullable' => False),
-                               'grouping' => array('type' => 
'varchar','precision' => '4','nullable' => False),
-                               'descr' => array('type' => 
'varchar','precision' => '100','nullable' => False),
-                               'mva' => array('type' => 'int','precision' => 
'4','nullable' => True),
-                               'responsible' => array('type' => 
'int','precision' => '4','nullable' => True),
-                       ),
-                       'pk' => array('id'),
-                       'fk' => array(),
-                       'ix' => array(),
-                       'uc' => array()
-               ),
-               'fm_dim_d' => array(
-                       'fd' => array(
-                               'id' => array('type' => 'int','precision' => 
'4','nullable' => False),
-                               'descr' => array('type' => 
'varchar','precision' => '25','nullable' => False)
-                       ),
-                       'pk' => array('id'),
-                       'fk' => array(),
-                       'ix' => array(),
-                       'uc' => array()
-               ),
-               'fm_workorder' => array(
-                       'fd' => array(
-                               'id' => array('type' => 'int','precision' => 
'4','nullable' => False),
-                               'num' => array('type' => 'varchar','precision' 
=> '20','nullable' => False),
-                               'project_id' => array('type' => 
'int','precision' => '4','nullable' => False),
-                               'user_id' => array('type' => 'int','precision' 
=> '4','nullable' => False),
-                               'access' => array('type' => 
'varchar','precision' => '7','nullable' => True),
-                               'category' => array('type' => 'int','precision' 
=> '4','nullable' => False),
-                               'chapter_id' => array('type' => 
'int','precision' => '4','nullable' => True),
-                               'entry_date' => array('type' => 
'int','precision' => '4','nullable' => False),
-                               'start_date' => array('type' => 
'int','precision' => '4','nullable' => False),
-                               'end_date' => array('type' => 'int','precision' 
=> '4','nullable' => False),
-                               'coordinator' => array('type' => 
'int','precision' => '4','nullable' => False),
-                               'vendor_id' => array('type' => 
'int','precision' => '4','nullable' => True),
-                               'status' => array('type' => 
'varchar','precision' => '20','nullable' => False,'default' => 'active'),
-                               'descr' => array('type' => 'text','nullable' => 
True),
-                               'title' => array('type' => 
'varchar','precision' => '255','nullable' => False),
-                               'budget' => array('type' => 
'decimal','precision' => '20','scale' => '2','nullable' => True,'default' => 
'0.00'),
-                               'calculation' => array('type' => 
'decimal','precision' => '20','scale' => '2','nullable' => True,'default' => 
'0.00'),
-                               'deviation' => array('type' => 
'decimal','precision' => '20','scale' => '2','nullable' => True),
-                               'act_mtrl_cost' => array('type' => 
'decimal','precision' => '20','scale' => '2','nullable' => True,'default' => 
'0.00'),
-                               'act_vendor_cost' => array('type' => 
'decimal','precision' => '20','scale' => '2','nullable' => True,'default' => 
'0.00'),
-                               'addition' => array('type' => 'int','precision' 
=> '4','nullable' => True),
-                               'rig_addition' => array('type' => 
'int','precision' => '4','nullable' => True),
-                               'account_id' => array('type' => 
'varchar','precision' => '20','nullable' => True),
-                               'key_fetch' => array('type' => 
'int','precision' => '4','nullable' => True),
-                               'key_deliver' => array('type' => 
'int','precision' => '4','nullable' => True),
-                               'integration' => array('type' => 
'int','precision' => '4','nullable' => True),
-                               'charge_tenant' => array('type' => 
'int','precision' => '2','nullable' => True),
-                               'claim_issued' => array('type' => 
'int','precision' => '2','nullable' => True)
-                       ),
-                       'pk' => array('id'),
-                       'fk' => array(),
-                       'ix' => array(),
-                       'uc' => array()
-               ),
-               'fm_workorder_category' => array(
-                       'fd' => array(
-                               'id' => array('type' => 'int','precision' => 
'4','nullable' => False),
-                               'descr' => array('type' => 
'varchar','precision' => '50','nullable' => True)
-                       ),
-                       'pk' => array('id'),
-                       'fk' => array(),
-                       'ix' => array(),
-                       'uc' => array()
-               ),
-               'fm_workorder_status' => array(
-                       'fd' => array(
-                               'id' => array('type' => 'varchar','precision' 
=> '20','nullable' => False),
-                               'descr' => array('type' => 
'varchar','precision' => '255','nullable' => False)
-                       ),
-                       'pk' => array('id'),
-                       'fk' => array(),
-                       'ix' => array(),
-                       'uc' => array()
-               ),
-               'fm_activities' => array(
-                       'fd' => array(
-                               'id' => array('type' => 'int','precision' => 
'4','nullable' => False),
-                               'num' => array('type' => 'varchar','precision' 
=> '25','nullable' => False),
-                               'base_descr' => array('type' => 
'text','nullable' => True),
-                               'unit' => array('type' => 'varchar','precision' 
=> '4','nullable' => True),
-                               'ns3420' => array('type' => 
'varchar','precision' => '15','nullable' => True),
-                               'remarkreq' => array('type' => 
'varchar','precision' => '5','nullable' => True,'default' => 'N'),
-                               'minperae' => array('type' => 'int','precision' 
=> '4','default' => '0','nullable' => True),
-                               'billperae' => array('type' => 
'decimal','precision' => '20','scale' => '2','nullable' => True,'default' => 
'0.00'),
-                               'dim_d' => array('type' => 'int','precision' => 
'4','nullable' => True),
-                               'descr' => array('type' => 'text','nullable' => 
True),
-                               'branch_id' => array('type' => 
'int','precision' => '4','nullable' => True),
-                               'agreement_group_id' => array('type' => 
'int','precision' => '4','nullable' => True)
-                       ),
-                       'pk' => array('id'),
-                       'fk' => array(),
-                       'ix' => array(),
-                       'uc' => array()
-               ),
-               'fm_agreement_group' => array(
-                       'fd' => array(
-                               'id' => array('type' => 'int','precision' => 
'4','nullable' => False),
-                               'num' => array('type' => 'varchar','precision' 
=> '25','nullable' => False),
-                               'descr' => array('type' => 
'varchar','precision' => '50','nullable' => False),
-                               'status' => array('type' => 
'varchar','precision' => '15','nullable' => False)
-                       ),
-                       'pk' => array('id'),
-                       'fk' => array(),
-                       'ix' => array(),
-                       'uc' => array()
-               ),
-               'fm_agreement' => array(
-                       'fd' => array(
-                               'group_id' => array('type' => 'int','precision' 
=> '4','nullable' => False),
-                               'id' => array('type' => 'int','precision' => 
'4','nullable' => False),
-                               'vendor_id' => array('type' => 
'int','precision' => '4','nullable' => False),
-                               'name' => array('type' => 'varchar','precision' 
=> '100','nullable' => False),
-                               'descr' => array('type' => 'text','nullable' => 
True),
-                               'status' => array('type' => 
'varchar','precision' => '10','nullable' => True),
-                               'entry_date' => array('type' => 
'int','precision' => '4','nullable' => True),
-                               'start_date' => array('type' => 
'int','precision' => '4','nullable' => True),
-                               'end_date' => array('type' => 'int','precision' 
=> '4','nullable' => True),
-                               'termination_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)
-                       ),
-                       'pk' => array('group_id','id'),
-                       'fk' => array(),
-                       'ix' => array(),
-                       'uc' => array()
-               ),
-               'fm_agreement_status' => array(
-                       'fd' => array(
-                               'id' => array('type' => 'varchar','precision' 
=> '20','nullable' => False),
-                               'descr' => array('type' => 
'varchar','precision' => '255','nullable' => False)
-                       ),
-                       'pk' => array('id'),
-                       'fk' => array(),
-                       'ix' => array(),
-                       'uc' => array()
-               ),
-
-               'fm_agreement_attribute' => array(
-                       'fd' => array(
-                               'id' => array('type' => 'int', 'precision' => 
4,'nullable' => False,'default' => '0'),
-                               'attrib_detail' => array('type' => 'int', 
'precision' => 2,'nullable' => False,'default' => '0'),
-                               'list' => array('type' => 'int', 'precision' => 
2,'nullable' => True),
-                               'location_form' => array('type' => 'int', 
'precision' => 2,'nullable' => True),
-                               'lookup_form' => array('type' => 'int', 
'precision' => 4,'nullable' => True),
-                               'column_name' => array('type' => 'varchar', 
'precision' => 20,'nullable' => False),
-                               'input_text' => array('type' => 'varchar', 
'precision' => 50,'nullable' => False),
-                               'statustext' => array('type' => 'varchar', 
'precision' => 100,'nullable' => False),
-                               'size' => array('type' => 'int', 'precision' => 
4,'nullable' => True),
-                               'datatype' => array('type' => 'varchar', 
'precision' => 10,'nullable' => False),
-                               'attrib_sort' => array('type' => 'int', 
'precision' => 4,'nullable' => True),
-                               'precision_' => array('type' => 'int', 
'precision' => 4,'nullable' => True),
-                               'scale' => array('type' => 'int', 'precision' 
=> 4,'nullable' => True),
-                               'default_value' => array('type' => 'varchar', 
'precision' => 18,'nullable' => True),
-                               'nullable' => array('type' => 'varchar', 
'precision' => 5,'nullable' => False,'default' => 'True'),
-                               'search' => array('type' => 'int', 'precision' 
=> 2,'nullable' => True)
-                       ),
-                       'pk' => array('id','attrib_detail'),
-                       'fk' => array(),
-                       'ix' => array(),
-                       'uc' => array()
-               ),
-
-               'fm_agreement_choice' => array(
-                       'fd' => array(
-                               'attrib_id' => array('type' => 'int', 
'precision' => 4,'nullable' => False,'default' => '0'),
-                               'id' => array('type' => 'int', 'precision' => 
4,'nullable' => False,'default' => '0'),
-                               'value' => array('type' => 'varchar', 
'precision' => 255,'nullable' => True),
-                               'attrib_detail' => array('type' => 'int', 
'precision' => 2,'nullable' => False,'default' => '0')
-                       ),
-                       'pk' => array('attrib_id','id','attrib_detail'),
-                       'fk' => array(),
-                       'ix' => array(),
-                       'uc' => array()
-               ),
-
-               'fm_activity_price_index' => array(
-                       'fd' => array(
-                               'activity_id' => array('type' => 
'int','precision' => '4','nullable' => False),
-                               'agreement_id' => array('type' => 
'int','precision' => '4','nullable' => False),
-                               'index_count' => array('type' => 
'int','precision' => '4','nullable' => False),
-                               'current_index' => array('type' => 
'int','precision' => '2','nullable' => True),
-                               'this_index' => array('type' => 
'decimal','precision' => '20','scale' => '4','nullable' => True,'default' => 
'0.00'),
-                               'm_cost' => array('type' => 
'decimal','precision' => '20','scale' => '2','nullable' => True,'default' => 
'0.00'),
-                               'w_cost' => array('type' => 
'decimal','precision' => '20','scale' => '2','nullable' => True,'default' => 
'0.00'),
-                               'total_cost' => array('type' => 
'decimal','precision' => '20','scale' => '2','nullable' => True,'default' => 
'0.00'),
-                               'entry_date' => array('type' => 
'int','precision' => '4','nullable' => True),
-                               'index_date' => array('type' => 
'int','precision' => '4','nullable' => True),
-                               'user_id' => array('type' => 'int','precision' 
=> '4','nullable' => True)
-                       ),
-                       'pk' => 
array('activity_id','agreement_id','index_count'),
-                       'fk' => array(),
-                       'ix' => array(),
-                       'uc' => array()
-               ),
-               'fm_branch' => array(
-                       'fd' => array(
-                               'id' => array('type' => 'int','precision' => 
'4','nullable' => False),
-                               'num' => array('type' => 'varchar','precision' 
=> '20','nullable' => False),
-                               'descr' => array('type' => 
'varchar','precision' => '255','nullable' => False)
-                       ),
-                       'pk' => array('id'),
-                       'fk' => array(),
-                       'ix' => array(),
-                       'uc' => array()
-               ),
-               'fm_wo_hours' => array(
-                       'fd' => array(
-                               'id' => array('type' => 'auto','precision' => 
'4','nullable' => False),
-                               'record' => array('type' => 'int','precision' 
=> '4','nullable' => True),
-                               'owner' => array('type' => 'int','precision' => 
'4','nullable' => False),
-                               'workorder_id' => array('type' => 
'int','precision' => '4','nullable' => False),
-                               'activity_id' => array('type' => 
'int','precision' => '4','nullable' => True),
-                               'activity_num' => array('type' => 
'varchar','precision' => '15','nullable' => True),
-                               'grouping_id' => array('type' => 
'int','precision' => '4','nullable' => True),
-                               'grouping_descr' => array('type' => 
'varchar','precision' => '50','nullable' => True),
-                               'entry_date' => array('type' => 
'int','precision' => '4','nullable' => False),
-                               'hours_descr' => array('type' => 
'varchar','precision' => '255','nullable' => True),
-                               'remark' => array('type' => 'text','nullable' 
=> True),
-                               'billperae' => array('type' => 
'decimal','precision' => '20','scale' => '2','nullable' => True,'default' => 
'0.00'),
-                               'vendor_id' => array('type' => 
'int','precision' => '4','nullable' => True),
-                               'unit' => array('type' => 'varchar','precision' 
=> '6','nullable' => True),
-                               'ns3420_id' => array('type' => 
'varchar','precision' => '20','nullable' => True),
-                               'tolerance' => array('type' => 
'int','precision' => '4','nullable' => True),
-                               'building_part' => array('type' => 
'varchar','precision' => '4','nullable' => True),
-                               'quantity' => array('type' => 
'decimal','precision' => '20','scale' => '2','nullable' => True),
-                               'cost' => array('type' => 'decimal','precision' 
=> '20','scale' => '2','nullable' => True),
-                               'dim_d' => array('type' => 'int','precision' => 
'4','nullable' => True),
-                               'category' => array('type' => 'int','precision' 
=> '4','nullable' => True)
-                       ),
-                       'pk' => array('id'),
-                       'fk' => array(),
-                       'ix' => array(),
-                       'uc' => array()
-               ),
-               '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()
-               ),
-               'fm_wo_h_deviation' => array(
-                       'fd' => array(
-                               'workorder_id' => array('type' => 
'int','precision' => '4','nullable' => False),
-                               'hour_id' => array('type' => 'int','precision' 
=> '4','nullable' => False),
-                               'id' => array('type' => 'int','precision' => 
'4','nullable' => False),
-                               'amount' => array('type' => 'int','precision' 
=> '4','nullable' => False),
-                               'descr' => array('type' => 'text','nullable' => 
True),
-                               'entry_date' => array('type' => 
'int','precision' => '4','nullable' => True)
-                       ),
-                       'pk' => array('workorder_id','hour_id','id'),
-                       'fk' => array(),
-                       'ix' => array(),
-                       'uc' => array()
-               ),
-               'fm_template' => array(
-                       'fd' => array(
-                               'id' => array('type' => 'auto','precision' => 
'4','nullable' => False),
-                               'name' => array('type' => 'varchar','precision' 
=> '50','nullable' => True),
-                               'descr' => array('type' => 
'varchar','precision' => '255','nullable' => True),
-                               'owner' => array('type' => 'int','precision' => 
'4','nullable' => True),
-                               'chapter_id' => array('type' => 
'int','precision' => '4','nullable' => True),
-                               'entry_date' => array('type' => 
'int','precision' => '4','nullable' => True)
-                       ),
-                       'pk' => array('id'),
-                       'fk' => array(),
-                       'ix' => array(),
-                       'uc' => array()
-               ),
-               'fm_template_hours' => array(
-                       'fd' => array(
-                               'id' => array('type' => 'auto','precision' => 
'4','nullable' => False),
-                               'template_id' => array('type' => 
'int','precision' => '4','nullable' => False),
-                               'record' => array('type' => 'int','precision' 
=> '4','nullable' => True),
-                               'owner' => array('type' => 'int','precision' => 
'4','nullable' => False),
-                               'workorder_id' => array('type' => 
'int','precision' => '4','nullable' => False),
-                               'activity_id' => array('type' => 
'int','precision' => '4','nullable' => True),
-                               'activity_num' => array('type' => 
'varchar','precision' => '15','nullable' => True),
-                               'grouping_id' => array('type' => 
'int','precision' => '4','nullable' => True),
-                               'grouping_descr' => array('type' => 
'varchar','precision' => '50','nullable' => True),
-                               'hours_descr' => array('type' => 
'varchar','precision' => '255','nullable' => True),
-                               'remark' => array('type' => 'text','nullable' 
=> True),
-                               'billperae' => array('type' => 
'decimal','precision' => '20','scale' => '2','nullable' => True,'default' => 
'0.00'),
-                               'vendor_id' => array('type' => 
'int','precision' => '4','nullable' => True),
-                               'unit' => array('type' => 'varchar','precision' 
=> '6','nullable' => True),
-                               'ns3420_id' => array('type' => 
'varchar','precision' => '20','nullable' => True),
-                               'tolerance' => array('type' => 
'int','precision' => '4','nullable' => True),
-                               'building_part' => array('type' => 
'varchar','precision' => '4','nullable' => True),
-                               'quantity' => array('type' => 
'decimal','precision' => '20','scale' => '2','nullable' => True),
-                               'cost' => array('type' => 'decimal','precision' 
=> '20','scale' => '2','nullable' => True),
-                               'dim_d' => array('type' => 'int','precision' => 
'4','nullable' => True)
-                       ),
-                       'pk' => array('id'),
-                       'fk' => array(),
-                       'ix' => array(),
-                       'uc' => array()
-               ),
-               'fm_key_loc' => array(
-                       'fd' => array(
-                               'id' => array('type' => 'int','precision' => 
'4','nullable' => False),
-                               'num' => array('type' => 'varchar','precision' 
=> '20','nullable' => False),
-                               'descr' => array('type' => 
'varchar','precision' => '255','nullable' => False)
-                       ),
-                       'pk' => array('id'),
-                       'fk' => array(),
-                       'ix' => array(),
-                       'uc' => array()
-               ),
-               'fm_chapter' => array(
-                       'fd' => array(
-                               'id' => array('type' => 'int','precision' => 
'4','nullable' => False),
-                               'descr' => array('type' => 
'varchar','precision' => '50','nullable' => False)
-                       ),
-                       'pk' => array('id'),
-                       'fk' => array(),
-                       'ix' => array(),
-                       'uc' => array()
-               ),
-               'fm_request' => array(
-                       'fd' => array(
-                               'id' => array('type' => 'int','precision' => 
'4','nullable' => False),
-                               'title' => array('type' => 
'varchar','precision' => '20','nullable' => True),
-                               'project_id' => array('type' => 
'int','precision' => '4','nullable' => True),
-                               'p_num' => array('type' => 
'varchar','precision' => '15','nullable' => True),
-                               'p_entity_id' => array('type' => 
'int','precision' => '4','nullable' => True),
-                               'p_cat_id' => array('type' => 'int','precision' 
=> '4','nullable' => True),
-                               'location_code' => array('type' => 
'varchar','precision' => '20','nullable' => True),
-                               'loc1' => array('type' => 'varchar','precision' 
=> '4','nullable' => True),
-                               'loc2' => array('type' => 'varchar','precision' 
=> '4','nullable' => True),
-                               'loc3' => array('type' => 'varchar','precision' 
=> '4','nullable' => True),
-                               'loc4' => array('type' => 'varchar','precision' 
=> '4','nullable' => True),
-                               'descr' => array('type' => 'text','nullable' => 
True),
-                               'category' => array('type' => 'int','precision' 
=> '4','nullable' => True),
-                               'owner' => array('type' => 'int','precision' => 
'4','nullable' => True),
-                               'access' => array('type' => 
'varchar','precision' => '7','nullable' => True),
-                               'floor' => array('type' => 
'varchar','precision' => '6','nullable' => True),
-                               'address' => array('type' => 
'varchar','precision' => '150','nullable' => True),
-                               'tenant_id' => array('type' => 
'int','precision' => '4','nullable' => True),
-                               'contact_phone' => array('type' => 
'varchar','precision' => '20','nullable' => True),
-                               'entry_date' => array('type' => 
'int','precision' => '4','nullable' => True),
-                               'budget' => array('type' => 'int','precision' 
=> '4','nullable' => True),
-                               'status' => array('type' => 
'varchar','precision' => '10','nullable' => True),
-                               'branch_id' => array('type' => 
'int','precision' => '4','nullable' => True),
-                               'coordinator' => array('type' => 
'int','precision' => '4','nullable' => True),
-                               'authorities_demands' => array('type' => 
'int','precision' => '2','default' => '0','nullable' => True),
-                               'score' => array('type' => 'int','precision' => 
'4','default' => '0','nullable' => True)
-                       ),
-                       'pk' => array('id'),
-                       'fk' => array(),
-                       'ix' => array('location_code'),
-                       'uc' => array()
-               ),
-               'fm_request_condition' => array(
-                       'fd' => array(
-                               'request_id' => array('type' => 
'int','precision' => '4','nullable' => False),
-                               'condition_type' => array('type' => 
'int','precision' => '4','nullable' => False),
-                               'degree' => array('type' => 'int','precision' 
=> '4','default' => '0','nullable' => True),
-                               'probability' => array('type' => 
'int','precision' => '4','default' => '0','nullable' => True),
-                               'consequence' => array('type' => 
'int','precision' => '4','default' => '0','nullable' => True),
-                               'user_id' => array('type' => 'int','precision' 
=> '4','nullable' => True),
-                               'entry_date' => array('type' => 
'int','precision' => '4','nullable' => True)
-                       ),
-                       'pk' => array('request_id','condition_type'),
-                       'fk' => array(),
-                       'ix' => array(),
-                       'uc' => array()
-               ),
-               'fm_request_status' => array(
-                       'fd' => array(
-                               'id' => array('type' => 'varchar','precision' 
=> '20','nullable' => False),
-                               'descr' => array('type' => 
'varchar','precision' => '255','nullable' => False)
-                       ),
-                       'pk' => array('id'),
-                       'fk' => array(),
-                       'ix' => array(),
-                       'uc' => array()
-               ),
-               'fm_request_category' => array(
-                       'fd' => array(
-                               'id' => array('type' => 'int','precision' => 
'4','nullable' => False),
-                               'descr' => array('type' => 
'varchar','precision' => '50','nullable' => True)
-                       ),
-                       'pk' => array('id'),
-                       'fk' => array(),
-                       'ix' => array(),
-                       'uc' => array()
-               ),
-               'fm_ns3420' => array(
-                       'fd' => array(
-                               'id' => array('type' => 'varchar','precision' 
=> '20','nullable' => False),
-                               'tekst1' => array('type' => 
'varchar','precision' => '50','nullable' => True),
-                               'enhet' => array('type' => 
'varchar','precision' => '6','nullable' => True),
-                               'tekst2' => array('type' => 
'varchar','precision' => '50','nullable' => True),
-                               'tekst3' => array('type' => 
'varchar','precision' => '50','nullable' => True),
-                               'tekst4' => array('type' => 
'varchar','precision' => '50','nullable' => True),
-                               'tekst5' => array('type' => 
'varchar','precision' => '50','nullable' => True),
-                               'tekst6' => array('type' => 
'varchar','precision' => '50','nullable' => True),
-                               'parent' => array('type' => 
'varchar','precision' => '20','nullable' => True),
-                               'type' => array('type' => 'varchar','precision' 
=> '20','nullable' => True)
-                       ),
-                       'pk' => array('id'),
-                       'fk' => array(),
-                       'ix' => array(),
-                       'uc' => array()
-               ),
-               'fm_tts_tickets' => array(
-                       'fd' => array(
-                               'id' => array('type' => 'auto','nullable' => 
False),
-                               'group_id' => array('type' => 'int','precision' 
=> '4','nullable' => True),
-                               'priority' => array('type' => 'int','precision' 
=> '2','nullable' => False),
-                               'user_id' => array('type' => 'int','precision' 
=> '4','nullable' => True),
-                               'assignedto' => array('type' => 
'int','precision' => '4','nullable' => True),
-                               'subject' => array('type' => 
'varchar','precision' => '255','nullable' => True),
-                               'cat_id' => array('type' => 'int','precision' 
=> '4','nullable' => True),
-                               'billable_hours' => array('type' => 
'decimal','precision' => '8','scale' => '2','nullable' => True),
-                               'billable_rate' => array('type' => 
'decimal','precision' => '8','scale' => '2','nullable' => True),
-                               'status' => array('type' => 'char','precision' 
=> '1','nullable' => False),
-                               'details' => array('type' => 'text','nullable' 
=> False),
-                               'location_code' => array('type' => 
'varchar','precision' => '50','nullable' => True),
-                               'p_num' => array('type' => 
'varchar','precision' => '15','nullable' => True),
-                               'p_entity_id' => array('type' => 
'int','precision' => '4','nullable' => True),
-                               'p_cat_id' => array('type' => 'int','precision' 
=> '4','nullable' => True),
-                               'loc1' => array('type' => 'varchar','precision' 
=> '4','nullable' => True),
-                               'loc2' => array('type' => 'varchar','precision' 
=> '4','nullable' => True),
-                               'loc3' => array('type' => 'varchar','precision' 
=> '4','nullable' => True),
-                               'loc4' => array('type' => 'varchar','precision' 
=> '4','nullable' => True),
-                               'floor' => array('type' => 
'varchar','precision' => '6','nullable' => True),
-                               'address' => array('type' => 
'varchar','precision' => '150','nullable' => True),
-                               'contact_phone' => array('type' => 
'varchar','precision' => '20','nullable' => True),
-                               'tenant_id' => array('type' => 
'int','precision' => '4','nullable' => True),
-                               'entry_date' => array('type' => 
'int','precision' => '4','nullable' => True),
-                               'finnish_date' => array('type' => 
'int','precision' => '4','nullable' => True),
-                               'finnish_date2' => array('type' => 
'int','precision' => '4','nullable' => True)
-                       ),
-                       'pk' => array('id'),
-                       'ix' => array(),
-                       'ix' => array('location_code'),
-                       'uc' => array()
-               ),
-               'fm_tts_views' => array(
-                       'fd' => array(
-                               'id' => array('type' => 'int','precision' => 
'4','nullable' => False),
-                               'account_id' => array('type' => 
'int','precision' => '4','nullable' => True),
-                               'time' => array('type' => 'int','precision' => 
'4','nullable' => False)
-                       ),
-                       'pk' => array(),
-                       'ix' => array(),
-                       'fk' => array(),
-                       'uc' => array()
-               ),
-               'fm_tts_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()
-               ),
-               'fm_ecoart' => array(
-                       'fd' => array(
-                               'id' => array('type' => 'int','precision' => 
'4','nullable' => False),
-                               'name' => array('type' => 'varchar','precision' 
=> '20','nullable' => False),
-                               'description' => array('type' => 
'text','nullable' => True)
-                       ),
-                       'pk' => array('id'),
-                       'ix' => array(),
-                       'fk' => array(),
-                       'uc' => array()
-               ),
-               'fm_ecoavvik' => array(
-                       'fd' => array(
-                               'bilagsnr' => array('type' => 'int','precision' 
=> '4','nullable' => False),
-                               'belop' => array('type' => 
'decimal','precision' => '20','scale' => '2','default' => '0','nullable' => 
False),
-                               'fakturadato' => array('type' => 
'timestamp','nullable' => False),
-                               'forfallsdato' => array('type' => 
'timestamp','nullable' => False),
-                               'artid' => array('type' => 'int','precision' => 
'2','nullable' => False),
-                               'godkjentbelop' => array('type' => 
'decimal','precision' => '20','scale' => '2','default' => '0','nullable' => 
True),
-                               'spvend_code' => array('type' => 
'varchar','precision' => '12','nullable' => True),
-                               'oppsynsmannid' => array('type' => 
'varchar','precision' => '12','nullable' => True),
-                               'saksbehandlerid' => array('type' => 
'varchar','precision' => '12','nullable' => True),
-                               'budsjettansvarligid' => array('type' => 
'varchar','precision' => '12','nullable' => False),
-                               'utbetalingid' => array('type' => 
'varchar','precision' => '12','nullable' => True),
-                               'oppsynsigndato' => array('type' => 
'timestamp','nullable' => True),
-                               'saksigndato' => array('type' => 
'timestamp','nullable' => True),
-                               'budsjettsigndato' => array('type' => 
'timestamp','nullable' => True),
-                               'utbetalingsigndato' => array('type' => 
'timestamp','nullable' => True),
-                               'overftid' => array('type' => 
'timestamp','nullable' => True)
-                       ),
-                       'pk' => array('bilagsnr'),
-                       'ix' => array(),
-                       'fk' => array(),
-                       'uc' => array()
-               ),
-               'fm_ecobilag' => array(
-                       'fd' => array(
-                               'id' => array('type' => 'auto','precision' => 
'4','nullable' => False),
-                               'bilagsnr' => array('type' => 'int','precision' 
=> '4','nullable' => False),
-                               'kidnr' => array('type' => 
'varchar','precision' => '30','nullable' => True),
-                               'typeid' => array('type' => 'int','precision' 
=> '2','nullable' => False),
-                               'kildeid' => array('type' => 'int','precision' 
=> '2','nullable' => False),
-                               'project_id' => array('type' => 
'int','precision' => '4','nullable' => True),
-                               'kostra_id' => array('type' => 
'int','precision' => '4','nullable' => True),
-                               'pmwrkord_code' => array('type' => 
'int','precision' => '4','nullable' => True),
-                               'belop' => array('type' => 
'decimal','precision' => '20','scale' => '2','default' => '0','nullable' => 
False),
-                               'fakturadato' => array('type' => 
'timestamp','nullable' => False),
-                               'periode' => array('type' => 'int','precision' 
=> '2','nullable' => True),
-                               'forfallsdato' => array('type' => 
'timestamp','nullable' => False),
-                               'fakturanr' => array('type' => 
'varchar','precision' => '15','nullable' => False),
-                               'spbudact_code' => array('type' => 
'varchar','precision' => '30','nullable' => True),
-                               'regtid' => array('type' => 
'timestamp','nullable' => False),
-                               'artid' => array('type' => 'int','precision' => 
'2','nullable' => False),
-                               'godkjentbelop' => array('type' => 
'decimal','precision' => '20','scale' => '2','default' => '0','nullable' => 
True),
-                               'spvend_code' => array('type' => 
'varchar','precision' => '12','nullable' => True),
-                               'dima' => array('type' => 'varchar','precision' 
=> '20','nullable' => True),
-                               'loc1' => array('type' => 'varchar','precision' 
=> '10','nullable' => True),
-                               'dimb' => array('type' => 'int','precision' => 
'2','nullable' => True),
-                               'mvakode' => array('type' => 'int','precision' 
=> '2','nullable' => True),
-                               'dimd' => array('type' => 'varchar','precision' 
=> '5','nullable' => True),
-                               'oppsynsmannid' => array('type' => 
'varchar','precision' => '12','nullable' => True),
-                               'saksbehandlerid' => array('type' => 
'varchar','precision' => '12','nullable' => True),
-                               'budsjettansvarligid' => array('type' => 
'varchar','precision' => '12','nullable' => False),
-                               'utbetalingid' => array('type' => 
'varchar','precision' => '12','nullable' => True),
-                               'oppsynsigndato' => array('type' => 
'timestamp','nullable' => True),
-                               'saksigndato' => array('type' => 
'timestamp','nullable' => True),
-                               'budsjettsigndato' => array('type' => 
'timestamp','nullable' => True),
-                               'utbetalingsigndato' => array('type' => 
'timestamp','nullable' => True),
-                               'merknad' => array('type' => 'text','nullable' 
=> True),
-                               'splitt' => array('type' => 'int','precision' 
=> '2','nullable' => True),
-                               'kreditnota' => array('type' => 
'int','precision' => '2','nullable' => True),
-                               'pre_transfer' => array('type' => 
'int','precision' => '2','nullable' => True)
-                       ),
-                       'pk' => array('id'),
-                       'ix' => array(),
-                       'fk' => array(),
-                       'uc' => array()
-               ),
-               'fm_ecobilagoverf' => array(
-                       'fd' => array(
-                               'id' => array('type' => 'int','precision' => 
'4','nullable' => False),
-                               'bilagsnr' => array('type' => 'int','precision' 
=> '4','nullable' => False),
-                               'kidnr' => array('type' => 
'varchar','precision' => '30','nullable' => True),
-                               'typeid' => array('type' => 'int','precision' 
=> '2','nullable' => False),
-                               'kildeid' => array('type' => 'int','precision' 
=> '2','nullable' => False),
-                               'project_id' => array('type' => 
'int','precision' => '4','nullable' => True),
-                               'kostra_id' => array('type' => 
'int','precision' => '4','nullable' => True),
-                               'pmwrkord_code' => array('type' => 
'int','precision' => '4','nullable' => True),
-                               'belop' => array('type' => 
'decimal','precision' => '20','scale' => '2','default' => '0','nullable' => 
False),
-                               'fakturadato' => array('type' => 
'timestamp','nullable' => False),
-                               'periode' => array('type' => 'int','precision' 
=> '2','nullable' => True),
-                               'forfallsdato' => array('type' => 
'timestamp','nullable' => False),
-                               'fakturanr' => array('type' => 
'varchar','precision' => '15','nullable' => False),
-                               'spbudact_code' => array('type' => 
'varchar','precision' => '30','nullable' => True),
-                               'regtid' => array('type' => 
'timestamp','nullable' => False),
-                               'artid' => array('type' => 'int','precision' => 
'2','nullable' => False),
-                               'godkjentbelop' => array('type' => 
'decimal','precision' => '20','scale' => '2','default' => '0','nullable' => 
True),
-                               'spvend_code' => array('type' => 
'varchar','precision' => '12','nullable' => True),
-                               'dima' => array('type' => 'varchar','precision' 
=> '20','nullable' => True),
-                               'loc1' => array('type' => 'varchar','precision' 
=> '10','nullable' => True),
-                               'dimb' => array('type' => 'int','precision' => 
'2','nullable' => True),
-                               'mvakode' => array('type' => 'int','precision' 
=> '2','nullable' => True),
-                               'dimd' => array('type' => 'varchar','precision' 
=> '5','nullable' => True),
-                               'oppsynsmannid' => array('type' => 
'varchar','precision' => '12','nullable' => True),
-                               'saksbehandlerid' => array('type' => 
'varchar','precision' => '12','nullable' => True),
-                               'budsjettansvarligid' => array('type' => 
'varchar','precision' => '12','nullable' => False),
-                               'utbetalingid' => array('type' => 
'varchar','precision' => '12','nullable' => True),
-                               'oppsynsigndato' => array('type' => 
'timestamp','nullable' => True),
-                               'saksigndato' => array('type' => 
'timestamp','nullable' => True),
-                               'budsjettsigndato' => array('type' => 
'timestamp','nullable' => True),
-                               'utbetalingsigndato' => array('type' => 
'timestamp','nullable' => True),
-                               'overftid' => array('type' => 
'timestamp','nullable' => True,'default' => 'current_timestamp'),
-                               'ordrebelop' => array('type' => 
'decimal','precision' => '20','scale' => '2','default' => '0','nullable' => 
False),
-                               'merknad' => array('type' => 'text','nullable' 
=> True),
-                               'splitt' => array('type' => 'int','precision' 
=> '2','nullable' => True),
-                               'filnavn' => array('type' => 
'varchar','precision' => '255','nullable' => False),
-                               'kreditnota' => array('type' => 
'int','precision' => '2','nullable' => True)
-                       ),
-                       'pk' => array('id'),
-                       'ix' => array(),
-                       'fk' => array(),
-                       'uc' => array()
-               ),
-               'fm_ecobilagkilde' => array(
-                       'fd' => array(
-                               'id' => array('type' => 'int','precision' => 
'2','nullable' => False),
-                               'name' => array('type' => 'varchar','precision' 
=> '20','nullable' => False),
-                               'description' => array('type' => 
'text','nullable' => True)
-                       ),
-                       'pk' => array('id'),
-                       'ix' => array(),
-                       'fk' => array(),
-                       'uc' => array()
-               ),
-               'fm_ecobilagtype' => array(
-                       'fd' => array(
-                               'id' => array('type' => 'int','precision' => 
'2','nullable' => False),
-                               'name' => array('type' => 'varchar','precision' 
=> '20','nullable' => False),
-                               'description' => array('type' => 
'text','nullable' => True)
-                       ),
-                       'pk' => array('id'),
-                       'ix' => array(),
-                       'fk' => array(),
-                       'uc' => array()
-               ),
-               'fm_ecodimb' => array(
-                       'fd' => array(
-                               'id' => array('type' => 'int','precision' => 
'2','nullable' => False),
-                               'name' => array('type' => 'varchar','precision' 
=> '20','nullable' => False),
-                               'description' => array('type' => 
'text','nullable' => True)
-                       ),
-                       'pk' => array('id'),
-                       'ix' => array(),
-                       'fk' => array(),
-                       'uc' => array()
-               ),
-               'fm_ecodimd' => array(
-                       'fd' => array(
-                               'id' => array('type' => 'varchar','precision' 
=> '5','nullable' => False),
-                               'name' => array('type' => 'varchar','precision' 
=> '20','nullable' => False),
-                               'description' => array('type' => 
'text','nullable' => True)
-                       ),
-                       'pk' => array('id'),
-                       'ix' => array(),
-                       'fk' => array(),
-                       'uc' => array()
-               ),
-               'fm_ecomva' => array(
-                       'fd' => array(
-                               'id' => array('type' => 'int','precision' => 
'2','nullable' => False),
-                               'name' => array('type' => 'varchar','precision' 
=> '20','nullable' => False),
-                               'description' => array('type' => 
'text','nullable' => True)
-                       ),
-                       'pk' => array('id'),
-                       'ix' => array(),
-                       'fk' => array(),
-                       'uc' => array()
-               ),
-               'fm_ecologg' => array(
-                       'fd' => array(
-                               'batchid' => array('type' => 'int','precision' 
=> '4','nullable' => False),
-                               'ecobilagid' => array('type' => 
'int','precision' => '4','nullable' => True),
-                               'status' => array('type' => 'int','precision' 
=> '2','nullable' => True),
-                               'melding' => array('type' => 
'varchar','precision' => '255','nullable' => True),
-                               'tid' => array('type' => 'timestamp','nullable' 
=> True,'default' => 'current_timestamp')
-                       ),
-                       'pk' => array(),
-                       'ix' => array(),
-                       'fk' => array(),
-                       'uc' => array()
-               ),
-               'fm_ecouser' => array(
-                       'fd' => array(
-                               'id' => array('type' => 'int','precision' => 
'4','nullable' => False),
-                               'lid' => array('type' => 'varchar','precision' 
=> '25','nullable' => False),
-                               'initials' => array('type' => 
'varchar','precision' => '6','nullable' => True)
-                       ),
-                       'pk' => array('id'),
-                       'ix' => array(),
-                       'fk' => array(),
-                       'uc' => array()
-               ),
-               'fm_acl2' => array(
-                       'fd' => array(
-                               'acl_host' => array('type' => 'int','precision' 
=> '4','default' => '0','nullable' => False),
-                               'acl_appid' => array('type' => 
'int','precision' => '4','default' => '0','nullable' => False),
-                               'grantor' => array('type' => 'int','precision' 
=> '4','nullable' => True),
-                               'grantor_type' => array('type' => 
'char','precision' => '1','nullable' => True),
-                               'acl_account' => array('type' => 
'int','precision' => '4','default' => '0','nullable' => False),
-                               'acl_location' => array('type' => 
'varchar','precision' => '255','nullable' => False),
-                               'acl_rights' => array('type' => 
'int','precision' => '4','default' => '','nullable' => True),
-                               'acl_type' => array('type' => 'int','precision' 
=> '2','default' => '0','nullable' => False),
-                               'acl_data ' => array('type' => 
'text','nullable' => True)
-                       ),
-                       'pk' => array(),
-                       'fk' => array(),
-                       'ix' => array(),
-                       'uc' => array()
-               ),
-               '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()
-               ),
-               'fm_projectbranch' => array(
-                       'fd' => array(
-                               'project_id' => array('type' => 
'int','precision' => '4','nullable' => False),
-                               'branch_id' => array('type' => 
'int','precision' => '4','nullable' => False)
-                       ),
-                       'pk' => array('project_id','branch_id'),
-                       'fk' => array(),
-                       'ix' => array(),
-                       'uc' => array()
-               ),
-               'fm_project' => array(
-                       'fd' => array(
-                               'id' => array('type' => 'int','precision' => 
'4','nullable' => False),
-                               'name' => array('type' => 'varchar','precision' 
=> '255','nullable' => False),
-                               'user_id' => array('type' => 'int','precision' 
=> '4','nullable' => False),
-                               'access' => array('type' => 
'varchar','precision' => '7','nullable' => True),
-                               'category' => array('type' => 'int','precision' 
=> '4','nullable' => False),
-                               'entry_date' => array('type' => 
'int','precision' => '4','nullable' => False),
-                               'start_date' => array('type' => 
'int','precision' => '4','nullable' => False),
-                               'end_date' => array('type' => 'int','precision' 
=> '4','nullable' => False),
-                               'coordinator' => array('type' => 
'int','precision' => '4','nullable' => False),
-                               'status' => array('type' => 
'varchar','precision' => '20','nullable' => False,'default' => 'active'),
-                               'descr' => array('type' => 'text','nullable' => 
True),
-                               'budget' => array('type' => 
'decimal','precision' => '20','scale' => '2','nullable' => True,'default' => 
'0.00'),
-                               'reserve' => array('type' => 
'decimal','precision' => '20','scale' => '2','nullable' => True,'default' => 
'0.00'),
-                               'p_num' => array('type' => 
'varchar','precision' => '15','nullable' => True),
-                               'p_entity_id' => array('type' => 
'int','precision' => '4','nullable' => True),
-                               'p_cat_id' => array('type' => 'int','precision' 
=> '4','nullable' => True),
-                               'location_code' => array('type' => 
'varchar','precision' => '20','nullable' => True),
-                               'loc1' => array('type' => 'varchar','precision' 
=> '4','nullable' => True),
-                               'loc2' => array('type' => 'varchar','precision' 
=> '4','nullable' => True),
-                               'loc3' => array('type' => 'varchar','precision' 
=> '4','nullable' => True),
-                               'loc4' => array('type' => 'varchar','precision' 
=> '4','nullable' => True),
-                               'address' => array('type' => 
'varchar','precision' => '150','nullable' => True),
-                               'tenant_id' => array('type' => 
'int','precision' => '4','nullable' => True),
-                               'contact_phone' => array('type' => 
'varchar','precision' => '20','nullable' => True),
-                               'key_fetch' => array('type' => 
'int','precision' => '4','nullable' => True),
-                               'key_deliver' => array('type' => 
'int','precision' => '4','nullable' => True),
-                               'other_branch' => array('type' => 
'varchar','precision' => '255','nullable' => True),
-                               'key_responsible' => array('type' => 
'int','precision' => '4','nullable' => True)
-                       ),
-                       'pk' => array('id'),
-                       'fk' => array(),
-                       'ix' => array('location_code'),
-                       'uc' => array()
-               ),
-               'fm_event_receipt' => array(
-                       'fd' => array(
-                               'cal_id' => array('type' => 'int','precision' 
=> '4','nullable' => False),
-                               'year_month_date' => array('type' => 
'int','precision' => '4','nullable' => False),
-                               'datetime_done' => array('type' => 
'int','precision' => '4','nullable' => True),
-                               'datetime_reject' => array('type' => 
'int','precision' => '4','nullable' => True),
-                               'user_id' => array('type' => 'int','precision' 
=> '4','nullable' => True)
-                       ),
-                       'pk' => array('cal_id','year_month_date'),
-                       'fk' => array(),
-                       'ix' => array(),
-                       'uc' => array()
-               ),
-               'fm_investment' => array(
-                       'fd' => array(
-                               'entity_id' => array('type' => 
'varchar','precision' => '20','nullable' => False),
-                               'invest_id' => array('type' => 
'int','precision' => '4','nullable' => False),
-                               'entity_type' => array('type' => 
'varchar','precision' => '20','nullable' => True),
-                               'p_num' => array('type' => 
'varchar','precision' => '15','nullable' => True),
-                               'p_entity_id' => array('type' => 
'int','precision' => '4','nullable' => True),
-                               'p_cat_id' => array('type' => 'int','precision' 
=> '4','nullable' => True),
-                               'location_code' => array('type' => 
'varchar','precision' => '20','nullable' => True),
-                               'loc1' => array('type' => 'varchar','precision' 
=> '4','nullable' => True),
-                               'loc2' => array('type' => 'varchar','precision' 
=> '4','nullable' => True),
-                               'loc3' => array('type' => 'varchar','precision' 
=> '4','nullable' => True),
-                               'loc4' => array('type' => 'varchar','precision' 
=> '4','nullable' => True),
-                               'address' => array('type' => 
'varchar','precision' => '150','nullable' => True),
-                               'descr' => array('type' => 
'varchar','precision' => '255','nullable' => True),
-                               'writeoff_year' => array('type' => 
'int','precision' => '4','nullable' => True)
-                       ),
-                       'pk' => array('entity_id','invest_id'),
-                       'fk' => array(),
-                       'ix' => array('location_code','entity_id'),
-                       'uc' => array()
-               ),
-               'fm_investment_value' => array(
-                       'fd' => array(
-                               'entity_id' => array('type' => 
'varchar','precision' => '20','nullable' => False),
-                               'invest_id' => array('type' => 
'int','precision' => '4','nullable' => False),
-                               'index_count' => array('type' => 
'int','precision' => '4','nullable' => False),
-                               'current_index' => array('type' => 
'int','precision' => '2','nullable' => True),
-                               'this_index' => array('type' => 
'decimal','precision' => '20','scale' => '4','default' => '0','nullable' => 
True),
-                               'initial_value' => array('type' => 
'decimal','precision' => '20','scale' => '2','default' => '0','nullable' => 
True),
-                               'value' => array('type' => 
'decimal','precision' => '20','scale' => '2','default' => '0','nullable' => 
True),
-                               'index_date' => array('type' => 
'timestamp','nullable' => True,'default' => 'current_timestamp')
-                       ),
-                       'pk' => array('entity_id','invest_id','index_count'),
-                       'fk' => array(),
-                       'ix' => array(),
-                       'uc' => array()
-               ),
-               'fm_idgenerator' => array(
-                       'fd' => array(
-                               'name' => array('type' => 'varchar','precision' 
=> '30','nullable' => False),
-                               'value' => array('type' => 'int','precision' => 
'4','nullable' => False),
-                               'increment' => array('type' => 
'int','precision' => '4','nullable' => True),
-                               'maxvalue' => array('type' => 'int','precision' 
=> '2','nullable' => True),
-                               'descr' => array('type' => 
'varchar','precision' => '30','nullable' => True)
-                       ),
-                       'pk' => array('name'),
-                       'fk' => array(),
-                       'ix' => array(),
-                       'uc' => array()
-               ),
-               'fm_document' => array(
-                       'fd' => array(
-                               'id' => array('type' => 'auto','precision' => 
'4','nullable' => False),
-                               'title' => array('type' => 
'varchar','precision' => '50','nullable' => True),
-                               'document_name' => array('type' => 
'varchar','precision' => '50','nullable' => True),
-                               'link' => array('type' => 'text','nullable' => 
True),
-                               'descr' => array('type' => 
'varchar','precision' => '255','nullable' => True),
-                               'version' => array('type' => 
'varchar','precision' => '10','nullable' => True),
-                               'document_date' => array('type' => 
'int','precision' => '4','nullable' => True),
-                               'entry_date' => array('type' => 
'int','precision' => '4','nullable' => True),
-                               'status' => array('type' => 
'varchar','precision' => '10','nullable' => True),
-                               'p_num' => array('type' => 
'varchar','precision' => '15','nullable' => True),
-                               'p_entity_id' => array('type' => 
'int','precision' => '4','nullable' => True),
-                               'p_cat_id' => array('type' => 'int','precision' 
=> '4','nullable' => True),
-                               'location_code' => array('type' => 
'varchar','precision' => '20','nullable' => False),
-                               'loc1' => array('type' => 'varchar','precision' 
=> '4','nullable' => True),
-                               'loc2' => array('type' => 'varchar','precision' 
=> '4','nullable' => True),
-                               'loc3' => array('type' => 'varchar','precision' 
=> '4','nullable' => True),
-                               'loc4' => array('type' => 'varchar','precision' 
=> '4','nullable' => True),
-                               'address' => array('type' => 
'varchar','precision' => '150','nullable' => True),
-                               'coordinator' => array('type' => 
'int','precision' => '4','nullable' => True),
-                               'vendor_id' => array('type' => 
'int','precision' => '4','nullable' => True),
-                               'branch_id' => array('type' => 
'int','precision' => '4','nullable' => True),
-                               'category' => array('type' => 'int','precision' 
=> '4','nullable' => True),
-                               'user_id' => array('type' => 'int','precision' 
=> '4','nullable' => True),
-                               'access' => array('type' => 
'varchar','precision' => '7','nullable' => True)
-                       ),
-                       'pk' => array('id'),
-                       'fk' => array(),
-                       'ix' => array('location_code'),
-                       'uc' => array()
-               ),
-               'fm_document_category' => array(
-                       'fd' => array(
-                               'id' => array('type' => 'int','precision' => 
'4','nullable' => False),
-                               'descr' => array('type' => 
'varchar','precision' => '50','nullable' => True)
-                       ),
-                       'pk' => array('id'),
-                       'fk' => array(),
-                       'ix' => array(),
-                       'uc' => array()
-               ),
-               'fm_document_status' => array(
-                       'fd' => array(
-                               'id' => array('type' => 'varchar','precision' 
=> '20','nullable' => False),
-                               'descr' => array('type' => 
'varchar','precision' => '255','nullable' => False)
-                       ),
-                       'pk' => array('id'),
-                       'fk' => array(),
-                       'ix' => array(),
-                       'uc' => array()
-               ),
-               'fm_acl_location' => array(
-                       'fd' => array(
-                               'id' => array('type' => 'varchar','precision' 
=> '20','nullable' => False),
-                               'descr' => array('type' => 
'varchar','precision' => '50','nullable' => False),
-                               'allow_grant' => array('type' => 
'int','precision' => '4','nullable' => True)
-                       ),
-                       'pk' => array('id'),
-                       'fk' => array(),
-                       'ix' => array(),
-                       'uc' => array()
-               ),
-               'fm_request_history' => array(
-                       'fd' => array(
-                               'history_id' => array('type' => 
'auto','precision' => '4','nullable' => False),
-                               'history_record_id' => array('type' => 
'int','precision' => '4','nullable' => False),
-                               'history_appname' => array('type' => 
'varchar','precision' => '64','nullable' => False),
-                               'history_owner' => array('type' => 
'int','precision' => '4','nullable' => False),
-                               'history_status' => array('type' => 
'char','precision' => '2','nullable' => False),
-                               'history_new_value' => array('type' => 
'text','nullable' => False),
-                               'history_timestamp' => array('type' => 
'timestamp','nullable' => False,'default' => 'current_timestamp')
-                       ),
-                       'pk' => array('history_id'),
-                       'fk' => array(),
-                       'ix' => array(),
-                       'uc' => array()
-               ),
-               'fm_workorder_history' => array(
-                       'fd' => array(
-                               'history_id' => array('type' => 
'auto','precision' => '4','nullable' => False),
-                               'history_record_id' => array('type' => 
'int','precision' => '4','nullable' => False),
-                               'history_appname' => array('type' => 
'varchar','precision' => '64','nullable' => False),
-                               'history_owner' => array('type' => 
'int','precision' => '4','nullable' => False),
-                               'history_status' => array('type' => 
'char','precision' => '2','nullable' => False),
-                               'history_new_value' => array('type' => 
'text','nullable' => False),
-                               'history_timestamp' => array('type' => 
'timestamp','nullable' => False,'default' => 'current_timestamp')
-                       ),
-                       'pk' => array('history_id'),
-                       'fk' => array(),
-                       'ix' => array(),
-                       'uc' => array()
-               ),
-               'fm_project_history' => array(
-                       'fd' => array(
-                               'history_id' => array('type' => 
'auto','precision' => '4','nullable' => False),
-                               'history_record_id' => array('type' => 
'int','precision' => '4','nullable' => False),
-                               'history_appname' => array('type' => 
'varchar','precision' => '64','nullable' => False),
-                               'history_owner' => array('type' => 
'int','precision' => '4','nullable' => False),
-                               'history_status' => array('type' => 
'char','precision' => '2','nullable' => False),
-                               'history_new_value' => array('type' => 
'text','nullable' => False),
-                               'history_timestamp' => array('type' => 
'timestamp','nullable' => False,'default' => 'current_timestamp')
-                       ),
-                       'pk' => array('history_id'),
-                       'fk' => array(),
-                       'ix' => array(),
-                       'uc' => array()
-               ),
-               'fm_tts_history' => array(
-                       'fd' => array(
-                               'history_id' => array('type' => 
'auto','precision' => '4','nullable' => False),
-                               'history_record_id' => array('type' => 
'int','precision' => '4','nullable' => False),
-                               'history_appname' => array('type' => 
'varchar','precision' => '64','nullable' => False),
-                               'history_owner' => array('type' => 
'int','precision' => '4','nullable' => False),
-                               'history_status' => array('type' => 
'char','precision' => '2','nullable' => False),
-                               'history_new_value' => array('type' => 
'text','nullable' => False),
-                               'history_timestamp' => array('type' => 
'timestamp','nullable' => False,'default' => 'current_timestamp')
-                       ),
-                       'pk' => array('history_id'),
-                       'fk' => array(),
-                       'ix' => array(),
-                       'uc' => array()
-               ),
-               'fm_document_history' => array(
-                       'fd' => array(
-                               'history_id' => array('type' => 
'auto','precision' => '4','nullable' => False),
-                               'history_record_id' => array('type' => 
'int','precision' => '4','nullable' => False),
-                               'history_appname' => array('type' => 
'varchar','precision' => '64','nullable' => False),
-                               'history_owner' => array('type' => 
'int','precision' => '4','nullable' => False),
-                               'history_status' => array('type' => 
'char','precision' => '2','nullable' => False),
-                               'history_new_value' => array('type' => 
'text','nullable' => False),
-                               'history_timestamp' => array('type' => 
'timestamp','nullable' => False,'default' => 'current_timestamp')
-                       ),
-                       'pk' => array('history_id'),
-                       'fk' => array(),
-                       'ix' => array(),
-                       'uc' => array()
-               ),
-               'fm_owner' => array(
-                       'fd' => array(
-                               'id' => array('type' => 'int','precision' => 
'4','nullable' => False),
-                               'abid' => array('type' => 'int','precision' => 
'4','nullable' => False),
-                               'org_name' => array('type' => 
'varchar','precision' => '50','nullable' => True),
-                               'contact_name' => array('type' => 
'varchar','precision' => '50','nullable' => True),
-                               'category' => array('type' => 'int','precision' 
=> '4','nullable' => False),
-                               'member_of' => array('type' => 
'varchar','precision' => '255','nullable' => True),
-                               'remark' => array('type' => 
'varchar','precision' => '255','nullable' => True),
-                               'entry_date' => array('type' => 
'int','precision' => '4','nullable' => True)
-                       ),
-                       'pk' => array('id'),
-                       'fk' => array(),
-                       'ix' => array(),
-                       'uc' => array()
-               ),
-
-               'fm_owner_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()
-               ),
-               'fm_owner_attribute' => array(
-                       'fd' => array(
-                               'id' => array('type' => 'int','precision' => 
'4','nullable' => False),
-                               'column_name' => array('type' => 
'varchar','precision' => '20','nullable' => False),
-                               'input_text' => array('type' => 
'varchar','precision' => '20','nullable' => False),
-                               'list' => array('type' => 'int','precision' => 
'2','nullable' => True),
-                               'location_form' => array('type' => 
'int','precision' => '2','nullable' => True),
-                               'lookup_form' => array('type' => 
'int','precision' => '2','nullable' => True),
-                               'search' => array('type' => 'int','precision' 
=> '2','nullable' => True),
-                               'statustext' => array('type' => 
'varchar','precision' => '100','nullable' => False),
-                               'size' => array('type' => 'int','precision' => 
'4','nullable' => True),
-                               'datatype' => array('type' => 
'varchar','precision' => '10','nullable' => True),
-                               'attrib_sort' => array('type' => 
'int','precision' => '4','nullable' => True),
-                               'precision_' => array('type' => 
'int','precision' => '4','nullable' => True),
-                               'scale' => array('type' => 'int','precision' => 
'4','nullable' => True),
-                               'default_value' => array('type' => 
'varchar','precision' => '20','nullable' => True),
-                               'nullable' => array('type' => 
'varchar','precision' => '5','nullable' => False,'default' => 'True')
-                       ),
-                       'pk' => array('id'),
-                       'fk' => array(),
-                       'ix' => array(),
-                       'uc' => array()
-               ),
-
-               'fm_owner_choice' => array(
-                       'fd' => array(
-                               'attrib_id' => array('type' => 
'int','precision' => '4','nullable' => False),
-                               'id' => array('type' => 'int','precision' => 
'4','nullable' => False),
-                               'value' => array('type' => 'text','nullable' => 
False)
-                       ),
-                       'pk' => array('attrib_id','id'),
-                       'fk' => array(),
-                       'ix' => array(),
-                       'uc' => array()
-               ),
-
-               'fm_cache' => array(
-                       'fd' => array(
-                               'name' => array('type' => 'varchar','precision' 
=> '50','nullable' => False),
-                               'value' => array('type' => 'text','nullable' => 
True)
-                       ),
-                       'pk' => array('name'),
-                       'fk' => array(),
-                       'ix' => array(),
-                       'uc' => array()
-               ),
-               'fm_entity' => array(
-                       'fd' => array(
-                               'id' => array('type' => 'int','precision' => 
'4','nullable' => False),
-                               'name' => array('type' => 'varchar','precision' 
=> '20','nullable' => False),
-                               'descr' => array('type' => 
'varchar','precision' => '50','nullable' => True),
-                               'location_form' => array('type' => 
'int','precision' => '4','nullable' => True),
-                               'documentation' => array('type' => 
'int','precision' => '4','nullable' => True),
-                               'lookup_entity' => array('type' => 
'text','nullable' => True)
-                       ),
-                       'pk' => array('id'),
-                       'fk' => array(),
-                       'ix' => array(),
-                       'uc' => array()
-               ),
-               'fm_entity_attribute' => array(
-                       'fd' => array(
-                               'entity_id' => array('type' => 
'int','precision' => '4','nullable' => False),
-                               'cat_id' => array('type' => 'int','precision' 
=> '4','nullable' => False),
-                               'id' => array('type' => 'int','precision' => 
'4','nullable' => False),
-                               'column_name' => array('type' => 
'varchar','precision' => '20','nullable' => False),
-                               'input_text' => array('type' => 
'varchar','precision' => '50','nullable' => False),
-                               'statustext' => array('type' => 
'varchar','precision' => '150','nullable' => False),
-                               'datatype' => array('type' => 
'varchar','precision' => '10','nullable' => False),
-                               'search' => array('type' => 'int','precision' 
=> '2','nullable' => True),
-                               'list' => array('type' => 'int','precision' => 
'4','nullable' => True),
-                               'attrib_sort' => array('type' => 
'int','precision' => '4','nullable' => True),
-                               'size' => array('type' => 'int','precision' => 
'4','nullable' => True),
-                               'precision_' => array('type' => 
'int','precision' => '4','nullable' => True),
-                               'scale' => array('type' => 'int','precision' => 
'4','nullable' => True),
-                               'default_value' => array('type' => 
'varchar','precision' => '20','nullable' => True),
-                               'nullable' => array('type' => 
'varchar','precision' => '5','nullable' => True)
-                       ),
-                       'pk' => array('entity_id','cat_id','id'),
-                       'fk' => array(),
-                       'ix' => array(),
-                       'uc' => array()
-               ),
-               'fm_entity_category' => array(
-                       'fd' => array(
-                               'entity_id' => array('type' => 
'int','precision' => '4','nullable' => False),
-                               'id' => array('type' => 'int','precision' => 
'4','nullable' => False),
-                               'name' => array('type' => 'varchar','precision' 
=> '20','nullable' => True),
-                               'descr' => array('type' => 
'varchar','precision' => '50','nullable' => True),
-                               'prefix' => array('type' => 
'varchar','precision' => '50','nullable' => True),
-                               'lookup_tenant' => array('type' => 
'int','precision' => '4','nullable' => True),
-                               'tracking' => array('type' => 'int','precision' 
=> '4','nullable' => True),
-                               'location_level' => array('type' => 
'int','precision' => '4','nullable' => True),
-                               'fileupload' => array('type' => 
'int','precision' => '4','nullable' => True),
-                               'loc_link' => array('type' => 'int','precision' 
=> '4','nullable' => True),
-                               'start_project' => array('type' => 
'int','precision' => '4','nullable' => True)
-                       ),
-                       'pk' => array('entity_id','id'),
-                       'fk' => array(),
-                       'ix' => array(),
-                       'uc' => array()
-               ),
-               'fm_entity_choice' => array(
-                       'fd' => array(
-                               'entity_id' => array('type' => 
'int','precision' => '4','nullable' => False),
-                               'cat_id' => array('type' => 'int','precision' 
=> '4','nullable' => False),
-                               'attrib_id' => array('type' => 
'int','precision' => '4','nullable' => False),
-                               'id' => array('type' => 'int','precision' => 
'4','nullable' => False),
-                               'value' => array('type' => 'text','nullable' => 
False)
-                       ),
-                       'pk' => array('entity_id','cat_id','attrib_id','id'),
-                       'fk' => array(),
-                       'ix' => array(),
-                       'uc' => array()
-               ),
-               'fm_entity_lookup' => array(
-                       'fd' => array(
-                               'entity_id' => array('type' => 
'int','precision' => '4','nullable' => False),
-                               'location' => array('type' => 
'varchar','precision' => '15','nullable' => False),
-                               'type' => array('type' => 'varchar','precision' 
=> '15','nullable' => False)
-                       ),
-                       'pk' => array('entity_id','location','type'),
-                       'fk' => array(),
-                       'ix' => array(),
-                       'uc' => array()
-               ),
-               '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()
-               ),
-               'fm_entity_1_1' => array(
-                       'fd' => array(
-                               'id' => array('type' => 'auto','precision' => 
'4','nullable' => False),
-                               'num' => array('type' => 'varchar','precision' 
=> '20','nullable' => False),
-                               'p_num' => array('type' => 
'varchar','precision' => '15','nullable' => True),
-                               'p_entity_id' => array('type' => 
'int','precision' => '4','nullable' => True),
-                               'p_cat_id' => array('type' => 'int','precision' 
=> '4','nullable' => True),
-                               'location_code' => array('type' => 
'varchar','precision' => '20','nullable' => False),
-                               'loc1' => array('type' => 'varchar','precision' 
=> '4','nullable' => True),
-                               'loc2' => array('type' => 'varchar','precision' 
=> '4','nullable' => True),
-                               'loc3' => array('type' => 'varchar','precision' 
=> '4','nullable' => True),
-                               'loc4' => array('type' => 'varchar','precision' 
=> '4','nullable' => True),
-                               'address' => array('type' => 
'varchar','precision' => '150','nullable' => True),
-                               'entry_date' => array('type' => 
'int','precision' => '4','nullable' => True),
-                               'user_id' => array('type' => 'int','precision' 
=> '4','nullable' => True),
-                               'status' => array('type' => 'int','precision' 
=> '4','nullable' => True),
-                               'category' => array('type' => 'int','precision' 
=> '4','nullable' => False),
-                               'ext_system_id' => array('type' => 
'varchar','precision' => '20','nullable' => False),
-                               'ext_meter_id' => array('type' => 
'varchar','precision' => '20','nullable' => False),
-                               'remark' => array('type' => 
'varchar','precision' => '255','nullable' => True)
-                       ),
-                       'pk' => array('id'),
-                       'fk' => array(),
-                       'ix' => array('location_code'),
-                       'uc' => array('num')
-               ),
-
-               'fm_entity_1_2' => array(
-                       'fd' => array(
-                               'id' => array('type' => 'auto','precision' => 
'4','nullable' => False),
-                               'num' => array('type' => 'varchar','precision' 
=> '16','nullable' => False),
-                               'p_num' => array('type' => 
'varchar','precision' => '15','nullable' => True),
-                               'p_entity_id' => array('type' => 
'int','precision' => '4','nullable' => True),
-                               'p_cat_id' => array('type' => 'int','precision' 
=> '4','nullable' => True),
-                               'location_code' => array('type' => 
'varchar','precision' => '20','nullable' => True),
-                               'loc1' => array('type' => 'varchar','precision' 
=> '4','nullable' => True),
-                               'loc2' => array('type' => 'varchar','precision' 
=> '4','nullable' => True),
-                               'loc3' => array('type' => 'varchar','precision' 
=> '4','nullable' => True),
-                               'loc4' => array('type' => 'varchar','precision' 
=> '4','nullable' => True),
-                               'address' => array('type' => 
'varchar','precision' => '150','nullable' => True),
-                               'tenant_id' => array('type' => 
'int','precision' => '4','nullable' => True),
-                               'contact_phone' => array('type' => 
'varchar','precision' => '30','nullable' => True),
-                               'entry_date' => array('type' => 
'int','precision' => '4','nullable' => True),
-                               'user_id' => array('type' => 'int','precision' 
=> '4','nullable' => True),
-                               'status' => array('type' => 'int','precision' 
=> '4','nullable' => True),
-                               'attribute1' => array('type' => 
'varchar','precision' => '12','nullable' => True),
-                               'attribute2' => array('type' => 
'timestamp','nullable' => True),
-                               'attribute3' => array('type' => 
'int','precision' => '4','nullable' => True),
-                               'attribute4' => array('type' => 
'text','nullable' => True),
-                               'attribute5' => array('type' => 
'int','precision' => '4','nullable' => True)
-                       ),
-                       'pk' => array('id'),
-                       'fk' => array(),
-                       'ix' => array('location_code'),
-                       'uc' => array()
-               ),
-               'fm_entity_1_3' => array(
-                       'fd' => array(
-                               'id' => array('type' => 'auto','precision' => 
'4','nullable' => False),
-                               'num' => array('type' => 'varchar','precision' 
=> '16','nullable' => False),
-                               'p_num' => array('type' => 
'varchar','precision' => '15','nullable' => True),
-                               'p_entity_id' => array('type' => 
'int','precision' => '4','nullable' => True),
-                               'p_cat_id' => array('type' => 'int','precision' 
=> '4','nullable' => True),
-                               'location_code' => array('type' => 
'varchar','precision' => '20','nullable' => True),
-                               'loc1' => array('type' => 'varchar','precision' 
=> '4','nullable' => True),
-                               'loc2' => array('type' => 'varchar','precision' 
=> '4','nullable' => True),
-                               'loc3' => array('type' => 'varchar','precision' 
=> '4','nullable' => True),
-                               'loc4' => array('type' => 'varchar','precision' 
=> '4','nullable' => True),
-                               'address' => array('type' => 
'varchar','precision' => '150','nullable' => True),
-                               'tenant_id' => array('type' => 
'int','precision' => '4','nullable' => True),
-                               'contact_phone' => array('type' => 
'varchar','precision' => '30','nullable' => True),
-                               'entry_date' => array('type' => 
'int','precision' => '4','nullable' => True),
-                               'user_id' => array('type' => 'int','precision' 
=> '4','nullable' => True),
-                               'status' => array('type' => 'int','precision' 
=> '4','nullable' => True),
-                               'attribute1' => array('type' => 
'varchar','precision' => '12','nullable' => True),
-                               'attribute2' => array('type' => 
'timestamp','nullable' => True),
-                               'attribute3' => array('type' => 
'int','precision' => '4','nullable' => True),
-                               'attribute4' => array('type' => 
'text','nullable' => True),
-                               'attribute5' => array('type' => 
'int','precision' => '4','nullable' => True)
-                       ),
-                       'pk' => array('id'),
-                       'fk' => array(),
-                       'ix' => array('location_code'),
-                       'uc' => array()
-               ),
-               'fm_entity_2_1' => array(
-                       'fd' => array(
-                               'id' => array('type' => 'auto','precision' => 
'4','nullable' => False),
-                               'num' => array('type' => 'varchar','precision' 
=> '16','nullable' => False),
-                               'p_num' => array('type' => 
'varchar','precision' => '15','nullable' => True),
-                               'p_entity_id' => array('type' => 
'int','precision' => '4','nullable' => True),
-                               'p_cat_id' => array('type' => 'int','precision' 
=> '4','nullable' => True),
-                               'location_code' => array('type' => 
'varchar','precision' => '20','nullable' => True),
-                               'loc1' => array('type' => 'varchar','precision' 
=> '4','nullable' => True),
-                               'loc2' => array('type' => 'varchar','precision' 
=> '4','nullable' => True),
-                               'loc3' => array('type' => 'varchar','precision' 
=> '4','nullable' => True),
-                               'loc4' => array('type' => 'varchar','precision' 
=> '4','nullable' => True),
-                               'address' => array('type' => 
'varchar','precision' => '150','nullable' => True),
-                               'tenant_id' => array('type' => 
'int','precision' => '4','nullable' => True),
-                               'contact_phone' => array('type' => 
'varchar','precision' => '30','nullable' => True),
-                               'entry_date' => array('type' => 
'int','precision' => '4','nullable' => True),
-                               'user_id' => array('type' => 'int','precision' 
=> '4','nullable' => True),
-                               'status' => array('type' => 'int','precision' 
=> '4','nullable' => True),
-                               'attribute1' => array('type' => 
'varchar','precision' => '12','nullable' => True),
-                               'attribute2' => array('type' => 
'timestamp','nullable' => True),
-                               'attribute3' => array('type' => 
'int','precision' => '4','nullable' => True),
-                               'attribute4' => array('type' => 
'text','nullable' => True),
-                               'attribute5' => array('type' => 
'int','precision' => '4','nullable' => True)
-                       ),
-                       'pk' => array('id'),
-                       'fk' => array(),
-                       'ix' => array('location_code'),
-                       'uc' => array()
-               ),
-               'fm_entity_2_2' => array(
-                       'fd' => array(
-                               'id' => array('type' => 'auto','precision' => 
'4','nullable' => False),
-                               'num' => array('type' => 'varchar','precision' 
=> '16','nullable' => False),
-                               'p_num' => array('type' => 
'varchar','precision' => '15','nullable' => True),
-                               'p_entity_id' => array('type' => 
'int','precision' => '4','nullable' => True),
-                               'p_cat_id' => array('type' => 'int','precision' 
=> '4','nullable' => True),
-                               'location_code' => array('type' => 
'varchar','precision' => '20','nullable' => True),
-                               'loc1' => array('type' => 'varchar','precision' 
=> '4','nullable' => True),
-                               'loc2' => array('type' => 'varchar','precision' 
=> '4','nullable' => True),
-                               'loc3' => array('type' => 'varchar','precision' 
=> '4','nullable' => True),
-                               'loc4' => array('type' => 'varchar','precision' 
=> '4','nullable' => True),
-                               'address' => array('type' => 
'varchar','precision' => '150','nullable' => True),
-                               'tenant_id' => array('type' => 
'int','precision' => '4','nullable' => True),
-                               'contact_phone' => array('type' => 
'varchar','precision' => '30','nullable' => True),
-                               'entry_date' => array('type' => 
'int','precision' => '4','nullable' => True),
-                               'user_id' => array('type' => 'int','precision' 
=> '4','nullable' => True),
-                               'status' => array('type' => 'int','precision' 
=> '4','nullable' => True),
-                               'attribute1' => array('type' => 
'varchar','precision' => '12','nullable' => True),
-                               'attribute2' => array('type' => 
'timestamp','nullable' => True),
-                               'attribute3' => array('type' => 
'int','precision' => '4','nullable' => True),
-                               'attribute4' => array('type' => 
'text','nullable' => True),
-                               'attribute5' => array('type' => 
'int','precision' => '4','nullable' => True)
-                       ),
-                       'pk' => array('id'),
-                       'fk' => array(),
-                       'ix' => array('location_code'),
-                       'uc' => array()
-               ),
-               'fm_custom' => array(
-                       'fd' => array(
-                               'id' => array('type' => 'int','precision' => 
'4','nullable' => False),
-                               'name' => array('type' => 'varchar','precision' 
=> '100','nullable' => False),
-                               'sql' => array('type' => 'text','nullable' => 
False),
-                               'entry_date' => array('type' => 
'int','precision' => '4','nullable' => True),
-                               'user_id' => array('type' => 'int','precision' 
=> '4','nullable' => True)
-                       ),
-                       'pk' => array('id'),
-                       'fk' => array(),
-                       'ix' => array(),
-                       'uc' => array()
-               ),
-               'fm_custom_cols' => array(
-                       'fd' => array(
-                               'custom_id' => array('type' => 
'int','precision' => '4','nullable' => False),
-                               'id' => array('type' => 'int','precision' => 
'4','nullable' => False),
-                               'name' => array('type' => 'varchar','precision' 
=> '100','nullable' => False),
-                               'descr' => array('type' => 
'varchar','precision' => '50','nullable' => False),
-                               'sorting' => array('type' => 'int','precision' 
=> '4','nullable' => False)
-                       ),
-                       'pk' => array('custom_id','id'),
-                       'fk' => array(),
-                       'ix' => array(),
-                       'uc' => array()
-               ),
-
-               'fm_orders' => array(
-                       'fd' => array(
-                               'id' => array('type' => 'int', 'precision' => 
4,'nullable' => False,'default' => '0'),
-                               'type' => array('type' => 'varchar', 
'precision' => 50,'nullable' => False)
-                       ),
-                       'pk' => array('id'),
-                       'fk' => array(),
-                       'ix' => array(),
-                       'uc' => array()
-               ),
-
-               'fm_s_agreement' => array(
-                       'fd' => array(
-                               'id' => array('type' => 'int', 'precision' => 
4,'nullable' => False,'default' => '0'),
-                               'vendor_id' => array('type' => 'int', 
'precision' => 4,'nullable' => True),
-                               'name' => array('type' => 'varchar', 
'precision' => 100,'nullable' => False),
-                               'descr' => array('type' => 'text','nullable' => 
True),
-                               'status' => array('type' => 'varchar', 
'precision' => 10,'nullable' => True),
-                               'category' => array('type' => 'int', 
'precision' => 4,'nullable' => True),
-                               'member_of' => array('type' => 
'text','nullable' => True),
-                               'entry_date' => array('type' => 'int', 
'precision' => 4,'nullable' => True),
-                               'start_date' => array('type' => 'int', 
'precision' => 4,'nullable' => True),
-                               'end_date' => array('type' => 'int', 
'precision' => 4,'nullable' => True),
-                               'termination_date' => array('type' => 'int', 
'precision' => 4,'nullable' => True),
-                               'user_id' => array('type' => 'int', 'precision' 
=> 4,'nullable' => True),
-                               'actual_cost' => array('type' => 'decimal', 
'precision' => 20, 'scale' => 2,'nullable' => True),
-                               'account_id' => array('type' => 'varchar', 
'precision' => 20,'nullable' => True)
-                       ),
-                       'pk' => array('id'),
-                       'fk' => array(),
-                       'ix' => array(),
-                       'uc' => array()
-               ),
-
-               'fm_s_agreement_attribute' => array(
-                       'fd' => array(
-                               'id' => array('type' => 'int', 'precision' => 
4,'nullable' => False,'default' => '0'),
-                               'attrib_detail' => array('type' => 'int', 
'precision' => 2,'nullable' => False,'default' => '0'),
-                               'list' => array('type' => 'int', 'precision' => 
2,'nullable' => True),
-                               'location_form' => array('type' => 'int', 
'precision' => 2,'nullable' => True),
-                               'lookup_form' => array('type' => 'int', 
'precision' => 4,'nullable' => True),
-                               'column_name' => array('type' => 'varchar', 
'precision' => 20,'nullable' => False),
-                               'input_text' => array('type' => 'varchar', 
'precision' => 50,'nullable' => False),
-                               'statustext' => array('type' => 'varchar', 
'precision' => 100,'nullable' => False),
-                               'size' => array('type' => 'int', 'precision' => 
4,'nullable' => True),
-                               'datatype' => array('type' => 'varchar', 
'precision' => 10,'nullable' => False),
-                               'attrib_sort' => array('type' => 'int', 
'precision' => 4,'nullable' => True),
-                               'precision_' => array('type' => 'int', 
'precision' => 4,'nullable' => True),
-                               'scale' => array('type' => 'int', 'precision' 
=> 4,'nullable' => True),
-                               'default_value' => array('type' => 'varchar', 
'precision' => 18,'nullable' => True),
-                               'nullable' => array('type' => 'varchar', 
'precision' => 5,'nullable' => False,'default' => 'True'),
-                               'search' => array('type' => 'int', 'precision' 
=> 2,'nullable' => True)
-                       ),
-                       'pk' => array('id','attrib_detail'),
-                       'fk' => array(),
-                       'ix' => array(),
-                       'uc' => array()
-               ),
-
-               'fm_s_agreement_category' => array(
-                       'fd' => array(
-                               'id' => array('type' => 'int', 'precision' => 
4,'nullable' => False,'default' => '0'),
-                               'descr' => array('type' => 'varchar', 
'precision' => 50,'nullable' => True)
-                       ),
-                       'pk' => array('id'),
-                       'fk' => array(),
-                       'ix' => array(),
-                       'uc' => array()
-               ),
-
-               'fm_s_agreement_choice' => array(
-                       'fd' => array(
-                               'attrib_id' => array('type' => 'int', 
'precision' => 4,'nullable' => False,'default' => '0'),
-                               'id' => array('type' => 'int', 'precision' => 
4,'nullable' => False,'default' => '0'),
-                               'value' => array('type' => 'varchar', 
'precision' => 255,'nullable' => True),
-                               'attrib_detail' => array('type' => 'int', 
'precision' => 2,'nullable' => False,'default' => '0')
-                       ),
-                       'pk' => array('attrib_id','id','attrib_detail'),
-                       'fk' => array(),
-                       'ix' => array(),
-                       'uc' => array()
-               ),
-
-               'fm_s_agreement_detail' => array(
-                       'fd' => array(
-                               'agreement_id' => array('type' => 'int', 
'precision' => 4,'nullable' => False,'default' => '0'),
-                               'id' => array('type' => 'int', 'precision' => 
4,'nullable' => False,'default' => '0'),
-                               'location_code' => array('type' => 'varchar', 
'precision' => 30,'nullable' => True),
-                               'address' => array('type' => 'varchar', 
'precision' => 150,'nullable' => True),
-                               'p_num' => array('type' => 'varchar', 
'precision' => 15,'nullable' => True),
-                               'p_entity_id' => array('type' => 'int', 
'precision' => 4,'nullable' => True,'default' => '0'),
-                               'p_cat_id' => array('type' => 'int', 
'precision' => 4,'nullable' => True,'default' => '0'),
-                               'descr' => array('type' => 'text','nullable' => 
True),
-                               'unit' => array('type' => 'varchar', 
'precision' => 10,'nullable' => True),
-                               'quantity' => array('type' => 'decimal', 
'precision' => 20, 'scale' => 2,'nullable' => True),
-                               'frequency' => array('type' => 'int', 
'precision' => 4,'nullable' => True),
-                               'user_id' => array('type' => 'int', 'precision' 
=> 4,'nullable' => True),
-                               'entry_date' => array('type' => 'int', 
'precision' => 4,'nullable' => True),
-                               'test' => array('type' => 'text','nullable' => 
True),
-                               'cost' => array('type' => 'decimal', 
'precision' => 20, 'scale' => 2,'nullable' => True)
-                       ),
-                       'pk' => array('agreement_id','id'),
-                       'fk' => array(),
-                       'ix' => array(),
-                       'uc' => array()
-               ),
-
-               'fm_s_agreement_pricing' => array(
-                       'fd' => array(
-                               'agreement_id' => array('type' => 'int', 
'precision' => 4,'nullable' => False,'default' => '0'),
-                               'item_id' => array('type' => 'int', 'precision' 
=> 4,'nullable' => False,'default' => '0'),
-                               'id' => array('type' => 'int', 'precision' => 
4,'nullable' => False,'default' => '0'),
-                               'current_index' => array('type' => 'int', 
'precision' => 2,'nullable' => True),
-                               'this_index' => array('type' => 'decimal', 
'precision' => 20, 'scale' => 4,'nullable' => True),
-                               'cost' => array('type' => 'decimal', 
'precision' => 20, 'scale' => 2,'nullable' => True),
-                               'index_date' => array('type' => 'int', 
'precision' => 4,'nullable' => True),
-                               'user_id' => array('type' => 'int', 'precision' 
=> 4,'nullable' => True),
-                               'entry_date' => array('type' => 'int', 
'precision' => 4,'nullable' => True)
-                       ),
-                       'pk' => array('agreement_id','item_id','id'),
-                       'fk' => array(),
-                       'ix' => array(),
-                       'uc' => array()
-               ),
-               'fm_async_method' => array(
-                       'fd' => array(
-                               'id' => array('type' => 'int','precision' => 
'4','nullable' => False),
-                               'name' => array('type' => 'varchar','precision' 
=> '255','nullable' => False),
-                               'data' => array('type' => 'text','nullable' => 
True),
-                               'descr' => array('type' => 'text','nullable' => 
True)
-                       ),
-                       'pk' => array('id'),
-                       'fk' => array(),
-                       'ix' => array(),
-                       'uc' => array()
-               ),
-               'fm_cron_log' => array(
-                       'fd' => array(
-                               'id' => array('type' => 'auto','precision' => 
'4','nullable' => False),
-                               'cron' => array('type' => 'int','precision' => 
'2','nullable' => True),
-                               'cron_date' => array('type' => 
'timestamp','nullable' => False,'default' => 'current_timestamp'),
-                               'process' => array('type' => 
'varchar','precision' => '255','nullable' => False),
-                               'message' => array('type' => 'text','nullable' 
=> True)
-                       ),
-                       'pk' => array('id'),
-                       'fk' => array(),
-                       'ix' => array(),
-                       'uc' => array()
-               ),
-               '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()
-               ),
-               'fm_tenant_claim_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()
-               )
-       );
+<?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$
+       */
+
+       $phpgw_baseline = array(
+               'fm_part_of_town' => array(
+                       'fd' => array(
+                               'part_of_town_id' => array('type' => 
'auto','precision' => '2','nullable' => False),
+                               'name' => array('type' => 'varchar','precision' 
=> '20','nullable' => True),
+                               'district_id' => array('type' => 
'int','precision' => '2','nullable' => True)
+                       ),
+                       'pk' => array('part_of_town_id'),
+                       'fk' => array(),
+                       'ix' => array(),
+                       'uc' => array()
+               ),
+
+
+               'fm_gab_location' => array(
+                       'fd' => array(
+                               'location_code' => array('type' => 
'varchar','precision' => '16','nullable' => False),
+                               'gab_id' => array('type' => 
'varchar','precision' => '20','nullable' => False),
+                               'user_id' => array('type' => 'int','precision' 
=> '4','nullable' => True),
+                               'entry_date' => array('type' => 
'int','precision' => '4','nullable' => True),
+                               'loc1' => array('type' => 'varchar','precision' 
=> '4','nullable' => True),
+                               'loc2' => array('type' => 'varchar','precision' 
=> '4','nullable' => True),
+                               'loc3' => array('type' => 'varchar','precision' 
=> '4','nullable' => True),
+                               'loc4' => array('type' => 'varchar','precision' 
=> '4','nullable' => True),
+                               'address' => array('type' => 
'varchar','precision' => '150','nullable' => True),
+                               'split' => array('type' => 'int','precision' => 
'2','nullable' => True),
+                               'remark' => array('type' => 
'varchar','precision' => '50','nullable' => True),
+                               'owner' => array('type' => 
'varchar','precision' => '5','nullable' => True),
+                               'Spredning' => array('type' => 
'int','precision' => '4','nullable' => True)
+                       ),
+                       'pk' => array('gab_id','location_code'),
+                       'fk' => array(),
+                       'ix' => array('location_code'),
+                       'uc' => array()
+               ),
+               'fm_streetaddress' => array(
+                       'fd' => array(
+                               'id' => array('type' => 'int','precision' => 
'4','nullable' => False),
+                               'descr' => array('type' => 
'varchar','precision' => '150','nullable' => False)
+                       ),
+                       'pk' => array('id'),
+                       'fk' => array(),
+                       'ix' => array(),
+                       'uc' => array()
+               ),
+               'fm_tenant' => array(
+                       'fd' => array(
+                               'id' => array('type' => 'int','precision' => 
'4','nullable' => False),
+                               'member_of' => array('type' => 
'varchar','precision' => '255','nullable' => True),
+                               'entry_date' => array('type' => 
'int','precision' => '4','nullable' => True),
+                               'first_name' => array('type' => 
'varchar','precision' => '30','nullable' => True),
+                               'last_name' => array('type' => 
'varchar','precision' => '30','nullable' => True),
+                               'contact_phone' => array('type' => 
'varchar','precision' => '20','nullable' => True),
+                               'category' => array('type' => 'int','precision' 
=> '4','nullable' => True)
+                       ),
+                       'pk' => array('id'),
+                       'fk' => array(),
+                       'ix' => array(),
+                       'uc' => array()
+               ),
+               'fm_tenant_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()
+               ),
+               'fm_tenant_attribute' => array(
+                       'fd' => array(
+                               'id' => array('type' => 'int','precision' => 
'4','nullable' => False),
+                               'column_name' => array('type' => 
'varchar','precision' => '20','nullable' => False),
+                               'input_text' => array('type' => 
'varchar','precision' => '20','nullable' => False),
+                               'list' => array('type' => 'int','precision' => 
'2','nullable' => True),
+                               'location_form' => array('type' => 
'int','precision' => '2','nullable' => True),
+                               'lookup_form' => array('type' => 
'int','precision' => '2','nullable' => True),
+                               'search' => array('type' => 'int','precision' 
=> '2','nullable' => True),
+                               'statustext' => array('type' => 
'varchar','precision' => '100','nullable' => False),
+                               'size' => array('type' => 'int','precision' => 
'4','nullable' => True),
+                               'datatype' => array('type' => 
'varchar','precision' => '10','nullable' => True),
+                               'attrib_sort' => array('type' => 
'int','precision' => '4','nullable' => True),
+                               'precision_' => array('type' => 
'int','precision' => '4','nullable' => True),
+                               'scale' => array('type' => 'int','precision' => 
'4','nullable' => True),
+                               'default_value' => array('type' => 
'varchar','precision' => '20','nullable' => True),
+                               'nullable' => array('type' => 
'varchar','precision' => '5','nullable' => False,'default' => 'True')
+                       ),
+                       'pk' => array('id'),
+                       'fk' => array(),
+                       'ix' => array(),
+                       'uc' => array()
+               ),
+
+               'fm_tenant_choice' => array(
+                       'fd' => array(
+                               'attrib_id' => array('type' => 
'int','precision' => '4','nullable' => False),
+                               'id' => array('type' => 'int','precision' => 
'4','nullable' => False),
+                               'value' => array('type' => 'text','nullable' => 
False)
+                       ),
+                       'pk' => array('attrib_id','id'),
+                       'fk' => array(),
+                       'ix' => array(),
+                       'uc' => array()
+               ),
+
+               'fm_vendor' => array(
+                       'fd' => array(
+                               'id' => array('type' => 'int','precision' => 
'4','nullable' => False),
+                               'entry_date' => array('type' => 
'int','precision' => '4','nullable' => True),
+                               'org_name' => array('type' => 
'varchar','precision' => '100','nullable' => True),
+                               'email' => array('type' => 
'varchar','precision' => '64','nullable' => True),
+                               'contact_phone' => array('type' => 
'varchar','precision' => '20','nullable' => True),
+                               'klasse' => array('type' => 
'varchar','precision' => '10','nullable' => True),
+                               'member_of' => array('type' => 
'varchar','precision' => '255','nullable' => True),
+                               'category' => array('type' => 'int','precision' 
=> '2','nullable' => True),
+                               'mva' => array('type' => 'int','precision' => 
'4','nullable' => True)
+                       ),
+                       'pk' => array('id'),
+                       'fk' => array(),
+                       'ix' => array(),
+                       'uc' => array()
+               ),
+               'fm_vendor_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()
+               ),
+               'fm_vendor_attribute' => array(
+                       'fd' => array(
+                               'id' => array('type' => 'int','precision' => 
'4','nullable' => False),
+                               'column_name' => array('type' => 
'varchar','precision' => '20','nullable' => False),
+                               'input_text' => array('type' => 
'varchar','precision' => '20','nullable' => False),
+                               'list' => array('type' => 'int','precision' => 
'2','nullable' => True),
+                               'location_form' => array('type' => 
'int','precision' => '2','nullable' => True),
+                               'lookup_form' => array('type' => 
'int','precision' => '2','nullable' => True),
+                               'search' => array('type' => 'int','precision' 
=> '2','nullable' => True),
+                               'statustext' => array('type' => 
'varchar','precision' => '100','nullable' => False),
+                               'size' => array('type' => 'int','precision' => 
'4','nullable' => True),
+                               'datatype' => array('type' => 
'varchar','precision' => '10','nullable' => True),
+                               'attrib_sort' => array('type' => 
'int','precision' => '4','nullable' => True),
+                               'precision_' => array('type' => 
'int','precision' => '4','nullable' => True),
+                               'scale' => array('type' => 'int','precision' => 
'4','nullable' => True),
+                               'default_value' => array('type' => 
'varchar','precision' => '20','nullable' => True),
+                               'nullable' => array('type' => 
'varchar','precision' => '5','nullable' => False,'default' => 'True')
+                       ),
+                       'pk' => array('id'),
+                       'fk' => array(),
+                       'ix' => array(),
+                       'uc' => array()
+               ),
+
+               'fm_vendor_choice' => array(
+                       'fd' => array(
+                               'attrib_id' => array('type' => 
'int','precision' => '4','nullable' => False),
+                               'id' => array('type' => 'int','precision' => 
'4','nullable' => False),
+                               'value' => array('type' => 'text','nullable' => 
False)
+                       ),
+                       'pk' => array('attrib_id','id'),
+                       'fk' => array(),
+                       'ix' => array(),
+                       'uc' => array()
+               ),
+
+
+               'fm_district' => array(
+                       'fd' => array(
+                               'id' => array('type' => 'int','precision' => 
'2','nullable' => False),
+                               'descr' => array('type' => 
'varchar','precision' => '20','nullable' => True)
+                       ),
+                       'pk' => array('id'),
+                       'fk' => array(),
+                       'ix' => array(),
+                       'uc' => array()
+               ),
+
+               'fm_standard_unit' => array(
+                       'fd' => array(
+                               'id' => array('type' => 'varchar','precision' 
=> '20','nullable' => False),
+                               'descr' => array('type' => 
'varchar','precision' => '255','nullable' => False)
+                       ),
+                       'pk' => array('id'),
+                       'fk' => array(),
+                       'ix' => array(),
+                       'uc' => array()
+               ),
+
+               'fm_location_type' => array(
+                       'fd' => array(
+                               'id' => array('type' => 'int','precision' => 
'4','nullable' => False),
+                               'name' => array('type' => 'varchar','precision' 
=> '20','nullable' => True),
+                               'descr' => array('type' => 
'varchar','precision' => '50','nullable' => True),
+                               'prefix' => array('type' => 
'varchar','precision' => '8','nullable' => True),
+                               'pk' => array('type' => 'text','nullable' => 
True),
+                               'ix' => array('type' => 'text','nullable' => 
True),
+                               'uc' => array('type' => 'text','nullable' => 
True),
+                       ),
+                       'pk' => array('id'),
+                       'fk' => array(),
+                       'ix' => array(),
+                       'uc' => array()
+               ),
+
+               'fm_location1' => 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),
+                       ),
+                       '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),
+                               'descr' => array('type' => 
'varchar','precision' => '255','nullable' => False)
+                       ),
+                       'pk' => array('id'),
+                       'fk' => array(),
+                       'ix' => array(),
+                       'uc' => array()
+               ),
+               'fm_location2' => 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),
+                       ),
+                       '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),
+                               'descr' => array('type' => 
'varchar','precision' => '255','nullable' => False)
+                       ),
+                       'pk' => array('id'),
+                       'fk' => array(),
+                       'ix' => array(),
+                       'uc' => array()
+               ),
+               'fm_location3' => 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),
+                       ),
+                       '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),
+                               'descr' => array('type' => 
'varchar','precision' => '255','nullable' => False)
+                       ),
+                       'pk' => array('id'),
+                       'fk' => array(),
+                       'ix' => array(),
+                       'uc' => array()
+               ),
+
+               'fm_location4' => 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),
+                       ),
+                       '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),
+                               'descr' => array('type' => 
'varchar','precision' => '255','nullable' => False)
+                       ),
+                       'pk' => array('id'),
+                       'fk' => array(),
+                       'ix' => array(),
+                       'uc' => array()
+               ),
+
+               'fm_location_config' => array(
+                       'fd' => array(
+                               'column_name' => array('type' => 
'varchar','precision' => '20','nullable' => False),
+                               'location_type' => array('type' => 
'int','precision' => '4','nullable' => False),
+                               'input_text' => array('type' => 
'varchar','precision' => '20','nullable' => True),
+                               'lookup_form' => array('type' => 
'int','precision' => '2','nullable' => True),
+                               'f_key' => array('type' => 'int','precision' => 
'2','nullable' => True),
+                               'ref_to_category' => array('type' => 
'int','precision' => '2','nullable' => True),
+                               'query_value' => array('type' => 
'int','precision' => '2','nullable' => True),
+                               'reference_table' => array('type' => 
'varchar','precision' => '30','nullable' => True),
+                               'reference_id' => array('type' => 
'varchar','precision' => '15','nullable' => True),
+                               'datatype' => array('type' => 
'varchar','precision' => '10','nullable' => True),
+                               'precision_' => array('type' => 
'int','precision' => '4','nullable' => True),
+                               'scale' => array('type' => 'int','precision' => 
'4','nullable' => True),
+                               'default_value' => array('type' => 
'varchar','precision' => '20','nullable' => True),
+                               'nullable' => array('type' => 
'varchar','precision' => '5','nullable' => False,'default' => 'True')
+                       ),
+                       'pk' => array('column_name'),
+                       'fk' => array(),
+                       'ix' => array(),
+                       'uc' => array()
+               ),
+
+               'fm_location_attrib' => array(
+                       'fd' => array(
+                               'type_id' => array('type' => 'int','precision' 
=> '4','nullable' => False),
+                               'id' => array('type' => 'int','precision' => 
'4','nullable' => False),
+                               'custom' => array('type' => 'int','precision' 
=> '4','nullable' => True),
+                               'column_name' => array('type' => 
'varchar','precision' => '20','nullable' => False),
+                               'input_text' => array('type' => 
'varchar','precision' => '20','nullable' => False),
+                               'list' => array('type' => 'int','precision' => 
'2','nullable' => True),
+                               'location_form' => array('type' => 
'int','precision' => '2','nullable' => True),
+                               'lookup_form' => array('type' => 
'int','precision' => '2','nullable' => True),
+                               'statustext' => array('type' => 
'varchar','precision' => '100','nullable' => False),
+                               'size' => array('type' => 'int','precision' => 
'4','nullable' => True),
+                               'datatype' => array('type' => 
'varchar','precision' => '10','nullable' => True),
+                               'attrib_sort' => array('type' => 
'int','precision' => '4','nullable' => True),
+                               'precision_' => array('type' => 
'int','precision' => '4','nullable' => True),
+                               'scale' => array('type' => 'int','precision' => 
'4','nullable' => True),
+                               'default_value' => array('type' => 
'varchar','precision' => '20','nullable' => True),
+                               'nullable' => array('type' => 
'varchar','precision' => '5','nullable' => False,'default' => 'True')
+                       ),
+                       'pk' => array('type_id','id'),
+                       'fk' => array(),
+                       'ix' => array(),
+                       'uc' => array()
+               ),
+
+               'fm_location_choice' => array(
+                       'fd' => array(
+                               'type_id' => array('type' => 'int','precision' 
=> '4','nullable' => False),
+                               'attrib_id' => array('type' => 
'int','precision' => '4','nullable' => False),
+                               'id' => array('type' => 'int','precision' => 
'4','nullable' => False),
+                               'value' => array('type' => 'text','nullable' => 
False)
+                       ),
+                       'pk' => array('type_id','attrib_id','id'),
+                       'fk' => array(),
+                       'ix' => array(),
+                       'uc' => array()
+               ),
+
+               'fm_building_part' => array(
+                       'fd' => array(
+                               'id' => array('type' => 'varchar','precision' 
=> '4','nullable' => False),
+                               'descr' => array('type' => 
'varchar','precision' => '50','nullable' => True)
+                       ),
+                       'pk' => array('id'),
+                       'fk' => array(),
+                       'ix' => array(),
+                       'uc' => array()
+               ),
+               'fm_b_account' => array(
+                       'fd' => array(
+                               'id' => array('type' => 'varchar','precision' 
=> '20','nullable' => False),
+                               'grouping' => array('type' => 
'varchar','precision' => '4','nullable' => False),
+                               'descr' => array('type' => 
'varchar','precision' => '100','nullable' => False),
+                               'mva' => array('type' => 'int','precision' => 
'4','nullable' => True),
+                               'responsible' => array('type' => 
'int','precision' => '4','nullable' => True),
+                       ),
+                       'pk' => array('id'),
+                       'fk' => array(),
+                       'ix' => array(),
+                       'uc' => array()
+               ),
+               'fm_dim_d' => array(
+                       'fd' => array(
+                               'id' => array('type' => 'int','precision' => 
'4','nullable' => False),
+                               'descr' => array('type' => 
'varchar','precision' => '25','nullable' => False)
+                       ),
+                       'pk' => array('id'),
+                       'fk' => array(),
+                       'ix' => array(),
+                       'uc' => array()
+               ),
+               'fm_workorder' => array(
+                       'fd' => array(
+                               'id' => array('type' => 'int','precision' => 
'4','nullable' => False),
+                               'num' => array('type' => 'varchar','precision' 
=> '20','nullable' => False),
+                               'project_id' => array('type' => 
'int','precision' => '4','nullable' => False),
+                               'user_id' => array('type' => 'int','precision' 
=> '4','nullable' => False),
+                               'access' => array('type' => 
'varchar','precision' => '7','nullable' => True),
+                               'category' => array('type' => 'int','precision' 
=> '4','nullable' => False),
+                               'chapter_id' => array('type' => 
'int','precision' => '4','nullable' => True),
+                               'entry_date' => array('type' => 
'int','precision' => '4','nullable' => False),
+                               'start_date' => array('type' => 
'int','precision' => '4','nullable' => False),
+                               'end_date' => array('type' => 'int','precision' 
=> '4','nullable' => False),
+                               'coordinator' => array('type' => 
'int','precision' => '4','nullable' => False),
+                               'vendor_id' => array('type' => 
'int','precision' => '4','nullable' => True),
+                               'status' => array('type' => 
'varchar','precision' => '20','nullable' => False,'default' => 'active'),
+                               'descr' => array('type' => 'text','nullable' => 
True),
+                               'title' => array('type' => 
'varchar','precision' => '255','nullable' => False),
+                               'budget' => array('type' => 
'decimal','precision' => '20','scale' => '2','nullable' => True,'default' => 
'0.00'),
+                               'calculation' => array('type' => 
'decimal','precision' => '20','scale' => '2','nullable' => True,'default' => 
'0.00'),
+                               'deviation' => array('type' => 
'decimal','precision' => '20','scale' => '2','nullable' => True),
+                               'act_mtrl_cost' => array('type' => 
'decimal','precision' => '20','scale' => '2','nullable' => True,'default' => 
'0.00'),
+                               'act_vendor_cost' => array('type' => 
'decimal','precision' => '20','scale' => '2','nullable' => True,'default' => 
'0.00'),
+                               'addition' => array('type' => 'int','precision' 
=> '4','nullable' => True),
+                               'rig_addition' => array('type' => 
'int','precision' => '4','nullable' => True),
+                               'account_id' => array('type' => 
'varchar','precision' => '20','nullable' => True),
+                               'key_fetch' => array('type' => 
'int','precision' => '4','nullable' => True),
+                               'key_deliver' => array('type' => 
'int','precision' => '4','nullable' => True),
+                               'integration' => array('type' => 
'int','precision' => '4','nullable' => True),
+                               'charge_tenant' => array('type' => 
'int','precision' => '2','nullable' => True),
+                               'claim_issued' => array('type' => 
'int','precision' => '2','nullable' => True)
+                       ),
+                       'pk' => array('id'),
+                       'fk' => array(),
+                       'ix' => array(),
+                       'uc' => array()
+               ),
+               'fm_workorder_category' => array(
+                       'fd' => array(
+                               'id' => array('type' => 'int','precision' => 
'4','nullable' => False),
+                               'descr' => array('type' => 
'varchar','precision' => '50','nullable' => True)
+                       ),
+                       'pk' => array('id'),
+                       'fk' => array(),
+                       'ix' => array(),
+                       'uc' => array()
+               ),
+               'fm_workorder_status' => array(
+                       'fd' => array(
+                               'id' => array('type' => 'varchar','precision' 
=> '20','nullable' => False),
+                               'descr' => array('type' => 
'varchar','precision' => '255','nullable' => False)
+                       ),
+                       'pk' => array('id'),
+                       'fk' => array(),
+                       'ix' => array(),
+                       'uc' => array()
+               ),
+               'fm_activities' => array(
+                       'fd' => array(
+                               'id' => array('type' => 'int','precision' => 
'4','nullable' => False),
+                               'num' => array('type' => 'varchar','precision' 
=> '25','nullable' => False),
+                               'base_descr' => array('type' => 
'text','nullable' => True),
+                               'unit' => array('type' => 'varchar','precision' 
=> '4','nullable' => True),
+                               'ns3420' => array('type' => 
'varchar','precision' => '15','nullable' => True),
+                               'remarkreq' => array('type' => 
'varchar','precision' => '5','nullable' => True,'default' => 'N'),
+                               'minperae' => array('type' => 'int','precision' 
=> '4','default' => '0','nullable' => True),
+                               'billperae' => array('type' => 
'decimal','precision' => '20','scale' => '2','nullable' => True,'default' => 
'0.00'),
+                               'dim_d' => array('type' => 'int','precision' => 
'4','nullable' => True),
+                               'descr' => array('type' => 'text','nullable' => 
True),
+                               'branch_id' => array('type' => 
'int','precision' => '4','nullable' => True),
+                               'agreement_group_id' => array('type' => 
'int','precision' => '4','nullable' => True)
+                       ),
+                       'pk' => array('id'),
+                       'fk' => array(),
+                       'ix' => array(),
+                       'uc' => array()
+               ),
+               'fm_agreement_group' => array(
+                       'fd' => array(
+                               'id' => array('type' => 'int','precision' => 
'4','nullable' => False),
+                               'num' => array('type' => 'varchar','precision' 
=> '25','nullable' => False),
+                               'descr' => array('type' => 
'varchar','precision' => '50','nullable' => False),
+                               'status' => array('type' => 
'varchar','precision' => '15','nullable' => False)
+                       ),
+                       'pk' => array('id'),
+                       'fk' => array(),
+                       'ix' => array(),
+                       'uc' => array()
+               ),
+               'fm_agreement' => array(
+                       'fd' => array(
+                               'group_id' => array('type' => 'int','precision' 
=> '4','nullable' => False),
+                               'id' => array('type' => 'int','precision' => 
'4','nullable' => False),
+                               'vendor_id' => array('type' => 
'int','precision' => '4','nullable' => False),
+                               'name' => array('type' => 'varchar','precision' 
=> '100','nullable' => False),
+                               'descr' => array('type' => 'text','nullable' => 
True),
+                               'status' => array('type' => 
'varchar','precision' => '10','nullable' => True),
+                               'entry_date' => array('type' => 
'int','precision' => '4','nullable' => True),
+                               'start_date' => array('type' => 
'int','precision' => '4','nullable' => True),
+                               'end_date' => array('type' => 'int','precision' 
=> '4','nullable' => True),
+                               'termination_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)
+                       ),
+                       'pk' => array('group_id','id'),
+                       'fk' => array(),
+                       'ix' => array(),
+                       'uc' => array()
+               ),
+               'fm_agreement_status' => array(
+                       'fd' => array(
+                               'id' => array('type' => 'varchar','precision' 
=> '20','nullable' => False),
+                               'descr' => array('type' => 
'varchar','precision' => '255','nullable' => False)
+                       ),
+                       'pk' => array('id'),
+                       'fk' => array(),
+                       'ix' => array(),
+                       'uc' => array()
+               ),
+
+               'fm_agreement_attribute' => array(
+                       'fd' => array(
+                               'id' => array('type' => 'int', 'precision' => 
4,'nullable' => False,'default' => '0'),
+                               'attrib_detail' => array('type' => 'int', 
'precision' => 2,'nullable' => False,'default' => '0'),
+                               'list' => array('type' => 'int', 'precision' => 
2,'nullable' => True),
+                               'location_form' => array('type' => 'int', 
'precision' => 2,'nullable' => True),
+                               'lookup_form' => array('type' => 'int', 
'precision' => 4,'nullable' => True),
+                               'column_name' => array('type' => 'varchar', 
'precision' => 20,'nullable' => False),
+                               'input_text' => array('type' => 'varchar', 
'precision' => 50,'nullable' => False),
+                               'statustext' => array('type' => 'varchar', 
'precision' => 100,'nullable' => False),
+                               'size' => array('type' => 'int', 'precision' => 
4,'nullable' => True),
+                               'datatype' => array('type' => 'varchar', 
'precision' => 10,'nullable' => False),
+                               'attrib_sort' => array('type' => 'int', 
'precision' => 4,'nullable' => True),
+                               'precision_' => array('type' => 'int', 
'precision' => 4,'nullable' => True),
+                               'scale' => array('type' => 'int', 'precision' 
=> 4,'nullable' => True),
+                               'default_value' => array('type' => 'varchar', 
'precision' => 18,'nullable' => True),
+                               'nullable' => array('type' => 'varchar', 
'precision' => 5,'nullable' => False,'default' => 'True'),
+                               'search' => array('type' => 'int', 'precision' 
=> 2,'nullable' => True)
+                       ),
+                       'pk' => array('id','attrib_detail'),
+                       'fk' => array(),
+                       'ix' => array(),
+                       'uc' => array()
+               ),
+
+               'fm_agreement_choice' => array(
+                       'fd' => array(
+                               'attrib_id' => array('type' => 'int', 
'precision' => 4,'nullable' => False,'default' => '0'),
+                               'id' => array('type' => 'int', 'precision' => 
4,'nullable' => False,'default' => '0'),
+                               'value' => array('type' => 'varchar', 
'precision' => 255,'nullable' => True),
+                               'attrib_detail' => array('type' => 'int', 
'precision' => 2,'nullable' => False,'default' => '0')
+                       ),
+                       'pk' => array('attrib_id','id','attrib_detail'),
+                       'fk' => array(),
+                       'ix' => array(),
+                       'uc' => array()
+               ),
+
+               'fm_activity_price_index' => array(
+                       'fd' => array(
+                               'activity_id' => array('type' => 
'int','precision' => '4','nullable' => False),
+                               'agreement_id' => array('type' => 
'int','precision' => '4','nullable' => False),
+                               'index_count' => array('type' => 
'int','precision' => '4','nullable' => False),
+                               'current_index' => array('type' => 
'int','precision' => '2','nullable' => True),
+                               'this_index' => array('type' => 
'decimal','precision' => '20','scale' => '4','nullable' => True,'default' => 
'0.00'),
+                               'm_cost' => array('type' => 
'decimal','precision' => '20','scale' => '2','nullable' => True,'default' => 
'0.00'),
+                               'w_cost' => array('type' => 
'decimal','precision' => '20','scale' => '2','nullable' => True,'default' => 
'0.00'),
+                               'total_cost' => array('type' => 
'decimal','precision' => '20','scale' => '2','nullable' => True,'default' => 
'0.00'),
+                               'entry_date' => array('type' => 
'int','precision' => '4','nullable' => True),
+                               'index_date' => array('type' => 
'int','precision' => '4','nullable' => True),
+                               'user_id' => array('type' => 'int','precision' 
=> '4','nullable' => True)
+                       ),
+                       'pk' => 
array('activity_id','agreement_id','index_count'),
+                       'fk' => array(),
+                       'ix' => array(),
+                       'uc' => array()
+               ),
+               'fm_branch' => array(
+                       'fd' => array(
+                               'id' => array('type' => 'int','precision' => 
'4','nullable' => False),
+                               'num' => array('type' => 'varchar','precision' 
=> '20','nullable' => False),
+                               'descr' => array('type' => 
'varchar','precision' => '255','nullable' => False)
+                       ),
+                       'pk' => array('id'),
+                       'fk' => array(),
+                       'ix' => array(),
+                       'uc' => array()
+               ),
+               'fm_wo_hours' => array(
+                       'fd' => array(
+                               'id' => array('type' => 'auto','precision' => 
'4','nullable' => False),
+                               'record' => array('type' => 'int','precision' 
=> '4','nullable' => True),
+                               'owner' => array('type' => 'int','precision' => 
'4','nullable' => False),
+                               'workorder_id' => array('type' => 
'int','precision' => '4','nullable' => False),
+                               'activity_id' => array('type' => 
'int','precision' => '4','nullable' => True),
+                               'activity_num' => array('type' => 
'varchar','precision' => '15','nullable' => True),
+                               'grouping_id' => array('type' => 
'int','precision' => '4','nullable' => True),
+                               'grouping_descr' => array('type' => 
'varchar','precision' => '50','nullable' => True),
+                               'entry_date' => array('type' => 
'int','precision' => '4','nullable' => False),
+                               'hours_descr' => array('type' => 
'varchar','precision' => '255','nullable' => True),
+                               'remark' => array('type' => 'text','nullable' 
=> True),
+                               'billperae' => array('type' => 
'decimal','precision' => '20','scale' => '2','nullable' => True,'default' => 
'0.00'),
+                               'vendor_id' => array('type' => 
'int','precision' => '4','nullable' => True),
+                               'unit' => array('type' => 'varchar','precision' 
=> '6','nullable' => True),
+                               'ns3420_id' => array('type' => 
'varchar','precision' => '20','nullable' => True),
+                               'tolerance' => array('type' => 
'int','precision' => '4','nullable' => True),
+                               'building_part' => array('type' => 
'varchar','precision' => '4','nullable' => True),
+                               'quantity' => array('type' => 
'decimal','precision' => '20','scale' => '2','nullable' => True),
+                               'cost' => array('type' => 'decimal','precision' 
=> '20','scale' => '2','nullable' => True),
+                               'dim_d' => array('type' => 'int','precision' => 
'4','nullable' => True),
+                               'category' => array('type' => 'int','precision' 
=> '4','nullable' => True)
+                       ),
+                       'pk' => array('id'),
+                       'fk' => array(),
+                       'ix' => array(),
+                       'uc' => array()
+               ),
+               '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()
+               ),
+               'fm_wo_h_deviation' => array(
+                       'fd' => array(
+                               'workorder_id' => array('type' => 
'int','precision' => '4','nullable' => False),
+                               'hour_id' => array('type' => 'int','precision' 
=> '4','nullable' => False),
+                               'id' => array('type' => 'int','precision' => 
'4','nullable' => False),
+                               'amount' => array('type' => 'int','precision' 
=> '4','nullable' => False),
+                               'descr' => array('type' => 'text','nullable' => 
True),
+                               'entry_date' => array('type' => 
'int','precision' => '4','nullable' => True)
+                       ),
+                       'pk' => array('workorder_id','hour_id','id'),
+                       'fk' => array(),
+                       'ix' => array(),
+                       'uc' => array()
+               ),
+               'fm_template' => array(
+                       'fd' => array(
+                               'id' => array('type' => 'auto','precision' => 
'4','nullable' => False),
+                               'name' => array('type' => 'varchar','precision' 
=> '50','nullable' => True),
+                               'descr' => array('type' => 
'varchar','precision' => '255','nullable' => True),
+                               'owner' => array('type' => 'int','precision' => 
'4','nullable' => True),
+                               'chapter_id' => array('type' => 
'int','precision' => '4','nullable' => True),
+                               'entry_date' => array('type' => 
'int','precision' => '4','nullable' => True)
+                       ),
+                       'pk' => array('id'),
+                       'fk' => array(),
+                       'ix' => array(),
+                       'uc' => array()
+               ),
+               'fm_template_hours' => array(
+                       'fd' => array(
+                               'id' => array('type' => 'auto','precision' => 
'4','nullable' => False),
+                               'template_id' => array('type' => 
'int','precision' => '4','nullable' => False),
+                               'record' => array('type' => 'int','precision' 
=> '4','nullable' => True),
+                               'owner' => array('type' => 'int','precision' => 
'4','nullable' => False),
+                               'workorder_id' => array('type' => 
'int','precision' => '4','nullable' => False),
+                               'activity_id' => array('type' => 
'int','precision' => '4','nullable' => True),
+                               'activity_num' => array('type' => 
'varchar','precision' => '15','nullable' => True),
+                               'grouping_id' => array('type' => 
'int','precision' => '4','nullable' => True),
+                               'grouping_descr' => array('type' => 
'varchar','precision' => '50','nullable' => True),
+                               'hours_descr' => array('type' => 
'varchar','precision' => '255','nullable' => True),
+                               'remark' => array('type' => 'text','nullable' 
=> True),
+                               'billperae' => array('type' => 
'decimal','precision' => '20','scale' => '2','nullable' => True,'default' => 
'0.00'),
+                               'vendor_id' => array('type' => 
'int','precision' => '4','nullable' => True),
+                               'unit' => array('type' => 'varchar','precision' 
=> '6','nullable' => True),
+                               'ns3420_id' => array('type' => 
'varchar','precision' => '20','nullable' => True),
+                               'tolerance' => array('type' => 
'int','precision' => '4','nullable' => True),
+                               'building_part' => array('type' => 
'varchar','precision' => '4','nullable' => True),
+                               'quantity' => array('type' => 
'decimal','precision' => '20','scale' => '2','nullable' => True),
+                               'cost' => array('type' => 'decimal','precision' 
=> '20','scale' => '2','nullable' => True),
+                               'dim_d' => array('type' => 'int','precision' => 
'4','nullable' => True)
+                       ),
+                       'pk' => array('id'),
+                       'fk' => array(),
+                       'ix' => array(),
+                       'uc' => array()
+               ),
+               'fm_key_loc' => array(
+                       'fd' => array(
+                               'id' => array('type' => 'int','precision' => 
'4','nullable' => False),
+                               'num' => array('type' => 'varchar','precision' 
=> '20','nullable' => False),
+                               'descr' => array('type' => 
'varchar','precision' => '255','nullable' => False)
+                       ),
+                       'pk' => array('id'),
+                       'fk' => array(),
+                       'ix' => array(),
+                       'uc' => array()
+               ),
+               'fm_chapter' => array(
+                       'fd' => array(
+                               'id' => array('type' => 'int','precision' => 
'4','nullable' => False),
+                               'descr' => array('type' => 
'varchar','precision' => '50','nullable' => False)
+                       ),
+                       'pk' => array('id'),
+                       'fk' => array(),
+                       'ix' => array(),
+                       'uc' => array()
+               ),
+               'fm_request' => array(
+                       'fd' => array(
+                               'id' => array('type' => 'int','precision' => 
'4','nullable' => False),
+                               'title' => array('type' => 
'varchar','precision' => '20','nullable' => True),
+                               'project_id' => array('type' => 
'int','precision' => '4','nullable' => True),
+                               'p_num' => array('type' => 
'varchar','precision' => '15','nullable' => True),
+                               'p_entity_id' => array('type' => 
'int','precision' => '4','nullable' => True),
+                               'p_cat_id' => array('type' => 'int','precision' 
=> '4','nullable' => True),
+                               'location_code' => array('type' => 
'varchar','precision' => '20','nullable' => True),
+                               'loc1' => array('type' => 'varchar','precision' 
=> '4','nullable' => True),
+                               'loc2' => array('type' => 'varchar','precision' 
=> '4','nullable' => True),
+                               'loc3' => array('type' => 'varchar','precision' 
=> '4','nullable' => True),
+                               'loc4' => array('type' => 'varchar','precision' 
=> '4','nullable' => True),
+                               'descr' => array('type' => 'text','nullable' => 
True),
+                               'category' => array('type' => 'int','precision' 
=> '4','nullable' => True),
+                               'owner' => array('type' => 'int','precision' => 
'4','nullable' => True),
+                               'access' => array('type' => 
'varchar','precision' => '7','nullable' => True),
+                               'floor' => array('type' => 
'varchar','precision' => '6','nullable' => True),
+                               'address' => array('type' => 
'varchar','precision' => '150','nullable' => True),
+                               'tenant_id' => array('type' => 
'int','precision' => '4','nullable' => True),
+                               'contact_phone' => array('type' => 
'varchar','precision' => '20','nullable' => True),
+                               'entry_date' => array('type' => 
'int','precision' => '4','nullable' => True),
+                               'budget' => array('type' => 'int','precision' 
=> '4','nullable' => True),
+                               'status' => array('type' => 
'varchar','precision' => '10','nullable' => True),
+                               'branch_id' => array('type' => 
'int','precision' => '4','nullable' => True),
+                               'coordinator' => array('type' => 
'int','precision' => '4','nullable' => True),
+                               'authorities_demands' => array('type' => 
'int','precision' => '2','default' => '0','nullable' => True),
+                               'score' => array('type' => 'int','precision' => 
'4','default' => '0','nullable' => True)
+                       ),
+                       'pk' => array('id'),
+                       'fk' => array(),
+                       'ix' => array('location_code'),
+                       'uc' => array()
+               ),
+               'fm_request_condition' => array(
+                       'fd' => array(
+                               'request_id' => array('type' => 
'int','precision' => '4','nullable' => False),
+                               'condition_type' => array('type' => 
'int','precision' => '4','nullable' => False),
+                               'degree' => array('type' => 'int','precision' 
=> '4','default' => '0','nullable' => True),
+                               'probability' => array('type' => 
'int','precision' => '4','default' => '0','nullable' => True),
+                               'consequence' => array('type' => 
'int','precision' => '4','default' => '0','nullable' => True),
+                               'user_id' => array('type' => 'int','precision' 
=> '4','nullable' => True),
+                               'entry_date' => array('type' => 
'int','precision' => '4','nullable' => True)
+                       ),
+                       'pk' => array('request_id','condition_type'),
+                       'fk' => array(),
+                       'ix' => array(),
+                       'uc' => array()
+               ),
+               'fm_request_status' => array(
+                       'fd' => array(
+                               'id' => array('type' => 'varchar','precision' 
=> '20','nullable' => False),
+                               'descr' => array('type' => 
'varchar','precision' => '255','nullable' => False)
+                       ),
+                       'pk' => array('id'),
+                       'fk' => array(),
+                       'ix' => array(),
+                       'uc' => array()
+               ),
+               'fm_request_category' => array(
+                       'fd' => array(
+                               'id' => array('type' => 'int','precision' => 
'4','nullable' => False),
+                               'descr' => array('type' => 
'varchar','precision' => '50','nullable' => True)
+                       ),
+                       'pk' => array('id'),
+                       'fk' => array(),
+                       'ix' => array(),
+                       'uc' => array()
+               ),
+               'fm_ns3420' => array(
+                       'fd' => array(
+                               'id' => array('type' => 'varchar','precision' 
=> '20','nullable' => False),
+                               'tekst1' => array('type' => 
'varchar','precision' => '50','nullable' => True),
+                               'enhet' => array('type' => 
'varchar','precision' => '6','nullable' => True),
+                               'tekst2' => array('type' => 
'varchar','precision' => '50','nullable' => True),
+                               'tekst3' => array('type' => 
'varchar','precision' => '50','nullable' => True),
+                               'tekst4' => array('type' => 
'varchar','precision' => '50','nullable' => True),
+                               'tekst5' => array('type' => 
'varchar','precision' => '50','nullable' => True),
+                               'tekst6' => array('type' => 
'varchar','precision' => '50','nullable' => True),
+                               'parent' => array('type' => 
'varchar','precision' => '20','nullable' => True),
+                               'type' => array('type' => 'varchar','precision' 
=> '20','nullable' => True)
+                       ),
+                       'pk' => array('id'),
+                       'fk' => array(),
+                       'ix' => array(),
+                       'uc' => array()
+               ),
+               'fm_tts_tickets' => array(
+                       'fd' => array(
+                               'id' => array('type' => 'auto','nullable' => 
False),
+                               'group_id' => array('type' => 'int','precision' 
=> '4','nullable' => True),
+                               'priority' => array('type' => 'int','precision' 
=> '2','nullable' => False),
+                               'user_id' => array('type' => 'int','precision' 
=> '4','nullable' => True),
+                               'assignedto' => array('type' => 
'int','precision' => '4','nullable' => True),
+                               'subject' => array('type' => 
'varchar','precision' => '255','nullable' => True),
+                               'cat_id' => array('type' => 'int','precision' 
=> '4','nullable' => True),
+                               'billable_hours' => array('type' => 
'decimal','precision' => '8','scale' => '2','nullable' => True),
+                               'billable_rate' => array('type' => 
'decimal','precision' => '8','scale' => '2','nullable' => True),
+                               'status' => array('type' => 'char','precision' 
=> '1','nullable' => False),
+                               'details' => array('type' => 'text','nullable' 
=> False),
+                               'location_code' => array('type' => 
'varchar','precision' => '50','nullable' => True),
+                               'p_num' => array('type' => 
'varchar','precision' => '15','nullable' => True),
+                               'p_entity_id' => array('type' => 
'int','precision' => '4','nullable' => True),
+                               'p_cat_id' => array('type' => 'int','precision' 
=> '4','nullable' => True),
+                               'loc1' => array('type' => 'varchar','precision' 
=> '4','nullable' => True),
+                               'loc2' => array('type' => 'varchar','precision' 
=> '4','nullable' => True),
+                               'loc3' => array('type' => 'varchar','precision' 
=> '4','nullable' => True),
+                               'loc4' => array('type' => 'varchar','precision' 
=> '4','nullable' => True),
+                               'floor' => array('type' => 
'varchar','precision' => '6','nullable' => True),
+                               'address' => array('type' => 
'varchar','precision' => '150','nullable' => True),
+                               'contact_phone' => array('type' => 
'varchar','precision' => '20','nullable' => True),
+                               'tenant_id' => array('type' => 
'int','precision' => '4','nullable' => True),
+                               'entry_date' => array('type' => 
'int','precision' => '4','nullable' => True),
+                               'finnish_date' => array('type' => 
'int','precision' => '4','nullable' => True),
+                               'finnish_date2' => array('type' => 
'int','precision' => '4','nullable' => True)
+                       ),
+                       'pk' => array('id'),
+                       'ix' => array(),
+                       'ix' => array('location_code'),
+                       'uc' => array()
+               ),
+               'fm_tts_views' => array(
+                       'fd' => array(
+                               'id' => array('type' => 'int','precision' => 
'4','nullable' => False),
+                               'account_id' => array('type' => 
'int','precision' => '4','nullable' => True),
+                               'time' => array('type' => 'int','precision' => 
'4','nullable' => False)
+                       ),
+                       'pk' => array(),
+                       'ix' => array(),
+                       'fk' => array(),
+                       'uc' => array()
+               ),
+               'fm_tts_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()
+               ),
+               'fm_ecoart' => array(
+                       'fd' => array(
+                               'id' => array('type' => 'int','precision' => 
'4','nullable' => False),
+                               'name' => array('type' => 'varchar','precision' 
=> '20','nullable' => False),
+                               'description' => array('type' => 
'text','nullable' => True)
+                       ),
+                       'pk' => array('id'),
+                       'ix' => array(),
+                       'fk' => array(),
+                       'uc' => array()
+               ),
+               'fm_ecoavvik' => array(
+                       'fd' => array(
+                               'bilagsnr' => array('type' => 'int','precision' 
=> '4','nullable' => False),
+                               'belop' => array('type' => 
'decimal','precision' => '20','scale' => '2','default' => '0','nullable' => 
False),
+                               'fakturadato' => array('type' => 
'timestamp','nullable' => False),
+                               'forfallsdato' => array('type' => 
'timestamp','nullable' => False),
+                               'artid' => array('type' => 'int','precision' => 
'2','nullable' => False),
+                               'godkjentbelop' => array('type' => 
'decimal','precision' => '20','scale' => '2','default' => '0','nullable' => 
True),
+                               'spvend_code' => array('type' => 
'varchar','precision' => '12','nullable' => True),
+                               'oppsynsmannid' => array('type' => 
'varchar','precision' => '12','nullable' => True),
+                               'saksbehandlerid' => array('type' => 
'varchar','precision' => '12','nullable' => True),
+                               'budsjettansvarligid' => array('type' => 
'varchar','precision' => '12','nullable' => False),
+                               'utbetalingid' => array('type' => 
'varchar','precision' => '12','nullable' => True),
+                               'oppsynsigndato' => array('type' => 
'timestamp','nullable' => True),
+                               'saksigndato' => array('type' => 
'timestamp','nullable' => True),
+                               'budsjettsigndato' => array('type' => 
'timestamp','nullable' => True),
+                               'utbetalingsigndato' => array('type' => 
'timestamp','nullable' => True),
+                               'overftid' => array('type' => 
'timestamp','nullable' => True)
+                       ),
+                       'pk' => array('bilagsnr'),
+                       'ix' => array(),
+                       'fk' => array(),
+                       'uc' => array()
+               ),
+               'fm_ecobilag' => array(
+                       'fd' => array(
+                               'id' => array('type' => 'auto','precision' => 
'4','nullable' => False),
+                               'bilagsnr' => array('type' => 'int','precision' 
=> '4','nullable' => False),
+                               'kidnr' => array('type' => 
'varchar','precision' => '30','nullable' => True),
+                               'typeid' => array('type' => 'int','precision' 
=> '2','nullable' => False),
+                               'kildeid' => array('type' => 'int','precision' 
=> '2','nullable' => False),
+                               'project_id' => array('type' => 
'int','precision' => '4','nullable' => True),
+                               'kostra_id' => array('type' => 
'int','precision' => '4','nullable' => True),
+                               'pmwrkord_code' => array('type' => 
'int','precision' => '4','nullable' => True),
+                               'belop' => array('type' => 
'decimal','precision' => '20','scale' => '2','default' => '0','nullable' => 
False),
+                               'fakturadato' => array('type' => 
'timestamp','nullable' => False),
+                               'periode' => array('type' => 'int','precision' 
=> '2','nullable' => True),
+                               'forfallsdato' => array('type' => 
'timestamp','nullable' => False),
+                               'fakturanr' => array('type' => 
'varchar','precision' => '15','nullable' => False),
+                               'spbudact_code' => array('type' => 
'varchar','precision' => '30','nullable' => True),
+                               'regtid' => array('type' => 
'timestamp','nullable' => False),
+                               'artid' => array('type' => 'int','precision' => 
'2','nullable' => False),
+                               'godkjentbelop' => array('type' => 
'decimal','precision' => '20','scale' => '2','default' => '0','nullable' => 
True),
+                               'spvend_code' => array('type' => 
'varchar','precision' => '12','nullable' => True),
+                               'dima' => array('type' => 'varchar','precision' 
=> '20','nullable' => True),
+                               'loc1' => array('type' => 'varchar','precision' 
=> '10','nullable' => True),
+                               'dimb' => array('type' => 'int','precision' => 
'2','nullable' => True),
+                               'mvakode' => array('type' => 'int','precision' 
=> '2','nullable' => True),
+                               'dimd' => array('type' => 'varchar','precision' 
=> '5','nullable' => True),
+                               'oppsynsmannid' => array('type' => 
'varchar','precision' => '12','nullable' => True),
+                               'saksbehandlerid' => array('type' => 
'varchar','precision' => '12','nullable' => True),
+                               'budsjettansvarligid' => array('type' => 
'varchar','precision' => '12','nullable' => False),
+                               'utbetalingid' => array('type' => 
'varchar','precision' => '12','nullable' => True),
+                               'oppsynsigndato' => array('type' => 
'timestamp','nullable' => True),
+                               'saksigndato' => array('type' => 
'timestamp','nullable' => True),
+                               'budsjettsigndato' => array('type' => 
'timestamp','nullable' => True),
+                               'utbetalingsigndato' => array('type' => 
'timestamp','nullable' => True),
+                               'merknad' => array('type' => 'text','nullable' 
=> True),
+                               'splitt' => array('type' => 'int','precision' 
=> '2','nullable' => True),
+                               'kreditnota' => array('type' => 
'int','precision' => '2','nullable' => True),
+                               'pre_transfer' => array('type' => 
'int','precision' => '2','nullable' => True)
+                       ),
+                       'pk' => array('id'),
+                       'ix' => array(),
+                       'fk' => array(),
+                       'uc' => array()
+               ),
+               'fm_ecobilagoverf' => array(
+                       'fd' => array(
+                               'id' => array('type' => 'int','precision' => 
'4','nullable' => False),
+                               'bilagsnr' => array('type' => 'int','precision' 
=> '4','nullable' => False),
+                               'kidnr' => array('type' => 
'varchar','precision' => '30','nullable' => True),
+                               'typeid' => array('type' => 'int','precision' 
=> '2','nullable' => False),
+                               'kildeid' => array('type' => 'int','precision' 
=> '2','nullable' => False),
+                               'project_id' => array('type' => 
'int','precision' => '4','nullable' => True),
+                               'kostra_id' => array('type' => 
'int','precision' => '4','nullable' => True),
+                               'pmwrkord_code' => array('type' => 
'int','precision' => '4','nullable' => True),
+                               'belop' => array('type' => 
'decimal','precision' => '20','scale' => '2','default' => '0','nullable' => 
False),
+                               'fakturadato' => array('type' => 
'timestamp','nullable' => False),
+                               'periode' => array('type' => 'int','precision' 
=> '2','nullable' => True),
+                               'forfallsdato' => array('type' => 
'timestamp','nullable' => False),
+                               'fakturanr' => array('type' => 
'varchar','precision' => '15','nullable' => False),
+                               'spbudact_code' => array('type' => 
'varchar','precision' => '30','nullable' => True),
+                               'regtid' => array('type' => 
'timestamp','nullable' => False),
+                               'artid' => array('type' => 'int','precision' => 
'2','nullable' => False),
+                               'godkjentbelop' => array('type' => 
'decimal','precision' => '20','scale' => '2','default' => '0','nullable' => 
True),
+                               'spvend_code' => array('type' => 
'varchar','precision' => '12','nullable' => True),
+                               'dima' => array('type' => 'varchar','precision' 
=> '20','nullable' => True),
+                               'loc1' => array('type' => 'varchar','precision' 
=> '10','nullable' => True),
+                               'dimb' => array('type' => 'int','precision' => 
'2','nullable' => True),
+                               'mvakode' => array('type' => 'int','precision' 
=> '2','nullable' => True),
+                               'dimd' => array('type' => 'varchar','precision' 
=> '5','nullable' => True),
+                               'oppsynsmannid' => array('type' => 
'varchar','precision' => '12','nullable' => True),
+                               'saksbehandlerid' => array('type' => 
'varchar','precision' => '12','nullable' => True),
+                               'budsjettansvarligid' => array('type' => 
'varchar','precision' => '12','nullable' => False),
+                               'utbetalingid' => array('type' => 
'varchar','precision' => '12','nullable' => True),
+                               'oppsynsigndato' => array('type' => 
'timestamp','nullable' => True),
+                               'saksigndato' => array('type' => 
'timestamp','nullable' => True),
+                               'budsjettsigndato' => array('type' => 
'timestamp','nullable' => True),
+                               'utbetalingsigndato' => array('type' => 
'timestamp','nullable' => True),
+                               'overftid' => array('type' => 
'timestamp','nullable' => True,'default' => 'current_timestamp'),
+                               'ordrebelop' => array('type' => 
'decimal','precision' => '20','scale' => '2','default' => '0','nullable' => 
False),
+                               'merknad' => array('type' => 'text','nullable' 
=> True),
+                               'splitt' => array('type' => 'int','precision' 
=> '2','nullable' => True),
+                               'filnavn' => array('type' => 
'varchar','precision' => '255','nullable' => False),
+                               'kreditnota' => array('type' => 
'int','precision' => '2','nullable' => True)
+                       ),
+                       'pk' => array('id'),
+                       'ix' => array(),
+                       'fk' => array(),
+                       'uc' => array()
+               ),
+               'fm_ecobilagkilde' => array(
+                       'fd' => array(
+                               'id' => array('type' => 'int','precision' => 
'2','nullable' => False),
+                               'name' => array('type' => 'varchar','precision' 
=> '20','nullable' => False),
+                               'description' => array('type' => 
'text','nullable' => True)
+                       ),
+                       'pk' => array('id'),
+                       'ix' => array(),
+                       'fk' => array(),
+                       'uc' => array()
+               ),
+               'fm_ecobilagtype' => array(
+                       'fd' => array(
+                               'id' => array('type' => 'int','precision' => 
'2','nullable' => False),
+                               'name' => array('type' => 'varchar','precision' 
=> '20','nullable' => False),
+                               'description' => array('type' => 
'text','nullable' => True)
+                       ),
+                       'pk' => array('id'),
+                       'ix' => array(),
+                       'fk' => array(),
+                       'uc' => array()
+               ),
+               'fm_ecodimb' => array(
+                       'fd' => array(
+                               'id' => array('type' => 'int','precision' => 
'2','nullable' => False),
+                               'name' => array('type' => 'varchar','precision' 
=> '20','nullable' => False),
+                               'description' => array('type' => 
'text','nullable' => True)
+                       ),
+                       'pk' => array('id'),
+                       'ix' => array(),
+                       'fk' => array(),
+                       'uc' => array()
+               ),
+               'fm_ecodimd' => array(
+                       'fd' => array(
+                               'id' => array('type' => 'varchar','precision' 
=> '5','nullable' => False),
+                               'name' => array('type' => 'varchar','precision' 
=> '20','nullable' => False),
+                               'description' => array('type' => 
'text','nullable' => True)
+                       ),
+                       'pk' => array('id'),
+                       'ix' => array(),
+                       'fk' => array(),
+                       'uc' => array()
+               ),
+               'fm_ecomva' => array(
+                       'fd' => array(
+                               'id' => array('type' => 'int','precision' => 
'2','nullable' => False),
+                               'name' => array('type' => 'varchar','precision' 
=> '20','nullable' => False),
+                               'description' => array('type' => 
'text','nullable' => True)
+                       ),
+                       'pk' => array('id'),
+                       'ix' => array(),
+                       'fk' => array(),
+                       'uc' => array()
+               ),
+               'fm_ecologg' => array(
+                       'fd' => array(
+                               'batchid' => array('type' => 'int','precision' 
=> '4','nullable' => False),
+                               'ecobilagid' => array('type' => 
'int','precision' => '4','nullable' => True),
+                               'status' => array('type' => 'int','precision' 
=> '2','nullable' => True),
+                               'melding' => array('type' => 
'varchar','precision' => '255','nullable' => True),
+                               'tid' => array('type' => 'timestamp','nullable' 
=> True,'default' => 'current_timestamp')
+                       ),
+                       'pk' => array(),
+                       'ix' => array(),
+                       'fk' => array(),
+                       'uc' => array()
+               ),
+               'fm_ecouser' => array(
+                       'fd' => array(
+                               'id' => array('type' => 'int','precision' => 
'4','nullable' => False),
+                               'lid' => array('type' => 'varchar','precision' 
=> '25','nullable' => False),
+                               'initials' => array('type' => 
'varchar','precision' => '6','nullable' => True)
+                       ),
+                       'pk' => array('id'),
+                       'ix' => array(),
+                       'fk' => array(),
+                       'uc' => array()
+               ),
+               'fm_acl2' => array(
+                       'fd' => array(
+                               'acl_host' => array('type' => 'int','precision' 
=> '4','default' => '0','nullable' => False),
+                               'acl_appid' => array('type' => 
'int','precision' => '4','default' => '0','nullable' => False),
+                               'grantor' => array('type' => 'int','precision' 
=> '4','nullable' => True),
+                               'grantor_type' => array('type' => 
'char','precision' => '1','nullable' => True),
+                               'acl_account' => array('type' => 
'int','precision' => '4','default' => '0','nullable' => False),
+                               'acl_location' => array('type' => 
'varchar','precision' => '255','nullable' => False),
+                               'acl_rights' => array('type' => 
'int','precision' => '4','default' => '','nullable' => True),
+                               'acl_type' => array('type' => 'int','precision' 
=> '2','default' => '0','nullable' => False),
+                               'acl_data ' => array('type' => 
'text','nullable' => True)
+                       ),
+                       'pk' => array(),
+                       'fk' => array(),
+                       'ix' => array(),
+                       'uc' => array()
+               ),
+               '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()
+               ),
+               'fm_projectbranch' => array(
+                       'fd' => array(
+                               'project_id' => array('type' => 
'int','precision' => '4','nullable' => False),
+                               'branch_id' => array('type' => 
'int','precision' => '4','nullable' => False)
+                       ),
+                       'pk' => array('project_id','branch_id'),
+                       'fk' => array(),
+                       'ix' => array(),
+                       'uc' => array()
+               ),
+               'fm_project' => array(
+                       'fd' => array(
+                               'id' => array('type' => 'int','precision' => 
'4','nullable' => False),
+                               'name' => array('type' => 'varchar','precision' 
=> '255','nullable' => False),
+                               'user_id' => array('type' => 'int','precision' 
=> '4','nullable' => False),
+                               'access' => array('type' => 
'varchar','precision' => '7','nullable' => True),
+                               'category' => array('type' => 'int','precision' 
=> '4','nullable' => False),
+                               'entry_date' => array('type' => 
'int','precision' => '4','nullable' => False),
+                               'start_date' => array('type' => 
'int','precision' => '4','nullable' => False),
+                               'end_date' => array('type' => 'int','precision' 
=> '4','nullable' => False),
+                               'coordinator' => array('type' => 
'int','precision' => '4','nullable' => False),
+                               'status' => array('type' => 
'varchar','precision' => '20','nullable' => False,'default' => 'active'),
+                               'descr' => array('type' => 'text','nullable' => 
True),
+                               'budget' => array('type' => 
'decimal','precision' => '20','scale' => '2','nullable' => True,'default' => 
'0.00'),
+                               'reserve' => array('type' => 
'decimal','precision' => '20','scale' => '2','nullable' => True,'default' => 
'0.00'),
+                               'p_num' => array('type' => 
'varchar','precision' => '15','nullable' => True),
+                               'p_entity_id' => array('type' => 
'int','precision' => '4','nullable' => True),
+                               'p_cat_id' => array('type' => 'int','precision' 
=> '4','nullable' => True),
+                               'location_code' => array('type' => 
'varchar','precision' => '20','nullable' => True),
+                               'loc1' => array('type' => 'varchar','precision' 
=> '4','nullable' => True),
+                               'loc2' => array('type' => 'varchar','precision' 
=> '4','nullable' => True),
+                               'loc3' => array('type' => 'varchar','precision' 
=> '4','nullable' => True),
+                               'loc4' => array('type' => 'varchar','precision' 
=> '4','nullable' => True),
+                               'address' => array('type' => 
'varchar','precision' => '150','nullable' => True),
+                               'tenant_id' => array('type' => 
'int','precision' => '4','nullable' => True),
+                               'contact_phone' => array('type' => 
'varchar','precision' => '20','nullable' => True),
+                               'key_fetch' => array('type' => 
'int','precision' => '4','nullable' => True),
+                               'key_deliver' => array('type' => 
'int','precision' => '4','nullable' => True),
+                               'other_branch' => array('type' => 
'varchar','precision' => '255','nullable' => True),
+                               'key_responsible' => array('type' => 
'int','precision' => '4','nullable' => True)
+                       ),
+                       'pk' => array('id'),
+                       'fk' => array(),
+                       'ix' => array('location_code'),
+                       'uc' => array()
+               ),
+               'fm_event_receipt' => array(
+                       'fd' => array(
+                               'cal_id' => array('type' => 'int','precision' 
=> '4','nullable' => False),
+                               'year_month_date' => array('type' => 
'int','precision' => '4','nullable' => False),
+                               'datetime_done' => array('type' => 
'int','precision' => '4','nullable' => True),
+                               'datetime_reject' => array('type' => 
'int','precision' => '4','nullable' => True),
+                               'user_id' => array('type' => 'int','precision' 
=> '4','nullable' => True)
+                       ),
+                       'pk' => array('cal_id','year_month_date'),
+                       'fk' => array(),
+                       'ix' => array(),
+                       'uc' => array()
+               ),
+               'fm_investment' => array(
+                       'fd' => array(
+                               'entity_id' => array('type' => 
'varchar','precision' => '20','nullable' => False),
+                               'invest_id' => array('type' => 
'int','precision' => '4','nullable' => False),
+                               'entity_type' => array('type' => 
'varchar','precision' => '20','nullable' => True),
+                               'p_num' => array('type' => 
'varchar','precision' => '15','nullable' => True),
+                               'p_entity_id' => array('type' => 
'int','precision' => '4','nullable' => True),
+                               'p_cat_id' => array('type' => 'int','precision' 
=> '4','nullable' => True),
+                               'location_code' => array('type' => 
'varchar','precision' => '20','nullable' => True),
+                               'loc1' => array('type' => 'varchar','precision' 
=> '4','nullable' => True),
+                               'loc2' => array('type' => 'varchar','precision' 
=> '4','nullable' => True),
+                               'loc3' => array('type' => 'varchar','precision' 
=> '4','nullable' => True),
+                               'loc4' => array('type' => 'varchar','precision' 
=> '4','nullable' => True),
+                               'address' => array('type' => 
'varchar','precision' => '150','nullable' => True),
+                               'descr' => array('type' => 
'varchar','precision' => '255','nullable' => True),
+                               'writeoff_year' => array('type' => 
'int','precision' => '4','nullable' => True)
+                       ),
+                       'pk' => array('entity_id','invest_id'),
+                       'fk' => array(),
+                       'ix' => array('location_code','entity_id'),
+                       'uc' => array()
+               ),
+               'fm_investment_value' => array(
+                       'fd' => array(
+                               'entity_id' => array('type' => 
'varchar','precision' => '20','nullable' => False),
+                               'invest_id' => array('type' => 
'int','precision' => '4','nullable' => False),
+                               'index_count' => array('type' => 
'int','precision' => '4','nullable' => False),
+                               'current_index' => array('type' => 
'int','precision' => '2','nullable' => True),
+                               'this_index' => array('type' => 
'decimal','precision' => '20','scale' => '4','default' => '0','nullable' => 
True),
+                               'initial_value' => array('type' => 
'decimal','precision' => '20','scale' => '2','default' => '0','nullable' => 
True),
+                               'value' => array('type' => 
'decimal','precision' => '20','scale' => '2','default' => '0','nullable' => 
True),
+                               'index_date' => array('type' => 
'timestamp','nullable' => True,'default' => 'current_timestamp')
+                       ),
+                       'pk' => array('entity_id','invest_id','index_count'),
+                       'fk' => array(),
+                       'ix' => array(),
+                       'uc' => array()
+               ),
+               'fm_idgenerator' => array(
+                       'fd' => array(
+                               'name' => array('type' => 'varchar','precision' 
=> '30','nullable' => False),
+                               'value' => array('type' => 'int','precision' => 
'4','nullable' => False),
+                               'increment' => array('type' => 
'int','precision' => '4','nullable' => True),
+                               'maxvalue' => array('type' => 'int','precision' 
=> '2','nullable' => True),
+                               'descr' => array('type' => 
'varchar','precision' => '30','nullable' => True)
+                       ),
+                       'pk' => array('name'),
+                       'fk' => array(),
+                       'ix' => array(),
+                       'uc' => array()
+               ),
+               'fm_document' => array(
+                       'fd' => array(
+                               'id' => array('type' => 'auto','precision' => 
'4','nullable' => False),
+                               'title' => array('type' => 
'varchar','precision' => '50','nullable' => True),
+                               'document_name' => array('type' => 
'varchar','precision' => '50','nullable' => True),
+                               'link' => array('type' => 'text','nullable' => 
True),
+                               'descr' => array('type' => 
'varchar','precision' => '255','nullable' => True),
+                               'version' => array('type' => 
'varchar','precision' => '10','nullable' => True),
+                               'document_date' => array('type' => 
'int','precision' => '4','nullable' => True),
+                               'entry_date' => array('type' => 
'int','precision' => '4','nullable' => True),
+                               'status' => array('type' => 
'varchar','precision' => '10','nullable' => True),
+                               'p_num' => array('type' => 
'varchar','precision' => '15','nullable' => True),
+                               'p_entity_id' => array('type' => 
'int','precision' => '4','nullable' => True),
+                               'p_cat_id' => array('type' => 'int','precision' 
=> '4','nullable' => True),
+                               'location_code' => array('type' => 
'varchar','precision' => '20','nullable' => False),
+                               'loc1' => array('type' => 'varchar','precision' 
=> '4','nullable' => True),
+                               'loc2' => array('type' => 'varchar','precision' 
=> '4','nullable' => True),
+                               'loc3' => array('type' => 'varchar','precision' 
=> '4','nullable' => True),
+                               'loc4' => array('type' => 'varchar','precision' 
=> '4','nullable' => True),
+                               'address' => array('type' => 
'varchar','precision' => '150','nullable' => True),
+                               'coordinator' => array('type' => 
'int','precision' => '4','nullable' => True),
+                               'vendor_id' => array('type' => 
'int','precision' => '4','nullable' => True),
+                               'branch_id' => array('type' => 
'int','precision' => '4','nullable' => True),
+                               'category' => array('type' => 'int','precision' 
=> '4','nullable' => True),
+                               'user_id' => array('type' => 'int','precision' 
=> '4','nullable' => True),
+                               'access' => array('type' => 
'varchar','precision' => '7','nullable' => True)
+                       ),
+                       'pk' => array('id'),
+                       'fk' => array(),
+                       'ix' => array('location_code'),
+                       'uc' => array()
+               ),
+               'fm_document_category' => array(
+                       'fd' => array(
+                               'id' => array('type' => 'int','precision' => 
'4','nullable' => False),
+                               'descr' => array('type' => 
'varchar','precision' => '50','nullable' => True)
+                       ),
+                       'pk' => array('id'),
+                       'fk' => array(),
+                       'ix' => array(),
+                       'uc' => array()
+               ),
+               'fm_document_status' => array(
+                       'fd' => array(
+                               'id' => array('type' => 'varchar','precision' 
=> '20','nullable' => False),
+                               'descr' => array('type' => 
'varchar','precision' => '255','nullable' => False)
+                       ),
+                       'pk' => array('id'),
+                       'fk' => array(),
+                       'ix' => array(),
+                       'uc' => array()
+               ),
+               'fm_acl_location' => array(
+                       'fd' => array(
+                               'id' => array('type' => 'varchar','precision' 
=> '20','nullable' => False),
+                               'descr' => array('type' => 
'varchar','precision' => '50','nullable' => False),
+                               'allow_grant' => array('type' => 
'int','precision' => '4','nullable' => True)
+                       ),
+                       'pk' => array('id'),
+                       'fk' => array(),
+                       'ix' => array(),
+                       'uc' => array()
+               ),
+               'fm_request_history' => array(
+                       'fd' => array(
+                               'history_id' => array('type' => 
'auto','precision' => '4','nullable' => False),
+                               'history_record_id' => array('type' => 
'int','precision' => '4','nullable' => False),
+                               'history_appname' => array('type' => 
'varchar','precision' => '64','nullable' => False),
+                               'history_owner' => array('type' => 
'int','precision' => '4','nullable' => False),
+                               'history_status' => array('type' => 
'char','precision' => '2','nullable' => False),
+                               'history_new_value' => array('type' => 
'text','nullable' => False),
+                               'history_timestamp' => array('type' => 
'timestamp','nullable' => False,'default' => 'current_timestamp')
+                       ),
+                       'pk' => array('history_id'),
+                       'fk' => array(),
+                       'ix' => array(),
+                       'uc' => array()
+               ),
+               'fm_workorder_history' => array(
+                       'fd' => array(
+                               'history_id' => array('type' => 
'auto','precision' => '4','nullable' => False),
+                               'history_record_id' => array('type' => 
'int','precision' => '4','nullable' => False),
+                               'history_appname' => array('type' => 
'varchar','precision' => '64','nullable' => False),
+                               'history_owner' => array('type' => 
'int','precision' => '4','nullable' => False),
+                               'history_status' => array('type' => 
'char','precision' => '2','nullable' => False),
+                               'history_new_value' => array('type' => 
'text','nullable' => False),
+                               'history_timestamp' => array('type' => 
'timestamp','nullable' => False,'default' => 'current_timestamp')
+                       ),
+                       'pk' => array('history_id'),
+                       'fk' => array(),
+                       'ix' => array(),
+                       'uc' => array()
+               ),
+               'fm_project_history' => array(
+                       'fd' => array(
+                               'history_id' => array('type' => 
'auto','precision' => '4','nullable' => False),
+                               'history_record_id' => array('type' => 
'int','precision' => '4','nullable' => False),
+                               'history_appname' => array('type' => 
'varchar','precision' => '64','nullable' => False),
+                               'history_owner' => array('type' => 
'int','precision' => '4','nullable' => False),
+                               'history_status' => array('type' => 
'char','precision' => '2','nullable' => False),
+                               'history_new_value' => array('type' => 
'text','nullable' => False),
+                               'history_timestamp' => array('type' => 
'timestamp','nullable' => False,'default' => 'current_timestamp')
+                       ),
+                       'pk' => array('history_id'),
+                       'fk' => array(),
+                       'ix' => array(),
+                       'uc' => array()
+               ),
+               'fm_tts_history' => array(
+                       'fd' => array(
+                               'history_id' => array('type' => 
'auto','precision' => '4','nullable' => False),
+                               'history_record_id' => array('type' => 
'int','precision' => '4','nullable' => False),
+                               'history_appname' => array('type' => 
'varchar','precision' => '64','nullable' => False),
+                               'history_owner' => array('type' => 
'int','precision' => '4','nullable' => False),
+                               'history_status' => array('type' => 
'char','precision' => '2','nullable' => False),
+                               'history_new_value' => array('type' => 
'text','nullable' => False),
+                               'history_timestamp' => array('type' => 
'timestamp','nullable' => False,'default' => 'current_timestamp')
+                       ),
+                       'pk' => array('history_id'),
+                       'fk' => array(),
+                       'ix' => array(),
+                       'uc' => array()
+               ),
+               'fm_document_history' => array(
+                       'fd' => array(
+                               'history_id' => array('type' => 
'auto','precision' => '4','nullable' => False),
+                               'history_record_id' => array('type' => 
'int','precision' => '4','nullable' => False),
+                               'history_appname' => array('type' => 
'varchar','precision' => '64','nullable' => False),
+                               'history_owner' => array('type' => 
'int','precision' => '4','nullable' => False),
+                               'history_status' => array('type' => 
'char','precision' => '2','nullable' => False),
+                               'history_new_value' => array('type' => 
'text','nullable' => False),
+                               'history_timestamp' => array('type' => 
'timestamp','nullable' => False,'default' => 'current_timestamp')
+                       ),
+                       'pk' => array('history_id'),
+                       'fk' => array(),
+                       'ix' => array(),
+                       'uc' => array()
+               ),
+               'fm_owner' => array(
+                       'fd' => array(
+                               'id' => array('type' => 'int','precision' => 
'4','nullable' => False),
+                               'abid' => array('type' => 'int','precision' => 
'4','nullable' => False),
+                               'org_name' => array('type' => 
'varchar','precision' => '50','nullable' => True),
+                               'contact_name' => array('type' => 
'varchar','precision' => '50','nullable' => True),
+                               'category' => array('type' => 'int','precision' 
=> '4','nullable' => False),
+                               'member_of' => array('type' => 
'varchar','precision' => '255','nullable' => True),
+                               'remark' => array('type' => 
'varchar','precision' => '255','nullable' => True),
+                               'entry_date' => array('type' => 
'int','precision' => '4','nullable' => True)
+                       ),
+                       'pk' => array('id'),
+                       'fk' => array(),
+                       'ix' => array(),
+                       'uc' => array()
+               ),
+
+               'fm_owner_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()
+               ),
+               'fm_owner_attribute' => array(
+                       'fd' => array(
+                               'id' => array('type' => 'int','precision' => 
'4','nullable' => False),
+                               'column_name' => array('type' => 
'varchar','precision' => '20','nullable' => False),
+                               'input_text' => array('type' => 
'varchar','precision' => '20','nullable' => False),
+                               'list' => array('type' => 'int','precision' => 
'2','nullable' => True),
+                               'location_form' => array('type' => 
'int','precision' => '2','nullable' => True),
+                               'lookup_form' => array('type' => 
'int','precision' => '2','nullable' => True),
+                               'search' => array('type' => 'int','precision' 
=> '2','nullable' => True),
+                               'statustext' => array('type' => 
'varchar','precision' => '100','nullable' => False),
+                               'size' => array('type' => 'int','precision' => 
'4','nullable' => True),
+                               'datatype' => array('type' => 
'varchar','precision' => '10','nullable' => True),
+                               'attrib_sort' => array('type' => 
'int','precision' => '4','nullable' => True),
+                               'precision_' => array('type' => 
'int','precision' => '4','nullable' => True),
+                               'scale' => array('type' => 'int','precision' => 
'4','nullable' => True),
+                               'default_value' => array('type' => 
'varchar','precision' => '20','nullable' => True),
+                               'nullable' => array('type' => 
'varchar','precision' => '5','nullable' => False,'default' => 'True')
+                       ),
+                       'pk' => array('id'),
+                       'fk' => array(),
+                       'ix' => array(),
+                       'uc' => array()
+               ),
+
+               'fm_owner_choice' => array(
+                       'fd' => array(
+                               'attrib_id' => array('type' => 
'int','precision' => '4','nullable' => False),
+                               'id' => array('type' => 'int','precision' => 
'4','nullable' => False),
+                               'value' => array('type' => 'text','nullable' => 
False)
+                       ),
+                       'pk' => array('attrib_id','id'),
+                       'fk' => array(),
+                       'ix' => array(),
+                       'uc' => array()
+               ),
+
+               'fm_cache' => array(
+                       'fd' => array(
+                               'name' => array('type' => 'varchar','precision' 
=> '50','nullable' => False),
+                               'value' => array('type' => 'text','nullable' => 
True)
+                       ),
+                       'pk' => array('name'),
+                       'fk' => array(),
+                       'ix' => array(),
+                       'uc' => array()
+               ),
+               'fm_entity' => array(
+                       'fd' => array(
+                               'id' => array('type' => 'int','precision' => 
'4','nullable' => False),
+                               'name' => array('type' => 'varchar','precision' 
=> '20','nullable' => False),
+                               'descr' => array('type' => 
'varchar','precision' => '50','nullable' => True),
+                               'location_form' => array('type' => 
'int','precision' => '4','nullable' => True),
+                               'documentation' => array('type' => 
'int','precision' => '4','nullable' => True),
+                               'lookup_entity' => array('type' => 
'text','nullable' => True)
+                       ),
+                       'pk' => array('id'),
+                       'fk' => array(),
+                       'ix' => array(),
+                       'uc' => array()
+               ),
+               'fm_entity_attribute' => array(
+                       'fd' => array(
+                               'entity_id' => array('type' => 
'int','precision' => '4','nullable' => False),
+                               'cat_id' => array('type' => 'int','precision' 
=> '4','nullable' => False),
+                               'id' => array('type' => 'int','precision' => 
'4','nullable' => False),
+                               'column_name' => array('type' => 
'varchar','precision' => '20','nullable' => False),
+                               'input_text' => array('type' => 
'varchar','precision' => '50','nullable' => False),
+                               'statustext' => array('type' => 
'varchar','precision' => '150','nullable' => False),
+                               'datatype' => array('type' => 
'varchar','precision' => '10','nullable' => False),
+                               'search' => array('type' => 'int','precision' 
=> '2','nullable' => True),
+                               'list' => array('type' => 'int','precision' => 
'4','nullable' => True),
+                               'attrib_sort' => array('type' => 
'int','precision' => '4','nullable' => True),
+                               'size' => array('type' => 'int','precision' => 
'4','nullable' => True),
+                               'precision_' => array('type' => 
'int','precision' => '4','nullable' => True),
+                               'scale' => array('type' => 'int','precision' => 
'4','nullable' => True),
+                               'default_value' => array('type' => 
'varchar','precision' => '20','nullable' => True),
+                               'nullable' => array('type' => 
'varchar','precision' => '5','nullable' => True)
+                       ),
+                       'pk' => array('entity_id','cat_id','id'),
+                       'fk' => array(),
+                       'ix' => array(),
+                       'uc' => array()
+               ),
+               'fm_entity_category' => array(
+                       'fd' => array(
+                               'entity_id' => array('type' => 
'int','precision' => '4','nullable' => False),
+                               'id' => array('type' => 'int','precision' => 
'4','nullable' => False),
+                               'name' => array('type' => 'varchar','precision' 
=> '20','nullable' => True),
+                               'descr' => array('type' => 
'varchar','precision' => '50','nullable' => True),
+                               'prefix' => array('type' => 
'varchar','precision' => '50','nullable' => True),
+                               'lookup_tenant' => array('type' => 
'int','precision' => '4','nullable' => True),
+                               'tracking' => array('type' => 'int','precision' 
=> '4','nullable' => True),
+                               'location_level' => array('type' => 
'int','precision' => '4','nullable' => True),
+                               'fileupload' => array('type' => 
'int','precision' => '4','nullable' => True),
+                               'loc_link' => array('type' => 'int','precision' 
=> '4','nullable' => True),
+                               'start_project' => array('type' => 
'int','precision' => '4','nullable' => True)
+                       ),
+                       'pk' => array('entity_id','id'),
+                       'fk' => array(),
+                       'ix' => array(),
+                       'uc' => array()
+               ),
+               'fm_entity_choice' => array(
+                       'fd' => array(
+                               'entity_id' => array('type' => 
'int','precision' => '4','nullable' => False),
+                               'cat_id' => array('type' => 'int','precision' 
=> '4','nullable' => False),
+                               'attrib_id' => array('type' => 
'int','precision' => '4','nullable' => False),
+                               'id' => array('type' => 'int','precision' => 
'4','nullable' => False),
+                               'value' => array('type' => 'text','nullable' => 
False)
+                       ),
+                       'pk' => array('entity_id','cat_id','attrib_id','id'),
+                       'fk' => array(),
+                       'ix' => array(),
+                       'uc' => array()
+               ),
+               'fm_entity_lookup' => array(
+                       'fd' => array(
+                               'entity_id' => array('type' => 
'int','precision' => '4','nullable' => False),
+                               'location' => array('type' => 
'varchar','precision' => '15','nullable' => False),
+                               'type' => array('type' => 'varchar','precision' 
=> '15','nullable' => False)
+                       ),
+                       'pk' => array('entity_id','location','type'),
+                       'fk' => array(),
+                       'ix' => array(),
+                       'uc' => array()
+               ),
+               '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()
+               ),
+               'fm_entity_1_1' => array(
+                       'fd' => array(
+                               'id' => array('type' => 'auto','precision' => 
'4','nullable' => False),
+                               'num' => array('type' => 'varchar','precision' 
=> '20','nullable' => False),
+                               'p_num' => array('type' => 
'varchar','precision' => '15','nullable' => True),
+                               'p_entity_id' => array('type' => 
'int','precision' => '4','nullable' => True),
+                               'p_cat_id' => array('type' => 'int','precision' 
=> '4','nullable' => True),
+                               'location_code' => array('type' => 
'varchar','precision' => '20','nullable' => False),
+                               'loc1' => array('type' => 'varchar','precision' 
=> '4','nullable' => True),
+                               'loc2' => array('type' => 'varchar','precision' 
=> '4','nullable' => True),
+                               'loc3' => array('type' => 'varchar','precision' 
=> '4','nullable' => True),
+                               'loc4' => array('type' => 'varchar','precision' 
=> '4','nullable' => True),
+                               'address' => array('type' => 
'varchar','precision' => '150','nullable' => True),
+                               'entry_date' => array('type' => 
'int','precision' => '4','nullable' => True),
+                               'user_id' => array('type' => 'int','precision' 
=> '4','nullable' => True),
+                               'status' => array('type' => 'int','precision' 
=> '4','nullable' => True),
+                               'category' => array('type' => 'int','precision' 
=> '4','nullable' => False),
+                               'ext_system_id' => array('type' => 
'varchar','precision' => '20','nullable' => False),
+                               'ext_meter_id' => array('type' => 
'varchar','precision' => '20','nullable' => False),
+                               'remark' => array('type' => 
'varchar','precision' => '255','nullable' => True)
+                       ),
+                       'pk' => array('id'),
+                       'fk' => array(),
+                       'ix' => array('location_code'),
+                       'uc' => array('num')
+               ),
+
+               'fm_entity_1_2' => array(
+                       'fd' => array(
+                               'id' => array('type' => 'auto','precision' => 
'4','nullable' => False),
+                               'num' => array('type' => 'varchar','precision' 
=> '16','nullable' => False),
+                               'p_num' => array('type' => 
'varchar','precision' => '15','nullable' => True),
+                               'p_entity_id' => array('type' => 
'int','precision' => '4','nullable' => True),
+                               'p_cat_id' => array('type' => 'int','precision' 
=> '4','nullable' => True),
+                               'location_code' => array('type' => 
'varchar','precision' => '20','nullable' => True),
+                               'loc1' => array('type' => 'varchar','precision' 
=> '4','nullable' => True),
+                               'loc2' => array('type' => 'varchar','precision' 
=> '4','nullable' => True),
+                               'loc3' => array('type' => 'varchar','precision' 
=> '4','nullable' => True),
+                               'loc4' => array('type' => 'varchar','precision' 
=> '4','nullable' => True),
+                               'address' => array('type' => 
'varchar','precision' => '150','nullable' => True),
+                               'tenant_id' => array('type' => 
'int','precision' => '4','nullable' => True),
+                               'contact_phone' => array('type' => 
'varchar','precision' => '30','nullable' => True),
+                               'entry_date' => array('type' => 
'int','precision' => '4','nullable' => True),
+                               'user_id' => array('type' => 'int','precision' 
=> '4','nullable' => True),
+                               'status' => array('type' => 'int','precision' 
=> '4','nullable' => True),
+                               'attribute1' => array('type' => 
'varchar','precision' => '12','nullable' => True),
+                               'attribute2' => array('type' => 
'timestamp','nullable' => True),
+                               'attribute3' => array('type' => 
'int','precision' => '4','nullable' => True),
+                               'attribute4' => array('type' => 
'text','nullable' => True),
+                               'attribute5' => array('type' => 
'int','precision' => '4','nullable' => True)
+                       ),
+                       'pk' => array('id'),
+                       'fk' => array(),
+                       'ix' => array('location_code'),
+                       'uc' => array()
+               ),
+               'fm_entity_1_3' => array(
+                       'fd' => array(
+                               'id' => array('type' => 'auto','precision' => 
'4','nullable' => False),
+                               'num' => array('type' => 'varchar','precision' 
=> '16','nullable' => False),
+                               'p_num' => array('type' => 
'varchar','precision' => '15','nullable' => True),
+                               'p_entity_id' => array('type' => 
'int','precision' => '4','nullable' => True),
+                               'p_cat_id' => array('type' => 'int','precision' 
=> '4','nullable' => True),
+                               'location_code' => array('type' => 
'varchar','precision' => '20','nullable' => True),
+                               'loc1' => array('type' => 'varchar','precision' 
=> '4','nullable' => True),
+                               'loc2' => array('type' => 'varchar','precision' 
=> '4','nullable' => True),
+                               'loc3' => array('type' => 'varchar','precision' 
=> '4','nullable' => True),
+                               'loc4' => array('type' => 'varchar','precision' 
=> '4','nullable' => True),
+                               'address' => array('type' => 
'varchar','precision' => '150','nullable' => True),
+                               'tenant_id' => array('type' => 
'int','precision' => '4','nullable' => True),
+                               'contact_phone' => array('type' => 
'varchar','precision' => '30','nullable' => True),
+                               'entry_date' => array('type' => 
'int','precision' => '4','nullable' => True),
+                               'user_id' => array('type' => 'int','precision' 
=> '4','nullable' => True),
+                               'status' => array('type' => 'int','precision' 
=> '4','nullable' => True),
+                               'attribute1' => array('type' => 
'varchar','precision' => '12','nullable' => True),
+                               'attribute2' => array('type' => 
'timestamp','nullable' => True),
+                               'attribute3' => array('type' => 
'int','precision' => '4','nullable' => True),
+                               'attribute4' => array('type' => 
'text','nullable' => True),
+                               'attribute5' => array('type' => 
'int','precision' => '4','nullable' => True)
+                       ),
+                       'pk' => array('id'),
+                       'fk' => array(),
+                       'ix' => array('location_code'),
+                       'uc' => array()
+               ),
+               'fm_entity_2_1' => array(
+                       'fd' => array(
+                               'id' => array('type' => 'auto','precision' => 
'4','nullable' => False),
+                               'num' => array('type' => 'varchar','precision' 
=> '16','nullable' => False),
+                               'p_num' => array('type' => 
'varchar','precision' => '15','nullable' => True),
+                               'p_entity_id' => array('type' => 
'int','precision' => '4','nullable' => True),
+                               'p_cat_id' => array('type' => 'int','precision' 
=> '4','nullable' => True),
+                               'location_code' => array('type' => 
'varchar','precision' => '20','nullable' => True),
+                               'loc1' => array('type' => 'varchar','precision' 
=> '4','nullable' => True),
+                               'loc2' => array('type' => 'varchar','precision' 
=> '4','nullable' => True),
+                               'loc3' => array('type' => 'varchar','precision' 
=> '4','nullable' => True),
+                               'loc4' => array('type' => 'varchar','precision' 
=> '4','nullable' => True),
+                               'address' => array('type' => 
'varchar','precision' => '150','nullable' => True),
+                               'tenant_id' => array('type' => 
'int','precision' => '4','nullable' => True),
+                               'contact_phone' => array('type' => 
'varchar','precision' => '30','nullable' => True),
+                               'entry_date' => array('type' => 
'int','precision' => '4','nullable' => True),
+                               'user_id' => array('type' => 'int','precision' 
=> '4','nullable' => True),
+                               'status' => array('type' => 'int','precision' 
=> '4','nullable' => True),
+                               'attribute1' => array('type' => 
'varchar','precision' => '12','nullable' => True),
+                               'attribute2' => array('type' => 
'timestamp','nullable' => True),
+                               'attribute3' => array('type' => 
'int','precision' => '4','nullable' => True),
+                               'attribute4' => array('type' => 
'text','nullable' => True),
+                               'attribute5' => array('type' => 
'int','precision' => '4','nullable' => True)
+                       ),
+                       'pk' => array('id'),
+                       'fk' => array(),
+                       'ix' => array('location_code'),
+                       'uc' => array()
+               ),
+               'fm_entity_2_2' => array(
+                       'fd' => array(
+                               'id' => array('type' => 'auto','precision' => 
'4','nullable' => False),
+                               'num' => array('type' => 'varchar','precision' 
=> '16','nullable' => False),
+                               'p_num' => array('type' => 
'varchar','precision' => '15','nullable' => True),
+                               'p_entity_id' => array('type' => 
'int','precision' => '4','nullable' => True),
+                               'p_cat_id' => array('type' => 'int','precision' 
=> '4','nullable' => True),
+                               'location_code' => array('type' => 
'varchar','precision' => '20','nullable' => True),
+                               'loc1' => array('type' => 'varchar','precision' 
=> '4','nullable' => True),
+                               'loc2' => array('type' => 'varchar','precision' 
=> '4','nullable' => True),
+                               'loc3' => array('type' => 'varchar','precision' 
=> '4','nullable' => True),
+                               'loc4' => array('type' => 'varchar','precision' 
=> '4','nullable' => True),
+                               'address' => array('type' => 
'varchar','precision' => '150','nullable' => True),
+                               'tenant_id' => array('type' => 
'int','precision' => '4','nullable' => True),
+                               'contact_phone' => array('type' => 
'varchar','precision' => '30','nullable' => True),
+                               'entry_date' => array('type' => 
'int','precision' => '4','nullable' => True),
+                               'user_id' => array('type' => 'int','precision' 
=> '4','nullable' => True),
+                               'status' => array('type' => 'int','precision' 
=> '4','nullable' => True),
+                               'attribute1' => array('type' => 
'varchar','precision' => '12','nullable' => True),
+                               'attribute2' => array('type' => 
'timestamp','nullable' => True),
+                               'attribute3' => array('type' => 
'int','precision' => '4','nullable' => True),
+                               'attribute4' => array('type' => 
'text','nullable' => True),
+                               'attribute5' => array('type' => 
'int','precision' => '4','nullable' => True)
+                       ),
+                       'pk' => array('id'),
+                       'fk' => array(),
+                       'ix' => array('location_code'),
+                       'uc' => array()
+               ),
+               'fm_custom' => array(
+                       'fd' => array(
+                               'id' => array('type' => 'int','precision' => 
'4','nullable' => False),
+                               'name' => array('type' => 'varchar','precision' 
=> '100','nullable' => False),
+                               'sql' => array('type' => 'text','nullable' => 
False),
+                               'entry_date' => array('type' => 
'int','precision' => '4','nullable' => True),
+                               'user_id' => array('type' => 'int','precision' 
=> '4','nullable' => True)
+                       ),
+                       'pk' => array('id'),
+                       'fk' => array(),
+                       'ix' => array(),
+                       'uc' => array()
+               ),
+               'fm_custom_cols' => array(
+                       'fd' => array(
+                               'custom_id' => array('type' => 
'int','precision' => '4','nullable' => False),
+                               'id' => array('type' => 'int','precision' => 
'4','nullable' => False),
+                               'name' => array('type' => 'varchar','precision' 
=> '100','nullable' => False),
+                               'descr' => array('type' => 
'varchar','precision' => '50','nullable' => False),
+                               'sorting' => array('type' => 'int','precision' 
=> '4','nullable' => False)
+                       ),
+                       'pk' => array('custom_id','id'),
+                       'fk' => array(),
+                       'ix' => array(),
+                       'uc' => array()
+               ),
+
+               'fm_orders' => array(
+                       'fd' => array(
+                               'id' => array('type' => 'int', 'precision' => 
4,'nullable' => False,'default' => '0'),
+                               'type' => array('type' => 'varchar', 
'precision' => 50,'nullable' => False)
+                       ),
+                       'pk' => array('id'),
+                       'fk' => array(),
+                       'ix' => array(),
+                       'uc' => array()
+               ),
+
+               'fm_s_agreement' => array(
+                       'fd' => array(
+                               'id' => array('type' => 'int', 'precision' => 
4,'nullable' => False,'default' => '0'),
+                               'vendor_id' => array('type' => 'int', 
'precision' => 4,'nullable' => True),
+                               'name' => array('type' => 'varchar', 
'precision' => 100,'nullable' => False),
+                               'descr' => array('type' => 'text','nullable' => 
True),
+                               'status' => array('type' => 'varchar', 
'precision' => 10,'nullable' => True),
+                               'category' => array('type' => 'int', 
'precision' => 4,'nullable' => True),
+                               'member_of' => array('type' => 
'text','nullable' => True),
+                               'entry_date' => array('type' => 'int', 
'precision' => 4,'nullable' => True),
+                               'start_date' => array('type' => 'int', 
'precision' => 4,'nullable' => True),
+                               'end_date' => array('type' => 'int', 
'precision' => 4,'nullable' => True),
+                               'termination_date' => array('type' => 'int', 
'precision' => 4,'nullable' => True),
+                               'user_id' => array('type' => 'int', 'precision' 
=> 4,'nullable' => True),
+                               'actual_cost' => array('type' => 'decimal', 
'precision' => 20, 'scale' => 2,'nullable' => True),
+                               'account_id' => array('type' => 'varchar', 
'precision' => 20,'nullable' => True)
+                       ),
+                       'pk' => array('id'),
+                       'fk' => array(),
+                       'ix' => array(),
+                       'uc' => array()
+               ),
+
+               'fm_s_agreement_attribute' => array(
+                       'fd' => array(
+                               'id' => array('type' => 'int', 'precision' => 
4,'nullable' => False,'default' => '0'),
+                               'attrib_detail' => array('type' => 'int', 
'precision' => 2,'nullable' => False,'default' => '0'),
+                               'list' => array('type' => 'int', 'precision' => 
2,'nullable' => True),
+                               'location_form' => array('type' => 'int', 
'precision' => 2,'nullable' => True),
+                               'lookup_form' => array('type' => 'int', 
'precision' => 4,'nullable' => True),
+                               'column_name' => array('type' => 'varchar', 
'precision' => 20,'nullable' => False),
+                               'input_text' => array('type' => 'varchar', 
'precision' => 50,'nullable' => False),
+                               'statustext' => array('type' => 'varchar', 
'precision' => 100,'nullable' => False),
+                               'size' => array('type' => 'int', 'precision' => 
4,'nullable' => True),
+                               'datatype' => array('type' => 'varchar', 
'precision' => 10,'nullable' => False),
+                               'attrib_sort' => array('type' => 'int', 
'precision' => 4,'nullable' => True),
+                               'precision_' => array('type' => 'int', 
'precision' => 4,'nullable' => True),
+                               'scale' => array('type' => 'int', 'precision' 
=> 4,'nullable' => True),
+                               'default_value' => array('type' => 'varchar', 
'precision' => 18,'nullable' => True),
+                               'nullable' => array('type' => 'varchar', 
'precision' => 5,'nullable' => False,'default' => 'True'),
+                               'search' => array('type' => 'int', 'precision' 
=> 2,'nullable' => True)
+                       ),
+                       'pk' => array('id','attrib_detail'),
+                       'fk' => array(),
+                       'ix' => array(),
+                       'uc' => array()
+               ),
+
+               'fm_s_agreement_category' => array(
+                       'fd' => array(
+                               'id' => array('type' => 'int', 'precision' => 
4,'nullable' => False,'default' => '0'),
+                               'descr' => array('type' => 'varchar', 
'precision' => 50,'nullable' => True)
+                       ),
+                       'pk' => array('id'),
+                       'fk' => array(),
+                       'ix' => array(),
+                       'uc' => array()
+               ),
+
+               'fm_s_agreement_choice' => array(
+                       'fd' => array(
+                               'attrib_id' => array('type' => 'int', 
'precision' => 4,'nullable' => False,'default' => '0'),
+                               'id' => array('type' => 'int', 'precision' => 
4,'nullable' => False,'default' => '0'),
+                               'value' => array('type' => 'varchar', 
'precision' => 255,'nullable' => True),
+                               'attrib_detail' => array('type' => 'int', 
'precision' => 2,'nullable' => False,'default' => '0')
+                       ),
+                       'pk' => array('attrib_id','id','attrib_detail'),
+                       'fk' => array(),
+                       'ix' => array(),
+                       'uc' => array()
+               ),
+
+               'fm_s_agreement_detail' => array(
+                       'fd' => array(
+                               'agreement_id' => array('type' => 'int', 
'precision' => 4,'nullable' => False,'default' => '0'),
+                               'id' => array('type' => 'int', 'precision' => 
4,'nullable' => False,'default' => '0'),
+                               'location_code' => array('type' => 'varchar', 
'precision' => 30,'nullable' => True),
+                               'address' => array('type' => 'varchar', 
'precision' => 150,'nullable' => True),
+                               'p_num' => array('type' => 'varchar', 
'precision' => 15,'nullable' => True),
+                               'p_entity_id' => array('type' => 'int', 
'precision' => 4,'nullable' => True,'default' => '0'),
+                               'p_cat_id' => array('type' => 'int', 
'precision' => 4,'nullable' => True,'default' => '0'),
+                               'descr' => array('type' => 'text','nullable' => 
True),
+                               'unit' => array('type' => 'varchar', 
'precision' => 10,'nullable' => True),
+                               'quantity' => array('type' => 'decimal', 
'precision' => 20, 'scale' => 2,'nullable' => True),
+                               'frequency' => array('type' => 'int', 
'precision' => 4,'nullable' => True),
+                               'user_id' => array('type' => 'int', 'precision' 
=> 4,'nullable' => True),
+                               'entry_date' => array('type' => 'int', 
'precision' => 4,'nullable' => True),
+                               'test' => array('type' => 'text','nullable' => 
True),
+                               'cost' => array('type' => 'decimal', 
'precision' => 20, 'scale' => 2,'nullable' => True)
+                       ),
+                       'pk' => array('agreement_id','id'),
+                       'fk' => array(),
+                       'ix' => array(),
+                       'uc' => array()
+               ),
+
+               'fm_s_agreement_pricing' => array(
+                       'fd' => array(
+                               'agreement_id' => array('type' => 'int', 
'precision' => 4,'nullable' => False,'default' => '0'),
+                               'item_id' => array('type' => 'int', 'precision' 
=> 4,'nullable' => False,'default' => '0'),
+                               'id' => array('type' => 'int', 'precision' => 
4,'nullable' => False,'default' => '0'),
+                               'current_index' => array('type' => 'int', 
'precision' => 2,'nullable' => True),
+                               'this_index' => array('type' => 'decimal', 
'precision' => 20, 'scale' => 4,'nullable' => True),
+                               'cost' => array('type' => 'decimal', 
'precision' => 20, 'scale' => 2,'nullable' => True),
+                               'index_date' => array('type' => 'int', 
'precision' => 4,'nullable' => True),
+                               'user_id' => array('type' => 'int', 'precision' 
=> 4,'nullable' => True),
+                               'entry_date' => array('type' => 'int', 
'precision' => 4,'nullable' => True)
+                       ),
+                       'pk' => array('agreement_id','item_id','id'),
+                       'fk' => array(),
+                       'ix' => array(),
+                       'uc' => array()
+               ),
+               'fm_async_method' => array(
+                       'fd' => array(
+                               'id' => array('type' => 'int','precision' => 
'4','nullable' => False),
+                               'name' => array('type' => 'varchar','precision' 
=> '255','nullable' => False),
+                               'data' => array('type' => 'text','nullable' => 
True),
+                               'descr' => array('type' => 'text','nullable' => 
True)
+                       ),
+                       'pk' => array('id'),
+                       'fk' => array(),
+                       'ix' => array(),
+                       'uc' => array()
+               ),
+               'fm_cron_log' => array(
+                       'fd' => array(
+                               'id' => array('type' => 'auto','precision' => 
'4','nullable' => False),
+                               'cron' => array('type' => 'int','precision' => 
'2','nullable' => True),
+                               'cron_date' => array('type' => 
'timestamp','nullable' => False,'default' => 'current_timestamp'),
+                               'process' => array('type' => 
'varchar','precision' => '255','nullable' => False),
+                               'message' => array('type' => 'text','nullable' 
=> True)
+                       ),
+                       'pk' => array('id'),
+                       'fk' => array(),
+                       'ix' => array(),
+                       'uc' => array()
+               ),
+               '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()
+               ),
+               'fm_tenant_claim_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()
+               ),
+               '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()
+               )
+       );






reply via email to

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