phpgroupware-cvs
[Top][All Lists]
Advanced

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

[Phpgroupware-cvs] CVS: inv/inc class.boinventory.inc.php,1.4,1.5 class.


From: Bettina gille <address@hidden>
Subject: [Phpgroupware-cvs] CVS: inv/inc class.boinventory.inc.php,1.4,1.5 class.soinventory.inc.php,1.2,1.3 class.uiinventory.inc.php,1.4,1.5 hook_preferences.inc.php,1.13,1.14
Date: Wed, 16 Jan 2002 20:49:07 -0500

Update of /cvsroot/phpgroupware/inv/inc
In directory subversions:/tmp/cvs-serv23844/inc

Modified Files:
        class.boinventory.inc.php class.soinventory.inc.php 
        class.uiinventory.inc.php hook_preferences.inc.php 
Log Message:
update

Index: class.boinventory.inc.php
===================================================================
RCS file: /cvsroot/phpgroupware/inv/inc/class.boinventory.inc.php,v
retrieving revision 1.4
retrieving revision 1.5
diff -C2 -r1.4 -r1.5
*** class.boinventory.inc.php   16 Jan 2002 02:14:16 -0000      1.4
--- class.boinventory.inc.php   17 Jan 2002 01:49:04 -0000      1.5
***************
*** 61,70 ****
                        }
  
!                       $start  = $GLOBALS['HTTP_POST_VARS']['start']  ? 
$GLOBALS['HTTP_POST_VARS']['start']  : $GLOBALS['HTTP_GET_VARS']['start'];
!                       $query  = $GLOBALS['HTTP_POST_VARS']['query']  ? 
$GLOBALS['HTTP_POST_VARS']['query']  : $GLOBALS['HTTP_GET_VARS']['query'];
!                       $sort   = $GLOBALS['HTTP_POST_VARS']['sort']   ? 
$GLOBALS['HTTP_POST_VARS']['sort']   : $GLOBALS['HTTP_GET_VARS']['sort'];
!                       $order  = $GLOBALS['HTTP_POST_VARS']['order']  ? 
$GLOBALS['HTTP_POST_VARS']['order']  : $GLOBALS['HTTP_GET_VARS']['order'];
!                       $cat_id = $GLOBALS['HTTP_POST_VARS']['cat_id'] ? 
$GLOBALS['HTTP_POST_VARS']['cat_id'] : $GLOBALS['HTTP_GET_VARS']['cat_id'];
!                       $action = $GLOBALS['HTTP_POST_VARS']['action'] ? 
$GLOBALS['HTTP_POST_VARS']['action'] : $GLOBALS['HTTP_GET_VARS']['action'];
                        $product_id = $GLOBALS['HTTP_POST_VARS']['product_id'] 
? $GLOBALS['HTTP_POST_VARS']['product_id'] : 
$GLOBALS['HTTP_GET_VARS']['product_id'];
  
--- 61,70 ----
                        }
  
!                       $start          = $GLOBALS['HTTP_POST_VARS']['start']  
? $GLOBALS['HTTP_POST_VARS']['start']  : $GLOBALS['HTTP_GET_VARS']['start'];
!                       $query          = $GLOBALS['HTTP_POST_VARS']['query']  
? $GLOBALS['HTTP_POST_VARS']['query']  : $GLOBALS['HTTP_GET_VARS']['query'];
!                       $sort           = $GLOBALS['HTTP_POST_VARS']['sort']   
? $GLOBALS['HTTP_POST_VARS']['sort']   : $GLOBALS['HTTP_GET_VARS']['sort'];
!                       $order          = $GLOBALS['HTTP_POST_VARS']['order']  
? $GLOBALS['HTTP_POST_VARS']['order']  : $GLOBALS['HTTP_GET_VARS']['order'];
!                       $cat_id         = $GLOBALS['HTTP_POST_VARS']['cat_id'] 
? $GLOBALS['HTTP_POST_VARS']['cat_id'] : $GLOBALS['HTTP_GET_VARS']['cat_id'];
!                       $action         = $GLOBALS['HTTP_POST_VARS']['action'] 
? $GLOBALS['HTTP_POST_VARS']['action'] : $GLOBALS['HTTP_GET_VARS']['action'];
                        $product_id = $GLOBALS['HTTP_POST_VARS']['product_id'] 
