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 603-609
sub itemissues {
Link Here
|
603 |
=head2 CanBookBeIssued |
602 |
=head2 CanBookBeIssued |
604 |
|
603 |
|
605 |
( $issuingimpossible, $needsconfirmation ) = CanBookBeIssued( $borrower, |
604 |
( $issuingimpossible, $needsconfirmation ) = CanBookBeIssued( $borrower, |
606 |
$barcode, $duedatespec, $inprocess, $ignore_reserves ); |
605 |
$barcode, $duedate, $inprocess, $ignore_reserves ); |
607 |
|
606 |
|
608 |
Check if a book can be issued. |
607 |
Check if a book can be issued. |
609 |
|
608 |
|
Lines 615-621
C<$issuingimpossible> and C<$needsconfirmation> are some hashref.
Link Here
|
615 |
|
614 |
|
616 |
=item C<$barcode> is the bar code of the book being issued. |
615 |
=item C<$barcode> is the bar code of the book being issued. |
617 |
|
616 |
|
618 |
=item C<$duedatespec> is a C4::Dates object. |
617 |
=item C<$duedates> is a DateTime object. |
619 |
|
618 |
|
620 |
=item C<$inprocess> boolean switch |
619 |
=item C<$inprocess> boolean switch |
621 |
=item C<$ignore_reserves> boolean switch |
620 |
=item C<$ignore_reserves> boolean switch |
Lines 980-986
sub CanBookBeIssued {
Link Here
|
980 |
$needsconfirmation{'rescardnumber'} = $resborrower->{'cardnumber'}; |
979 |
$needsconfirmation{'rescardnumber'} = $resborrower->{'cardnumber'}; |
981 |
$needsconfirmation{'resborrowernumber'} = $resborrower->{'borrowernumber'}; |
980 |
$needsconfirmation{'resborrowernumber'} = $resborrower->{'borrowernumber'}; |
982 |
$needsconfirmation{'resbranchname'} = $branchname; |
981 |
$needsconfirmation{'resbranchname'} = $branchname; |
983 |
$needsconfirmation{'reswaitingdate'} = format_date($res->{'waitingdate'}); |
982 |
$needsconfirmation{'reswaitingdate'} = $res->{'waitingdate'}; |
984 |
} |
983 |
} |
985 |
elsif ( $restype eq "Reserved" ) { |
984 |
elsif ( $restype eq "Reserved" ) { |
986 |
# The item is on reserve for someone else. |
985 |
# The item is on reserve for someone else. |
Lines 990-996
sub CanBookBeIssued {
Link Here
|
990 |
$needsconfirmation{'rescardnumber'} = $resborrower->{'cardnumber'}; |
989 |
$needsconfirmation{'rescardnumber'} = $resborrower->{'cardnumber'}; |
991 |
$needsconfirmation{'resborrowernumber'} = $resborrower->{'borrowernumber'}; |
990 |
$needsconfirmation{'resborrowernumber'} = $resborrower->{'borrowernumber'}; |
992 |
$needsconfirmation{'resbranchname'} = $branchname; |
991 |
$needsconfirmation{'resbranchname'} = $branchname; |
993 |
$needsconfirmation{'resreservedate'} = format_date($res->{'reservedate'}); |
992 |
$needsconfirmation{'resreservedate'} = $res->{'reservedate'}; |
994 |
} |
993 |
} |
995 |
} |
994 |
} |
996 |
} |
995 |
} |
Lines 1157-1169
Issue a book. Does no check, they are done in CanBookBeIssued. If we reach this
Link Here
|
1157 |
|
1156 |
|
1158 |
=item C<$barcode> is the barcode of the item being issued. |
1157 |
=item C<$barcode> is the barcode of the item being issued. |
1159 |
|
1158 |
|
1160 |
=item C<$datedue> is a C4::Dates object for the max date of return, i.e. the date due (optional). |
1159 |
=item C<$datedue> is a DateTime object for the max date of return, i.e. the date due (optional). |
1161 |
Calculated if empty. |
1160 |
Calculated if empty. |
1162 |
|
1161 |
|
1163 |
=item C<$cancelreserve> is 1 to override and cancel any pending reserves for the item (optional). |
1162 |
=item C<$cancelreserve> is 1 to override and cancel any pending reserves for the item (optional). |
1164 |
|
1163 |
|
1165 |
=item C<$issuedate> is the date to issue the item in iso (YYYY-MM-DD) format (optional). |
1164 |
=item C<$issuedate> is the date to issue the item in iso (YYYY-MM-DD) format (optional). |
1166 |
Defaults to today. Unlike C<$datedue>, NOT a C4::Dates object, unfortunately. |
1165 |
Defaults to today. Unlike C<$datedue>, NOT a DateTime object, unfortunately. |
1167 |
|
1166 |
|
1168 |
AddIssue does the following things : |
1167 |
AddIssue does the following things : |
1169 |
|
1168 |
|
Lines 1853-1859
sub AddReturn {
Link Here
|
1853 |
# define circControlBranch only if dropbox mode is set |
1852 |
# define circControlBranch only if dropbox mode is set |
1854 |
# don't allow dropbox mode to create an invalid entry in issues (issuedate > today) |
1853 |
# don't allow dropbox mode to create an invalid entry in issues (issuedate > today) |
1855 |
# FIXME: check issuedate > returndate, factoring in holidays |
1854 |
# FIXME: check issuedate > returndate, factoring in holidays |
1856 |
#$circControlBranch = _GetCircControlBranch($item,$borrower) unless ( $item->{'issuedate'} eq C4::Dates->today('iso') );; |
1855 |
|
1857 |
$circControlBranch = _GetCircControlBranch($item,$borrower); |
1856 |
$circControlBranch = _GetCircControlBranch($item,$borrower); |
1858 |
$issue->{'overdue'} = DateTime->compare($issue->{'date_due'}, $dropboxdate ) == -1 ? 1 : 0; |
1857 |
$issue->{'overdue'} = DateTime->compare($issue->{'date_due'}, $dropboxdate ) == -1 ? 1 : 0; |
1859 |
} |
1858 |
} |
Lines 2789-2795
C<$itemnumber> is the number of the item to renew.
Link Here
|
2789 |
C<$branch> is the library where the renewal took place (if any). |
2788 |
C<$branch> is the library where the renewal took place (if any). |
2790 |
The library that controls the circ policies for the renewal is retrieved from the issues record. |
2789 |
The library that controls the circ policies for the renewal is retrieved from the issues record. |
2791 |
|
2790 |
|
2792 |
C<$datedue> can be a C4::Dates object used to set the due date. |
2791 |
C<$datedue> can be a DateTime object used to set the due date. |
2793 |
|
2792 |
|
2794 |
C<$lastreneweddate> is an optional ISO-formatted date used to set issues.lastreneweddate. If |
2793 |
C<$lastreneweddate> is an optional ISO-formatted date used to set issues.lastreneweddate. If |
2795 |
this parameter is not supplied, lastreneweddate is set to the current date. |
2794 |
this parameter is not supplied, lastreneweddate is set to the current date. |
Lines 3373-3379
$newdatedue = CalcDateDue($startdate,$itemtype,$branchcode,$borrower);
Link Here
|
3373 |
|
3372 |
|
3374 |
this function calculates the due date given the start date and configured circulation rules, |
3373 |
this function calculates the due date given the start date and configured circulation rules, |
3375 |
checking against the holidays calendar as per the 'useDaysMode' syspref. |
3374 |
checking against the holidays calendar as per the 'useDaysMode' syspref. |
3376 |
C<$startdate> = C4::Dates object representing start date of loan period (assumed to be today) |
3375 |
C<$startdate> = DateTime object representing start date of loan period (assumed to be today) |
3377 |
C<$itemtype> = itemtype code of item in question |
3376 |
C<$itemtype> = itemtype code of item in question |
3378 |
C<$branch> = location whose calendar to use |
3377 |
C<$branch> = location whose calendar to use |
3379 |
C<$borrower> = Borrower object |
3378 |
C<$borrower> = Borrower object |
Lines 3815-3822
sub TransferSlip {
Link Here
|
3815 |
my $item = GetItem( $itemnumber, $barcode ) |
3814 |
my $item = GetItem( $itemnumber, $barcode ) |
3816 |
or return; |
3815 |
or return; |
3817 |
|
3816 |
|
3818 |
my $pulldate = C4::Dates->new(); |
|
|
3819 |
|
3820 |
return C4::Letters::GetPreparedLetter ( |
3817 |
return C4::Letters::GetPreparedLetter ( |
3821 |
module => 'circulation', |
3818 |
module => 'circulation', |
3822 |
letter_code => 'TRANSFERSLIP', |
3819 |
letter_code => 'TRANSFERSLIP', |