Lines 3874-3888
sub CalcDateDue {
Link Here
|
3874 |
if ( $potential_datedue > $library_close and $todayhours->close_time and $tomorrowhours->open_time ) { |
3874 |
if ( $potential_datedue > $library_close and $todayhours->close_time and $tomorrowhours->open_time ) { |
3875 |
if ( $considerlibraryhours eq 'close' ) { |
3875 |
if ( $considerlibraryhours eq 'close' ) { |
3876 |
# datedue will be after the library closes on that day |
3876 |
# datedue will be after the library closes on that day |
3877 |
# shorten loan period to end when library closes |
3877 |
# shorten loan period to end when library closes by hardcoding due time |
3878 |
$dur = $potential_datedue->delta_ms( $library_close ); |
3878 |
$datedue->set( hour => $close[0], minute => $close[1] ); |
3879 |
$sethours = $considerlibraryhours; |
|
|
3880 |
} elsif ( $considerlibraryhours eq 'open' ) { |
3879 |
} elsif ( $considerlibraryhours eq 'open' ) { |
3881 |
# datedue will be after the library closes on that day |
3880 |
# datedue will be after the library closes on that day |
3882 |
# extend loan period to when library opens following day |
3881 |
# extend loan period to when library opens following day by hardcoding due time for next open day |
3883 |
my $library_open = $datedue->clone->set( hour => $open[0], minute => $open[1] ); |
3882 |
$dur = DateTime::Duration->new( days => 1 ); |
3884 |
$dur = $potential_datedue->delta_ms( $library_open )->add( days => 1 ); |
3883 |
$datedue->set( hour => $open[0], minute => $open[1] ); |
3885 |
$sethours = $considerlibraryhours; |
|
|
3886 |
} else { |
3884 |
} else { |
3887 |
# ignore library open hours |
3885 |
# ignore library open hours |
3888 |
$dur = DateTime::Duration->new( hours => $loanlength->{$length_key} ); |
3886 |
$dur = DateTime::Duration->new( hours => $loanlength->{$length_key} ); |
Lines 3896-3911
sub CalcDateDue {
Link Here
|
3896 |
$dur = DateTime::Duration->new( days => $loanlength->{$length_key} ); |
3894 |
$dur = DateTime::Duration->new( days => $loanlength->{$length_key} ); |
3897 |
} |
3895 |
} |
3898 |
my $calendar = Koha::Calendar->new( branchcode => $branch, days_mode => $daysmode ); |
3896 |
my $calendar = Koha::Calendar->new( branchcode => $branch, days_mode => $daysmode ); |
3899 |
$datedue = $calendar->addDuration( $datedue, $dur, $loanlength->{lengthunit} ); |
3897 |
$datedue = $calendar->addDuration( $datedue, $dur, $loanlength->{lengthunit} ) if $dur; |
3900 |
if ($loanlength->{lengthunit} eq 'days') { |
3898 |
if ($loanlength->{lengthunit} eq 'days') { |
3901 |
$datedue->set_hour(23); |
3899 |
$datedue->set_hour(23); |
3902 |
$datedue->set_minute(59); |
3900 |
$datedue->set_minute(59); |
3903 |
} else { |
|
|
3904 |
if ( $sethours and $sethours eq 'close' ) { |
3905 |
$datedue->set( hour => $close[0], minute => $close[1] ); |
3906 |
} elsif ( $sethours and $sethours eq 'open' ) { |
3907 |
$datedue->set( hour => $open[0], minute => $open[1] ); |
3908 |
} |
3909 |
} |
3901 |
} |
3910 |
} |
3902 |
} |
3911 |
|
3903 |
|
3912 |
- |
|
|