? $GLOBALS['HTTP_POST_VARS']['product_id'] : 
$GLOBALS['HTTP_GET_VARS']['product_id'];
  
***************
*** 77,88 ****
                                $this->query = $query;
                        }
!                       if(isset($cat_id))
                        {
!                               $this->cat_id = $cat_id;
                        }
!                       if($cat_id == '0' || $cat_id == 0 || $cat_id == '')
                        {
!                               unset($this->cat_id);
                        }
                        if(isset($product_id))
                        {
--- 77,107 ----
                                $this->query = $query;
                        }
! 
!                       if($cat_id == '0' || $cat_id == 0 || $cat_id == '')
                        {
!                               $prefs = $this->read_prefs();
!                               if ($prefs['cat_id'])
!                               {
!                                       $this->cat_id = $prefs['cat_id'];
!                               }
!                               else
!                               {
!                                       $this->cat_id = 999;
!                               }
                        }
!                       else
                        {
!                               $this->cat_id = $cat_id;
                        }
+ 
+       /*              $this->oldcat = $this->cat_id;
+ 
+                       if ($this->oldcat != $cat_id)
+                       { */
+                               $data = $this->select_cats_data($this->cat_id);
+                               $this->taxpercent       = $data['taxpercent'];
+                               $this->number           = $data['number'];
+               //      }
+ 
                        if(isset($product_id))
                        {
***************
*** 93,96 ****
--- 112,116 ----
                                unset($this->product_id);
                        }
+ 
                        if(isset($sort) && !empty($sort))
                        {
***************
*** 109,113 ****
                function save_sessiondata($data)
                {
!                       
$GLOBALS['phpgw']->session->appsession('session_data','inv',$data);
                }
  
--- 129,141 ----
                function save_sessiondata($data)
                {
!                       if ($this->use_session)
!                       {
!                               $data['oldcat'] = $data['cat_id'];
!                               $cat_data = 
$this->select_cats_data($data['cat_id']);
!                               $data['taxpercent']     = 
$cat_data['taxpercent'];
!                               $data['number']         = $cat_data['number'];
! 
!                               
$GLOBALS['phpgw']->session->appsession('session_data','inv',$data);
!                       }
                }
  
***************
*** 125,128 ****
--- 153,168 ----
                                $this->cat_id = $data['cat_id'];
                        }
+                       if(isset($data['oldcat']))
+                       {
+                               $this->oldcat = $data['oldcat'];
+                       }
+                       if(isset($data['taxpercent']))
+                       {
+                               $this->taxpercent = $data['taxpercent'];
+                       }
+                       if(isset($data['number']))
+                       {
+                               $this->number = $data['number'];
+                       }
                        if(isset($data['product_id']))
                        {
***************
*** 131,145 ****
                }
  
!               function save_sessiondata($data)
                {
!                       if ($this->use_session)
!                       {
!                               
$GLOBALS['phpgw']->session->appsession('session_data','inv', $data);
!                       }
                }
  
!               function formatted_list($data)
                {
!                       return $this->cats->formated_list($data);
                }
  
--- 171,182 ----
                }
  
!               function formatted_cat_list()
                {
!                       return $this->cats->formated_list(array('format' => 
'select','type' => 'all','selected' => $this->cat_id));
                }
  
!               function return_single_cat()
                {
!                       return $this->cats->return_single($this->cat_id);
                }
  
***************
*** 178,183 ****
                function read_single_contact($abid)
                {
!                       $cols = array('org_name' => 'org_name');
!                       return $this->contacts->read_single_entry($abid,$cols);
                }
  
--- 215,224 ----
                function read_single_contact($abid)
                {
!                       $cols = array('n_given' => 'n_given',
!                                               'n_family' => 'n_family',
!                                               'org_name' => 'org_name');
! 
!                       $entry = 
$this->contacts->read_single_entry($abid,$cols);
!                       return $entry;
                }
  
