diff --git a/htdocs/product/sousproduits/fiche.php b/htdocs/product/sousproduits/fiche.php index 9d81c31fe22..a7813898175 100644 --- a/htdocs/product/sousproduits/fiche.php +++ b/htdocs/product/sousproduits/fiche.php @@ -46,23 +46,19 @@ $result=restrictedArea($user,'produit|service',$id,'product','','',$fieldid); $mesg = ''; +$id=isset($_GET["id"])?$_GET["id"]:$_POST["id"]; $ref=isset($_GET["ref"])?$_GET["ref"]:$_POST["ref"]; $key=isset($_GET["key"])?$_GET["key"]:$_POST["key"]; $catMere=isset($_GET["catMere"])?$_GET["catMere"]:$_POST["catMere"]; -$id=isset($_GET["id"])?$_GET["id"]:$_POST["id"]; $action=isset($_GET["action"])?$_GET["action"]:$_POST["action"]; $cancel=isset($_GET["cancel"])?$_GET["cancel"]:$_POST["cancel"]; -if ($action <> 're-edit') +$product = new Product($db); +if ($id || $ref) { - $product = new Product($db); - if ($id) $result = $product->fetch($id); - if ($ref) $result = $product->fetch($ref); - if ($_GET["ref"]) $result = $product->fetch('',$_GET["ref"]); - if ($_GET["id"]) $result = $product->fetch($_GET["id"]); + $result = $product->fetch($id,$ref); } -$html = new Form($db); // Action association d'un sousproduit if ($action == 'add_prod' && @@ -104,7 +100,7 @@ $cancel <> $langs->trans("Cancel") && // action recherche des produits par mot-cle et/ou par categorie if($action == 'search' ) { - $sql = 'SELECT DISTINCT p.rowid, p.ref, p.label, p.price'; + $sql = 'SELECT DISTINCT p.rowid, p.ref, p.label, p.price, p.fk_product_type as type'; $sql.= ' FROM '.MAIN_DB_PREFIX.'product as p'; $sql.= ' LEFT JOIN '.MAIN_DB_PREFIX.'categorie_product as cp ON p.rowid = cp.fk_product'; $sql.= " WHERE p.entity = ".$conf->entity; @@ -117,7 +113,7 @@ if($action == 'search' ) { $sql.= " AND cp.fk_categorie ='".addslashes($catMere)."'"; } - $sql.= " ORDER BY p.ref ASC "; + $sql.= " ORDER BY p.ref ASC"; // $sql.= $db->plimit($limit + 1 ,$offset); $resql = $db->query($sql) ; @@ -135,6 +131,8 @@ if ($cancel == $langs->trans("Cancel")) * View */ +$html = new Form($db); + llxHeader("","",$langs->trans("CardProduct".$product->type)); $html = new Form($db); @@ -205,7 +203,6 @@ if ($id || $ref) print "\n"; - print "\n"; } } @@ -240,13 +237,20 @@ if ($id || $ref) // Libelle print '
| '.$langs->trans("Ref").' | '.$langs->trans("Label").' | '.$langs->trans("AddDel").' | '.$langs->trans("Quantity").' | '; + print '