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 4423-4429
sub _CalculateAndUpdateFine {
Link Here
|
4423 |
itemnumber => $issue->itemnumber, |
4419 |
itemnumber => $issue->itemnumber, |
4424 |
borrowernumber => $issue->borrowernumber, |
4420 |
borrowernumber => $issue->borrowernumber, |
4425 |
amount => $amount, |
4421 |
amount => $amount, |
4426 |
due => output_pref($datedue), |
4422 |
due => $datedue, |
4427 |
}); |
4423 |
}); |
4428 |
} |
4424 |
} |
4429 |
elsif ($return_date) { |
4425 |
elsif ($return_date) { |
Lines 4436-4442
sub _CalculateAndUpdateFine {
Link Here
|
4436 |
itemnumber => $issue->itemnumber, |
4432 |
itemnumber => $issue->itemnumber, |
4437 |
borrowernumber => $issue->borrowernumber, |
4433 |
borrowernumber => $issue->borrowernumber, |
4438 |
amount => 0, |
4434 |
amount => 0, |
4439 |
due => output_pref($datedue), |
4435 |
due => $datedue, |
4440 |
}); |
4436 |
}); |
4441 |
} |
4437 |
} |
4442 |
} |
4438 |
} |