Skip to content

Commit a086f12

Browse files
committed
Fix bad email sent in free mode
1 parent 87205a8 commit a086f12

File tree

1 file changed

+9
-2
lines changed

1 file changed

+9
-2
lines changed

class/sellyoursaasutils.class.php

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -835,8 +835,15 @@ public function doAlertHardEndTrial()
835835
$outputlangs->loadLangs(array('main'));
836836

837837
// @TODO Save in cache $arraydefaultmessage for each $object->thirdparty->default_lang and reuse it to avoid getEMailTemplate called each time
838-
dol_syslog("We will call getEMailTemplate for type 'contract', label 'HardTrialExpiringReminder', outputlangs->defaultlang=".$outputlangs->defaultlang);
839-
$arraydefaultmessage=$formmail->getEMailTemplate($this->db, 'contract', $user, $outputlangs, 0, 1, 'HardTrialExpiringReminder');
838+
if ($object->thirdparty->array_options['options_checkboxnonprofitorga'] == 'nonprofit' && getDolGlobalInt("SELLYOURSAAS_ENABLE_FREE_PAYMENT_MODE")) {
839+
dol_syslog("We will call getEMailTemplate for type 'contract', label 'HardTrialExpiringReminderFreeInstance', outputlangs->defaultlang=".$outputlangs->defaultlang);
840+
$arraydefaultmessage = $formmail->getEMailTemplate($this->db, 'contract', $user, $outputlangs, 0, 1, 'HardTrialExpiringReminderFreeInstance');
841+
dol_syslog("Topic found is ".$arraydefaultmessage->topic);
842+
} else {
843+
dol_syslog("We will call getEMailTemplate for type 'contract', label 'HardTrialExpiringReminder', outputlangs->defaultlang=".$outputlangs->defaultlang);
844+
$arraydefaultmessage = $formmail->getEMailTemplate($this->db, 'contract', $user, $outputlangs, 0, 1, 'HardTrialExpiringReminder');
845+
dol_syslog("Topic found is ".$arraydefaultmessage->topic);
846+
}
840847

841848
$substitutionarray=getCommonSubstitutionArray($outputlangs, 0, null, $object);
842849
$substitutionarray['__SELLYOURSAAS_EXPIRY_DATE__']=dol_print_date($expirationdate, 'day', 'tzserver', $outputlangs);

0 commit comments

Comments
 (0)