X-Git-Url: http://wagnertech.de/gitweb/gitweb.cgi/timetracker.git/blobdiff_plain/14452b9930953c2692a7281978d90beabd8d010e..3655c5052140f504072336ec2d13dfc28dbd8957:/cron.php diff --git a/cron.php b/cron.php index 9212e558..d7825461 100644 --- a/cron.php +++ b/cron.php @@ -46,7 +46,6 @@ import('ttReportHelper'); $mdb2 = getConnection(); $now = mktime(); -$now = 1473548400; $sql = "select * from tt_cron where $now >= next and status = 1 and report_id is not null and email is not null"; @@ -65,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".