|
Lines 796-812
Cancels all reserves with an expiration date from before today.
Link Here
|
| 796 |
=cut |
796 |
=cut |
| 797 |
|
797 |
|
| 798 |
sub CancelExpiredReserves { |
798 |
sub CancelExpiredReserves { |
| 799 |
|
|
|
| 800 |
my $today = dt_from_string(); |
799 |
my $today = dt_from_string(); |
| 801 |
my $cancel_on_holidays = C4::Context->preference('ExpireReservesOnHolidays'); |
800 |
my $cancel_on_holidays = C4::Context->preference('ExpireReservesOnHolidays'); |
| 802 |
my $expireWaiting = C4::Context->preference('ExpireReservesMaxPickUpDelay'); |
801 |
my $expireWaiting = C4::Context->preference('ExpireReservesMaxPickUpDelay'); |
| 803 |
|
802 |
|
| 804 |
my $dbh = C4::Context->dbh; |
|
|
| 805 |
|
| 806 |
my $dtf = Koha::Database->new->schema->storage->datetime_parser; |
803 |
my $dtf = Koha::Database->new->schema->storage->datetime_parser; |
| 807 |
|
|
|
| 808 |
my $params = { expirationdate => { '<', $dtf->format_date($today) } }; |
804 |
my $params = { expirationdate => { '<', $dtf->format_date($today) } }; |
| 809 |
|
|
|
| 810 |
$params->{found} = undef unless $expireWaiting; |
805 |
$params->{found} = undef unless $expireWaiting; |
| 811 |
|
806 |
|
| 812 |
# FIXME To move to Koha::Holds->search_expired (?) |
807 |
# FIXME To move to Koha::Holds->search_expired (?) |
|
Lines 822-828
sub CancelExpiredReserves {
Link Here
|
| 822 |
$cancel_params->{charge_cancel_fee} = 1; |
817 |
$cancel_params->{charge_cancel_fee} = 1; |
| 823 |
} |
818 |
} |
| 824 |
$hold->cancel( $cancel_params ); |
819 |
$hold->cancel( $cancel_params ); |
| 825 |
|
|
|
| 826 |
} |
820 |
} |
| 827 |
} |
821 |
} |
| 828 |
|
822 |
|
| 829 |
- |
|
|