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: Thu, 06 Apr 2006 13:34:54 +0000

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

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.1&tr2=1.2&r1=text&r2=text
http://cvs.savannah.gnu.org/viewcvs/phpgroupware/property/inc/class.sobudget.inc.php.diff?tr1=1.1&tr2=1.2&r1=text&r2=text
http://cvs.savannah.gnu.org/viewcvs/phpgroupware/property/inc/class.bobudget.inc.php.diff?tr1=1.1&tr2=1.2&r1=text&r2=text

Patches:
Index: property/inc/class.bobudget.inc.php
diff -u property/inc/class.bobudget.inc.php:1.1 
property/inc/class.bobudget.inc.php:1.2
--- property/inc/class.bobudget.inc.php:1.1     Tue Apr  4 13:46:30 2006
+++ property/inc/class.bobudget.inc.php Thu Apr  6 13:34:54 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.1 2006/04/04 13:46:30 
sigurdne Exp $
+       * @version $Id: class.bobudget.inc.php,v 1.2 2006/04/06 13:34:54 
sigurdne Exp $
        */
 
        /**
@@ -36,8 +36,9 @@
 
                function bobudget($session=False)
                {
-                       $this->currentapp               = 
$GLOBALS['phpgw_info']['flags']['currentapp'];
-                       $this->so = CreateObject($this->currentapp.'.sobudget');
+                       $this->currentapp       = 
$GLOBALS['phpgw_info']['flags']['currentapp'];
+                       $this->so               = 
CreateObject($this->currentapp.'.sobudget');
+                       $this->bocommon         = 
CreateObject($this->currentapp.'.bocommon');
 
                        if ($session)
                        {
@@ -190,6 +191,20 @@
                        $this->total_records = $this->so->total_records;
                        return $budget;
                }
+               
+               function get_b_group_list($selected ='')
+               {
+                       $b_group_list = $this->so->get_b_group_list();
+                       return 
$this->bocommon->select_list($selected,$b_group_list);
+               }
+
+               function get_revision_list($selected ='',$year='')
+               {
+                       $revision_list = $this->so->get_revision_list($year);
+                       return 
$this->bocommon->select_list($selected,$revision_list);
+               }
+
+
 
        }
 ?>
Index: property/inc/class.sobudget.inc.php
diff -u property/inc/class.sobudget.inc.php:1.1 
property/inc/class.sobudget.inc.php:1.2
--- property/inc/class.sobudget.inc.php:1.1     Tue Apr  4 13:46:30 2006
+++ property/inc/class.sobudget.inc.php Thu Apr  6 13:34:54 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.1 2006/04/04 13:46:30 
sigurdne Exp $
+       * @version $Id: class.sobudget.inc.php,v 1.2 2006/04/06 13:34:54 
sigurdne Exp $
        */
 
        /**
@@ -52,7 +52,7 @@
                        {
                                $ordermethod = ' order by id DESC';
                        }
-
+/*
 
                        $where = 'WHERE';
                        if ($cat_id > 0)
@@ -70,8 +70,9 @@
                                $querymethod = " $where ( abid = '$query' or 
org_name $this->like '%$query%')";
                        }
 
+*/
                        $sql = "SELECT * FROM fm_budget $filtermethod 
$querymethod";
-return;
+
                        $this->db2->query($sql,__LINE__,__FILE__);
                        $this->total_records = $this->db2->num_rows();
 
@@ -86,15 +87,19 @@
 
                        while ($this->db->next_record())
                        {
-                               $budgets[] = array
+                               $budget[] = array
                                (
                                        'budget_id'             => 
$this->db->f('id'),
-                                       'name'                  => 
stripslashes($this->db->f('name')),
-                                       'entry_date'    => 
$this->db->f('entry_date'),
+                                       'year'                  => 
$this->db->f('year'),
+                                       'b_group'               => 
$this->db->f('b_group'),
+                                       'district_id'           => 
$this->db->f('district_id'),
+                                       'revision'              => 
$this->db->f('revision'),
+                                       'budget_cost'           => 
$this->db->f('budget_cost'),
+                                       'entry_date'            => 
$this->db->f('entry_date'),
                                        'user'                  => 
$GLOBALS['phpgw']->accounts->id2name($this->db->f('user_id'))
                                );
                        }
-                       return $budgets;
+                       return $budget;
                }
 
                function read_single($budget_id)
@@ -104,57 +109,28 @@
                        if ($this->db->next_record())
                        {
                                $budget['id']                   = 
(int)$this->db->f('id');
-                               $budget['name']                 = 
stripslashes($this->db->f('name'));
-                               $budget['sql_text']                     = 
stripslashes($this->db->f('sql_text'));
+                               $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['remark']       = 
stripslashes($this->db->f('remark'));
+                               $budget['budget_cost']  = 
$this->db->f('budget_cost');
                                $budget['entry_date']   = 
$this->db->f('entry_date');
-                               $budget['cols']                 = 
$this->read_cols($budget_id);
                        }
 
                        return $budget;
                }
 
