phpgroupware-cvs
[Top][All Lists]
Advanced

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

[Phpgroupware-cvs] property/inc class.uibudget.inc.php class.sobud...


From: Sigurd Nes
Subject: [Phpgroupware-cvs] property/inc class.uibudget.inc.php class.sobud...
Date: Fri, 07 Apr 2006 13:28:02 +0000

CVSROOT:        /sources/phpgroupware
Module name:    property
Branch:         
Changes by:     Sigurd Nes <address@hidden>     06/04/07 13:28:02

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

Log message:
        

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

Patches:
Index: property/inc/class.bobudget.inc.php
diff -u property/inc/class.bobudget.inc.php:1.2 
property/inc/class.bobudget.inc.php:1.3
--- property/inc/class.bobudget.inc.php:1.2     Thu Apr  6 13:34:54 2006
+++ property/inc/class.bobudget.inc.php Fri Apr  7 13:28:02 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.2 2006/04/06 13:34:54 
sigurdne Exp $
+       * @version $Id: class.bobudget.inc.php,v 1.3 2006/04/07 13:28:02 
sigurdne Exp $
        */
 
        /**
@@ -46,13 +46,17 @@
                                $this->use_session = True;
                        }
 
-                       $start  = get_var('start',array('POST','GET'));
-                       $query  = get_var('query',array('POST','GET'));
-                       $sort   = get_var('sort',array('POST','GET'));
-                       $order  = get_var('order',array('POST','GET'));
-                       $filter = get_var('filter',array('POST','GET'));
-                       $cat_id = get_var('cat_id',array('POST','GET'));
-                       $allrows                        = 
get_var('allrows',array('POST','GET'));
+                       $start          = get_var('start',array('POST','GET'));
+                       $query          = get_var('query',array('POST','GET'));
+                       $sort           = get_var('sort',array('POST','GET'));
+                       $order          = get_var('order',array('POST','GET'));
+                       $filter         = get_var('filter',array('POST','GET'));
+                       $cat_id         = get_var('cat_id',array('POST','GET'));
+                       $allrows        = 
get_var('allrows',array('POST','GET'));
+                       $district_id    = 
get_var('district_id',array('POST','GET'));
+                       $year           = get_var('year',array('POST','GET'));
+                       $grouping       = 
get_var('grouping',array('POST','GET'));
+                       $revision       = 
get_var('revision',array('POST','GET'));
 
                        if ($start)
                        {
@@ -91,6 +95,28 @@
                        {
                                $this->allrows = $allrows;
                        }
+
+                       if(isset($district_id))
+                       {
+                               $this->district_id = $district_id;
+                       }
+                       if(isset($year))
+                       {
+                               $this->year = $year;
+                       }
+                       if(isset($grouping))
+                       {
+                               $this->grouping = $grouping;
+                       }
+                       if(isset($revision))
+                       {
+                               $this->revision = $revision;
+                       }
+                       if(!$this->year = $year)
+                       {
+                               unset ($this->grouping);
+                               unset ($this->revision);
+                       }
                }
 
 
@@ -123,7 +149,9 @@
                function read()
                {
                        $budget = $this->so->read(array('start' => 
$this->start,'query' => $this->query,'sort' => $this->sort,'order' => 
$this->order,
-                                                                               
        'filter' => $this->filter,'cat_id' => 
$this->cat_id,'allrows'=>$this->allrows));
+                                                       'filter' => 
$this->filter,'cat_id' => $this->cat_id,'allrows'=>$this->allrows,
+                                                       'district_id' => 
$this->district_id,'year' => $this->year,'grouping' => 
$this->grouping,'revision' => $this->revision,));
+
                        $this->total_records = $this->so->total_records;
 
                        for ($i=0; $i<count($budget); $i++)
@@ -203,8 +231,65 @@
                        $revision_list = $this->so->get_revision_list($year);
                        return 
$this->bocommon->select_list($selected,$revision_list);
                }
+               
+               function get_year_filter_list($selected ='')
+               {
+                       if(!isset($_GET['year']))
+                       {
+                               $selected = date(Y);
+                       }
+                       $year_list = $this->so->get_year_filter_list();
+                       return 
$this->bocommon->select_list($selected,$year_list);
+               }
+
+               function get_revision_filter_list($selected ='')
+               {
+                       if(!isset($_GET['year']))
+                       {
+                               $year = 
(isset($GET['year'])?$this->year:date(Y));
+                               $this->year = $year;
+                               $selected = $this->so->get_max_revision($year);
+                               $this->revision = $selected;
+                       }
+                       else
+                       {
+                               $year = $this->year;
+                       }
+
+                       $revision_list = 
$this->so->get_revision_filter_list($year);
+                       return 
$this->bocommon->select_list($selected,$revision_list);
+
+               }
+
+               function get_grouping_filter_list($selected ='')
+               {
+                       if(!isset($_GET['year']))
+                       {
+                               $year = 
(isset($GET['year'])?$this->year:date(Y));
+                       }
+                       else
+                       {
+                               $year = $this->year;
+                       }
+                       $grouping_list = 
$this->so->get_grouping_filter_list($year);
+                       return 
$this->bocommon->select_list($selected,$grouping_list);
+               }
+
+/*
+                               'period_list'                           => 
$this->bo->get_period_filter_list($this->period),
+                               'lang_no_period'                        => 
lang('no period'),
+                               'lang_year_statustext'                  => 
lang('Select the period the selection belongs to'),
+
+                               'grouping_list'                         => 
$this->bo->get_grouping_filter_list($this->grouping),
+                               'lang_no_grouping'                      => 
lang('no year'),
+                               'lang_grouping_statustext'              => 
lang('Select the year the selection belongs to'),
+
+                               'revision_list'                         => 
$this->bo->get_revision_filter_list($this->revision),
+                               'lang_no_revision'                      => 
lang('no revision'),
+                               'lang_revision_statustext'              => 
lang('Select the revision the selection belongs to'),
 
 
+*/
 
        }
 ?>