***************
*** 232,238 ****
  // selects the tax from products category
  
                function select_tax($cat_id)
                {
!                       $cat_data = $this->cats->id2name($this->cat_id,'data');
                        $data = unserialize($cat_data);
                        $tax = $data['tax'];
--- 273,289 ----
  // selects the tax from products category
  
+               function select_cats_data($cat_id)
+               {
+                       $cat_data = $this->cats->id2name($cat_id,'data');
+                       $data = unserialize($cat_data);
+                       $tax = $data['tax'];
+                       $cat['taxpercent'] = ($data['tax']/100);
+                       $cat['number'] = $data['number'];
+                       return $cat;
+               }
+ 
                function select_tax($cat_id)
                {
!                       $cat_data = $this->cats->id2name($cat_id,'data');
                        $data = unserialize($cat_data);
                        $tax = $data['tax'];
***************
*** 243,247 ****
                function select_number($cat_id)
                {
!                       $cat_data = $this->cats->id2name($this->cat_id,'data');
                        $data = unserialize($cat_data);
  
--- 294,298 ----
                function select_number($cat_id)
                {
!                       $cat_data = $this->cats->id2name($cat_id,'data');
                        $data = unserialize($cat_data);
  
***************
*** 256,262 ****
                }
  
!               function read_products($limit,$object,$cat_id,$status)
                {
!                       $pro = 
$this->soinv->read_products($this->start,$limit,$this->query,$object,$cat_id,$this->sort,$this->order,$status);
                        $this->total_records = $this->soinv->total_records;
                        return $pro;
--- 307,313 ----
                }
  
!               function read_products($limit,$object,$status)
                {
!                       $pro = 
$this->soinv->read_products($this->start,$limit,$this->query,$object,$this->cat_id,$this->sort,$this->order,$status);
                        $this->total_records = $this->soinv->total_records;
                        return $pro;
***************
*** 302,306 ****
                                $maxnum = 
$this->soinv->max_product_number($number);
                                $sub = strlen($number);
!                               $max = add_leading_zero(substr($maxnum,$sub));
                                return $number . $max;
                        }
--- 353,357 ----
                                $maxnum = 
$this->soinv->max_product_number($number);
                                $sub = strlen($number);
!                               $max = 
$this->add_leading_zero(substr($maxnum,$sub));
                                return $number . $max;
                        }
***************
*** 427,438 ****
                        }
  
!                       if (! 
checkdate($values['pmonth'],$values['pday'],$values['pyear']))
                        {
!                               $error[] = lang('You have entered an invalid 
purchase date !');
                        }
  
!                       if (! 
checkdate($values['smonth'],$values['sday'],$values['syear']))
                        {
!                               $error[] = lang('You have entered an invalid 
selling date !');
                        }
  
--- 478,495 ----
                        }
  
!                       if ($values['pmonth'] || $values['pday'] || 
$values['pyear'])
                        {
!                               if (! 
checkdate($values['pmonth'],$values['pday'],$values['pyear']))
!                               {
!                                       $error[] = lang('You have entered an 
invalid purchase date !');
!                               }
                        }
  
!                       if ($values['smonth'] || $values['sday'] || 
$values['syear'])
                        {
!                               if (! 
checkdate($values['smonth'],$values['sday'],$values['syear']))
!                               {
!                                       $error[] = lang('You have entered an 
invalid selling date !');
!                               }
                        }
  
***************
*** 476,480 ****
                                $this->soinv->add_product($values);
                        }
!                       return $values['retail'];
                }
        }
--- 533,599 ----
                                $this->soinv->add_product($values);
                        }
