X-Git-Url: http://wagnertech.de/gitweb/gitweb.cgi/timetracker.git/blobdiff_plain/0040233ec546afbe413861e356e26351468c4992..4af7dd7e10968588fe4c2828be5402f41d53ebc5:/cron.php
diff --git a/cron.php b/cron.php
index 7be547d6..d7825461 100644
--- a/cron.php
+++ b/cron.php
@@ -64,11 +64,18 @@ while ($val = $res->fetchRow()) {
$user = new ttUser(null, $report['user_id']);
$i18n->load($user->lang);
- // Email report.
- if (ttReportHelper::sendFavReport($report, $val['email']))
- echo "Report ".$val['report_id']. " sent to ".$val['email']."
";
- else
- echo "Error while emailing report...
";
+ // Check condition on a report.
+ $condition_ok = true;
+ if ($val['report_condition'])
+ $condition_ok = ttReportHelper::checkFavReportCondition($report, $val['report_condition']);
+
+ // Email report if condition is okay.
+ if ($condition_ok) {
+ if (ttReportHelper::sendFavReport($report, $val['email']))
+ echo "Report ".$val['report_id']. " sent to ".$val['email']."
";
+ else
+ echo "Error while emailing report...
";
+ }
// Calculate next execution time.
$next = tdCron::getNextOccurrence($val['cron_spec'], $now + 60); // +60 sec is here to get us correct $next when $now is close to existing "next".