Bug 24159: Use days_mode circ rule to calculate the dropbox date

Calculate the drop box date depending on the circ rule. Note that only
the branchcode is taken into account here. Is that correct?

Test plan:
Use the drop box date feature and confirm that it takes into account the
calendar, depending on the circ rule.

Signed-off-by: Simon Perry <simon.perry@itcarlow.ie>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
This commit is contained in:
Jonathan Druart 2020-03-12 08:46:59 +01:00
parent 71e235751f
commit c6bf011e37
1 changed files with 9 additions and 2 deletions

View File

@ -48,8 +48,15 @@ sub calculate_dropbox_date {
my $userenv = C4::Context->userenv;
my $branchcode = $userenv->{branch} // q{};
my $calendar = Koha::Calendar->new( branchcode => $branchcode );
my $today = dt_from_string();
my $useDaysMode_value = Koha::CirculationRules->get_useDaysMode_effective_value(
{
categorycode => undef,
itemtype => undef,
branchcode => $branchcode,
}
);
my $calendar = Koha::Calendar->new( branchcode => $branchcode, days_mode => $useDaysMode_value );
my $today = dt_from_string;
my $dropbox_date = $calendar->addDate( $today, -1 );
return $dropbox_date;