Lines 84-99
if ( $step == 2 ) {
Link Here
|
84 |
|
84 |
|
85 |
my %checkboxes = map { $_ => 1 } split /\0/, $params->{'checkbox'}; |
85 |
my %checkboxes = map { $_ => 1 } split /\0/, $params->{'checkbox'}; |
86 |
|
86 |
|
87 |
my $membersToDelete; |
87 |
my $patrons_to_delete; |
88 |
if ($patron_list_id) { |
88 |
if ($patron_list_id) { |
89 |
my @patron_list_patrons = |
89 |
my @patron_list_patrons = |
90 |
Koha::Database->new()->schema()->resultset('PatronListPatron') |
90 |
Koha::Database->new()->schema()->resultset('PatronListPatron') |
91 |
->search( { patron_list_id => $patron_list_id } ); |
91 |
->search( { patron_list_id => $patron_list_id } ); |
92 |
$membersToDelete = \@patron_list_patrons; |
92 |
$patrons_to_delete = \@patron_list_patrons; |
93 |
} |
93 |
} |
94 |
else { |
94 |
else { |
95 |
if ( $checkboxes{borrower} ) { |
95 |
if ( $checkboxes{borrower} ) { |
96 |
$membersToDelete = GetBorrowersToExpunge( |
96 |
$patrons_to_delete = GetBorrowersToExpunge( |
97 |
_get_selection_params( |
97 |
_get_selection_params( |
98 |
$not_borrowered_since, |
98 |
$not_borrowered_since, |
99 |
$borrower_dateexpiry, |
99 |
$borrower_dateexpiry, |
Lines 102-117
if ( $step == 2 ) {
Link Here
|
102 |
); |
102 |
); |
103 |
} |
103 |
} |
104 |
} |
104 |
} |
105 |
_skip_borrowers_with_nonzero_balance($membersToDelete); |
105 |
_skip_borrowers_with_nonzero_balance($patrons_to_delete); |
106 |
|
106 |
|
107 |
my $membersToAnonymize; |
107 |
my $members_to_anonymize; |
108 |
if ( $checkboxes{issue} ) { |
108 |
if ( $checkboxes{issue} ) { |
109 |
$membersToAnonymize = GetBorrowersWithIssuesHistoryOlderThan($last_issue_date); |
109 |
$members_to_anonymize = GetBorrowersWithIssuesHistoryOlderThan($last_issue_date); |
110 |
} |
110 |
} |
111 |
|
111 |
|
112 |
$template->param( |
112 |
$template->param( |
113 |
memberstodelete_list => $membersToDelete, |
113 |
patrons_to_delete => $patrons_to_delete, |
114 |
memberstoanonymize_list => $membersToAnonymize, |
114 |
patrons_to_anonymize => $members_to_anonymize, |
115 |
patron_list_id => $patron_list_id, |
115 |
patron_list_id => $patron_list_id, |
116 |
); |
116 |
); |
117 |
} |
117 |
} |
Lines 124-152
elsif ( $step == 3 ) {
Link Here
|
124 |
|
124 |
|
125 |
# delete members |
125 |
# delete members |
126 |
if ($do_delete) { |
126 |
if ($do_delete) { |
127 |
my $membersToDelete; |
127 |
my $patrons_to_delete; |
128 |
if ($patron_list_id) { |
128 |
if ($patron_list_id) { |
129 |
my @patron_list_patrons = |
129 |
my @patron_list_patrons = |
130 |
Koha::Database->new()->schema()->resultset('PatronListPatron') |
130 |
Koha::Database->new()->schema()->resultset('PatronListPatron') |
131 |
->search( { patron_list_id => $patron_list_id } ); |
131 |
->search( { patron_list_id => $patron_list_id } ); |
132 |
$membersToDelete = \@patron_list_patrons; |
132 |
$patrons_to_delete = \@patron_list_patrons; |
133 |
} |
133 |
} |
134 |
else { |
134 |
else { |
135 |
$membersToDelete = GetBorrowersToExpunge( |
135 |
$patrons_to_delete = GetBorrowersToExpunge( |
136 |
_get_selection_params( |
136 |
_get_selection_params( |
137 |
$not_borrowered_since, $borrower_dateexpiry, |
137 |
$not_borrowered_since, $borrower_dateexpiry, |
138 |
$borrower_categorycode |
138 |
$borrower_categorycode |
139 |
) |
139 |
) |
140 |
); |
140 |
); |
141 |
} |
141 |
} |
142 |
_skip_borrowers_with_nonzero_balance($membersToDelete); |
142 |
_skip_borrowers_with_nonzero_balance($patrons_to_delete); |
143 |
|
143 |
|
144 |
$totalDel = scalar(@$membersToDelete); |
144 |
$totalDel = scalar(@$patrons_to_delete); |
145 |
$radio = $params->{'radio'}; |
145 |
$radio = $params->{'radio'}; |
146 |
for ( my $i = 0 ; $i < $totalDel ; $i++ ) { |
146 |
for ( my $i = 0 ; $i < $totalDel ; $i++ ) { |
147 |
$radio eq 'testrun' && last; |
147 |
$radio eq 'testrun' && last; |
148 |
my $borrowernumber = $membersToDelete->[$i]->{'borrowernumber'} |
148 |
my $borrowernumber = $patrons_to_delete->[$i]->{'borrowernumber'} |
149 |
|| $membersToDelete->[$i]->get_column('borrowernumber'); |
149 |
|| $patrons_to_delete->[$i]->get_column('borrowernumber'); |
150 |
$radio eq 'trash' && MoveMemberToDeleted($borrowernumber); |
150 |
$radio eq 'trash' && MoveMemberToDeleted($borrowernumber); |
151 |
C4::VirtualShelves::HandleDelBorrower($borrowernumber); |
151 |
C4::VirtualShelves::HandleDelBorrower($borrowernumber); |
152 |
DelMember($borrowernumber); |
152 |
DelMember($borrowernumber); |
153 |
- |
|
|