fmsystem-commits
[Top][All Lists]
Advanced

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

[Fmsystem-commits] [10961] Property: budget handling


From: Sigurd Nes
Subject: [Fmsystem-commits] [10961] Property: budget handling
Date: Mon, 04 Mar 2013 19:34:01 +0000

Revision: 10961
          http://svn.sv.gnu.org/viewvc/?view=rev&root=fmsystem&revision=10961
Author:   sigurdne
Date:     2013-03-04 19:34:01 +0000 (Mon, 04 Mar 2013)
Log Message:
-----------
Property: budget handling

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

Modified: trunk/property/inc/class.soproject.inc.php
===================================================================
--- trunk/property/inc/class.soproject.inc.php  2013-03-04 18:35:50 UTC (rev 
10960)
+++ trunk/property/inc/class.soproject.inc.php  2013-03-04 19:34:01 UTC (rev 
10961)
@@ -2874,12 +2874,12 @@
                                $this->db->query("SELECT sum(budget) as budget 
FROM fm_project_budget WHERE project_id = {$id} AND year = {$latest_year} AND 
active = 1",__LINE__,__FILE__);
                                $this->db->next_record();
                                $last_budget = $this->db->f('budget');
-/*
+
                                if( !abs( $last_budget ) > 0 )
                                {
                                        throw new 
Exception('property_soproject::transfer_budget() - no budget to transfer for 
this investment project: ' . $id);
                                }
-*/
+
                                //paid last year
                                $this->db->query("SELECT sum(amount) as paid 
FROM fm_project"
                                . " {$this->join} fm_workorder ON fm_project.id 
= fm_workorder.project_id"
@@ -2954,10 +2954,31 @@
                                        switch($type)
                                        {
                                                case 'project':
-                                                       
$this->transfer_budget($_id, $new_budget[$_id], $transfer_budget_year);
+                                                       try
+                                                       {
+                                                               
$this->transfer_budget($_id, $new_budget[$_id], $transfer_budget_year);
+                                                       }
+                                                       catch(Exception $e)
+                                                       {
+                                                               if ( $e )
+                                                               {
+                                                                       
phpgwapi_cache::message_set($e->getMessage(), 'error'); 
+                                                               }
+                                                       }
                                                        break;
                                                case 'workorder':
-                                                       
$soworkorder->transfer_budget($_id, $new_budget[$_id], $transfer_budget_year);
+                                                       try
+                                                       {
+                                                               
$soworkorder->transfer_budget($_id, $new_budget[$_id], $transfer_budget_year);
+                                                       }
+                                                       catch(Exception $e)
+                                                       {
+                                                               if ( $e )
+                                                               {
+                                                                       
phpgwapi_cache::message_set($e->getMessage(), 'error'); 
+                                                               }
+                                                       }
+
                                                        break;
                                                default:
                                                        throw new 
Exception('property_soproject::bulk_update_status() - not a valid type');

Modified: trunk/property/inc/class.soworkorder.inc.php
===================================================================
--- trunk/property/inc/class.soworkorder.inc.php        2013-03-04 18:35:50 UTC 
(rev 10960)
+++ trunk/property/inc/class.soworkorder.inc.php        2013-03-04 19:34:01 UTC 
(rev 10961)
@@ -2189,7 +2189,7 @@
                                $this->db->query("SELECT sum(combined_cost) AS 
budget FROM fm_workorder_budget WHERE order_id = {$id} AND year = 
{$latest_year}",__LINE__,__FILE__);
                                $this->db->next_record();
                                $last_budget = $this->db->f('budget');
-                               if(!$last_budget)
+                               if( !abs( $last_budget ) > 0 )
                                {
                                        throw new 
Exception('property_workorder::transfer_budget() - no budget to transfer for 
this investment order: ' . $id);
                                }




reply via email to

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