<?php
	/**************************************************************************\
	* phpGroupWare - Inventory                                                 *
	* http://www.phpgroupware.org                                              *
	* Written by Joseph Engo <jengo@phpgroupware.org>                		   *
	* 			 Bettina Gille [ceb@phpgroupware.org]		                   *
	* ----------------------------------------------                           *
	* This program is free software; you can redistribute it and/or modify it  *
	* under the terms of the GNU General Public License as published by the    *
	* Free Software Foundation; either version 2 of the License, or (at your   *
	* option) any later version.                                               *
	\**************************************************************************/
  /* $Id: deleteproduct.php,v 1.18 2001/06/05 01:09:32 bettina Exp $ */

    if ($confirm)
    {
		$phpgw_info['flags'] = array('noheader' => True,
									'nonavbar' => True);
	}

	$phpgw_info['flags']['currentapp'] = 'inv';
	include('../header.inc.php');

	if (! $con)
	{
		Header('Location: ' . $referer . '&subproduct=True');
	}

	if ($confirm)
	{
		$phpgw->db->query("delete from phpgw_inv_products where con='$con'");
		Header('Location: ' . $referer . '&subproduct=True');
		$phpgw->common->phpgw_exit();
	}
	else
	{
		$hidden_vars = '<input type="hidden" name="con" value="' . $con . '">' . "\n"
					. '<input type="hidden" name="referer" value="' . $referer . '">' . "\n";

		$t = CreateObject('phpgwapi.Template',PHPGW_APP_TPL);
		$t->set_file(array('product_delete' => 'delete.tpl'));
		$t->set_var('deleteheader',lang('Are you sure you want to delete this product ?'));
		$t->set_var('lang_subs','');
		$t->set_var('subs', '');
		$t->set_var('nolink',$HTTP_REFERER);
		$t->set_var('lang_no',lang('No'));
        $t->set_var('hidden_vars',$hidden_vars);
        $t->set_var('action_url',$phpgw->link('/inv/deleteproduct.php','con=' . $con . '&referer=' . $referer));
        $t->set_var('lang_yes',lang('Yes'));
		$t->pparse('out','product_delete');
	}
	$phpgw->common->phpgw_footer();
?>
