phpgroupware-cvs
[Top][All Lists]
Advanced

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

[Phpgroupware-cvs] property/inc class.sobudget.inc.php class.bobud...


From: Sigurd Nes
Subject: [Phpgroupware-cvs] property/inc class.sobudget.inc.php class.bobud...
Date: Wed, 19 Apr 2006 11:27:13 +0000

CVSROOT:        /sources/phpgroupware
Module name:    property
Branch:         
Changes by:     Sigurd Nes <address@hidden>     06/04/19 11:27:13

Modified files:
        inc            : class.sobudget.inc.php class.bobudget.inc.php 
                         class.uibudget.inc.php 

Log message:
        

CVSWeb URLs:
http://cvs.savannah.gnu.org/viewcvs/phpgroupware/property/inc/class.sobudget.inc.php.diff?tr1=1.8&tr2=1.9&r1=text&r2=text
http://cvs.savannah.gnu.org/viewcvs/phpgroupware/property/inc/class.bobudget.inc.php.diff?tr1=1.6&tr2=1.7&r1=text&r2=text
http://cvs.savannah.gnu.org/viewcvs/phpgroupware/property/inc/class.uibudget.inc.php.diff?tr1=1.6&tr2=1.7&r1=text&r2=text

Patches:
Index: property/inc/class.bobudget.inc.php
diff -u property/inc/class.bobudget.inc.php:1.6 
property/inc/class.bobudget.inc.php:1.7
--- property/inc/class.bobudget.inc.php:1.6     Tue Apr 11 11:39:04 2006
+++ property/inc/class.bobudget.inc.php Wed Apr 19 11:27:13 2006
@@ -8,7 +8,7 @@
        * @internal Development of this application was funded by 
http://www.bergen.kommune.no/bbb_/ekstern/
        * @package property
        * @subpackage budget
