diff --git a/htdocs/core/actions_dellink.inc.php b/htdocs/core/actions_dellink.inc.php index a8f3b26291f..02de4833da7 100644 --- a/htdocs/core/actions_dellink.inc.php +++ b/htdocs/core/actions_dellink.inc.php @@ -43,7 +43,7 @@ if ($action == 'addlink' && !empty($permissiondellink) && !$cancellink && $id > } // Link by reference -if ($action == 'addlinkbyref' && !empty($permissiondellink) && !$cancellink && $id > 0 && !empty($addlinkref) && getDolGlobalString('MAIN_LINK_BY_REF_IN_LINKTO')) { +if ($action == 'addlinkbyref' && !empty($permissiondellink) && !$cancellink && $id > 0 && !empty($addlinkref) && getDolGlobalString('MAIN_HIDE_LINK_BY_REF_IN_LINKTO')) { $element_prop = getElementProperties($addlink); if (is_array($element_prop)) { dol_include_once('/' . $element_prop['classpath'] . '/' . $element_prop['classfile'] . '.class.php'); diff --git a/htdocs/core/class/html.form.class.php b/htdocs/core/class/html.form.class.php index e5d392ab580..11d2644cdf2 100644 --- a/htdocs/core/class/html.form.class.php +++ b/htdocs/core/class/html.form.class.php @@ -9656,6 +9656,7 @@ class Form } } + // Build the html part with possible suggested links foreach ($possiblelinks as $key => $possiblelink) { $num = 0; @@ -9666,7 +9667,7 @@ class Form if (!empty($possiblelink['perms']) && (empty($restrictlinksto) || in_array($key, $restrictlinksto)) && (empty($excludelinksto) || !in_array($key, $excludelinksto))) { print '
use_javascript_ajax) ? '' : ' style="display:none"') . '>'; - if (getDolGlobalString('MAIN_LINK_BY_REF_IN_LINKTO')) { + if (getDolGlobalString('MAIN_HIDE_LINK_BY_REF_IN_LINKTO')) { print '
'."\n"; print ''."\n"; print '
'; @@ -9692,52 +9693,55 @@ class Form $num = $this->db->num_rows($resqllist); $i = 0; - print '
'; - print ''."\n"; - print ''; - print ''; - print ''; - print ''; - print ''; - print ''; - print ''; - print ''; - print ''; - print ''; - print ''; - print ''; - print ''; - while ($i < $num) { - $objp = $this->db->fetch_object($resqllist); - - print ''; - print ''; - print ''; - print ''; - print ''; - print ''; + if ($num > 0) { + print '
'; + print ''."\n"; + print ''; + print ''; + print ''; + print ''; + print ''; + print '
' . $langs->trans("Ref") . '' . $langs->trans("RefCustomer") . '' . $langs->trans("AmountHTShort") . '' . $langs->trans("Company") . '
'; - print ''; - print '' . (!empty($objp->ref_client) ? $objp->ref_client : (!empty($objp->ref_supplier) ? $objp->ref_supplier : '')) . ''; - if ($possiblelink['label'] == 'LinkToContract') { - $form = new Form($this->db); - print $form->textwithpicto('', $langs->trans("InformationOnLinkToContract")) . ' '; - } - print '' . (isset($objp->total_ht) ? price($objp->total_ht) : '') . ''; - print '' . $objp->name . '
'; + print ''; + print ''; + print ''; + print ''; + print ''; + print ''; print ''; - $i++; + while ($i < $num) { + $objp = $this->db->fetch_object($resqllist); + + print ''; + print ''; + print ''; + print ''; + print ''; + print ''; + print ''; + $i++; + } + print '
' . $langs->trans("Ref") . '' . $langs->trans("RefCustomer") . '' . $langs->trans("AmountHTShort") . '' . $langs->trans("Company") . '
'; + print ''; + print '' . (!empty($objp->ref_client) ? $objp->ref_client : (!empty($objp->ref_supplier) ? $objp->ref_supplier : '')) . ''; + if ($possiblelink['label'] == 'LinkToContract') { + $form = new Form($this->db); + print $form->textwithpicto('', $langs->trans("InformationOnLinkToContract")) . ' '; + } + print '' . (isset($objp->total_ht) ? price($objp->total_ht) : '') . ''; + print '' . $objp->name . '
'; + print '
'; + if ($num) { + print ''; + } + if (empty($conf->use_javascript_ajax)) { + print '
'; + } else { + print '
'; + } + print ''; } - print ''; - print '
'; - if ($num) { - print ''; - } - if (empty($conf->use_javascript_ajax)) { - print '
'; - } else { - print ''; - } - print ''; + $this->db->free($resqllist); } else { dol_print_error($this->db); @@ -9745,7 +9749,7 @@ class Form print ''; //$linktoelem.=($linktoelem?'   ':''); - if ($num > 0 || getDolGlobalString('MAIN_LINK_BY_REF_IN_LINKTO')) { + if ($num > 0 || getDolGlobalString('MAIN_HIDE_LINK_BY_REF_IN_LINKTO')) { $linktoelemlist .= '
  • ' . $langs->trans($possiblelink['label']) . ' (' . $num . ')
  • '; // } else $linktoelem.=$langs->trans($possiblelink['label']); } else {