Made report footer optional depending on setting in config.php
authorNik Okuntseff <support@anuko.com>
Fri, 11 Mar 2016 08:10:11 +0000 (00:10 -0800)
committerNik Okuntseff <support@anuko.com>
Fri, 11 Mar 2016 08:10:11 +0000 (00:10 -0800)
The REPORT_FOOTER setting must be defined as false to remove the footer

WEB-INF/config.php.dist
WEB-INF/lib/ttReportHelper.class.php
WEB-INF/templates/footer.tpl
topdf.php

index 95efb4e..25ba2c0 100644 (file)
@@ -173,6 +173,11 @@ define('CURRENCY_DEFAULT', '$');
 define('EXPORT_DECIMAL_DURATION', true);
 
 
+// REPORT_FOOTER - defines whether to use a footer on reports.
+// 
+define('REPORT_FOOTER', true);
+
+
 // Authentication module (see WEB-INF/lib/auth/)
 // Possible authentication methods:
 //   db - internal database, logins and password hashes are stored in time tracker database.
index ac7d679..8d422e6 100644 (file)
@@ -1055,13 +1055,13 @@ class ttReportHelper {
   // prepareReportBody - prepares an email body for report.
   static function prepareReportBody($bean, $comment)
   {
-       global $user;
-       global $i18n;
+    global $user;
+    global $i18n;
 
     $items = ttReportHelper::getItems($bean);
     $group_by = $bean->getAttribute('group_by');
     if ($group_by && 'no_grouping' != $group_by)
-        $subtotals = ttReportHelper::getSubtotals($bean);
+      $subtotals = ttReportHelper::getSubtotals($bean);
     $totals = ttReportHelper::getTotals($bean);
     
     // Use custom fields plugin if it is enabled.
@@ -1301,7 +1301,8 @@ class ttReportHelper {
     }
     
     // Output footer.
-    $body .= '<p style="text-align: center;">'.$i18n->getKey('form.mail.footer').'</p>';
+    if (!defined('REPORT_FOOTER') || !(REPORT_FOOTER == false))
+      $body .= '<p style="text-align: center;">'.$i18n->getKey('form.mail.footer').'</p>';
 
     // Finish creating email body.
     $body .= '</body></html>';
@@ -1558,7 +1559,8 @@ class ttReportHelper {
     }
     
     // Output footer.
-    $body .= '<p style="text-align: center;">'.$i18n->getKey('form.mail.footer').'</p>';
+    if (!defined('REPORT_FOOTER') || !(REPORT_FOOTER == false))
+      $body .= '<p style="text-align: center;">'.$i18n->getKey('form.mail.footer').'</p>';
 
     // Finish creating email body.
     $body .= '</body></html>';
index 8bd37de..2de3e4b 100644 (file)
@@ -12,7 +12,7 @@
       <br>
       <table cellspacing="0" cellpadding="4" width="100%" border="0">
         <tr>
-          <td align="center">&nbsp;Anuko Time Tracker 1.9.13.3402 | Copyright &copy; <a href="https://www.anuko.com/lp/tt_3.htm" target="_blank">Anuko</a> |
+          <td align="center">&nbsp;Anuko Time Tracker 1.9.14.3403 | Copyright &copy; <a href="https://www.anuko.com/lp/tt_3.htm" target="_blank">Anuko</a> |
             <a href="https://www.anuko.com/lp/tt_4.htm" target="_blank">{$i18n.footer.credits}</a> |
             <a href="https://www.anuko.com/lp/tt_5.htm" target="_blank">{$i18n.footer.license}</a> |
             <a href="https://www.anuko.com/lp/tt_7.htm" target="_blank">{$i18n.footer.improve}</a>
index 286724f..3f0a6dc 100644 (file)
--- a/topdf.php
+++ b/topdf.php
@@ -311,7 +311,9 @@ if ($totals_only) {
 }
 
 // Output footer.
-$html .= '<p style="text-align: center;">'.$i18n->getKey('form.mail.footer').'</p>';
+if (!defined('REPORT_FOOTER') || !(REPORT_FOOTER == false)) // By default we print it unless explicitely defined as false.
+  $html .= '<p style="text-align: center;">'.$i18n->getKey('form.mail.footer').'</p>';
+
 // By this time we have html ready.
 
 // Determine title for report.
@@ -331,7 +333,7 @@ header('Content-Disposition: attachment; filename="timesheet.pdf"');
 // Beginning of TCPDF code here.
 
 // Extend TCPDF class so that we can use custom header and footer.
-class MyyPDF extends TCPDF {
+class ttPDF extends TCPDF {
 
   public $image_file = 'images/tt_logo.png'; // Image file for the logo in header.
   public $page_word = 'Page'; // Localized "Page" word in footer, ex: Page 1/2.
@@ -364,7 +366,7 @@ class MyyPDF extends TCPDF {
 }
 
 // Create new PDF document.
-$pdf = new MyyPDF(PDF_PAGE_ORIENTATION, PDF_UNIT, PDF_PAGE_FORMAT, true, 'UTF-8', false);
+$pdf = new ttPDF(PDF_PAGE_ORIENTATION, PDF_UNIT, PDF_PAGE_FORMAT, true, 'UTF-8', false);
 
 // If custom logo file exists - set it.
 if (file_exists('images/'.$user->team_id.'.png'))