Lines 85-123
if ( $step == 2 ) {
Link Here
|
85 |
my $membersToDelete; |
85 |
my $membersToDelete; |
86 |
if ( $checkboxes{borrower} ) { |
86 |
if ( $checkboxes{borrower} ) { |
87 |
$membersToDelete = GetBorrowersToExpunge( |
87 |
$membersToDelete = GetBorrowersToExpunge( |
88 |
{ |
88 |
_get_selection_params($not_borrowered_since, $borrower_dateexpiry, $borrower_categorycode) |
89 |
( |
|
|
90 |
$not_borrowered_since |
91 |
? ( |
92 |
not_borrowered_since => output_pref( |
93 |
{ |
94 |
dt => $not_borrowered_since, |
95 |
dateformat => 'iso', |
96 |
dateonly => 1 |
97 |
} |
98 |
) |
99 |
) |
100 |
: () |
101 |
), |
102 |
( |
103 |
$borrower_dateexpiry |
104 |
? ( |
105 |
expired_before => output_pref( |
106 |
{ |
107 |
dt => $borrower_dateexpiry, |
108 |
dateformat => 'iso', |
109 |
dateonly => 1 |
110 |
} |
111 |
) |
112 |
) |
113 |
: () |
114 |
), |
115 |
( |
116 |
$borrower_categorycode |
117 |
? ( category_code => $borrower_categorycode ) |
118 |
: () |
119 |
), |
120 |
} |
121 |
); |
89 |
); |
122 |
_skip_borrowers_with_nonzero_balance( $membersToDelete ); |
90 |
_skip_borrowers_with_nonzero_balance( $membersToDelete ); |
123 |
$totalDel = scalar @$membersToDelete; |
91 |
$totalDel = scalar @$membersToDelete; |
Lines 147-180
elsif ( $step == 3 ) {
Link Here
|
147 |
# delete members |
115 |
# delete members |
148 |
if ($do_delete) { |
116 |
if ($do_delete) { |
149 |
my $membersToDelete = GetBorrowersToExpunge( |
117 |
my $membersToDelete = GetBorrowersToExpunge( |
150 |
{ |
118 |
_get_selection_params($not_borrowered_since, $borrower_dateexpiry, $borrower_categorycode) |
151 |
( |
|
|
152 |
$not_borrowered_since |
153 |
? ( |
154 |
not_borrowered_since => output_pref( |
155 |
{ |
156 |
dt => $not_borrowered_since, |
157 |
dateformat => 'iso' |
158 |
} |
159 |
) |
160 |
) |
161 |
: () |
162 |
), |
163 |
( |
164 |
$borrower_dateexpiry |
165 |
? ( |
166 |
expired_before => output_pref( |
167 |
{ dt => $borrower_dateexpiry, dateformat => 'iso' } |
168 |
) |
169 |
) |
170 |
: () |
171 |
), |
172 |
( |
173 |
$borrower_categorycode |
174 |
? ( category_code => $borrower_categorycode ) |
175 |
: () |
176 |
), |
177 |
} |
178 |
); |
119 |
); |
179 |
_skip_borrowers_with_nonzero_balance( $membersToDelete ); |
120 |
_skip_borrowers_with_nonzero_balance( $membersToDelete ); |
180 |
$totalDel = scalar(@$membersToDelete); |
121 |
$totalDel = scalar(@$membersToDelete); |
Lines 227-229
sub _skip_borrowers_with_nonzero_balance {
Link Here
|
227 |
($balance != 0) ? (): ($_); |
168 |
($balance != 0) ? (): ($_); |
228 |
} @$borrowers; |
169 |
} @$borrowers; |
229 |
} |
170 |
} |
230 |
- |
171 |
|
|
|
172 |
sub _get_selection_params { |
173 |
my ($not_borrowered_since, $borrower_dateexpiry, $borrower_categorycode) = @_; |
174 |
|
175 |
my $params = {}; |
176 |
$params->{not_borrowered_since} = output_pref({ |
177 |
dt => $not_borrowered_since, |
178 |
dateformat => 'iso', |
179 |
dateonly => 1 |
180 |
}) if $not_borrowered_since; |
181 |
$params->{expired_before} = output_pref({ |
182 |
dt => $borrower_dateexpiry, |
183 |
dateformat => 'iso', |
184 |
dateonly => 1 |
185 |
}) if $borrower_dateexpiry; |
186 |
$params->{borrower_categorycode} = $borrower_categorycode if $borrower_categorycode; |
187 |
|
188 |
return $params; |
189 |
}; |