-               function read_cols($budget_id)
-               {
-                       $sql = "SELECT * FROM fm_budget_cols WHERE 
budget_id=$budget_id ORDER by sorting";
-                       $this->db->query($sql);
-
-                       while ($this->db->next_record())
-                       {
-                               $choice[] = array
-                               (
-                                       'id'    => $this->db->f('id'),
-                                       'name'  => $this->db->f('name'),
-                                       'descr' => $this->db->f('descr'),
-                                       'sorting'=> $this->db->f('sorting')
-                               );
-
-                       }
-                       return $choice;
-               }
-
-               function read_budget_name($budget_id)
-               {
-                       $this->db->query("select name from fm_budget where 
id='$budget_id'",__LINE__,__FILE__);
-
-                       if ($this->db->next_record())
-                       {
-                               $name                   = 
stripslashes($this->db->f('name'));
-                       }
-
-                       return $name;
-               }
-
                function add($budget)
                {
-                       $budget['name'] = 
$this->db->db_addslashes($budget['name']);
-                       $budget['sql_text'] = 
$this->db->db_addslashes($budget['sql_text']);
+                       $budget['remark'] = 
$this->db->db_addslashes($budget['remark']);
 
                        $this->db->transaction_begin();
 
                        $id = $this->bocommon->next_id('fm_budget');
 
-                       $this->db->query("INSERT INTO fm_budget 
(id,entry_date,sql_text,name,user_id) "
-                               . "VALUES ($id,'" . time() . "','" . 
$budget['sql_text'] . "','" . $budget['name'] . "'," . $this->account . 
")",__LINE__,__FILE__);
+                       $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__);
 
                        $receipt['budget_id']= $id;
 
@@ -167,110 +143,15 @@
 
                function edit($budget)
                {
-                       $budget['name'] = 
$this->db->db_addslashes($budget['name']);
-                       $budget['sql_text'] = 
$this->db->db_addslashes($budget['sql_text']);
-
-                       $this->db->query("UPDATE fm_budget set sql_text='" . 
$budget['sql_text'] . "', entry_date='" . time() . "', name='" . 
$budget['name'] . "' WHERE id=" . 
intval($budget['budget_id']),__LINE__,__FILE__);
-
-                       if($budget['new_name'])
-                       {
-                               $column_id = 
$this->bocommon->next_id('fm_budget_cols' 
,array('budget_id'=>$budget['budget_id']));
+                       $budget['remark'] = 
$this->db->db_addslashes($budget['remark']);
 
-                               $sql = "SELECT max(sorting) as max_sort FROM 
fm_budget_cols WHERE budget_id=" . $budget['budget_id'];
-                               $this->db->query($sql);
-                               $this->db->next_record();
-                               $sorting        = $this->db->f('max_sort')+1;
-
-
-                               $values= array(
-                                       $budget['budget_id'],
-                                       $column_id,
-                                       $budget['new_name'],
-                                       
$this->db->db_addslashes($budget['new_descr']),
-                                       $sorting
-                                       );
-
-                               $values = 
$this->bocommon->validate_db_insert($values);
-
-                               $this->db->query("INSERT INTO fm_budget_cols 
(budget_id,id,name,descr,sorting) "
-                               . "VALUES ($values)");
-                       }
-
-
-                       if($budget['delete_cols'])
-                       {
-                               for ($i=0;$i<count($budget['delete_cols']);$i++)
-                               {
-
-                                       $sql = "SELECT sorting FROM 
fm_budget_cols where budget_id=" . $budget['budget_id'] . " AND id=" . 
$budget['delete_cols'][$i];
-                                       $this->db->query($sql);
-                                       $this->db->next_record();
-                                       $sorting        = 
$this->db->f('sorting');
-                                       $sql2 = "SELECT max(sorting) as 
max_sort FROM fm_budget_cols";
-                                       $this->db->query($sql2);
-                                       $this->db->next_record();
-                                       $max_sort       = 
$this->db->f('max_sort');
-
-                                       if($max_sort>$sorting)
-                                       {
-                                               $sql = "UPDATE fm_budget_cols 
set sorting=sorting-1 WHERE sorting > $sorting AND budget_id=" . 
$budget['budget_id'];
-                                               $this->db->query($sql);
-                                       }
-
-
-                                       $this->db->query("DELETE FROM 
fm_budget_cols WHERE  budget_id=" . $budget['budget_id']  ." AND id=" . 
$budget['delete_cols'][$i]);
-                               }
-                       }
+                       $this->db->query("UPDATE fm_budget set remark='" . 
$budget['remark'] . "', entry_date='" . time() . "', budget_cost='" . 
$budget['budget_cost'] . "' WHERE id=" . 
intval($budget['budget_id']),__LINE__,__FILE__);
 
                        $receipt['budget_id']= $budget['budget_id'];
                        $receipt['message'][] = array('msg'=>lang('budget %1 
has been edited',$budget['budget_id']));
                        return $receipt;
                }
 
-               function resort($data)
-               {
-//html_print_r($data);
-                       if(is_array($data))
-                       {
-                               $resort = 
(isset($data['resort'])?$data['resort']:'up');
-                               $budget_id = 
(isset($data['id'])?$data['budget_id']:'');
-                               $id = (isset($data['id'])?$data['id']:'');
-                       }
-
-                       $sql = "SELECT sorting FROM fm_budget_cols WHERE 
budget_id = $budget_id AND id=$id";
-                       $this->db->query($sql);
-                       $this->db->next_record();
-                       $sorting        = $this->db->f('sorting');
-                       $sql = "SELECT max(sorting) as max_sort FROM 
fm_budget_cols WHERE budget_id = $budget_id";
-                       $this->db->query($sql);
-                       $this->db->next_record();
-                       $max_sort       = $this->db->f('max_sort');
-                       switch($resort)
-                       {
-                               case 'up':
-                                       if($sorting>1)
-                                       {
-                                               $sql = "UPDATE fm_budget_cols 
set sorting=$sorting WHERE budget_id = $budget_id AND sorting =" . ($sorting-1);
-                                               $this->db->query($sql);
-                                               $sql = "UPDATE fm_budget_cols 
set sorting=" . ($sorting-1) ." WHERE budget_id = $budget_id AND id=$id";
-                                               $this->db->query($sql);
-                                       }
-                                       break;
-                               case 'down':
-                                       if($max_sort > $sorting)
-                                       {
-                                               $sql = "UPDATE fm_budget_cols 
set sorting=$sorting WHERE budget_id = $budget_id AND sorting =" . ($sorting+1);
-                                               $this->db->query($sql);
-                                               $sql = "UPDATE fm_budget_cols 
set sorting=" . ($sorting+1) ." WHERE budget_id = $budget_id AND id=$id";
-                                               $this->db->query($sql);
-                                       }
-                                       break;
-                               default:
-                                       return;
-                                       break;
-                       }
-               }
-
                function read_budget($data)
                {
                        if(is_array($data))
@@ -320,6 +201,50 @@
                        return $budget;
                }
 
+               function get_b_group_list()
+               {
+                       $sql = "SELECT grouping FROM fm_b_account group by 
grouping";
+                       $this->db->query($sql);
+
+                       while ($this->db->next_record())
+                       {
+                               $group_list[] = array
+                               (
+                                       'id'    => $this->db->f('grouping'),
+                                       'name'  => $this->db->f('grouping')
+                               );
+
+                       }
+                       return $group_list;
+               }
+
+               function get_revision_list($year='')
+               {
+                       $sql = "SELECT revision FROM fm_budget where year =" . 
(int)$year;
+                       $this->db->query($sql);
+
+                       while ($this->db->next_record())
+                       {
+                               $revision_list[] = array
+                               (
+                                       'id'    => $this->db->f('revision'),
+                                       'name'  => $this->db->f('revision')
+                               );
+
+                       }
+
+                       $i = count($revision_list);
+
+                       $revision_list[] = array
+                       (
+                               'id'    => $i+1,
+                               'name'  => $i+1
+                       );
+
+                       return $revision_list;
+               }
+
+
                function delete($budget_id)
                {
                        $this->db->query('DELETE FROM fm_budget WHERE id=' . 
intval($budget_id),__LINE__,__FILE__);
Index: property/inc/class.uibudget.inc.php
diff -u property/inc/class.uibudget.inc.php:1.1 
property/inc/class.uibudget.inc.php:1.2
--- property/inc/class.uibudget.inc.php:1.1     Tue Apr  4 13:46:30 2006
+++ property/inc/class.uibudget.inc.php Thu Apr  6 13:34:54 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.1 2006/04/04 13:46:30 
sigurdne Exp $
+       * @version $Id: class.uibudget.inc.php,v 1.2 2006/04/06 13:34:54 
sigurdne Exp $
        */
 
        /**
@@ -54,7 +54,7 @@
                        $this->filter           = $this->bo->filter;
                        $this->cat_id           = $this->bo->cat_id;
                        $this->allrows          = $this->bo->allrows;
-                       $this->menu->sub                        ='budget';
+                       $this->menu->sub        ='budget';
 
                        $this->acl2                             = 
CreateObject($this->currentapp.'.acl2');
 
@@ -100,142 +100,69 @@
                        
$GLOBALS['phpgw']->session->appsession('session_data','budget_receipt','');
 
                        $list = $this->bo->read();
-
-                       $uicols['name'][]       = 'budget_id';
-                       $uicols['descr'][]      = lang('ID');
-                       $uicols['name'][]       = 'name';
-                       $uicols['descr'][]      = lang('Name');
-                       $uicols['name'][]       = 'entry_date';
-                       $uicols['descr'][]      = lang('date');
-                       $uicols['name'][]       = 'user';
-                       $uicols['descr'][]      = lang('User');
-
-                       $j=0;
                        if (isset($list) AND is_array($list))
                        {
                                foreach($list as $entry)
                                {
-                                       for 
($i=0;$i<count($uicols['name']);$i++)
-                                       {
-                                               
if($uicols['input_type'][$i]!='hidden')
-                                               {
-                                                       
$content[$j]['row'][$i]['value']                        = 
$entry[$uicols['name'][$i]];
-                                                       
$content[$j]['row'][$i]['name']                         = $uicols['name'][$i];
-                                               }
-                                       }
-
-                                       if($this->acl_read)
-                                       {
-                                               
$content[$j]['row'][$i]['statustext']                   = lang('view the 
entity');
-                                               $content[$j]['row'][$i]['text'] 
                                = lang('view');
-                                               
$content[$j]['row'][$i++]['link']                               = 
$GLOBALS['phpgw']->link('/index.php','menuaction='.$this->currentapp.'.uibudget.view&budget_id='
 . $entry['budget_id']);
-                                       }
-                                       if($this->acl_edit)
-                                       {
-                                               
$content[$j]['row'][$i]['statustext']                   = lang('edit the 
actor');
-                                               $content[$j]['row'][$i]['text'] 
                                = lang('edit');
-                                               
$content[$j]['row'][$i++]['link']                               = 
$GLOBALS['phpgw']->link('/index.php','menuaction='.$this->currentapp.'.uibudget.edit&budget_id='
 . $entry['budget_id']);
-                                       }
-                                       if($this->acl_delete)
-                                       {
-                                               
$content[$j]['row'][$i]['statustext']                   = lang('delete the 
actor');
-                                               $content[$j]['row'][$i]['text'] 
                                = lang('delete');
-                                               
$content[$j]['row'][$i++]['link']                               = 
$GLOBALS['phpgw']->link('/index.php','menuaction='.$this->currentapp.'.uibudget.delete&budget_id='
 . $entry['budget_id']);
-                                       }
 
-                                       $j++;
+                                       $content[] = array
+                                       (
+                                               'year'                          
=> $entry['year'],
+                                               'b_group'                       
=> $entry['b_group'],
+                                               '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']),
+                                               'lang_edit_text'                
=> lang('edit the budget record'),
+                                               'lang_delete_text'              
=> lang('delete the budget record'),
+                                               'text_edit'                     
=> lang('edit'),
+                                               'text_delete'                   
=> lang('delete')
+                                       );
                                }
                        }
 
-//_debug_array($list);
-                       $i=0;
-                       $table_header[$i]['header']     = lang('ID');
-                       $table_header[$i]['width']              = '5%';
-                       $table_header[$i]['align']              = 'center';
-                       $table_header[$i]['sort_link']  =true;
-                       $table_header[$i]['sort']               = 
$this->nextmatchs->show_sort_order(array
-                               (
-                                       'sort'  => $this->sort,
-                                       'var'   =>      'id',
-                                       'order' =>      $this->order,
-                                       'extra'         => array('menuaction'   
=> $this->currentapp.'.uibudget.index',
-                                                                               
'query'         =>$this->query,
-                                                                               
'start_date'    => $start_date,
-                                                                               
'end_date'=>$end_date)
-                               ));
-                       $i++;
-                       $table_header[$i]['header']     = lang('name');
-                       $table_header[$i]['width']              = '5%';
-                       $table_header[$i]['align']              = 'center';
-                       $table_header[$i]['sort_link']  =true;
-                       $table_header[$i]['sort']               = 
$this->nextmatchs->show_sort_order(array
-                               (
-                                       'sort'  => $this->sort,
-                                       'var'   =>      'name',
-                                       'order' =>      $this->order,
-                                       'extra'         => array('menuaction'   
=> $this->currentapp.'.uibudget.index',
-                                                                               
'query'         =>$this->query,
-                                                                               
'start_date'    => $start_date,
-                                                                               
'end_date'=>$end_date)
-                               ));
-                       $i++;
-
-                       $table_header[$i]['header']     = lang('date');
-                       $table_header[$i]['width']              = '5%';
-                       $table_header[$i]['align']              = 'center';
-                       $table_header[$i]['sort_link']  =true;
-                       $table_header[$i]['sort']               = 
$this->nextmatchs->show_sort_order(array
-                               (
-                                       'sort'  => $this->sort,
-                                       'var'   =>      'name',
-                                       'order' =>      $this->order,
-                                       'extra'         => array('menuaction'   
=> $this->currentapp.'.uibudget.index',
-                                                                               
'query'         =>$this->query,
-                                                                               
'start_date'    => $start_date,
-                                                                               
'end_date'=>$end_date)
-                               ));
-                       $i++;
-                       $table_header[$i]['header']     = lang('User');
-                       $table_header[$i]['width']              = '5%';
-                       $table_header[$i]['align']              = 'center';
-                       $table_header[$i]['sort_link']  =true;
-                       $table_header[$i]['sort']               = 
$this->nextmatchs->show_sort_order(array
-                               (
-                                       'sort'  => $this->sort,
-                                       'var'   =>      'user_id',
-                                       'order' =>      $this->order,
-                                       'extra'         => array('menuaction'   
=> $this->currentapp.'.uibudget.index',
-                                                                               
'query'         =>$this->query,
-                                                                               
'start_date'    => $start_date,
-                                                                               
'end_date'=>$end_date)
-                               ));
-                       $i++;
-
+                       $table_header[] = array
+                       (
+                               'lang_year'             => lang('year'),
+                               'lang_revision'         => lang('revision'),
+                               'lang_b_group'          => lang('group'),
+                               'lang_budget_cost'      => lang('budget_cost'),
+                               'lang_edit'             => lang('edit'),
+                               'lang_delete'           => lang('delete'),
+                               'lang_district_id'      => lang('district_id'),
+
+                               'sort_district_id'      => 
$this->nextmatchs->show_sort_order(array
+                                                                               
(
+                                                                               
        'sort'  => $this->sort,
+                                                                               
        'var'   =>      'district_id',
+                                                                               
        'order' =>      $this->order,
+                                                                               
        'extra'         => array('menuaction'   => 
$this->currentapp.'.uibudget.index',
+                                                                               
                                                'allrows'=>$this->allrows)
+                                                                               
)),
+               
+                               'sort_b_group'  => 
$this->nextmatchs->show_sort_order(array
+                                                                               
(
+                                                                               
        'sort'  => $this->sort,
+                                                                               
        'var'   =>      'b_group',
+                                                                               
        'order' =>      $this->order,
+                                                                               
        'extra'         => array('menuaction'   => 
$this->currentapp.'.uibudget.index',
+                                                                               
                                                'allrows'=>$this->allrows)
+                                                                               
)),
+
+                               'sort_budget_cost'      => 
$this->nextmatchs->show_sort_order(array
+                                                                               
(
+                                                                               
        'sort'  => $this->sort,
+                                                                               
        'var'   =>      'budget_cost',
+                                                                               
        'order' =>      $this->order,
+                                                                               
        'extra'         => array('menuaction'   => 
$this->currentapp.'.uibudget.index',
+                                                                               
                                                'allrows'=>$this->allrows)
+                                                                               
)),
+                       );
 
-                       if($this->acl_read)
-                       {
-                               $table_header[$i]['width']                      
= '5%';
-                               $table_header[$i]['align']                      
= 'center';
-                               $table_header[$i]['header']                     
= lang('view');
-                               $i++;
-                       }
-                       if($this->acl_edit)
-                       {
-                               $table_header[$i]['width']                      
= '5%';
-                               $table_header[$i]['align']                      
= 'center';
-                               $table_header[$i]['header']                     
= lang('edit');
-                               $i++;
-                       }
-                       if($this->acl_delete)
-                       {
-                               $table_header[$i]['width']                      
= '5%';
-                               $table_header[$i]['align']                      
= 'center';
-                               $table_header[$i]['header']                     
= lang('delete');
-                               $i++;
-                       }
 
 
-                       if($this->acl_add)
+                       if($acl_add)
                        {
                                $table_add = array
                                (
@@ -283,9 +210,9 @@
                                'lang_searchbutton_statustext'  => lang('Submit 
the search string'),
                                'query'                                         
        => $this->query,
                                'lang_search'                                   
=> lang('search'),
-                               'table_header'                                  
=> $table_header,
-                               'values'                                        
        => $content,
-                               'table_add'                                     
        => $table_add
+                               'table_header_budget'                           
=> $table_header,
+                               'values_budget'                                 
=> $content,
+                               'table_add'                                     
=> $table_add
                        );
                        $this->save_sessiondata();
                        $GLOBALS['phpgw_info']['flags']['app_header'] = 
lang('budget') . ': ' . lang('list budget');
@@ -319,141 +246,36 @@
 
                        $list = $this->bo->read();
 
-                       $uicols['name'][]       = 'budget_id';
-                       $uicols['descr'][]      = lang('ID');
-                       $uicols['name'][]       = 'name';
-                       $uicols['descr'][]      = lang('Name');
-                       $uicols['name'][]       = 'entry_date';
-                       $uicols['descr'][]      = lang('date');
-                       $uicols['name'][]       = 'user';
-                       $uicols['descr'][]      = lang('User');
-
-                       $j=0;
-                       if (isset($list) AND is_array($list))
+                       if (isset($custom_function_list) AND 
is_array($custom_function_list))
                        {
-                               foreach($list as $entry)
+                               foreach($custom_function_list as $entry)
                                {
-                                       for 
($i=0;$i<count($uicols['name']);$i++)
-                                       {
-                                               
if($uicols['input_type'][$i]!='hidden')
-                                               {
-                                                       
$content[$j]['row'][$i]['value']                        = 
$entry[$uicols['name'][$i]];
-                                                       
$content[$j]['row'][$i]['name']                         = $uicols['name'][$i];
-                                               }
-                                       }
 
-                                       if($this->acl_read)
-                                       {
-                                               
$content[$j]['row'][$i]['statustext']                   = lang('view the 
entity');
-                                               $content[$j]['row'][$i]['text'] 
                                = lang('view');
-                                               
$content[$j]['row'][$i++]['link']                               = 
$GLOBALS['phpgw']->link('/index.php','menuaction='.$this->currentapp.'.uibudget.view&budget_id='
 . $entry['budget_id']);
-                                       }
-                                       if($this->acl_edit)
-                                       {
-                                               
$content[$j]['row'][$i]['statustext']                   = lang('edit the 
actor');
-                                               $content[$j]['row'][$i]['text'] 
                                = lang('edit');
-                                               
$content[$j]['row'][$i++]['link']                               = 
$GLOBALS['phpgw']->link('/index.php','menuaction='.$this->currentapp.'.uibudget.edit&budget_id='
 . $entry['budget_id']);
-                                       }
-                                       if($this->acl_delete)
-                                       {
-                                               
$content[$j]['row'][$i]['statustext']                   = lang('delete the 
actor');
-                                               $content[$j]['row'][$i]['text'] 
                                = lang('delete');
-                                               
$content[$j]['row'][$i++]['link']                               = 
$GLOBALS['phpgw']->link('/index.php','menuaction='.$this->currentapp.'.uibudget.delete&budget_id='
 . $entry['budget_id']);
-                                       }
-
-                                       $j++;
+                                       $content[] = array
+                                       (
+                                               'file_name'                     
        => $entry['file_name'],
+                                               'descr'                         
        => $entry['descr'],
+                                               'sorting'                       
        => $entry['sorting'],
+                                               'active'                        
        => $entry['active']?'X':'',
+                                               'link_up'                       
        => 
$GLOBALS['phpgw']->link('/index.php','menuaction='.$this->currentapp.'.ui_custom.list_custom_function&resort=up&appname='
 . $appname . '&location=' . $location . '&id=' . $entry['id'] . '&allrows=' . 
$this->allrows),
+                                               'link_down'                     
        => 
$GLOBALS['phpgw']->link('/index.php','menuaction='.$this->currentapp.'.ui_custom.list_custom_function&resort=down&appname='
 . $appname . '&location=' . $location . '&id=' . $entry['id'] . '&allrows=' . 
$this->allrows),
+                                               'link_edit'                     
        => 
$GLOBALS['phpgw']->link('/index.php','menuaction='.$this->currentapp.'.ui_custom.edit_custom_function&appname='
 . $appname . '&location=' . $location . '&id=' . $entry['id']),
+                                               'link_delete'                   
        => 
$GLOBALS['phpgw']->link('/index.php','menuaction='.$this->currentapp.'.ui_custom.delete&appname='
 . $appname . '&location=' . $location . '&custom_function_id=' . $entry['id']),
+                                               'lang_up_text'                  
        => lang('shift up'),
+                                               'lang_down_text'                
        => lang('shift down'),
+                                               'lang_edit_text'                
        => lang('edit the custom_function'),
+                                               'lang_delete_text'              
        => lang('delete the custom_function'),
+                                               'text_custom_function'          
        => lang('custom functions'),
+                                               'text_up'                       
        => lang('up'),
+                                               'text_down'                     
        => lang('down'),
+                                               'text_edit'                     
        => lang('edit'),
+                                               'text_delete'                   
        => lang('delete')
+                                       );
                                }
                        }
 
-//_debug_array($list);
-                       $i=0;
-                       $table_header[$i]['header']     = lang('ID');
-                       $table_header[$i]['width']              = '5%';
-                       $table_header[$i]['align']              = 'center';
-                       $table_header[$i]['sort_link']  =true;
-                       $table_header[$i]['sort']               = 
$this->nextmatchs->show_sort_order(array
-                               (
-                                       'sort'  => $this->sort,
-                                       'var'   =>      'id',
-                                       'order' =>      $this->order,
-                                       'extra'         => array('menuaction'   
=> $this->currentapp.'.uibudget.index',
-                                                                               
'query'         =>$this->query,
-                                                                               
'start_date'    => $start_date,
-                                                                               
'end_date'=>$end_date)
-                               ));
-                       $i++;
-                       $table_header[$i]['header']     = lang('name');
-                       $table_header[$i]['width']              = '5%';
-                       $table_header[$i]['align']              = 'center';
-                       $table_header[$i]['sort_link']  =true;
-                       $table_header[$i]['sort']               = 
$this->nextmatchs->show_sort_order(array
-                               (
-                                       'sort'  => $this->sort,
-                                       'var'   =>      'name',
-                                       'order' =>      $this->order,
-                                       'extra'         => array('menuaction'   
=> $this->currentapp.'.uibudget.index',
-                                                                               
'query'         =>$this->query,
-                                                                               
'start_date'    => $start_date,
-                                                                               
'end_date'=>$end_date)
-                               ));
-                       $i++;
-
-                       $table_header[$i]['header']     = lang('date');
-                       $table_header[$i]['width']              = '5%';
-                       $table_header[$i]['align']              = 'center';
-                       $table_header[$i]['sort_link']  =true;
-                       $table_header[$i]['sort']               = 
$this->nextmatchs->show_sort_order(array
-                               (
-                                       'sort'  => $this->sort,
-                                       'var'   =>      'name',
-                                       'order' =>      $this->order,
-                                       'extra'         => array('menuaction'   
=> $this->currentapp.'.uibudget.index',
-                                                                               
'query'         =>$this->query,
-                                                                               
'start_date'    => $start_date,
-                                                                               
'end_date'=>$end_date)
-                               ));
-                       $i++;
-                       $table_header[$i]['header']     = lang('User');
-                       $table_header[$i]['width']              = '5%';
-                       $table_header[$i]['align']              = 'center';
-                       $table_header[$i]['sort_link']  =true;
-                       $table_header[$i]['sort']               = 
$this->nextmatchs->show_sort_order(array
-                               (
-                                       'sort'  => $this->sort,
-                                       'var'   =>      'user_id',
-                                       'order' =>      $this->order,
-                                       'extra'         => array('menuaction'   
=> $this->currentapp.'.uibudget.index',
-                                                                               
'query'         =>$this->query,
-                                                                               
'start_date'    => $start_date,
-                                                                               
'end_date'=>$end_date)
-                               ));
-                       $i++;
-
-
-                       if($this->acl_read)
-                       {
-                               $table_header[$i]['width']                      
= '5%';
-                               $table_header[$i]['align']                      
= 'center';
-                               $table_header[$i]['header']                     
= lang('view');
-                               $i++;
-                       }
-                       if($this->acl_edit)
-                       {
-                               $table_header[$i]['width']                      
= '5%';
-                               $table_header[$i]['align']                      
= 'center';
-                               $table_header[$i]['header']                     
= lang('edit');
-                               $i++;
-                       }
-                       if($this->acl_delete)
-                       {
-                               $table_header[$i]['width']                      
= '5%';
-                               $table_header[$i]['align']                      
= 'center';
-                               $table_header[$i]['header']                     
= lang('delete');
-                               $i++;
-                       }
-
 
-                       if($this->acl_add)
+                       if($acl_add)
                        {
                                $table_add = array
                                (
@@ -514,9 +336,14 @@
 
                function edit()
                {
-                       if(!$this->acl_add && !$this->acl_edit)
+
+                       $acl2_location  = '.budget';
+                       $acl_add        = $this->acl2->check($acl2_location,2);
+                       $acl_edit       = $this->acl2->check($acl2_location,4);
+
+                       if(!$acl_add && !$acl_edit)
                        {
-                               
$GLOBALS['phpgw']->redirect_link('/index.php','menuaction='.$this->currentapp.'.uilocation.stop&perm=2&acl_location='
 . $this->acl2_location);
+                               
$GLOBALS['phpgw']->redirect_link('/index.php','menuaction='.$this->currentapp.'.uilocation.stop&perm=2&acl_location='
 . $acl2_location);
                        }
 
                        $budget_id      = 
get_var('budget_id',array('POST','GET'));
@@ -534,14 +361,9 @@
 
                        if ($values['save'] || $values['apply'])
                        {
-                               if(!$values['name'])
+                               if(!$values['budget_cost'])
                                {
-                                       
$receipt['error'][]=array('msg'=>lang('Please enter a name !'));
-                               }
-
-                               if(!$values['sql_text'])
-                               {
-                                       
$receipt['error'][]=array('msg'=>lang('Please enter a sql query !'));
+                                       
$receipt['error'][]=array('msg'=>lang('Please enter a budget cost !'));
                                }
 
                                if(!$receipt['error'])
@@ -549,7 +371,7 @@
                                        $values['budget_id']    = $budget_id;
                                        $receipt = $this->bo->save($values);
                                        $budget_id = $receipt['budget_id'];
-                                       $this->cat_id = 
($values['cat_id']?$values['cat_id']:$this->cat_id);
+                               //      $this->cat_id = 
($values['cat_id']?$values['cat_id']:$this->cat_id);
 
                                        if ($values['save'])
                                        {
@@ -567,7 +389,7 @@
 
                        if ($budget_id)
                        {
-                               $budget = $this->bo->read_single($budget_id);
+                               $values = $this->bo->read_single($budget_id);
                                $this->cat_id = 
($budget['cat_id']?$budget['cat_id']:$this->cat_id);
                        }
 
@@ -580,52 +402,53 @@
 
                        $msgbox_data = $this->bocommon->msgbox_data($receipt);
 
-                       while (is_array($budget['cols']) && list(,$entry) = 
each($budget['cols']))
-                       {
-                               $cols[] = array(
-                                       'id'            => $entry['id'],
-                                       'name'          => $entry['name'],
-                                       'descr'         => $entry['descr'],
-                                       'sorting'       => $entry['sorting'],
-                                       'text_up'       => lang('Up'),
-                                       'text_down'     => lang('Down'),
-                                       'link_up'       => 
$GLOBALS['phpgw']->link('/index.php','menuaction='.$this->currentapp.'.uibudget.edit&resort=up&cols_id='
 . $entry['id'] . '&budget_id=' . $budget_id),
-                                       'link_down'     => 
$GLOBALS['phpgw']->link('/index.php','menuaction='.$this->currentapp.'.uibudget.edit&resort=down&cols_id='
 . $entry['id'] . '&budget_id=' . $budget_id)
-                                       );
-                       }
-
+                       $year[0]['id'] = date(Y);
+                       $year[1]['id'] = date(Y) +1;
+                       $year[2]['id'] = date(Y) +2;
+                       $year[3]['id'] = date(Y) +3;
 
                        $data = array
                        (
-                               'msgbox_data'                                   
=> $GLOBALS['phpgw']->common->msgbox($msgbox_data),
-                               'edit_url'                                      
        => $GLOBALS['phpgw']->link('/index.php',$link_data),
-                               'lang_budget_id'                                
=> lang('ID'),
-                               'value_budget_id'                               
=> $budget_id,
-                               'lang_sql_text'                                 
=> lang('sql'),
-                               'lang_name'                                     
        => lang('name'),
-                               'lang_save'                                     
        => lang('save'),
-                               'lang_cancel'                                   
=> lang('cancel'),
-                               'lang_apply'                                    
=> lang('apply'),
-                               'value_sql_text'                                
=> $budget['sql_text'],
-                               'value_name'                                    
=> $budget['name'],
+                               'lang_revision'                         => 
lang('revision'),
+                               'lang_revision_statustext'              => 
lang('Select revision'),
+                               'revision_list'                         => 
$this->bo->get_revision_list($values['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),
+
+                               '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']),
+                               
+                               'value_year'                            => 
$values['year'],
+                               'value_district_id'                     => 
$values['district_id'],
+                               'value_b_group'                         => 
$values['b_group'],
+                               'value_revision'                        => 
$values['revision'],
+
+                               'msgbox_data'                           => 
$GLOBALS['phpgw']->common->msgbox($msgbox_data),
+                               'edit_url'                              => 
$GLOBALS['phpgw']->link('/index.php',$link_data),
+                               'lang_budget_id'                        => 
lang('ID'),
+                               'value_budget_id'                       => 
$budget_id,
+                               'lang_budget_cost'                      => 
lang('budget cost'),
+                               'lang_remark'                           => 
lang('remark'),
+                               'lang_save'                             => 
lang('save'),
+                               'lang_cancel'                           => 
lang('cancel'),
+                               'lang_apply'                            => 
lang('apply'),
+                               'value_remark'                          => 
$values['remark'],
+                               'value_budget_cost'                     => 
$values['budget_cost'],
                                'lang_name_statustext'                  => 
lang('Enter a name for the query'),
-                               'lang_sql_statustext'                   => 
lang('Enter a sql query'),
+                               'lang_remark_statustext'                => 
lang('Enter a remark'),
                                'lang_apply_statustext'                 => 
lang('Apply the values'),
-                               'lang_cancel_statustext'                => 
lang('Leave the budget untouched and return back to the list'),
-                               'lang_save_statustext'                  => 
lang('Save the budget and return back to the list'),
-                               'lang_no_cat'                                   
=> lang('no category'),
-                               'lang_cat_statustext'                   => 
lang('Select the category the budget belongs to. To do not use a category 
select NO CATEGORY'),
-                               'lang_descr'                                    
=> lang('descr'),
-                               'lang_new_name_statustext'              => 
lang('name'),
-                               'lang_new_descr_statustext'             => 
lang('descr'),
-                               'cols'                                          
        => $cols,
-                               'lang_col_name'                                 
=> lang('Column name'),
-                               'lang_col_descr'                                
=> lang('Column description'),
-                               'lang_delete_column'                    => 
lang('Delete column'),
-                               'lang_delete_cols_statustext'   => lang('Delete 
this column from the output'),
-                               'lang_up_text'                                  
=> lang('Up'),
-                               'lang_down_text'                                
=> lang('Down'),
-                               'lang_sorting'                                  
=> lang('Sorting'),
+                               'lang_cancel_statustext'                => 
lang('Leave the budget untouched and return to the list'),
+                               'lang_save_statustext'                  => 
lang('Save the budget and return to the list'),
+
 
                        );
                        $GLOBALS['phpgw_info']['flags']['app_header'] = 
lang('budget') . ': ' . ($budget_id?lang('edit budget'):lang('add budget'));




reply via email to

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