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.5,1.6 class.


From: Bettina gille <address@hidden>
Subject: [Phpgroupware-cvs] CVS: inv/inc class.boinventory.inc.php,1.5,1.6 class.soinventory.inc.php,1.3,1.4 class.uiinventory.inc.php,1.5,1.6
Date: Wed, 16 Jan 2002 23:56:39 -0500

Update of /cvsroot/phpgroupware/inv/inc
In directory subversions:/tmp/cvs-serv7222/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.5
retrieving revision 1.6
diff -C2 -r1.5 -r1.6
*** class.boinventory.inc.php   17 Jan 2002 01:49:04 -0000      1.5
--- class.boinventory.inc.php   17 Jan 2002 04:56:37 -0000      1.6
***************
*** 445,449 ****
                                {
                                        $exists = $this->exists(array('action' 
=> 'num','num' => $values['num'],'cat_id' => $values['cat_id'],
!                                                                               
                        'product_id' => $values['product_id']));
  
                                        if ($exists)
--- 445,449 ----
                                {
                                        $exists = $this->exists(array('action' 
=> 'num','num' => $values['num'],'cat_id' => $values['cat_id'],
!                                                                               
                        'product_id' => $this->product_id));
  
                                        if ($exists)
***************
*** 464,468 ****
                                {
                                        $exists = $this->exists(array('action' 
=> 'name','name' => $values['name'],'cat_id' => $values['cat_id'],
!                                                                               
                        'product_id' => $values['product_id']));
  
                                        if ($exists)
--- 464,468 ----
                                {
                                        $exists = $this->exists(array('action' 
=> 'name','name' => $values['name'],'cat_id' => $values['cat_id'],
!                                                                               
                        'product_id' => $this->product_id));
  
                                        if ($exists)
***************
*** 523,530 ****
                        }
  
                        $values['retail'] = 
$this->get_retail($values['cat_id'],$values['price']);
  
!                       if ($values['product_id'] && $values['product_id'] != 0)
                        {
                                $this->soinv->edit_product($values);
                        }
--- 523,556 ----
                        }
  
+                       if ($values['smonth'] || $values['sday'] || 
$values['syear'])
+                       {
+                               $values['sdate'] = 
mktime(0,0,0,$values['smonth'], $values['sday'], $values['syear']);
+                       }
+ 
+                       if ($values['pmonth'] || $values['pday'] || 
$values['pyear'])
+                       {
+                               $values['pdate'] = 
mktime(0,0,0,$values['pmonth'],$values['pday'],$values['pyear']);
+                       }
+ 
+             if (!$values['pdate'])
+             {
+                 $values['pdate'] = time();
+             }
+ 
+                       if (!$values['cost'])
+                       {
+                               $values['cost'] = 0;
+                       }
+ 
+                       if (!$values['price'])
+                       {
+                               $values['price'] = 0;
+                       }
+ 
                        $values['retail'] = 
$this->get_retail($values['cat_id'],$values['price']);
  
!                       if ($this->product_id && $this->product_id != 0)
                        {
+                               $values['product_id'] = $this->product_id;
                                $this->soinv->edit_product($values);
                        }

Index: class.soinventory.inc.php
===================================================================
RCS file: /cvsroot/phpgroupware/inv/inc/class.soinventory.inc.php,v
retrieving revision 1.3
retrieving revision 1.4
diff -C2 -r1.3 -r1.4
*** class.soinventory.inc.php   17 Jan 2002 01:49:04 -0000      1.3
--- class.soinventory.inc.php   17 Jan 2002 04:56:37 -0000      1.4
***************
*** 409,415 ****
                        }
  
!                       if ($values['id'] && ($values['id'] != 0))
                        {
!                               $editexists = " and con !='" . $values['id'] . 
"'";
                        }
  
--- 409,415 ----
                        }
  
!                       if ($values['product_id'] && ($values['product_id'] != 
0))
                        {
!                               $editexists = " and con !='" . 
$values['product_id'] . "'";
                        }
  
***************
*** 429,432 ****
--- 429,434 ----
                function add_product($values)
                {
+                       $values['num']          = 
$this->db->db_addslashes($values['num']);
+                       $values['serial']       = 
$this->db->db_addslashes($values['serial']);
                        $values['name']         = 
$this->db->db_addslashes($values['name']);
                        $values['descr']        = 
$this->db->db_addslashes($values['descr']);
***************
*** 440,444 ****
                                                        . "','" . 
$values['price'] . "','" . $values['retail'] . "','" . $values['stock'] . "','" 
. $values['mstock'] . "','"
                                                        . $values['url'] . 
"','" . $values['ftp'] . "','" . $values['dist'] . "','" . $values['pdate'] . 
"','" . $values['sdate']
!                                                       . "','" . 
$values['bin'] . "','" . $values['product_note'] . "')",__LINE__,__FILE__);
                }
  
--- 442,465 ----
                                                        . "','" . 
$values['price'] . "','" . $values['retail'] . "','" . $values['stock'] . "','" 
. $values['mstock'] . "','"
                                                        . $values['url'] . 
