Bugzilla – Attachment 76109 Details for
Bug 5789
Fines don't work when items have null homebranch
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 5789 - Fines don't work when items have null homebranch
Bug-5789---Fines-dont-work-when-items-have-null-ho.patch (text/plain), 2.40 KB, created by
Pierre-Luc Lapointe
on 2018-06-15 20:08:04 UTC
(
hide
)
Description:
Bug 5789 - Fines don't work when items have null homebranch
Filename:
MIME Type:
Creator:
Pierre-Luc Lapointe
Created:
2018-06-15 20:08:04 UTC
Size:
2.40 KB
patch
obsolete
>From 063d401217fe9992b168028d5fa6b05df2d1c8a4 Mon Sep 17 00:00:00 2001 >From: Barton Chittenden <barton@bywatersolutions.com> >Date: Sun, 6 May 2018 12:49:52 -0700 >Subject: [PATCH] Bug 5789 - Fines don't work when items have null homebranch > >When the CircControl system preference is set to 'the library the item is from' and items.homebranch is not set, >fines.pl will stop processing witha fatal error that looks something like this: > > Use of uninitialized value $branchcode in exists at /home/koha/kohaclone/misc/cronjobs/fines.pl line 110 > No branchcode argument passed to Koha::Calendar->new at /home/koha/kohaclone/misc/cronjobs/fines.pl line 169. > >This patch will check the value of $branchcode before it is used. If $branchcode is undefined, a warning will >be issued and, processing will be skipped for that item, and continue for the next item. > >To test: > >1) Set CircControl to 'the library the item is from' >2) Check out items and back-date them to be overdue >3) Set homebranch of one of the items to NULL >4) Run misc/cronjobs/fines.pl, note that processing stops at that item. >5) Apply patch >6) Repeat step 4. not that processing completes. >7) Check logs, you should see a warning message for the item missing its homebranch. >8) Sign off. > >Signed-off-by: Pierre-Luc Lapointe <pierreluc.lapointe@inLibro.com> >--- > misc/cronjobs/fines.pl | 9 ++++++++- > 1 file changed, 8 insertions(+), 1 deletion(-) > >diff --git a/misc/cronjobs/fines.pl b/misc/cronjobs/fines.pl >index 87c732e..08105ae 100755 >--- a/misc/cronjobs/fines.pl >+++ b/misc/cronjobs/fines.pl >@@ -110,8 +110,15 @@ for my $overdue ( @{$overdues} ) { > ( $control eq 'ItemHomeLibrary' ) ? $overdue->{homebranch} > : ( $control eq 'PatronLibrary' ) ? $borrower->{branchcode} > : $overdue->{branchcode}; >+ # In final case, CircControl must be PickupLibrary. (branchcode comes from issues table here). >+ >+ unless( defined $branchcode ) { >+ warn( "Item home branch, borrower branch code or issues branchcode " >+ . "not defined. Cannot process fine for borrower cardnumber '$borrower->{cardnumber}', " >+ . "item barcode '$overdue->{branchcode}'"); >+ next; >+ } > >-# In final case, CircControl must be PickupLibrary. (branchcode comes from issues table here). > if ( !exists $is_holiday{$branchcode} ) { > $is_holiday{$branchcode} = set_holiday( $branchcode, $today ); > } >-- >2.7.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 5789
:
75103
| 76109