diff --git a/htdocs/core/class/html.formmail.class.php b/htdocs/core/class/html.formmail.class.php
index 72b4050f9b3..fd0a7c7a63f 100644
--- a/htdocs/core/class/html.formmail.class.php
+++ b/htdocs/core/class/html.formmail.class.php
@@ -1254,9 +1254,9 @@ class FormMail extends Form
* @param string $type_template Get message for model/type=$type_template, type='all' also included.
* @param User $user Get template public or limited to this user
* @param Translate $outputlangs Output lang object
- * @param int $id Id of template to find, or -1 for first found with position 0, or 0 for first found whatever is position (priority order depends on lang provided or not) or -2 for exact match with label (no answer if not found)
+ * @param int $id Id of template to get, or -1 for first found with position 0, or 0 for first found whatever is position (priority order depends on lang provided or not) or -2 for exact match with label (no answer if not found)
* @param int $active 1=Only active template, 0=Only disabled, -1=All
- * @param string $label Label of template
+ * @param string $label Label of template to get
* @return ModelMail|integer One instance of ModelMail or -1 if error
*/
public function getEMailTemplate($db, $type_template, $user, $outputlangs, $id = 0, $active = 1, $label = '')
diff --git a/htdocs/public/payment/paymentok.php b/htdocs/public/payment/paymentok.php
index 5bf78e9e17a..ecc19b75ab5 100644
--- a/htdocs/public/payment/paymentok.php
+++ b/htdocs/public/payment/paymentok.php
@@ -1264,17 +1264,21 @@ if ($ispaymentok) {
// Get email content from template
$arraydefaultmessage = null;
- $labeltouse = $conf->global->EVENTORGANIZATION_TEMPLATE_EMAIL_AFT_SUBS_EVENT;
+ $idoftemplatetouse = $conf->global->EVENTORGANIZATION_TEMPLATE_EMAIL_AFT_SUBS_EVENT; // Email to send for Event organization registration
- if (!empty($labeltouse)) {
- $arraydefaultmessage = $formmail->getEMailTemplate($db, 'conferenceorbooth', $user, $outputlangs, $labeltouse, 1, '');
+ if (!empty($idoftemplatetouse)) {
+ $arraydefaultmessage = $formmail->getEMailTemplate($db, 'conferenceorbooth', $user, $outputlangs, $idoftemplatetouse, 1, '');
}
- if (!empty($labeltouse) && is_object($arraydefaultmessage) && $arraydefaultmessage->id > 0) {
+ if (!empty($idoftemplatetouse) && is_object($arraydefaultmessage) && $arraydefaultmessage->id > 0) {
$subject = $arraydefaultmessage->topic;
$msg = $arraydefaultmessage->content;
+ } else {
+ $subject = '['.$object->ref.' - '.$outputlangs->trans("NewRegistration").']';
+ $msg = $outputlangs->trans("OrganizationEventPaymentOfRegistrationWasReceived");
}
+
$substitutionarray = getCommonSubstitutionArray($outputlangs, 0, null, $thirdparty);
complete_substitutions_array($substitutionarray, $outputlangs, $object);
@@ -1293,7 +1297,7 @@ if ($ispaymentok) {
if ($result) {
dol_syslog("EMail sent to ".$sendto, LOG_DEBUG, 0, '_payment');
} else {
- dol_syslog("Failed to send EMail to ".$sendto, LOG_ERR, 0, '_payment');
+ dol_syslog("Failed to send EMail to ".$sendto.' - '.$mailfile->error, LOG_ERR, 0, '_payment');
}
}
}
@@ -1449,14 +1453,18 @@ if ($ispaymentok) {
// Get email content from template
$arraydefaultmessage = null;
- $labeltouse = $conf->global->EVENTORGANIZATION_TEMPLATE_EMAIL_AFT_SUBS_EVENT;
- if (!empty($labeltouse)) {
- $arraydefaultmessage = $formmail->getEMailTemplate($db, 'conferenceorbooth', $user, $outputlangs, $labeltouse, 1, '');
+ $idoftemplatetouse = $conf->global->EVENTORGANIZATION_TEMPLATE_EMAIL_AFT_SUBS_BOOTH; // Email sent after registration for a Booth
+
+ if (!empty($idoftemplatetouse)) {
+ $arraydefaultmessage = $formmail->getEMailTemplate($db, 'conferenceorbooth', $user, $outputlangs, $idoftemplatetouse, 1, '');
}
- if (!empty($labeltouse) && is_object($arraydefaultmessage) && $arraydefaultmessage->id > 0) {
+ if (!empty($idoftemplatetouse) && is_object($arraydefaultmessage) && $arraydefaultmessage->id > 0) {
$subject = $arraydefaultmessage->topic;
$msg = $arraydefaultmessage->content;
+ } else {
+ $subject = '['.$booth->ref.' - '.$outputlangs->trans("NewRegistration").']';
+ $msg = $outputlangs->trans("OrganizationEventPaymentOfBoothWasReceived");
}
$substitutionarray = getCommonSubstitutionArray($outputlangs, 0, null, $thirdparty);