Bugzilla – Attachment 185945 Details for
Bug 40708
Increase accuracy and accessibility of checkin errors
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 40708: Return the specific error to the checkin page
Bug-40708-Return-the-specific-error-to-the-checkin.patch (text/plain), 5.17 KB, created by
Brendan Lawlor
on 2025-08-29 17:13:40 UTC
(
hide
)
Description:
Bug 40708: Return the specific error to the checkin page
Filename:
MIME Type:
Creator:
Brendan Lawlor
Created:
2025-08-29 17:13:40 UTC
Size:
5.17 KB
patch
obsolete
>From 7e30e1dc02d8c56432a3d7ad9f241c25c019b8c2 Mon Sep 17 00:00:00 2001 >From: Nick Clemens <nick@bywatersolutions.com> >Date: Fri, 29 Aug 2025 12:03:13 +0000 >Subject: [PATCH] Bug 40708: Return the specific error to the checkin page > >When implemented, the message here was believed to either be about Duplicate IDs, or guarantor issues. >We are now seeing a wider variety of issues possible from SQL errors, lock timeout or missings rows as examples > >This patch adds an 'ErrorMessage' message to the return from AddReturn and displays it to the user. > >To test: >1 - Issue an item to a patron, note the itemnumber >2 - On the command line, lock the row: > sudo koha-mysql kohadev > START TRANSACTION; > SELECT * FROM issues WHERE itemnumber=975 FOR UPDATE; > leave mysql open at this point >3 - On the interface, check in the item, wait a bit >4 - After a bit you get the error to check the config page, but nothing is there >5 - close mysql, apply patch, restart all >6 - Repeat 2 >7 - Check in the item, wait a bit >8 - Note you now get the error from the DB: > Error: (DBIx::Class::Storage::DBI::_dbh_execute(): DBI Exception: DBD::mysql::st execute failed: Lock wait timeout exceeded; try restarting transaction at /kohadevbox/koha/Koha/Object.pm line 174 ) >9 - Sign off! > >Signed-off-by: Brendan Lawlor <blawlor@clamsnet.org> >--- > C4/Circulation.pm | 8 ++++++-- > circ/returns.pl | 2 +- > .../intranet-tmpl/prog/en/modules/circ/returns.tt | 11 ++++++----- > 3 files changed, 13 insertions(+), 8 deletions(-) > >diff --git a/C4/Circulation.pm b/C4/Circulation.pm >index 59e12c72cd..dcc1bd19dc 100644 >--- a/C4/Circulation.pm >+++ b/C4/Circulation.pm >@@ -2380,14 +2380,18 @@ sub AddReturn { > ); > } > } else { >+ my $error = "$@"; > carp >- "The checkin for the following issue failed, Please go to the about page and check all messages on the 'System information' to see if there are configuration / data issues ($@)" >+ "The checkin for the following issue failed, Please go to the about page and check all messages on the 'System information' to see if there are configuration / data issues, or see the specific message in parentheses ($@)" > . Dumper( $issue->unblessed ); > > my $indexer = Koha::SearchEngine::Indexer->new( { index => $Koha::SearchEngine::BIBLIOS_INDEX } ); > $indexer->index_records( $item->biblionumber, "specialUpdate", "biblioserver" ); > >- return ( 0, { WasReturned => 0, DataCorrupted => 1 }, $issue, $patron_unblessed ); >+ return ( >+ 0, { WasReturned => 0, DataCorrupted => $error }, $issue, >+ $patron_unblessed >+ ); > } > > # FIXME is the "= 1" right? This could be the borrower hash. >diff --git a/circ/returns.pl b/circ/returns.pl >index 901877ef1e..584b6e84a2 100755 >--- a/circ/returns.pl >+++ b/circ/returns.pl >@@ -730,7 +730,7 @@ foreach my $code ( keys %$messages ) { > } elsif ( $code eq 'NotForLoanStatusUpdated' ) { > $err{NotForLoanStatusUpdated} = $messages->{NotForLoanStatusUpdated}; > } elsif ( $code eq 'DataCorrupted' ) { >- $err{data_corrupted} = 1; >+ $err{data_corrupted} = $messages->{'DataCorrupted'}; > } elsif ( $code eq 'ReturnClaims' ) { > $template->param( ReturnClaims => $messages->{ReturnClaims} ); > } elsif ( $code eq 'ClaimAutoResolved' ) { >diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/circ/returns.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/circ/returns.tt >index b248cdc882..fb1c684ff1 100644 >--- a/koha-tmpl/intranet-tmpl/prog/en/modules/circ/returns.tt >+++ b/koha-tmpl/intranet-tmpl/prog/en/modules/circ/returns.tt >@@ -399,11 +399,12 @@ > [% IF ( errmsgloo.foreverdebarred ) %] > <p class="problem ret_foreverdebarred"><strong>Reminder: </strong>Patron has an indefinite restriction.</p> > [% END %] >- [% IF errmsgloo.data_corrupted %] >- <p class="problem ret_datacorrupt" >- >The item has not been checked in due to a configuration issue in your system. You must ask an administrator to take a look at the <a href="/cgi-bin/koha/about.pl#sysinfo_panel">about page</a> and correct all >- errors shown on the "System information" tab</p >- > >+ [% IF ( errmsgloo.data_corrupted ) %] >+ <p class="problem ret_datacorrupt"> >+ The item has not been checked in due to an issue in your system. Note the error below. An administrator may find further details by looking at the <a href="/cgi-bin/koha/about.pl#sysinfo_panel">about page</a> and >+ correcting errors shown on the "System information" tab, or note the error below. >+ </p> >+ <p class="problem ret_error_message"> Error: ([% errmsgloo.data_corrupted | html %]) </p> > [% END %] > [% END # /FOREACH errmsgloo %] > </div> >-- >2.39.5
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 40708
:
185911
|
185912
|
185929
|
185943
|
185945
|
186468
|
186469
|
186470