diff --git a/htdocs/core/class/html.form.class.php b/htdocs/core/class/html.form.class.php index 3354aa01209..813e1aa9a12 100644 --- a/htdocs/core/class/html.form.class.php +++ b/htdocs/core/class/html.form.class.php @@ -5266,8 +5266,8 @@ class Form * Show block with links to link to other objects. * * @param CommonObject $object Object we want to show links to - * @param array $restrictlinksto Restrict links to some elements, for exemple array('order') or array('supplier_order') - * @return string <0 if KO, >0 if OK + * @param array $restrictlinksto Restrict links to some elements, for exemple array('order') or array('supplier_order'). null or array() if no restriction. + * @return string <0 if KO, >0 if OK */ function showLinkToObjectBlock($object, $restrictlinksto=array()) { @@ -5278,8 +5278,7 @@ class Form if (! is_object($object->thirdparty)) $object->fetch_thirdparty(); - - if (((! is_array($restrictlinksto)) || in_array('order',$restrictlinksto)) + if ((empty($restrictlinksto) || in_array('order',$restrictlinksto)) && ! empty($conf->commande->enabled)) { $linktoelem.=($linktoelem?'   ':'').'' . $langs->trans('LinkedOrder') . ''; @@ -5346,7 +5345,7 @@ class Form print ''; } - if ((in_array('fichinter',$restrictlinksto)) && ! empty($conf->ficheinter->enabled)) + if ((empty($restrictlinksto) || (in_array('fichinter',$restrictlinksto))) && ! empty($conf->ficheinter->enabled)) { $linktoelem.=($linktoelem?'   ':'').'' . $langs->trans('LinkedFichinter') . ''; @@ -5407,7 +5406,7 @@ class Form print ''; } - if (((! is_array($restrictlinksto)) || in_array('supplier_order',$restrictlinksto)) + if ((empty($restrictlinksto) || in_array('supplier_order',$restrictlinksto)) && ! empty($conf->fournisseur->enabled)) { $linktoelem.=($linktoelem?'   ':'').'' . $langs->trans('LinkedOrder') . '';