Lines 1161-1166
sub AddIssue {
Link Here
|
1161 |
my $barcodecheck=CheckValidBarcode($barcode); |
1161 |
my $barcodecheck=CheckValidBarcode($barcode); |
1162 |
if ($datedue && ref $datedue ne 'DateTime') { |
1162 |
if ($datedue && ref $datedue ne 'DateTime') { |
1163 |
$datedue = dt_from_string($datedue); |
1163 |
$datedue = dt_from_string($datedue); |
|
|
1164 |
if ( C4::Context->preference('useDaysMode') eq 'Datedue' ) { |
1165 |
# use the calendar to push the due date to the next open day |
1166 |
$datedue = $calendar->next_open_day($datedue); |
1167 |
} |
1164 |
} |
1168 |
} |
1165 |
# $issuedate defaults to today. |
1169 |
# $issuedate defaults to today. |
1166 |
if ( ! defined $issuedate ) { |
1170 |
if ( ! defined $issuedate ) { |
Lines 3004-3025
sub CalcDateDue {
Link Here
|
3004 |
C4::Context->preference('dateformat') |
3008 |
C4::Context->preference('dateformat') |
3005 |
); |
3009 |
); |
3006 |
} else { |
3010 |
} else { |
3007 |
|
|
|
3008 |
# otherwise, calculate the datedue as normal |
3011 |
# otherwise, calculate the datedue as normal |
3009 |
if ( C4::Context->preference('useDaysMode') eq 'Days' ) |
3012 |
my $calendar = Koha::Calendar->new( branchcode => $branch ); |
3010 |
{ # ignoring calendar |
3013 |
|
|
|
3014 |
if ( C4::Context->preference('useDaysMode') ne 'Calendar' ) |
3015 |
{ # ignoring calendar to calculate date due |
3011 |
my $dt = |
3016 |
my $dt = |
3012 |
DateTime->now( time_zone => C4::Context->tz() ) |
3017 |
DateTime->now( time_zone => C4::Context->tz() ) |
3013 |
->truncate( to => 'minute' ); |
3018 |
->truncate( to => 'minute' ); |
3014 |
if ( $loanlength->{lengthunit} eq 'hours' ) { |
3019 |
if ( $loanlength->{lengthunit} eq 'hours' ) { |
3015 |
$dt->add( hours => $loanlength->{issuelength} ); |
3020 |
$dt->add( hours => $loanlength->{issuelength} ); |
3016 |
return $dt; |
|
|
3017 |
} else { # days |
3021 |
} else { # days |
3018 |
$dt->add( days => $loanlength->{issuelength} ); |
3022 |
$dt->add( days => $loanlength->{issuelength} ); |
3019 |
$dt->set_hour(23); |
3023 |
$dt->set_hour(23); |
3020 |
$dt->set_minute(59); |
3024 |
$dt->set_minute(59); |
3021 |
return $dt; |
|
|
3022 |
} |
3025 |
} |
|
|
3026 |
|
3027 |
if ( C4::Context->preference('useDaysMode') eq 'Datedue' ) { |
3028 |
# use the calendar to push the due date to the next open day |
3029 |
$dt = $calendar->next_open_day($dt); |
3030 |
} |
3031 |
|
3032 |
return $dt; |
3033 |
|
3023 |
} else { |
3034 |
} else { |
3024 |
my $dur; |
3035 |
my $dur; |
3025 |
if ($loanlength->{lengthunit} eq 'hours') { |
3036 |
if ($loanlength->{lengthunit} eq 'hours') { |
Lines 3031-3037
sub CalcDateDue {
Link Here
|
3031 |
if (ref $startdate ne 'DateTime' ) { |
3042 |
if (ref $startdate ne 'DateTime' ) { |
3032 |
$startdate = dt_from_string($startdate); |
3043 |
$startdate = dt_from_string($startdate); |
3033 |
} |
3044 |
} |
3034 |
my $calendar = Koha::Calendar->new( branchcode => $branch ); |
|
|
3035 |
$datedue = $calendar->addDate( $startdate, $dur, $loanlength->{lengthunit} ); |
3045 |
$datedue = $calendar->addDate( $startdate, $dur, $loanlength->{lengthunit} ); |
3036 |
if ($loanlength->{lengthunit} eq 'days') { |
3046 |
if ($loanlength->{lengthunit} eq 'days') { |
3037 |
$datedue->set_hour(23); |
3047 |
$datedue->set_hour(23); |