]> wagnertech.de Git - timetracker.git/blobdiff - WEB-INF/lib/ttReportHelper.class.php
Added Bcc option for team managers.
[timetracker.git] / WEB-INF / lib / ttReportHelper.class.php
index ae90374c134a6ba9b716785b9a8b04b082599370..f1fc59084b2c33443386a1f79311888db7965a85 100644 (file)
@@ -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)
   {
@@ -1561,7 +1575,7 @@ class ttReportHelper {
   // sendFavReport - sends a favorite report to a specified email, called from cron.php
   static function sendFavReport($report, $email) {
     // 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,8 +1587,10 @@ class ttReportHelper {
     $mailer->setCharSet(CHARSET);
     $mailer->setContentType('text/html');
     $mailer->setSender(SENDER);
+    if (!empty($user->bcc_email))
+      $mailer->setReceiverBCC($user->bcc_email);
     $mailer->setReceiver($email);
-    $mailer->setSendType(MAIL_MODE);
+    $mailer->setMailMode(MAIL_MODE);
     if (!$mailer->send($report['name'], $body))
       return false;