From 66c4282a61e625fdd1b433f39b6ce79d89d8f54e Mon Sep 17 00:00:00 2001 From: Rodolphe Quiedeville Date: Sun, 3 Dec 2006 12:29:38 +0000 Subject: [PATCH] Modification de la creation des produits specifiques --- htdocs/product/fiche.php | 35 +++++++++++++++++------------------ 1 file changed, 17 insertions(+), 18 deletions(-) diff --git a/htdocs/product/fiche.php b/htdocs/product/fiche.php index ef9f66aeffd..cd5a4abdd50 100644 --- a/htdocs/product/fiche.php +++ b/htdocs/product/fiche.php @@ -38,7 +38,6 @@ require_once(DOL_DOCUMENT_ROOT."/product.class.php"); require_once(DOL_DOCUMENT_ROOT."/commande/commande.class.php"); $langs->load("bills"); -$langs->load("products"); $mesg = ''; @@ -63,7 +62,16 @@ if ($_GET["action"] == 'fastappro') // Action ajout d'un produit ou service if ($_POST["action"] == 'add' && $user->rights->produit->creer) { - $product = new Product($db); + 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->ref = $_POST["ref"]; $product->libelle = $_POST["libelle"]; @@ -91,23 +99,14 @@ if ($_POST["action"] == 'add' && $user->rights->produit->creer) if ( $value != $current_lang ) $e_product = $product; - $id = $product->create($user); - - // Produit spécifique - if ($id > 0) + // Produit spécifique + 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); - include_once('canvas/product.'.$product->canvas.'.class.php'); - - $product = new $class($db); - if ($product->CreateCanvas($id) > 0) - { - // Erreur - $id = 0; - } - } + $id = $product->CreateCanvas($user, $_POST); + } + else + { + $id = $product->create($user); } if ($id > 0)