Index: property/inc/class.sobudget.inc.php
diff -u property/inc/class.sobudget.inc.php:1.2 
property/inc/class.sobudget.inc.php:1.3
--- property/inc/class.sobudget.inc.php:1.2     Thu Apr  6 13:34:54 2006
+++ property/inc/class.sobudget.inc.php Fri Apr  7 13:28:02 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.2 2006/04/06 13:34:54 
sigurdne Exp $
+       * @version $Id: class.sobudget.inc.php,v 1.3 2006/04/07 13:28:02 
sigurdne Exp $
        */
 
        /**
@@ -28,6 +28,7 @@
                        $this->account          = 
$GLOBALS['phpgw_info']['user']['account_id'];
 
                        $this->join                     = $this->bocommon->join;
+                       $this->left_join                = 
$this->bocommon->left_join;
                        $this->like                     = $this->bocommon->like;
                }
 
@@ -41,7 +42,11 @@
                                $sort = 
(isset($data['sort'])?$data['sort']:'DESC');
                                $order = 
(isset($data['order'])?$data['order']:'');
                                $cat_id = 
(isset($data['cat_id'])?$data['cat_id']:0);
-                               $allrows                = 
(isset($data['allrows'])?$data['allrows']:'');
+                               $allrows = 
(isset($data['allrows'])?$data['allrows']:'');
+                               $district_id = 
(isset($data['district_id'])?$data['district_id']:'');
+                               $year = (isset($data['year'])?$data['year']:'');
+                               $grouping = 
(isset($data['grouping'])?$data['grouping']:'');
+                               $revision = 
(isset($data['revision'])?$data['revision']:'');
                        }
 
                        if ($order)
@@ -52,7 +57,7 @@
                        {
                                $ordermethod = ' order by id DESC';
                        }
-/*
+
 
                        $where = 'WHERE';
                        if ($cat_id > 0)
@@ -62,16 +67,41 @@
 
                        }
 
+                       if ($district_id > 0)
+                       {
+                               $filtermethod .= " $where 
district_id='$district_id' ";
+                               $where = 'AND';
+
+                       }
+                       if ($year > 0)
+                       {
+                               $filtermethod .= " $where year='$year' ";
+                               $where = 'AND';
+
+                       }
+                       if ($grouping > 0)
+                       {
+                               $filtermethod .= " $where grouping='$grouping' 
";
+                               $where = 'AND';
+
+                       }
+                       if ($revision > 0)
+                       {
+                               $filtermethod .= " $where revision='$revision' 
";
+                               $where = 'AND';
+
+                       }
+
                        if($query)
                        {
                                $query = ereg_replace("'",'',$query);
                                $query = ereg_replace('"','',$query);
 
-                               $querymethod = " $where ( abid = '$query' or 
org_name $this->like '%$query%')";
+                               $querymethod = " $where ( descr $this->like 
'%$query%')";
                        }
 
-*/
-                       $sql = "SELECT * FROM fm_budget $filtermethod 
$querymethod";
+
+                       $sql = "SELECT fm_budget.*,grouping, descr FROM 
fm_budget $this->join fm_b_account ON fm_budget.b_account_id = fm_b_account.id 
$filtermethod $querymethod";
 
                        $this->db2->query($sql,__LINE__,__FILE__);
                        $this->total_records = $this->db2->num_rows();
