[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Fmsystem-commits] [11033] property: budget handling
From: |
Sigurd Nes |
Subject: |
[Fmsystem-commits] [11033] property: budget handling |
Date: |
Sun, 07 Apr 2013 17:06:56 +0000 |
Revision: 11033
http://svn.sv.gnu.org/viewvc/?view=rev&root=fmsystem&revision=11033
Author: sigurdne
Date: 2013-04-07 17:06:56 +0000 (Sun, 07 Apr 2013)
Log Message:
-----------
property: budget handling
Modified Paths:
--------------
trunk/property/inc/class.soXport.inc.php
Modified: trunk/property/inc/class.soXport.inc.php
===================================================================
--- trunk/property/inc/class.soXport.inc.php 2013-04-07 12:30:01 UTC (rev
11032)
+++ trunk/property/inc/class.soXport.inc.php 2013-04-07 17:06:56 UTC (rev
11033)
@@ -789,25 +789,20 @@
foreach ($orders as $order)
{
$this->db->query("UPDATE fm_workorder
SET actual_cost = '{$order['actual_cost']}' WHERE id =
'{$order['order_id']}'",__LINE__,__FILE__);
- }
- foreach ($orders_affected as $order_id =>
$dummy)
- {
-
phpgwapi_cache::system_clear('property', "budget_order_{$order_id}");
-
- $this->db->query("SELECT max(periode)
AS period, max(amount) AS amount FROM fm_orders_paid_or_pending_view WHERE
order_id = {$order_id} AND periode IS NOT NULL",__LINE__,__FILE__);
+ $this->db->query("SELECT max(periode)
AS period, max(amount) AS amount FROM fm_orders_paid_or_pending_view WHERE
order_id = {$order['order_id']} AND periode IS NOT NULL",__LINE__,__FILE__);
$this->db->next_record();
$period =
$this->db->f('period');
$amount =
$this->db->f('amount');
$year = $period ? (int)
substr($period,0,4) : date('Y');
- $this->db->query("SELECT order_id FROM
fm_workorder_budget WHERE order_id = {$order_id} AND year =
{$year}",__LINE__,__FILE__);
+ $this->db->query("SELECT order_id FROM
fm_workorder_budget WHERE order_id = {$order['order_id']} AND year =
{$year}",__LINE__,__FILE__);
if (!$this->db->next_record())
{
try
{
-
$soworkorder->transfer_budget($order_id, array('budget_amount' => $amount,
'latest_year' => ($year -1)), $year);
+
$soworkorder->transfer_budget($order['order_id'], array('budget_amount' =>
$amount, 'latest_year' => ($year -1)), $year);
}
catch(Exception $e)
{
@@ -818,14 +813,21 @@
}
}
+ }
+
+ reset($orders_affected);
+
+ foreach ($orders_affected as $order_id =>
$dummy)
+ {
+
phpgwapi_cache::system_clear('property', "budget_order_{$order_id}");
+
// Not yet processed
- $this->db->query("SELECT max(amount) AS
amount FROM fm_orders_paid_or_pending_view WHERE order_id = {$order_id} AND
periode IS NULL",__LINE__,__FILE__);
-
- if($this->db->next_record())
+ $this->db->query("SELECT max(amount) AS
amount FROM fm_orders_paid_or_pending_view WHERE order_id = {$order_id} AND
periode IS NULL",__LINE__,__FILE__);
+ $this->db->next_record();
+ $amount =
$this->db->f('amount');
+ if($amount)
{
- $amount =
$this->db->f('amount');
$year =
date('Y');
-
$this->db->query("SELECT
order_id FROM fm_workorder_budget WHERE order_id = {$order_id} AND year =
{$year}",__LINE__,__FILE__);
if (!$this->db->next_record())
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Fmsystem-commits] [11033] property: budget handling,
Sigurd Nes <=