From 7d3162313e5ed26dbebf08b0246ed1e5537c2ae0 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Tue, 27 Feb 2018 10:59:26 +0100 Subject: [PATCH] FIX Temporary dir for mail files must be cleaned at beginning of form --- htdocs/core/class/html.formmail.class.php | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/htdocs/core/class/html.formmail.class.php b/htdocs/core/class/html.formmail.class.php index 1b5d743c350..2fd38d097c0 100644 --- a/htdocs/core/class/html.formmail.class.php +++ b/htdocs/core/class/html.formmail.class.php @@ -252,6 +252,14 @@ class FormMail extends Form $langs->load("other"); $langs->load("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')) + { + $this->clear_attached_files(); + } + + // Call hook getFormMail $hookmanager->initHooks(array('formmail')); $parameters=array( @@ -306,7 +314,6 @@ class FormMail extends Form if (GETPOST('mode','alpha') == 'init' || (GETPOST('modelmailselected','alpha') && GETPOST('modelmailselected','alpha') != '-1')) { - $this->clear_attached_files(); if (! empty($arraydefaultmessage['joinfiles']) && is_array($this->param['fileinit'])) { foreach($this->param['fileinit'] as $file)