Lines 703-709
sub CanBookBeIssued {
Link Here
|
703 |
if ($duedate && ref $duedate ne 'DateTime') { |
703 |
if ($duedate && ref $duedate ne 'DateTime') { |
704 |
$duedate = dt_from_string($duedate); |
704 |
$duedate = dt_from_string($duedate); |
705 |
} |
705 |
} |
706 |
my $now = DateTime->now( time_zone => C4::Context->tz() ); |
706 |
my $now = dt_from_string(); |
707 |
unless ( $duedate ) { |
707 |
unless ( $duedate ) { |
708 |
my $issuedate = $now->clone(); |
708 |
my $issuedate = $now->clone(); |
709 |
|
709 |
|
Lines 1234-1240
sub checkHighHolds {
Link Here
|
1234 |
} |
1234 |
} |
1235 |
} |
1235 |
} |
1236 |
|
1236 |
|
1237 |
my $issuedate = DateTime->now( time_zone => C4::Context->tz() ); |
1237 |
my $issuedate = dt_from_string(); |
1238 |
|
1238 |
|
1239 |
my $calendar = Koha::Calendar->new( branchcode => $branchcode ); |
1239 |
my $calendar = Koha::Calendar->new( branchcode => $branchcode ); |
1240 |
|
1240 |
|
Lines 1313-1319
sub AddIssue {
Link Here
|
1313 |
|
1313 |
|
1314 |
# $issuedate defaults to today. |
1314 |
# $issuedate defaults to today. |
1315 |
if ( !defined $issuedate ) { |
1315 |
if ( !defined $issuedate ) { |
1316 |
$issuedate = DateTime->now( time_zone => C4::Context->tz() ); |
1316 |
$issuedate = dt_from_string(); |
1317 |
} |
1317 |
} |
1318 |
else { |
1318 |
else { |
1319 |
if ( ref $issuedate ne 'DateTime' ) { |
1319 |
if ( ref $issuedate ne 'DateTime' ) { |
Lines 1463-1469
sub AddIssue {
Link Here
|
1463 |
holdingbranch => C4::Context->userenv->{'branch'}, |
1463 |
holdingbranch => C4::Context->userenv->{'branch'}, |
1464 |
itemlost => 0, |
1464 |
itemlost => 0, |
1465 |
onloan => $datedue->ymd(), |
1465 |
onloan => $datedue->ymd(), |
1466 |
datelastborrowed => DateTime->now( time_zone => C4::Context->tz() )->ymd(), |
1466 |
datelastborrowed => dt_from_string(), |
1467 |
}, |
1467 |
}, |
1468 |
$item_object->biblionumber, |
1468 |
$item_object->biblionumber, |
1469 |
$item_object->itemnumber, |
1469 |
$item_object->itemnumber, |
Lines 2766-2772
sub CanBookBeRenewed {
Link Here
|
2766 |
$soonestrenewal->truncate( to => 'day' ); |
2766 |
$soonestrenewal->truncate( to => 'day' ); |
2767 |
} |
2767 |
} |
2768 |
|
2768 |
|
2769 |
if ( $soonestrenewal > DateTime->now( time_zone => C4::Context->tz() ) ) |
2769 |
if ( $soonestrenewal > dt_from_string() ) |
2770 |
{ |
2770 |
{ |
2771 |
return ( 0, "auto_too_soon" ) if $issue->auto_renew; |
2771 |
return ( 0, "auto_too_soon" ) if $issue->auto_renew; |
2772 |
return ( 0, "too_soon" ); |
2772 |
return ( 0, "too_soon" ); |
Lines 2888-2894
sub AddRenewal {
Link Here
|
2888 |
my $itemnumber = shift or return; |
2888 |
my $itemnumber = shift or return; |
2889 |
my $branch = shift; |
2889 |
my $branch = shift; |
2890 |
my $datedue = shift; |
2890 |
my $datedue = shift; |
2891 |
my $lastreneweddate = shift || DateTime->now(time_zone => C4::Context->tz); |
2891 |
my $lastreneweddate = shift || dt_from_string(); |
2892 |
|
2892 |
|
2893 |
my $item_object = Koha::Items->find($itemnumber) or return; |
2893 |
my $item_object = Koha::Items->find($itemnumber) or return; |
2894 |
my $biblio = $item_object->biblio; |
2894 |
my $biblio = $item_object->biblio; |
Lines 2927-2933
sub AddRenewal {
Link Here
|
2927 |
|
2927 |
|
2928 |
$datedue = (C4::Context->preference('RenewalPeriodBase') eq 'date_due') ? |
2928 |
$datedue = (C4::Context->preference('RenewalPeriodBase') eq 'date_due') ? |
2929 |
dt_from_string( $issue->date_due, 'sql' ) : |
2929 |
dt_from_string( $issue->date_due, 'sql' ) : |
2930 |
DateTime->now( time_zone => C4::Context->tz()); |
2930 |
dt_from_string(); |
2931 |
$datedue = CalcDateDue($datedue, $itemtype, $circ_library->branchcode, $patron_unblessed, 'is a renewal'); |
2931 |
$datedue = CalcDateDue($datedue, $itemtype, $circ_library->branchcode, $patron_unblessed, 'is a renewal'); |
2932 |
} |
2932 |
} |
2933 |
|
2933 |
|
Lines 3556-3564
sub CalcDateDue {
Link Here
|
3556 |
$datedue = $startdate->clone; |
3556 |
$datedue = $startdate->clone; |
3557 |
} |
3557 |
} |
3558 |
} else { |
3558 |
} else { |
3559 |
$datedue = |
3559 |
$datedue = dt_from_string()->truncate( to => 'minute' ); |
3560 |
DateTime->now( time_zone => C4::Context->tz() ) |
|
|
3561 |
->truncate( to => 'minute' ); |
3562 |
} |
3560 |
} |
3563 |
|
3561 |
|
3564 |
|
3562 |
|
Lines 4035-4041
sub GetAgeRestriction {
Link Here
|
4035 |
} |
4033 |
} |
4036 |
|
4034 |
|
4037 |
#Get how many days the borrower has to reach the age restriction |
4035 |
#Get how many days the borrower has to reach the age restriction |
4038 |
my @Today = split /-/, DateTime->today->ymd(); |
4036 |
my @Today = split /-/, dt_from_string()->ymd(); |
4039 |
my $daysToAgeRestriction = Date_to_Days(@alloweddate) - Date_to_Days(@Today); |
4037 |
my $daysToAgeRestriction = Date_to_Days(@alloweddate) - Date_to_Days(@Today); |
4040 |
#Negative days means the borrower went past the age restriction age |
4038 |
#Negative days means the borrower went past the age restriction age |
4041 |
return ($restriction_year, $daysToAgeRestriction); |
4039 |
return ($restriction_year, $daysToAgeRestriction); |