View | Details | Raw Unified | Return to bug 29354
Collapse All | Expand All

(-)a/misc/cronjobs/overdue_notices.pl (-21 / +49 lines)
Lines 435-452 if ( defined $htmlfilename ) { Link Here
435
    open $fh, ">:encoding(UTF-8)",File::Spec->catdir ($htmlfilename,"notices-".$today->ymd().".html");
435
    open $fh, ">:encoding(UTF-8)",File::Spec->catdir ($htmlfilename,"notices-".$today->ymd().".html");
436
  }
436
  }
437
  
437
  
438
  print $fh "<html>\n";
438
  print $fh _get_html_start();
439
  print $fh "<head>\n";
440
  print $fh "<meta http-equiv=\"Content-Type\" content=\"text/html; charset=utf-8\" />\n";
441
  print $fh "<style type='text/css'>\n";
442
  print $fh "pre {page-break-after: always;}\n";
443
  print $fh "pre {white-space: pre-wrap;}\n";
444
  print $fh "pre {white-space: -moz-pre-wrap;}\n";
445
  print $fh "pre {white-space: -o-pre-wrap;}\n";
446
  print $fh "pre {word-wrap: break-work;}\n";
447
  print $fh "</style>\n";
448
  print $fh "</head>\n";
449
  print $fh "<body>\n";
450
}
439
}
451
elsif ( defined $text_filename ) {
440
elsif ( defined $text_filename ) {
452
  if ( $text_filename eq '' ) {
441
  if ( $text_filename eq '' ) {
Lines 848-863 END_SQL Link Here
848
        if ( defined $csvfilename ) {
837
        if ( defined $csvfilename ) {
849
            my $delimiter = C4::Context->csv_delimiter;
838
            my $delimiter = C4::Context->csv_delimiter;
850
            $content = join($delimiter, qw(title name surname address1 address2 zipcode city country email itemcount itemsinfo due_date issue_date)) . "\n";
839
            $content = join($delimiter, qw(title name surname address1 address2 zipcode city country email itemcount itemsinfo due_date issue_date)) . "\n";
840
            $content .= join( "\n", @output_chunks );
841
        } elsif ( defined $htmlfilename ) {
842
            $content = _get_html_start();
843
            $content .= join( "\n", @output_chunks );
844
            $content .= _get_html_end();
845
        } else {
846
            $content = join( "\n", @output_chunks );
851
        }
847
        }
852
        else {
853
            $content = "";
854
        }
855
        $content .= join( "\n", @output_chunks );
856
848
857
        if ( C4::Context->preference('EmailOverduesNoEmail') ) {
849
        if ( C4::Context->preference('EmailOverduesNoEmail') ) {
858
            my $attachment = {
850
            my $attachment = {
859
                filename => defined $csvfilename ? 'attachment.csv' : 'attachment.txt',
851
                filename => defined $csvfilename ? 'attachment.csv' : defined $htmlfilename ? 'attachment.html' : 'attachment.txt',
860
                type => 'text/plain',
852
                type => defined $htmlfilename ? 'text/html' : 'text/plain',
861
                content => $content,
853
                content => $content,
862
            };
854
            };
863
855
Lines 885-892 if ($csvfilename) { Link Here
885
}
877
}
886
878
887
if ( defined $htmlfilename ) {
879
if ( defined $htmlfilename ) {
888
  print $fh "</body>\n";
880
  print $fh _get_html_end();
889
  print $fh "</html>\n";
890
  close $fh;
881
  close $fh;
891
} elsif ( defined $text_filename ) {
882
} elsif ( defined $text_filename ) {
892
  close $fh;
883
  close $fh;
Lines 946-949 sub prepare_letter_for_printing { Link Here
946
    return $return;
937
    return $return;
947
}
938
}
948
939
940
=head2 _get_html_start
941
942
Return the start of a HTML document, including html, head and the start body
943
tags. This should be usable both in the HTML file written to disc, and in the
944
attachment.html sent as email.
945
946
=cut
947
948
sub _get_html_start {
949
950
    return "<html>
951
<head>
952
<meta http-equiv=\"Content-Type\" content=\"text/html; charset=utf-8\" />
953
<style type='text/css'>
954
pre {page-break-after: always;}
955
pre {white-space: pre-wrap;}
956
pre {white-space: -moz-pre-wrap;}
957
pre {white-space: -o-pre-wrap;}
958
pre {word-wrap: break-work;}
959
</style>
960
</head>
961
<body>";
962
963
}
964
965
=head2 _get_html_end
966
967
Return the end of an HTML document, namely the closing body and html tags.
968
969
=cut
970
971
sub _get_html_end {
972
973
    return "</body>
974
</html>";
975
976
}
977
949
cronlogaction({ action => 'End', info => "COMPLETED" });
978
cronlogaction({ action => 'End', info => "COMPLETED" });
950
- 

Return to bug 29354