fmsystem-commits
[Top][All Lists]
Advanced

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

[Fmsystem-commits] [11779] validate budget dimensions


From: Sigurd Nes
Subject: [Fmsystem-commits] [11779] validate budget dimensions
Date: Tue, 04 Mar 2014 08:46:49 +0000

Revision: 11779
          http://svn.sv.gnu.org/viewvc/?view=rev&root=fmsystem&revision=11779
Author:   sigurdne
Date:     2014-03-04 08:46:48 +0000 (Tue, 04 Mar 2014)
Log Message:
-----------
validate budget dimensions

Modified Paths:
--------------
    trunk/property/inc/class.boinvoice.inc.php
    trunk/property/inc/class.soinvoice.inc.php
    trunk/property/inc/class.uiinvoice2.inc.php
    trunk/property/setup/phpgw_no.lang

Modified: trunk/property/inc/class.boinvoice.inc.php
===================================================================
--- trunk/property/inc/class.boinvoice.inc.php  2014-03-03 19:27:39 UTC (rev 
11778)
+++ trunk/property/inc/class.boinvoice.inc.php  2014-03-04 08:46:48 UTC (rev 
11779)
@@ -969,7 +969,7 @@
                }
 
                /**
-                * Reasign an alter dimensions accordingly
+                * Reassign and alter dimensions accordingly
                 * @param int $line_id
                 * @param bigint $order_id
                 * @return boolean true on success
@@ -978,4 +978,14 @@
                {
                        return $this->so->reassign_order($line_id, $order_id);
                }
+
+               /**
+                * Check if provided budget account is valid
+                * @param string $b_account_id
+                * @return boolean true on valid budget account
+                */
+               function check_valid_b_account($b_account_id)
+               {
+                       return $this->so->check_valid_b_account($b_account_id);
+               }
        }

Modified: trunk/property/inc/class.soinvoice.inc.php
===================================================================
--- trunk/property/inc/class.soinvoice.inc.php  2014-03-03 19:27:39 UTC (rev 
11778)
+++ trunk/property/inc/class.soinvoice.inc.php  2014-03-04 08:46:48 UTC (rev 
11779)
@@ -2637,4 +2637,16 @@
                        return $this->db->query("UPDATE fm_ecobilag SET 
$value_set WHERE id = $line_id",__LINE__,__FILE__);
 
                }
+
+               /**
+                * Check if provided budget account is valid
+                * @param string $b_account_id
+                * @return boolean true on valid budget account
+                */
+               function check_valid_b_account($b_account_id)
+               {
+                       $this->db->query("SELECT active FROM fm_b_account WHERE 
id = '{$b_account_id}'",__LINE__,__FILE__);
+                       $this->db->next_record();
+                       return !!$this->db->f('active');
+               }
        }       

Modified: trunk/property/inc/class.uiinvoice2.inc.php
===================================================================
--- trunk/property/inc/class.uiinvoice2.inc.php 2014-03-03 19:27:39 UTC (rev 
11778)
+++ trunk/property/inc/class.uiinvoice2.inc.php 2014-03-04 08:46:48 UTC (rev 
11779)
@@ -124,7 +124,7 @@
                }
 
                /**
-                * Reasign an alter dimensions accordingly
+                * Reassign and alter dimensions accordingly
                 * @param int $line_id
                 * @param bigint $order_id
                 * @return boolean true on success
@@ -176,6 +176,20 @@
                                        return $this->reassign_order($line_id, 
$values['order_id'], $voucher_id);
                                }
 
+                               $cats                   = 
CreateObject('phpgwapi.categories', -1,  'property', '.project');
+                               $cats->supress_info     = true;
+                               $category       = 
$cats->return_single((int)$values['dim_e']);
+                               if(!isset($category[0]) || 
$category[0]['active'] != 1)
+                               {
+                                       $receipt['error'][]=true;               
                
+                                       phpgwapi_cache::message_set(lang('not a 
valid category'), 'error');
+                               }
+                               
if(!$this->bo->check_valid_b_account($values['b_account_id']))
+                               {
+                                       $receipt['error'][]=true;               
                
+                                       phpgwapi_cache::message_set(lang('not a 
valid budget account'), 'error');
+                               }
+                               
                                $order = 
execMethod('property.soworkorder.read_single',$values['order_id']);
                                $project = 
execMethod('property.soproject.read_single', $order['project_id']);
                                

Modified: trunk/property/setup/phpgw_no.lang
===================================================================
--- trunk/property/setup/phpgw_no.lang  2014-03-03 19:27:39 UTC (rev 11778)
+++ trunk/property/setup/phpgw_no.lang  2014-03-04 08:46:48 UTC (rev 11779)
@@ -1989,6 +1989,8 @@
 cost categories        property        no      Kostnadskategori
 negative value for budget      property        no      Negativ verdi for 
kostnadsestimat
 no symptoms    property        no      Ingen avvik
+not a valid category   property        no      Ugyldig Kategori
+not a valid budget account     property        no      Ugyldig Kostnadsart
 minor symptoms property        no      Ikke vesentlig avvik
 medium symptoms        property        no      Vesentlig avvik
 serious symptoms       property        no      Stort eller vesentlig avvik




reply via email to

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