View | Details | Raw Unified | Return to bug 14708
Collapse All | Expand All

(-)a/Koha/REST/V1/Patrons.pm (-5 / +17 lines)
Lines 310-320 sub delete { Link Here
310
        $patron = Koha::Patrons->find( $c->validation->param('patron_id') );
310
        $patron = Koha::Patrons->find( $c->validation->param('patron_id') );
311
311
312
        # check if loans, reservations, debarrment, etc. before deletion!
312
        # check if loans, reservations, debarrment, etc. before deletion!
313
        $patron->delete;
313
        try {
314
        return $c->render(
314
            $patron->delete;
315
            status  => 204,
315
            return $c->render(
316
            openapi => q{}
316
                status  => 204,
317
        );
317
                openapi => q{}
318
            );
319
        } catch {
320
            if ( $_->isa('Koha::Exceptions::Patron::FailedDeleteAnonymousPatron') ) {
321
                return $c->render(
322
                    status  => 403,
323
                    openapi => { error => "Anonymous patron cannot be deleted" }
324
                );
325
            }
326
            else {
327
                $c->unhandled_exception($_);
328
            }
329
        };
318
    }
330
    }
319
    catch {
331
    catch {
320
        unless ($patron) {
332
        unless ($patron) {
(-)a/members/deletemem.pl (-3 / +9 lines)
Lines 24-29 Link Here
24
use Modern::Perl;
24
use Modern::Perl;
25
25
26
use CGI qw ( -utf8 );
26
use CGI qw ( -utf8 );
27
28
use Try::Tiny;
29
27
use C4::Context;
30
use C4::Context;
28
use C4::Output;
31
use C4::Output;
29
use C4::Auth;
32
use C4::Auth;
Lines 127-135 if ( $op eq 'delete_confirm' or $countissues > 0 or $debits or $is_guarantor ) { Link Here
127
        });
130
        });
128
    my $patron = Koha::Patrons->find( $member );
131
    my $patron = Koha::Patrons->find( $member );
129
    $patron->move_to_deleted;
132
    $patron->move_to_deleted;
130
    $patron->delete;
133
    try {
134
        $patron->delete;
135
        print $input->redirect("/cgi-bin/koha/members/members-home.pl");
136
    } catch {
137
        print $input->redirect("/cgi-bin/koha/members/moremember.pl?borrowernumber=$member&error=CANT_DELETE_ANONYMOUS_PATRON");
138
    }
131
    # TODO Tell the user everything went ok
139
    # TODO Tell the user everything went ok
132
    print $input->redirect("/cgi-bin/koha/members/members-home.pl");
133
    exit 0; # Exit without error
140
    exit 0; # Exit without error
134
}
141
}
135
142
136
- 

Return to bug 14708