2
0
forked from Wavyzz/dolibarr

NEW: add link to a element by ref

This commit is contained in:
kamel
2021-07-28 12:18:35 +02:00
parent a635e82406
commit 2cd7513936
2 changed files with 44 additions and 4 deletions

View File

@@ -7971,6 +7971,21 @@ class Form
if (!empty($possiblelink['perms']) && (empty($restrictlinksto) || in_array($key, $restrictlinksto)) && (empty($excludelinksto) || !in_array($key, $excludelinksto))) {
print '<div id="'.$key.'list"'.(empty($conf->use_javascript_ajax) ? '' : ' style="display:none"').'>';
if (!empty($conf->global->MAIN_LINK_BY_REF_IN_LINKTO)) {
print '<br><form action="' . $_SERVER["PHP_SELF"] . '" method="POST" name="formlinkedbyref' . $key . '">';
print '<input type="hidden" name="id" value="' . $object->id . '">';
print '<input type="hidden" name="action" value="addlinkbyref">';
print '<input type="hidden" name="addlink" value="' . $key . '">';
print '<table class="noborder">';
print '<tr>';
print '<td>' . $langs->trans("Ref") . '</td>';
print '<td><input type="text" name="reftolinkto" value="' . dol_escape_htmltag(GETPOST('reftolinkto', 'alpha')) . '">&nbsp;<input type="submit" class="button valignmiddle" value="' . $langs->trans('ToLink') . '">&nbsp;<input type="submit" class="button" name="cancel" value="' . $langs->trans('Cancel') . '"></td>';
print '</tr>';
print '</table>';
print '</form>';
}
$sql = $possiblelink['sql'];
$resqllist = $this->db->query($sql);
@@ -8028,7 +8043,7 @@ class Form
print '</div>';
//$linktoelem.=($linktoelem?' &nbsp; ':'');
if ($num > 0) {
if ($num > 0 || !empty($conf->global->MAIN_LINK_BY_REF_IN_LINKTO)) {
$linktoelemlist .= '<li><a href="#linkto'.$key.'" class="linkto dropdowncloseonclick" rel="'.$key.'">'.$langs->trans($possiblelink['label']).' ('.$num.')</a></li>';
// } else $linktoelem.=$langs->trans($possiblelink['label']);
} else {