Lines 24-30
use POSIX qw( floor );
Link Here
|
24 |
use YAML::XS; |
24 |
use YAML::XS; |
25 |
use Encode; |
25 |
use Encode; |
26 |
|
26 |
|
27 |
use Koha::DateUtils qw( dt_from_string output_pref ); |
|
|
28 |
use C4::Context; |
27 |
use C4::Context; |
29 |
use C4::Stats qw( UpdateStats ); |
28 |
use C4::Stats qw( UpdateStats ); |
30 |
use C4::Reserves qw( CheckReserves CanItemBeReserved MoveReserve ModReserve ModReserveMinusPriority RevertWaitingStatus IsItemOnHoldAndFound IsAvailableForItemLevelRequest ItemsAnyAvailableAndNotRestricted ); |
29 |
use C4::Reserves qw( CheckReserves CanItemBeReserved MoveReserve ModReserve ModReserveMinusPriority RevertWaitingStatus IsItemOnHoldAndFound IsAvailableForItemLevelRequest ItemsAnyAvailableAndNotRestricted ); |
Lines 43-49
use Koha::Account;
Link Here
|
43 |
use Koha::AuthorisedValues; |
42 |
use Koha::AuthorisedValues; |
44 |
use Koha::BackgroundJob::BatchUpdateBiblioHoldsQueue; |
43 |
use Koha::BackgroundJob::BatchUpdateBiblioHoldsQueue; |
45 |
use Koha::Biblioitems; |
44 |
use Koha::Biblioitems; |
46 |
use Koha::DateUtils qw( dt_from_string output_pref ); |
45 |
use Koha::DateUtils qw( dt_from_string ); |
47 |
use Koha::Calendar; |
46 |
use Koha::Calendar; |
48 |
use Koha::Checkouts; |
47 |
use Koha::Checkouts; |
49 |
use Koha::Illrequests; |
48 |
use Koha::Illrequests; |
Lines 798-804
sub CanBookBeIssued {
Link Here
|
798 |
my $now = dt_from_string(); |
797 |
my $now = dt_from_string(); |
799 |
$duedate ||= CalcDateDue( $now, $effective_itemtype, $circ_library->branchcode, $patron_unblessed ); |
798 |
$duedate ||= CalcDateDue( $now, $effective_itemtype, $circ_library->branchcode, $patron_unblessed ); |
800 |
if (DateTime->compare($duedate,$now) == -1 ) { # duedate cannot be before now |
799 |
if (DateTime->compare($duedate,$now) == -1 ) { # duedate cannot be before now |
801 |
$needsconfirmation{INVALID_DATE} = output_pref($duedate); |
800 |
$needsconfirmation{INVALID_DATE} = $duedate; |
802 |
} |
801 |
} |
803 |
|
802 |
|
804 |
my $fees = Koha::Charges::Fees->new( |
803 |
my $fees = Koha::Charges::Fees->new( |
Lines 1235-1253
sub CanBookBeIssued {
Link Here
|
1235 |
my $check = checkHighHolds( $item_object, $patron ); |
1234 |
my $check = checkHighHolds( $item_object, $patron ); |
1236 |
|
1235 |
|
1237 |
if ( $check->{exceeded} ) { |
1236 |
if ( $check->{exceeded} ) { |
|
|
1237 |
my $highholds = { |
1238 |
num_holds => $check->{outstanding}, |
1239 |
duration => $check->{duration}, |
1240 |
returndate => $check->{due_date}, |
1241 |
}; |
1238 |
if ($override_high_holds) { |
1242 |
if ($override_high_holds) { |
1239 |
$alerts{HIGHHOLDS} = { |
1243 |
$alerts{HIGHHOLDS} = $highholds; |
1240 |
num_holds => $check->{outstanding}, |
|
|
1241 |
duration => $check->{duration}, |
1242 |
returndate => output_pref( { dt => dt_from_string($check->{due_date}), dateformat => 'iso', timeformat => '24hr' }), |
1243 |
}; |
1244 |
} |
1244 |
} |
1245 |
else { |
1245 |
else { |
1246 |
$needsconfirmation{HIGHHOLDS} = { |
1246 |
$needsconfirmation{HIGHHOLDS} = $highholds; |
1247 |
num_holds => $check->{outstanding}, |
|
|
1248 |
duration => $check->{duration}, |
1249 |
returndate => output_pref( { dt => dt_from_string($check->{due_date}), dateformat => 'iso', timeformat => '24hr' }), |
1250 |
}; |
1251 |
} |
1247 |
} |
1252 |
} |
1248 |
} |
1253 |
} |
1249 |
} |
Lines 1462-1469
Calculated if empty.
Link Here
|
1462 |
|
1458 |
|
1463 |
=item C<$cancelreserve> is 1 to override and cancel any pending reserves for the item (optional). |
1459 |
=item C<$cancelreserve> is 1 to override and cancel any pending reserves for the item (optional). |
1464 |
|
1460 |
|
1465 |
=item C<$issuedate> is the date to issue the item in iso (YYYY-MM-DD) format (optional). |
1461 |
=item C<$issuedate> is a DateTime object for the date to issue the item (optional). |
1466 |
Defaults to today. Unlike C<$datedue>, NOT a DateTime object, unfortunately. |
1462 |
Defaults to today. |
1467 |
|
1463 |
|
1468 |
AddIssue does the following things : |
1464 |
AddIssue does the following things : |
1469 |
|
1465 |
|
Lines 1635-1642
sub AddIssue {
Link Here
|
1635 |
|
1631 |
|
1636 |
my $issue_attributes = { |
1632 |
my $issue_attributes = { |
1637 |
borrowernumber => $borrower->{'borrowernumber'}, |
1633 |
borrowernumber => $borrower->{'borrowernumber'}, |
1638 |
issuedate => $issuedate->strftime('%Y-%m-%d %H:%M:%S'), |
1634 |
issuedate => $issuedate, |
1639 |
date_due => $datedue->strftime('%Y-%m-%d %H:%M:%S'), |
1635 |
date_due => $datedue, |
1640 |
branchcode => C4::Context->userenv->{'branch'}, |
1636 |
branchcode => C4::Context->userenv->{'branch'}, |
1641 |
onsite_checkout => $onsite_checkout, |
1637 |
onsite_checkout => $onsite_checkout, |
1642 |
auto_renew => $auto_renew ? 1 : 0, |
1638 |
auto_renew => $auto_renew ? 1 : 0, |
Lines 4417-4423
sub _CalculateAndUpdateFine {
Link Here
|
4417 |
itemnumber => $issue->itemnumber, |
4413 |
itemnumber => $issue->itemnumber, |
4418 |
borrowernumber => $issue->borrowernumber, |
4414 |
borrowernumber => $issue->borrowernumber, |
4419 |
amount => $amount, |
4415 |
amount => $amount, |
4420 |
due => output_pref($datedue), |
4416 |
due => $datedue, |
4421 |
}); |
4417 |
}); |
4422 |
} |
4418 |
} |
4423 |
elsif ($return_date) { |
4419 |
elsif ($return_date) { |
Lines 4430-4436
sub _CalculateAndUpdateFine {
Link Here
|
4430 |
itemnumber => $issue->itemnumber, |
4426 |
itemnumber => $issue->itemnumber, |
4431 |
borrowernumber => $issue->borrowernumber, |
4427 |
borrowernumber => $issue->borrowernumber, |
4432 |
amount => 0, |
4428 |
amount => 0, |
4433 |
due => output_pref($datedue), |
4429 |
due => $datedue, |
4434 |
}); |
4430 |
}); |
4435 |
} |
4431 |
} |
4436 |
} |
4432 |
} |