diff --git a/htdocs/admin/eventorganization.php b/htdocs/admin/eventorganization.php
index f91f8ef13f1..8efbfcdb669 100644
--- a/htdocs/admin/eventorganization.php
+++ b/htdocs/admin/eventorganization.php
@@ -220,7 +220,7 @@ if ($action == 'edit') {
foreach ($arrayofparameters as $constname => $val) {
if ($val['enabled']==1) {
$setupnotempty++;
- print '
| ';
+ print ' |
';
$tooltiphelp = (($langs->trans($constname . 'Tooltip') != $constname . 'Tooltip') ? $langs->trans($constname . 'Tooltip') : '');
$tooltiphelp .= (($langs->trans($constname . 'Tooltip2') && $langs->trans($constname . 'Tooltip2') != $constname . 'Tooltip2') ? '
'."\n".$langs->trans($constname . 'Tooltip2') : '');
print ''.$form->textwithpicto($langs->trans($constname), $tooltiphelp, 1, 'info', '', 0, 3, 'tootips'.$constname).'';
@@ -313,7 +313,8 @@ if ($action == 'edit') {
foreach ($arrayofparameters as $constname => $val) {
if ($val['enabled']==1) {
$setupnotempty++;
- print ' |
| ';
+ print ' |
';
+ print '';
$tooltiphelp = (($langs->trans($constname . 'Tooltip') != $constname . 'Tooltip') ? $langs->trans($constname . 'Tooltip') : '');
$tooltiphelp .= (($langs->trans($constname . 'Tooltip2') && $langs->trans($constname . 'Tooltip2') != $constname . 'Tooltip2') ? '
'."\n".$langs->trans($constname . 'Tooltip2') : '');
print $form->textwithpicto($langs->trans($constname), $tooltiphelp);
@@ -331,12 +332,17 @@ if ($action == 'edit') {
$formmail = new FormMail($db);
$tmp = explode(':', $val['type']);
-
- $template = $formmail->getEMailTemplate($db, $tmp[1], $user, $langs, getDolGlobalString($constname));
- if ($template < 0) {
- setEventMessages(null, $formmail->errors, 'errors');
+ $labelemailtemplate = getDolGlobalString($constname);
+ if ($labelemailtemplate && $labelemailtemplate != '-1') {
+ $template = $formmail->getEMailTemplate($db, $tmp[1], $user, $langs, getDolGlobalString($constname));
+ if (is_numeric($template) && $template < 0) {
+ setEventMessages($formmail->error, $formmail->errors, 'errors');
+ } else {
+ if ($template->label != 'default') {
+ print $langs->trans($template->label);
+ }
+ }
}
- print $langs->trans($template->label);
}
} elseif (preg_match('/category:/', $val['type'])) {
if (getDolGlobalString($constname)) {
@@ -364,16 +370,21 @@ if ($action == 'edit') {
}
} elseif ($val['type'] == 'product') {
$product = new Product($db);
- $resprod = $product->fetch(getDolGlobalString($constname));
- if ($resprod > 0) {
- print $product->getNomUrl(1);
- } elseif ($resprod < 0) {
- setEventMessages($product->error, $product->errors, "errors");
+ $idproduct = getDolGlobalString($constname);
+ if ($idproduct > 0) {
+ $resprod = $product->fetch($idproduct);
+ if ($resprod > 0) {
+ print $product->getNomUrl(1);
+ } elseif ($resprod < 0) {
+ setEventMessages($product->error, $product->errors, "errors");
+ }
}
} else {
print getDolGlobalString($constname);
}
- print ' |
';
+ print '';
+
+ print '';
}
}
diff --git a/htdocs/core/class/html.formmail.class.php b/htdocs/core/class/html.formmail.class.php
index 281cfaca58d..74f0eadfdf2 100644
--- a/htdocs/core/class/html.formmail.class.php
+++ b/htdocs/core/class/html.formmail.class.php
@@ -1277,7 +1277,7 @@ class FormMail extends Form
* @param int $id Id of template to get, or -1 for first found with position 0, or 0 for first found whatever is position (priority order depends on lang provided or not) or -2 for exact match with label (no answer if not found)
* @param int $active 1=Only active template, 0=Only disabled, -1=All
* @param string $label Label of template to get
- * @return ModelMail|integer One instance of ModelMail or -1 if error
+ * @return ModelMail|integer One instance of ModelMail or < 0 if error
*/
public function getEMailTemplate($dbs, $type_template, $user, $outputlangs, $id = 0, $active = 1, $label = '')
{