To reproduce: - Create a Manual invoice for a patron, select Type: Lost Item - Do not fill in Barcode, Description - Give the invoice an amount that is easy to identify - Go to tab "Pay fines" - Identify row of new fine, click "Pay" - On the following page, click "Confirm" Result: "Internal Server Error" plack error log says: Can't call method "last_returned_by" on an undefined value at /home/marc/koha/C4/Circulation.pm line 2188. - Repeat steps above, insert a valid Barcode of an item that is lost. Same result.
Following finding: sub pay in Koha/Account.pm line 106 triggers C4::Circulation::ReturnLostItem ( $self->{patron_id}, $fine->itemnumber ); $fine->itemnumber is not defined. But should payment for a lost item mark the item as returned? Payment for an item that is lost does not necessarily mean that the item is already replaced or will be replaced at all.
(In reply to Marc Véron from comment #1) > Following finding: > But should payment for a lost item mark the item as returned? > > Payment for an item that is lost does not necessarily mean that the item is > already replaced or will be replaced at all. Please ignore this comment - of course the item should be marked as returned. I think - it should not be possible to create a manual invoice for a lost item or alternatively the barcode should be verified and the item should be set to LOST (not in the scope of this bug) - paying a fine for a lost item without having a barcode should not result in an internal server error (scope of this bug)
To recreate you need StoreLastBorrower
Created attachment 61402 [details] [review] Bug 18266: Fix internal error when paying fine for lost item without.. item If a fine is created for a lost item but the itemnumber is not supplied, the system will return it. The item should not be mark as returned if there is no item linked to the fine. Test plan: 1. Turn StoreLastBorrower on 2. Create a manual invoice for a lost item, do not supply a barcode 3. Pay the fines 'Pay fines > Pay' => Without this patch applied you get Can't call method "last_returned_by" on an undefined value at /home/marc/koha/C4/Circulation.pm line 2188. => With this patch applied, you must not get the error.
Created attachment 61439 [details] [review] Bug 18266: Fix internal error when paying fine for lost item without.. item If a fine is created for a lost item but the itemnumber is not supplied, the system will return it. The item should not be mark as returned if there is no item linked to the fine. Test plan: 1. Turn StoreLastBorrower on 2. Create a manual invoice for a lost item, do not supply a barcode 3. Pay the fines 'Pay fines > Pay' => Without this patch applied you get Can't call method "last_returned_by" on an undefined value at /home/marc/koha/C4/Circulation.pm line 2188. => With this patch applied, you must not get the error. Signed-off-by: Marc Véron <veron@veron.ch>
Created attachment 61687 [details] [review] Bug 18266: Fix internal error when paying fine for lost item without.. item If a fine is created for a lost item but the itemnumber is not supplied, the system will return it. The item should not be mark as returned if there is no item linked to the fine. Test plan: 1. Turn StoreLastBorrower on 2. Create a manual invoice for a lost item, do not supply a barcode 3. Pay the fines 'Pay fines > Pay' => Without this patch applied you get Can't call method "last_returned_by" on an undefined value at /home/marc/koha/C4/Circulation.pm line 2188. => With this patch applied, you must not get the error. Signed-off-by: Marc Véron <veron@veron.ch> Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
Pushed to master for 17.05, thanks Jonathan!
I was able to reproduce this error on 16.11.x, but the patch doesn't apply cleanly. There is a conflict in Koha/Account.pm. Jonathan, could you please take a look? I'd really like this for 16.11.07.
Created attachment 61795 [details] [review] [16.11.x] Bug 18266: Fix internal error when paying fine for lost item without.. item If a fine is created for a lost item but the itemnumber is not supplied, the system will return it. The item should not be mark as returned if there is no item linked to the fine. Test plan: 1. Turn StoreLastBorrower on 2. Create a manual invoice for a lost item, do not supply a barcode 3. Pay the fines 'Pay fines > Pay' => Without this patch applied you get Can't call method "last_returned_by" on an undefined value at /home/marc/koha/C4/Circulation.pm line 2188. => With this patch applied, you must not get the error.
This patch has been pushed to 16.11.x and will be in 16.11.07.
Pushed to 3.22.x for 3.22.20
Pushed to 16.05.x, for 16.05.12 release