[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Fmsystem-commits] [8092] preparing for EAV-modelling
From: |
Sigurd Nes |
Subject: |
[Fmsystem-commits] [8092] preparing for EAV-modelling |
Date: |
Sun, 13 Nov 2011 21:03:31 +0000 |
Revision: 8092
http://svn.sv.gnu.org/viewvc/?view=rev&root=fmsystem&revision=8092
Author: sigurdne
Date: 2011-11-13 21:03:29 +0000 (Sun, 13 Nov 2011)
Log Message:
-----------
preparing for EAV-modelling
Modified Paths:
--------------
trunk/bim/setup/setup.inc.php
trunk/bim/setup/tables_current.inc.php
trunk/bim/setup/tables_update.inc.php
trunk/catch/setup/setup.inc.php
trunk/catch/setup/tables_current.inc.php
trunk/catch/setup/tables_update.inc.php
trunk/phpgwapi/inc/class.custom_fields.inc.php
trunk/property/inc/class.soadmin_entity.inc.php
trunk/property/inc/class.uiadmin_entity.inc.php
trunk/property/setup/setup.inc.php
trunk/property/setup/tables_current.inc.php
trunk/property/setup/tables_update.inc.php
trunk/property/templates/base/admin_entity.xsl
Modified: trunk/bim/setup/setup.inc.php
===================================================================
--- trunk/bim/setup/setup.inc.php 2011-11-12 12:30:55 UTC (rev 8091)
+++ trunk/bim/setup/setup.inc.php 2011-11-13 21:03:29 UTC (rev 8092)
@@ -12,7 +12,7 @@
*/
$setup_info['bim']['name'] = 'bim';
- $setup_info['bim']['version'] = '0.9.17.500';
+ $setup_info['bim']['version'] = '0.9.17.501';
$setup_info['bim']['app_order'] = 8;
$setup_info['bim']['enable'] = 1;
$setup_info['bim']['app_group'] = 'office';
Modified: trunk/bim/setup/tables_current.inc.php
===================================================================
--- trunk/bim/setup/tables_current.inc.php 2011-11-12 12:30:55 UTC (rev
8091)
+++ trunk/bim/setup/tables_current.inc.php 2011-11-13 21:03:29 UTC (rev
8092)
@@ -15,6 +15,8 @@
'fm_bim_type' => array(
'fd' => array(
'id' => array('type' => 'auto', 'precision' =>
4, 'nullable' => False),
+ 'location_id' => array('type' =>
'int','precision' => 4,'nullable' => True),
+ 'is_ifc' => array('type' => 'int','precision'
=> 2,'default' => 1,'nullable' => True),
'name' => array('type' => 'varchar',
'precision' => 64,'nullable' => False),
'description' => array('type' => 'varchar',
'precision' => 512,'nullable' => True)
),
@@ -50,10 +52,17 @@
'guid' => array('type' => 'varchar',
'precision' => 24,'nullable' => False),
'xml_representation' => array('type' =>
'xml','nullable' => False),
'model' => array('type' => 'int', 'precision'
=> 4,'nullable' => False),
+ 'p_location_id' => array('type' =>
'int','precision' => '4','nullable' => True),
+ 'p_id' => array('type' => 'int','precision' =>
'4','nullable' => True),
+ 'location_code' => array('type' =>
'varchar','precision' => '20','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),
),
'pk' => array('id'),
- 'fk' => array('fm_bim_model' => array('model' => 'id'),
- 'fm_bim_type' =>
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')),
'ix' => array(),
'uc' => array('guid')
)
Modified: trunk/bim/setup/tables_update.inc.php
===================================================================
--- trunk/bim/setup/tables_update.inc.php 2011-11-12 12:30:55 UTC (rev
8091)
+++ trunk/bim/setup/tables_update.inc.php 2011-11-13 21:03:29 UTC (rev
8092)
@@ -14,19 +14,24 @@
/**
* Update bim version from 0.9.17.500 to 0.9.17.501
*/
-
-
-/*
$test[] = '0.9.17.500';
function bim_upgrade0_9_17_500()
{
$GLOBALS['phpgw_setup']->oProc->m_odb->transaction_begin();
+
$GLOBALS['phpgw_setup']->oProc->AddColumn('fm_bim_type','location_id',array('type'
=> 'int','precision' => 4,'nullable' => True));
+
$GLOBALS['phpgw_setup']->oProc->AddColumn('fm_bim_type','is_ifc',array('type'
=> 'int','precision' => 2,'default' => 1,'nullable' => True));
-
+
$GLOBALS['phpgw_setup']->oProc->AddColumn('fm_bim_item','p_location_id',
array('type' => 'int','precision' => '4','nullable' => True));
+ $GLOBALS['phpgw_setup']->oProc->AddColumn('fm_bim_item','p_id',
array('type' => 'int','precision' => '4','nullable' => True));
+
$GLOBALS['phpgw_setup']->oProc->AddColumn('fm_bim_item','location_code',
array('type' => 'varchar','precision' => '20','nullable' => true));
+
$GLOBALS['phpgw_setup']->oProc->AddColumn('fm_bim_item','address', array('type'
=> 'varchar','precision' => '150','nullable' => True));
+
$GLOBALS['phpgw_setup']->oProc->AddColumn('fm_bim_item','entry_date',
array('type' => 'int','precision' => '4','nullable' => True));
+
$GLOBALS['phpgw_setup']->oProc->AddColumn('fm_bim_item','user_id', array('type'
=> 'int','precision' => '4','nullable' => True));
+
if($GLOBALS['phpgw_setup']->oProc->m_odb->transaction_commit())
{
$GLOBALS['setup_info']['bim']['currentver'] =
'0.9.17.501';
return $GLOBALS['setup_info']['bim']['currentver'];
}
}
-*/
+
Modified: trunk/catch/setup/setup.inc.php
===================================================================
--- trunk/catch/setup/setup.inc.php 2011-11-12 12:30:55 UTC (rev 8091)
+++ trunk/catch/setup/setup.inc.php 2011-11-13 21:03:29 UTC (rev 8092)
@@ -27,7 +27,7 @@
*/
$setup_info['catch']['name'] = 'catch';
- $setup_info['catch']['version'] = '0.9.17.511';
+ $setup_info['catch']['version'] = '0.9.17.512';
$setup_info['catch']['app_order'] = 20;
$setup_info['catch']['enable'] = 1;
$setup_info['catch']['globals_checked'] = True;
Modified: trunk/catch/setup/tables_current.inc.php
===================================================================
--- trunk/catch/setup/tables_current.inc.php 2011-11-12 12:30:55 UTC (rev
8091)
+++ trunk/catch/setup/tables_current.inc.php 2011-11-13 21:03:29 UTC (rev
8092)
@@ -56,6 +56,7 @@
'loc_link' => array('type' => 'int','precision'
=> '4','nullable' => True),
'start_project' => array('type' =>
'int','precision' => '4','nullable' => True),
'start_ticket' => array('type' =>
'int','precision' => '2','nullable' => True),
+ 'is_eav' => array('type' => 'int','precision'
=> '2','nullable' => True),
'jasperupload' => array('type' =>
'int','precision' => 2,'nullable' => True),
'parent_id' => array('type' =>
'int','precision' => '4','nullable' => True),
'level' => array('type' => 'int','precision' =>
'4','nullable' => True),
Modified: trunk/catch/setup/tables_update.inc.php
===================================================================
--- trunk/catch/setup/tables_update.inc.php 2011-11-12 12:30:55 UTC (rev
8091)
+++ trunk/catch/setup/tables_update.inc.php 2011-11-13 21:03:29 UTC (rev
8092)
@@ -344,3 +344,23 @@
return $GLOBALS['setup_info']['catch']['currentver'];
}
}
+
+ /**
+ * Update catch version from 0.9.17.511 to 0.9.17.512
+ * Add flag for eav modelling
+ */
+
+ $test[] = '0.9.17.511';
+ function catch_upgrade0_9_17_511()
+ {
+ $GLOBALS['phpgw_setup']->oProc->m_odb->transaction_begin();
+
+
$GLOBALS['phpgw_setup']->oProc->AddColumn('fm_catch_category','is_eav',array('type'
=> 'int','precision' => 2,'nullable' => True));
+
+ if($GLOBALS['phpgw_setup']->oProc->m_odb->transaction_commit())
+ {
+ $GLOBALS['setup_info']['catch']['currentver'] =
'0.9.17.512';
+ return $GLOBALS['setup_info']['catch']['currentver'];
+ }
+ }
+
Modified: trunk/phpgwapi/inc/class.custom_fields.inc.php
===================================================================
--- trunk/phpgwapi/inc/class.custom_fields.inc.php 2011-11-12 12:30:55 UTC
(rev 8091)
+++ trunk/phpgwapi/inc/class.custom_fields.inc.php 2011-11-13 21:03:29 UTC
(rev 8092)
@@ -243,12 +243,6 @@
$attrib_table =
$GLOBALS['phpgw']->locations->get_attrib_table($appname, $location);
}
- // Need a table to operate on
- if ( !$attrib_table )
- {
- return -1;
- }
-
if(isset($attrib['get_list_function_input']) &&
$attrib['get_list_function_input'])
{
$attrib['get_list_function_input'] =
$this->_validate_function_input($attrib['get_list_function_input']);
@@ -381,6 +375,21 @@
$receipt['id'] = $values['id'];
+ // if no table: assume eav-model
+ if ( !$attrib_table )
+ {
+ if ( !$this->global_lock )
+ {
+ if ( $this->_db->transaction_commit() )
+ {
+ return $values['id'];
+ }
+ }
+
+ return 0;
+ }
+
+
if ( !$values['precision_'] > 0)
{
$precision =
$this->_translate_datatype_precision($values['datatype']);
@@ -688,8 +697,6 @@
$OldPrecision = $this->_db->f('precision_');
$OldGroup = (int)
$this->_db->f('group_id');
- $table_def = $this->get_table_def($attrib_table);
-
$this->_db->transaction_begin();
if( !$doubled )
@@ -749,6 +756,17 @@
}
+ if(!$attrib_table) // Assume EAV-model
+ {
+ if ( $this->_db->transaction_commit() )
+ {
+ return true;
+ }
+
+ return false;
+ }
+
+ $table_def = $this->get_table_def($attrib_table);
$this->_oProc->m_aTables = $table_def;
if($OldColumnName !=$attrib['column_name'])
Modified: trunk/property/inc/class.soadmin_entity.inc.php
===================================================================
--- trunk/property/inc/class.soadmin_entity.inc.php 2011-11-12 12:30:55 UTC
(rev 8091)
+++ trunk/property/inc/class.soadmin_entity.inc.php 2011-11-13 21:03:29 UTC
(rev 8092)
@@ -176,14 +176,15 @@
{
$id = $this->db2->f('id');
$category = array
- (
- 'id' => $id,
- 'name' =>
$this->db2->f('name'),
- 'prefix' =>
$this->db2->f('prefix'),
- 'descr' =>
$this->db2->f('descr'),
- 'level' =>
$this->db2->f('level'),
- 'parent_id' =>
$this->db2->f('parent_id')
- );
+ (
+ 'id' => $id,
+ 'name' =>
$this->db2->f('name'),
+ 'prefix' =>
$this->db2->f('prefix'),
+ 'descr' =>
$this->db2->f('descr'),
+ 'level' =>
$this->db2->f('level'),
+ 'parent_id' =>
$this->db2->f('parent_id'),
+ 'is_eav' =>
$this->db2->f('is_eav'),
+ );
if($required)
{
@@ -440,6 +441,7 @@
'loc_link'
=> $this->db->f('loc_link'),
'start_project'
=> $this->db->f('start_project'),
'start_ticket'
=> $this->db->f('start_ticket'),
+ 'is_eav'
=> $this->db->f('is_eav'),
'jasperupload'
=> $this->db->f('jasperupload'),
'parent_id'
=> $this->db->f('parent_id'),
'level'
=> $this->db->f('level')
@@ -553,6 +555,7 @@
$values['loc_link'],
$values['start_project'],
$values['start_ticket'],
+ $values['is_eav'],
$values['jasperupload'],
$values['parent_id'],
$level
@@ -560,13 +563,34 @@
$values_insert =
$this->db->validate_insert($values_insert);
- $this->db->query("INSERT INTO {$table}
(entity_id,id,name,
descr,prefix,lookup_tenant,tracking,location_level,location_link_level,fileupload,loc_link,start_project,start_ticket,jasperupload,parent_id,level
) "
+ $this->db->query("INSERT INTO {$table}
(entity_id,id,name,
descr,prefix,lookup_tenant,tracking,location_level,location_link_level,fileupload,loc_link,start_project,start_ticket,is_eav,jasperupload,parent_id,level
) "
. "VALUES ($values_insert)",__LINE__,__FILE__);
- $location_id =
$GLOBALS['phpgw']->locations->add(".{$this->type}.{$values['entity_id']}.{$values['id']}",
$values['name'], $this->type_app[$this->type], true,
"fm_{$this->type}_{$values['entity_id']}_{$values['id']}");
$receipt['id']= $values['id'];
+ if($values['is_eav']) // if modelles as eav - we are
good
+ {
+ $location_id =
$GLOBALS['phpgw']->locations->add(".{$this->type}.{$values['entity_id']}.{$values['id']}",
$values['name'], $this->type_app[$this->type], true);
+ $values_insert = array
+ (
+ 'location_id' => $location_id,
+ 'name' =>
".{$this->type}.{$values['entity_id']}.{$values['id']}::{$values['name']}",
+ 'description' => $values['descr'],
+ 'is_ifc' => 0
+ );
+
+ $this->db->query('INSERT INTO fm_bim_type (' .
implode(',',array_keys($values_insert)) . ') VALUES (' .
$this->db->validate_insert(array_values($values_insert)) .
')',__LINE__,__FILE__);
+
+ $this->db->transaction_commit();
+
+ $receipt['message'][] = array('msg' =>
lang('%1 has been saved as an eav-model',$values['name']));
+ return $receipt;
+ }
+
+
+ // if not eav - we need a table to hold the attributes
+ $location_id =
$GLOBALS['phpgw']->locations->add(".{$this->type}.{$values['entity_id']}.{$values['id']}",
$values['name'], $this->type_app[$this->type], true,
"fm_{$this->type}_{$values['entity_id']}_{$values['id']}");
$this->init_process();
$fd = $this->get_default_column_def();
@@ -752,6 +776,7 @@
'loc_link'
=> $entity['loc_link'],
'start_project'
=> $entity['start_project'],
'start_ticket'
=> $entity['start_ticket'],
+ 'is_eav'
=> $entity['is_eav'],
'jasperupload'
=> $entity['jasperupload'],
'parent_id'
=> $entity['parent_id'],
'level'
=> $level
Modified: trunk/property/inc/class.uiadmin_entity.inc.php
===================================================================
--- trunk/property/inc/class.uiadmin_entity.inc.php 2011-11-12 12:30:55 UTC
(rev 8091)
+++ trunk/property/inc/class.uiadmin_entity.inc.php 2011-11-13 21:03:29 UTC
(rev 8092)
@@ -546,6 +546,8 @@
$uicols['descr'][4] = lang('Prefix');
$uicols['name'][5] = 'entity_id';
$uicols['descr'][5] = lang('id');
+ $uicols['name'][5] = 'is_eav';
+ $uicols['descr'][5] = lang('is_eav');
$j = 0;
$count_uicols_name = count($uicols['name']);
@@ -1176,6 +1178,7 @@
'value_start_project'
=> $values['start_project'],
'start_ticket'
=> true,
'value_start_ticket'
=> $values['start_ticket'],
+ 'value_is_eav'
=> $values['is_eav'],
'jasperupload'
=> true,
'category_list'
=> $category_list,
'parent_list'
=> $parent_list
Modified: trunk/property/setup/setup.inc.php
===================================================================
--- trunk/property/setup/setup.inc.php 2011-11-12 12:30:55 UTC (rev 8091)
+++ trunk/property/setup/setup.inc.php 2011-11-13 21:03:29 UTC (rev 8092)
@@ -12,7 +12,7 @@
*/
$setup_info['property']['name'] = 'property';
- $setup_info['property']['version'] = '0.9.17.624';
+ $setup_info['property']['version'] = '0.9.17.625';
$setup_info['property']['app_order'] = 8;
$setup_info['property']['enable'] = 1;
$setup_info['property']['app_group'] = 'office';
Modified: trunk/property/setup/tables_current.inc.php
===================================================================
--- trunk/property/setup/tables_current.inc.php 2011-11-12 12:30:55 UTC (rev
8091)
+++ trunk/property/setup/tables_current.inc.php 2011-11-13 21:03:29 UTC (rev
8092)
@@ -1608,6 +1608,7 @@
'loc_link' => array('type' => 'int','precision'
=> '4','nullable' => True),
'start_project' => array('type' =>
'int','precision' => '4','nullable' => True),
'start_ticket' => array('type' =>
'int','precision' => '2','nullable' => True),
+ 'is_eav' => array('type' => 'int','precision'
=> '2','nullable' => True),
'jasperupload' => array('type' =>
'int','precision' => '2','nullable' => True),
'parent_id' => array('type' =>
'int','precision' => '4','nullable' => True),
'level' => array('type' => 'int','precision' =>
'4','nullable' => True)
Modified: trunk/property/setup/tables_update.inc.php
===================================================================
--- trunk/property/setup/tables_update.inc.php 2011-11-12 12:30:55 UTC (rev
8091)
+++ trunk/property/setup/tables_update.inc.php 2011-11-13 21:03:29 UTC (rev
8092)
@@ -5457,6 +5457,26 @@
/**
+ * Update property version from 0.9.17.624 to 0.9.17.625
+ * Add flag for eav modelling
+ */
+
+ $test[] = '0.9.17.624';
+ function property_upgrade0_9_17_624()
+ {
+ $GLOBALS['phpgw_setup']->oProc->m_odb->transaction_begin();
+
+
$GLOBALS['phpgw_setup']->oProc->AddColumn('fm_entity_category','is_eav',array('type'
=> 'int','precision' => 2,'nullable' => True));
+
+ if($GLOBALS['phpgw_setup']->oProc->m_odb->transaction_commit())
+ {
+ $GLOBALS['setup_info']['property']['currentver'] =
'0.9.17.625';
+ return $GLOBALS['setup_info']['property']['currentver'];
+ }
+ }
+
+
+ /**
* Update property version from 0.9.17.607 to 0.9.17.608
* Add more room for address at tickets
*
Modified: trunk/property/templates/base/admin_entity.xsl
===================================================================
--- trunk/property/templates/base/admin_entity.xsl 2011-11-12 12:30:55 UTC
(rev 8091)
+++ trunk/property/templates/base/admin_entity.xsl 2011-11-13 21:03:29 UTC
(rev 8092)
@@ -681,6 +681,23 @@
</input>
</td>
</tr>
+ <tr>
+ <td>
+
<xsl:value-of select="php:function('lang', 'is eav')"/>
+ </td>
+ <td>
+ <input
type="checkbox" name="values[is_eav]" value="1">
+
<xsl:attribute name="title">
+
<xsl:value-of select="php:function('lang', 'This category is modelled
in the database as a xml adapted entity attribute value model')"/>
+
</xsl:attribute>
+
<xsl:if test="value_is_eav = '1'">
+
<xsl:attribute name="checked">
+
<xsl:text>checked</xsl:text>
+
</xsl:attribute>
+
</xsl:if>
+ </input>
+ </td>
+ </tr>
</xsl:when>
</xsl:choose>
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Fmsystem-commits] [8092] preparing for EAV-modelling,
Sigurd Nes <=