"','" . $values['ftp'] . "','" . $values['dist'] . "','" . $values['pdate'] . 
"','" . $values['sdate']
!                                                       . "','" . 
$values['bin'] . "','" . $values['note'] . "')",__LINE__,__FILE__);
!               }
! 
!               function edit_product($values)
!               {
!                       $values['num']          = 
$this->db->db_addslashes($values['num']);
!                       $values['serial']       = 
$this->db->db_addslashes($values['serial']);
!                       $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("update phpgw_inv_products set id='" . 
$values['num'] . "', serial='" . $values['serial'] . "',name='"
!                                                       . $values['name'] . "', 
descr='" . $values['descr'] . "', category='" . $values['cat_id'] . "',status='"
!                                                       . $values['status'] . 
"',cost='" . $values['cost'] . "', price='" . $values['price'] . "', retail='"
!                                                       . $values['retail'] . 
"', stock='" . $values['stock'] . "', mstock='" . $values['mstock'] . "',url='"
!                                                       . $values['url'] . 
"',ftp='" . $values['ftp'] . "',dist='" . $values['dist'] . "',pdate='" . 
$values['pdate']
!                                                       . "',sdate='" . 
$values['sdate'] . "',bin='" . $values['bin'] . "',product_note='" . 
$values['note']
!                                                       . "' where con='" . 
$values['product_id'] . "'",__LINE__,__FILE__);
                }
  

Index: class.uiinventory.inc.php
===================================================================
RCS file: /cvsroot/phpgroupware/inv/inc/class.uiinventory.inc.php,v
retrieving revision 1.5
retrieving revision 1.6
diff -C2 -r1.5 -r1.6
*** class.uiinventory.inc.php   17 Jan 2002 01:49:04 -0000      1.5
--- class.uiinventory.inc.php   17 Jan 2002 04:56:37 -0000      1.6
***************
*** 300,303 ****
--- 300,304 ----
                        $values         = $GLOBALS['HTTP_POST_VARS']['values'];
                        $submit         = $GLOBALS['HTTP_POST_VARS']['submit'];
+                       $referer        = $GLOBALS['HTTP_POST_VARS']['referer'];
  
                        if (!$submit)
***************
*** 307,310 ****
--- 308,338 ----
                        }
  
+                       if ($submit)
+                       {
+                               $error = $this->boinv->check_values($values);
+                               if (is_array($error))
+                               {
+                                       
$this->t->set_var('message',$GLOBALS['phpgw']->common->error_list($error));
+                               }
+                               else
+                               {
+                                       $postval        = 
$this->boinv->save_product($values);
+                                       $cat_id         = $values['cat_id'];
+                                       $num            = $postval['num'];
+                                       $retail         = $postval['retail'];
+ 
+                                       if ($this->product_id)
+                                       {
+                                               
$this->t->set_var('message',lang('Product x x has been updated !', 
$values['num'],$values['name']));
+                                       }
+                                       else
+                                       {
+                                               
$this->t->set_var('message',lang('Product x x has been added !', 
$values['num'],$values['name']));
+                                       }
+                               }
+                       }
+ 
+                       $this->display_app_header();
+ 
                        $this->t->set_file(array('form' => 'product_form.tpl'));
  
***************
*** 314,320 ****
                                $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']);
                        }
                        else
--- 342,349 ----
                                $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']);
+                               $num = $values['num'];
                        }
                        else
***************
*** 327,351 ****
                        }
  
-                       if ($submit)
-                       {
-                               if ($this->product_id)
-                               {
-                                       $values['product_id']   = 
$this->product_id;
-                               }
-                               $error = $this->boinv->check_values($values);
-                               if (is_array($error))
-                               {
-                                       
$this->t->set_var('message',$GLOBALS['phpgw']->common->error_list($error));
-                               }
-                               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'];
-                               }
-                       }
- 
                        $link_data = array
                        (
--- 356,359 ----
***************
*** 364,377 ****
                        }
  
-                       $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']);
!                       $this->t->set_var('serial',$values['serial']);
!                       $this->t->set_var('descr',$values['descr']);
  
                        if (! ereg('http://',$values['url']))
--- 372,385 ----
                        }
  
                        $owner = $this->boinv->cats->id2name($cat_id,'owner');
                        
$this->t->set_var('actionurl',$GLOBALS['phpgw']->link('/index.php',$link_data));
+ 
+                       $hidden_vars .= '<input type="hidden" name="referer" 
value="' . $referer . '">' . "\n";
                        $this->t->set_var('hidden_vars',$hidden_vars);
!                       
$this->t->set_var('num',$GLOBALS['phpgw']->strip_html($num));
!                       
$this->t->set_var('short_name',$GLOBALS['phpgw']->strip_html($values['name']));
!                       
$this->t->set_var('product_note',$GLOBALS['phpgw']->strip_html($values['note']));
!                       
$this->t->set_var('serial',$GLOBALS['phpgw']->strip_html($values['serial']));
!                       
$this->t->set_var('descr',$GLOBALS['phpgw']->strip_html($values['descr']));
  
                        if (! ereg('http://',$values['url']))
***************
*** 379,382 ****
--- 387,395 ----
                                $url = 'http://'. $values['url'];
                        }
+                       else
+                       {
+                               $url = 
$GLOBALS['phpgw']->strip_html($values['url']);
+                       }
+ 
                        $this->t->set_var('url',$url);
  
***************
*** 385,388 ****
--- 398,406 ----
                                $ftp = 'ftp://'. $values['ftp'];
                        }
+                       else
+                       {
+                               $ftp = 
$GLOBALS['phpgw']->strip_html($values['ftp']);
+                       }
+ 
                        $this->t->set_var('ftp',$ftp);
  




reply via email to

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