Fix: link to link to objects not visible

This commit is contained in:
Laurent Destailleur 2016-08-03 19:01:51 +02:00
parent cdafd45877
commit b97223edd7

View File

@ -5266,7 +5266,7 @@ class Form
* Show block with links to link to other objects. * Show block with links to link to other objects.
* *
* @param CommonObject $object Object we want to show links to * @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') * @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 * @return string <0 if KO, >0 if OK
*/ */
function showLinkToObjectBlock($object, $restrictlinksto=array()) function showLinkToObjectBlock($object, $restrictlinksto=array())
@ -5278,8 +5278,7 @@ class Form
if (! is_object($object->thirdparty)) $object->fetch_thirdparty(); if (! is_object($object->thirdparty)) $object->fetch_thirdparty();
if ((empty($restrictlinksto) || in_array('order',$restrictlinksto))
if (((! is_array($restrictlinksto)) || in_array('order',$restrictlinksto))
&& ! empty($conf->commande->enabled)) && ! empty($conf->commande->enabled))
{ {
$linktoelem.=($linktoelem?' &nbsp; ':'').'<a href="#linktoorder" id="linktoorder">' . $langs->trans('LinkedOrder') . '</a>'; $linktoelem.=($linktoelem?' &nbsp; ':'').'<a href="#linktoorder" id="linktoorder">' . $langs->trans('LinkedOrder') . '</a>';
@ -5346,7 +5345,7 @@ class Form
print '</div>'; print '</div>';
} }
if ((in_array('fichinter',$restrictlinksto)) && ! empty($conf->ficheinter->enabled)) if ((empty($restrictlinksto) || (in_array('fichinter',$restrictlinksto))) && ! empty($conf->ficheinter->enabled))
{ {
$linktoelem.=($linktoelem?' &nbsp; ':'').'<a href="#" id="linktoorder">' . $langs->trans('LinkedFichinter') . '</a>'; $linktoelem.=($linktoelem?' &nbsp; ':'').'<a href="#" id="linktoorder">' . $langs->trans('LinkedFichinter') . '</a>';
@ -5407,7 +5406,7 @@ class Form
print '</div>'; print '</div>';
} }
if (((! is_array($restrictlinksto)) || in_array('supplier_order',$restrictlinksto)) if ((empty($restrictlinksto) || in_array('supplier_order',$restrictlinksto))
&& ! empty($conf->fournisseur->enabled)) && ! empty($conf->fournisseur->enabled))
{ {
$linktoelem.=($linktoelem?' &nbsp; ':'').'<a href="#linktoorder" id="linktoorder">' . $langs->trans('LinkedOrder') . '</a>'; $linktoelem.=($linktoelem?' &nbsp; ':'').'<a href="#linktoorder" id="linktoorder">' . $langs->trans('LinkedOrder') . '</a>';