From 79d5f91870a15a9b09d27ed4e6eed2683d7e9ea7 Mon Sep 17 00:00:00 2001 From: Marcel de Rooy Date: Fri, 3 Sep 2021 09:33:00 +0000 Subject: [PATCH] Bug 28935: Apply modules change to controller scripts Content-Type: text/plain; charset=utf-8 --- members/memberentry.pl | 6 +++--- opac/opac-memberentry.pl | 9 ++++++--- 2 files changed, 9 insertions(+), 6 deletions(-) diff --git a/members/memberentry.pl b/members/memberentry.pl index 509b5ac19e..227792c13a 100755 --- a/members/memberentry.pl +++ b/members/memberentry.pl @@ -48,8 +48,8 @@ use Email::Valid; use Koha::SMS::Providers; use Koha::Patron::Allowlist; -my $ui_allowlist = Koha::Patron::Allowlist->new({ interface => 'staff' }); - +my $allowlist = Koha::Patron::Allowlist->new({ interface => 'staff' }); +$allowlist->load; my $input = CGI->new; my %data; @@ -434,7 +434,7 @@ if ( defined $sms ) { $newdata{smsalertnumber} = $sms; } -$ui_allowlist->apply({ input => \%newdata }); +my $blocked = $allowlist->apply({ input => \%newdata, verbose => 1 }); # TODO Should we log results in $blocked ? ### Error checks should happen before this line. $nok = $nok || scalar(@errors); diff --git a/opac/opac-memberentry.pl b/opac/opac-memberentry.pl index 3c3d9434ae..1f1dc98b98 100755 --- a/opac/opac-memberentry.pl +++ b/opac/opac-memberentry.pl @@ -48,7 +48,8 @@ use Koha::AuthorisedValues; use Koha::Patron::Allowlist; -my $ui_allowlist = Koha::Patron::Allowlist->new(); +my $allowlist = Koha::Patron::Allowlist->new; +$allowlist->load; my $cgi = CGI->new; my $dbh = C4::Context->dbh; @@ -136,7 +137,8 @@ if ( $action eq 'create' ) { delete $borrower{'password2'}; my @unwanted_fields = split( /\|/, C4::Context->preference('PatronSelfRegistrationBorrowerUnwantedField') || q|| ); - $ui_allowlist->apply({ input => \%borrower, additional_deny_list => \@unwanted_fields }); + $allowlist->remove( @unwanted_fields ); + $allowlist->apply({ input => \%borrower, verbose => 1 }); # TODO Log blocked data ? my $cardnumber_error_code; if ( !grep { $_ eq 'cardnumber' } @empty_mandatory_fields ) { @@ -276,7 +278,8 @@ elsif ( $action eq 'update' ) { %borrower = ( %$borrower, %borrower ); my @unwanted_fields = split( /\|/, C4::Context->preference('PatronSelfModificationBorrowerUnwantedField') || q|| ); - $ui_allowlist->apply({ input => \%borrower, additional_deny_list => \@unwanted_fields }); + $allowlist->remove( @unwanted_fields ); + $allowlist->apply({ input => \%borrower, verbose => 1 }); # TODO Log blocked data ? if (@empty_mandatory_fields || @$invalidformfields) { $template->param( -- 2.20.1