From 363fefba8ced45eca804e4ada6c0dec6a61a59b0 Mon Sep 17 00:00:00 2001 From: Jonathan Druart Date: Fri, 21 Jul 2023 12:03:07 +0200 Subject: [PATCH] Bug 33940: Fix messages we sent to templates please squash with the first patch --- installer/onboarding.pl | 3 ++- members/memberentry.pl | 3 ++- opac/opac-memberentry.pl | 3 ++- 3 files changed, 6 insertions(+), 3 deletions(-) diff --git a/installer/onboarding.pl b/installer/onboarding.pl index a8e63f066a5..457f1fe278f 100755 --- a/installer/onboarding.pl +++ b/installer/onboarding.pl @@ -143,7 +143,8 @@ if ( $step == 3 ) { my $is_cardnumber_valid = Koha::Policy::Patrons::Cardnumber->is_valid($cardnumber); unless ( $is_cardnumber_valid ) { - for my $message ( @{ $is_cardnumber_valid->messages } ) { + for my $m ( @{ $is_cardnumber_valid->messages } ) { + my $message = $m->message; if ( $message eq 'already_exists' ) { push @messages, { code => 'ERROR_cardnumber_already_exists' }; } diff --git a/members/memberentry.pl b/members/memberentry.pl index d9b027070f7..35d9b0bd87b 100755 --- a/members/memberentry.pl +++ b/members/memberentry.pl @@ -295,7 +295,8 @@ if ($op eq 'save' || $op eq 'insert'){ my $is_valid = Koha::Policy::Patrons::Cardnumber->is_valid($newdata{cardnumber}, $patron ); unless ($is_valid) { - for my $message ( @{ $is_valid->messages } ) { + for my $m ( @{ $is_valid->messages } ) { + my $message = $m->message; if ( $message eq 'already_exists' ) { push @messages, { code => 'ERROR_cardnumber_already_exists' }; } elsif ( $message eq 'invalid_length' ) { diff --git a/opac/opac-memberentry.pl b/opac/opac-memberentry.pl index bc922a9ee04..9af4a2371d3 100755 --- a/opac/opac-memberentry.pl +++ b/opac/opac-memberentry.pl @@ -140,7 +140,8 @@ if ( $action eq 'create' ) { my $patron = Koha::Patrons->find($borrower{borrowernumber}); $is_cardnumber_valid = Koha::Policy::Patrons::Cardnumber->is_valid($borrower{cardnumber}, $patron); unless ($is_cardnumber_valid) { - for my $message ( @{ $is_cardnumber_valid->messages } ) { + for my $m ( @{ $is_cardnumber_valid->messages } ) { + my $message = $m->message; if ( $message eq 'already_exists' ) { $template->param( cardnumber_already_exists => 1 ); } elsif ( $message eq 'invalid_length' ) { -- 2.25.1