Lines 143-148
Default items.content lists only those items that fall in the
Link Here
|
143 |
range of the currently processing notice. |
143 |
range of the currently processing notice. |
144 |
Choose list-all to include all overdue items in the list (limited by B<-max> setting). |
144 |
Choose list-all to include all overdue items in the list (limited by B<-max> setting). |
145 |
|
145 |
|
|
|
146 |
=item B<-date> |
147 |
|
148 |
use it in order to send overdues on a specific date and not Now. |
149 |
|
146 |
=back |
150 |
=back |
147 |
|
151 |
|
148 |
=head1 DESCRIPTION |
152 |
=head1 DESCRIPTION |
Lines 259-264
my $listall = 0;
Link Here
|
259 |
my $itemscontent = join( ',', qw( date_due title barcode author itemnumber ) ); |
263 |
my $itemscontent = join( ',', qw( date_due title barcode author itemnumber ) ); |
260 |
my @myborcat; |
264 |
my @myborcat; |
261 |
my @myborcatout; |
265 |
my @myborcatout; |
|
|
266 |
my $date; |
262 |
|
267 |
|
263 |
GetOptions( |
268 |
GetOptions( |
264 |
'help|?' => \$help, |
269 |
'help|?' => \$help, |
Lines 268-279
GetOptions(
Link Here
|
268 |
'max=s' => \$MAX, |
273 |
'max=s' => \$MAX, |
269 |
'library=s' => \@branchcodes, |
274 |
'library=s' => \@branchcodes, |
270 |
'csv:s' => \$csvfilename, # this optional argument gets '' if not supplied. |
275 |
'csv:s' => \$csvfilename, # this optional argument gets '' if not supplied. |
271 |
'html:s' => \$htmlfilename, # this optional argument gets '' if not supplied. |
276 |
'html:s' => \$htmlfilename, # this optional argument gets '' if not supplied. |
272 |
'itemscontent=s' => \$itemscontent, |
277 |
'itemscontent=s' => \$itemscontent, |
273 |
'list-all' => \$listall, |
278 |
'list-all' => \$listall, |
274 |
't|triggered' => \$triggered, |
279 |
't|triggered' => \$triggered, |
275 |
'borcat=s' => \@myborcat, |
280 |
'date' => \$date, |
276 |
'borcatout=s' => \@myborcatout, |
281 |
'borcat=s' => \@myborcat, |
|
|
282 |
'borcatout=s' => \@myborcatout, |
277 |
) or pod2usage(2); |
283 |
) or pod2usage(2); |
278 |
pod2usage(1) if $help; |
284 |
pod2usage(1) if $help; |
279 |
pod2usage( -verbose => 2 ) if $man; |
285 |
pod2usage( -verbose => 2 ) if $man; |
Lines 320-325
if (@branchcodes) {
Link Here
|
320 |
} |
326 |
} |
321 |
} |
327 |
} |
322 |
|
328 |
|
|
|
329 |
if ($date){ |
330 |
$date=$dbh->quote($date); |
331 |
} |
332 |
else { |
333 |
$date="NOW()"; |
334 |
} |
335 |
|
323 |
# these are the fields that will be substituted into <<item.content>> |
336 |
# these are the fields that will be substituted into <<item.content>> |
324 |
my @item_content_fields = split( /,/, $itemscontent ); |
337 |
my @item_content_fields = split( /,/, $itemscontent ); |
325 |
|
338 |
|
Lines 376-388
foreach my $branchcode (@branches) {
Link Here
|
376 |
$verbose and warn sprintf "branchcode : '%s' using %s\n", $branchcode, $admin_email_address; |
389 |
$verbose and warn sprintf "branchcode : '%s' using %s\n", $branchcode, $admin_email_address; |
377 |
|
390 |
|
378 |
my $sth2 = $dbh->prepare( <<'END_SQL' ); |
391 |
my $sth2 = $dbh->prepare( <<'END_SQL' ); |
379 |
SELECT biblio.*, items.*, issues.*, biblioitems.itemtype, TO_DAYS(NOW())-TO_DAYS(date_due) AS days_overdue |
392 |
SELECT biblio.*, items.*, issues.*, biblioitems.itemtype, TO_DAYS($date)-TO_DAYS(date_due) AS days_overdue |
380 |
FROM issues,items,biblio, biblioitems |
393 |
FROM issues,items,biblio, biblioitems |
381 |
WHERE items.itemnumber=issues.itemnumber |
394 |
WHERE items.itemnumber=issues.itemnumber |
382 |
AND biblio.biblionumber = items.biblionumber |
395 |
AND biblio.biblionumber = items.biblionumber |
383 |
AND biblio.biblionumber = biblioitems.biblionumber |
396 |
AND biblio.biblionumber = biblioitems.biblionumber |
384 |
AND issues.borrowernumber = ? |
397 |
AND issues.borrowernumber = ? |
385 |
AND TO_DAYS(NOW())-TO_DAYS(date_due) BETWEEN ? and ? |
398 |
AND TO_DAYS($date)-TO_DAYS(date_due) BETWEEN ? and ? |
386 |
END_SQL |
399 |
END_SQL |
387 |
|
400 |
|
388 |
my $query = "SELECT * FROM overduerules WHERE delay1 IS NOT NULL AND branchcode = ? "; |
401 |
my $query = "SELECT * FROM overduerules WHERE delay1 IS NOT NULL AND branchcode = ? "; |
Lines 442-451
END_SQL
Link Here
|
442 |
} |
455 |
} |
443 |
$borrower_sql .= ' AND categories.overduenoticerequired=1 '; |
456 |
$borrower_sql .= ' AND categories.overduenoticerequired=1 '; |
444 |
if($triggered) { |
457 |
if($triggered) { |
445 |
$borrower_sql .= ' AND TO_DAYS(NOW())-TO_DAYS(date_due) = ?'; |
458 |
$borrower_sql .= ' AND TO_DAYS($date)-TO_DAYS(date_due) = ?'; |
446 |
push @borrower_parameters, $mindays; |
459 |
push @borrower_parameters, $mindays; |
447 |
} else { |
460 |
} else { |
448 |
$borrower_sql .= ' AND TO_DAYS(NOW())-TO_DAYS(date_due) BETWEEN ? and ? ' ; |
461 |
$borrower_sql .= ' AND TO_DAYS($date)-TO_DAYS(date_due) BETWEEN ? and ? ' ; |
449 |
push @borrower_parameters, $mindays, $maxdays; |
462 |
push @borrower_parameters, $mindays, $maxdays; |
450 |
} |
463 |
} |
451 |
|
464 |
|
452 |
- |
|
|