-       * @version $Id: class.bobudget.inc.php,v 1.6 2006/04/11 11:39:04 
sigurdne Exp $
+       * @version $Id: class.bobudget.inc.php,v 1.7 2006/04/19 11:27:13 
sigurdne Exp $
        */
 
        /**
@@ -229,6 +229,10 @@
 
                        if(is_array($values['distribute']) && 
is_array($values['distribute_year']))
                        {
+                               if($values['distribute'][0]=='new')
+                               {
+                                       $values['distribute'][0]= 
$receipt['budget_id'];
+                               }
                                $this->distribute($values,$receipt);
                        }
                        return $receipt;
Index: property/inc/class.sobudget.inc.php
diff -u property/inc/class.sobudget.inc.php:1.8 
property/inc/class.sobudget.inc.php:1.9
--- property/inc/class.sobudget.inc.php:1.8     Wed Apr 12 10:24:43 2006
+++ property/inc/class.sobudget.inc.php Wed Apr 19 11:27:13 2006
@@ -8,7 +8,7 @@
        * @internal Development of this application was funded by 
http://www.bergen.kommune.no/bbb_/ekstern/
        * @package property
        * @subpackage budget
-       * @version $Id: class.sobudget.inc.php,v 1.8 2006/04/12 10:24:43 
sigurdne Exp $
+       * @version $Id: class.sobudget.inc.php,v 1.9 2006/04/19 11:27:13 
sigurdne Exp $
        */
 
        /**
@@ -242,21 +242,32 @@
 
                function add_basis($budget)
                {
+                       $receipt = array();
                        $budget['remark'] = 
$this->db->db_addslashes($budget['remark']);
 
                        $this->db->transaction_begin();
 
-                       $id = $this->bocommon->next_id('fm_budget_basis');
+                       $sql = "SELECT id FROM fm_budget_basis WHERE year ='" . 
$budget['year'] . "'  AND b_group ='" . $budget['b_group'] . "' AND revision = 
'" . $budget['revision'] . "'AND district_id='" . $budget['district_id'] . "'";
+                       $this->db->query($sql,__LINE__,__FILE__);
 
-                       $this->db->query("INSERT INTO fm_budget_basis 
(id,entry_date,remark,user_id,year,revision,district_id,b_group,budget_cost)"
-                               . "VALUES ($id,'" . time() . "','" . 
$budget['remark'] . "'," . $this->account . "," . $budget['year'] . "," . 
$budget['revision'] . "," . $budget['district_id'] . "," . $budget['b_group'] . 
"," . $budget['budget_cost'] . ")",__LINE__,__FILE__);
+                       if($this->db->next_record())
+                       {
+                               $receipt['error'][] = array('msg'=>lang('budget 
%1 already saved',$this->db->f('id')));
+                       }
 
-                       $receipt['budget_id']= $id;
+                       if(!$receipt['error'])
+                       {
+                               $id = 
$this->bocommon->next_id('fm_budget_basis');
 
+                               $this->db->query("INSERT INTO fm_budget_basis 
(id,entry_date,remark,user_id,year,revision,district_id,b_group,budget_cost)"
+                                       . "VALUES ($id,'" . time() . "','" . 
$budget['remark'] . "'," . $this->account . "," . $budget['year'] . "," . 
$budget['revision'] . "," . $budget['district_id'] . "," . $budget['b_group'] . 
"," . $budget['budget_cost'] . ")",__LINE__,__FILE__);
 
-                       $this->db->transaction_commit();
+                               $receipt['budget_id']= $id;
+                               $receipt['message'][] = 
array('msg'=>lang('budget %1 has been saved',$receipt['budget_id']));
+                       }
 
-                       $receipt['message'][] = array('msg'=>lang('budget %1 
has been saved',$receipt['budget_id']));
+                       $this->db->transaction_commit();
+                       
                        return $receipt;
                }
 
@@ -300,16 +311,27 @@
 
                        $this->db->transaction_begin();
 
-                       $id = $this->bocommon->next_id('fm_budget');
+                       $sql = "SELECT id FROM fm_budget WHERE year ='" . 
$budget['year'] . "'  AND b_account_id ='" . $budget['b_account_id'] . "' AND 
revision = '" . $budget['revision'] . "'AND district_id='" . 
$budget['district_id'] . "'";
+                       $this->db->query($sql,__LINE__,__FILE__);
 
-                       $this->db->query("INSERT INTO fm_budget 
(id,entry_date,remark,user_id,year,revision,district_id,b_account_id,budget_cost)"
-                               . "VALUES ($id,'" . time() . "','" . 
$budget['remark'] . "'," . $this->account . "," . $budget['year'] . "," . 
$budget['revision'] . "," . $budget['district_id'] . "," . 
$budget['b_account_id'] . "," . $budget['budget_cost'] . ")",__LINE__,__FILE__);
+                       if($this->db->next_record())
+                       {
+                               $receipt['error'][] = array('msg'=>lang('budget 
%1 already saved',$this->db->f('id')));
+                       }
+
+                       if(!$receipt['error'])
+                       {
+                               $id = $this->bocommon->next_id('fm_budget');
 
-                       $receipt['budget_id']= $id;
+                               $this->db->query("INSERT INTO fm_budget 
(id,entry_date,remark,user_id,year,revision,district_id,b_account_id,budget_cost)"
+                                       . "VALUES ($id,'" . time() . "','" . 
$budget['remark'] . "'," . $this->account . "," . $budget['year'] . "," . 
$budget['revision'] . "," . $budget['district_id'] . "," . 
$budget['b_account_id'] . "," . $budget['budget_cost'] . ")",__LINE__,__FILE__);
+
+                               $receipt['budget_id']= $id;
+                               $receipt['message'][] = 
array('msg'=>lang('budget %1 has been saved',$receipt['budget_id']));
+                       }
 
                        $this->db->transaction_commit();
 
-                       $receipt['message'][] = array('msg'=>lang('budget %1 
has been saved',$receipt['budget_id']));
                        return $receipt;
                }
 
@@ -470,7 +492,7 @@
                        $year_condition = 'year in (' . 
implode(",",$values['distribute_year']). ')';
 
                        $this->db->transaction_begin();
-                       
+
                        foreach ($values['distribute'] as $basis_id)
                        {
                                $this->db->query("SELECT * FROM fm_budget_basis 
where id='$basis_id'",__LINE__,__FILE__);
Index: property/inc/class.uibudget.inc.php
diff -u property/inc/class.uibudget.inc.php:1.6 
property/inc/class.uibudget.inc.php:1.7
--- property/inc/class.uibudget.inc.php:1.6     Mon Apr 10 19:22:31 2006
+++ property/inc/class.uibudget.inc.php Wed Apr 19 11:27:13 2006
@@ -8,7 +8,7 @@
        * @internal Development of this application was funded by 
http://www.bergen.kommune.no/bbb_/ekstern/
        * @package property
        * @subpackage budget
-       * @version $Id: class.uibudget.inc.php,v 1.6 2006/04/10 19:22:31 
sigurdne Exp $
+       * @version $Id: class.uibudget.inc.php,v 1.7 2006/04/19 11:27:13 
sigurdne Exp $
        */
 
        /**
@@ -787,6 +787,7 @@
                                'edit_url'                              => 
$GLOBALS['phpgw']->link('/index.php',$link_data),
                                'lang_budget_id'                        => 
lang('ID'),
                                'value_budget_id'                       => 
$budget_id,
+                               'value_distribute_id'                   => 
$budget_id?$budget_id:'new',
                                'lang_budget_cost'                      => 
lang('budget cost'),
                                'lang_remark'                           => 
lang('remark'),
                                'lang_save'                             => 
lang('save'),




reply via email to

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