[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Fmsystem-commits] [16071] more on integration
From: |
sigurdne |
Subject: |
[Fmsystem-commits] [16071] more on integration |
Date: |
Mon, 12 Dec 2016 10:21:33 +0000 (UTC) |
Revision: 16071
http://svn.sv.gnu.org/viewvc/?view=rev&root=fmsystem&revision=16071
Author: sigurdne
Date: 2016-12-12 10:21:33 +0000 (Mon, 12 Dec 2016)
Log Message:
-----------
more on integration
Modified Paths:
--------------
trunk/property/inc/class.botts.inc.php
trunk/property/inc/class.boworkorder.inc.php
trunk/property/inc/class.soproject.inc.php
trunk/property/inc/class.uiworkorder.inc.php
trunk/property/js/portico/workorder.edit.js
trunk/property/templates/base/workorder.xsl
Modified: trunk/property/inc/class.botts.inc.php
===================================================================
--- trunk/property/inc/class.botts.inc.php 2016-12-11 20:32:51 UTC (rev
16070)
+++ trunk/property/inc/class.botts.inc.php 2016-12-12 10:21:33 UTC (rev
16071)
@@ -1798,9 +1798,9 @@
$config = CreateObject('admin.soconfig',
$GLOBALS['phpgw']->locations->get_id('property', '.ticket'));
$check_external_register=
!!$config->config_data['external_register']['check_external_register'];
$supervisors = array();
- $invoice = CreateObject('property.soinvoice');
if (isset($this->config->config_data['invoice_acl']) &&
$this->config->config_data['invoice_acl'] == 'dimb')
{
+ $invoice = CreateObject('property.soinvoice');
$default_found = false;
$supervisor_id =
$invoice->get_default_dimb_role_user(3, $ecodimb);
if($supervisor_id)
@@ -1935,24 +1935,27 @@
{
$order_type =
$this->bocommon->socommon->get_order_type($order_id);
- switch ($order_type)
+ if($order_id)
{
- case 'workorder':
- $location = '.project.workorder';
- $location_item_id = $order_id;
- break;
- case 'ticket':
- $location = '.ticket';
- $location_item_id =
$this->so->get_ticket_from_order($order_id);
- break;
- default:
- throw new Exception('Order type not
supported');
+ switch ($order_type)
+ {
+ case 'workorder':
+ $location =
'.project.workorder';
+ $location_item_id = $order_id;
+ break;
+ case 'ticket':
+ $location = '.ticket';
+ $location_item_id =
$this->so->get_ticket_from_order($order_id);
+ break;
+ default:
+ throw new Exception('Order type
not supported');
+ }
}
$supervisor_email = array();
//Check if user is asked for approval
- if(empty($supervisors[$this->account]))
+ if(empty($supervisors[$this->account]) && $order_id)
{
$action_params = array(
'appname' => 'property',
Modified: trunk/property/inc/class.boworkorder.inc.php
===================================================================
--- trunk/property/inc/class.boworkorder.inc.php 2016-12-11 20:32:51 UTC
(rev 16070)
+++ trunk/property/inc/class.boworkorder.inc.php 2016-12-12 10:21:33 UTC
(rev 16071)
@@ -1069,4 +1069,14 @@
}
return $_budget_amount;
}
+
+ /**
+ * Get orders related to a project
+ * @param int $project_id
+ * @return array of ids
+ */
+ function get_order_list($project_id)
+ {
+ return $this->so->get_order_list($project_id);
+ }
}
\ No newline at end of file
Modified: trunk/property/inc/class.soproject.inc.php
===================================================================
--- trunk/property/inc/class.soproject.inc.php 2016-12-11 20:32:51 UTC (rev
16070)
+++ trunk/property/inc/class.soproject.inc.php 2016-12-12 10:21:33 UTC (rev
16071)
@@ -2523,6 +2523,23 @@
//_debug_array($open_period);die();
}
+ function set_status( $id, $status_new)
+ {
+ $id = (int)$id;
+ $this->db->query("SELECT status FROM fm_project WHERE
id = '{$id}'", __LINE__, __FILE__);
+ $this->db->next_record();
+ $old_status = $this->db->f('status');
+
+ if ($old_status != $status_new)
+ {
+ $this->db->transaction_begin();
+ $this->db->query("UPDATE fm_project SET status
= '{$status_new}' WHERE id = '{$id}'", __LINE__, __FILE__);
+ $historylog =
CreateObject('property.historylog', 'project');
+ $historylog->add('S', $id, $status_new,
$old_status);
+ $this->db->transaction_commit();
+ }
+ }
+
function update_request_status( $project_id = '', $status = '',
$category = 0, $coordinator = 0 )
{
$historylog_r = CreateObject('property.historylog',
'request');
Modified: trunk/property/inc/class.uiworkorder.inc.php
===================================================================
--- trunk/property/inc/class.uiworkorder.inc.php 2016-12-11 20:32:51 UTC
(rev 16070)
+++ trunk/property/inc/class.uiworkorder.inc.php 2016-12-12 10:21:33 UTC
(rev 16071)
@@ -981,14 +981,20 @@
$subject =
lang('Approval') . ": {$values['project_id']}";
$message = '<a href ="'
. $GLOBALS['phpgw']->link( array('menuaction' => $approval_menuaction,
'id' =>
$values['project_id']), false, true) . '">' . lang('project %1 needs approval',
$values['project_id']) . '</a>';
+ if
(isset($config->config_data['project_approval_status']) &&
$config->config_data['project_approval_status'])
+ {
+
$_project_status = $config->config_data['project_approval_status'];
+
createObject('property.soproject')->set_status($values['project_id'],$_project_status);
+ }
+ $_orders =
$this->bo->get_order_list($values['project_id']);
break;
default:
$approval_menuaction =
'property.uiworkorder.edit';
$subject =
lang('Approval') . ": {$id}";
$message = '<a href ="'
. $GLOBALS['phpgw']->link( array('menuaction' => $approval_menuaction,
'id' => $id), false,
true) . '">' . lang('Workorder %1 needs approval', $id) . '</a>';
-
+ $_orders = array($id);
break;
}
@@ -1030,21 +1036,25 @@
$_address =
$GLOBALS['phpgw']->accounts->id2lid($_account_id) . "@{$email_domain}";
}
- $action_params['responsible'] =
$_account_id;
- try
+ foreach ($_orders as $_order_id)
{
- $historylog->add('AP',
$id, $GLOBALS['phpgw']->accounts->get($_account_id)->__toString() .
"::{$_budget_amount}");
-
execMethod('property.sopending_action.set_pending_action', $action_params);
- $rcpt =
$GLOBALS['phpgw']->send->msg('email', $_address, $subject,
stripslashes($message), '', $cc, $bcc, $coordinator_email, $coordinator_name,
'html');
- if ($rcpt)
+
$action_params['responsible'] = $_account_id;
+ $action_params['id'] =
$_order_id;
+ try
{
-
phpgwapi_cache::message_set(lang('%1 is notified', $_address),'message');
+
$historylog->add('AP', $id,
$GLOBALS['phpgw']->accounts->get($_account_id)->__toString() .
"::{$_budget_amount}");
+
execMethod('property.sopending_action.set_pending_action', $action_params);
+ $rcpt =
$GLOBALS['phpgw']->send->msg('email', $_address, $subject,
stripslashes($message), '', $cc, $bcc, $coordinator_email, $coordinator_name,
'html');
+ if ($rcpt)
+ {
+
phpgwapi_cache::message_set(lang('%1 is notified', $_address),'message');
+ }
}
+ catch (Exception $exc)
+ {
+
phpgwapi_cache::message_set($exc->getMessage(),'error');
+ }
}
- catch (Exception $exc)
- {
-
phpgwapi_cache::message_set($exc->getMessage(),'error');
- }
}
}
@@ -2261,10 +2271,10 @@
$approval_level =
!empty($config->config_data['approval_level']) ?
$config->config_data['approval_level'] : 'order';
- $_accumulated_budget_amount = 0;
+ $accumulated_budget_amount = 0;
if($approval_level == 'project')
{
- $_accumulated_budget_amount =
$this->bo->get_accumulated_budget_amount($values['project_id']);
+ $accumulated_budget_amount =
$this->bo->get_accumulated_budget_amount($values['project_id']);
}
$data = array(
@@ -2325,7 +2335,8 @@
'lang_budget' => lang('Budget'),
'value_budget' =>
isset($this->receipt['error']) && $this->receipt['error'] ?
$_POST['values']['budget'] : '',
'check_for_budget' => abs($budget),
- 'check_value_budget' =>
$_accumulated_budget_amount ? $_accumulated_budget_amount : $budget,
+ 'local_value_budget' => $budget,
+ 'accumulated_budget_amount' =>
$accumulated_budget_amount ? $accumulated_budget_amount : $budget,
'lang_budget_statustext' => lang('Enter the
budget'),
'lang_incl_tax' => lang('incl tax'),
'lang_calculation' => lang('Calculation'),
Modified: trunk/property/js/portico/workorder.edit.js
===================================================================
--- trunk/property/js/portico/workorder.edit.js 2016-12-11 20:32:51 UTC (rev
16070)
+++ trunk/property/js/portico/workorder.edit.js 2016-12-12 10:21:33 UTC (rev
16071)
@@ -1,4 +1,6 @@
-var amount = 0;
+//var amount = 0;
+var local_value_budget;
+var accumulated_budget_amount;
var order_id;
var vendor_id;
var project_ecodimb;
@@ -537,8 +539,11 @@
var contract_sum = Number($('#field_contract_sum').val());
var budget_sum = Number($('#field_budget').val());
- var total_amount = Math.max((contract_sum + Number(amount)),
(budget_sum +Number(amount)) );// || Number(amount);
+ var total_amount = Math.max((contract_sum - Number(local_value_budget)
+ Number(accumulated_budget_amount)),
+ (budget_sum - Number(local_value_budget) +
Number(accumulated_budget_amount)),
+ (Number(local_value_budget),Number(accumulated_budget_amount)));
+
$("#order_received_amount").val(total_amount);
var oArgs = {menuaction: 'property.uitts.check_purchase_right',
ecodimb: ecodimb, amount: total_amount, order_id: order_id};
Modified: trunk/property/templates/base/workorder.xsl
===================================================================
--- trunk/property/templates/base/workorder.xsl 2016-12-11 20:32:51 UTC (rev
16070)
+++ trunk/property/templates/base/workorder.xsl 2016-12-12 10:21:33 UTC (rev
16071)
@@ -1236,7 +1236,8 @@
<script type="text/javascript">
var lang = <xsl:value-of
select="php:function('js_lang', 'please enter either a budget or contrakt sum',
'next', 'save')"/>;
var check_for_budget = <xsl:value-of
select="check_for_budget"/>;
- var amount = <xsl:value-of
select="check_value_budget"/>;
+ var local_value_budget = <xsl:value-of
select="local_value_budget"/>;
+ var accumulated_budget_amount = <xsl:value-of
select="accumulated_budget_amount"/>;
var project_ecodimb = '<xsl:value-of
select="project_ecodimb"/>';
var base_java_url = <xsl:value-of
select="base_java_url"/>;
var location_item_id = '<xsl:value-of
select="location_item_id"/>';
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Fmsystem-commits] [16071] more on integration,
sigurdne <=