[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Fmsystem-commits] [10216] Merge 10166:10210 from trunk
From: |
Sigurd Nes |
Subject: |
[Fmsystem-commits] [10216] Merge 10166:10210 from trunk |
Date: |
Mon, 15 Oct 2012 10:39:00 +0000 |
Revision: 10216
http://svn.sv.gnu.org/viewvc/?view=rev&root=fmsystem&revision=10216
Author: sigurdne
Date: 2012-10-15 10:38:59 +0000 (Mon, 15 Oct 2012)
Log Message:
-----------
Merge 10166:10210 from trunk
Modified Paths:
--------------
branches/Version-1_0-branch/bim/inc/class.sobimtype.inc.php
branches/Version-1_0-branch/bim/setup/setup.inc.php
branches/Version-1_0-branch/bim/setup/tables_current.inc.php
branches/Version-1_0-branch/bim/setup/tables_update.inc.php
Modified: branches/Version-1_0-branch/bim/inc/class.sobimtype.inc.php
===================================================================
--- branches/Version-1_0-branch/bim/inc/class.sobimtype.inc.php 2012-10-15
10:38:47 UTC (rev 10215)
+++ branches/Version-1_0-branch/bim/inc/class.sobimtype.inc.php 2012-10-15
10:38:59 UTC (rev 10216)
@@ -58,14 +58,25 @@
if($this->getBimObjectType($name) != null) {
throw new Exception('Type already exists!');
}
- if(is_null($description)) {
- $sql = "INSERT INTO ".self::bimTypeTable." (name)
VALUES ('$name')";
- } else {
- $sql = "INSERT INTO ".self::bimTypeTable." (name,
description) VALUES ('$name', '$description')";
+
+ $location_id = $GLOBALS['phpgw']->locations->add($name,
$description ? $description : $name , 'bim');
+
+ if(is_null($description))
+ {
+ $sql = "INSERT INTO ".self::bimTypeTable."
(location_id, name) VALUES ($location_id, '$name')";
+ }
+ else
+ {
+ $description = $this->db->db_addslashes($description);
+ $sql = "INSERT INTO ".self::bimTypeTable."
(location_id, name, description) VALUES ($location_id, '$name',
'$description')";
}
- if(is_null($this->db->query($sql,__LINE__,__FILE__) )){
+
+ if(is_null($this->db->query($sql,__LINE__,__FILE__) ))
+ {
throw new Exception("Error adding object
type!");
- } else {
+ }
+ else
+ {
return true;
}
}
Modified: branches/Version-1_0-branch/bim/setup/setup.inc.php
===================================================================
--- branches/Version-1_0-branch/bim/setup/setup.inc.php 2012-10-15 10:38:47 UTC
(rev 10215)
+++ branches/Version-1_0-branch/bim/setup/setup.inc.php 2012-10-15 10:38:59 UTC
(rev 10216)
@@ -12,7 +12,7 @@
*/
$setup_info['bim']['name'] = 'bim';
- $setup_info['bim']['version'] = '0.9.17.504';
+ $setup_info['bim']['version'] = '0.9.17.505';
$setup_info['bim']['app_order'] = 8;
$setup_info['bim']['enable'] = 1;
$setup_info['bim']['app_group'] = 'office';
Modified: branches/Version-1_0-branch/bim/setup/tables_current.inc.php
===================================================================
--- branches/Version-1_0-branch/bim/setup/tables_current.inc.php
2012-10-15 10:38:47 UTC (rev 10215)
+++ branches/Version-1_0-branch/bim/setup/tables_current.inc.php
2012-10-15 10:38:59 UTC (rev 10216)
@@ -47,8 +47,9 @@
),
'fm_bim_item' => array(
'fd' => array(
+ 'location_id' => array('type' => 'int',
'precision' => 4,'nullable' => False),
+ 'id' => array('type' => 'int', 'precision' =>
4, 'nullable' => False),
'type' => array('type' => 'int', 'precision' =>
4,'nullable' => False),
- 'id' => array('type' => 'int', 'precision' =>
4, 'nullable' => False),
'guid' => array('type' => 'varchar',
'precision' => 50,'nullable' => False),
'xml_representation' => array('type' =>
'xml','nullable' => False),
'model' => array('type' => 'int', 'precision'
=> 4,'nullable' => False),
@@ -61,9 +62,10 @@
'user_id' => array('type' => 'int','precision'
=> '4','nullable' => True),
),
'pk' => array('type','id'),
- 'fk' => array('fm_bim_type' => array('type' => 'id')),
-// 'fk' => array('fm_bim_model' => array('model' => 'id'),
-// 'fm_bim_type' =>
array('type' => 'id')),
+ 'fk' => array(
+ 'fm_bim_type' => array('type' => 'id'),
+ 'phpgw_locations' =>
array('location_id' => 'location_id')
+ ),
'ix' => array(),
'uc' => array('guid')
)
Modified: branches/Version-1_0-branch/bim/setup/tables_update.inc.php
===================================================================
--- branches/Version-1_0-branch/bim/setup/tables_update.inc.php 2012-10-15
10:38:47 UTC (rev 10215)
+++ branches/Version-1_0-branch/bim/setup/tables_update.inc.php 2012-10-15
10:38:59 UTC (rev 10216)
@@ -82,3 +82,46 @@
return $GLOBALS['setup_info']['bim']['currentver'];
}
}
+ /**
+ * Update bim version from 0.9.17.504 to 0.9.17.505
+ */
+ $test[] = '0.9.17.504';
+ function bim_upgrade0_9_17_504()
+ {
+ $GLOBALS['phpgw_setup']->oProc->m_odb->transaction_begin();
+
+
$GLOBALS['phpgw_setup']->oProc->AddColumn('fm_bim_item','location_id',
array('type' => 'int', 'precision' => 4,'nullable' => true));
+
+
+ $GLOBALS['phpgw_setup']->oProc->query("SELECT * FROM
fm_bim_type",__LINE__,__FILE__);
+
+ $values = array();
+ while ($GLOBALS['phpgw_setup']->oProc->next_record())
+ {
+ $types[] = array
+ (
+ 'id' =>
(int)$GLOBALS['phpgw_setup']->oProc->f('id'),
+ 'location_id' =>
(int)$GLOBALS['phpgw_setup']->oProc->f('location_id'),
+ 'name' =>
$GLOBALS['phpgw_setup']->oProc->f('name',true),
+ 'description' =>
$GLOBALS['phpgw_setup']->oProc->f('description',true)
+ );
+ }
+
+ foreach ($types as $entry)
+ {
+ if(!$location_id = $entry['location_id'])
+ {
+ $location_id =
$GLOBALS['phpgw']->locations->add($entry['name'], $entry['description'], 'bim');
+ }
+
+ $GLOBALS['phpgw_setup']->oProc->query("UPDATE
fm_bim_item SET location_id = {$location_id} WHERE type =
{$entry['id']}",__LINE__,__FILE__);
+ }
+
+
$GLOBALS['phpgw_setup']->oProc->AlterColumn('fm_bim_item','location_id',
array('type' => 'int', 'precision' => 4,'nullable' => false));
+
+ if($GLOBALS['phpgw_setup']->oProc->m_odb->transaction_commit())
+ {
+ $GLOBALS['setup_info']['bim']['currentver'] =
'0.9.17.505';
+ return $GLOBALS['setup_info']['bim']['currentver'];
+ }
+ }
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Fmsystem-commits] [10216] Merge 10166:10210 from trunk,
Sigurd Nes <=