phpgroupware-cvs
[Top][All Lists]
Advanced

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

[Phpgroupware-cvs] CVS: property/inc class.bocommon.inc.php,1.21,1.22 cl


From: Sigurd Nes <address@hidden>
Subject: [Phpgroupware-cvs] CVS: property/inc class.bocommon.inc.php,1.21,1.22 class.bopricebook.inc.php,1.1,1.2 class.sopricebook.inc.php,1.1,1.2 class.uipricebook.inc.php,1.1,1.2
Date: Sat, 01 Mar 2003 19:39:15 -0500

Update of /cvsroot/phpgroupware/property/inc
In directory subversions:/tmp/cvs-serv17177/inc

Modified Files:
        class.bocommon.inc.php class.bopricebook.inc.php 
        class.sopricebook.inc.php class.uipricebook.inc.php 
Log Message:
no message

Index: class.bocommon.inc.php
===================================================================
RCS file: /cvsroot/phpgroupware/property/inc/class.bocommon.inc.php,v
retrieving revision 1.21
retrieving revision 1.22
diff -C2 -r1.21 -r1.22
*** class.bocommon.inc.php      28 Feb 2003 19:39:00 -0000      1.21
--- class.bocommon.inc.php      2 Mar 2003 00:39:12 -0000       1.22
***************
*** 581,590 ****
                        if ($sub == pricebook && $this->admin_pricebook)
                        {
!                               
$menu['sublang_vendor_activities']=lang('Vendors');
                                
$menu['sub_vendor_activities']=$GLOBALS['phpgw']->link('/index.php','menuaction='.$currentapp.'.uipricebook.index');
  
!                               
$menu['sub_activities_list']=$GLOBALS['phpgw']->link('/index.php','menuaction='.$currentapp.'.uipricebook.index');
                                
$menu['sub_list_agreement']=$GLOBALS['phpgw']->link('/index.php','menuaction='.$currentapp.'.uipricebook.index');
-                               
$menu['sublang_activities_list']=lang('Activities');
                                $menu['sublang_agreement']=lang('Agreement');
                        }
--- 581,591 ----
                        if ($sub == pricebook && $this->admin_pricebook)
                        {
!                               $menu['sublang_vendor_activities']=lang('Per 
Vendor');
                                
$menu['sub_vendor_activities']=$GLOBALS['phpgw']->link('/index.php','menuaction='.$currentapp.'.uipricebook.index');
  
!                               
$menu['sub_activities_list']=$GLOBALS['phpgw']->link('/index.php','menuaction='.$currentapp.'.uipricebook.activity');
!                               $menu['sublang_activities_list']=lang('Per 
Agreement');
! 
                                
$menu['sub_list_agreement']=$GLOBALS['phpgw']->link('/index.php','menuaction='.$currentapp.'.uipricebook.index');
                                $menu['sublang_agreement']=lang('Agreement');
                        }

Index: class.bopricebook.inc.php
===================================================================
RCS file: /cvsroot/phpgroupware/property/inc/class.bopricebook.inc.php,v
retrieving revision 1.1
retrieving revision 1.2
diff -C2 -r1.1 -r1.2
*** class.bopricebook.inc.php   28 Feb 2003 19:39:00 -0000      1.1
--- class.bopricebook.inc.php   2 Mar 2003 00:39:12 -0000       1.2
***************
*** 100,109 ****
                                                                                
        'filter' => $this->filter,'cat_id' => 
$this->cat_id,'allrows'=>$this->allrows));
                        $this->total_records = $this->so->total_records;
  
!                       for ($i=0; $i<count($pricebook); $i++)
!                       {
!                               $pricebook[$i]['date']  = 
$GLOBALS['phpgw']->common->show_date($pricebook[$i]['date']);
!                               $pricebook[$i]['owner'] = 
$GLOBALS['phpgw']->accounts->id2name($pricebook[$i]['owner']);
!                       }
                        return $pricebook;
                }
