|
Lines 1-5
Link Here
|
| 1 |
#!/usr/bin/perl |
1 |
#!/usr/bin/perl |
| 2 |
|
2 |
|
| 3 |
# Copyright 2008 Liblime |
3 |
# Copyright 2008 Liblime |
| 4 |
# Copyright 2010 BibLibre |
4 |
# Copyright 2010 BibLibre |
| 5 |
# |
5 |
# |
|
Lines 371-380
if ( defined $htmlfilename ) {
Link Here
|
| 371 |
|
371 |
|
| 372 |
print $html_fh "<html>\n"; |
372 |
print $html_fh "<html>\n"; |
| 373 |
print $html_fh "<head>\n"; |
373 |
print $html_fh "<head>\n"; |
|
|
374 |
print $html_fh '<meta charset="UTF-8">'; |
| 374 |
print $html_fh '<link href="/opac-tmpl/prog/en/css/vanierletters.css" type="text/css" rel="stylesheet">'; |
375 |
print $html_fh '<link href="/opac-tmpl/prog/en/css/vanierletters.css" type="text/css" rel="stylesheet">'; |
| 375 |
print $html_fh "<style type='text/css'>\n"; |
376 |
print $html_fh "<style type='text/css'>\n"; |
| 376 |
print $html_fh "#content {page-break-after: always;}\n"; |
377 |
print $html_fh "#content {page-break-after: always;}\n"; |
| 377 |
# print $html_fh "pre {white-space: pre-wrap;}\n"; |
378 |
# print $html_fh ".fee {text-align: right;}\n"; |
| 378 |
# print $html_fh "pre {white-space: -moz-pre-wrap;}\n"; |
379 |
# print $html_fh "pre {white-space: -moz-pre-wrap;}\n"; |
| 379 |
# print $html_fh "pre {white-space: -o-pre-wrap;}\n"; |
380 |
# print $html_fh "pre {white-space: -o-pre-wrap;}\n"; |
| 380 |
# print $html_fh "pre {word-wrap: break-work;}\n"; |
381 |
# print $html_fh "pre {word-wrap: break-work;}\n"; |
|
Lines 494-501
END_SQL
Link Here
|
| 494 |
if ( $htmlfilename ) |
495 |
if ( $htmlfilename ) |
| 495 |
{ |
496 |
{ |
| 496 |
$titles .= "<table>"; |
497 |
$titles .= "<table>"; |
| 497 |
$titles .= "<tr><th>Loan date</th><th>Due date</th><th>Title</th><th>Callnumber</th><th>Barcode</th></tr>"; |
498 |
$titles .= "<tr><th>Loan date</th><th>Due date</th><th>Title</th><th>Callnumber</th><th>Barcode</th>"; |
| 498 |
} |
499 |
if ($overdue_rules->{"invoice$i"}) { |
|
|
500 |
$titles .= "<th>Fees</th></tr>"; |
| 501 |
} |
| 502 |
else { |
| 503 |
$titles .= "</tr>"; |
| 504 |
} |
| 505 |
} |
| 506 |
my $defaultReplacementPrice = sprintf("%.2f",C4::Context->preference("DefaultReplacementPrice")); |
| 507 |
my $invoiceProcessingFee = sprintf("%.2f",C4::Context->preference("InvoiceProcessingFee")); |
| 508 |
my $invoiceBillingFee = sprintf("%.2f", C4::Context->preference("InvoiceBillingFee")) ; |
| 509 |
my $total = 0; |
| 510 |
|
| 499 |
while ( my $item_info = $sth2->fetchrow_hashref() ) { |
511 |
while ( my $item_info = $sth2->fetchrow_hashref() ) { |
| 500 |
if ( ( !$email || $nomail ) && $PrintNoticesMaxLines && $j >= $PrintNoticesMaxLines ) { |
512 |
if ( ( !$email || $nomail ) && $PrintNoticesMaxLines && $j >= $PrintNoticesMaxLines ) { |
| 501 |
$exceededPrintNoticesMaxLines = 1; |
513 |
$exceededPrintNoticesMaxLines = 1; |
|
Lines 504-510
END_SQL
Link Here
|
| 504 |
$j++; |
516 |
$j++; |
| 505 |
my @item_info = map { $_ =~ /^date|date$/ ? format_date( $item_info->{$_} ) : $item_info->{$_} || ' ' } @item_content_fields; |
517 |
my @item_info = map { $_ =~ /^date|date$/ ? format_date( $item_info->{$_} ) : $item_info->{$_} || ' ' } @item_content_fields; |
| 506 |
$titles .= join("\t.", @item_info) . "\n" if ( ! $htmlfilename ); |
518 |
$titles .= join("\t.", @item_info) . "\n" if ( ! $htmlfilename ); |
| 507 |
$titles .= "<tr><td>".join("</td><td>", @item_info) . "</td></tr>" if ( $htmlfilename ); |
519 |
$titles .= "<tr><td>".join("</td><td>", @item_info) . "</td></tr>" if ( $htmlfilename ); |
|
|
520 |
|
| 521 |
if ($overdue_rules->{"invoice$i"}) { |
| 522 |
my $priceRepl = $item_info->{'replacementprice'}; |
| 523 |
$priceRepl = ($priceRepl == 0) ? $defaultReplacementPrice:$priceRepl; |
| 524 |
my $data = C4::Circulation::GetIssuingRule($overdue_rules->{'categorycode'}, $item_info->{'itemtype'}, $branchcode); |
| 525 |
my $overdueFinesCap = sprintf("%.2f", $data->{'overduefinescap'}); |
| 526 |
|
| 527 |
$titles .= '<tr class="fee">'. '<td colspan="5">Replacement cost</td>' . '<td>' .$priceRepl. "\$</td></tr>"; |
| 528 |
$titles .= '<tr class="fee">'. '<td colspan="5">Overdue fine</td>' . '<td>' .$overdueFinesCap. "\$</td></tr>"; |
| 529 |
$titles .= '<tr class="fee">'. '<td colspan="5">Processing fee</td>' . '<td>' .$invoiceProcessingFee. "\$</td></tr>"; |
| 530 |
|
| 531 |
$total += $priceRepl + $overdueFinesCap + $invoiceProcessingFee; |
| 532 |
} |
| 533 |
|
| 508 |
warn join('|', @item_info ); |
534 |
warn join('|', @item_info ); |
| 509 |
warn $titles; |
535 |
warn $titles; |
| 510 |
$itemcount++; |
536 |
$itemcount++; |
|
Lines 512-517
END_SQL
Link Here
|
| 512 |
} |
538 |
} |
| 513 |
if ( $htmlfilename ) |
539 |
if ( $htmlfilename ) |
| 514 |
{ |
540 |
{ |
|
|
541 |
if ($overdue_rules->{"invoice$i"}) { |
| 542 |
$total += $invoiceBillingFee; |
| 543 |
$total = sprintf("%.2f", $total); |
| 544 |
$titles .= "<tr>". '<td colspan="6"></td>' . "</tr>"; |
| 545 |
$titles .= '<tr class="fee">'. '<td colspan="5">Billing fee</td>' . '<td>' .$invoiceBillingFee. "\$</td></tr>"; |
| 546 |
$titles .= "<tr>". '<td colspan="6"></td>' . "</tr>"; |
| 547 |
$titles .= "<tr>". '<td colspan="6"></td>' . "</tr>"; |
| 548 |
$titles .= '<tr class="fee">'. '<td colspan="5"><b>Total</b></td>' . '<td><b>' .$total. "\$<b/></td></tr>"; |
| 549 |
} |
| 515 |
$titles .= "</table>"; |
550 |
$titles .= "</table>"; |
| 516 |
} |
551 |
} |
| 517 |
warn $titles; |
552 |
warn $titles; |
|
Lines 535-542
END_SQL
Link Here
|
| 535 |
# might as well skip while PERIOD, no other borrowers are going to work. |
570 |
# might as well skip while PERIOD, no other borrowers are going to work. |
| 536 |
# FIXME : Does this mean a letter must be defined in order to trigger a debar ? |
571 |
# FIXME : Does this mean a letter must be defined in order to trigger a debar ? |
| 537 |
next PERIOD; |
572 |
next PERIOD; |
| 538 |
} |
573 |
} |
| 539 |
|
574 |
|
| 540 |
if ( $exceededPrintNoticesMaxLines ) { |
575 |
if ( $exceededPrintNoticesMaxLines ) { |
| 541 |
$letter->{'content'} .= "List too long for form; please check your account online for a complete list of your overdue items."; |
576 |
$letter->{'content'} .= "List too long for form; please check your account online for a complete list of your overdue items."; |
| 542 |
} |
577 |
} |
|
Lines 622-628
END_SQL
Link Here
|
| 622 |
print @output_chunks; |
657 |
print @output_chunks; |
| 623 |
} |
658 |
} |
| 624 |
|
659 |
|
| 625 |
if ( ! $nomail ) |
660 |
if ( ! $nomail ) |
| 626 |
{ |
661 |
{ |
| 627 |
# Generate the content of the csv with headers |
662 |
# Generate the content of the csv with headers |
| 628 |
my $content = join(";", qw(title name surname address1 address2 zipcode city country email itemcount itemsinfo due_date issue_date)) . "\n"; |
663 |
my $content = join(";", qw(title name surname address1 address2 zipcode city country email itemcount itemsinfo due_date issue_date)) . "\n"; |