X-Git-Url: http://wagnertech.de/git?a=blobdiff_plain;f=WEB-INF%2Flib%2FttReportHelper.class.php;h=c66cb33aa3a25e2a54d6f4482513b19eb5cc72c3;hb=cd1db85db249a747c6943f6adbe981c3706e0607;hp=56a4aa805ad379edadbf3e22fd6cbbc6e9a4b288;hpb=db2ca21db73a2ea52155510e1e0300541d6b9ef6;p=timetracker.git diff --git a/WEB-INF/lib/ttReportHelper.class.php b/WEB-INF/lib/ttReportHelper.class.php index 56a4aa80..c66cb33a 100644 --- a/WEB-INF/lib/ttReportHelper.class.php +++ b/WEB-INF/lib/ttReportHelper.class.php @@ -1300,6 +1300,20 @@ class ttReportHelper { return $body; } + // checkFavReportCondition - checks whether it is okay to send fav report. + static function checkFavReportCondition($report, $condition) + { + $items = ttReportHelper::getFavItems($report); + + $condition = str_replace('count', '', $condition); + $count_required = intval(trim(str_replace('>', '', $condition))); + + if (count($items) > $count_required) + return true; // Condition ok. + + return false; + } + // prepareFavReportBody - prepares an email body for a favorite report. static function prepareFavReportBody($report) { @@ -1559,9 +1573,9 @@ class ttReportHelper { } // sendFavReport - sends a favorite report to a specified email, called from cron.php - static function sendFavReport($report, $email) { + static function sendFavReport($report, $subject, $email, $cc) { // We are called from cron.php, we have no $bean in session. - // cron.php set global $user and $i18n objects to match our favorite report user. + // cron.php sets global $user and $i18n objects to match our favorite report user. global $user; global $i18n; @@ -1573,9 +1587,14 @@ class ttReportHelper { $mailer->setCharSet(CHARSET); $mailer->setContentType('text/html'); $mailer->setSender(SENDER); + if (!empty($cc)) + $mailer->setReceiverCC($cc); + if (!empty($user->bcc_email)) + $mailer->setReceiverBCC($user->bcc_email); $mailer->setReceiver($email); $mailer->setMailMode(MAIL_MODE); - if (!$mailer->send($report['name'], $body)) + if (empty($subject)) $subject = $report['name']; + if (!$mailer->send($subject, $body)) return false; return true;