--- 100,111 ----
                                                                                
        'filter' => $this->filter,'cat_id' => 
$this->cat_id,'allrows'=>$this->allrows));
                        $this->total_records = $this->so->total_records;
+                       return $pricebook;
+               }
  
!               function read_activities_pr_aggreement()
!               {
!                       $pricebook = 
$this->so->read_activities_pr_aggreement(array('start' => $this->start,'query' 
=> $this->query,'sort' => $this->sort,'order' => $this->order,
!                                                                               
        'filter' => $this->filter,'cat_id' => 
$this->cat_id,'allrows'=>$this->allrows));
!                       $this->total_records = $this->so->total_records;
                        return $pricebook;
                }
***************
*** 219,222 ****
--- 221,265 ----
  
                        return $vendor_list;
+               }
+ 
+               function get_agreement_list($format='',$selected='')
+               {
+                       switch($format)
+                       {
+                               case 'select':
+                                       
$GLOBALS['phpgw']->xslttpl->add_file(array('cat_select'));
+                                       break;
+                               case 'filter':
+                                       
$GLOBALS['phpgw']->xslttpl->add_file(array('cat_filter'));
+                                       break;
+                       }
+ 
+                       $agreements= $this->so->get_agreement_list();
+ 
+                       while (is_array($agreements) && list(,$agreement_entry) 
= each($agreements))
+                       {
+                               $sel_agreement_entry = '';
+                               if ($agreement_entry['id']==$selected)
+                               {
+                                       $sel_agreement_entry = 'selected';
+                               }
+ 
+                               $agreement_list[] = array
+                               (
+                                       'cat_id'        => 
$agreement_entry['id'],
+                                       'name'          => 
$agreement_entry['name'],
+                                       'selected'      => $sel_agreement_entry
+                               );
+                       }
+ 
+                       for ($i=0;$i<count($agreement_list);$i++)
+                       {
+                               if ($agreement_list[$i]['selected'] != 
'selected')
+                               {
+                                       unset($agreement_list[$i]['selected']);
+                               }
+                       }
+ 
+                       return $agreement_list;
                }
  

Index: class.sopricebook.inc.php
===================================================================
RCS file: /cvsroot/phpgroupware/property/inc/class.sopricebook.inc.php,v
retrieving revision 1.1
retrieving revision 1.2
diff -C2 -r1.1 -r1.2
*** class.sopricebook.inc.php   28 Feb 2003 19:39:00 -0000      1.1
--- class.sopricebook.inc.php   2 Mar 2003 00:39:12 -0000       1.2
***************
*** 65,69 ****
                                        (
                                                'id'    => 
$this->db->f('vendor_id'),
!                                               'name'  => 
$this->db->f('org_name'),
                                        );
                                }
--- 65,69 ----
                                        (
                                                'id'    => 
$this->db->f('vendor_id'),
!                                               'name'  => 
$this->db->f('org_name')
                                        );
                                }
***************
*** 71,74 ****
--- 71,88 ----
                }
  
+               function get_agreement_list()
+               {
+                       $this->db->query("SELECT * FROM fm_wo_agreement ORDER 
BY descr asc");
+                       while ($this->db->next_record())
+                       {
+                               $agreement_list[]=array
+                               (
+                                       'id'    => $this->db->f('id'),
+                                       'name'  => 
$GLOBALS['phpgw']->strip_html($this->db->f('descr')).' [ '. 
$GLOBALS['phpgw']->strip_html($this->db->f('status')).' ] '
+                               );
+                       }
+                       return $agreement_list;
+               }
+ 
                function read($data)
                {
***************
*** 113,118 ****
                        }
  
-                       $sql = "SELECT * FROM fm_building WHERE $filtermethod 
$querymethod";
- 
                        $sql = "SELECT 
fm_wo_activities.num,fm_wo_activities.unit,fm_wo_activities.descr as 
descr,activity_id, phpgw_addressbook.org_name,fm_wo_branch.descr as branch 
,vendor_id,total_cost,m_cost,w_cost,index_count,fm_wo_activity_price_index.this_index
 "
                                . " FROM (fm_wo_activities  $this->join 
fm_wo_activity_price_index ON fm_wo_activities.id = 
fm_wo_activity_price_index.activity_id) $this->join phpgw_addressbook ON 
fm_wo_activity_price_index.vendor_id = phpgw_addressbook.id "
--- 127,130 ----
***************
*** 150,153 ****
--- 162,247 ----
                                        'index_count'           => 