@@ -91,7 +121,9 @@
                                (
                                        'budget_id'             => 
$this->db->f('id'),
                                        'year'                  => 
$this->db->f('year'),
-                                       'b_group'               => 
$this->db->f('b_group'),
+                                       'grouping'              => 
$this->db->f('grouping'),
+                                       'b_account_id'          => 
$this->db->f('b_account_id'),
+                                       'b_account_name'        => 
$this->db->f('descr'),
                                        'district_id'           => 
$this->db->f('district_id'),
                                        'revision'              => 
$this->db->f('revision'),
                                        'budget_cost'           => 
$this->db->f('budget_cost'),
@@ -112,7 +144,7 @@
                                $budget['year']                 = 
$this->db->f('year');
                                $budget['district_id']          = 
$this->db->f('district_id');
                                $budget['revision']             = 
$this->db->f('revision');
-                               $budget['b_group']              = 
$this->db->f('b_group');
+                               $budget['b_account_id']         = 
$this->db->f('b_account_id');
                                $budget['remark']       = 
stripslashes($this->db->f('remark'));
                                $budget['budget_cost']  = 
$this->db->f('budget_cost');
                                $budget['entry_date']   = 
$this->db->f('entry_date');
@@ -129,8 +161,8 @@
 
                        $id = $this->bocommon->next_id('fm_budget');
 
-                       $this->db->query("INSERT INTO fm_budget 
(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->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;
 
@@ -244,11 +276,66 @@
                        return $revision_list;
                }
 
+               function get_year_filter_list()
+               {
+                       $sql = "SELECT year FROM fm_budget group by year";
+                       $this->db->query($sql);
+
+                       while ($this->db->next_record())
+                       {
+                               $year_list[] = array
+                               (
+                                       'id'    => $this->db->f('year'),
+                                       'name'  => $this->db->f('year')
+                               );
+                       }
+                       return $year_list;
+               }
+
+               function get_max_revision($year ='')
+               {
+                       $sql = "SELECT max(revision) as revision FROM fm_budget 
WHERE year =". (int)$year;
+                       $this->db->query($sql);
+                       $this->db->next_record();
+                       return $this->db->f('revision');
+               }
+
+
+               function get_revision_filter_list($year ='')
+               {
+                       $sql = "SELECT revision FROM fm_budget WHERE year =". 
(int)$year . "  group by revision";
+                       $this->db->query($sql);
+
+                       while ($this->db->next_record())
+                       {
+                               $revision_list[] = array
+                               (
+                                       'id'    => $this->db->f('revision'),
+                                       'name'  => $this->db->f('revision')
+                               );
+                       }
+                       return $revision_list;
+               }
+
+               function get_grouping_filter_list($year ='')
+               {
+                       $sql = "SELECT grouping FROM fm_budget $this->join 
fm_b_account ON fm_budget.b_account_id = fm_b_account.id WHERE year =". 
(int)$year . "  group by grouping";
+                       $this->db->query($sql);
+
+                       while ($this->db->next_record())
+                       {
+                               $grouping_list[] = array
+                               (
+                                       'id'    => $this->db->f('grouping'),
+                                       'name'  => $this->db->f('grouping')
+                               );
+                       }
+                       return $grouping_list;
+               }
 
                function delete($budget_id)
                {
                        $this->db->query('DELETE FROM fm_budget WHERE id=' . 
intval($budget_id),__LINE__,__FILE__);
-                       $this->db->query('DELETE FROM fm_budget_cols WHERE 
budget_id=' . intval($budget_id),__LINE__,__FILE__);
                }
        }
 ?>
Index: property/inc/class.uibudget.inc.php
diff -u property/inc/class.uibudget.inc.php:1.2 
property/inc/class.uibudget.inc.php:1.3
--- property/inc/class.uibudget.inc.php:1.2     Thu Apr  6 13:34:54 2006
+++ property/inc/class.uibudget.inc.php Fri Apr  7 13:28:02 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.2 2006/04/06 13:34:54 
sigurdne Exp $
+       * @version $Id: class.uibudget.inc.php,v 1.3 2006/04/07 13:28:02 
sigurdne Exp $
        */
 
        /**
@@ -54,9 +54,14 @@
                        $this->filter           = $this->bo->filter;
                        $this->cat_id           = $this->bo->cat_id;
                        $this->allrows          = $this->bo->allrows;
+                       $this->district_id      = $this->bo->district_id;
+                       $this->year             = $this->bo->year;
+                       $this->grouping         = $this->bo->grouping;
+                       $this->revision         = $this->bo->revision;
+
                        $this->menu->sub        ='budget';
 
-                       $this->acl2                             = 
CreateObject($this->currentapp.'.acl2');
+                       $this->acl2             = 
CreateObject($this->currentapp.'.acl2');
 
                }
 
@@ -82,6 +87,9 @@
                        $acl_add        = $this->acl2->check($acl2_location,2);
                        $acl_edit       = $this->acl2->check($acl2_location,4);
                        $acl_delete     = $this->acl2->check($acl2_location,8);
+                       $revision_list  = 
$this->bo->get_revision_filter_list($this->revision); // reset year
+                       $this->year     = $this->bo->year;
+                       $this->revision = $this->bo->revision;
 
                        if(!$acl_read)
                        {
@@ -102,23 +110,27 @@
                        $list = $this->bo->read();
                        if (isset($list) AND is_array($list))
                        {
+                               $sum = 0;
                                foreach($list as $entry)
                                {
 
                                        $content[] = array
                                        (
                                                'year'                          
=> $entry['year'],
-                                               'b_group'                       
=> $entry['b_group'],
+                                               'b_account_id'                  
=> $entry['b_account_id'],
+                                               'b_account_name'                
=> $entry['b_account_name'],
+                                               'grouping'                      
=> $entry['grouping'],
                                                'district_id'                   
=> $entry['district_id'],
                                                'revision'                      
=> $entry['revision'],
                                                'budget_cost'                   
=> $entry['budget_cost'],
-                                               'link_edit'                     
=> 
$GLOBALS['phpgw']->link('/index.php','menuaction='.$this->currentapp.'.uibudget.edit&budget_id='
 . $entry['id']),
-                                               'link_delete'                   
=> 
$GLOBALS['phpgw']->link('/index.php','menuaction='.$this->currentapp.'.uibudget.delete$budget_id='
 . $entry['id']),
+                                               'link_edit'                     
=> 
$GLOBALS['phpgw']->link('/index.php','menuaction='.$this->currentapp.'.uibudget.edit&budget_id='
 . $entry['budget_id']),
+                                               'link_delete'                   
=> 
$GLOBALS['phpgw']->link('/index.php','menuaction='.$this->currentapp.'.uibudget.delete&budget_id='
 . $entry['budget_id']),
                                                'lang_edit_text'                
=> lang('edit the budget record'),
                                                'lang_delete_text'              
=> lang('delete the budget record'),
                                                'text_edit'                     
=> lang('edit'),
                                                'text_delete'                   
=> lang('delete')
                                        );
+                                       $sum = $sum + $entry['budget_cost'];
                                }
                        }
 
@@ -126,8 +138,10 @@
                        (
                                'lang_year'             => lang('year'),
                                'lang_revision'         => lang('revision'),
-                               'lang_b_group'          => lang('group'),
+                               'lang_b_account'        => lang('budget 
account'),
+                               'lang_name'             => lang('name'),
                                'lang_budget_cost'      => lang('budget_cost'),
+                               'lang_grouping'         => lang('grouping'),
                                'lang_edit'             => lang('edit'),
                                'lang_delete'           => lang('delete'),
                                'lang_district_id'      => lang('district_id'),
@@ -138,15 +152,39 @@
                                                                                
        'var'   =>      'district_id',
                                                                                
        'order' =>      $this->order,
                                                                                
        'extra'         => array('menuaction'   => 
$this->currentapp.'.uibudget.index',
-                                                                               
                                                'allrows'=>$this->allrows)
+                                                                               
                                                'district_id'   
=>$this->district_id,
+                                                                               
                                                'year'          =>$this->year,
+                                                                               
                                                'period'        =>$this->period,
+                                                                               
                                                'grouping'      
=>$this->grouping,
+                                                                               
                                                'revision'      
=>$this->revision,
+                                                                               
                                                'allrows'       
=>$this->allrows)
                                                                                
)),
                
-                               'sort_b_group'  => 
$this->nextmatchs->show_sort_order(array
+                               'sort_b_account_id'     => 
$this->nextmatchs->show_sort_order(array
+                                                                               
(
+                                                                               
        'sort'  => $this->sort,
+                                                                               
        'var'   =>      'b_account_id',
+                                                                               
        'order' =>      $this->order,
+                                                                               
        'extra'         => array('menuaction'   => 
$this->currentapp.'.uibudget.index',
+                                                                               
                                                'district_id'   
=>$this->district_id,
+                                                                               
                                                'year'          =>$this->year,
+                                                                               
                                                'period'        =>$this->period,
+                                                                               
                                                'grouping'      
=>$this->grouping,
+                                                                               
                                                'revision'      
=>$this->revision,
+                                                                               
                                                'allrows'=>$this->allrows)
+                                                                               
)),
+
+                               'sort_grouping' => 
$this->nextmatchs->show_sort_order(array
                                                                                
(
                                                                                
        'sort'  => $this->sort,
-                                                                               
        'var'   =>      'b_group',
+                                                                               
        'var'   =>      'grouping',
                                                                                
        'order' =>      $this->order,
                                                                                
        'extra'         => array('menuaction'   => 
$this->currentapp.'.uibudget.index',
+                                                                               
                                                'district_id'   
=>$this->district_id,
+                                                                               
                                                'year'          =>$this->year,
+                                                                               
                                                'period'        =>$this->period,
+                                                                               
                                                'grouping'      
=>$this->grouping,
+                                                                               
                                                'revision'      
=>$this->revision,
                                                                                
                                                'allrows'=>$this->allrows)
                                                                                
)),
 
@@ -156,6 +194,11 @@
                                                                                
        'var'   =>      'budget_cost',
                                                                                
        'order' =>      $this->order,
                                                                                
        'extra'         => array('menuaction'   => 
$this->currentapp.'.uibudget.index',
+                                                                               
                                                'district_id'   
=>$this->district_id,
+                                                                               
                                                'year'          =>$this->year,
+                                                                               
                                                'period'        =>$this->period,
+                                                                               
                                                'grouping'      
=>$this->grouping,
+                                                                               
                                                'revision'      
=>$this->revision,
                                                                                
                                                'allrows'=>$this->allrows)
                                                                                
)),
                        );
@@ -166,20 +209,24 @@
                        {
                                $table_add = array
                                (
-                                       'lang_add'                              
=> lang('add'),
+                                       'lang_add'              => lang('add'),
                                        'lang_add_statustext'   => lang('add a 
budget query'),
-                                       'add_action'                    => 
$GLOBALS['phpgw']->link('/index.php','menuaction='.$this->currentapp.'.uibudget.edit')
+                                       'add_action'            => 
$GLOBALS['phpgw']->link('/index.php','menuaction='.$this->currentapp.'.uibudget.edit')
                                );
                        }
 
                        $link_data = array
                        (
                                'menuaction'    => 
$this->currentapp.'.uibudget.index',
-                                               'sort'                  
=>$this->sort,
-                                               'order'                 
=>$this->order,
-                                               'cat_id'                
=>$this->cat_id,
-                                               'filter'                
=>$this->filter,
-                                               'query'                 
=>$this->query
+                                               'sort'          =>$this->sort,
+                                               'order'         =>$this->order,
+                                               'cat_id'        =>$this->cat_id,
+                                               'filter'        =>$this->filter,
+                                               'query'         =>$this->query,
+                                               'district_id'   
=>$this->district_id,
+                                               'year'          =>$this->year,
+                                               'grouping'      
=>$this->grouping,
+                                               'revision'      
=>$this->revision
                        );
 
                        if(!$this->allrows)
@@ -191,10 +238,13 @@
                                $record_limit   = $this->bo->total_records;
                        }
 
+                                               
                        $msgbox_data = $this->bocommon->msgbox_data($receipt);
 
                        $data = array
                        (
+                               'sum'                                           
=> $sum,
+                               'lang_sum'                                      
=> lang('sum'),
                                'msgbox_data'                                   
=> $GLOBALS['phpgw']->common->msgbox($msgbox_data),
                                'links'                                         
=> $links,
                                'allow_allrows'                                 
=> true,
@@ -203,17 +253,37 @@
                                'record_limit'                                  
=> $record_limit,
                                'num_records'                                   
=> count($list),
                                'all_records'                                   
=> $this->bo->total_records,
-                               'link_url'                                      
        => $GLOBALS['phpgw']->link('/index.php',$link_data),
-                               'img_path'                                      
        => $GLOBALS['phpgw']->common->get_image_path('phpgwapi','default'),
+                               'link_url'                                      
=> $GLOBALS['phpgw']->link('/index.php',$link_data),
+                               'img_path'                                      
=> $GLOBALS['phpgw']->common->get_image_path('phpgwapi','default'),
                                'select_action'                                 
=> $GLOBALS['phpgw']->link('/index.php',$link_data),
-                               'lang_searchfield_statustext'   => lang('Enter 
the search string. To show all entries, empty this field and press the SUBMIT 
button again'),
-                               'lang_searchbutton_statustext'  => lang('Submit 
the search string'),
-                               'query'                                         
        => $this->query,
+                               'lang_searchfield_statustext'                   
=> lang('Enter the search string. To show all entries, empty this field and 
press the SUBMIT button again'),
+                               'lang_searchbutton_statustext'                  
=> lang('Submit the search string'),
+                               'query'                                         
=> $this->query,
                                'lang_search'                                   
=> lang('search'),
                                'table_header_budget'                           
=> $table_header,
                                'values_budget'                                 
=> $content,
-                               'table_add'                                     
=> $table_add
+                               'table_add'                                     
=> $table_add,
+                               'district_list'                                 
=> $this->bocommon->select_district_list('filter',$this->district_id),
+                               'lang_no_district'                              
=> lang('no district'),
+                               'lang_district_statustext'              => 
lang('Select the district the selection belongs to. To do not use a district 
select NO DISTRICT'),
+                               'select_district_name'                  => 
'district_id',
+
+                               'year_list'                             => 
$this->bo->get_year_filter_list($this->year),
+                               'lang_no_year'                          => 
lang('no year'),
+                               'lang_year_statustext'                  => 
lang('Select the year the selection belongs to'),
+
+                               'grouping_list'                         => 
$this->bo->get_grouping_filter_list($this->grouping),
+                               'lang_no_grouping'                      => 
lang('no grouping'),
+                               'lang_grouping_statustext'              => 
lang('Select the grouping the selection belongs to'),
+
+                               'revision_list'                         => 
$this->bo->get_revision_filter_list($this->revision),
+                               'lang_no_revision'                      => 
lang('no revision'),
+                               'lang_revision_statustext'              => 
lang('Select the revision the selection belongs to'),
+
                        );
+
+
+
                        $this->save_sessiondata();
                        $GLOBALS['phpgw_info']['flags']['app_header'] = 
lang('budget') . ': ' . lang('list budget');
 
@@ -347,20 +417,27 @@
                        }
 
                        $budget_id      = 
get_var('budget_id',array('POST','GET'));
-                       $cols_id        = 
get_var('cols_id',array('POST','GET'));
-                       $resort = get_var('resort',array('POST','GET'));
-                       $values         = get_var('values',array('POST'));
-
-                       if($cols_id)
-                       {
-                               
$this->bo->resort(array('budget_id'=>$budget_id,'id'=>$cols_id,'resort'=>$resort));
-                       }
 
+                       $values         = get_var('values',array('POST'));
 
                        $GLOBALS['phpgw']->xslttpl->add_file(array('budget'));
 
                        if ($values['save'] || $values['apply'])
                        {
+                               $values['b_account_id']         = 
get_var('b_account_id',array('POST'));
+                               $values['b_account_name']       = 
get_var('b_account_name',array('POST'));
+
+                               if(!$values['b_account_id'] && !$budget_id)
+                               {
+                                       
$receipt['error'][]=array('msg'=>lang('Please select a budget account !'));
+                               }
+
+                               
+                               if(!$values['district_id'] && !$budget_id)
+                               {
+                                       
$receipt['error'][]=array('msg'=>lang('Please select a district !'));
+                               }
+
                                if(!$values['budget_cost'])
                                {
                                        
$receipt['error'][]=array('msg'=>lang('Please enter a budget cost !'));
@@ -379,6 +456,16 @@
                                                
$GLOBALS['phpgw']->redirect_link('/index.php','menuaction='.$this->currentapp.'.uibudget.index');
                                        }
                                }
+                               else
+                               {
+                                       $year_selected = $values['year'];
+                                       $district_id = $values['district_id'];
+                                       $revision = $values['revision'];
+                                       
+                                       unset ($values['year']);
+                                       unset ($values['district_id']);
+                                       unset ($values['revision']);
+                               }
                        }
 
                        if ($values['cancel'])
@@ -407,25 +494,32 @@
                        $year[2]['id'] = date(Y) +2;
                        $year[3]['id'] = date(Y) +3;
 
+                       
$b_account_data=$this->bocommon->initiate_ui_budget_account_lookup(array(
+                                               'b_account_id'          => 
$values['b_account_id'],
+                                               'b_account_name'        => 
$values['b_account_name'],
+                                               'type'                  => 
$values['b_account_id']?'view':'form'));
+
                        $data = array
                        (
+                               'b_account_data'                        => 
$b_account_data,
+                               'value_b_account'                       => 
$values['b_account_id'],
                                'lang_revision'                         => 
lang('revision'),
                                'lang_revision_statustext'              => 
lang('Select revision'),
-                               'revision_list'                         => 
$this->bo->get_revision_list($values['revision']),
-
+                               'revision_list'                         => 
$this->bo->get_revision_list($revision),
+/*
                                'lang_b_group'                  => lang('budget 
group'),
                                'lang_b_group_statustext'               => 
lang('Select budget group'),
                                'b_group_list'                          => 
$this->bo->get_b_group_list($values['b_group']),
-                               
+*/             
                                'lang_year'                             => 
lang('year'),
                                'lang_year_statustext'                  => 
lang('Budget year'),
-                               'year'                                  => 
$this->bocommon->select_list($values['year'],$year),
+                               'year'                                  => 
$this->bocommon->select_list($year_selected,$year),
 
                                'lang_district'                         => 
lang('District'),
                                'lang_no_district'                      => 
lang('no district'),
                                'lang_district_statustext'              => 
lang('Select the district'),
                                'select_district_name'                  => 
'values[district_id]',
-                               'district_list'                         => 
$this->bocommon->select_district_list('select',$values['district_id']),
+                               'district_list'                         => 
$this->bocommon->select_district_list('select',$district_id),
                                
                                'value_year'                            => 
$values['year'],
                                'value_district_id'                     => 
$values['district_id'],
@@ -482,13 +576,13 @@
                                'done_action'                   => 
$GLOBALS['phpgw']->link('/index.php',$link_data),
                                'delete_action'                 => 
$GLOBALS['phpgw']->link('/index.php','menuaction='.$this->currentapp.'.uibudget.delete&budget_id='
 . $budget_id),
                                'lang_confirm_msg'              => lang('do you 
really want to delete this entry'),
-                               'lang_yes'                              => 
lang('yes'),
+                               'lang_yes'                      => lang('yes'),
                                'lang_yes_statustext'   => lang('Delete the 
entry'),
                                'lang_no_statustext'    => lang('Back to the 
list'),
                                'lang_no'                               => 
lang('no')
                        );
 
-                       $appname                                                
= lang('budget');
+                       $appname                                        = 
lang('budget');
                        $function_msg                                   = 
lang('delete budget');
 
                        $GLOBALS['phpgw_info']['flags']['app_header'] = 
lang($this->currentapp) . ' - ' . $appname . ': ' . $function_msg;




reply via email to

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