Bugzilla – Attachment 16407 Details for
Bug 8378
<fine> syntax not working on overdues anymore
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 8378 - <fine> in overdues changed to <<items.fine>>
Bug-8378---fine-in-overdues-changed-to-itemsfine.patch (text/plain), 3.05 KB, created by
Tomás Cohen Arazi (tcohen)
on 2013-03-19 15:16:47 UTC
(
hide
)
Description:
Bug 8378 - <fine> in overdues changed to <<items.fine>>
Filename:
MIME Type:
Creator:
Tomás Cohen Arazi (tcohen)
Created:
2013-03-19 15:16:47 UTC
Size:
3.05 KB
patch
obsolete
>From 38b205a4bd1fd631fe93a03f275220f381b34b93 Mon Sep 17 00:00:00 2001 >From: Dobrica Pavlinusic <dpavlin@rot13.org> >Date: Tue, 19 Mar 2013 13:40:50 +0100 >Subject: [PATCH] Bug 8378 - <fine> in overdues changed to <<items.fine>> > >This patch reintroduces fines in overdue_notices.pl with minimal >changes to exsiting code. > >It DOES changes template syntax, it used to be <fine>USD</fine> but >currency was not recalculated and used only to select format, so >now we are using active system currency because values are in it >anyway. > >Example notify template: > ><item>"<<biblio.title>>" by <<biblio.author>>, <<items.itemcallnumber>>, >Barcode: <<items.barcode>> Fine: <<items.fine>> </item> > >If your active currency doesn't have valid ISO code this code will >fallback to sprintf with two decimal digits, and you can insert >currency symbol in template itself (currency field is not editable >through web interface, so this fallback might be useful for existing >installations). > >Test scenario: >1. configure fine amount under "Circulation and fines rules" > for patron category and item type >2. checkout item with correct type to partron in correct > category with due date set to yesterday >3. verify that overdue notice uses new <<items.fine>> tag >4. run ./misc/cronjobs/fines.pl to calculate fines >5. run ./misc/cronjobs/overdue_notices.pl -n > and verify that fine amount is included > >Notes: Tested using the default ODUE notice, changing: ><fines>USD</fines> >for ><<items.fine>> > >Everything worked as expected with finesmode=production set. > >Signed-off-by: Tomas Cohen Arazi <tomascohen@gmail.com> >--- > misc/cronjobs/overdue_notices.pl | 14 +++++--------- > 1 file changed, 5 insertions(+), 9 deletions(-) > >diff --git a/misc/cronjobs/overdue_notices.pl b/misc/cronjobs/overdue_notices.pl >index ba58e95..aad5ec0 100755 >--- a/misc/cronjobs/overdue_notices.pl >+++ b/misc/cronjobs/overdue_notices.pl >@@ -40,6 +40,7 @@ use C4::Dates qw/format_date/; > use C4::Debug; > use C4::Letters; > use C4::Overdues qw(GetFine); >+use C4::Budgets qw(GetCurrency); > > =head1 NAME > >@@ -707,13 +708,7 @@ sub parse_letter { > $tables{'branches'} = $p; > } > >- my $currency_format; >- if ( defined $params->{'letter'}->{'content'} >- and $params->{'letter'}->{'content'} =~ m/<fine>(.*)<\/fine>/o ) >- { # process any fine tags... >- $currency_format = $1; >- $params->{'letter'}->{'content'} =~ s/<fine>.*<\/fine>/<<item.fine>>/o; >- } >+ my $currency_format = GetCurrency()->{currency}; > > my @item_tables; > if ( my $i = $params->{'items'} ) { >@@ -725,8 +720,9 @@ sub parse_letter { > $item_format = $1; > } > >- $item->{'fine'} = currency_format($currency_format, "$fine", FMT_SYMBOL) >- if $currency_format; >+ $item->{'fine'} = currency_format($currency_format, "$fine", FMT_SYMBOL); >+ # if active currency isn't correct ISO code fallback to sprintf >+ $item->{'fine'} = sprintf('%.2f', $fine) unless $item->{'fine'}; > > push @item_tables, { > 'biblio' => $item->{'biblionumber'}, >-- >1.7.10.4
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 8378
:
11628
|
11804
|
11805
|
11806
|
11906
|
12286
|
14069
|
16387
|
16388
|
16390
|
16407
|
16408
|
16513
|
16515
|
16518
|
16522
|
16528
|
16529
|
16530
|
16531