Example #1
0
	$product = new Product($db);
	$result=$product->fetch($id);
	$product->accountancy_code_sell=$_POST["productaccountancycodesell"];
	$result=$product->update($product->id,$user,1,0,1);
	if ($result < 0)
	{
		$mesg=join(',',$product->errors);
	}
	$action="";
}

if ($action == 'fastappro')
{
	$product = new Product($db);
	$product->fetch($id);
	$result = $product->fastappro($user);
	Header("Location: fiche.php?id=".$id);
	exit;
}


// Add a product or service
if ($action == 'add' && ($user->rights->produit->creer || $user->rights->service->creer))
{
	$error=0;

	if (empty($_POST["libelle"]))
	{
		$mesg='<div class="error">'.$langs->trans('ErrorFieldRequired',$langs->transnoentities('Label')).'</div>';
		$action = "create";
		$_GET["canvas"] = $_POST["canvas"];