WIP : sendEmailsReminder()

This commit is contained in:
atm-lena 2020-08-27 12:30:59 +02:00
parent acb50950a4
commit f57325237a
2 changed files with 19 additions and 1 deletions

View File

@ -28,6 +28,8 @@
*/
require_once DOL_DOCUMENT_ROOT.'/comm/action/class/cactioncomm.class.php';
require_once DOL_DOCUMENT_ROOT.'/core/class/commonobject.class.php';
require_once DOL_DOCUMENT_ROOT.'/core/class/html.formmail.class.php';
/**
@ -1949,7 +1951,7 @@ class ActionComm extends CommonObject
*/
public function sendEmailsReminder()
{
global $conf, $langs;
global $conf, $langs, $user;
$error = 0;
$this->output = '';
@ -1976,6 +1978,21 @@ class ActionComm extends CommonObject
// TODO Scan events of type 'email' into table llx_actioncomm_reminder with status todo, send email, then set status to done
$sql = "SELECT rowid as id, fk_email_template FROM ".MAIN_DB_PREFIX."actioncomm_reminder WHERE typeremind = 'email'";
$resql = $this->db->query($sql);
if($resql){
while($obj = $this->db->fetch_object($resql)){
$formmail = new FormMail($this->db);
$arraymessage = $formmail->getEMailTemplate($this->db, 'actioncomm_send', $user, $langs, (!empty($obj->fk_email_template)) ? $obj->fk_email_template : 0, 1, '(SendingReminderActionComm)');
}
} else {
$error++;
}
// Delete also very old past events (we do not keep more than 1 month record in past)
$sql = "DELETE FROM ".MAIN_DB_PREFIX."actioncomm_reminder WHERE dateremind < '".$this->db->jdate($now - (3600 * 24 * 32))."'";
$this->db->query($sql);

View File

@ -117,6 +117,7 @@ SendingEmailOnMemberValidation=Sending email on new member validation
SendingEmailOnNewSubscription=Sending email on new subscription
SendingReminderForExpiredSubscription=Sending reminder for expired subscriptions
SendingEmailOnCancelation=Sending email on cancelation
SendingReminderActionComm=Sending reminder for agenda event
# Topic of email templates
YourMembershipRequestWasReceived=Your membership was received.
YourMembershipWasValidated=Your membership was validated