Bug 31235 - UseDaysMode is used for calculating the expiration date for waiting holds
Summary: UseDaysMode is used for calculating the expiration date for waiting holds
Status: NEW
Alias: None
Product: Koha
Classification: Unclassified
Component: Circulation (show other bugs)
Version: Main
Hardware: All All
: P5 - low minor
Assignee: Bugs List
QA Contact: Testopia
URL:
Keywords:
Depends on: 24159
Blocks:
  Show dependency treegraph
 
Reported: 2022-07-25 09:50 UTC by Katrin Fischer
Modified: 2022-11-17 12:39 UTC (History)
3 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 2022-07-25 09:50:45 UTC
This is also a confusing one: The UseDaysMode system preference, that can also be set in the circulation rules is described as:

... when calculating the date due. 

BUT: In set_waiting it's also used to calculate the expiration date for holds:

    my $max_pickup_delay = C4::Context->preference("ReservesMaxPickUpDelay");
    my $cancel_on_holidays = C4::Context->preference('ExpireReservesOnHolidays');

    my $expirationdate = $today->clone;
    $expirationdate->add(days => $max_pickup_delay);

    if ( C4::Context->preference("ExcludeHolidaysFromMaxPickUpDelay") ) {
        my $itemtype = $self->item ? $self->item->effective_itemtype : $self->biblio->itemtype;
        my $daysmode = Koha::CirculationRules->get_effective_daysmode(
            {
                categorycode => $self->borrower->categorycode,
                itemtype     => $itemtype,
                branchcode   => $self->branchcode,
            }
        );
        my $calendar = Koha::Calendar->new( branchcode => $self->branchcode, days_mode => $daysmode );

        $expirationdate = $calendar->days_forward( dt_from_string(), $max_pickup_delay );
    }

I feel like this is quite odd as you can set ExcludeHolidaysFromMaxPickUpDelay to ignore the calendar (and then it will be ignored). 

But if you set it to use the calendar, it can still be ignored when the UseDaysMode setting is set to ignore calendar. So it should probably be:

Ignore the calendar | Use UseDaysMode setting ...

If asked previously, I'd have said don't make this rely on UseDaysMode and just use calendar or not.
Comment 1 Katrin Fischer 2022-07-25 09:55:51 UTC
... and the UseDaysMode description should be amended to include the hold expiration date and a link to ExcludeHolidaysFromMaxPickupDelay.
Comment 2 Jonathan Druart 2022-08-01 14:45:54 UTC
Koha::Calendar need a days_mode to be instantiated correctly.

> and just use calendar or not.
What does it mean? That we need the different days_mode option for ExcludeHolidaysFromMaxPickUpDelay?
Comment 3 Katrin Fischer 2022-11-17 12:39:00 UTC
(In reply to Jonathan Druart from comment #2)
> Koha::Calendar need a days_mode to be instantiated correctly.
> 
> > and just use calendar or not.
> What does it mean? That we need the different days_mode option for
> ExcludeHolidaysFromMaxPickUpDelay?

I guess that would be the only solution if you want to make them behave differently... but for now it might be easiest to mention it in the UseDaysMode system preference for documentation.