This commit is contained in:
Rodolphe Quiedeville 2006-12-15 15:13:38 +00:00
parent cdfd7e0e8b
commit 7e03483539

View File

@ -116,6 +116,7 @@ if ($_POST["action"] == 'add' && $user->rights->produit->creer)
{ {
$mesg='<div class="error">'.$product->error.'</div>'; $mesg='<div class="error">'.$product->error.'</div>';
$_GET["action"] = "create"; $_GET["action"] = "create";
$_GET["canvas"] = $product->canvas;
$_GET["type"] = $_POST["type"]; $_GET["type"] = $_POST["type"];
} }
} }
@ -396,7 +397,22 @@ $html = new Form($db);
*/ */
if ($_GET["action"] == 'create' && $user->rights->produit->creer) if ($_GET["action"] == 'create' && $user->rights->produit->creer)
{ {
$product = new Product($db); if ( !isset($product) )
{
if ($_GET["canvas"] <> '' && file_exists('canvas/product.'.$_GET["canvas"].'.class.php') )
{
$class = 'Product'.ucfirst($_GET["canvas"]);
include_once('canvas/product.'.$_GET["canvas"].'.class.php');
$product = new $class($db);
}
else
{
$product = new Product($db);
}
}
$product->assign_smarty_values($smarty);
if ($_error == 1) if ($_error == 1)
{ {
@ -520,6 +536,9 @@ if ($_GET["action"] == 'create' && $user->rights->produit->creer)
else else
{ {
//RODO //RODO
// On assigne les valeurs meme en creation car elles sont definies si
// on revient en erreur
//
$smarty->template_dir = DOL_DOCUMENT_ROOT.'/product/canvas/'.$_GET["canvas"].'/'; $smarty->template_dir = DOL_DOCUMENT_ROOT.'/product/canvas/'.$_GET["canvas"].'/';
$null = $html->load_tva("tva_tx",$conf->defaulttx,$mysoc,''); $null = $html->load_tva("tva_tx",$conf->defaulttx,$mysoc,'');
$smarty->assign('tva_taux_value', $html->tva_taux_value); $smarty->assign('tva_taux_value', $html->tva_taux_value);
@ -558,7 +577,7 @@ if ($_GET["id"] || $_GET["ref"])
$smarty->template_dir = DOL_DOCUMENT_ROOT.'/product/canvas/'.$product->canvas.'/'; $smarty->template_dir = DOL_DOCUMENT_ROOT.'/product/canvas/'.$product->canvas.'/';
$product->assign_values($smarty); $product->assign_smarty_values($smarty);
} }
else else
{ {
@ -901,7 +920,6 @@ if ($_GET["id"] && $_GET["action"] == '' && $product->status)
print '<table width="100%" class="noborder">'; print '<table width="100%" class="noborder">';
// Propals // Propals
if($conf->propal->enabled && $user->rights->propale->creer) if($conf->propal->enabled && $user->rights->propale->creer)
{ {