- // Email report.
- if (ttReportHelper::sendFavReport($report, $val['email']))
- echo "Report ".$val['report_id']. " sent to ".$val['email']."<br>";
- else
- echo "Error while emailing report...<br>";
-
+ // 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['subject'], $val['email'], $val['cc']))
+ echo "Report ".$val['report_id']. " sent to ".$val['email']."<br>";
+ else
+ echo "Error while emailing report...<br>";
+ }
+