Merge pull request #16535 from atm-greg/Fix_attach_files_when_models_are_available

Fix : if mailmodels exist in database attached files are always cleared
This commit is contained in:
Laurent Destailleur 2021-03-04 16:45:00 +01:00 committed by GitHub
commit 672a07fdac
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -332,7 +332,7 @@ class FormMail extends Form
$langs->loadLangs(array('other', 'mails'));
// Clear temp files. Must be done at beginning, before call of triggers
if (GETPOST('mode', 'alpha') == 'init' || (GETPOST('modelmailselected', 'alpha') && GETPOST('modelmailselected', 'alpha') != '-1'))
if (GETPOST('mode', 'alpha') == 'init' || (GETPOST('modelselected') && GETPOST('modelmailselected', 'alpha') && GETPOST('modelmailselected', 'alpha') != '-1'))
{
$this->clear_attached_files();
}