Bugzilla – Attachment 22159 Details for
Bug 11092
Need a processing fee and billing fee on late notices.
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Add a processing fee and billing fee on late notices
overdue_notices.pl.diff (text/plain), 5.41 KB, created by
Blou
on 2013-10-21 13:41:39 UTC
(
hide
)
Description:
Add a processing fee and billing fee on late notices
Filename:
MIME Type:
Creator:
Blou
Created:
2013-10-21 13:41:39 UTC
Size:
5.41 KB
patch
obsolete
>diff --git a/misc/cronjobs/overdue_notices.pl b/misc/cronjobs/overdue_notices.pl >index d39291b..29b60e9 100755 >--- a/misc/cronjobs/overdue_notices.pl >+++ b/misc/cronjobs/overdue_notices.pl >@@ -1,5 +1,5 @@ > #!/usr/bin/perl >- >+ > # Copyright 2008 Liblime > # Copyright 2010 BibLibre > # >@@ -371,10 +371,11 @@ if ( defined $htmlfilename ) { > > print $html_fh "<html>\n"; > print $html_fh "<head>\n"; >+ print $html_fh '<meta charset="UTF-8">'; > print $html_fh '<link href="/opac-tmpl/prog/en/css/vanierletters.css" type="text/css" rel="stylesheet">'; > print $html_fh "<style type='text/css'>\n"; > print $html_fh "#content {page-break-after: always;}\n"; >-# print $html_fh "pre {white-space: pre-wrap;}\n"; >+# print $html_fh ".fee {text-align: right;}\n"; > # print $html_fh "pre {white-space: -moz-pre-wrap;}\n"; > # print $html_fh "pre {white-space: -o-pre-wrap;}\n"; > # print $html_fh "pre {word-wrap: break-work;}\n"; >@@ -494,8 +495,19 @@ END_SQL > if ( $htmlfilename ) > { > $titles .= "<table>"; >- $titles .= "<tr><th>Loan date</th><th>Due date</th><th>Title</th><th>Callnumber</th><th>Barcode</th></tr>"; >- } >+ $titles .= "<tr><th>Loan date</th><th>Due date</th><th>Title</th><th>Callnumber</th><th>Barcode</th>"; >+ if ($overdue_rules->{"invoice$i"}) { >+ $titles .= "<th>Fees</th></tr>"; >+ } >+ else { >+ $titles .= "</tr>"; >+ } >+ } >+ my $defaultReplacementPrice = sprintf("%.2f",C4::Context->preference("DefaultReplacementPrice")); >+ my $invoiceProcessingFee = sprintf("%.2f",C4::Context->preference("InvoiceProcessingFee")); >+ my $invoiceBillingFee = sprintf("%.2f", C4::Context->preference("InvoiceBillingFee")) ; >+ my $total = 0; >+ > while ( my $item_info = $sth2->fetchrow_hashref() ) { > if ( ( !$email || $nomail ) && $PrintNoticesMaxLines && $j >= $PrintNoticesMaxLines ) { > $exceededPrintNoticesMaxLines = 1; >@@ -504,7 +516,21 @@ END_SQL > $j++; > my @item_info = map { $_ =~ /^date|date$/ ? format_date( $item_info->{$_} ) : $item_info->{$_} || ' ' } @item_content_fields; > $titles .= join("\t.", @item_info) . "\n" if ( ! $htmlfilename ); >- $titles .= "<tr><td>".join("</td><td>", @item_info) . "</td></tr>" if ( $htmlfilename ); >+ $titles .= "<tr><td>".join("</td><td>", @item_info) . "</td></tr>" if ( $htmlfilename ); >+ >+ if ($overdue_rules->{"invoice$i"}) { >+ my $priceRepl = $item_info->{'replacementprice'}; >+ $priceRepl = ($priceRepl == 0) ? $defaultReplacementPrice:$priceRepl; >+ my $data = C4::Circulation::GetIssuingRule($overdue_rules->{'categorycode'}, $item_info->{'itemtype'}, $branchcode); >+ my $overdueFinesCap = sprintf("%.2f", $data->{'overduefinescap'}); >+ >+ $titles .= '<tr class="fee">'. '<td colspan="5">Replacement cost</td>' . '<td>' .$priceRepl. "\$</td></tr>"; >+ $titles .= '<tr class="fee">'. '<td colspan="5">Overdue fine</td>' . '<td>' .$overdueFinesCap. "\$</td></tr>"; >+ $titles .= '<tr class="fee">'. '<td colspan="5">Processing fee</td>' . '<td>' .$invoiceProcessingFee. "\$</td></tr>"; >+ >+ $total += $priceRepl + $overdueFinesCap + $invoiceProcessingFee; >+ } >+ > warn join('|', @item_info ); > warn $titles; > $itemcount++; >@@ -512,6 +538,15 @@ END_SQL > } > if ( $htmlfilename ) > { >+ if ($overdue_rules->{"invoice$i"}) { >+ $total += $invoiceBillingFee; >+ $total = sprintf("%.2f", $total); >+ $titles .= "<tr>". '<td colspan="6"></td>' . "</tr>"; >+ $titles .= '<tr class="fee">'. '<td colspan="5">Billing fee</td>' . '<td>' .$invoiceBillingFee. "\$</td></tr>"; >+ $titles .= "<tr>". '<td colspan="6"></td>' . "</tr>"; >+ $titles .= "<tr>". '<td colspan="6"></td>' . "</tr>"; >+ $titles .= '<tr class="fee">'. '<td colspan="5"><b>Total</b></td>' . '<td><b>' .$total. "\$<b/></td></tr>"; >+ } > $titles .= "</table>"; > } > warn $titles; >@@ -535,8 +570,8 @@ END_SQL > # might as well skip while PERIOD, no other borrowers are going to work. > # FIXME : Does this mean a letter must be defined in order to trigger a debar ? > next PERIOD; >- } >- >+ } >+ > if ( $exceededPrintNoticesMaxLines ) { > $letter->{'content'} .= "List too long for form; please check your account online for a complete list of your overdue items."; > } >@@ -622,7 +657,7 @@ END_SQL > print @output_chunks; > } > >- if ( ! $nomail ) >+ if ( ! $nomail ) > { > # Generate the content of the csv with headers > my $content = join(";", qw(title name surname address1 address2 zipcode city country email itemcount itemsinfo due_date issue_date)) . "\n";
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
|
Splinter Review
Attachments on
bug 11092
:
22158
|
22159
|
22160
|
28716