Topic: Rep108: Statement - since when is it only emailing when overdue debits

I upgraded from 2.4.14 to 2.4.16 and just wanted to run my monthly statement reports to my dealers.
So I selected customer and email: yes.
Then I got the message "customer xxx has no overdue debits. No email is sent".

WHY? I checked an older version of rep108.php and it hasn't got this check... and I even can't find in the GITHub change logs anything about this.

            if (($CustomerRecord["Balance"]) != ($CustomerRecord["Balance"] - $CustomerRecord["Due"]))
                $rep->End($email, _("Statement") . " " . _("as of") . " " . sql2date($date) . " " . _("from") . " " . get_company_pref('coy_name'));
            else
                display_notification(sprintf(_("Customer %s has no overdue debits. No e-mail is sent."), $myrow["DebtorName"]));       

This makes no sense. Even if a customer has NO overdue debits he still needs to be sent a statement... I could just print it into a PDF, which still works and then manually create an email... but why would I need to do this...?

For now I have overwritten the new rep108 with the older one to keep the functionality.

Re: Rep108: Statement - since when is it only emailing when overdue debits

The difference between the v2.4.14 and 2.4.16 for the file reporting/rep108.php in diff format is as follows:

 core/reporting/rep108.php | 10 +++++++---
 1 file changed, 7 insertions(+), 3 deletions(-)

diff --git a/core/reporting/rep108.php b/core/reporting/rep108.php
index abb11e7..f2d6d42 100644
--- a/core/reporting/rep108.php
+++ b/core/reporting/rep108.php
@@ -175,12 +175,16 @@ function print_statements()
         for ($i = 0; $i < 5; $i++)
             $rep->TextWrap($col[$i], $rep->row, $col[$i + 1] - $col[$i], $str2[$i], 'right');
         if ($email == 1)
-            $rep->End($email, _("Statement") . " " . _("as of") . " " . sql2date($date));
-
+        {
+            if (($CustomerRecord["Balance"]) != ($CustomerRecord["Balance"] - $CustomerRecord["Due"]))
+                $rep->End($email, _("Statement") . " " . _("as of") . " " . sql2date($date) . " " . _("from") . " " . get_company_pref('coy_name'));
+            else
+                display_notification(sprintf(_("Customer %s has no overdue debits. No e-mail is sent."), $myrow["DebtorName"]));       
+        }
     }
 
     if (!isset($rep))
-        display_notification("No customers with outstanding balances found");
+        display_notification(_("No customers with outstanding balances found"));
     else if ($email == 0)
         $rep->End();
 }

The last change is that the notification text is now translated.
The "End(email..." statement is now in an "if" construct that you may revert as needed.