[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Fmsystem-commits] [11890] property and catch: more on department
From: |
Sigurd Nes |
Subject: |
[Fmsystem-commits] [11890] property and catch: more on department |
Date: |
Mon, 07 Apr 2014 11:45:42 +0000 |
Revision: 11890
http://svn.sv.gnu.org/viewvc/?view=rev&root=fmsystem&revision=11890
Author: sigurdne
Date: 2014-04-07 11:45:41 +0000 (Mon, 07 Apr 2014)
Log Message:
-----------
property and catch: more on department
Modified Paths:
--------------
trunk/catch/setup/setup.inc.php
trunk/catch/setup/tables_update.inc.php
trunk/property/inc/class.boentity.inc.php
trunk/property/inc/class.bogeneric.inc.php
trunk/property/inc/class.soadmin_entity.inc.php
trunk/property/inc/class.soentity.inc.php
trunk/property/inc/class.uientity.inc.php
trunk/property/setup/setup.inc.php
trunk/property/setup/tables_update.inc.php
trunk/property/templates/base/entity.xsl
Modified: trunk/catch/setup/setup.inc.php
===================================================================
--- trunk/catch/setup/setup.inc.php 2014-04-06 19:14:12 UTC (rev 11889)
+++ trunk/catch/setup/setup.inc.php 2014-04-07 11:45:41 UTC (rev 11890)
@@ -27,7 +27,7 @@
*/
$setup_info['catch']['name'] = 'catch';
- $setup_info['catch']['version'] = '0.9.17.516';
+ $setup_info['catch']['version'] = '0.9.17.517';
$setup_info['catch']['app_order'] = 20;
$setup_info['catch']['enable'] = 1;
$setup_info['catch']['globals_checked'] = True;
Modified: trunk/catch/setup/tables_update.inc.php
===================================================================
--- trunk/catch/setup/tables_update.inc.php 2014-04-06 19:14:12 UTC (rev
11889)
+++ trunk/catch/setup/tables_update.inc.php 2014-04-07 11:45:41 UTC (rev
11890)
@@ -502,3 +502,47 @@
}
}
+
+ /**
+ * Update catch version from 0.9.17.516 to 0.9.17.517
+ * Add department_id to catch tables
+ */
+ $test[] = '0.9.17.516';
+ function catch_upgrade0_9_17_516()
+ {
+ $GLOBALS['phpgw_setup']->oProc->m_odb->transaction_begin();
+
+ $GLOBALS['phpgw_setup']->oProc->query("SELECT * FROM
fm_catch_category");
+
+ $categories = array();
+ while ($GLOBALS['phpgw_setup']->oProc->next_record())
+ {
+ $categories[] = array
+ (
+ 'entity_id' =>
$GLOBALS['phpgw_setup']->oProc->f('entity_id'),
+ 'cat_id' =>
$GLOBALS['phpgw_setup']->oProc->f('id')
+ );
+ }
+
+ $tables = $GLOBALS['phpgw_setup']->oProc->m_odb->table_names();
+
+ foreach ($categories as $category)
+ {
+ $table =
"fm_catch_{$category['entity_id']}_{$category['cat_id']}";
+ if(in_array($table, $tables))
+ {
+ $metadata =
$GLOBALS['phpgw_setup']->oProc->m_odb->metadata($table);
+ if(!isset($metadata['department_id']))
+ {
+
$GLOBALS['phpgw_setup']->oProc->AddColumn($table,'department_id',array('type'
=> 'int','precision' => 4,'nullable' => True));
+ }
+ }
+ }
+
+ if($GLOBALS['phpgw_setup']->oProc->m_odb->transaction_commit())
+ {
+ $GLOBALS['setup_info']['catch']['currentver'] =
'0.9.17.517';
+ return $GLOBALS['setup_info']['catch']['currentver'];
+ }
+ }
+
Modified: trunk/property/inc/class.boentity.inc.php
===================================================================
--- trunk/property/inc/class.boentity.inc.php 2014-04-06 19:14:12 UTC (rev
11889)
+++ trunk/property/inc/class.boentity.inc.php 2014-04-07 11:45:41 UTC (rev
11890)
@@ -493,7 +493,22 @@
}
$values = $this->custom->prepare($values,
$this->type_app[$this->type],".{$this->type}.{$data['entity_id']}.{$data['cat_id']}",
$data['view']);
- // $soadmin_entity =
CreateObject('property.soadmin_entity');
+ if($values['department_id'])
+ {
+ $bogeneric =
CreateObject('property.sogeneric');
+ $bogeneric->get_location_info('department');
+ $department =
$bogeneric->read_single(array('id' => $values['department_id']));
+ $values['department_name'] =
$department['name'];
+ $values['department_name_path'] =
$department['name'];
+ if($department['parent_id'])
+ {
+ $path =
$bogeneric->get_path(array('type' => 'department', 'id' =>
$department['parent_id']));
+ if($path)
+ {
+ $values['department_name_path']
.= '::' . implode(' > ', $path);
+ }
+ }
+ }
if($values['location_code'])
{
Modified: trunk/property/inc/class.bogeneric.inc.php
===================================================================
--- trunk/property/inc/class.bogeneric.inc.php 2014-04-06 19:14:12 UTC (rev
11889)
+++ trunk/property/inc/class.bogeneric.inc.php 2014-04-07 11:45:41 UTC (rev
11890)
@@ -166,7 +166,6 @@
}
}
}
-
}
$this->total_records = $this->so->total_records;
Modified: trunk/property/inc/class.soadmin_entity.inc.php
===================================================================
--- trunk/property/inc/class.soadmin_entity.inc.php 2014-04-06 19:14:12 UTC
(rev 11889)
+++ trunk/property/inc/class.soadmin_entity.inc.php 2014-04-07 11:45:41 UTC
(rev 11890)
@@ -580,7 +580,7 @@
$fd['entry_date'] = array('type' => 'int', 'precision'
=> 4, 'nullable' => true);
$fd['user_id'] = array('type' => 'int', 'precision' =>
4, 'nullable' => true);
-
+ $fd['department_id'] = array('type' => 'int',
'precision' => 4, 'nullable' => true);
return $fd;
}
Modified: trunk/property/inc/class.soentity.inc.php
===================================================================
--- trunk/property/inc/class.soentity.inc.php 2014-04-06 19:14:12 UTC (rev
11889)
+++ trunk/property/inc/class.soentity.inc.php 2014-04-07 11:45:41 UTC (rev
11890)
@@ -308,7 +308,7 @@
$querymethod = " $where (" . implode(' AND
',$_querymethod) . ')';
unset($_querymethod);
}
- $sql = "SELECT id, location_code, p_location_id, p_id,
xml_representation FROM fm_bim_item WHERE location_id = {$location_id}
$querymethod";
+ $sql = "SELECT id, location_code, p_location_id, p_id,
department_id, xml_representation FROM fm_bim_item WHERE location_id =
{$location_id} $querymethod";
$sql_cnt = "SELECT count(id) as cnt FROM fm_bim_item
WHERE location_id = {$location_id} $querymethod";
@@ -375,6 +375,7 @@
'datatype' => false,
'attrib_id' => false,
);
+
$dataset[$j]['p_location_id'] = array
(
'value' =>
$this->db->f('p_location_id'),
@@ -389,6 +390,12 @@
'attrib_id' => false,
);
+ $dataset[$j]['department_id'] = array
+ (
+ 'value' =>
$this->db->f('department_id'),
+ 'datatype' => false,
+ 'attrib_id' => false,
+ );
$j++;
}
@@ -1601,6 +1608,7 @@
$values['status'] =
$this->db->f('status');
$values['user_id'] =
$this->db->f('user_id');
$values['entry_date'] =
$this->db->f('entry_date');
+ $values['department_id'] =
$this->db->f('department_id');
if ( isset($values['attributes']) &&
is_array($values['attributes']) )
{
@@ -1651,6 +1659,7 @@
$values['location_code'] =
$this->db->f('location_code');
$values['user_id'] =
$this->db->f('user_id');
$values['entry_date'] =
$this->db->f('entry_date');
+ $values['department_id'] =
$this->db->f('department_id');
$xmldata =
$this->db->f('xml_representation',true);
$xml = new DOMDocument('1.0', 'utf-8');
@@ -2053,6 +2062,7 @@
'location_code' =>
$data['location_code'],
'loc1' =>
$data['loc1'],
'address' =>
$data['address'],
+ 'department_id' =>
$data['department_id']
);
$value_set =
$this->db->validate_update($value_set);
Modified: trunk/property/inc/class.uientity.inc.php
===================================================================
--- trunk/property/inc/class.uientity.inc.php 2014-04-06 19:14:12 UTC (rev
11889)
+++ trunk/property/inc/class.uientity.inc.php 2014-04-07 11:45:41 UTC (rev
11890)
@@ -1526,6 +1526,10 @@
if ((isset($values['save']) && $values['save']) ||
(isset($values['apply']) && $values['apply']))
{
+ if($category['department'])
+ {
+ $values['extra']['department_id'] =
phpgw::get_var('department_id', 'int');
+ }
if($GLOBALS['phpgw']->session->is_repost())
{
$receipt['error'][]=array('msg'=>lang('Hmm... looks like a repost!'));
@@ -2402,6 +2406,9 @@
'myColumnDefs'
=> $myColumnDefs,
'enable_bulk'
=> $category['enable_bulk'],
'department'
=> $category['department'],
+ 'value_department_id'
=> $values['department_id'],
+ 'value_department_name'
=> $values['department_name'],
+ 'value_department_name_path' =>
$values['department_name_path'],
'value_location_id'
=> $GLOBALS['phpgw']->locations->get_id($this->type_app[$this->type],
$this->acl_location),
'link_pdf'
=> $GLOBALS['phpgw']->link('/index.php',$pdf_data),
'start_project'
=> $category['start_project'],
Modified: trunk/property/setup/setup.inc.php
===================================================================
--- trunk/property/setup/setup.inc.php 2014-04-06 19:14:12 UTC (rev 11889)
+++ trunk/property/setup/setup.inc.php 2014-04-07 11:45:41 UTC (rev 11890)
@@ -12,7 +12,7 @@
*/
$setup_info['property']['name'] = 'property';
- $setup_info['property']['version'] = '0.9.17.679';
+ $setup_info['property']['version'] = '0.9.17.680';
$setup_info['property']['app_order'] = 8;
$setup_info['property']['enable'] = 1;
$setup_info['property']['app_group'] = 'office';
Modified: trunk/property/setup/tables_update.inc.php
===================================================================
--- trunk/property/setup/tables_update.inc.php 2014-04-06 19:14:12 UTC (rev
11889)
+++ trunk/property/setup/tables_update.inc.php 2014-04-07 11:45:41 UTC (rev
11890)
@@ -7937,3 +7937,49 @@
return $GLOBALS['setup_info']['property']['currentver'];
}
}
+
+ /**
+ * Update property version from 0.9.17.670 to 0.9.17.671
+ * Add department_id to entity tables
+ */
+ $test[] = '0.9.17.679';
+ function property_upgrade0_9_17_679()
+ {
+ $GLOBALS['phpgw_setup']->oProc->m_odb->transaction_begin();
+
+ $GLOBALS['phpgw_setup']->oProc->query("DELETE FROM fm_cache");
+
+ $GLOBALS['phpgw_setup']->oProc->query("SELECT * FROM
fm_entity_category");
+
+ $categories = array();
+ while ($GLOBALS['phpgw_setup']->oProc->next_record())
+ {
+ $categories[] = array
+ (
+ 'entity_id' =>
$GLOBALS['phpgw_setup']->oProc->f('entity_id'),
+ 'cat_id' =>
$GLOBALS['phpgw_setup']->oProc->f('id')
+ );
+ }
+
+ $tables = $GLOBALS['phpgw_setup']->oProc->m_odb->table_names();
+
+ foreach ($categories as $category)
+ {
+ $table =
"fm_entity_{$category['entity_id']}_{$category['cat_id']}";
+ if(in_array($table, $tables))
+ {
+ $metadata =
$GLOBALS['phpgw_setup']->oProc->m_odb->metadata($table);
+ if(!isset($metadata['department_id']))
+ {
+
$GLOBALS['phpgw_setup']->oProc->AddColumn($table,'department_id',array('type'
=> 'int','precision' => 4,'nullable' => True));
+ }
+ }
+ }
+
+ if($GLOBALS['phpgw_setup']->oProc->m_odb->transaction_commit())
+ {
+ $GLOBALS['setup_info']['property']['currentver'] =
'0.9.17.680';
+ return $GLOBALS['setup_info']['property']['currentver'];
+ }
+ }
+
Modified: trunk/property/templates/base/entity.xsl
===================================================================
--- trunk/property/templates/base/entity.xsl 2014-04-06 19:14:12 UTC (rev
11889)
+++ trunk/property/templates/base/entity.xsl 2014-04-07 11:45:41 UTC (rev
11890)
@@ -593,9 +593,9 @@
</td>
<td>
<div class="autocomplete">
-
<input id="department_id"
name="department_id" type="hidden" value="department_id">
+
<input id="department_id"
name="department_id" type="hidden" value="{value_department_id}">
</input>
-
<input id="department_name"
name="department_name" type="text" value="{department_name}" size='60'>
+
<input id="department_name"
name="department_name" type="text" value="{value_department_name}"
title="{value_department_name_path}" size='60'>
<xsl:choose>
<xsl:when
test="disabled!=''">
<xsl:attribute name="disabled">
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Fmsystem-commits] [11890] property and catch: more on department,
Sigurd Nes <=