FIX attach file and send by mail in ticket

This commit is contained in:
VESSILLER 2023-02-03 14:02:46 +01:00
parent 5395a4ab4b
commit c2f91b2e15
2 changed files with 5 additions and 5 deletions

View File

@ -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));
}
}
}

View File

@ -2454,7 +2454,7 @@ class Ticket extends CommonObject
$maxheightmini = 72;
$formmail = new FormMail($this->db);
$formmail->trackid = 'tic'.$this->id;
$attachedfiles = $formmail->get_attached_files();
$filepath = $attachedfiles['paths'];