Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

FROM field becomes empty upon saving email template [EASY FIX PROPOSED AND TESTED] #31997

Closed
caos30 opened this issue Nov 19, 2024 · 1 comment
Labels
Bug This is a bug (something does not work as expected)

Comments

@caos30
Copy link

caos30 commented Nov 19, 2024

Bug

When modifying an email template (on Admin Tools) the "email_from" field is being saved as empty value. It worked fine on version 20.0.0 but on 20.0.1 & 20.0.2 it fails.

The problem and solutions is very easy @eldy , i think that it was a simple missing fault, just on file

/htdocs/admin/mail_templates.php (line #477) 

now appears this:

if ($field == 'topic') {
	$_POST['topic'] = GETPOST('topic-'.$rowid);
}
if ($field == 'joinfiles') {
	$_POST['joinfiles'] = GETPOST('joinfiles-'.$rowid);
}
if ($field == 'content') {
	$_POST['content'] = GETPOST('content-'.$rowid, 'restricthtml');
}
if ($field == 'content_lines') {
	$_POST['content_lines'] = GETPOST('content_lines-'.$rowid, 'restricthtml');
}

And it's missing another IF for email_from field:

if ($field == 'email_from') {
	$_POST['email_from'] = GETPOST('email_from-'.$rowid);
}

Perhaps you also would like to add somekind of "well-formed email address" check before to save the email... i don't know. But in any case, this simple patch solve the problem saving this field of the email template.

Dolibarr Version

20.0.1 & 20.0.2

Environment PHP

No response

Environment Database

No response

Steps to reproduce the behavior and expected behavior

  1. try to modify an existing email template
  2. set a "From" email address and save changes
  3. modify again the same template and you will see that "From" box is empty

Note: the saving works fine when CREATING a template, but not when MODIFYING it.

Attached files

No response

@caos30 caos30 added the Bug This is a bug (something does not work as expected) label Nov 19, 2024
@eldy eldy closed this as completed in 023856c Nov 19, 2024
@daowanatel
Copy link

daowanatel commented Nov 20, 2024

actually the file is /htdocs/admin/mails_templates.php

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bug This is a bug (something does not work as expected)
Projects
None yet
Development

No branches or pull requests

2 participants