[Koha-patches] [PATCH 05/12] MT3346 : overdue_notices

Henri-Damien LAURENT henridamien.laurent at biblibre.com
Sat May 1 00:19:47 CEST 2010


-csv was not working as advertised.
This feature is now working as it is forecast

Signed-off-by: Henri-Damien LAURENT <henridamien.laurent at biblibre.com>
---
 misc/cronjobs/overdue_notices.pl |   53 +++++++++++++++++--------------------
 1 files changed, 24 insertions(+), 29 deletions(-)

diff --git a/misc/cronjobs/overdue_notices.pl b/misc/cronjobs/overdue_notices.pl
index 04a5a0f..4de6cdd 100755
--- a/misc/cronjobs/overdue_notices.pl
+++ b/misc/cronjobs/overdue_notices.pl
@@ -566,39 +566,34 @@ END_SQL
     }
 
     if (@output_chunks) {
-        if ($nomail) {
-            if ( defined $csvfilename ) {
-                print $csv_fh @output_chunks;
-            } elsif ( defined $htmlfilename ) {
-                print $html_fh @output_chunks;
-            } else {
-                local $, = "\f";    # pagebreak
-                print @output_chunks;
-            }
-        } 
+        if ( defined $csvfilename ) {
+            print $csv_fh @output_chunks;        
+        }
         elsif ( defined $htmlfilename ) {
             print $html_fh @output_chunks;        
         }
-        else {
-            my $attachment = {
-                filename => defined $csvfilename ? 'attachment.csv' : 'attachment.txt',
-                type => 'text/plain',
-                content => join( "\n", @output_chunks )
-            };
-
-            my $letter = {
-                title   => 'Overdue Notices',
-                content => 'These messages were not sent directly to the patrons.',
-            };
-            C4::Letters::EnqueueLetter(
-                {   letter                 => $letter,
-                    borrowernumber         => undef,
-                    message_transport_type => 'email',
-                    attachments            => [$attachment],
-                    to_address             => $admin_email_address,
-                }
-            );
+        elsif ($nomail){
+                local $, = "\f";    # pagebreak
+                print @output_chunks;
         }
+        my $attachment = {
+            filename => defined $csvfilename ? 'attachment.csv' : 'attachment.txt',
+            type => 'text/plain',
+            content => join( "\n", @output_chunks )
+        };
+
+        my $letter = {
+            title   => 'Overdue Notices',
+            content => 'These messages were not sent directly to the patrons.',
+        };
+        C4::Letters::EnqueueLetter(
+            {   letter                 => $letter,
+                borrowernumber         => undef,
+                message_transport_type => 'email',
+                attachments            => [$attachment],
+                to_address             => $admin_email_address,
+            }
+        );
     }
 
 }
-- 
1.6.3.3




More information about the Koha-patches mailing list