@@ -67,7 +67,7 @@ if ($action == 'add_prod' &&
$cancel <> $langs->trans("Cancel") &&
($user->rights->produit->creer || $user->rights->service->creer))
{
-
+ $error=0;
for($i=0;$i<$_POST["max_prod"];$i++)
{
// print "
: ".$_POST["prod_id_chk".$i];
@@ -79,26 +79,33 @@ $cancel <> $langs->trans("Cancel") &&
}
else
{
+ $error++;
$action = 're-edit';
- if($product->error == "isFatherOfThis")
- $mesg = $langs->trans("ErrorAssociationIsFatherOfThis");
+ if ($product->error == "isFatherOfThis") $mesg = $langs->trans("ErrorAssociationIsFatherOfThis");
+ else $mesg=$product->error;
}
}
else
{
- if($product->del_sousproduit($id, $_POST["prod_id_".$i]))
+ if ($product->del_sousproduit($id, $_POST["prod_id_".$i]) > 0)
{
$action = 'edit';
}
else
{
+ $error++;
$action = 're-edit';
+ $mesg=$product->error;
}
-
-
}
}
+ if (! $error)
+ {
+ header("Location: ".$_SERVER["PHP_SELF"].'?id='.$product->id);
+ exit;
+ }
}
+
// action recherche des produits par mot-cle et/ou par categorie
if($action == 'search' )
{
@@ -180,27 +187,32 @@ if ($id || $ref)
print '| '.$langs->trans("Label").' | '.$product->libelle.' | ';
print '
';
+ // Number of subproducts
$product->get_sousproduits_arbo ();
print '| '.$langs->trans("AssociatedProductsNumber").' | '.sizeof($product->get_arbo_each_prod()).' | ';
- // associations sousproduits
+ // List of subproducts
$prods_arbo = $product->get_arbo_each_prod();
if(sizeof($prods_arbo) > 0)
{
print '
';
print ''.$langs->trans("ProductAssociationList").' ';
- foreach($prods_arbo as $key => $value)
+ print '';
+ foreach($prods_arbo as $value)
{
- $productstatic->id=$value[1];
- $productstatic->type=0;
- //$productstatic->ref=$value[0];
+ $productstatic->id=$value['id'];
+ $productstatic->type=$value['type'];
+ $productstatic->ref=$value['fullpath'];
//var_dump($value);
//print ''.$productstatic->ref.' ';
//print $productstatic->getNomUrl(1).' ';
- print $value[0]; // This contains a tr line.
+ //print $value[0]; // This contains a tr line.
+ print '';
+ print '| '.$productstatic->getNomUrl(1).' ('.$value['nb'].') | ';
+ print ' | ';
+ print ' ';
}
-
-
+ print ' ';
print ' |
';
}
@@ -225,27 +237,45 @@ if ($id || $ref)
// Reference
print ''.$langs->trans("Ref").' | ';
print $html->showrefnav($product,'ref','',1,'ref');
- print ' | ';
-
- if ($product->is_photo_available($conf->produit->dir_output))
- {
- // Photo
- print '';
- $nbphoto=$product->show_photos($conf->produit->dir_output,1,1,0);
print ' | ';
- }
print '';
- // Libelle
+ // Label
print '| '.$langs->trans("Label").' | '.$product->libelle.' | ';
print '
';
- // Nombre de sousproduits associes
+ // Number of subproducts
$product->get_sousproduits_arbo ();
print '| '.$langs->trans("AssociatedProductsNumber").' | '.sizeof($product->get_arbo_each_prod()).' | ';
print '
';
+ // List of subproducts
+ $prods_arbo = $product->get_arbo_each_prod();
+ //var_dump($prods_arbo);
+ if(sizeof($prods_arbo) > 0)
+ {
+ print '';
+ print ''.$langs->trans("ProductAssociationList").' ';
+ print '';
+ foreach($prods_arbo as $value)
+ {
+ $productstatic->id=$value['id'];
+ $productstatic->type=$value['type'];
+ $productstatic->ref=$value['fullpath'];
+ //var_dump($value);
+ //print ''.$productstatic->ref.' ';
+ //print $productstatic->getNomUrl(1).' ';
+ //print $value[0]; // This contains a tr line.
+ print '';
+ print '| '.$productstatic->getNomUrl(1).' ('.$value['nb'].') | ';
+ print ' | ';
+ print ' ';
+ }
+ print ' ';
+ print ' |
';
+ }
+
print '';
print '
';
@@ -253,6 +283,7 @@ if ($id || $ref)
print '';
}