scripts in de database

This commit is contained in:
2026-08-28 12:17:50 +02:00
parent 51187f8537
commit 2f92328461
179 changed files with 7344 additions and 0 deletions
+45
View File
@@ -0,0 +1,45 @@
// last execution: 2026-08-28 08:00:01
$jobs = entity\getMany('Script', 100, 'name', 'asc', 'type=', 'job');
logAdd(log);
html = '';
logAdd(log, 'info', 'Mailen laatste taken logs');
$html = "";
$i = 0;
$n = array\length($jobs);
while($i < $n,
$job = array\at($jobs, $i);
$log = attr($job, 'log');
$name = attr($job, 'name');
$last_exec = datetime\format(attr($job, 'lastexec'), 'Europe/Amsterdam', 'DD/MM/YYYY HH:mm:ss');
strAdd($html, '<h3>', $name, '</h3>');
strAdd($html, '<p>', 'Laatste uitvoering: ', $last_exec, '</p>');
$html = string\concatenate($html, '<table><tbody>', $log, '</tbody></table>');
$i = $i + 1;
);
$body = emailTemplate;
$body = string\replace($body, '{{log}}', $html);
$dt = datetime\format(datetime\now(), 'Europe/Amsterdam', 'DD/MM/YYYY');
$subject = string\concatenate('NVKH Crm - Job Verslag - ', $dt);
$userId = env\userAttribute('id');
$mailadr = configGet('job-report-mail-address');
$emailId = record\create('Email', 'subject', $subject,
'body', $body,
'to', $mailadr,
'assignedUser', $userId,
'isUser', true,
'parentType', 'Script',
'parentId', id
);
ext\email\send($emailId);
logAdd(log, 'info', 'Mail gestuurd naar ', $mailadr);