Bug 16201 - Tie automatic cancellation of expired non-waiting holds to a system preference
Summary: Tie automatic cancellation of expired non-waiting holds to a system preference
Status: NEW
Alias: None
Product: Koha
Classification: Unclassified
Component: Hold requests (show other bugs)
Version: Main
Hardware: All All
: P5 - low enhancement
Assignee: Bugs List
QA Contact: Testopia
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2016-04-05 09:50 UTC by Katrin Fischer
Modified: 2024-07-09 08:08 UTC (History)
2 users (show)

See Also:
Change sponsored?: ---
Patch complexity: ---
Documentation contact:
Documentation submission:
Text to go in the release notes:
Version(s) released in:
Circulation function:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Katrin Fischer 2016-04-05 09:50:00 UTC
Currently, if you run multiple instances on a server, you can not easily configure for some, but not others, that holds not picked up will automatically cancelled. 

The cronjob used is:
misc/cronjobs/holds/cancel_expired_holds.pl

If it's scheduled, the feature is active for all instances - or you'd have to maintain a list, change the default cron files etc.

It would be nice if this feature was tied to a new system preference, so that you can easily activate/deactivate it from within Koha and without accessing the server.

This might also be useful for libraries that want to wait a little longer with cancelling in some cases, for example after a holiday period or when the library has been closed for a while.
Comment 1 Katrin Fischer 2023-09-09 19:12:57 UTC
This would still be nice to have :)
Comment 2 Lisette Scheer 2024-07-08 19:22:22 UTC
Doesn't  ExpireReservesMaxPickUpDelay do this? Or does that not matter if the cron is running?
Comment 3 Katrin Fischer 2024-07-09 08:08:44 UTC
Hi Lisette, thanks for looking into this! 

I had to dig a little deeper to figure out what I was thinking about here in 2016:

The ExpireReservesMaxPickUpDelay seems to only be used for waiting holds, but it will still expire other "expired" holds that are not waiting yet, if I read the code correctly.


sub CancelExpiredReserves {
    my $cancellation_reason = shift;
    my $today = dt_from_string();
    my $cancel_on_holidays = C4::Context->preference('ExpireReservesOnHolidays');
    my $expireWaiting = C4::Context->preference('ExpireReservesMaxPickUpDelay');

    my $dtf = Koha::Database->new->schema->storage->datetime_parser;
    my $params = {
        -or => [
            { expirationdate => { '<', $dtf->format_date($today) } },
            { patron_expiration_date => { '<' => $dtf->format_date($today) } }
        ]
    };

    $params->{found} = [ { '!=', 'W' }, undef ]  unless $expireWaiting;