|
Lines 22-35
package C4::Circulation;
Link Here
|
| 22 |
use strict; |
22 |
use strict; |
| 23 |
#use warnings; FIXME - Bug 2505 |
23 |
#use warnings; FIXME - Bug 2505 |
| 24 |
use DateTime; |
24 |
use DateTime; |
|
|
25 |
use Koha::DateUtils; |
| 25 |
use C4::Context; |
26 |
use C4::Context; |
| 26 |
use C4::Stats; |
27 |
use C4::Stats; |
| 27 |
use C4::Reserves; |
28 |
use C4::Reserves; |
| 28 |
use C4::Biblio; |
29 |
use C4::Biblio; |
| 29 |
use C4::Items; |
30 |
use C4::Items; |
| 30 |
use C4::Members; |
31 |
use C4::Members; |
| 31 |
use C4::Dates; |
|
|
| 32 |
use C4::Dates qw(format_date); |
| 33 |
use C4::Accounts; |
32 |
use C4::Accounts; |
| 34 |
use C4::ItemCirculationAlertPreference; |
33 |
use C4::ItemCirculationAlertPreference; |
| 35 |
use C4::Message; |
34 |
use C4::Message; |
|
Lines 657-663
sub itemissues {
Link Here
|
| 657 |
=head2 CanBookBeIssued |
656 |
=head2 CanBookBeIssued |
| 658 |
|
657 |
|
| 659 |
( $issuingimpossible, $needsconfirmation ) = CanBookBeIssued( $borrower, |
658 |
( $issuingimpossible, $needsconfirmation ) = CanBookBeIssued( $borrower, |
| 660 |
$barcode, $duedatespec, $inprocess, $ignore_reserves ); |
659 |
$barcode, $duedate, $inprocess, $ignore_reserves ); |
| 661 |
|
660 |
|
| 662 |
Check if a book can be issued. |
661 |
Check if a book can be issued. |
| 663 |
|
662 |
|
|
Lines 669-675
C<$issuingimpossible> and C<$needsconfirmation> are some hashref.
Link Here
|
| 669 |
|
668 |
|
| 670 |
=item C<$barcode> is the bar code of the book being issued. |
669 |
=item C<$barcode> is the bar code of the book being issued. |
| 671 |
|
670 |
|
| 672 |
=item C<$duedatespec> is a C4::Dates object. |
671 |
=item C<$duedates> is a DateTime object. |
| 673 |
|
672 |
|
| 674 |
=item C<$inprocess> boolean switch |
673 |
=item C<$inprocess> boolean switch |
| 675 |
=item C<$ignore_reserves> boolean switch |
674 |
=item C<$ignore_reserves> boolean switch |
|
Lines 1035-1041
sub CanBookBeIssued {
Link Here
|
| 1035 |
$needsconfirmation{'rescardnumber'} = $resborrower->{'cardnumber'}; |
1034 |
$needsconfirmation{'rescardnumber'} = $resborrower->{'cardnumber'}; |
| 1036 |
$needsconfirmation{'resborrowernumber'} = $resborrower->{'borrowernumber'}; |
1035 |
$needsconfirmation{'resborrowernumber'} = $resborrower->{'borrowernumber'}; |
| 1037 |
$needsconfirmation{'resbranchname'} = $branchname; |
1036 |
$needsconfirmation{'resbranchname'} = $branchname; |
| 1038 |
$needsconfirmation{'reswaitingdate'} = format_date($res->{'waitingdate'}); |
1037 |
$needsconfirmation{'reswaitingdate'} = $res->{'waitingdate'}; |
| 1039 |
} |
1038 |
} |
| 1040 |
elsif ( $restype eq "Reserved" ) { |
1039 |
elsif ( $restype eq "Reserved" ) { |
| 1041 |
# The item is on reserve for someone else. |
1040 |
# The item is on reserve for someone else. |
|
Lines 1045-1051
sub CanBookBeIssued {
Link Here
|
| 1045 |
$needsconfirmation{'rescardnumber'} = $resborrower->{'cardnumber'}; |
1044 |
$needsconfirmation{'rescardnumber'} = $resborrower->{'cardnumber'}; |
| 1046 |
$needsconfirmation{'resborrowernumber'} = $resborrower->{'borrowernumber'}; |
1045 |
$needsconfirmation{'resborrowernumber'} = $resborrower->{'borrowernumber'}; |
| 1047 |
$needsconfirmation{'resbranchname'} = $branchname; |
1046 |
$needsconfirmation{'resbranchname'} = $branchname; |
| 1048 |
$needsconfirmation{'resreservedate'} = format_date($res->{'reservedate'}); |
1047 |
$needsconfirmation{'resreservedate'} = $res->{'reservedate'}; |
| 1049 |
} |
1048 |
} |
| 1050 |
} |
1049 |
} |
| 1051 |
} |
1050 |
} |
|
Lines 1212-1224
Issue a book. Does no check, they are done in CanBookBeIssued. If we reach this
Link Here
|
| 1212 |
|
1211 |
|
| 1213 |
=item C<$barcode> is the barcode of the item being issued. |
1212 |
=item C<$barcode> is the barcode of the item being issued. |
| 1214 |
|
1213 |
|
| 1215 |
=item C<$datedue> is a C4::Dates object for the max date of return, i.e. the date due (optional). |
1214 |
=item C<$datedue> is a DateTime object for the max date of return, i.e. the date due (optional). |
| 1216 |
Calculated if empty. |
1215 |
Calculated if empty. |
| 1217 |
|
1216 |
|
| 1218 |
=item C<$cancelreserve> is 1 to override and cancel any pending reserves for the item (optional). |
1217 |
=item C<$cancelreserve> is 1 to override and cancel any pending reserves for the item (optional). |
| 1219 |
|
1218 |
|
| 1220 |
=item C<$issuedate> is the date to issue the item in iso (YYYY-MM-DD) format (optional). |
1219 |
=item C<$issuedate> is the date to issue the item in iso (YYYY-MM-DD) format (optional). |
| 1221 |
Defaults to today. Unlike C<$datedue>, NOT a C4::Dates object, unfortunately. |
1220 |
Defaults to today. Unlike C<$datedue>, NOT a DateTime object, unfortunately. |
| 1222 |
|
1221 |
|
| 1223 |
AddIssue does the following things : |
1222 |
AddIssue does the following things : |
| 1224 |
|
1223 |
|
|
Lines 1905-1911
sub AddReturn {
Link Here
|
| 1905 |
# define circControlBranch only if dropbox mode is set |
1904 |
# define circControlBranch only if dropbox mode is set |
| 1906 |
# don't allow dropbox mode to create an invalid entry in issues (issuedate > today) |
1905 |
# don't allow dropbox mode to create an invalid entry in issues (issuedate > today) |
| 1907 |
# FIXME: check issuedate > returndate, factoring in holidays |
1906 |
# FIXME: check issuedate > returndate, factoring in holidays |
| 1908 |
#$circControlBranch = _GetCircControlBranch($item,$borrower) unless ( $item->{'issuedate'} eq C4::Dates->today('iso') );; |
1907 |
|
| 1909 |
$circControlBranch = _GetCircControlBranch($item,$borrower); |
1908 |
$circControlBranch = _GetCircControlBranch($item,$borrower); |
| 1910 |
$issue->{'overdue'} = DateTime->compare($issue->{'date_due'}, $dropboxdate ) == -1 ? 1 : 0; |
1909 |
$issue->{'overdue'} = DateTime->compare($issue->{'date_due'}, $dropboxdate ) == -1 ? 1 : 0; |
| 1911 |
} |
1910 |
} |
|
Lines 2851-2857
C<$itemnumber> is the number of the item to renew.
Link Here
|
| 2851 |
C<$branch> is the library where the renewal took place (if any). |
2850 |
C<$branch> is the library where the renewal took place (if any). |
| 2852 |
The library that controls the circ policies for the renewal is retrieved from the issues record. |
2851 |
The library that controls the circ policies for the renewal is retrieved from the issues record. |
| 2853 |
|
2852 |
|
| 2854 |
C<$datedue> can be a C4::Dates object used to set the due date. |
2853 |
C<$datedue> can be a DateTime object used to set the due date. |
| 2855 |
|
2854 |
|
| 2856 |
C<$lastreneweddate> is an optional ISO-formatted date used to set issues.lastreneweddate. If |
2855 |
C<$lastreneweddate> is an optional ISO-formatted date used to set issues.lastreneweddate. If |
| 2857 |
this parameter is not supplied, lastreneweddate is set to the current date. |
2856 |
this parameter is not supplied, lastreneweddate is set to the current date. |
|
Lines 3435-3441
$newdatedue = CalcDateDue($startdate,$itemtype,$branchcode,$borrower);
Link Here
|
| 3435 |
|
3434 |
|
| 3436 |
this function calculates the due date given the start date and configured circulation rules, |
3435 |
this function calculates the due date given the start date and configured circulation rules, |
| 3437 |
checking against the holidays calendar as per the 'useDaysMode' syspref. |
3436 |
checking against the holidays calendar as per the 'useDaysMode' syspref. |
| 3438 |
C<$startdate> = C4::Dates object representing start date of loan period (assumed to be today) |
3437 |
C<$startdate> = DateTime object representing start date of loan period (assumed to be today) |
| 3439 |
C<$itemtype> = itemtype code of item in question |
3438 |
C<$itemtype> = itemtype code of item in question |
| 3440 |
C<$branch> = location whose calendar to use |
3439 |
C<$branch> = location whose calendar to use |
| 3441 |
C<$borrower> = Borrower object |
3440 |
C<$borrower> = Borrower object |
|
Lines 3877-3884
sub TransferSlip {
Link Here
|
| 3877 |
my $item = GetItem( $itemnumber, $barcode ) |
3876 |
my $item = GetItem( $itemnumber, $barcode ) |
| 3878 |
or return; |
3877 |
or return; |
| 3879 |
|
3878 |
|
| 3880 |
my $pulldate = C4::Dates->new(); |
|
|
| 3881 |
|
| 3882 |
return C4::Letters::GetPreparedLetter ( |
3879 |
return C4::Letters::GetPreparedLetter ( |
| 3883 |
module => 'circulation', |
3880 |
module => 'circulation', |
| 3884 |
letter_code => 'TRANSFERSLIP', |
3881 |
letter_code => 'TRANSFERSLIP', |