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

(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/members/moremember.tt (+4 lines)
Lines 54-59 Link Here
54
                                <h3>Unable to delete patrons from other libraries with current settings</h3>
54
                                <h3>Unable to delete patrons from other libraries with current settings</h3>
55
                                <p>Insufficient privileges.</p>
55
                                <p>Insufficient privileges.</p>
56
                            [% END %]
56
                            [% END %]
57
                            [% IF ( error == 'CANT_DELETE_ANONYMOUS_PATRON' ) %]
58
                                <h3>Unable to delete patron that is set as AnonymousPatron</h3>
59
                                <p>This patron cannot be deleted while set as AnonymousPatron in the system preferences.</p>
60
                            [% END %]
57
                            [% IF ( error == 'CANT_DELETE' ) %]
61
                            [% IF ( error == 'CANT_DELETE' ) %]
58
                                <h3>Unable to delete patron</h3>
62
                                <h3>Unable to delete patron</h3>
59
                                <p>Insufficient privileges.</p>
63
                                <p>Insufficient privileges.</p>
(-)a/members/deletemem.pl (+7 lines)
Lines 82-87 if (C4::Context->preference("IndependentBranches")) { Link Here
82
    }
82
    }
83
}
83
}
84
84
85
if ( my $anonymous_patron = C4::Context->preference("AnonymousPatron") ) {
86
    if ( $patron->id eq $anonymous_patron ) {
87
        print $input->redirect("/cgi-bin/koha/members/moremember.pl?borrowernumber=$member&error=CANT_DELETE_ANONYMOUS_PATRON");
88
        exit 0;    # Exit without error
89
    }
90
}
91
85
my $op = $input->param('op') || 'delete_confirm';
92
my $op = $input->param('op') || 'delete_confirm';
86
my $dbh = C4::Context->dbh;
93
my $dbh = C4::Context->dbh;
87
my $is_guarantor = $dbh->selectrow_array("SELECT COUNT(*) FROM borrowers WHERE guarantorid=?", undef, $member);
94
my $is_guarantor = $dbh->selectrow_array("SELECT COUNT(*) FROM borrowers WHERE guarantorid=?", undef, $member);
(-)a/misc/cronjobs/delete_patrons.pl (-2 / +8 lines)
Lines 59-65 unless ($confirm) { Link Here
59
}
59
}
60
60
61
say scalar(@$members) . " patrons to delete";
61
say scalar(@$members) . " patrons to delete";
62
62
my $anonymous_patron = C4::Context->preference("AnonymousPatron"); 
63
my $deleted = 0;
63
my $deleted = 0;
64
for my $member (@$members) {
64
for my $member (@$members) {
65
    print "Trying to delete patron $member->{borrowernumber}... "
65
    print "Trying to delete patron $member->{borrowernumber}... "
Lines 76-81 for my $member (@$members) { Link Here
76
        next;
76
        next;
77
    }
77
    }
78
78
79
    if ( $anonymous_patron ) {
80
        if ( $patron->id eq $anonymous_patron ) {
81
            say "Failed to delete patron $borrowernumber: patron is AnonymousPatron";
82
            next;
83
        }
84
    }
85
79
    if ( $confirm ) {
86
    if ( $confirm ) {
80
        my $deleted = eval { $patron->move_to_deleted; };
87
        my $deleted = eval { $patron->move_to_deleted; };
81
        if ($@ or not $deleted) {
88
        if ($@ or not $deleted) {
82
- 

Return to bug 14708