diff --git a/htdocs/accountancy/admin/accountmodel.php b/htdocs/accountancy/admin/accountmodel.php
index 0b4aa70e548..55c194cd416 100644
--- a/htdocs/accountancy/admin/accountmodel.php
+++ b/htdocs/accountancy/admin/accountmodel.php
@@ -757,8 +757,7 @@ if ($id)
{
print '
| * '.$langs->trans("AvailableVariables").": ";
require_once DOL_DOCUMENT_ROOT.'/core/class/html.formmail.class.php';
- $formmail=new FormMail($db);
- $tmp=$formmail->getAvailableSubstitKey('form');
+ $tmp=FormMail::getAvailableSubstitKey('formemail');
print implode(', ', $tmp);
print ' |
';
}
diff --git a/htdocs/admin/mails_templates.php b/htdocs/admin/mails_templates.php
index f0bf5609adf..08ba76dca99 100644
--- a/htdocs/admin/mails_templates.php
+++ b/htdocs/admin/mails_templates.php
@@ -118,17 +118,17 @@ require_once DOL_DOCUMENT_ROOT.'/core/class/html.formmail.class.php';
$formmail=new FormMail($db);
if (empty($conf->global->MAIN_EMAIL_TEMPLATES_FOR_OBJECT_LINES))
{
- $tmp=$formmail->getAvailableSubstitKey('form');
+ $tmp=FormMail::getAvailableSubstitKey('formemail');
$tmp['__(AnyTransKey)__']='__(AnyTransKey)__';
$helpsubstit = $langs->trans("AvailableVariables").':
'.implode('
', $tmp);
$helpsubstitforlines = $langs->trans("AvailableVariables").':
'.implode('
', $tmp);
}
else
{
- $tmp=$formmail->getAvailableSubstitKey('formwithlines');
+ $tmp=FormMail::getAvailableSubstitKey('formemailwithlines');
$tmp['__(AnyTransKey)__']='__(AnyTransKey)__';
$helpsubstit = $langs->trans("AvailableVariables").':
'.implode('
', $tmp);
- $tmp=$formmail->getAvailableSubstitKey('formforlines');
+ $tmp=FormMail::getAvailableSubstitKey('formemailforlines');
$helpsubstitforlines = $langs->trans("AvailableVariables").':
'.implode('
', $tmp);
}
@@ -484,7 +484,11 @@ if ($action != 'edit')
{
print '';
if (! empty($tabhelp[$id][$value]) && preg_match('/^http(s*):/i',$tabhelp[$id][$value])) print ''.$valuetoshow.' '.img_help(1,$valuetoshow).'';
- else if (! empty($tabhelp[$id][$value])) print $form->textwithpicto($valuetoshow,$tabhelp[$id][$value]);
+ else if (! empty($tabhelp[$id][$value]))
+ {
+ if (in_array($value, array('topic'))) print $form->textwithpicto($valuetoshow, $tabhelp[$id][$value], 1, 'help', '', 0, 2, $value); // Tooltip on click
+ else print $form->textwithpicto($valuetoshow, $tabhelp[$id][$value], 1, 'help', '', 0, 2); // Tooltip on hover
+ }
else print $valuetoshow;
print ' | ';
}
@@ -539,8 +543,8 @@ if ($action != 'edit')
foreach ($fieldsforcontent as $tmpfieldlist)
{
print '';
- if ($tmpfieldlist == 'content') print ''.$form->textwithpicto($langs->trans("Content"),$tabhelp[$id][$tmpfieldlist]).' ';
- if ($tmpfieldlist == 'content_lines') print ''.$form->textwithpicto($langs->trans("ContentForLines"),$tabhelp[$id][$tmpfieldlist]).' ';
+ if ($tmpfieldlist == 'content') print ''.$form->textwithpicto($langs->trans("Content"), $tabhelp[$id][$tmpfieldlist], 1, 'help', '', 0, 2, $tmpfieldlist).' ';
+ if ($tmpfieldlist == 'content_lines') print ''.$form->textwithpicto($langs->trans("ContentForLines"), $tabhelp[$id][$tmpfieldlist], 1, 'help', '', 0, 2, $tmpfieldlist).' ';
if ($context != 'hide')
{
@@ -624,7 +628,11 @@ if ($resql)
// Affiche nom du champ
if ($showfield)
{
- if (! empty($tabhelp[$id][$value])) $valuetoshow = $form->textwithpicto($valuetoshow,$tabhelp[$id][$value]);
+ if (! empty($tabhelp[$id][$value]))
+ {
+ if (in_array($value, array('topic'))) $valuetoshow = $form->textwithpicto($valuetoshow, $tabhelp[$id][$value], 1, 'help', '', 0, 2); // Tooltip on hover
+ else $valuetoshow = $form->textwithpicto($valuetoshow, $tabhelp[$id][$value], 1, 'help', '', 0, 2); // Tooltip on hover
+ }
print getTitleFieldOfList($valuetoshow, 0, $_SERVER["PHP_SELF"], ($sortable?$fieldlist[$field]:''), ($page?'page='.$page.'&':''), $param, "align=".$align, $sortfield, $sortorder);
}
}
diff --git a/htdocs/core/class/html.formmail.class.php b/htdocs/core/class/html.formmail.class.php
index 6c411b60e66..6988fb4b992 100644
--- a/htdocs/core/class/html.formmail.class.php
+++ b/htdocs/core/class/html.formmail.class.php
@@ -1059,18 +1059,18 @@ class FormMail extends Form
}
/**
- * Set substit array from object
+ * Get list of substition keys available.
*
- * @param string $mode 'form', 'formwithlines', 'formforlines' or 'emailing'
+ * @param string $mode 'formemail', 'formemailwithlines', 'formemailforlines', 'emailing', ...
* @return void
*/
- function getAvailableSubstitKey($mode='form')
+ static function getAvailableSubstitKey($mode='formemail')
{
- global $conf;
+ global $conf, $langs;
$vars=array();
- if ($mode == 'form' || $mode == 'formwithlines' || $mode == 'formforlines')
+ if ($mode == 'formemail' || $mode == 'formemailwithlines' || $mode == 'formemailforlines')
{
$vars=array(
'__REF__',
@@ -1134,7 +1134,13 @@ class FormMail extends Form
}
}
- $vars=complete_substitutions_array($vars, $langs, null, null);
+ $tmparray=array();
+ $parameters=array('mode'=>$mode);
+ complete_substitutions_array($tmparray, $langs, null, $parameters);
+ foreach($tmparray as $key => $val)
+ {
+ $vars[]=$key;
+ }
return $vars;
}
|