fmsystem-commits
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Fmsystem-commits] [10729] property: bulk update budget


From: Sigurd Nes
Subject: [Fmsystem-commits] [10729] property: bulk update budget
Date: Tue, 29 Jan 2013 17:10:13 +0000

Revision: 10729
          http://svn.sv.gnu.org/viewvc/?view=rev&root=fmsystem&revision=10729
Author:   sigurdne
Date:     2013-01-29 17:10:12 +0000 (Tue, 29 Jan 2013)
Log Message:
-----------
property: bulk update budget

Modified Paths:
--------------
    trunk/property/inc/class.soproject.inc.php

Modified: trunk/property/inc/class.soproject.inc.php
===================================================================
--- trunk/property/inc/class.soproject.inc.php  2013-01-29 15:04:36 UTC (rev 
10728)
+++ trunk/property/inc/class.soproject.inc.php  2013-01-29 17:10:12 UTC (rev 
10729)
@@ -2590,18 +2590,22 @@
                        $this->db->next_record();
                        $periodization_id = $this->db->f('periodization_id');
                        $project_type_id = $this->db->f('project_type_id');
-                       $transferred = $this->update_budget($id, 
$budget['latest_year'], $periodization_id, $budget['obligation'], false, 
'subtract');
-                       
-                       if($budget['budget_amount'])
+
+                       if(abs($budget['obligation']) > 0)
                        {
-                               $this->update_budget($id, $year, 
$periodization_id, (int) $budget['budget_amount'], true, 'update', true);
+                               $transferred = $this->update_budget($id, 
$budget['latest_year'], $periodization_id, $budget['obligation'], false, 
'subtract');
                        }
-                       
+
                        if($project_type_id == 1)//operation
                        {
                                $this->db->query("UPDATE fm_project_budget SET 
active = 0 WHERE project_id = {$id}",__LINE__,__FILE__);
+                       }                       
+
+                       if($budget['budget_amount'])
+                       {
+                               $this->update_budget($id, $year, 
$periodization_id, (int)$budget['budget_amount'], true, 'update', true);
                        }
-
+                       
                        $this->db->transaction_commit();
                }
 
@@ -2612,19 +2616,19 @@
                        {
                                echo "<H1> Overføre budsjett for valgte 
prosjekt/bestillinger til år {$transfer_budget} </H1>";
 
-                               foreach($new_budget as $_id => $_budget)
+                               foreach($ids as $_id)
                                {
-                                       if((int)$_budget['latest_year'] >= 
(int)$transfer_budget_year)
+                                       
if((int)$new_budget[$_id]['latest_year'] >= (int)$transfer_budget_year)
                                        {
                                                continue;
                                        }
                                        switch($type)
                                        {
                                                case 'project':
-                                                       
$this->transfer_budget($_id, $_budget, $transfer_budget_year);
+                                                       
$this->transfer_budget($_id, $new_budget[$_id], $transfer_budget_year);
                                                        break;
                                                case 'workorder':
-                                                       _debug_array( $_budget);
+                                                       _debug_array( 
$new_budget[$_id]);
                                                        break;
                                                default:
                                                        throw new 
Exception('property_soproject::bulk_update_status() - not a valid type');




reply via email to

[Prev in Thread] Current Thread [Next in Thread]