|
@@ -910,7 +910,7 @@ class FormTicket
|
|
|
$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();
|
|
|
}
|
|
|
|
|
@@ -943,10 +943,10 @@ class FormTicket
|
|
|
$listofmimes = array();
|
|
|
$keytoavoidconflict = empty($this->trackid) ? '' : '-'.$this->trackid; // this->trackid must be defined
|
|
|
|
|
|
- if (GETPOST('mode', 'alpha') == 'init' || (GETPOST('modelmailselected', 'alpha') && GETPOST('modelmailselected', 'alpha') != '-1')) {
|
|
|
- if (!empty($arraydefaultmessage->joinfiles) && is_array($this->param['fileinit'])) {
|
|
|
+ if (GETPOST('mode', 'alpha') == 'init' || (GETPOST('modelselected') && GETPOST('modelmailselected', 'alpha') && GETPOST('modelmailselected', 'alpha') != '-1')) {
|
|
|
+ if (!empty($arraydefaultmessage->joinfiles) && !empty($this->param['fileinit']) && is_array($this->param['fileinit'])) {
|
|
|
foreach ($this->param['fileinit'] as $file) {
|
|
|
- $this->add_attached_files($file, basename($file), dol_mimetype($file));
|
|
|
+ $formmail->add_attached_files($file, basename($file), dol_mimetype($file));
|
|
|
}
|
|
|
}
|
|
|
}
|