Lines 60-66
overdue_notices.pl
Link Here
|
60 |
-max <days> maximum days overdue to deal with |
60 |
-max <days> maximum days overdue to deal with |
61 |
-library <branchname> only deal with overdues from this library (repeatable : several libraries can be given) |
61 |
-library <branchname> only deal with overdues from this library (repeatable : several libraries can be given) |
62 |
-csv <filename> populate CSV file |
62 |
-csv <filename> populate CSV file |
63 |
-html <filename> Output html to file |
63 |
-html <filedir> Output html to file directory or to STDOUT if none specified |
64 |
-itemscontent <list of fields> item information in templates |
64 |
-itemscontent <list of fields> item information in templates |
65 |
-borcat <categorycode> category code that must be included |
65 |
-borcat <categorycode> category code that must be included |
66 |
-borcatout <categorycode> category code that must be excluded |
66 |
-borcatout <categorycode> category code that must be excluded |
Lines 362-368
if ( defined $csvfilename ) {
Link Here
|
362 |
} else { |
362 |
} else { |
363 |
open $csv_fh, ">", $csvfilename or die "unable to open $csvfilename: $!"; |
363 |
open $csv_fh, ">", $csvfilename or die "unable to open $csvfilename: $!"; |
364 |
} |
364 |
} |
365 |
if ( $csv->combine(qw(name surname address1 address2 zipcode city country email itemcount itemsinfo)) ) { |
365 |
if ( $csv->combine(qw(name surname address1 address2 zipcode city country email phone cardnumber itemcount itemsinfo)) ) { |
366 |
print $csv_fh $csv->string, "\n"; |
366 |
print $csv_fh $csv->string, "\n"; |
367 |
} else { |
367 |
} else { |
368 |
$verbose and warn 'combine failed on argument: ' . $csv->error_input; |
368 |
$verbose and warn 'combine failed on argument: ' . $csv->error_input; |
Lines 376-386
if ( defined $htmlfilename ) {
Link Here
|
376 |
$html_fh = *STDOUT; |
376 |
$html_fh = *STDOUT; |
377 |
} else { |
377 |
} else { |
378 |
my $today = DateTime->now(time_zone => C4::Context->tz ); |
378 |
my $today = DateTime->now(time_zone => C4::Context->tz ); |
379 |
open $html_fh, ">",File::Spec->catdir ($htmlfilename,"notices-".$today->ymd().".html"); |
379 |
my $htmlfile = File::Spec->catdir ($htmlfilename,"notices-".$today->ymd().".html"); |
|
|
380 |
open $html_fh, ">:encoding(UTF-8)", $htmlfile or die "unable to open $htmlfile; $! (Be sure to create the directory)\n"; |
380 |
} |
381 |
} |
381 |
|
382 |
|
382 |
print $html_fh "<html>\n"; |
383 |
print $html_fh "<html>\n"; |
383 |
print $html_fh "<head>\n"; |
384 |
print $html_fh "<head>\n"; |
|
|
385 |
print $html_fh "<meta http-equiv=\"Content-Type\" content=\"text/html; charset=utf-8\" />\n"; |
384 |
print $html_fh "<style type='text/css'>\n"; |
386 |
print $html_fh "<style type='text/css'>\n"; |
385 |
print $html_fh "pre {page-break-after: always;}\n"; |
387 |
print $html_fh "pre {page-break-after: always;}\n"; |
386 |
print $html_fh "pre {white-space: pre-wrap;}\n"; |
388 |
print $html_fh "pre {white-space: pre-wrap;}\n"; |
Lines 451-457
END_SQL
Link Here
|
451 |
# <date> <itemcount> <firstname> <lastname> <address1> <address2> <address3> <city> <postcode> <country> |
453 |
# <date> <itemcount> <firstname> <lastname> <address1> <address2> <address3> <city> <postcode> <country> |
452 |
|
454 |
|
453 |
my $borrower_sql = <<'END_SQL'; |
455 |
my $borrower_sql = <<'END_SQL'; |
454 |
SELECT distinct(issues.borrowernumber), firstname, surname, address, address2, city, zipcode, country, email, emailpro, B_email |
456 |
SELECT distinct(issues.borrowernumber), firstname, surname, address, address2, city, zipcode, country, email, emailpro, B_email, phone, cardnumber |
455 |
FROM issues,borrowers,categories |
457 |
FROM issues,borrowers,categories |
456 |
WHERE issues.borrowernumber=borrowers.borrowernumber |
458 |
WHERE issues.borrowernumber=borrowers.borrowernumber |
457 |
AND borrowers.categorycode=categories.categorycode |
459 |
AND borrowers.categorycode=categories.categorycode |
Lines 595-600
END_SQL
Link Here
|
595 |
country => $data->{'country'}, |
597 |
country => $data->{'country'}, |
596 |
email => $notice_email, |
598 |
email => $notice_email, |
597 |
itemcount => $itemcount, |
599 |
itemcount => $itemcount, |
|
|
600 |
phone => $data->{'phone'}, |
601 |
cardnumber => $data->{'cardnumber'}, |
598 |
titles => $titles, |
602 |
titles => $titles, |
599 |
outputformat => defined $csvfilename ? 'csv' : defined $htmlfilename ? 'html' : '', |
603 |
outputformat => defined $csvfilename ? 'csv' : defined $htmlfilename ? 'html' : '', |
600 |
} |
604 |
} |
Lines 752-758
sub prepare_letter_for_printing {
Link Here
|
752 |
if ( exists $params->{'outputformat'} && $params->{'outputformat'} eq 'csv' ) { |
756 |
if ( exists $params->{'outputformat'} && $params->{'outputformat'} eq 'csv' ) { |
753 |
if ($csv->combine( |
757 |
if ($csv->combine( |
754 |
$params->{'firstname'}, $params->{'lastname'}, $params->{'address1'}, $params->{'address2'}, $params->{'postcode'}, |
758 |
$params->{'firstname'}, $params->{'lastname'}, $params->{'address1'}, $params->{'address2'}, $params->{'postcode'}, |
755 |
$params->{'city'}, $params->{'country'}, $params->{'email'}, $params->{'itemcount'}, $params->{'titles'} |
759 |
$params->{'city'}, $params->{'country'}, $params->{'email'}, $params->{'phone'}, $params->{'cardnumber'}, $params->{'itemcount'}, $params->{'titles'} |
756 |
) |
760 |
) |
757 |
) { |
761 |
) { |
758 |
return $csv->string, "\n"; |
762 |
return $csv->string, "\n"; |
759 |
- |
|
|