Fix debug module eventorganization

This commit is contained in:
Laurent Destailleur 2022-10-18 23:12:15 +02:00
parent 2b2d01cdc9
commit b562ab9948
2 changed files with 25 additions and 14 deletions

View File

@ -220,7 +220,7 @@ if ($action == 'edit') {
foreach ($arrayofparameters as $constname => $val) {
if ($val['enabled']==1) {
$setupnotempty++;
print '<tr class="oddeven"><td>';
print '<tr class="oddeven"><td><!-- '.$constname.' -->';
$tooltiphelp = (($langs->trans($constname . 'Tooltip') != $constname . 'Tooltip') ? $langs->trans($constname . 'Tooltip') : '');
$tooltiphelp .= (($langs->trans($constname . 'Tooltip2') && $langs->trans($constname . 'Tooltip2') != $constname . 'Tooltip2') ? '<br><br>'."\n".$langs->trans($constname . 'Tooltip2') : '');
print '<span id="helplink'.$constname.'" class="spanforparamtooltip">'.$form->textwithpicto($langs->trans($constname), $tooltiphelp, 1, 'info', '', 0, 3, 'tootips'.$constname).'</span>';
@ -313,7 +313,8 @@ if ($action == 'edit') {
foreach ($arrayofparameters as $constname => $val) {
if ($val['enabled']==1) {
$setupnotempty++;
print '<tr class="oddeven"><td>';
print '<tr class="oddeven">';
print '<td><!-- '.$constname.' -->';
$tooltiphelp = (($langs->trans($constname . 'Tooltip') != $constname . 'Tooltip') ? $langs->trans($constname . 'Tooltip') : '');
$tooltiphelp .= (($langs->trans($constname . 'Tooltip2') && $langs->trans($constname . 'Tooltip2') != $constname . 'Tooltip2') ? '<br><br>'."\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 '</td></tr>';
print '</td>';
print '</tr>';
}
}

View File

@ -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 = '')
{