Modification de la creation des produits specifiques

This commit is contained in:
Rodolphe Quiedeville 2006-12-03 12:29:38 +00:00
parent 1af7db0e33
commit 66c4282a61

View File

@ -38,7 +38,6 @@ require_once(DOL_DOCUMENT_ROOT."/product.class.php");
require_once(DOL_DOCUMENT_ROOT."/commande/commande.class.php"); require_once(DOL_DOCUMENT_ROOT."/commande/commande.class.php");
$langs->load("bills"); $langs->load("bills");
$langs->load("products");
$mesg = ''; $mesg = '';
@ -62,8 +61,17 @@ if ($_GET["action"] == 'fastappro')
// Action ajout d'un produit ou service // Action ajout d'un produit ou service
if ($_POST["action"] == 'add' && $user->rights->produit->creer) if ($_POST["action"] == 'add' && $user->rights->produit->creer)
{
if ($_POST["canvas"] <> '' && file_exists('canvas/product.'.$_POST["canvas"].'.class.php') )
{
$class = 'Product'.ucfirst($_POST["canvas"]);
include_once('canvas/product.'.$_POST["canvas"].'.class.php');
$product = new $class($db);
}
else
{ {
$product = new Product($db); $product = new Product($db);
}
$product->ref = $_POST["ref"]; $product->ref = $_POST["ref"];
$product->libelle = $_POST["libelle"]; $product->libelle = $_POST["libelle"];
@ -91,23 +99,14 @@ if ($_POST["action"] == 'add' && $user->rights->produit->creer)
if ( $value != $current_lang ) $e_product = $product; if ( $value != $current_lang ) $e_product = $product;
$id = $product->create($user);
// Produit spécifique // Produit spécifique
if ($id > 0)
{
if ($product->canvas <> '' && file_exists('canvas/product.'.$product->canvas.'.class.php') ) if ($product->canvas <> '' && file_exists('canvas/product.'.$product->canvas.'.class.php') )
{ {
$class = 'Product'.ucfirst($product->canvas); $id = $product->CreateCanvas($user, $_POST);
include_once('canvas/product.'.$product->canvas.'.class.php'); }
else
$product = new $class($db);
if ($product->CreateCanvas($id) > 0)
{ {
// Erreur $id = $product->create($user);
$id = 0;
}
}
} }
if ($id > 0) if ($id > 0)