$this->db->f('index_count'),
                                        'grants'                        => 
$ngrants
+                               );
+                       }
+ //            _debug_array($pricebook);
+                       return $pricebook;
+               }
+ 
+               function read_activities_pr_aggreement($data)
+               {
+                       if(is_array($data))
+                       {
+                               if ($data['start'])
+                               {
+                                       $start=$data['start'];
+                               }
+                               else
+                               {
+                                       $start=0;
+                               }
+                               $filter = 
(isset($data['filter'])?$data['filter']:'none');
+                               $query = 
(isset($data['query'])?$data['query']:'');
+                               $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']:'');
+                       }
+ 
+                       if ($order)
+                       {
+                               $ordermethod = " order by $order $sort";
+                       }
+                       else
+                       {
+                               $ordermethod = " order by activity_id asc";
+                       }
+ 
+                       if ($cat_id > 0)
+                       {
+                               $filtermethod .= " Where agreement_id='$cat_id' 
";
+                       }
+                       else
+                       {
+                               $filtermethod = " Where agreement_id = ''";
+                       }
+                       if($query)
+                       {
+                               $query = ereg_replace("'",'',$query);
+                               $query = ereg_replace('"','',$query);
+ 
+ //                            $querymethod = " AND (fm_wo_activities.descr 
LIKE '%$query%' or fm_wo_activities.num LIKE '%$query%')";
+                               $querymethod = " and (fm_wo_activities.descr 
like '%$query%' or fm_wo_activities.base_descr like '%$query%' or 
fm_wo_activities.num like '%$query%') ";
+                       }
+ 
+                       $sql = "SELECT fm_wo_activities.id AS activity_id, 
fm_wo_activities.num, fm_wo_activities.base_descr, fm_wo_activities.unit, 
fm_wo_activities.dim_d, fm_wo_branch.descr as branch, fm_wo_activities.descr, 
ns3420 "
+                               . " FROM  fm_wo_activities $this->join 
fm_wo_branch on fm_wo_activities.branch_id=fm_wo_branch.id"
+                               . " $filtermethod $querymethod ";
+ 
+                       $this->db2->query($sql,__LINE__,__FILE__);
+                       $this->total_records = $this->db2->num_rows();
+ 
+                       if(!$allrows)
+                       {
+                               $this->db->limit_query($sql . 
$ordermethod,$start,__LINE__,__FILE__);
+                       }
+                       else
+                       {
+                               $this->db->query($sql . 
$ordermethod,__LINE__,__FILE__);
+                       }
+ 
+                       while ($this->db->next_record())
+                       {
+                               $ngrants = 
(int)$this->grants[$this->db->f('building_owner')];
+                               $pricebook[] = array
+                               (
+                                       'activity_id'   => 
$this->db->f('activity_id'),
+                                       'num'                   => 
$this->db->f('num'),
+                                       'base_descr'    => 
stripslashes($this->db->f('base_descr')),
+                                       'branch'                => 
$this->db->f('branch'),
+                                       'dim_d'                 => 
$this->db->f('dim_d'),
+                                       'ns3420'                => 
$this->db->f('ns3420'),
+                                       'unit'                  => 
$this->db->f('unit'),
+                                       'descr'                 => 
stripslashes($this->db->f('descr')),
+                                       'grants'                => $ngrants
                                );
                        }

