Koha/C4
Kyle M Hall d4f41cc8aa
Bug 23018: Refunding a lost item fee may trigger error if any fee has been written off related to that item
If a lost item fee is written off, it creates a writeoff with the same itemnumber but the amount column is a negative number.

Now, when the lost item is returned, it calls _FixAccountForLostAndReturned which searchs for all accountlines with an account type of 'L' or 'W'.

Then, if the *first* of those lines has an outstanding balance, a credit is created and *all* the lines found are passed to $credit->apply. The apply method then calls is_debit on each line and when it hits the writeoff, it throws an exception ( Koha::Exceptions::Account::IsNotDebit ).

When this happens, the credit is creating but not applied the the outstanding lost item fee, and the librarian is presented with an error page.

It seems like the solution is to only fetch the first result since it seems like that is the only one we should be operating on.

Test Plan:
1) Create a lost item with a fee
2) Create a manual debit using the barcode of the item
3) Write off that manual debit
4) Check in the item, note the error
5) Apply this patch
6) Repeat steps 1-3
7) Check in the item, no error!

Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
2019-07-15 11:27:57 +01:00
..
AuthoritiesMarc
Barcodes Bug 21937: Syspref autoBarcode annual doesn't increment properly barcode 2019-04-19 14:32:36 +00:00
ClassSortRoutine
ClassSplitRoutine
Creators Bug 22878: Do not pass layout_id on creating a layout 2019-05-15 12:10:52 +00:00
External Bug 22010: Check preferences for ebook integration 2019-04-30 11:42:51 +00:00
Form
Heading
ILSDI Bug 23156: Add pagination to checkouts in ILS-DI GetPatronInfo service 2019-06-25 17:16:26 +01:00
Installer Bug 21073: (follow-up) Add Class::Inspector to PerlDependencies 2019-06-18 17:30:14 +01:00
Labels
Linker Bug 21450: Cache authorities search using term and auth_type 2019-05-30 10:13:38 +00:00
Members
OAI
Output
Patroncards Bug 22429: Infinite loop in patron card printing 2019-03-15 11:59:28 +00:00
Reports Bug 22357: Do not duplicate report rows if several reports exist 2019-04-30 11:35:23 +00:00
Search
Serials
SIP Bug 20292: Filter/censor info sent via SIP 2019-06-24 15:33:48 +01:00
Utils Bug 20514: Use streetnumber when searching for patrons by address 2019-05-15 12:10:53 +00:00
Accounts.pm Bug 22600: Update Tests adding 'interface' as needed 2019-04-10 19:43:11 +00:00
Acquisition.pm Bug 21364: (QA follow-up) Fix QA script complaints (tabs and filters) 2019-04-30 12:45:42 +00:00
Auth.pm Bug 14407: Follow up to add test case and clean noise 2019-05-10 11:39:50 +00:00
Auth_cas_servers.yaml.sample
Auth_with_cas.pm
Auth_with_ldap.pm Bug 22461: (follow-up) Use exists not defined 2019-04-26 17:51:09 +00:00
Auth_with_shibboleth.pm
AuthoritiesMarc.pm Bug 21036: Remove odd number of elements warnings from AuthoritiesMarc.pm 2019-05-07 11:39:24 +00:00
BackgroundJob.pm
Barcodes.pm
Biblio.pm Bug 22709: Add after biblio/item action hooks 2019-07-04 13:49:38 +01:00
Bookseller.pm
Boolean.pm
Breeding.pm Bug 22532: Remove Z39.50 random 2019-04-18 10:48:10 +00:00
Budgets.pm Bug 10577: (QA follow-up) Remove tab chars 2019-03-28 12:46:14 +00:00
Calendar.pm
Charset.pm
Circulation.pm Bug 23018: Refunding a lost item fee may trigger error if any fee has been written off related to that item 2019-07-15 11:27:57 +01:00
ClassSortRoutine.pm
ClassSource.pm
ClassSplitRoutine.pm
Context.pm Bug 22600: Add 'cron' to interface types and set appropriately 2019-04-10 19:43:11 +00:00
Contract.pm
CourseReserves.pm Bug 23083: Fix course reserve item editing if one of the value is set to UNCHANGED 2019-07-05 08:34:13 +01:00
Creators.pm
Debug.pm
Heading.pm Bug 21826: Remove strict and warning from Heading.pm 2019-01-25 20:13:41 +00:00
HoldsQueue.pm Bug 22330: Cache item and library objects when building the holds queue 2019-03-21 16:22:56 +00:00
HTML5Media.pm
Images.pm Bug 21987: Do not generate true color thumbnails if not needed 2019-03-15 12:19:56 +00:00
ImportBatch.pm Bug 22532: Remove Z39.50 random 2019-04-18 10:48:10 +00:00
ImportExportFramework.pm Bug 18143: Silence ods MARC framework export flood 2019-02-19 13:52:15 +00:00
InstallAuth.pm
Installer.pm Bug 21651: Always insert notice templates related tables 2019-05-15 15:47:15 +00:00
ItemCirculationAlertPreference.pm
Items.pm Bug 22709: Add after biblio/item action hooks 2019-07-04 13:49:38 +01:00
Koha.pm
Labels.pm
Languages.pm Bug 18213: Add Template plugin and fix for C4/Languages 2019-03-28 15:57:32 +00:00
Letters.pm Bug 5770: (QA follow-up) Revert change to GetQueuedMessages 2019-05-10 17:29:31 +00:00
Linker.pm
Log.pm Bug 22600: Add 'interface' to accountlines 2019-04-10 19:43:11 +00:00
MarcModificationTemplates.pm Bug 21831: Allow move all fields even if destination field is different 2019-05-23 14:50:57 +00:00
Matcher.pm Bug 22046: Simplify and unify the code for get_matches 2019-05-23 14:44:42 +00:00
Members.pm
Message.pm Bug 21206: Replace C4::Items::GetItem 2019-02-26 13:24:07 +00:00
NewsChannels.pm
Output.pm Bug 23117: Shortcut additem.pl on nonexistent biblionumber 2019-06-15 08:01:37 +01:00
Overdues.pm Bug 22521: (QA follow-up) Corrections to tests 2019-04-17 16:49:36 +00:00
Patroncards.pm
Print.pm
Record.pm
Reports.pm
Reserves.pm Bug 21181: Make cancel_expired_reserves.pl Cancel all holds not waiting if ExpireReservesMaxPickupDelay not set 2019-07-05 08:39:23 +01:00
Ris.pm
RotatingCollections.pm
Scheduler.pm
Scrubber.pm
Search.pm Bug 14419: Expanding facets (Show more) performs a new search 2019-07-04 09:22:02 +01:00
Serials.pm Bug 23126: Display multi-line entries in subscrpitions correctly 2019-06-25 17:18:00 +01:00
Service.pm
ShelfBrowser.pm
SMS.pm
SocialData.pm
Stats.pm Bug 21683: Remove accountlines.accountno 2019-03-21 18:19:22 +00:00
Suggestions.pm Bug 22907: Add missing use statement 2019-05-30 10:19:06 +00:00
Tags.pm
Templates.pm
TmplToken.pm
TmplTokenType.pm
TTParser.pm
UsageStats.pm Bug 14576: Allow arbitrary automatic update of location on checkin 2019-04-25 11:36:23 +00:00
XISBN.pm
XSLT.pm Bug 22899: (QA follow-up) Change accessor name 2019-05-14 18:08:34 +00:00