[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Phpgroupware-cvs] CVS: inv/inc class.boinventory.inc.php,1.8,1.9 class.
From: |
Bettina Gille <address@hidden> |
Subject: |
[Phpgroupware-cvs] CVS: inv/inc class.boinventory.inc.php,1.8,1.9 class.soinventory.inc.php,1.7,1.8 class.uiinventory.inc.php,1.8,1.9 |
Date: |
Fri, 05 Apr 2002 18:35:06 -0500 |
Update of /cvsroot/phpgroupware/inv/inc
In directory subversions:/tmp/cvs-serv3891/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.8
retrieving revision 1.9
diff -C2 -r1.8 -r1.9
*** class.boinventory.inc.php 31 Jan 2002 22:33:07 -0000 1.8
--- class.boinventory.inc.php 5 Apr 2002 23:35:03 -0000 1.9
***************
*** 242,245 ****
--- 242,250 ----
}
+ function read_status()
+ {
+ return $this->soinv->read_status();
+ }
+
function select_status_list($selected = '')
{
***************
*** 446,509 ****
function check_values($values)
{
! if (!$values['cat_id'])
! {
! $error[] = lang('Please select a category for that product !');
! }
!
! if (!$values['choose'])
{
! if (!$values['num'])
{
! $error[] = lang('Please enter an ID !');
}
else
{
! $exists = $this->exists(array('action'
=> 'num','num' => $values['num'],'cat_id' => $values['cat_id'],
!
'product_id' => $this->product_id));
!
if ($exists)
{
! $error[] = lang('That ID has
been used already !');
! }
!
! if (strlen($values['num']) > 20)
! {
! $error[] = lang('ID can not
exceed 20 characters in length !');
}
}
}
!
! if (!$values['serial'])
{
! if ($values['name'])
{
! $exists = $this->exists(array('action'
=> 'name','name' => $values['name'],'cat_id' => $values['cat_id'],
!
'product_id' => $this->product_id));
! if ($exists)
{
! $error[] = lang('That name has
been used already !');
}
! if (strlen($values['name']) > 255)
{
! $error[] = lang('name can not
exceed 255 characters in length !');
}
}
- }
! 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 !');
}
}
--- 451,531 ----
function check_values($values)
{
! if ($values['action'] == 'status')
{
! if (!$values['status_name'])
{
! $error[] = lang('Please enter a name
!');
}
else
{
! $exists = $this->exists(array('action'
=> 'status','status_name' => $values['status_name'],
!
'status_id' => $values['status_id']));
if ($exists)
{
! $error[] = lang('That name has
been used already !');
}
}
}
! else
{
! if (!$values['cat_id'])
{
! $error[] = lang('Please select a category for that
product !');
! }
! if (!$values['choose'])
! {
! if (!$values['num'])
{
! $error[] = lang('Please enter
an ID !');
}
+ else
+ {
+ $exists =
$this->exists(array('action' => 'num','num' => $values['num'],'cat_id' =>
$values['cat_id'],
+
'product_id' => $this->product_id));
+ if ($exists)
+ {
+ $error[] = lang('That
ID has been used already !');
+ }
+
+ if (strlen($values['num']) > 20)
+ {
+ $error[] = lang('ID can
not exceed 20 characters in length !');
+ }
+ }
+ }
! if (!$values['serial'])
! {
! if ($values['name'])
{
! $exists =
$this->exists(array('action' => 'name','name' => $values['name'],'cat_id' =>
$values['cat_id'],
!
'product_id' => $this->product_id));
! if ($exists)
! {
! $error[] = lang('That
name has been used already !');
! }
!
! if (strlen($values['name']) >
255)
! {
! $error[] = lang('name
can not exceed 255 characters in length !');
! }
}
}
! 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 !');
! }
}
}
***************
*** 592,595 ****
--- 614,629 ----
}
+ function save_status($values)
+ {
+ if ($values['status_id'] && $values['status_id'] != 0)
+ {
+ $this->soinv->edit_status($values);
+ }
+ else
+ {
+
$this->soinv->add_status($values['status_name']);
+ }
+ }
+
function save_prefs($prefs)
{
***************
*** 639,645 ****
}
! function delete_product()
{
! $this->soinv->delete_product($this->product_id);
}
}
--- 673,679 ----
}
! function delete($values)
{
! $this->soinv->delete($values);
}
}
Index: class.soinventory.inc.php
===================================================================
RCS file: /cvsroot/phpgroupware/inv/inc/class.soinventory.inc.php,v
retrieving revision 1.7
retrieving revision 1.8
diff -C2 -r1.7 -r1.8
*** class.soinventory.inc.php 31 Jan 2002 22:33:07 -0000 1.7
--- class.soinventory.inc.php 5 Apr 2002 23:35:03 -0000 1.8
***************
*** 133,137 ****
function status_list()
{
! $this->db->query("select * from phpgw_inv_statuslist");
while ($this->db->next_record())
{
--- 133,137 ----
function status_list()
{
! $this->db->query("select * from
phpgw_inv_statuslist",__LINE__,__FILE__);
while ($this->db->next_record())
{
***************
*** 141,144 ****
--- 141,170 ----
}
+ function read_status()
+ {
+ $this->db->query("select * from phpgw_inv_statuslist
order by status_name asc",__LINE__,__FILE__);
+
+ while ($this->db->next_record())
+ {
+ $sta[] = array
+ (
+ 'status_id' =>
$this->db->f('status_id'),
+ 'status_name' =>
$this->db->f('status_name')
+ );
+ }
+ return $sta;
+ }
+
+ function add_status($status_name)
+ {
+ $this->db->query("insert into phpgw_inv_statuslist
(status_name) values ('" . $this->db->db_addslashes($status_name) .
"')",__LINE__,__FILE__);
+ }
+
+ function edit_status($values)
+ {
+ $this->db->query("UPDATE phpgw_inv_statuslist set
status_name='" . $this->db->db_addslashes($values['status_name']) . "' where
status_id='"
+ .
intval($values['status_id']) . "'",__LINE__,__FILE__);
+ }
+
function read_products($start, $limit = True, $query = '',
$object = 'category',$object_id = '', $sort = '', $order = '',$status =
'active')
{
***************
*** 401,422 ****
function exists($values)
{
! if (!$values['cat_id'])
{
! $values['cat_id'] = 0;
}
!
! switch($values['action'])
{
! case 'num': $column = 'id'; $item =
$values['num']; break;
! case 'name': $column = 'name'; $item =
$values['name']; break;
! }
! if ($values['product_id'] && ($values['product_id'] !=
0))
! {
! $editexists = " and con !='" .
$values['product_id'] . "'";
! }
! $this->db->query("select count(*) from
phpgw_inv_products where $column ='" . $item . "' AND category='"
! . $values['cat_id'] .
"'" . $editexists,__LINE__,__FILE__);
if ($this->db->f(0))
--- 427,455 ----
function exists($values)
{
! if ($values['action'] == 'status')
{
! $this->db->query("select count(*) from
phpgw_inv_statuslist where status_name='" . $values['status_name']);
}
! else
{
! if (!$values['cat_id'])
! {
! $values['cat_id'] = 0;
! }
! switch($values['action'])
! {
! case 'num': $column = 'id';
$item = $values['num']; break;
! case 'name': $column = 'name'; $item
= $values['name']; break;
! }
! if ($values['product_id'] &&
($values['product_id'] != 0))
! {
! $editexists = " and con !='" .
$values['product_id'] . "'";
! }
!
! $this->db->query("select count(*) from
phpgw_inv_products where $column ='" . $item . "' AND category='"
! .
$values['cat_id'] . "'" . $editexists,__LINE__,__FILE__);
! }
if ($this->db->f(0))
***************
*** 476,482 ****
}
! function delete_product($product_id)
{
! $this->db->query("delete from phpgw_inv_products where
con='" . $product_id . "'",__LINE__,__FILE__);
}
}
--- 509,522 ----
}
! function delete($values)
{
! if ($values['action'] == 'pro')
! {
! $this->db->query("delete from
phpgw_inv_products where con='" . $values['product_id'] .
"'",__LINE__,__FILE__);
! }
! else
! {
! $this->db->query("delete from
phpgw_inv_statuslist where status_id='" . $values['status_id'] .
"'",__LINE__,__FILE__);
! }
}
}
Index: class.uiinventory.inc.php
===================================================================
RCS file: /cvsroot/phpgroupware/inv/inc/class.uiinventory.inc.php,v
retrieving revision 1.8
retrieving revision 1.9
diff -C2 -r1.8 -r1.9
*** class.uiinventory.inc.php 31 Jan 2002 22:33:07 -0000 1.8
--- class.uiinventory.inc.php 5 Apr 2002 23:35:03 -0000 1.9
***************
*** 28,33 ****
class uiinventory
{
var $grants;
! var $stock;
var $public_functions = array
--- 28,51 ----
class uiinventory
{
+ var $boinv;
+ var $nextmatchs;
+ var $sbox;
+ var $t;
var $grants;
!
! var $start;
! var $filter;
! var $query;
! var $sort;
! var $order;
! var $cat_id;
!
! var $taxpercent;
! var $number;
! var $action;
! var $product_id;
! var $status;
! var $dist;
! var $selection;
var $public_functions = array
***************
*** 37,41 ****
'preferences' => True,
'view_product' => True,
! 'delete_product' => True
);
--- 55,63 ----
'preferences' => True,
'view_product' => True,
! 'delete_product' => True,
! 'list_status' => True,
! 'add_status' => True,
! 'edit_status' => True,
! 'delete_status' => True
);
***************
*** 88,93 ****
--- 110,118 ----
$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'));
+ $this->t->set_var('lang_delete',lang('Delete'));
+
$this->t->set_var('lang_select_cat',lang('Select
category'));
$this->t->set_var('lang_search',lang('Search'));
***************
*** 102,105 ****
--- 127,131 ----
$this->t->set_var('lang_num',lang('Product ID'));
$this->t->set_var('lang_name',lang('Short Name'));
+ $this->t->set_var('lang_status_name',lang('Status
Name'));
$this->t->set_var('lang_url',lang('WWW'));
$this->t->set_var('lang_ftp',lang('FTP'));
***************
*** 137,145 ****
$this->t->set_var('link_products',$GLOBALS['phpgw']->link('/index.php','menuaction=inv.uiinventory.list_products&action=subproduct'));
$this->t->set_var('link_categorys',$GLOBALS['phpgw']->link('/index.php','menuaction=preferences.uicategories.index&cats_app=inv&cats_level=True&extra=tax,number'));
!
$this->t->set_var('link_status',$GLOBALS['phpgw']->link('/inv/liststatus.php'));
!
$this->t->set_var('link_orders',$GLOBALS['phpgw']->link('/inv/listorders.php'));
!
$this->t->set_var('link_dists',$GLOBALS['phpgw']->link('/inv/listdist.php'));
$this->t->set_var('link_archive',$GLOBALS['phpgw']->link('/inv/archiv.php','subarchive=True'));
!
$this->t->set_var('link_rooms',$GLOBALS['phpgw']->link('/inv/rooms.php','subroom=True'));
if ($subarchive == True)
--- 163,171 ----
$this->t->set_var('link_products',$GLOBALS['phpgw']->link('/index.php','menuaction=inv.uiinventory.list_products&action=subproduct'));
$this->t->set_var('link_categorys',$GLOBALS['phpgw']->link('/index.php','menuaction=preferences.uicategories.index&cats_app=inv&cats_level=True&extra=tax,number'));
!
$this->t->set_var('link_status',$GLOBALS['phpgw']->link('/index.php','menuaction=inv.uiinventory.list_status'));
!
$this->t->set_var('link_orders',$GLOBALS['phpgw']->link('/inv/listorders.php'));
!
$this->t->set_var('link_dists',$GLOBALS['phpgw']->link('/inv/listdist.php'));
$this->t->set_var('link_archive',$GLOBALS['phpgw']->link('/inv/archiv.php','subarchive=True'));
!
$this->t->set_var('link_rooms',$GLOBALS['phpgw']->link('/inv/rooms.php','subroom=True'));
if ($subarchive == True)
***************
*** 696,699 ****
--- 722,726 ----
function delete_product()
{
+ // $product_id =
$GLOBALS['HTTP_POST_VARS']['product_id'];
$confirm = $GLOBALS['HTTP_POST_VARS']['confirm'];
***************
*** 711,715 ****
if ($confirm)
{
! $this->boinv->delete_product();
Header('Location: ' .
$GLOBALS['phpgw']->link('/index.php',$link_data));
}
--- 738,742 ----
if ($confirm)
{
! $this->boinv->delete(array('action' =>
'pro','product_id' => $this->product_id));
Header('Location: ' .
$GLOBALS['phpgw']->link('/index.php',$link_data));
}
***************
*** 727,733 ****
. '<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'));
--- 754,758 ----
. '<input type="hidden"
name="referer" value="' . $referer . '">' . "\n";
! $this->t->set_var('deleteheader',lang('Are you sure you
want to delete this entry ?'));
$this->t->set_var('nolink',$GLOBALS['phpgw']->link('/index.php',$link_data));
$this->t->set_var('lang_no',lang('No'));
***************
*** 736,739 ****
--- 761,913 ----
$this->t->set_var('lang_yes',lang('Yes'));
$this->t->pfp('out','delete');
+ }
+
+ function list_status()
+ {
+ $lm = $GLOBALS['HTTP_POST_VARS']['lm'];
+
+ $link_data = array
+ (
+ 'menuaction' => 'inv.uiinventory.list_status'
+ );
+
+ $this->t->set_file(array('status_list_t' =>
'liststatus.tpl'));
+
$this->t->set_block('status_list_t','status_list','list');
+
+ $this->display_app_header();
+
+ $this->t->set_var('lang_action',lang('Product status
list'));
+
+ if ($lm == 'statusupdated')
+ {
+ $this->t->set_var('message',lang('Product
status has been updated !'));
+ }
+ if ($lm == 'statusadded')
+ {
+ $this->t->set_var('message',lang('Product
status has been added !'));
+ }
+
+ $sta = $this->boinv->read_status();
+
+ for ($i=0;$i<count($sta);$i++)
+ {
+
$this->nextmatchs->template_alternate_row_color(&$this->t);
+ $status_name =
$GLOBALS['phpgw']->strip_html($sta[$i]['status_name']);
+ $this->t->set_var('name',lang($status_name));
+
+ if ($status_name != 'archive')
+ {
+ $link_data['menuaction'] =
'inv.uiinventory.edit_status';
+ $link_data['status_id'] =
$sta[$i]['status_id'];
+
$this->t->set_var('edit',$GLOBALS['phpgw']->link('/index.php',$link_data));
+
$this->t->set_var('lang_edit_entry',lang('Edit'));
+
+ $link_data['menuaction'] =
'inv.uiinventory.delete_status';
+
$this->t->set_var('delete',$GLOBALS['phpgw']->link('/index.php',$link_data));
+
$this->t->set_var('lang_delete_entry',lang('Delete'));
+ }
+ else
+ {
+ $this->t->set_var('edit',' ');
+ $this->t->set_var('delete',' ');
+ $this->t->set_var('lang_edit_entry','');
+
$this->t->set_var('lang_delete_entry','');
+ }
+
+ $this->t->fp('list','status_list',True);
+ }
+
+
$this->t->set_var('add_action',$GLOBALS['phpgw']->link('/index.php','menuaction=inv.uiinventory.add_status'));
+ $this->t->pfp('out','status_list_t',True);
+ }
+
+ function add_status()
+ {
+ $status_name =
$GLOBALS['HTTP_POST_VARS']['status_name'];
+ $this->t->set_file(array('form' => 'status_form.tpl'));
+
+ $this->display_app_header();
+
+ if ($GLOBALS['HTTP_POST_VARS']['submit'])
+ {
+ $error =
$this->boinv->check_values(array('action' => 'status','status_name' =>
$status_name));
+ if (is_array($error))
+ {
+
$this->t->set_var('message',$GLOBALS['phpgw']->common->error_list($error));
+ }
+ else
+ {
+
$this->boinv->save_status(array('status_name' => $status_name));
+ Header('Location: ' .
$GLOBALS['phpgw']->link('/index.php','menuaction=inv.uiinventory.list_status&lm=statusadded'));
+ $GLOBALS['phpgw']->common->phpgw_exit();
+ }
+ }
+
+ $this->t->set_var('status_name',$status_name);
+ $this->t->set_var('lang_action',lang('Add product
status'));
+
$this->t->set_var('form_action',$GLOBALS['phpgw']->link('/index.php','menuaction=inv.uiinventory.add_status'));
+ $this->t->pfp('out','form');
+ }
+
+ function edit_status()
+ {
+ $status_id =
$GLOBALS['HTTP_POST_VARS']['status_id'] ?
$GLOBALS['HTTP_POST_VARS']['status_id'] :
$GLOBALS['HTTP_GET_VARS']['status_id'];
+ $status_name =
$GLOBALS['HTTP_POST_VARS']['status_name'];
+
+ $this->t->set_file(array('form' => 'status_form.tpl'));
+ $this->display_app_header();
+
+ if ($GLOBALS['HTTP_POST_VARS']['submit'])
+ {
+ $error =
$this->boinv->check_values(array('action' => 'status','status_name' =>
$status_name,'status_id' => $status_id));
+ if (is_array($error))
+ {
+
$this->t->set_var('message',$GLOBALS['phpgw']->common->error_list($error));
+ }
+ else
+ {
+
$this->boinv->save_status(array('status_name' => $status_name,'status_id' =>
$status_id));
+ Header('Location: ' .
$GLOBALS['phpgw']->link('/index.php','menuaction=inv.uiinventory.list_status&lm=statusupdated'));
+ $GLOBALS['phpgw']->common->phpgw_exit();
+ }
+ }
+
+
$this->t->set_var('status_name',$GLOBALS['phpgw']->strip_html($this->boinv->return_value($status_id)));
+ $this->t->set_var('status_id',$status_id);
+ $this->t->set_var('lang_action','Edit product status');
+
$this->t->set_var('form_action',$GLOBALS['phpgw']->link('index.php','menuaction=inv.uiinventory.edit_status&status_id='
. $status_id));
+ $this->t->pfp('out','form');
+ }
+
+ function delete_status()
+ {
+ $status_id = $GLOBALS['HTTP_POST_VARS']['status_id'] ?
$GLOBALS['HTTP_POST_VARS']['status_id'] :
$GLOBALS['HTTP_GET_VARS']['status_id'];
+
+ $link_data = array
+ (
+ 'menuaction' =>
'inv.uiinventory.list_status',
+ 'status_id' => $status_id
+ );
+
+ if ($GLOBALS['HTTP_POST_VARS']['confirm'])
+ {
+ $this->boinv->delete(array('action' =>
'status', 'status_id' => $status_id));
+ Header('Location: ' .
$GLOBALS['phpgw']->link('/index.php',$link_data));
+ $GLOBALS['phpgw']->common->phpgw_exit();
+ }
+
+ $this->t->set_file(array('status_delete' =>
'delete.tpl'));
+
+ $this->display_app_header();
+
+ $this->t->set_var('deleteheader',lang('Are you sure you
want to delete this entry ?'));
+ $this->t->set_var('hidden_vars','<input type="hidden"
name="status_id" value="' . $status_id . '">');
+
$this->t->set_var('nolink',$GLOBALS['phpgw']->link('/index.php',$link_data));
+ $this->t->set_var('lang_no',lang('No'));
+
+ $link_data['menuaction'] =
'inv.uiinventory.delete_status';
+
$this->t->set_var('action_url',$GLOBALS['phpgw']->link('/index.php',$link_data));
+ $this->t->set_var('lang_yes',lang('Yes'));
+ $this->t->pfp('out','status_delete');
}
}
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Phpgroupware-cvs] CVS: inv/inc class.boinventory.inc.php,1.8,1.9 class.soinventory.inc.php,1.7,1.8 class.uiinventory.inc.php,1.8,1.9,
Bettina Gille <address@hidden> <=
- Prev by Date:
[Phpgroupware-cvs] CVS: inv/templates/default delete.tpl,1.8,1.9 liststatus.tpl,1.3,1.4 status_form.tpl,1.8,1.9
- Next by Date:
[Phpgroupware-cvs] CVS: inv/inc class.soinvoice.inc.php,NONE,1.1 class.soinventory.inc.php,1.8,1.9 class.uiinventory.inc.php,1.9,1.10
- Previous by thread:
[Phpgroupware-cvs] CVS: inv/templates/default delete.tpl,1.8,1.9 liststatus.tpl,1.3,1.4 status_form.tpl,1.8,1.9
- Next by thread:
[Phpgroupware-cvs] CVS: inv/inc class.soinvoice.inc.php,NONE,1.1 class.soinventory.inc.php,1.8,1.9 class.uiinventory.inc.php,1.9,1.10
- Index(es):