Index: class.uipricebook.inc.php
===================================================================
RCS file: /cvsroot/phpgroupware/property/inc/class.uipricebook.inc.php,v
retrieving revision 1.1
retrieving revision 1.2
diff -C2 -r1.1 -r1.2
*** class.uipricebook.inc.php   28 Feb 2003 19:39:00 -0000      1.1
--- class.uipricebook.inc.php   2 Mar 2003 00:39:12 -0000       1.2
***************
*** 22,29 ****
                var $public_functions = array
                (
!                       'index'  => True,
!                       'view'   => True,
!                       'edit'   => True,
!                       'delete' => True
                );
  
--- 22,30 ----
                var $public_functions = array
                (
!                       'activity'              => True,
!                       'index'                 => True,
!                       'view'                  => True,
!                       'edit_activity' => True,
!                       'delete'                => True
                );
  
***************
*** 130,134 ****
                                                                                
        'order' =>      $this->order,
                                                                                
        'extra'         => array('menuaction'   => 
$this->currentapp.'.uipricebook.index',
!                                                                               
                                                        'cat_id'        
=>$this->cat_id)
                                                                                
)),
                                'lang_index_count'      => lang('Index Count'),
--- 131,136 ----
                                                                                
        'order' =>      $this->order,
                                                                                
        'extra'         => array('menuaction'   => 
$this->currentapp.'.uipricebook.index',
!                                                                               
                                                        'cat_id'        
=>$this->cat_id,
!                                                                               
                                                        'allrows'       
=>$this->allrows)
                                                                                
)),
                                'lang_index_count'      => lang('Index Count'),
***************
*** 153,157 ****
                                                                                
        'order' =>      $this->order,
                                                                                
        'extra'         => array('menuaction'   => 
$this->currentapp.'.uipricebook.index',
!                                                                               
                                                        'cat_id'        
=>$this->cat_id)
                                                                                
))
                        );
--- 155,160 ----
                                                                                
        'order' =>      $this->order,
                                                                                
        'extra'         => array('menuaction'   => 
$this->currentapp.'.uipricebook.index',
!                                                                               
                                                        'cat_id'        
=>$this->cat_id,
!                                                                               
                                                        'allrows'       
=>$this->allrows)
                                                                                
))
                        );
***************
*** 178,188 ****
                        );
  
-                       $table_add[] = array
-                       (
-                               'lang_add'                              => 
lang('add'),
-                               'lang_add_statustext'   => lang('add a 
building'),
-                               'add_action'                    => 
$GLOBALS['phpgw']->link('/index.php','menuaction='.$this->currentapp.'.uipricebook.edit')
-                       );
- 
                        $link_data = array
                        (
--- 181,184 ----
***************
*** 236,250 ****
                                'values'                                        
        => $content,
                                'table_update'                                  
=> $table_update,
!                               'update_action'                                 
=> 
$GLOBALS['phpgw']->link('/index.php','menuaction='.$this->currentapp.'.uipricebook.index'),
                                'table_add'                                     
        => $table_add
                        );
  
!                       
$GLOBALS['phpgw']->xslttpl->set_var('phpgw',array('list' => $data));
                        $this->save_sessiondata();
                }
  
!               function edit()
                {
!                       $property_id                    = 
get_var('property_id',array('GET'));
                        $building_id                    = 
get_var('building_id',array('POST','GET'));
                        $values                                 = 
get_var('values',array('POST','GET'));
--- 232,377 ----
                                'values'                                        
        => $content,
                                'table_update'                                  
=> $table_update,
!                               'update_action'                                 
=> 
$GLOBALS['phpgw']->link('/index.php','menuaction='.$this->currentapp.'.uipricebook.index')
                   );
