Gestion generique de la navigation Fiche suivante-Precedente

This commit is contained in:
Regis Houssin 2007-07-30 21:35:29 +00:00
parent be77c626a0
commit 22e59a51e1
5 changed files with 12 additions and 50 deletions

View File

@ -46,6 +46,8 @@ accessforbidden();
llxHeader("","",$langs->trans("BarCode"));
$html = new Form($db);
$product = new Product($db);
if ($_GET["ref"]) $result = $product->fetch('',$_GET["ref"]);
if ($_GET["id"]) $result = $product->fetch($_GET["id"]);
@ -61,12 +63,7 @@ print '<table class="border" width="100%">';
// Reference
print '<tr>';
print '<td width="15%">'.$langs->trans("Ref").'</td><td colspan="2">';
$product->load_previous_next_ref();
$previous_ref = $product->ref_previous?'<a href="'.$_SERVER["PHP_SELF"].'?ref='.$product->ref_previous.'">'.img_previous().'</a>':'';
$next_ref = $product->ref_next?'<a href="'.$_SERVER["PHP_SELF"].'?ref='.$product->ref_next.'">'.img_next().'</a>':'';
if ($previous_ref || $next_ref) print '<table class="nobordernopadding" width="100%"><tr class="nobordernopadding"><td class="nobordernopadding">';
print '<a href="'.$_SERVER["PHP_SELF"].'?id='.$product->id.'">'.$product->ref.'</a>';
if ($previous_ref || $next_ref) print '</td><td class="nobordernopadding" align="center" width="20">'.$previous_ref.'</td><td class="nobordernopadding" align="center" width="20">'.$next_ref.'</td></tr></table>';
print $html->showrefnav($product,'ref');
print '</td>';
print '</tr>';

View File

@ -91,10 +91,8 @@ if ($_GET["id"] || $_GET["ref"])
llxHeader("","",$langs->trans("CardProduct".$product->type));
}
$html = new Form($db);
/*
* Fiche produit
*/

View File

@ -163,26 +163,8 @@ if ($id || $ref)
// Reference
print '<td width="15%">'.$langs->trans("Ref").'</td><td>';
// Suivant/précédent
$product->load_previous_next_ref();
$previous_ref = $product->ref_previous?'<a href="?ref='.$product->ref_previous.'">'.img_previous().'</a>':'';
$next_ref = $product->ref_next?'<a href="?ref='.$product->ref_next.'">'.img_next().'</a>':'';
if ($previous_ref || $next_ref) print '<table class="nobordernopadding" width="100%"><tr class="nobordernopadding"><td class="nobordernopadding">';
print '<a href="?id='.$product->id.'">'.$product->ref.'</a>';
if ($previous_ref || $next_ref) print '</td><td class="nobordernopadding" align="center" width="20">'.$previous_ref.'</td><td class="nobordernopadding" align="center" width="20">'.$next_ref.'</td></tr></table>';
print '</td>';
if ($product->is_photo_available($conf->produit->dir_output))
{
// Photo
print '<td valign="middle" align="center" rowspan="'.$nblignes.'">';
$nbphoto=$product->show_photos($conf->produit->dir_output,1,1,0);
print '</td>';
}
print '</tr>';
print $html->showrefnav($product,'ref');
print '</td></tr>';
// Libelle
print '<tr><td>'.$langs->trans("Label").'</td><td>'.$product->libelle.'</td>';

View File

@ -108,8 +108,9 @@ if ($_GET["id"] || $_GET["ref"])
$head=product_prepare_head($product, $user);
$titre=$langs->trans("CardProduct".$product->type);
dolibarr_fiche_head($head, 'stock', $titre);
$html = new Form($db);
print($mesg);
print '<table class="border" width="100%">';
@ -117,12 +118,7 @@ if ($_GET["id"] || $_GET["ref"])
// Reference
print '<tr>';
print '<td width="25%">'.$langs->trans("Ref").'</td><td>';
$product->load_previous_next_ref();
$previous_ref = $product->ref_previous?'<a href="'.$_SERVER["PHP_SELF"].'?ref='.$product->ref_previous.'">'.img_previous().'</a>':'';
$next_ref = $product->ref_next?'<a href="'.$_SERVER["PHP_SELF"].'?ref='.$product->ref_next.'">'.img_next().'</a>':'';
if ($previous_ref || $next_ref) print '<table class="nobordernopadding" width="100%"><tr class="nobordernopadding"><td class="nobordernopadding">';
print '<a href="'.$_SERVER["PHP_SELF"].'?id='.$product->id.'">'.$product->ref.'</a>';
if ($previous_ref || $next_ref) print '</td><td class="nobordernopadding" align="center" width="20">'.$previous_ref.'</td><td class="nobordernopadding" align="center" width="20">'.$next_ref.'</td></tr></table>';
print $html->showrefnav($product,'ref');
print '</td>';
print '</tr>';

View File

@ -134,29 +134,18 @@ if ($_GET["id"]) $result = $product->fetch($_GET["id"]);
llxHeader("","",$langs->trans("Translation"));
$html = new Form($db);
$head=product_prepare_head($product, $user);
$titre=$langs->trans("CardProduct".$product->type);
if ( $_GET["action"] != 'edit') dolibarr_fiche_head($head, 'translation', $titre);
dolibarr_fiche_head($head, 'translation', $titre);
print '<table class="border" width="100%">';
// Reference
print '<tr>';
print '<td width="15%">'.$langs->trans("Ref").'</td><td colspan="2">';
if ($_GET["action"] != 'edit')
{
$product->load_previous_next_ref();
$previous_ref = $product->ref_previous?'<a href="?ref='.$product->ref_previous.'">'.img_previous().'</a>':'';
$next_ref = $product->ref_next?'<a href="?ref='.$product->ref_next.'">'.img_next().'</a>':'';
if ($previous_ref || $next_ref) print '<table class="nobordernopadding" width="100%"><tr class="nobordernopadding"><td class="nobordernopadding">';
print '<a href="?id='.$product->id.'">'.$product->ref.'</a>';
if ($previous_ref || $next_ref) print '</td><td class="nobordernopadding" align="center" width="20">'.$previous_ref.'</td><td class="nobordernopadding" align="center" width="20">'.$next_ref.'</td></tr></table>';
}
else
{
print '<a href="?id='.$product->id.'">'.$product->ref.'</a>';
}
print $html->showrefnav($product,'ref');
print '</td>';
print '</tr>';
print '</table>';