From 8c604fc3d8c6b9a5e0fc8c0a0e16a66c3bb80222 Mon Sep 17 00:00:00 2001 From: Andrii Nugged Date: Mon, 3 Jun 2024 03:50:24 +0300 Subject: [PATCH] Bug 37014: Fix after-modal-POST to transmit "not_returned" message MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit The bug report addresses an issue where the message "Item was not checked in" erroneously appears during the second POST after a manual or modal check-in process. 1. In circ/returns.pl: - Introduced a new hash `%rinot_returned` to track items not returned across pages. - Updated the logic to capture the "not returned" status from the query parameters. - Adjusted the input processing loop to include `not_returned` status. - Modified the section handling barcode check-ins to appropriately initialize and update the `not_returned` status. 2. returns.tt: - Added hidden input fields in the template to include `not_returned` status in the form submissions. The changes ensure that the "not_returned" status is correctly tracked and displayed, preventing the erroneous message from appearing on subsequent POST requests. 1. Perform a manual check-in of an item, but make some warning modal appear: for ex., transfer: check-in the item in not home library. 2. Press OK on the modal. There will be a POST transition again to redraw the checked-in items list. 3. Verify that the "Item was not checked in" message appears erroneously near the item's row. 4. Apply the patch. 5. Repeat steps 1-3 and check that there will be no erroneous "Item was not checked in" message. Signed-off-by: Tadeusz „tadzik” Sośnierz Signed-off-by: Lucas Gass Signed-off-by: Katrin Fischer (cherry picked from commit f567d41b91092711278a1e00accb1ebdee59f4c2) Signed-off-by: Lucas Gass (cherry picked from commit 12edba3773ae2a47384134a04790ec519b262d43) Signed-off-by: Fridolin Somers --- circ/returns.pl | 8 +++++++- koha-tmpl/intranet-tmpl/prog/en/modules/circ/returns.tt | 7 +++++++ 2 files changed, 14 insertions(+), 1 deletion(-) diff --git a/circ/returns.pl b/circ/returns.pl index 3fd20c6591..79c14b982d 100755 --- a/circ/returns.pl +++ b/circ/returns.pl @@ -103,6 +103,7 @@ my $returned_counter = C4::Context->preference('numReturnedItemsToShow') || 8; my %returneditems; my %riduedate; my %riborrowernumber; +my %rinot_returned; my @inputloop; foreach ( $query->param ) { my $counter; @@ -120,6 +121,7 @@ foreach ( $query->param ) { my $barcode = $query->param("ri-$counter"); my $duedate = $query->param("dd-$counter"); my $borrowernumber = $query->param("bn-$counter"); + my $not_returned = $query->param("nr-$counter"); $counter++; # decode barcode ## Didn't we already decode them before passing them back last time?? @@ -130,12 +132,14 @@ foreach ( $query->param ) { $returneditems{$counter} = $barcode; $riduedate{$counter} = $duedate; $riborrowernumber{$counter} = $borrowernumber; + $rinot_returned{$counter} = $not_returned; ####################### $input{counter} = $counter; $input{barcode} = $barcode; $input{duedate} = $duedate; $input{borrowernumber} = $borrowernumber; + $input{not_returned} = $not_returned; push( @inputloop, \%input ); } @@ -385,6 +389,7 @@ if ($barcode) { $returneditems{0} = $barcode; $riborrowernumber{0} = $borrower->{'borrowernumber'}; $riduedate{0} = $duedate; + $rinot_returned{0} = 0; $input{borrowernumber} = $borrower->{'borrowernumber'}; $input{duedate} = $duedate; unless ( $dropboxmode ) { @@ -428,6 +433,7 @@ if ($barcode) { } $input{duedate} = $duedate; $input{not_returned} = 1; + $rinot_returned{0} = 1; $returneditems{0} = $barcode; $riduedate{0} = $duedate; push( @inputloop, \%input ); @@ -807,7 +813,7 @@ foreach ( sort { $a <=> $b } keys %returneditems ) { # we could handle that better displaying a message in the template - $ri{not_returned} = 1 unless $returned; + $ri{not_returned} = $rinot_returned{$_}; my $biblio = $item->biblio; # FIXME pass $item to the template and we are done here... $ri{itembiblionumber} = $biblio->biblionumber; 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 357eebb3ba..bb02f1b6f2 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/modules/circ/returns.tt +++ b/koha-tmpl/intranet-tmpl/prog/en/modules/circ/returns.tt @@ -430,6 +430,7 @@ + [% END %] @@ -511,6 +512,7 @@ + [% END %] [% IF item.onloan %] @@ -583,6 +585,7 @@ + [% END %] @@ -860,6 +865,7 @@ + [% END %] @@ -1122,6 +1128,7 @@ + [% END %] -- 2.39.5