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.6,1.7 class.


From: Bettina Gille <address@hidden>
Subject: [Phpgroupware-cvs] CVS: inv/inc class.boinventory.inc.php,1.6,1.7 class.soinventory.inc.php,1.4,1.5 class.uiinventory.inc.php,1.6,1.7
Date: Thu, 17 Jan 2002 19:00:37 -0500

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

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

Index: class.boinventory.inc.php
===================================================================
RCS file: /cvsroot/phpgroupware/inv/inc/class.boinventory.inc.php,v
retrieving revision 1.6
retrieving revision 1.7
diff -C2 -r1.6 -r1.7
*** class.boinventory.inc.php   17 Jan 2002 04:56:37 -0000      1.6
--- class.boinventory.inc.php   18 Jan 2002 00:00:35 -0000      1.7
***************
*** 78,81 ****
--- 78,86 ----
                        }
  
+                       if (isset($cat_id) && !empty($cat_id))
+                       {
+                               $this->cat_id = $cat_id;
+                       }
+ 
                        if($cat_id == '0' || $cat_id == 0 || $cat_id == '')
                        {
***************
*** 90,97 ****
                                }
                        }
-                       else
-                       {
-                               $this->cat_id = $cat_id;
-                       }
  
        /*              $this->oldcat = $this->cat_id;
--- 95,98 ----
***************
*** 149,168 ****
                        $this->order    = $data['order'];
                        $this->action   = $data['action'];
!                       if(isset($data['cat_id']))
!                       {
!                               $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']))
                        {
--- 150,157 ----
                        $this->order    = $data['order'];
                        $this->action   = $data['action'];
!                       $this->cat_id = $data['cat_id'];
!                       $this->oldcat = $data['oldcat'];
!                       $this->taxpercent = $data['taxpercent'];
!                       $this->number = $data['number'];
                        if(isset($data['product_id']))
                        {
***************
*** 622,625 ****
--- 611,619 ----
                        }
                        return $prefs;
+               }
+ 
+               function delete_product()
+               {
+                       $this->soinv->delete_product($this->product_id);
                }
        }

Index: class.soinventory.inc.php
===================================================================
RCS file: /cvsroot/phpgroupware/inv/inc/class.soinventory.inc.php,v
retrieving revision 1.4
retrieving revision 1.5
diff -C2 -r1.4 -r1.5
*** class.soinventory.inc.php   17 Jan 2002 04:56:37 -0000      1.4
--- class.soinventory.inc.php   18 Jan 2002 00:00:35 -0000      1.5
***************
*** 472,475 ****
--- 472,480 ----
                        }
                }
+ 
+               function delete_product($product_id)
+               {
+                       $this->db->query("delete from phpgw_inv_products where 
con='" . $product_id . "'",__LINE__,__FILE__);
+               }
        }
  ?>

Index: class.uiinventory.inc.php
===================================================================
RCS file: /cvsroot/phpgroupware/inv/inc/class.uiinventory.inc.php,v
retrieving revision 1.6
retrieving revision 1.7
diff -C2 -r1.6 -r1.7
*** class.uiinventory.inc.php   17 Jan 2002 04:56:37 -0000      1.6
--- class.uiinventory.inc.php   18 Jan 2002 00:00:35 -0000      1.7
***************
*** 33,39 ****
                var $public_functions = array
                (
!                       'list_products' => True,
!                       'edit_product'  => True,
!                       'preferences'   => True
                );
  
--- 33,41 ----
                var $public_functions = array
                (
!                       'list_products'         => True,
!                       'edit_product'          => True,
!                       'preferences'           => True,
!                       'view_product'          => True,
!                       'delete_product'        => True
                );
  
***************
*** 79,82 ****
--- 81,85 ----
                        
$this->t->set_var('bg_color',$GLOBALS['phpgw_info']['theme']['th_bg']);
                        
$this->t->set_var('tr_color1',$GLOBALS['phpgw_info']['theme']['row_on']);
+                       
$this->t->set_var('tr_color3',$GLOBALS['phpgw_info']['theme']['row_off']);
                        $this->t->set_var('lang_edit',lang('Edit'));
                        $this->t->set_var('lang_view',lang('View'));
***************
*** 275,279 ****
                                }
  
!                               $link_data['menuaction'] = 
'inv.uiinventory.edit_product';
                                
$this->t->set_var('view',$GLOBALS['phpgw']->link('/index.php',$link_data));
  
--- 278,282 ----
                                }
  
!                               $link_data['menuaction'] = 
'inv.uiinventory.view_product';
                                
$this->t->set_var('view',$GLOBALS['phpgw']->link('/index.php',$link_data));
  
***************
*** 467,471 ****
                                if 
($this->boinv->check_perms($grants[$owner],PHPGW_ACL_DELETE) || $owner == 
$this->boinv->account)
                                {
!                                       $link_data['menuaction'] = 
'inv.uiinventory.delete';
                                        $this->t->set_var('delete','<form 
method="POST" action="' . $GLOBALS['phpgw']->link('/index.php',$link_data)
                                                                                
. '"><input type="submit" value="' . lang('Delete') .'"></form>');
--- 470,474 ----
                                if 
($this->boinv->check_perms($grants[$owner],PHPGW_ACL_DELETE) || $owner == 
$this->boinv->account)
                                {
!                                       $link_data['menuaction'] = 
'inv.uiinventory.delete_product';
                                        $this->t->set_var('delete','<form 
method="POST" action="' . $GLOBALS['phpgw']->link('/index.php',$link_data)
                                                                                
. '"><input type="submit" value="' . lang('Delete') .'"></form>');
***************
*** 540,543 ****
--- 543,693 ----
                        $this->t->set_var('lang_save',lang('Save'));
                        $this->t->pfp('out','prefs');
+               }
+ 
+               function view_product()
+               {
+                       $submit         = $GLOBALS['HTTP_POST_VARS']['submit'];
+                       $referer        = $GLOBALS['HTTP_POST_VARS']['referer'];
+ 
+                       if (!$submit)
+                       {
+                               $referer        = 
$GLOBALS['HTTP_SERVER_VARS']['HTTP_REFERER'] ? 
$GLOBALS['HTTP_SERVER_VARS']['HTTP_REFERER'] : $GLOBALS['HTTP_REFERER'];
+                               $cat_id         = $this->cat_id;
+                       }
+ 
+                       if ($submit)
+                       {
+                               Header('Location: ' . $referer);
+                       }
+ 
+                       if (!$this->product_id)
+                       {
+                               Header('Location: ' . $referer);
+                       }
+ 
+                       $this->display_app_header();
+ 
+                       $this->t->set_file(array('view' => 'view_product.tpl'));
+ 
+                       $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();
+                       }
+       
+                       $this->t->set_var('lang_action',lang('View product'));
+                       $this->t->set_var('hidden_vars','<input type="hidden" 
name="referer" value="' . $referer . '">');
+                       $this->t->set_var('currency',$prefs['currency']);  
+ 
+                       $values = $this->boinv->read_single_product();
+ 
+                       
$this->t->set_var('cat_name',$GLOBALS['phpgw']->strip_html($this->boinv->cats->id2name($values['cat_id'],'name')));
+ 
+                       $abid = $values['dist'];
+                       if (!$abid) { $dist = '&nbsp;'; }
+                       else
+                       {
+                               $dist = 
$this->boinv->read_single_contact($abid);
+                       }
+                       
$this->t->set_var('dist',$GLOBALS['phpgw']->strip_html($dist[0]['org_name']));
+ 
+                       
$this->t->set_var('status',lang($this->boinv->return_value($values['status'])));
+ 
+                       
$this->t->set_var('num',$GLOBALS['phpgw']->strip_html($values['num']));
+                       
$this->t->set_var('name',$GLOBALS['phpgw']->strip_html($values['name']));
+                       
$this->t->set_var('descr',$GLOBALS['phpgw']->strip_html($values['descr']));
+                       
$this->t->set_var('serial',$GLOBALS['phpgw']->strip_html($values['serial']));
+ 
+                       $url = $values['url'];
+                       if (!$url || ($url == 'http://')) { $url = ''; }
+                       else
+                       { 
+                               $url = 
$GLOBALS['phpgw']->strip_html($values['url']);
+                               if (! ereg('http://',$url)) { $url = 'http://'. 
$url; }
+                       }
+                       $this->t->set_var('url',$url);
+ 
+                       $ftp = $values['ftp'];
+                       if (!$ftp || ($ftp == 'ftp://')) { $ftp = ''; }
+                       else
+                       { 
+                               $ftp = 
$GLOBALS['phpgw']->strip_html($values['ftp']);
+                               if (! ereg('ftp://',$ftp)) { $ftp = 'ftp://'. 
$ftp; }
+                       }
+                       $this->t->set_var('url',$url);
+ 
+                       $this->t->set_var('cost',$values['cost']);
+                       $this->t->set_var('price',$values['price']);
+                       $this->t->set_var('stock',$values['stock']);
+                       $this->t->set_var('mstock',$values['mstock']);
+ 
+                       
$this->t->set_var('retail',sprintf("%01.2f",$this->boinv->get_retail($values['cat_id'],$values['price'])));
+ 
+                       if ($values['pdate'] != 0)
+                       {
+                               $pdate = $values['pdate'] + (60*60) * 
$GLOBALS['phpgw_info']['user']['preferences']['common']['tz_offset'];
+                               $pdateout = 
$GLOBALS['phpgw']->common->show_date($pdate,$GLOBALS['phpgw_info']['user']['preferences']['common']['dateformat']);
+                       }
+ 
+                       $this->t->set_var('pdate',$pdateout);
+ 
+                       if ($values['sdate'] != 0)
+                       {
+                               $sdate = $values['sdate'] + (60*60) * 
$GLOBALS['phpgw_info']['user']['preferences']['common']['tz_offset'];
+                               $sdateout = 
$GLOBALS['phpgw']->common->show_date($sdate,$GLOBALS['phpgw_info']['user']['preferences']['common']['dateformat']);
+                       }
+ 
+                       $this->t->set_var('sdate',$sdateout);
+ 
+                       $this->t->set_var('done_action',$referer);
+                       $this->t->pfp('out','view');
+               }
+ 
+               function delete_product()
+               {
+                       $confirm        = $GLOBALS['HTTP_POST_VARS']['confirm'];
+ 
+                       if (!$confirm)
+                       {
+                               $referer = 
$GLOBALS['HTTP_SERVER_VARS']['HTTP_REFERER'] ? 
$GLOBALS['HTTP_SERVER_VARS']['HTTP_REFERER'] : $GLOBALS['HTTP_REFERER'];
+                       }
+ 
+                       $link_data = array
+                       (
+                               'menuaction'            => 
'inv.uiinventory.list_products',
+                               'action'                        => 'subproducts'
+                       );
+ 
+                       if ($confirm)
+                       {
+                               $this->boinv->delete_product();
+                               Header('Location: ' . 
$GLOBALS['phpgw']->link('/index.php',$link_data));
+                       }
+ 
+                       if (!$this->product_id)
+                       {
+                               Header('Location: ' . $referer);
+                       }
+ 
+                       $this->display_app_header();
+ 
+                       $this->t->set_file(array('delete' => 'delete.tpl'));
+ 
+                       $hidden_vars = '<input type="hidden" name="product_id" 
value="' . $this->product_id . '">' . "\n"
+                                                       . '<input type="hidden" 
name="referer" value="' . $referer . '">' . "\n";
+ 
+                       $this->t->set_var('deleteheader',lang('Are you sure you 
want to delete this product ?'));
+                       $this->t->set_var('lang_subs','');
+                       $this->t->set_var('subs', '');
+                       
$this->t->set_var('nolink',$GLOBALS['phpgw']->link('/index.php',$link_data));
+                       $this->t->set_var('lang_no',lang('No'));
+               $this->t->set_var('hidden_vars',$hidden_vars);
+               
$this->t->set_var('action_url',$GLOBALS['phpgw']->link('/index.php','menuaction=inv.uiinventory.delete_product&product_id='
 . $this->product_id));
+               $this->t->set_var('lang_yes',lang('Yes'));
+                       $this->t->pfp('out','delete');
                }
        }




reply via email to

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