init mail body properly

This commit is contained in:
Uwe Steinmann 2025-06-06 14:12:28 +02:00
parent 00c3a63ff1
commit bfe4641920

View File

@ -27,8 +27,6 @@ class SeedDMS_ExpiredDocumentsTask extends SeedDMS_SchedulerTaskBase { /* {{{ */
$tableformathead = " %-10s %5s %-60s";
$tableformathtml = "<tr><td>%s</td><td>%d</td><td>%s</td></tr>";
$tableformatheadhtml = "<tr><th>%s</th><th>%s</th><th>%s</th></tr>";
$body = '';
$bodyhtml = '';
require_once('inc/inc.ClassEmailNotify.php');
$email = new SeedDMS_EmailNotify($dms, $settings->_smtpSendFrom, $settings->_smtpServer, $settings->_smtpPort, $settings->_smtpUser, $settings->_smtpPassword);
@ -39,6 +37,8 @@ class SeedDMS_ExpiredDocumentsTask extends SeedDMS_SchedulerTaskBase { /* {{{ */
if(!$u->isGuest() && !$u->isDisabled()) {
$docs = $dms->getDocumentsExpired(intval($taskparams['days']), $u);
if (count($docs)>0) {
$body = '';
$bodyhtml = '';
$bodyhtml .= "<table>".PHP_EOL;
$bodyhtml .= sprintf($tableformatheadhtml."\n", getMLText("expires", array(), ""), "ID", getMLText("name", array(), ""));
$body .= sprintf($tableformathead."\n", getMLText("expires", array(), ""), "ID", getMLText("name", array(), ""));
@ -66,6 +66,8 @@ class SeedDMS_ExpiredDocumentsTask extends SeedDMS_SchedulerTaskBase { /* {{{ */
} elseif($taskparams['email']) {
$docs = $dms->getDocumentsExpired(intval($taskparams['days']));
if (count($docs)>0) {
$body = '';
$bodyhtml = '';
$bodyhtml .= "<table>".PHP_EOL;
$bodyhtml .= sprintf($tableformatheadhtml."\n", getMLText("expiration_date", array(), ""), "ID", getMLText("name", array(), ""));
$body .= sprintf($tableformathead."\n", getMLText("expiration_date", array(), ""), "ID", getMLText("name", array(), ""));