From e8d02c58d2457c143e2bfd60ede0d95b44218f70 Mon Sep 17 00:00:00 2001 From: Jonathan Druart Date: Wed, 31 Jan 2024 11:03:38 +0100 Subject: [PATCH] Bug 34478: Add missing op - members-update Signed-off-by: Jonathan Druart --- .../prog/en/modules/members/members-update.tt | 5 ++- members/members-update-do.pl | 43 ++++++++++--------- 2 files changed, 27 insertions(+), 21 deletions(-) diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/members/members-update.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/members/members-update.tt index 95c6a481c2..5350ebf150 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/modules/members/members-update.tt +++ b/koha-tmpl/intranet-tmpl/prog/en/modules/members/members-update.tt @@ -205,7 +205,10 @@ [% END # /FOREACH pm %] -
+
+ + +
[% ELSE %]
diff --git a/members/members-update-do.pl b/members/members-update-do.pl index a42c1ff963..7adcb62ef1 100755 --- a/members/members-update-do.pl +++ b/members/members-update-do.pl @@ -29,36 +29,39 @@ my $query = CGI->new; my ( $userid, $cookie, $sessionID, $flags ) = checkauth($query, 0, { borrowers => 'edit_borrowers' }, 'intranet'); +my $op = $query->param('op') || q{}; my $logged_in_user = Koha::Patrons->find({ userid => $userid }); my @params = $query->param; -foreach my $param (@params) { - if ( $param =~ "^modify_" ) { - my (undef, $borrowernumber) = split( /_/, $param ); +if ( $op eq 'cud-update' ) { + foreach my $param (@params) { + if ( $param =~ "^modify_" ) { + my (undef, $borrowernumber) = split( /_/, $param ); - my $patron = Koha::Patrons->find($borrowernumber); - next unless $logged_in_user->can_see_patron_infos( $patron ); + my $patron = Koha::Patrons->find($borrowernumber); + next unless $logged_in_user->can_see_patron_infos( $patron ); - my $action = $query->param($param); + my $action = $query->param($param); - if ( $action eq 'approve' ) { - my $m = Koha::Patron::Modifications->find( { borrowernumber => $borrowernumber } ); + if ( $action eq 'approve' ) { + my $m = Koha::Patron::Modifications->find( { borrowernumber => $borrowernumber } ); - if ($query->param("unset_gna_$borrowernumber")) { - # Unset gone no address - # FIXME Looks like this could go to $m->approve - my $patron = Koha::Patrons->find( $borrowernumber ); - $patron->gonenoaddress(undef)->store; - } + if ($query->param("unset_gna_$borrowernumber")) { + # Unset gone no address + # FIXME Looks like this could go to $m->approve + my $patron = Koha::Patrons->find( $borrowernumber ); + $patron->gonenoaddress(undef)->store; + } - $m->approve() if $m; - } - elsif ( $action eq 'deny' ) { - my $m = Koha::Patron::Modifications->find( { borrowernumber => $borrowernumber } ); - $m->delete() if $m; + $m->approve() if $m; + } + elsif ( $action eq 'deny' ) { + my $m = Koha::Patron::Modifications->find( { borrowernumber => $borrowernumber } ); + $m->delete() if $m; + } + # elsif ( $action eq 'ignore' ) { } } - # elsif ( $action eq 'ignore' ) { } } } -- 2.39.5