! 
!                       
$GLOBALS['phpgw']->xslttpl->set_var('phpgw',array('list' => $data));
!                       $this->save_sessiondata();
!               }
! 
!               function activity()
!               {
! 
!                       $GLOBALS['phpgw']->xslttpl->add_file(array('pricebook',
!                                                                               
'menu',
!                                                                               
'nextmatchs',
!                                                                               
$GLOBALS['phpgw']->common->get_tpl_dir('phpgwapi','default') . SEP . 
'app_header',
!                                                                               
$GLOBALS['phpgw']->common->get_tpl_dir('phpgwapi','default') . SEP . 
'filter_select',
!                                                                               
$GLOBALS['phpgw']->common->get_tpl_dir('phpgwapi','default') . SEP . 
'search_field'));
! 
!                       $links = $this->bocommon->menu();
! 
!                       $values                         = 
get_var('values',array('POST'));
!                       $values['date']         = get_var('date',array('POST'));
! 
! //_debug_array($values);
!                       if($values['submit_update'])
!                       {
!                               $receipt=$this->bo->update_pricebook($values);
!                       }
! 
! 
!                       $pricebook_list = 
$this->bo->read_activities_pr_aggreement();
! //_debug_array($pricebook_list);
!                       while (is_array($pricebook_list) && list(,$pricebook) = 
each($pricebook_list))
!                       {
!                               $content[] = array
!                               (
!                                       'activity_id'                           
=> $pricebook['activity_id'],
!                                       'num'                                   
        => $pricebook['num'],
!                                       'branch'                                
        => $pricebook['branch'],
!                                       'base_descr'                            
=> $pricebook['base_descr'],
!                                       'dim_d'                                 
        => $pricebook['dim_d'],
!                                       'ns3420'                                
        => $pricebook['ns3420'],
!                                       'unit'                                  
        => $pricebook['unit'],
!                                       'descr'                                 
        => $pricebook['descr'],
!                                       'link_vendor'                           
=> 
$GLOBALS['phpgw']->link('/index.php','menuaction='.$this->currentapp.'.uipricebook.vendor&activity_id='
 . $pricebook['activity_id'].'&agreement=' . $this->cat_id),
!                                       'link_edit'                             
        => 
$GLOBALS['phpgw']->link('/index.php','menuaction='.$this->currentapp.'.uipricebook.edit_activity&activity_id='
 . $pricebook['activity_id'].'&agreement=' . $this->cat_id),
!                                       'link_delete'                           
=> 
$GLOBALS['phpgw']->link('/index.php','menuaction='.$this->currentapp.'.uipricebook.delete&activity_id='
 . $pricebook['property_id']),
!                                       'lang_vendor_statustext'        => 
lang('view the vendor(s) for this activity'),
!                                       'lang_edit_statustext'          => 
lang('edit this activity'),
!                                       'lang_delete_statustext'        => 
lang('delete this activity'),
!                                       'text_vendor'                           
=> lang('vendor'),
!                                       'text_edit'                             
        => lang('edit'),
!                                       'text_delete'                           
=> lang('delete')
!                               );
!                       }
! 
!                       $table_header[] = array
!                       (
!                               'sort_num'      => 
$this->nextmatchs->show_sort_order(array
!                                                                               
(
!                                                                               
        'sort'  => $this->sort,
!                                                                               
        'var'   =>      'num',
!                                                                               
        'order' =>      $this->order,
!                                                                               
        'extra'         => array('menuaction'   => 
$this->currentapp.'.uipricebook.activity',
!                                                                               
                                                        'cat_id'        
=>$this->cat_id,
!                                                                               
                                                        'allrows'       
=>$this->allrows)
!                                                                               
)),
!                               'lang_num'                      => 
lang('Activity Num'),
!                               'lang_branch'           => lang('Branch'),
!                               'lang_vendor'           => lang('Vendor'),
!                               'lang_descr'            => lang('Description'),
!                               'lang_base_descr'       => lang('Base'),
!                               'lang_dim_d'            => lang('Dim d'),
!                               'lang_ns3420'           => lang('NS3420'),
!                               'lang_unit'                     => lang('Unit'),
!                               'lang_edit'                     => lang('edit'),
!                               'lang_delete'           => lang('delete')
!                       );
! 
!                       $table_add[] = array
!                       (
!                               'lang_add'                              => 
lang('add'),
!                               'lang_add_statustext'   => lang('add a 
building'),
!                               'add_action'                    => 
$GLOBALS['phpgw']->link('/index.php','menuaction='.$this->currentapp.'.uipricebook.edit_activity&agreement='
 . $this->cat_id)
!                       );
! 
!                       $link_data = array
!                       (
!                               'menuaction'    => 
$this->currentapp.'.uipricebook.activity',
!                                               'sort'                  
=>$this->sort,
!                                               'order'                 
=>$this->order,
!                                               'cat_id'                
=>$this->cat_id,
!                                               'filter'                
=>$this->filter,
!                                               'query'                 
=>$this->query
!                       );
! 
!                       if(!$this->allrows)
!                       {
!                               $record_limit   = 
$GLOBALS['phpgw_info']['user']['preferences']['common']['maxmatchs'];
!                       }
!                       else
!                       {
!                               $record_limit   = $this->bo->total_records;
!                       }
! 
!                       $data = array
!                       (
!                               'error'                                         
        => $receipt['error'],
!                               'message'                                       
        => $receipt['message'],
!                               'links'                                         
        => $links,
!                               'allrows'                                       
        => $this->allrows,
!                               'allow_allrows'                                 
=> true,
!                               'start_record'                                  
=> $this->start,
!                               'record_limit'                                  
=> $record_limit,
!                               'num_records'                                   
=> count($pricebook_list),
!                               'all_records'                                   
=> $this->bo->total_records,
!                               'lang_select_all'                               
=> lang('Select All'),
!                               'link_url'                                      
        => $GLOBALS['phpgw']->link('/index.php',$link_data),
!                               'img_path'                                      
        => $GLOBALS['phpgw']->common->get_image_path('phpgwapi'),
!                               'appname'                                       
        => lang($this->currentapp),
!                               'function_msg'                                  
=> lang('list activities per agreement'),
!                               'lang_no_cat'                                   
=> lang('select agreement'),
!                               'lang_cat_statustext'                   => 
lang('Select the agreement the pricebook belongs to. To do not use a category 
select NO CATEGORY'),
!                               'select_name'                                   
=> 'cat_id',
!                               'cat_list'                                      
        => $this->bo->get_agreement_list('filter',$this->cat_id),
!                               'select_action'                                 
=> $GLOBALS['phpgw']->link('/index.php',$link_data),
!                               'filter_list'                                   
=> $this->nextmatchs->xslt_filter(array('filter' => $this->filter,'yours' => 
'yes')),
!                               'lang_filter_statustext'                => 
lang('Select the filter. To show all entries select SHOW ALL'),
!                               '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_submit'                                   
=> lang('submit'),
!                               'table_header_activities'               => 
$table_header,
!                               'values_activities'                             
=> $content,
                                'table_add'                                     
        => $table_add
                        );
  
!                       
$GLOBALS['phpgw']->xslttpl->set_var('phpgw',array('list_activities' => $data));
                        $this->save_sessiondata();
                }
  
!               function edit_activity()
                {
!                       $agreement                      = 
get_var('agreement',array('GET'));
                        $building_id                    = 
get_var('building_id',array('POST','GET'));
                        $values                                 = 
get_var('values',array('POST','GET'));
***************
*** 400,404 ****
                                'select_name'                                   
=> 'values[cat_id]',
                                'lang_remark_statustext'                => 
lang('Enter any remarks regarding this building'),
!                               'cat_list'                                      
        => 
$this->bocommon->select_category_building_list('select',$values['cat_id'])
                        );
  
--- 527,531 ----
                                'select_name'                                   
=> 'values[cat_id]',
                                'lang_remark_statustext'                => 
lang('Enter any remarks regarding this building'),
!                               'cat_list'                                      
        => $this->bo->get_agreement_list('select',$agreement)
                        );
  





reply via email to

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