diff --git a/modules/contratti/edit.php b/modules/contratti/edit.php
index 0c39e163f..64185a672 100644
--- a/modules/contratti/edit.php
+++ b/modules/contratti/edit.php
@@ -49,6 +49,10 @@ $_SESSION['superselect']['idanagrafica'] = $record['idanagrafica'];
+
+
{[ "type": "select", "label": "", "name": "idreferente", "value": "$idreferente$", "ajax-source": "referenti" ]}
diff --git a/modules/preventivi/edit.php b/modules/preventivi/edit.php
index 6b18a52e3..46edb2fc3 100644
--- a/modules/preventivi/edit.php
+++ b/modules/preventivi/edit.php
@@ -42,6 +42,10 @@ $_SESSION['superselect']['idanagrafica'] = $record['idanagrafica'];
+
+
{[ "type": "select", "label": "", "name": "idreferente", "value": "$idreferente$", "ajax-source": "referenti" ]}
diff --git a/src/Modules.php b/src/Modules.php
index 788ace750..be8980b6b 100644
--- a/src/Modules.php
+++ b/src/Modules.php
@@ -250,10 +250,12 @@ class Modules
* @param string $testo
* @param string $alternativo
* @param string $extra
+ * @param bool $blank
+ * @param string $anchor
*
* @return string
*/
- public static function link($modulo, $id_record = null, $testo = null, $alternativo = true, $extra = null, $blank = true)
+ public static function link($modulo, $id_record = null, $testo = null, $alternativo = true, $extra = null, $blank = true, $anchor = null)
{
$testo = isset($testo) ? nl2br($testo) : tr('Visualizza scheda');
$alternativo = is_bool($alternativo) && $alternativo ? $testo : $alternativo;
@@ -270,7 +272,7 @@ class Modules
if (!empty($module) && in_array($module->permission, ['r', 'rw'])) {
$link = !empty($id_record) ? 'editor.php?id_module='.$module['id'].'&id_record='.$id_record : 'controller.php?id_module='.$module['id'];
- return ''.$testo.'';
+ return ''.$testo.'';
} else {
return $alternativo;
}
diff --git a/src/Plugins.php b/src/Plugins.php
index 4c1911138..7ae10eb35 100644
--- a/src/Plugins.php
+++ b/src/Plugins.php
@@ -97,4 +97,30 @@ class Plugins
return $element ? $element->filepath($file) : null;
}
+
+ /**
+ * Costruisce un link HTML per il modulo e il record indicati.
+ *
+ * @param string|int $plugin
+ * @param int $id_record
+ * @param string $testo
+ * @param string $alternativo
+ * @param string $extra
+ * @param bool $blank
+ *
+ * @return string
+ */
+ public static function link($plugin, $id_record = null, $testo = null, $alternativo = true, $extra = null, $blank = true)
+ {
+ $plugin = self::get($plugin);
+ $alternativo = is_bool($alternativo) && $alternativo ? $testo : $alternativo;
+
+ if (!empty($plugin) && in_array($plugin->permission, ['r', 'rw'])) {
+ $anchor = 'tab_'.$plugin->id;
+
+ return Modules::link($plugin->originalModule->id, $id_record, $testo, $alternativo, $extra, $blank, $anchor);
+ }
+
+ return $alternativo;
+ }
}