Lines 705-711
sub CanBookBeIssued {
Link Here
|
705 |
if ($duedate && ref $duedate ne 'DateTime') { |
705 |
if ($duedate && ref $duedate ne 'DateTime') { |
706 |
$duedate = dt_from_string($duedate); |
706 |
$duedate = dt_from_string($duedate); |
707 |
} |
707 |
} |
708 |
my $now = DateTime->now( time_zone => C4::Context->tz() ); |
708 |
my $now = dt_from_string(); |
709 |
unless ( $duedate ) { |
709 |
unless ( $duedate ) { |
710 |
my $issuedate = $now->clone(); |
710 |
my $issuedate = $now->clone(); |
711 |
|
711 |
|
Lines 1236-1242
sub checkHighHolds {
Link Here
|
1236 |
} |
1236 |
} |
1237 |
} |
1237 |
} |
1238 |
|
1238 |
|
1239 |
my $issuedate = DateTime->now( time_zone => C4::Context->tz() ); |
1239 |
my $issuedate = dt_from_string(); |
1240 |
|
1240 |
|
1241 |
my $calendar = Koha::Calendar->new( branchcode => $branchcode ); |
1241 |
my $calendar = Koha::Calendar->new( branchcode => $branchcode ); |
1242 |
|
1242 |
|
Lines 1315-1321
sub AddIssue {
Link Here
|
1315 |
|
1315 |
|
1316 |
# $issuedate defaults to today. |
1316 |
# $issuedate defaults to today. |
1317 |
if ( !defined $issuedate ) { |
1317 |
if ( !defined $issuedate ) { |
1318 |
$issuedate = DateTime->now( time_zone => C4::Context->tz() ); |
1318 |
$issuedate = dt_from_string(); |
1319 |
} |
1319 |
} |
1320 |
else { |
1320 |
else { |
1321 |
if ( ref $issuedate ne 'DateTime' ) { |
1321 |
if ( ref $issuedate ne 'DateTime' ) { |
Lines 1466-1472
sub AddIssue {
Link Here
|
1466 |
$item_object->holdingbranch(C4::Context->userenv->{'branch'}); |
1466 |
$item_object->holdingbranch(C4::Context->userenv->{'branch'}); |
1467 |
$item_object->itemlost(0); |
1467 |
$item_object->itemlost(0); |
1468 |
$item_object->onloan($datedue->ymd()); |
1468 |
$item_object->onloan($datedue->ymd()); |
1469 |
$item_object->datelastborrowed(DateTime->now( time_zone => C4::Context->tz() )->ymd()); # FIXME we should use dt_from_string here |
1469 |
$item_object->datelastborrowed( dt_from_string()->ymd() ); |
1470 |
$item_object->store({log_action => 0}); |
1470 |
$item_object->store({log_action => 0}); |
1471 |
ModDateLastSeen( $item_object->itemnumber ); |
1471 |
ModDateLastSeen( $item_object->itemnumber ); |
1472 |
|
1472 |
|
Lines 2805-2811
sub CanBookBeRenewed {
Link Here
|
2805 |
$soonestrenewal->truncate( to => 'day' ); |
2805 |
$soonestrenewal->truncate( to => 'day' ); |
2806 |
} |
2806 |
} |
2807 |
|
2807 |
|
2808 |
if ( $soonestrenewal > DateTime->now( time_zone => C4::Context->tz() ) ) |
2808 |
if ( $soonestrenewal > dt_from_string() ) |
2809 |
{ |
2809 |
{ |
2810 |
return ( 0, "auto_too_soon" ) if $issue->auto_renew && $patron->autorenew_checkouts; |
2810 |
return ( 0, "auto_too_soon" ) if $issue->auto_renew && $patron->autorenew_checkouts; |
2811 |
return ( 0, "too_soon" ); |
2811 |
return ( 0, "too_soon" ); |
Lines 2932-2938
sub AddRenewal {
Link Here
|
2932 |
my $itemnumber = shift or return; |
2932 |
my $itemnumber = shift or return; |
2933 |
my $branch = shift; |
2933 |
my $branch = shift; |
2934 |
my $datedue = shift; |
2934 |
my $datedue = shift; |
2935 |
my $lastreneweddate = shift || DateTime->now(time_zone => C4::Context->tz); |
2935 |
my $lastreneweddate = shift || dt_from_string(); |
2936 |
my $skipfinecalc = shift; |
2936 |
my $skipfinecalc = shift; |
2937 |
|
2937 |
|
2938 |
my $item_object = Koha::Items->find($itemnumber) or return; |
2938 |
my $item_object = Koha::Items->find($itemnumber) or return; |
Lines 2972-2978
sub AddRenewal {
Link Here
|
2972 |
|
2972 |
|
2973 |
$datedue = (C4::Context->preference('RenewalPeriodBase') eq 'date_due') ? |
2973 |
$datedue = (C4::Context->preference('RenewalPeriodBase') eq 'date_due') ? |
2974 |
dt_from_string( $issue->date_due, 'sql' ) : |
2974 |
dt_from_string( $issue->date_due, 'sql' ) : |
2975 |
DateTime->now( time_zone => C4::Context->tz()); |
2975 |
dt_from_string(); |
2976 |
$datedue = CalcDateDue($datedue, $itemtype, $circ_library->branchcode, $patron_unblessed, 'is a renewal'); |
2976 |
$datedue = CalcDateDue($datedue, $itemtype, $circ_library->branchcode, $patron_unblessed, 'is a renewal'); |
2977 |
} |
2977 |
} |
2978 |
|
2978 |
|
Lines 3595-3603
sub CalcDateDue {
Link Here
|
3595 |
$datedue = $startdate->clone; |
3595 |
$datedue = $startdate->clone; |
3596 |
} |
3596 |
} |
3597 |
} else { |
3597 |
} else { |
3598 |
$datedue = |
3598 |
$datedue = dt_from_string()->truncate( to => 'minute' ); |
3599 |
DateTime->now( time_zone => C4::Context->tz() ) |
|
|
3600 |
->truncate( to => 'minute' ); |
3601 |
} |
3599 |
} |
3602 |
|
3600 |
|
3603 |
|
3601 |
|
Lines 4081-4087
sub GetAgeRestriction {
Link Here
|
4081 |
} |
4079 |
} |
4082 |
|
4080 |
|
4083 |
#Get how many days the borrower has to reach the age restriction |
4081 |
#Get how many days the borrower has to reach the age restriction |
4084 |
my @Today = split /-/, DateTime->today->ymd(); |
4082 |
my @Today = split /-/, dt_from_string()->ymd(); |
4085 |
my $daysToAgeRestriction = Date_to_Days(@alloweddate) - Date_to_Days(@Today); |
4083 |
my $daysToAgeRestriction = Date_to_Days(@alloweddate) - Date_to_Days(@Today); |
4086 |
#Negative days means the borrower went past the age restriction age |
4084 |
#Negative days means the borrower went past the age restriction age |
4087 |
return ($restriction_year, $daysToAgeRestriction); |
4085 |
return ($restriction_year, $daysToAgeRestriction); |