|
Lines 381-387
if ( defined $csvfilename ) {
Link Here
|
| 381 |
} else { |
381 |
} else { |
| 382 |
open $csv_fh, ">", $csvfilename or die "unable to open $csvfilename: $!"; |
382 |
open $csv_fh, ">", $csvfilename or die "unable to open $csvfilename: $!"; |
| 383 |
} |
383 |
} |
| 384 |
if ( $csv->combine(qw(name surname address1 address2 zipcode city country email itemcount itemsinfo)) ) { |
384 |
if ( $csv->combine(qw(name surname address1 address2 zipcode city country email phone cardnumber itemcount itemsinfo branchname letternumber)) ) { |
| 385 |
print $csv_fh $csv->string, "\n"; |
385 |
print $csv_fh $csv->string, "\n"; |
| 386 |
} else { |
386 |
} else { |
| 387 |
$verbose and warn 'combine failed on argument: ' . $csv->error_input; |
387 |
$verbose and warn 'combine failed on argument: ' . $csv->error_input; |
|
Lines 395-405
if ( defined $htmlfilename ) {
Link Here
|
| 395 |
$fh = *STDOUT; |
395 |
$fh = *STDOUT; |
| 396 |
} else { |
396 |
} else { |
| 397 |
my $today = DateTime->now(time_zone => C4::Context->tz ); |
397 |
my $today = DateTime->now(time_zone => C4::Context->tz ); |
| 398 |
open $fh, ">",File::Spec->catdir ($htmlfilename,"notices-".$today->ymd().".html"); |
398 |
open $fh, ">:encoding(UTF-8)",File::Spec->catdir ($htmlfilename,"notices-".$today->ymd().".html"); |
| 399 |
} |
399 |
} |
| 400 |
|
400 |
|
| 401 |
print $fh "<html>\n"; |
401 |
print $fh "<html>\n"; |
| 402 |
print $fh "<head>\n"; |
402 |
print $fh "<head>\n"; |
|
|
403 |
print $fh "<meta http-equiv=\"Content-Type\" content=\"text/html; charset=utf-8\" />\n"; |
| 403 |
print $fh "<style type='text/css'>\n"; |
404 |
print $fh "<style type='text/css'>\n"; |
| 404 |
print $fh "pre {page-break-after: always;}\n"; |
405 |
print $fh "pre {page-break-after: always;}\n"; |
| 405 |
print $fh "pre {white-space: pre-wrap;}\n"; |
406 |
print $fh "pre {white-space: pre-wrap;}\n"; |
|
Lines 435-444
foreach my $branchcode (@branches) {
Link Here
|
| 435 |
$verbose and warn sprintf "branchcode : '%s' using %s\n", $branchcode, $admin_email_address; |
436 |
$verbose and warn sprintf "branchcode : '%s' using %s\n", $branchcode, $admin_email_address; |
| 436 |
|
437 |
|
| 437 |
my $sth2 = $dbh->prepare( <<"END_SQL" ); |
438 |
my $sth2 = $dbh->prepare( <<"END_SQL" ); |
| 438 |
SELECT biblio.*, items.*, issues.*, biblioitems.itemtype, TO_DAYS($date)-TO_DAYS(date_due) AS days_overdue |
439 |
SELECT biblio.*, items.*, issues.*, biblioitems.itemtype, TO_DAYS($date)-TO_DAYS(date_due) AS days_overdue, branchname |
| 439 |
FROM issues,items,biblio, biblioitems |
440 |
FROM issues,items,biblio, biblioitems, branches b |
| 440 |
WHERE items.itemnumber=issues.itemnumber |
441 |
WHERE items.itemnumber=issues.itemnumber |
| 441 |
AND biblio.biblionumber = items.biblionumber |
442 |
AND biblio.biblionumber = items.biblionumber |
|
|
443 |
AND b.branchcode = items.homebranch |
| 442 |
AND biblio.biblionumber = biblioitems.biblionumber |
444 |
AND biblio.biblionumber = biblioitems.biblionumber |
| 443 |
AND issues.borrowernumber = ? |
445 |
AND issues.borrowernumber = ? |
| 444 |
END_SQL |
446 |
END_SQL |
|
Lines 484-490
END_SQL
Link Here
|
| 484 |
# <date> <itemcount> <firstname> <lastname> <address1> <address2> <address3> <city> <postcode> <country> |
486 |
# <date> <itemcount> <firstname> <lastname> <address1> <address2> <address3> <city> <postcode> <country> |
| 485 |
|
487 |
|
| 486 |
my $borrower_sql = <<'END_SQL'; |
488 |
my $borrower_sql = <<'END_SQL'; |
| 487 |
SELECT issues.borrowernumber, firstname, surname, address, address2, city, zipcode, country, email, emailpro, B_email, smsalertnumber, |
489 |
SELECT issues.borrowernumber, firstname, surname, address, address2, city, zipcode, country, email, emailpro, B_email, smsalertnumber, phone, cardnumber |
| 488 |
TO_DAYS(?)-TO_DAYS(date_due) as difference, date_due |
490 |
TO_DAYS(?)-TO_DAYS(date_due) as difference, date_due |
| 489 |
FROM issues,borrowers,categories |
491 |
FROM issues,borrowers,categories |
| 490 |
WHERE issues.borrowernumber=borrowers.borrowernumber |
492 |
WHERE issues.borrowernumber=borrowers.borrowernumber |
|
Lines 680-685
END_SQL
Link Here
|
| 680 |
address1 => $data->{'address'}, |
682 |
address1 => $data->{'address'}, |
| 681 |
address2 => $data->{'address2'}, |
683 |
address2 => $data->{'address2'}, |
| 682 |
city => $data->{'city'}, |
684 |
city => $data->{'city'}, |
|
|
685 |
phone => $data->{'phone'}, |
| 686 |
cardnumber => $data->{'cardnumber'}, |
| 687 |
branchname => $branch_details->{'branchname'}, |
| 688 |
letternumber => $i, |
| 683 |
postcode => $data->{'zipcode'}, |
689 |
postcode => $data->{'zipcode'}, |
| 684 |
country => $data->{'country'}, |
690 |
country => $data->{'country'}, |
| 685 |
email => $notice_email, |
691 |
email => $notice_email, |
|
Lines 877-883
sub prepare_letter_for_printing {
Link Here
|
| 877 |
if ( exists $params->{'outputformat'} && $params->{'outputformat'} eq 'csv' ) { |
883 |
if ( exists $params->{'outputformat'} && $params->{'outputformat'} eq 'csv' ) { |
| 878 |
if ($csv->combine( |
884 |
if ($csv->combine( |
| 879 |
$params->{'firstname'}, $params->{'lastname'}, $params->{'address1'}, $params->{'address2'}, $params->{'postcode'}, |
885 |
$params->{'firstname'}, $params->{'lastname'}, $params->{'address1'}, $params->{'address2'}, $params->{'postcode'}, |
| 880 |
$params->{'city'}, $params->{'country'}, $params->{'email'}, $params->{'itemcount'}, $params->{'titles'} |
886 |
$params->{'city'}, $params->{'country'}, $params->{'email'}, $params->{'phone'}, $params->{'cardnumber'}, |
|
|
887 |
$params->{'itemcount'}, $params->{'titles'}, $params->{'branchname'}, $params->{'letternumber'} |
| 881 |
) |
888 |
) |
| 882 |
) { |
889 |
) { |
| 883 |
return $csv->string, "\n"; |
890 |
return $csv->string, "\n"; |
| 884 |
- |
|
|