From bab856bf9fd7ef5b51601ae9fc36d572cec953ea Mon Sep 17 00:00:00 2001 From: Emmi Takkinen Date: Wed, 20 Mar 2024 15:33:21 +0200 Subject: [PATCH] Bug 36368: Declare template param "op" after variable $op is set If an error occurs while adding new patron, after fixing the error and hitting save, patron entry page reloads to "Modify patron" section and error "Patron not found. Return to search" is displayed. But no patron is saved. This happens because we declare template param op too early in the code and it receives value "cud-insert" instead of "add_form" as it should. To test: 1. Add new patron and cause an error (wrong age etc.). 2. Attempt to save patron, error message is displayed. 3. Fix your errors and attempt to save again. => Error message "Patron not found. Return to search" is displayed and new patron is not saved to database. 4. Apply this patch. 5. Repeat steps from 1 to 3. => Saving patron should now work. => To be save, test if modifying patron also works as it should. Sponsored-by: Koha-Suomi Oy --- members/memberentry.pl | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/members/memberentry.pl b/members/memberentry.pl index b7d8a4a1a4..36312a95f0 100755 --- a/members/memberentry.pl +++ b/members/memberentry.pl @@ -163,7 +163,6 @@ foreach (@field_check) { next unless m/\w/o; $template->param( "no$_" => 1 ); } -$template->param( "op" => $op ); $template->param( "quickadd" => 1 ) if ( $quickadd ); $template->param( "duplicate" => 1 ) if ( $op eq 'duplicate' ); $template->param( "checked" => 1 ) if ( defined($nodouble) && $nodouble eq 1 ); @@ -605,6 +604,9 @@ if ($nok or !$nodouble){ $template->param( step_1 => 1,step_2 => 1,step_3 => 1, step_4 => 1, step_5 => 1, step_6 => 1, step_7 => 1 ); } } + +$template->param( "op" => $op ); + if (C4::Context->preference("IndependentBranches")) { my $userenv = C4::Context->userenv; if ( !C4::Context->IsSuperLibrarian() && $data{'branchcode'} ) { -- 2.34.1