Bug 34478: Add missing op - members-update

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
This commit is contained in:
Jonathan Druart 2024-01-31 11:03:38 +01:00
parent c790129c7d
commit e8d02c58d2
No known key found for this signature in database
GPG Key ID: A085E712BEF0E0F0
2 changed files with 27 additions and 21 deletions

View File

@ -205,7 +205,10 @@
</div> <!-- /panel.panel-default -->
[% END # /FOREACH pm %]
</div> <!-- /#pending-updates -->
<fieldset class="action"><input type="submit" class="btn btn-primary" value="Submit" /></fieldset>
<fieldset class="action">
<input type="hidden" name="op" value="cud-update" />
<input type="submit" class="btn btn-primary" value="Submit" />
</fieldset>
</form>
[% ELSE %]
<div class="dialog message">

View File

@ -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;
}
$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 'deny' ) {
my $m = Koha::Patron::Modifications->find( { borrowernumber => $borrowernumber } );
$m->delete() if $m;
}
# elsif ( $action eq 'ignore' ) { }
}
}