Merge branch '22.0' of git@github.com:Dolibarr/dolibarr.git into develop

This commit is contained in:
ldestailleur
2025-07-21 23:20:42 +02:00
7 changed files with 87 additions and 47 deletions

View File

@@ -158,7 +158,8 @@ The following changes may create regressions for some external modules, but were
* The signature of API get for intervention has been modified to match other get api on other objects. * The signature of API get for intervention has been modified to match other get api on other objects.
* The directory /build has been moved into /dev/build. * The directory /build has been moved into /dev/build.
* The API to create a website account /idthirdparty/accounts/site is now POST (instead of PUT) and to update is PUT (instead of PATCH). * The API to create a website account /idthirdparty/accounts/site is now POST (instead of PUT) and to update is PUT (instead of PATCH).
* Debug v22 - Invert option TICKET_DO_NOT_INCLUDE_LINK_TO_CUSTOMER (that add link to backoffice interface link when it should remain private)
into TICKET_INCLUDE_LINK_TO_PUBLIC_INTERFACE_IN_MESSAGE. It also avoid often emails marked as SPAM due to suspicious link.
***** ChangeLog for 21.0.1 compared to 21.0.0 ***** ***** ChangeLog for 21.0.1 compared to 21.0.0 *****

View File

@@ -198,7 +198,7 @@ if ($action == 'updateMask') {
include_once DOL_DOCUMENT_ROOT."/core/lib/files.lib.php"; include_once DOL_DOCUMENT_ROOT."/core/lib/files.lib.php";
$notification_email = GETPOST('TICKET_NOTIFICATION_EMAIL_FROM', 'alpha'); $notification_email = GETPOST('TICKET_NOTIFICATION_EMAIL_FROM', 'alpha');
$notification_email_description = "Sender of ticket replies sent from Dolibarr"; $notification_email_description = "Email of user allowed to send ticket replies from Dolibarr";
if (!empty($notification_email)) { if (!empty($notification_email)) {
$res = dolibarr_set_const($db, 'TICKET_NOTIFICATION_EMAIL_FROM', $notification_email, 'chaine', 0, $notification_email_description, $conf->entity); $res = dolibarr_set_const($db, 'TICKET_NOTIFICATION_EMAIL_FROM', $notification_email, 'chaine', 0, $notification_email_description, $conf->entity);
} else { // If an empty e-mail address is providen, use the global "FROM" since an empty field will cause other issues } else { // If an empty e-mail address is providen, use the global "FROM" since an empty field will cause other issues
@@ -208,6 +208,17 @@ if ($action == 'updateMask') {
$error++; $error++;
} }
$notification_email_replyto = GETPOST('TICKET_NOTIFICATION_EMAIL_REPLYTO', 'alpha');
$notification_email_replyto_description = "Email that must appears as the sender of ticket replies sent from Dolibarr";
if (!empty($notification_email)) {
$res = dolibarr_set_const($db, 'TICKET_NOTIFICATION_EMAIL_REPLYTO', $notification_email_replyto, 'chaine', 0, $notification_email_replyto_description, $conf->entity);
} else {
$res = dolibarr_set_const($db, 'TICKET_NOTIFICATION_EMAIL_REPLYTO', getDolGlobalString('MAIN_MAIL_EMAIL_FROM'), 'chaine', 0, $notification_email_replyto_description, $conf->entity);
}
if (!($res > 0)) {
$error++;
}
// altairis : differentiate notification email FROM and TO // altairis : differentiate notification email FROM and TO
$notification_email_to = GETPOST('TICKET_NOTIFICATION_EMAIL_TO', 'alpha'); $notification_email_to = GETPOST('TICKET_NOTIFICATION_EMAIL_TO', 'alpha');
$notification_email_to_description = "Notified e-mail for ticket replies sent from Dolibarr"; $notification_email_to_description = "Notified e-mail for ticket replies sent from Dolibarr";
@@ -645,7 +656,7 @@ if (!getDolGlobalString('FCKEDITOR_ENABLE_MAIL')) {
print "</tr>\n"; print "</tr>\n";
} }
// Email to send notifications // Email of sender allowed to send technical notifications
print '<tr class="oddeven"><td><label for="TICKET_NOTIFICATION_EMAIL_FROM" class="block">'.$langs->trans("TicketEmailNotificationFrom").'</label></td>'; print '<tr class="oddeven"><td><label for="TICKET_NOTIFICATION_EMAIL_FROM" class="block">'.$langs->trans("TicketEmailNotificationFrom").'</label></td>';
print '<td class="left">'; print '<td class="left">';
print img_picto('', 'email', 'class="pictofixedwidth"'); print img_picto('', 'email', 'class="pictofixedwidth"');
@@ -655,6 +666,16 @@ print $formcategory->textwithpicto('', $langs->trans("TicketEmailNotificationFro
print '</td>'; print '</td>';
print '</tr>'; print '</tr>';
// Email that must appears as the sender of email notifications
print '<tr class="oddeven"><td><label for="TICKET_NOTIFICATION_EMAIL_REPLYTO" class="block">'.$langs->trans("TicketEmailNotificationReplyTo").'</label></td>';
print '<td class="left">';
print img_picto('', 'email', 'class="pictofixedwidth"');
print '<input type="text" class="minwidth200" id="TICKET_NOTIFICATION_EMAIL_REPLYTO" name="TICKET_NOTIFICATION_EMAIL_REPLYTO" value="' . getDolGlobalString('TICKET_NOTIFICATION_EMAIL_REPLYTO').'"></td>';
print '<td class="center">';
print $formcategory->textwithpicto('', $langs->trans("TicketEmailNotificationReplyToHelp"), 1, 'help');
print '</td>';
print '</tr>';
print '<tr class="oddeven"><td class="titlefieldmiddle"><label for="TICKET_SEND_INTERNAL_CC" class="block">'; print '<tr class="oddeven"><td class="titlefieldmiddle"><label for="TICKET_SEND_INTERNAL_CC" class="block">';
print $form->textwithpicto($langs->trans("TicketSendToInternalCC"), $langs->trans("TicketSendToInternalCCHelp")).'</label></td>'; print $form->textwithpicto($langs->trans("TicketSendToInternalCC"), $langs->trans("TicketSendToInternalCCHelp")).'</label></td>';
print '<td>'; print '<td>';

View File

@@ -145,7 +145,7 @@ if (($action == 'send' || $action == 'relance') && !GETPOST('addfile') && !GETPO
$result = $object->fetch($id); $result = $object->fetch($id);
if (method_exists($object, "fetch_thirdparty") && !in_array($object->element, array('member', 'user', 'expensereport', 'societe', 'contact'))) { if (method_exists($object, "fetch_thirdparty") && !in_array($object->element, array('member', 'user', 'expensereport', 'societe', 'contact'))) {
$resultthirdparty = $object->fetch_thirdparty(); $object->fetch_thirdparty();
$thirdparty = $object->thirdparty; $thirdparty = $object->thirdparty;
if (is_object($thirdparty)) { if (is_object($thirdparty)) {
$sendtosocid = $thirdparty->id; $sendtosocid = $thirdparty->id;

View File

@@ -1685,10 +1685,19 @@ class FormTicket
} }
*/ */
// From // From (and Reply-To if defined)
$from = getDolGlobalString('TICKET_NOTIFICATION_EMAIL_FROM'); $from = getDolGlobalString('TICKET_NOTIFICATION_EMAIL_FROM');
print '<tr class="email_line"><td class="width200"><span class="">'.$langs->trans("MailFrom").'</span></td>'; $replyto = getDolGlobalString('TICKET_NOTIFICATION_EMAIL_REPLYTO');
print '<td><span class="">'.img_picto('', 'email', 'class="pictofixedwidth"').$from.'</span></td></tr>'; print '<tr class="email_line"><td class="width200"><span class="">'.$langs->trans("MailFrom");
if ($replyto) {
print ' <span class="opacitymedium">('.$langs->trans("MailReply").')</span>';
}
print '</span></td>';
print '<td><span class="">'.img_picto('', 'email', 'class="pictofixedwidth"').$from;
if ($replyto) {
print ' <span class="opacitymedium">('.$replyto.')</span>';
}
print '</span></td></tr>';
// Recipients / adressed-to // Recipients / adressed-to
print '<tr class="email_line"><td>'.$langs->trans('MailRecipients'); print '<tr class="email_line"><td>'.$langs->trans('MailRecipients');

View File

@@ -72,8 +72,10 @@ TicketPublicAccess=A public interface requiring no identification is available a
TicketSetupDictionaries=The type of ticket, severity and analytic codes are configurable from dictionaries TicketSetupDictionaries=The type of ticket, severity and analytic codes are configurable from dictionaries
TicketParamModule=Module variable setup TicketParamModule=Module variable setup
TicketParamMail=Email setup TicketParamMail=Email setup
TicketEmailNotificationFrom=Sender e-mail for notification on tickets (creation of ticket or update messages) TicketEmailNotificationFrom=E-mail of sender allowed to send technical notification about tickets (creation of ticket or update messages)
TicketEmailNotificationFromHelp=Sender e-mail to use to send the notification emails for tickets creation or message addition. For example noreply@example.com TicketEmailNotificationFromHelp=Sender e-mail to use as the From to send the notification emails for tickets creation or message addition. For example: noreply@example.com or robot@example.com
TicketEmailNotificationReplyTo=E-mail that must appears to recipient as the sender of the notification (creation of ticket or update messages)
TicketEmailNotificationReplyToHelp=Sender e-mail to use as the Reply-To to send the notification emails for tickets creation or message addition. If defined, this is the email that the recipient will reply to instead of the From. For example: support@example.com
TicketEmailNotificationTo=Notify ticket creation to this e-mail address TicketEmailNotificationTo=Notify ticket creation to this e-mail address
TicketEmailNotificationToHelp=If present, this e-mail address will be notified of a ticket creation (in addition to any other default recipients) TicketEmailNotificationToHelp=If present, this e-mail address will be notified of a ticket creation (in addition to any other default recipients)
TicketNewEmailBodyLabel=Text message sent after creating a ticket TicketNewEmailBodyLabel=Text message sent after creating a ticket

View File

@@ -2902,9 +2902,11 @@ class Ticket extends CommonObject
$from = getDolGlobalString('TICKET_NOTIFICATION_EMAIL_FROM'); $from = getDolGlobalString('TICKET_NOTIFICATION_EMAIL_FROM');
$replyto = getDolGlobalString('TICKET_NOTIFICATION_EMAIL_REPLYTO');
// don't try to send email if no recipient // don't try to send email if no recipient
if (!empty($sendto)) { if (!empty($sendto)) {
$this->sendTicketMessageByEmail($subject, $message, 0, $sendto, $listofpaths, $listofmimes, $listofnames, $sendtocc, $from); $this->sendTicketMessageByEmail($subject, $message, 0, $sendto, $listofpaths, $listofmimes, $listofnames, $sendtocc, $from, $replyto);
} }
} }
@@ -3075,9 +3077,10 @@ class Ticket extends CommonObject
* @param string[] $mimefilename_list List of attached file name in message * @param string[] $mimefilename_list List of attached file name in message
* @param array<string> $array_receiver_cc Array of receiver in CC. Example array('john@doe.com') * @param array<string> $array_receiver_cc Array of receiver in CC. Example array('john@doe.com')
* @param string $from Email from * @param string $from Email from
* @param string $replyto Reply to
* @return boolean True if mail sent to at least one receiver, false otherwise * @return boolean True if mail sent to at least one receiver, false otherwise
*/ */
public function sendTicketMessageByEmail($subject, $message, $send_internal_cc = 0, $array_receiver = array(), $filename_list = array(), $mimetype_list = array(), $mimefilename_list = array(), $array_receiver_cc = array(), $from = '') public function sendTicketMessageByEmail($subject, $message, $send_internal_cc = 0, $array_receiver = array(), $filename_list = array(), $mimetype_list = array(), $mimefilename_list = array(), $array_receiver_cc = array(), $from = '', $replyto = '')
{ {
global $conf, $langs, $user; global $conf, $langs, $user;
@@ -3160,7 +3163,11 @@ class Ticket extends CommonObject
foreach ($array_receiver as $key => $receiver) { foreach ($array_receiver as $key => $receiver) {
$receiverstring .= ($receiverstring ? ',' : '').$receiver; $receiverstring .= ($receiverstring ? ',' : '').$receiver;
} }
$mailfile = new CMailFile($subject, $receiverstring, $from, $message, $filepath, $mimetype, $filename, $sendtocc, '', $deliveryreceipt, -1, '', '', $trackid, $moreinheader, 'ticket', '', $upload_dir_tmp);
$sendcontext = 'ticket';
// Send email
$mailfile = new CMailFile($subject, $receiverstring, $from, $message, $filepath, $mimetype, $filename, $sendtocc, '', $deliveryreceipt, -1, '', '', $trackid, $moreinheader, $sendcontext, $replyto, $upload_dir_tmp);
if ($mailfile->error) { if ($mailfile->error) {