[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Fmsystem-commits] [15482] property: common budget account at project-le
From: |
sigurdne |
Subject: |
[Fmsystem-commits] [15482] property: common budget account at project-level |
Date: |
Wed, 17 Aug 2016 14:05:06 +0000 (UTC) |
Revision: 15482
http://svn.sv.gnu.org/viewvc/?view=rev&root=fmsystem&revision=15482
Author: sigurdne
Date: 2016-08-17 14:05:05 +0000 (Wed, 17 Aug 2016)
Log Message:
-----------
property: common budget account at project-level
Modified Paths:
--------------
trunk/property/inc/class.bocommon.inc.php
trunk/property/inc/class.soproject.inc.php
trunk/property/inc/class.uiproject.inc.php
trunk/property/inc/class.uiworkorder.inc.php
trunk/property/js/portico/project.edit.js
trunk/property/setup/phpgw_no.lang
trunk/property/setup/setup.inc.php
trunk/property/setup/tables_current.inc.php
trunk/property/setup/tables_update.inc.php
trunk/property/templates/base/config.tpl
trunk/property/templates/base/project.xsl
Modified: trunk/property/inc/class.bocommon.inc.php
===================================================================
--- trunk/property/inc/class.bocommon.inc.php 2016-08-17 11:19:34 UTC (rev
15481)
+++ trunk/property/inc/class.bocommon.inc.php 2016-08-17 14:05:05 UTC (rev
15482)
@@ -2507,13 +2507,28 @@
public function get_b_account()
{
$query = phpgw::get_var('query');
+ $role = phpgw::get_var('role');
- $sogeneric = CreateObject('property.sogeneric',
'budget_account');
+ $type = 'budget_account';
+
+ if($role == 'group')
+ {
+ $type = 'b_account_category';
+ }
+
+ $sogeneric = CreateObject('property.sogeneric', $type);
$values = $sogeneric->read(array('query' => $query));
foreach ($values as &$value)
{
- $value['name'] = "{$value['id']}
{$value['descr']}";
+ if (!preg_match("/^{$value['id']}/",
$value['descr']))
+ {
+ $value['name'] = "{$value['id']}
{$value['descr']}";
+ }
+ else
+ {
+ $value['name'] = $value['descr'];
+ }
}
return array('ResultSet' => array('Result' => $values));
Modified: trunk/property/inc/class.soproject.inc.php
===================================================================
--- trunk/property/inc/class.soproject.inc.php 2016-08-17 11:19:34 UTC (rev
15481)
+++ trunk/property/inc/class.soproject.inc.php 2016-08-17 14:05:05 UTC (rev
15482)
@@ -907,7 +907,8 @@
'contact_phone' =>
$this->db->f('contact_phone'),
'external_project_id' =>
$this->db->f('external_project_id'),
'ecodimb' => $this->db->f('ecodimb'),
- 'b_account_id' =>
$this->db->f('account_group'),
+ 'b_account_group' =>
$this->db->f('account_group'),
+ 'b_account_id' =>
$this->db->f('b_account_id'),
'contact_id' =>
$this->db->f('contact_id'),
'inherit_location' =>
$this->db->f('inherit_location'),
'periodization_id' =>
$this->db->f('periodization_id')
@@ -1237,6 +1238,7 @@
$project['key_responsible'],
$this->account,
$project['ecodimb'],
+ $project['b_account_group'],
$project['b_account_id'],
$project['contact_id'],
$project['inherit_location'],
@@ -1246,7 +1248,7 @@
$values = $this->db->validate_insert($values);
$this->db->query("INSERT INTO fm_project
(id,project_type_id,external_project_id,name,access,category,entry_date,start_date,end_date,coordinator,status,"
- .
"descr,budget,reserve,location_code,address,key_deliver,key_fetch,other_branch,key_responsible,user_id,ecodimb,account_group,contact_id,inherit_location,periodization_id
$cols) "
+ .
"descr,budget,reserve,location_code,address,key_deliver,key_fetch,other_branch,key_responsible,user_id,ecodimb,account_group,b_account_id,contact_id,inherit_location,periodization_id
$cols) "
. "VALUES ($values $vals )", __LINE__,
__FILE__);
/**
@@ -1424,7 +1426,8 @@
'location_code' => $project['location_code'],
'address' => $address,
'ecodimb' => $project['ecodimb'],
- 'account_group' => $project['b_account_id'],
+ 'account_group' => $project['b_account_group'],
+ 'b_account_id' => $project['b_account_id'],
'contact_id' => $project['contact_id'],
'inherit_location' =>
$project['inherit_location'],
);
Modified: trunk/property/inc/class.uiproject.inc.php
===================================================================
--- trunk/property/inc/class.uiproject.inc.php 2016-08-17 11:19:34 UTC (rev
15481)
+++ trunk/property/inc/class.uiproject.inc.php 2016-08-17 14:05:05 UTC (rev
15482)
@@ -734,8 +734,6 @@
$values_attribute = phpgw::get_var('values_attribute');
// $values['external_project_id'] =
phpgw::get_var('external_project_id');
// $values['ecodimb'] = phpgw::get_var('ecodimb');
- $values['b_account_id'] =
phpgw::get_var('b_account_id', 'int', 'POST');
- $values['b_account_name'] =
phpgw::get_var('b_account_name', 'string', 'POST');
$values['contact_id'] = phpgw::get_var('contact',
'int', 'POST');
$config = CreateObject('phpgwapi.config', 'property');
@@ -788,14 +786,22 @@
if (isset($values['b_account_id']) &&
$values['b_account_id'])
{
$sogeneric = CreateObject('property.sogeneric');
-
$sogeneric->get_location_info('b_account_category', false);
+ $sogeneric->get_location_info('budget_account',
false);
$status_data =
$sogeneric->read_single(array('id' => (int)$values['b_account_id']), array());
+ $values['b_account_group'] =
$status_data['category'];
+ }
+ if (isset($values['b_account_group']) &&
$values['b_account_group'])
+ {
+ $sogeneric = CreateObject('property.sogeneric');
+
$sogeneric->get_location_info('b_account_category', false);
+ $status_data =
$sogeneric->read_single(array('id' => (int)$values['b_account_group']),
array());
+
if (isset($status_data['external_project']) &&
$status_data['external_project'])//mandatory for this account group
{
if
(!isset($values['external_project_id']) || !$values['external_project_id'])
{
- $this->receipt['error'][] =
array('msg' => lang('Please select a project group!'));
+ $this->receipt['error'][] =
array('msg' => lang('Please select an external project!'));
$error_id = true;
}
}
@@ -1381,21 +1387,41 @@
$b_account_data = array();
$ecodimb_data = array();
-
if (isset($config->config_data['budget_at_project']) &&
$config->config_data['budget_at_project'])
{
- $b_account_data =
$this->bocommon->initiate_ui_budget_account_lookup(array
+ $b_account_group_data =
$this->bocommon->initiate_ui_budget_account_lookup(array
(
- 'b_account_id' =>
$values['b_account_id'],
- 'b_account_name' =>
$values['b_account_name'],
+ 'b_account_id' =>
$values['b_account_group'],
+ 'b_account_name' =>
$values['b_account_group_name'],
'role' => 'group',
'type' => $lookup_type
)
);
+
+ $b_account_data = array();
+
+ if
(isset($config->config_data['budget_account_at_project']) &&
$config->config_data['budget_account_at_project'])
+ {
+ $b_account_data =
$this->bocommon->initiate_ui_budget_account_lookup(array
+ (
+ 'b_account_id' =>
$values['b_account_id'],
+ 'b_account_name' =>
$values['b_account_name'],
+ 'type' => $lookup_type
+ )
+ );
+ }
+
+ $default_ecodimb =
(isset($GLOBALS['phpgw_info']['user']['preferences']['property']['dimb']) ?
$GLOBALS['phpgw_info']['user']['preferences']['property']['dimb'] : '');
+ if(isset($values['ecodimb']) &&
$values['ecodimb'] && $values['ecodimb'] != $default_ecodimb)
+ {
+
$GLOBALS['phpgw']->preferences->add('property', 'dimb', $values['ecodimb'],
'user');
+
$GLOBALS['phpgw']->preferences->save_repository();
+ }
+
$ecodimb_data =
$this->bocommon->initiate_ecodimb_lookup(array
(
- 'ecodimb' => $values['ecodimb'],
+ 'ecodimb' => $values['ecodimb'] ?
$values['ecodimb'] : $default_ecodimb,
'ecodimb_descr' =>
$values['ecodimb_descr'],
'disabled' => $mode == 'view'
));
@@ -1993,7 +2019,8 @@
'suppresscoordination' => $suppresscoordination,
'custom_attributes' => array('attributes' =>
$values['attributes']),
'lookup_functions' =>
isset($values['lookup_functions']) ? $values['lookup_functions'] : '',
- 'b_account_data' => $b_account_data,
+ 'b_account_group_data' => $b_account_group_data,
+ 'b_account_data' =>
$b_account_data,
'ecodimb_data' => $ecodimb_data,
'contact_data' => $contact_data,
'tabs' => self::_generate_tabs($tabs,
$active_tab, array('documents' => $id ? false : true,
Modified: trunk/property/inc/class.uiworkorder.inc.php
===================================================================
--- trunk/property/inc/class.uiworkorder.inc.php 2016-08-17 11:19:34 UTC
(rev 15481)
+++ trunk/property/inc/class.uiworkorder.inc.php 2016-08-17 14:05:05 UTC
(rev 15482)
@@ -1431,15 +1431,15 @@
$b_group_data =
$this->bocommon->initiate_ui_budget_account_lookup(array(
- 'b_account_id' => $project['b_account_id'],
+ 'b_account_id' => $project['b_account_group'],
'role' => 'group',
'type' => $mode));
$b_account_data =
$this->bocommon->initiate_ui_budget_account_lookup(array(
- 'b_account_id' => $values['b_account_id'],
+ 'b_account_id' => $project['b_account_id'] ?
$project['b_account_id'] : $values['b_account_id'],
'b_account_name' => $values['b_account_name'],
'disabled' => '',
- 'parent' => $project['b_account_id'],
+ 'parent' => $project['b_account_group'],
'type' => $mode,
'required' => true
));
Modified: trunk/property/js/portico/project.edit.js
===================================================================
--- trunk/property/js/portico/project.edit.js 2016-08-17 11:19:34 UTC (rev
15481)
+++ trunk/property/js/portico/project.edit.js 2016-08-17 14:05:05 UTC (rev
15482)
@@ -449,6 +449,15 @@
var strURL = phpGWLink('index.php', oArgs, true);
JqueryPortico.autocompleteHelper(strURL, 'external_project_name',
'external_project_id', 'external_project_container');
-var oArgs = {menuaction: 'property.uiproject.get_ecodimb'};
-var strURL = phpGWLink('index.php', oArgs, true);
+oArgs = {menuaction: 'property.uiproject.get_ecodimb'};
+strURL = phpGWLink('index.php', oArgs, true);
JqueryPortico.autocompleteHelper(strURL, 'ecodimb_name', 'ecodimb',
'ecodimb_container');
+
+oArgs = {menuaction: 'property.uiworkorder.get_b_account', role: 'group'};
+strURL = phpGWLink('index.php', oArgs, true);
+JqueryPortico.autocompleteHelper(strURL, 'b_account_group_name',
'b_account_group', 'b_account_group_container');
+
+oArgs = {menuaction: 'property.uiworkorder.get_b_account'};
+strURL = phpGWLink('index.php', oArgs, true);
+JqueryPortico.autocompleteHelper(strURL, 'b_account_name', 'b_account_id',
'b_account_container');
+
Modified: trunk/property/setup/phpgw_no.lang
===================================================================
--- trunk/property/setup/phpgw_no.lang 2016-08-17 11:19:34 UTC (rev 15481)
+++ trunk/property/setup/phpgw_no.lang 2016-08-17 14:05:05 UTC (rev 15482)
@@ -2061,4 +2061,5 @@
order received property no Varemottak
receive order property no Motta vare
check date type property no Dato filter type
-no date property no Ingen dato
\ No newline at end of file
+no date property no Ingen dato
+Please select an external project! property no Velg et
tilnyttet eksternt prosjekt
\ No newline at end of file
Modified: trunk/property/setup/setup.inc.php
===================================================================
--- trunk/property/setup/setup.inc.php 2016-08-17 11:19:34 UTC (rev 15481)
+++ trunk/property/setup/setup.inc.php 2016-08-17 14:05:05 UTC (rev 15482)
@@ -11,7 +11,7 @@
* @version $Id$
*/
$setup_info['property']['name'] = 'property';
- $setup_info['property']['version'] = '0.9.17.703';
+ $setup_info['property']['version'] = '0.9.17.704';
$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 2016-08-17 11:19:34 UTC (rev
15481)
+++ trunk/property/setup/tables_current.inc.php 2016-08-17 14:05:05 UTC (rev
15482)
@@ -1748,6 +1748,7 @@
'ecodimb' => array('type' => 'int', 'precision'
=> 4, 'nullable' => True),
'contact_id' => array('type' => 'int',
'precision' => 4, 'nullable' => True),
'account_group' => array('type' => 'int',
'precision' => 4, 'nullable' => True),
+ 'b_account_id' => array('type' => 'varchar',
'precision' => '20', 'nullable' => True),
'inherit_location' => array('type' => 'int',
'precision' => 2, 'nullable' => True,
'default' => 1),
'periodization_id' => array('type' => 'int',
'precision' => 4, 'nullable' => true)
Modified: trunk/property/setup/tables_update.inc.php
===================================================================
--- trunk/property/setup/tables_update.inc.php 2016-08-17 11:19:34 UTC (rev
15481)
+++ trunk/property/setup/tables_update.inc.php 2016-08-17 14:05:05 UTC (rev
15482)
@@ -9230,3 +9230,27 @@
return $GLOBALS['setup_info']['property']['currentver'];
}
}
+
+ /**
+ * Update property version from 0.9.17.703 to 0.9.17.704
+ *
+ */
+ $test[] = '0.9.17.703';
+
+ function property_upgrade0_9_17_703()
+ {
+ $GLOBALS['phpgw_setup']->oProc->m_odb->transaction_begin();
+
+ $GLOBALS['phpgw_setup']->oProc->AddColumn("fm_project",
'b_account_id', array(
+ 'type' => 'varchar',
+ 'precision' => 20,
+ 'nullable' => True
+ )
+ );
+
+ if($GLOBALS['phpgw_setup']->oProc->m_odb->transaction_commit())
+ {
+ $GLOBALS['setup_info']['property']['currentver'] =
'0.9.17.704';
+ return $GLOBALS['setup_info']['property']['currentver'];
+ }
+ }
Modified: trunk/property/templates/base/config.tpl
===================================================================
--- trunk/property/templates/base/config.tpl 2016-08-17 11:19:34 UTC (rev
15481)
+++ trunk/property/templates/base/config.tpl 2016-08-17 14:05:05 UTC (rev
15482)
@@ -577,6 +577,15 @@
</select>
</td>
</tr>
+ <tr class="pure-table-odd">
+ <td>{lang_common_budget_account_at_project_level}.</td>
+ <td>
+ <select
name="newsettings[budget_account_at_project]">
+ <option value=""
{selected_budget_account_at_project_}>NO</option>
+ <option value="1"
{selected_budget_account_at_project_1}>YES</option>
+ </select>
+ </td>
+ </tr>
<tr>
<td>{lang_update_project_budget_from_order}.</td>
<td>
Modified: trunk/property/templates/base/project.xsl
===================================================================
--- trunk/property/templates/base/project.xsl 2016-08-17 11:19:34 UTC (rev
15481)
+++ trunk/property/templates/base/project.xsl 2016-08-17 14:05:05 UTC (rev
15482)
@@ -376,8 +376,67 @@
</input>
<div id="ecodimb_container"/>
</div>
+ <xsl:if test="b_account_data =''">
+ <div class="pure-control-group">
+ <xsl:variable
name="lang_budget_account">
+ <xsl:value-of
select="php:function('lang', 'budget account group')"/>
+ </xsl:variable>
+ <label>
+ <xsl:value-of
select="$lang_budget_account"/>
+ </label>
+ <input type="hidden"
id="b_account_group" name="values[b_account_group]"
value="{b_account_group_data/value_b_account_id}"/>
+ <input type="text"
id="b_account_group_name" name="values[b_account_group_name]"
value="{b_account_group_data/value_b_account_name}">
+ <xsl:choose>
+ <xsl:when
test="mode='edit'">
+ <xsl:attribute
name="data-validation">
+
<xsl:text>required</xsl:text>
+ </xsl:attribute>
+ <xsl:attribute
name="data-validation-error-msg">
+
<xsl:value-of select="$lang_budget_account"/>
+ </xsl:attribute>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:attribute
name="disabled">
+
<xsl:text>disabled</xsl:text>
+ </xsl:attribute>
+ </xsl:otherwise>
+ </xsl:choose>
+ </input>
+ <div id="b_account_group_container"/>
+ </div>
+ </xsl:if>
- <xsl:choose>
+ <xsl:if test="b_account_data !=''">
+ <div class="pure-control-group">
+ <xsl:variable
name="lang_budget_account">
+ <xsl:value-of
select="php:function('lang', 'budget account')"/>
+ </xsl:variable>
+ <label>
+ <xsl:value-of
select="$lang_budget_account"/>
+ </label>
+ <input type="hidden"
id="b_account_id" name="values[b_account_id]"
value="{b_account_data/value_b_account_id}"/>
+ <input type="text"
id="b_account_name" name="values[b_account_name]"
value="{b_account_data/value_b_account_name}">
+ <xsl:choose>
+ <xsl:when
test="mode='edit'">
+
<xsl:attribute name="data-validation">
+
<xsl:text>required</xsl:text>
+
</xsl:attribute>
+
<xsl:attribute name="data-validation-error-msg">
+
<xsl:value-of select="$lang_budget_account"/>
+
</xsl:attribute>
+ </xsl:when>
+ <xsl:otherwise>
+
<xsl:attribute name="disabled">
+
<xsl:text>disabled</xsl:text>
+
</xsl:attribute>
+ </xsl:otherwise>
+ </xsl:choose>
+ </input>
+ <div id="b_account_container"/>
+ </div>
+ </xsl:if>
+
+ <!--xsl:choose>
<xsl:when test="b_account_data!=''">
<xsl:choose>
<xsl:when
test="mode='edit'">
@@ -388,7 +447,7 @@
</xsl:otherwise>
</xsl:choose>
</xsl:when>
- </xsl:choose>
+ </xsl:choose-->
<xsl:if test="value_project_id > 0 and
mode='edit'">
<div class="pure-control-group">
<label for="name">
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Fmsystem-commits] [15482] property: common budget account at project-level,
sigurdne <=