!                       return array('retail' => $values['retail'],'num' => 
$values['num']);
!               }
! 
!               function read_prefs()
!               {
!                       $GLOBALS['phpgw']->preferences->read_repository();
! 
!                       $prefs = array();
! 
!                       if 
($GLOBALS['phpgw_info']['user']['preferences']['inv'])
!                       {
!                               $prefs['print_format']  = 
$GLOBALS['phpgw_info']['user']['preferences']['inv']['print_format'];
!                               $prefs['abid']                  = 
$GLOBALS['phpgw_info']['user']['preferences']['inv']['abid'];
!                               $prefs['cat_id']                = 
$GLOBALS['phpgw_info']['user']['preferences']['inv']['cat_id'];
!                       }
!                       return $prefs;
!               }
! 
!               function save_prefs($prefs)
!               {
!                       $GLOBALS['phpgw']->preferences->read_repository();
! 
!                       if ($prefs)
!                       {
!                               
$GLOBALS['phpgw']->preferences->change('inv','print_format',$prefs['print_format']);
!                               
$GLOBALS['phpgw']->preferences->change('inv','abid',$prefs['abid']);
!                               
$GLOBALS['phpgw']->preferences->change('inv','cat_id',$prefs['cat_id']);
!                               
$GLOBALS['phpgw']->preferences->save_repository(True);
!                       }
!               }
! 
!               function check_prefs()
!               {
!                       $prefs = $this->get_prefs();
! 
!                       if (! isset($prefs['country']) || (! 
isset($prefs['currency'])))
!                       {
!                               $error[] = lang('Please set your global 
preferences !');
!                       }
! 
!                       if (! isset($prefs['abid']) || (! 
isset($prefs['print_format'])) || (! isset($prefs['cat_id'])))
!                       {
!                               $error[] = lang('Please set your preferences 
for this application !');
!                       }
!                       return $error;
!               }
! 
!               function get_prefs()
!               {
!                       $GLOBALS['phpgw']->preferences->read_repository();
! 
!                       $prefs = array();
! 
!                       $prefs['currency']      = 
$GLOBALS['phpgw_info']['user']['preferences']['common']['currency'];
!                       $prefs['country']       = 
$GLOBALS['phpgw_info']['user']['preferences']['common']['country'];
! 
!                       if 
($GLOBALS['phpgw_info']['user']['preferences']['inv'])
!                       {
!                               $prefs['abid']                  = 
$GLOBALS['phpgw_info']['user']['preferences']['inv']['abid'];
!                               $prefs['print_format']  = 
$GLOBALS['phpgw_info']['user']['preferences']['inv']['print_format'];
!                               $prefs['cat_id']                = 
$GLOBALS['phpgw_info']['user']['preferences']['inv']['cat_id'];
!                       }
!                       return $prefs;
                }
        }

Index: class.soinventory.inc.php
===================================================================
RCS file: /cvsroot/phpgroupware/inv/inc/class.soinventory.inc.php,v
retrieving revision 1.2
retrieving revision 1.3
diff -C2 -r1.2 -r1.3
*** class.soinventory.inc.php   16 Jan 2002 01:32:05 -0000      1.2
--- class.soinventory.inc.php   17 Jan 2002 01:49:04 -0000      1.3
***************
*** 429,437 ****
                function add_product($values)
                {
!                       $values['name']         = 
$this->db_addslashes($values['name']);
!                       $values['descr']        = 
$this->db_addslashes($values['descr']);
!                       $values['note']         = 
$this->db_addslashes($values['note']);
!                       $values['url']          = 
$this->db_addslashes($values['url']);
!                       $values['ftp']          = 
$this->db_addslashes($values['ftp']);
  
                        $this->db->query("insert into phpgw_inv_products 
(id,serial,name,descr,category,status,cost,price,retail,stock,mstock,url,ftp,dist,"
--- 429,437 ----
                function add_product($values)
                {
!                       $values['name']         = 
$this->db->db_addslashes($values['name']);
!                       $values['descr']        = 
$this->db->db_addslashes($values['descr']);
!                       $values['note']         = 
$this->db->db_addslashes($values['note']);
!                       $values['url']          = 
$this->db->db_addslashes($values['url']);
!                       $values['ftp']          = 
$this->db->db_addslashes($values['ftp']);
  
                        $this->db->query("insert into phpgw_inv_products 
(id,serial,name,descr,category,status,cost,price,retail,stock,mstock,url,ftp,dist,"
***************
*** 443,450 ****
                }
  
- 
                function max_product_number($number) 
                {
!                       return $this->db->query("select max(id) from 
phpgw_inv_products where id like ('$number%')");
                }
        }
--- 443,453 ----
                }
  
                function max_product_number($number) 
                {
!                       $this->db->query("select max(id) from 
phpgw_inv_products where id like ('$number%')");
!                       if ($this->db->next_record())
!                       {
!                               return $this->db->f(0);
!                       }
                }
        }

Index: class.uiinventory.inc.php
===================================================================
RCS file: /cvsroot/phpgroupware/inv/inc/class.uiinventory.inc.php,v
retrieving revision 1.4
retrieving revision 1.5
diff -C2 -r1.4 -r1.5
*** class.uiinventory.inc.php   16 Jan 2002 02:14:16 -0000      1.4
--- class.uiinventory.inc.php   17 Jan 2002 01:49:04 -0000      1.5
***************
*** 34,38 ****
                (
                        'list_products' => True,
!                       'edit_product'  => true
                );
  
--- 34,39 ----
                (
                        'list_products' => True,
!                       'edit_product'  => True,
!                       'preferences'   => True
                );
  
***************
*** 52,55 ****
--- 53,58 ----
                        $this->sort                                             
                = $this->boinv->sort;
                        $this->cat_id                                           
        = $this->boinv->cat_id;
+                       $this->taxpercent                                       
        = $this->boinv->taxpercent;
+                       $this->number                                           
        = $this->boinv->number;
                        $this->action                                           
        = $this->boinv->action;
                        $this->product_id                                       
        = $this->boinv->product_id;
***************
*** 168,177 ****
                function list_products()
                {
-                       global $cat_id;
- 
                        $link_data = array
                        (
                                'menuaction'    => 
'inv.uiinventory.list_products',
!                               'cat_id'                => $cat_id,
                                'action'                => $this->action
                        );
--- 171,178 ----
                function list_products()
                {
                        $link_data = array
                        (
                                'menuaction'    => 
'inv.uiinventory.list_products',
!                               'cat_id'                => $this->cat_id,
                                'action'                => $this->action
                        );
***************
*** 183,213 ****
                        $this->display_app_header();
  
!                       if 
(isset($GLOBALS['phpgw_info']['user']['preferences']['common']['currency']))
                        {
!                               $currency = 
$GLOBALS['phpgw_info']['user']['preferences']['common']['currency'];
!                               $this->t->set_var('error','');
                        }
                        else
                        {
!                               $this->t->set_var('error',lang('Please set your 
preferences for this application !'));
                        }
  
                        $archive_id = $this->boinv->get_status_id('archive');
  
!                       if (!$this->start)
!                       {
!                               $this->start = '0';
!                       }
! 
!                       if (! $cat_id)
!                       {
!                               $cat_id = '999';
!                       }
!                       else
                        {
!                               $category = 
$this->boinv->cats->return_single($cat_id);
                        }
  
!                       $products = 
$this->boinv->read_products(True,'category',$cat_id,'active');
  
  //--------------------------------- nextmatch 
--------------------------------------------
--- 184,206 ----
                        $this->display_app_header();
  
!                       $nopref = $this->boinv->check_prefs();
!                       if (is_array($nopref))
                        {
!                               
$this->t->set_var('pref_message',$GLOBALS['phpgw']->common->error_list($nopref));
                        }
                        else
                        {
!                               $prefs = $this->boinv->get_prefs();
                        }
  
                        $archive_id = $this->boinv->get_status_id('archive');
  
!                       if (!$start)
                        {
!                               $start = '0';
                        }
  
!                       $category = $this->boinv->return_single_cat();
!                       $products = 
$this->boinv->read_products(True,'category','active');
  
  //--------------------------------- nextmatch 
--------------------------------------------
***************
*** 233,242 ****
                        
$this->t->set_var('sort_retail',$this->nextmatchs->show_sort_order($this->sort,'retail',$this->order,'/index.php',lang('Retail'),$link_data));
                        
$this->t->set_var('sort_stock',$this->nextmatchs->show_sort_order($this->sort,'stock',$this->order,'/index.php',lang('Stock'),$link_data));
!                       $this->t->set_var('currency',$currency);
                        $this->t->set_var('lang_action',lang('Product list'));
                        
$this->t->set_var('cat_action',$GLOBALS['phpgw']->link('/index.php',$link_data));
                        
$this->t->set_var('search_action',$GLOBALS['phpgw']->link('/index.php',$link_data));
  
!                       
$this->t->set_var('category_list',$this->boinv->formatted_list(array('format' 
=> 'select','type' => 'all','selected' => $cat_id)));
  
  // -------------------------------- end declaration 
-----------------------------------------
--- 226,235 ----
                        
$this->t->set_var('sort_retail',$this->nextmatchs->show_sort_order($this->sort,'retail',$this->order,'/index.php',lang('Retail'),$link_data));
                        
$this->t->set_var('sort_stock',$this->nextmatchs->show_sort_order($this->sort,'stock',$this->order,'/index.php',lang('Stock'),$link_data));
!                       $this->t->set_var('currency',$prefs['currency']);
                        $this->t->set_var('lang_action',lang('Product list'));
                        
$this->t->set_var('cat_action',$GLOBALS['phpgw']->link('/index.php',$link_data));
                        
$this->t->set_var('search_action',$GLOBALS['phpgw']->link('/index.php',$link_data));
  
!                       
$this->t->set_var('category_list',$this->boinv->formatted_cat_list());
  
  // -------------------------------- end declaration 
-----------------------------------------
***************
*** 266,274 ****
                                $this->t->set_var(array('num' => 
$GLOBALS['phpgw']->strip_html($products[$i]['num']),
                                                                                
'name' => $name,
!                                                                               
'dist' => $dist,
                                                                                
'status' => lang($this->boinv->return_value($products[$i]['status'])),
                                                                                
'cost' => $products[$i]['cost'],
                                                                                
'price' => $products[$i]['price'],
!                                                                               
'retail' => 
sprintf("%01.2f",$this->boinv->get_retail($cat_id,$products[$i]['price'])),
                                                                                
'stock' => $products[$i]['stock'],
                                                                                
'serial' => $serial));
--- 259,267 ----
                                $this->t->set_var(array('num' => 
$GLOBALS['phpgw']->strip_html($products[$i]['num']),
                                                                                
'name' => $name,
!                                                                               
'dist' => $dist[0]['org_name'],
                                                                                
'status' => lang($this->boinv->return_value($products[$i]['status'])),
                                                                                
'cost' => $products[$i]['cost'],
                                                                                
'price' => $products[$i]['price'],
!                                                                               
'retail' => 
sprintf("%01.2f",round($products[$i]['price']*(1+$this->taxpercent),2)),
                                                                                
'stock' => $products[$i]['stock'],
                                                                                
'serial' => $serial));
***************
*** 303,311 ****
                }
  
- 
                function edit_product()
                {
-                       global $cat_id;
- 
                        $values         = $GLOBALS['HTTP_POST_VARS']['values'];
                        $submit         = $GLOBALS['HTTP_POST_VARS']['submit'];
--- 296,301 ----
***************
*** 313,317 ****
                        if (!$submit)
                        {
!                               $referer = 
$GLOBALS['HTTP_SERVER_VARS']['HTTP_REFERER'] ? 
$GLOBALS['HTTP_SERVER_VARS']['HTTP_REFERER'] : $GLOBALS['HTTP_REFERER'];
                        }
  
--- 303,308 ----
                        if (!$submit)
                        {
!                               $referer        = 
$GLOBALS['HTTP_SERVER_VARS']['HTTP_REFERER'] ? 
$GLOBALS['HTTP_SERVER_VARS']['HTTP_REFERER'] : $GLOBALS['HTTP_REFERER'];
!                               $cat_id         = $this->cat_id;
                        }
  
***************
*** 323,329 ****
                                $this->t->set_block('form','edit','edithandle');
                                $this->t->set_var('lang_action',lang('Edit 
product'));
!                               $hidden_vars = '<input type="hidden" 
name="product_id" value="' . $this->product_id . '">' . "\n";
                                $values = $this->boinv->read_single_product();
-                               $cat_id = $values['cat_id'];
                                $retail = 
$this->boinv->get_retail($values['cat_id'],$values['price']);
                        }
--- 314,319 ----
                                $this->t->set_block('form','edit','edithandle');
                                $this->t->set_var('lang_action',lang('Edit 
product'));
!               //              $hidden_vars = '<input type="hidden" 
name="product_id" value="' . $this->product_id . '">' . "\n";
                                $values = $this->boinv->read_single_product();
                                $retail = 
$this->boinv->get_retail($values['cat_id'],$values['price']);
                        }
***************
*** 339,349 ****
                        if ($submit)
                        {
!                               if ($product_id)
                                {
!                                       $values['product_id']   = $product_id;
!                                       $this->product_id               = 
$product_id;
                                }
- 
-                               $values['cat_id'] = $cat_id;
                                $error = $this->boinv->check_values($values);
                                if (is_array($error))
--- 329,336 ----
                        if ($submit)
                        {
!                               if ($this->product_id)
                                {
!                                       $values['product_id']   = 
$this->product_id;
                                }
                                $error = $this->boinv->check_values($values);
                                if (is_array($error))
***************
*** 353,358 ****
                                else
                                {
!                                       $retail = 
$this->boinv->save_product($values);
                                        
$this->t->set_var('message',lang('Product x x has been added !', 
$values['num'],$values['name']));
                                }
                        }
--- 340,348 ----
                                else
                                {
!                                       $postval = 
$this->boinv->save_product($values);
                                        
$this->t->set_var('message',lang('Product x x has been added !', 
$values['num'],$values['name']));
+                                       $cat_id         = $values['cat_id'];
+                                       $num            = $postval['num'];
+                                       $retail         = $postval['retail'];
                                }
                        }
***************
*** 362,367 ****
                                'menuaction'    => 
'inv.uiinventory.edit_product',
                                'action'                => $this->action,
!                               'product_id'    => $this->product_id,
!                               'cat_id'                => $cat_id
                        );
  
--- 352,356 ----
                                'menuaction'    => 
'inv.uiinventory.edit_product',
                                'action'                => $this->action,
!                               'product_id'    => $this->product_id
                        );
  
***************
*** 376,384 ****
  
                        $this->display_app_header();
!                       $hidden_vars .= '<input type="hidden" name="referer" 
value="' . $referer . '">' . "\n";
                        $owner = $this->boinv->cats->id2name($cat_id,'owner');
                        
$this->t->set_var('actionurl',$GLOBALS['phpgw']->link('/index.php',$link_data));
                        $this->t->set_var('hidden_vars',$hidden_vars);
!                       $this->t->set_var('num',$values['num']);
                        $this->t->set_var('short_name',$values['name']);
                        $this->t->set_var('product_note',$values['note']);
--- 365,373 ----
  
                        $this->display_app_header();
!                       $hidden_vars = '<input type="hidden" name="referer" 
value="' . $referer . '">' . "\n";
                        $owner = $this->boinv->cats->id2name($cat_id,'owner');
                        
$this->t->set_var('actionurl',$GLOBALS['phpgw']->link('/index.php',$link_data));
                        $this->t->set_var('hidden_vars',$hidden_vars);
!                       $this->t->set_var('num',$num);
                        $this->t->set_var('short_name',$values['name']);
                        $this->t->set_var('product_note',$values['note']);
***************
*** 470,473 ****
--- 459,525 ----
                                $this->t->pfp('addhandle','add');
                        }
+               }
+ 
+               function preferences()
+               {
+                       $submit = $GLOBALS['HTTP_POST_VARS']['submit'];
+                       $prefs  = $GLOBALS['HTTP_POST_VARS']['prefs'];
+                       $abid   = $GLOBALS['HTTP_POST_VARS']['abid'];
+ 
+                       if ($submit)
+                       {
+                               $prefs['abid']          = $abid;
+                               $this->boinv->save_prefs($prefs);
+ 
+                               Header('Location: ' . 
$GLOBALS['phpgw']->link('/preferences/index.php'));
+                               $GLOBALS['phpgw']->common->phpgw_exit();
+                       }
+ 
+                       $GLOBALS['phpgw']->common->phpgw_header();
+                       echo parse_navbar();
+ 
+                       $this->t->set_file(array('prefs' => 'preferences.tpl'));
+ 
+                       
$this->t->set_var('actionurl',$GLOBALS['phpgw']->link('/index.php','menuaction=inv.uiinventory.preferences'));
+                       
$this->t->set_var('addressbook_link',$GLOBALS['phpgw']->link('/inv/addressbook.php','query='));
+                       $this->t->set_var('lang_action',lang('Inventory 
preferences'));
+                       $this->t->set_var('lang_address',lang('Select your 
address'));
+                       $this->t->set_var('lang_select',lang('Select per button 
!'));
+                       $this->t->set_var('lang_print_format',lang('Select 
print format'));
+                       $this->t->set_var('lang_def_cat',lang('Default 
category'));
+                       $this->t->set_var('lang_select_def_cat',lang('Select 
default category'));
+ 
+                       $prefs = $this->boinv->read_prefs();
+ 
+                       if (isset($prefs['abid']))
+                       {
+                               $abid = $prefs['abid'];
+                               $entry = 
$this->boinv->read_single_contact($abid);
+ 
+                               if ($entry[0]['org_name'] == '') { 
$this->t->set_var('name',$entry[0]['n_given'] . ' ' . $entry[0]['n_family']); }
+                               else { 
$this->t->set_var('name',$entry[0]['org_name'] . ' [ ' . $entry[0]['n_given'] . 
' ' . $entry[0]['n_family'] . ' ]'); }
+                       }
+                       else
+                       {
+                               $this->t->set_var('name',$name);
+                       }
+ 
+                       $this->t->set_var('abid',$abid);
+ 
+                       if ($prefs['print_format']=='html'):
+                               $format_sel[0]=' selected';
+                       elseif ($prefs['print_format']=='pdf'):
+                               $format_sel[1]=' selected';
+                       endif;
+ 
+                       $print_format = '<option value="html"' . $format_sel[0] 
.'>' . lang('HTML') . '</option>' . "\n"
+                                               . '<option value="pdf"' . 
$format_sel[1] . '>' . lang('PDF') . '</option>' . "\n";
+ 
+                       $this->t->set_var('print_format',$print_format);
+ 
+                       
$this->t->set_var('category_list',$this->boinv->cats->formated_list(array('format'
 => 'select','type' => 'all','selected' => $prefs['cat_id'])));
+ 
+                       $this->t->set_var('lang_save',lang('Save'));
+                       $this->t->pfp('out','prefs');
                }
        }

Index: hook_preferences.inc.php
===================================================================
RCS file: /cvsroot/phpgroupware/inv/inc/hook_preferences.inc.php,v
retrieving revision 1.13
retrieving revision 1.14
diff -C2 -r1.13 -r1.14
*** hook_preferences.inc.php    14 Jan 2002 01:22:40 -0000      1.13
--- hook_preferences.inc.php    17 Jan 2002 01:49:04 -0000      1.14
***************
*** 25,31 ****
                $file = Array
                (
!                       'Preferences'           => 
$GLOBALS['phpgw']->link('/inv/preferences.php'),
                        'Grant Access'          => 
$GLOBALS['phpgw']->link('/index.php','menuaction=preferences.uiaclprefs.index&acl_app='.$appname),
!                       'Edit Categories'       => 
$GLOBALS['phpgw']->link('/index.php',$link_data) 
                );
  
--- 25,31 ----
                $file = Array
                (
!                       'Preferences'           => 
$GLOBALS['phpgw']->link('/index.php','menuaction=inv.uiinventory.preferences'),
                        'Grant Access'          => 
$GLOBALS['phpgw']->link('/index.php','menuaction=preferences.uiaclprefs.index&acl_app='.$appname),
!                       'Edit Categories'       => 
$GLOBALS['phpgw']->link('/index.php',$link_data)
                );
  




reply via email to

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