diff --git a/htdocs/html.form.class.php b/htdocs/html.form.class.php index c8c9fcc168318167e01123864fdfbf4a89e5993d..e00e882101426fc23d4319c1667884b5745f9b45 100644 --- a/htdocs/html.form.class.php +++ b/htdocs/html.form.class.php @@ -3322,7 +3322,28 @@ class Form $select_month .= '</select>'; return $select_month; } - + + /** + * \brief Affiche tableau avec ref et bouton navigation pour un objet metier + * \param object Objet a afficher + * \return string Portion HTML avec ref + boutons nav + */ + function showrefnav($object) + { + $ret=''; + + $object->load_previous_next_ref($object->next_prev_filter); + $previous_ref = $object->ref_previous?'<a href="'.$_SERVER["PHP_SELF"].'?ref='.urlencode($object->ref_previous).'">'.img_previous().'</a>':''; + $next_ref = $object->ref_next?'<a href="'.$_SERVER["PHP_SELF"].'?ref='.urlencode($object->ref_next).'">'.img_next().'</a>':''; + + if ($previous_ref || $next_ref) $ret.='<table class="nobordernopadding" width="100%"><tr class="nobordernopadding"><td class="nobordernopadding">'; + $ret.=$object->getNomUrl(1); + if ($previous_ref || $next_ref) { + $ret.='</td><td class="nobordernopadding" align="center" width="20">'.$previous_ref.'</td>'; + $ret.='<td class="nobordernopadding" align="center" width="20">'.$next_ref.'</td></tr></table>'; + } + return $ret; + } } ?> diff --git a/htdocs/product/fiche.php b/htdocs/product/fiche.php index 7e836708b1d31464ba688b0ca2402d2c92bfd20e..aa644658e95903b18f270372cb4002678552b53e 100644 --- a/htdocs/product/fiche.php +++ b/htdocs/product/fiche.php @@ -628,9 +628,6 @@ if ($_GET["id"] || $_GET["ref"]) print($mesg); - $product->load_previous_next_ref($product->next_prev_filter); - $previous_ref = $product->ref_previous?'<a href="'.$_SERVER["PHP_SELF"].'?ref='.urlencode($product->ref_previous).'">'.img_previous().'</a>':''; - $next_ref = $product->ref_next?'<a href="'.$_SERVER["PHP_SELF"].'?ref='.urlencode($product->ref_next).'">'.img_next().'</a>':''; } if ($_GET["action"] <> 'edit' && $product->canvas <> '') { @@ -657,12 +654,9 @@ if ($_GET["id"] || $_GET["ref"]) // Reference print '<td width="15%">'.$langs->trans("Ref").'</td><td width="85%">'; - 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); print '</td>'; - $nblignes=6; if ($product->isproduct() && $conf->stock->enabled) $nblignes++; if ($product->isservice()) $nblignes++;