FIX sending email on payment of registration of event
This commit is contained in:
parent
9f379dfcf4
commit
c55da219d9
@ -1254,9 +1254,9 @@ class FormMail extends Form
|
|||||||
* @param string $type_template Get message for model/type=$type_template, type='all' also included.
|
* @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 User $user Get template public or limited to this user
|
||||||
* @param Translate $outputlangs Output lang object
|
* @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 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
|
* @return ModelMail|integer One instance of ModelMail or -1 if error
|
||||||
*/
|
*/
|
||||||
public function getEMailTemplate($db, $type_template, $user, $outputlangs, $id = 0, $active = 1, $label = '')
|
public function getEMailTemplate($db, $type_template, $user, $outputlangs, $id = 0, $active = 1, $label = '')
|
||||||
|
|||||||
@ -1264,17 +1264,21 @@ if ($ispaymentok) {
|
|||||||
// Get email content from template
|
// Get email content from template
|
||||||
$arraydefaultmessage = null;
|
$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)) {
|
if (!empty($idoftemplatetouse)) {
|
||||||
$arraydefaultmessage = $formmail->getEMailTemplate($db, 'conferenceorbooth', $user, $outputlangs, $labeltouse, 1, '');
|
$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;
|
$subject = $arraydefaultmessage->topic;
|
||||||
$msg = $arraydefaultmessage->content;
|
$msg = $arraydefaultmessage->content;
|
||||||
|
} else {
|
||||||
|
$subject = '['.$object->ref.' - '.$outputlangs->trans("NewRegistration").']';
|
||||||
|
$msg = $outputlangs->trans("OrganizationEventPaymentOfRegistrationWasReceived");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
$substitutionarray = getCommonSubstitutionArray($outputlangs, 0, null, $thirdparty);
|
$substitutionarray = getCommonSubstitutionArray($outputlangs, 0, null, $thirdparty);
|
||||||
complete_substitutions_array($substitutionarray, $outputlangs, $object);
|
complete_substitutions_array($substitutionarray, $outputlangs, $object);
|
||||||
|
|
||||||
@ -1293,7 +1297,7 @@ if ($ispaymentok) {
|
|||||||
if ($result) {
|
if ($result) {
|
||||||
dol_syslog("EMail sent to ".$sendto, LOG_DEBUG, 0, '_payment');
|
dol_syslog("EMail sent to ".$sendto, LOG_DEBUG, 0, '_payment');
|
||||||
} else {
|
} 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
|
// Get email content from template
|
||||||
$arraydefaultmessage = null;
|
$arraydefaultmessage = null;
|
||||||
|
|
||||||
$labeltouse = $conf->global->EVENTORGANIZATION_TEMPLATE_EMAIL_AFT_SUBS_EVENT;
|
$idoftemplatetouse = $conf->global->EVENTORGANIZATION_TEMPLATE_EMAIL_AFT_SUBS_BOOTH; // Email sent after registration for a Booth
|
||||||
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;
|
$subject = $arraydefaultmessage->topic;
|
||||||
$msg = $arraydefaultmessage->content;
|
$msg = $arraydefaultmessage->content;
|
||||||
|
} else {
|
||||||
|
$subject = '['.$booth->ref.' - '.$outputlangs->trans("NewRegistration").']';
|
||||||
|
$msg = $outputlangs->trans("OrganizationEventPaymentOfBoothWasReceived");
|
||||||
}
|
}
|
||||||
|
|
||||||
$substitutionarray = getCommonSubstitutionArray($outputlangs, 0, null, $thirdparty);
|
$substitutionarray = getCommonSubstitutionArray($outputlangs, 0, null, $thirdparty);
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user