[Koha-bugs] [Bug 8378] <fine> syntax not working on overdues anymore

bugzilla-daemon at bugs.koha-community.org bugzilla-daemon at bugs.koha-community.org
Wed Aug 15 20:44:59 CEST 2012


http://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=8378

--- Comment #1 from wajasu <matted-34813 at mypacks.net> ---
Created attachment 11628
  -->
http://bugs.koha-community.org/bugzilla3/attachment.cgi?id=11628&action=edit
0001-Bug-8378-fine-syntax-not-working-on-overdues-anymore

This patch returns the behavior for handling the <fine>USD</fine> tag in
overdue_notices.pl

It seems this behavior got lost during other changes.

At the time of writing this patch, I needed another patch that I had signed off
on, so you will need
to apply SIGNED-OFF-Bug-8607-FIX-overdues_notices-script-date.patch first to
get overdue_notice.pl working.
That patch fixed substitution of a date variable that had incorrect quotes, and
enables overdues to be returned.

Test Plan:
1) I added a student patron  (be sure overdues notices can be received with the
correct patron type)
2) I checked out a book  (in my case i checked out 2 because I wanted to see if
multiple were supported)
3) As mysql -uroot -p  koha       (connect to your test database)
> select * from borrowers;    ( to find the borrowernumber for your test patron)
> select * from issues;       ( to see the checkout outs. )
> update issues set date_due='2012-07-01 23:59:00' where borrowernumber=55;  ( set the date_due to make the book overdue)
4) login as the patron and see that the checkouts are overdue ( check
circulation rules or sysprefs if needed )
5) I applied SIGNED-OFF-Bug-8607-FIX-overdues_notices-script-date.patch   (if
you are on master around 2012-08-15)
6) As root in dev environment kohaclone:
misc/cronjobs/overdue_notices.pl -n          (I got no amount after the Fine:
with the currency format code)
...
The following item(s) is/are currently overdue:

"Paul and his theology " by , 227/.06, Barcode: 111 Fine: USD
"Apostolic history and the Gospel" by , , Barcode: 333 Fine: USD
...
7) I applied Bug-8378-fine-syntax-not-working-on-overdues-anymore.patch   (what
we are really testing)
8) As root in dev environment kohaclone:     (be sure the patched 
C4/Letters.pm is in /usr/share/koha/lib if you use an std install)
misc/cronjobs/overdue_notices.pl -n          (I got the amount ==> Fine: $0.00
)
...
The following item(s) is/are currently overdue:

"Paul and his theology " by , 227/.06, Barcode: 111 Fine: $0.00
"Apostolic history and the Gospel" by , , Barcode: 333 Fine: $0.00
...

Notes:
I would apply this patch after Bug8607 to save time on setup steps, and start
from step 6)

How was it fixed:
In overdue_notices.pl the parse_letter routine needed the 'letter' in params to
get the <fine> tag and
the currency format.  It replaced the <fine> tag with <<item.fine>>, which
should have been <<items.fine>>.
The routine also iterated over the items to format and pushed for use in
GetPreparedLetter, but that routine
queried the database again for the letter template, and thus would see the
<fine> tag and not <<items.fine>>.
So I had to factor out GetLetter from GetPreparedLetter, keeping
GetPreparedLetter the same behavior, since its
called in many places (Reserves.pm, etc).  I also added a GetProcessedLetter to
Letters.pm that did the same thing
as GetPreparedLetter, but accepted a 'letter' param, so it doesn't query the
database. I edited overdue_notice.pl
to GetLetter, earlier in the code so its retrieved less often, and supply it to
parse_letter which originally
wanted to do its magic.

wajasu

-- 
You are receiving this mail because:
You are the assignee for the bug.
You are watching all bug changes.


More information about the Koha-bugs mailing list