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

(-)a/misc/cronjobs/delete_patrons.pl (-5 / +5 lines)
Lines 89-97 if (!defined $members and @file_members) { Link Here
89
unless ($confirm) {
89
unless ($confirm) {
90
    say "Doing a dry run; no patron records will actually be deleted.";
90
    say "Doing a dry run; no patron records will actually be deleted.";
91
    say "Run again with --confirm to delete the records.";
91
    say "Run again with --confirm to delete the records.";
92
    $verbose ||= 1;
92
}
93
}
93
94
94
say scalar(@$members) . " patrons to delete";
95
say scalar(@$members) . " patrons to delete" if $verbose;;
95
96
96
my $deleted = 0;
97
my $deleted = 0;
97
for my $member (@$members) {
98
for my $member (@$members) {
Lines 105-118 for my $member (@$members) { Link Here
105
        next;
106
        next;
106
    }
107
    }
107
    if ( my $charges = $patron->account->non_issues_charges ) { # And what if we owe to this patron?
108
    if ( my $charges = $patron->account->non_issues_charges ) { # And what if we owe to this patron?
108
        say "Failed to delete patron $borrowernumber: patron has $charges in fines";
109
        say "Failed to delete patron $borrowernumber: patron has $charges in fines" if $verbose;
109
        next;
110
        next;
110
    }
111
    }
111
112
112
    if ( $confirm ) {
113
    if ( $confirm ) {
113
        my $deleted = eval { $patron->move_to_deleted; };
114
        my $deleted = eval { $patron->move_to_deleted; };
114
        if ($@ or not $deleted) {
115
        if ($@ or not $deleted) {
115
            say "Failed to delete patron $borrowernumber, cannot move it" . ( $@ ? ": ($@)" : "" );
116
            say "Failed to delete patron $borrowernumber, cannot move it" . ( $@ ? ": ($@)" : "" ) if $verbose;
116
            next;
117
            next;
117
        }
118
        }
118
119
Lines 126-132 for my $member (@$members) { Link Here
126
    say "OK" if $verbose;
127
    say "OK" if $verbose;
127
}
128
}
128
129
129
say "$deleted patrons deleted";
130
say "$deleted patrons deleted" if $verbose;
130
131
131
=head1 NAME
132
=head1 NAME
132
133
133
- 

Return to bug 25157