From c2f91b2e15cec9f680041aef260d348a2b2213cd Mon Sep 17 00:00:00 2001 From: VESSILLER Date: Fri, 3 Feb 2023 14:02:46 +0100 Subject: [PATCH 1/4] FIX attach file and send by mail in ticket --- htdocs/core/class/html.formticket.class.php | 8 ++++---- htdocs/ticket/class/ticket.class.php | 2 +- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/htdocs/core/class/html.formticket.class.php b/htdocs/core/class/html.formticket.class.php index cea007f8e61..cd6b9ecd7fc 100644 --- a/htdocs/core/class/html.formticket.class.php +++ b/htdocs/core/class/html.formticket.class.php @@ -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)); } } } diff --git a/htdocs/ticket/class/ticket.class.php b/htdocs/ticket/class/ticket.class.php index e03bdabe617..d12df619bb0 100644 --- a/htdocs/ticket/class/ticket.class.php +++ b/htdocs/ticket/class/ticket.class.php @@ -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']; From 55d6e2ead026cf7dde9124e26432d97e3b63a9b5 Mon Sep 17 00:00:00 2001 From: tnegre Date: Tue, 7 Feb 2023 17:24:16 +0100 Subject: [PATCH 2/4] Fix prelevement line : the link to the facture was to a customer facture, even when it was a facturefourn. --- htdocs/compta/prelevement/line.php | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/htdocs/compta/prelevement/line.php b/htdocs/compta/prelevement/line.php index cba7777b734..6eb10ce6a1a 100644 --- a/htdocs/compta/prelevement/line.php +++ b/htdocs/compta/prelevement/line.php @@ -309,7 +309,11 @@ if ($id) { print img_object($langs->trans("ShowBill"), "bill"); print ' '; - print ''.$obj->ref."\n"; + if ($type == 'bank-transfer') { + print ''.$obj->ref."\n"; + } else { + print ''.$obj->ref."\n"; + } print ''; print img_object($langs->trans("ShowCompany"), "company").' '.$obj->name."\n"; From b880029ac048e3b3e256fac1baf24f2451348a3f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?No=C3=A9=20Cendrier?= Date: Wed, 8 Feb 2023 09:58:30 +0100 Subject: [PATCH 3/4] typos in getAttchments() $arrayobject --- htdocs/emailcollector/class/emailcollector.class.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/htdocs/emailcollector/class/emailcollector.class.php b/htdocs/emailcollector/class/emailcollector.class.php index 53889ef9c07..5d0c92b4c32 100644 --- a/htdocs/emailcollector/class/emailcollector.class.php +++ b/htdocs/emailcollector/class/emailcollector.class.php @@ -1951,7 +1951,7 @@ class EmailCollector extends CommonObject 'ticket' => array('table' => 'ticket', 'fields' => array('ref'), 'class' => 'ticket/class/ticket.class.php', - 'object' => ' Ticket'), + 'object' => 'Ticket'), 'knowledgemanagement' => array('table' => 'knowledgemanagement_knowledgerecord', 'fields' => array('ref'), 'class' => 'knowledgemanagement/class/knowledgemanagement.class.php', @@ -1969,7 +1969,7 @@ class EmailCollector extends CommonObject 'class' => 'compta/facture/class/facture.class.php', 'object' => 'Facture'), 'fournisseur/facture' => array('table' => 'facture_fourn', - 'fields' => array('ref', ref_client), + 'fields' => array('ref', 'ref_client'), 'class' => 'fourn/class/fournisseur.facture.class.php', 'object' => 'FactureFournisseur'), 'produit' => array('table' => 'product', From 01e0503b0f073fa39056f168b8fe6cf049e0cd3e Mon Sep 17 00:00:00 2001 From: VESSILLER Date: Thu, 9 Feb 2023 11:52:41 +0100 Subject: [PATCH 4/4] FIX several email sent to the same recipient when adding message from ticket --- htdocs/ticket/class/ticket.class.php | 28 ++++++++++++++-------------- 1 file changed, 14 insertions(+), 14 deletions(-) diff --git a/htdocs/ticket/class/ticket.class.php b/htdocs/ticket/class/ticket.class.php index d12df619bb0..122c5ae35ab 100644 --- a/htdocs/ticket/class/ticket.class.php +++ b/htdocs/ticket/class/ticket.class.php @@ -2576,24 +2576,24 @@ class Ticket extends CommonObject $assigned_user = new User($this->db); $assigned_user->fetch($this->fk_user_assign); if (!empty($assigned_user->email)) { - $sendto[] = $assigned_user->getFullName($langs)." <".$assigned_user->email.">"; + $sendto[$assigned_user->email] = $assigned_user->getFullName($langs)." <".$assigned_user->email.">"; } else { $assigned_user_dont_have_email = $assigned_user->getFullName($langs); } } if (empty($sendto)) { if (!empty($conf->global->TICKET_PUBLIC_NOTIFICATION_NEW_MESSAGE_DEFAULT_EMAIL)) { - $sendto[] = $conf->global->TICKET_PUBLIC_NOTIFICATION_NEW_MESSAGE_DEFAULT_EMAIL; + $sendto[$conf->global->TICKET_PUBLIC_NOTIFICATION_NEW_MESSAGE_DEFAULT_EMAIL] = $conf->global->TICKET_PUBLIC_NOTIFICATION_NEW_MESSAGE_DEFAULT_EMAIL; } elseif (!empty($conf->global->TICKET_NOTIFICATION_EMAIL_TO)) { - $sendto[] = $conf->global->TICKET_NOTIFICATION_EMAIL_TO; + $sendto[$conf->global->TICKET_NOTIFICATION_EMAIL_TO] = $conf->global->TICKET_NOTIFICATION_EMAIL_TO; } } // Add global email address recipient if (!empty($conf->global->TICKET_NOTIFICATION_ALSO_MAIN_ADDRESS) && - !empty($conf->global->TICKET_NOTIFICATION_EMAIL_TO) && !in_array($conf->global->TICKET_NOTIFICATION_EMAIL_TO, $sendto) + !empty($conf->global->TICKET_NOTIFICATION_EMAIL_TO) && !array_key_exists($conf->global->TICKET_NOTIFICATION_EMAIL_TO, $sendto) ) { - $sendto[] = $conf->global->TICKET_NOTIFICATION_EMAIL_TO; + $sendto[$conf->global->TICKET_NOTIFICATION_EMAIL_TO] = $conf->global->TICKET_NOTIFICATION_EMAIL_TO; } if (!empty($sendto)) { @@ -2677,7 +2677,7 @@ class Ticket extends CommonObject if ($info_sendto['email'] != '') { if (!empty($info_sendto['email'])) { - $sendto[] = trim($info_sendto['firstname']." ".$info_sendto['lastname'])." <".$info_sendto['email'].">"; + $sendto[$info_sendto['email']] = trim($info_sendto['firstname']." ".$info_sendto['lastname'])." <".$info_sendto['email'].">"; } //Contact type @@ -2693,9 +2693,9 @@ class Ticket extends CommonObject $message .= '
'.$langs->trans('TicketNotificationEmailBodyInfosTrackUrlinternal').' : '.$object->track_id.'
'; // Add global email address recipient - if ($conf->global->TICKET_NOTIFICATION_ALSO_MAIN_ADDRESS && !in_array($conf->global->TICKET_NOTIFICATION_EMAIL_TO, $sendto)) { + if ($conf->global->TICKET_NOTIFICATION_ALSO_MAIN_ADDRESS && !array_key_exists($conf->global->TICKET_NOTIFICATION_EMAIL_TO, $sendto)) { if (!empty($conf->global->TICKET_NOTIFICATION_EMAIL_TO)) { - $sendto[] = $conf->global->TICKET_NOTIFICATION_EMAIL_TO; + $sendto[$conf->global->TICKET_NOTIFICATION_EMAIL_TO] = $conf->global->TICKET_NOTIFICATION_EMAIL_TO; } } @@ -2755,7 +2755,7 @@ class Ticket extends CommonObject if ($info_sendto['email'] != '' && $info_sendto['email'] != $object->origin_email) { if (!empty($info_sendto['email'])) { - $sendto[] = trim($info_sendto['firstname']." ".$info_sendto['lastname'])." <".$info_sendto['email'].">"; + $sendto[$info_sendto['email']] = trim($info_sendto['firstname']." ".$info_sendto['lastname'])." <".$info_sendto['email'].">"; } $recipient = dolGetFirstLastname($info_sendto['firstname'], $info_sendto['lastname'], '-1').' ('.strtolower($info_sendto['libelle']).')'; @@ -2775,21 +2775,21 @@ class Ticket extends CommonObject $message .= '
'.$message_signature; if (!empty($object->origin_email)) { - $sendto[] = $object->origin_email; + $sendto[$object->origin_email] = $object->origin_email; } - if ($object->fk_soc > 0 && !in_array($object->origin_email, $sendto)) { + if ($object->fk_soc > 0 && !array_key_exists($object->origin_email, $sendto)) { $object->socid = $object->fk_soc; $object->fetch_thirdparty(); if (!empty($object->thirdparty->email)) { - $sendto[] = $object->thirdparty->email; + $sendto[$object->thirdparty->email] = $object->thirdparty->email; } } // altairis: Add global email address reciepient - if ($conf->global->TICKET_NOTIFICATION_ALSO_MAIN_ADDRESS && !in_array($conf->global->TICKET_NOTIFICATION_EMAIL_TO, $sendto)) { + if ($conf->global->TICKET_NOTIFICATION_ALSO_MAIN_ADDRESS && !array_key_exists($conf->global->TICKET_NOTIFICATION_EMAIL_TO, $sendto)) { if (!empty($conf->global->TICKET_NOTIFICATION_EMAIL_TO)) { - $sendto[] = $conf->global->TICKET_NOTIFICATION_EMAIL_TO; + $sendto[$conf->global->TICKET_NOTIFICATION_EMAIL_TO] = $conf->global->TICKET_NOTIFICATION_EMAIL_TO; } }