From 07d29024a1c0369f6ec10669af949e5e86813a58 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Thu, 16 Jul 2009 20:41:55 +0000 Subject: [PATCH] Look: Minor estethic change on linked products. --- htdocs/product/sousproduits/fiche.php | 80 ++++++++++++++++----------- 1 file changed, 49 insertions(+), 31 deletions(-) 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("Label").''.$product->libelle.''; print ''; + // Nombre de sousproduits associes $product->get_sousproduits_arbo (); print ''.$langs->trans("AssociatedProductsNumber").''.sizeof($product->get_arbo_each_prod()).''; print ''; - print ''.$langs->trans("ProductToAddSearch").''; - print ''; - print '
'; + + print '
'; + + print '
'; + + print ''; + print ''; + print ''; + print ''; + print '
'.$langs->trans("ProductToAddSearch").'
'; print ''; print $langs->trans("KeywordFilter"); print ''; @@ -261,24 +265,31 @@ if ($id || $ref) } print '
'; print ''; - print '
'; if($action == 'search') { - print ''; - print ''; - print ''; + print '
'; print ''; print ''; print ''; + print ''; + print ''; + print ''; + print ''; + print ''; + print ''; if ($resql) { $num = $db->num_rows($resql); $i=0; - if($num == 0) - print ''; + $var=true; + + if($num == 0) print ''; + while ($i < $num) { $objp = $db->fetch_object($resql); @@ -293,8 +304,10 @@ if ($id || $ref) // associations sousproduits $prods_arbo = $prod_arbo->get_arbo_each_prod(); if(sizeof($prods_arbo) > 0) { - foreach($prods_arbo as $key => $value) { - if ($value[1]==$id) { + foreach($prods_arbo as $key => $value) + { + if ($value[1]==$id) + { $is_pere=1; } } @@ -304,8 +317,14 @@ if ($id || $ref) continue; } } - print "\n"; - print ''; + $var=!$var; + print "\n"; + $productstatic->id=$objp->rowid; + $productstatic->ref=$objp->ref; + $productstatic->libelle=$objp->label; + $productstatic->type=$objp->type; + + print ''; print ''; if($product->is_sousproduit($id, $objp->rowid)) { @@ -319,7 +338,7 @@ if ($id || $ref) } print ''; - print ''; + print ''; print ''; print ''; } @@ -332,17 +351,16 @@ if ($id || $ref) dol_print_error($db); } print ''; - if($num > 0) - print ''; + if($num > 0) print ''; print '
'.$langs->trans("Ref").''.$langs->trans("Label").''.$langs->trans("AddDel").''.$langs->trans("Quantity").'
'.$langs->trans("Ref").''.$langs->trans("Label").''.$langs->trans("AddDel").''.$langs->trans("Quantity").'
'.$langs->trans("NoMatchFound").'
'.$langs->trans("NoMatchFound").'
'.$objp->ref.'
'.$productstatic->getNomUrl(1,'',24).''.$objp->label.''; print '

trans("Update").'">
'; + print ''; } - print ''; - print ''; - print ''; } } +print "\n"; + /* ************************************************************************** */ /* */ @@ -356,7 +374,7 @@ if ($action == '') { if ($user->rights->produit->creer || $user->rights->service->creer) { - print ''.$langs->trans("EditAssociate").''; + print ''.$langs->trans("EditAssociate").''; } }