Lines 191-197
GetOptions(
Link Here
|
191 |
|
191 |
|
192 |
pod2usage( -verbose => 2 ) if $man; |
192 |
pod2usage( -verbose => 2 ) if $man; |
193 |
pod2usage(1) if $help || !$confirm; |
193 |
pod2usage(1) if $help || !$confirm; |
194 |
if( defined($active) && defined($inactive) ) { |
194 |
if ( defined($active) && defined($inactive) ) { |
195 |
print "Sorry, it is not possible to pass both -active as well as -inactive.\n"; |
195 |
print "Sorry, it is not possible to pass both -active as well as -inactive.\n"; |
196 |
exit; |
196 |
exit; |
197 |
} |
197 |
} |
Lines 223-236
warn 'found ' . $upcoming_mem_expires->count . ' soon expiring members'
Link Here
|
223 |
|
223 |
|
224 |
# main loop |
224 |
# main loop |
225 |
$letter_type = 'MEMBERSHIP_EXPIRY' if !$letter_type; |
225 |
$letter_type = 'MEMBERSHIP_EXPIRY' if !$letter_type; |
226 |
my ( $count_active, $count_inactive, $count_enqueued ) = ( 0, 0, 0 ); |
226 |
my ( $count_skipped, $count_enqueued ) = ( 0, 0 ); |
227 |
while ( my $recent = $upcoming_mem_expires->next ) { |
227 |
while ( my $recent = $upcoming_mem_expires->next ) { |
228 |
my $patron_active = $recent->is_active({ months => $active // $inactive }); # checked already that only one is defined |
228 |
if ( $active && !$recent->is_active( { months => $active } ) ) { |
229 |
if( defined($active) && !$patron_active ) { |
229 |
$count_skipped++; |
230 |
$count_inactive++; |
|
|
231 |
next; |
230 |
next; |
232 |
} elsif( defined($inactive) && $patron_active ) { |
231 |
} elsif ( $inactive && $recent->is_active( { months => $inactive } ) ) { |
233 |
$count_active++; |
232 |
$count_skipped++; |
234 |
next; |
233 |
next; |
235 |
} |
234 |
} |
236 |
my $from_address = $recent->library->from_email_address; |
235 |
my $from_address = $recent->library->from_email_address; |
Lines 280-289
while ( my $recent = $upcoming_mem_expires->next ) {
Link Here
|
280 |
} |
279 |
} |
281 |
} |
280 |
} |
282 |
|
281 |
|
283 |
if( $verbose ) { |
282 |
if ($verbose) { |
284 |
print "Enqueued notices for $count_enqueued patrons\n"; |
283 |
print "Enqueued notices for $count_enqueued patrons\n"; |
285 |
print "Skipped $count_active active patrons\n" if $count_active; |
284 |
print "Skipped $count_skipped inactive patrons\n" if $active; |
286 |
print "Skipped $count_inactive inactive patrons\n" if $count_inactive; |
285 |
print "Skipped $count_skipped active patrons\n" if $inactive; |
287 |
} |
286 |
} |
288 |
|
287 |
|
289 |
cronlogaction({ action => 'End', info => "COMPLETED" }); |
288 |
cronlogaction({ action => 'End', info => "COMPLETED" }); |
290 |
- |
|
|