|
Lines 570-576
sub itemissues {
Link Here
|
| 570 |
=head2 CanBookBeIssued |
570 |
=head2 CanBookBeIssued |
| 571 |
|
571 |
|
| 572 |
( $issuingimpossible, $needsconfirmation ) = CanBookBeIssued( $borrower, |
572 |
( $issuingimpossible, $needsconfirmation ) = CanBookBeIssued( $borrower, |
| 573 |
$barcode, $duedatespec, $inprocess ); |
573 |
$barcode, $duedatespec, $inprocess, $ignore_reserves ); |
| 574 |
|
574 |
|
| 575 |
Check if a book can be issued. |
575 |
Check if a book can be issued. |
| 576 |
|
576 |
|
|
Lines 584-590
C<$issuingimpossible> and C<$needsconfirmation> are some hashref.
Link Here
|
| 584 |
|
584 |
|
| 585 |
=item C<$duedatespec> is a C4::Dates object. |
585 |
=item C<$duedatespec> is a C4::Dates object. |
| 586 |
|
586 |
|
| 587 |
=item C<$inprocess> |
587 |
=item C<$inprocess> boolean switch |
|
|
588 |
=item C<$ignore_reserves> boolean switch |
| 588 |
|
589 |
|
| 589 |
=back |
590 |
=back |
| 590 |
|
591 |
|
|
Lines 661-667
if the borrower borrows to much things
Link Here
|
| 661 |
=cut |
662 |
=cut |
| 662 |
|
663 |
|
| 663 |
sub CanBookBeIssued { |
664 |
sub CanBookBeIssued { |
| 664 |
my ( $borrower, $barcode, $duedate, $inprocess ) = @_; |
665 |
my ( $borrower, $barcode, $duedate, $inprocess, $ignore_reserves ) = @_; |
| 665 |
my %needsconfirmation; # filled with problems that needs confirmations |
666 |
my %needsconfirmation; # filled with problems that needs confirmations |
| 666 |
my %issuingimpossible; # filled with problems that causes the issue to be IMPOSSIBLE |
667 |
my %issuingimpossible; # filled with problems that causes the issue to be IMPOSSIBLE |
| 667 |
my $item = GetItem(GetItemnumberFromBarcode( $barcode )); |
668 |
my $item = GetItem(GetItemnumberFromBarcode( $barcode )); |
|
Lines 868-904
sub CanBookBeIssued {
Link Here
|
| 868 |
$needsconfirmation{issued_borrowernumber} = $currborinfo->{'borrowernumber'}; |
869 |
$needsconfirmation{issued_borrowernumber} = $currborinfo->{'borrowernumber'}; |
| 869 |
} |
870 |
} |
| 870 |
|
871 |
|
| 871 |
# See if the item is on reserve. |
872 |
unless ( $ignore_reserves ) { |
| 872 |
my ( $restype, $res, undef ) = C4::Reserves::CheckReserves( $item->{'itemnumber'} ); |
873 |
# See if the item is on reserve. |
| 873 |
if ($restype) { |
874 |
my ( $restype, $res ) = C4::Reserves::CheckReserves( $item->{'itemnumber'} ); |
| 874 |
my $resbor = $res->{'borrowernumber'}; |
875 |
if ($restype) { |
| 875 |
my ( $resborrower ) = C4::Members::GetMember( borrowernumber => $resbor ); |
876 |
my $resbor = $res->{'borrowernumber'}; |
| 876 |
my $branches = GetBranches(); |
877 |
if ( $resbor ne $borrower->{'borrowernumber'} ) { |
| 877 |
my $branchname = $branches->{ $res->{'branchcode'} }->{'branchname'}; |
878 |
my ( $resborrower ) = C4::Members::GetMember( borrowernumber => $resbor ); |
| 878 |
if ( $resbor ne $borrower->{'borrowernumber'} && $restype eq "Waiting" ) |
879 |
my $branchname = GetBranchName( $res->{'branchcode'} ); |
| 879 |
{ |
880 |
if ( $restype eq "Waiting" ) |
| 880 |
# The item is on reserve and waiting, but has been |
881 |
{ |
| 881 |
# reserved by some other patron. |
882 |
# The item is on reserve and waiting, but has been |
| 882 |
$needsconfirmation{RESERVE_WAITING} = 1; |
883 |
# reserved by some other patron. |
| 883 |
$needsconfirmation{'resfirstname'} = $resborrower->{'firstname'}; |
884 |
$needsconfirmation{RESERVE_WAITING} = 1; |
| 884 |
$needsconfirmation{'ressurname'} = $resborrower->{'surname'}; |
885 |
$needsconfirmation{'resfirstname'} = $resborrower->{'firstname'}; |
| 885 |
$needsconfirmation{'rescardnumber'} = $resborrower->{'cardnumber'}; |
886 |
$needsconfirmation{'ressurname'} = $resborrower->{'surname'}; |
| 886 |
$needsconfirmation{'resborrowernumber'} = $resborrower->{'borrowernumber'}; |
887 |
$needsconfirmation{'rescardnumber'} = $resborrower->{'cardnumber'}; |
| 887 |
$needsconfirmation{'resbranchname'} = $branchname; |
888 |
$needsconfirmation{'resborrowernumber'} = $resborrower->{'borrowernumber'}; |
| 888 |
$needsconfirmation{'reswaitingdate'} = format_date($res->{'waitingdate'}); |
889 |
$needsconfirmation{'resbranchname'} = $branchname; |
| 889 |
} |
890 |
$needsconfirmation{'reswaitingdate'} = format_date($res->{'waitingdate'}); |
| 890 |
elsif ( $restype eq "Reserved" ) { |
891 |
} |
| 891 |
# The item is on reserve for someone else. |
892 |
elsif ( $restype eq "Reserved" ) { |
| 892 |
$needsconfirmation{RESERVED} = 1; |
893 |
# The item is on reserve for someone else. |
| 893 |
$needsconfirmation{'resfirstname'} = $resborrower->{'firstname'}; |
894 |
$needsconfirmation{RESERVED} = 1; |
| 894 |
$needsconfirmation{'ressurname'} = $resborrower->{'surname'}; |
895 |
$needsconfirmation{'resfirstname'} = $resborrower->{'firstname'}; |
| 895 |
$needsconfirmation{'rescardnumber'} = $resborrower->{'cardnumber'}; |
896 |
$needsconfirmation{'ressurname'} = $resborrower->{'surname'}; |
| 896 |
$needsconfirmation{'resborrowernumber'} = $resborrower->{'borrowernumber'}; |
897 |
$needsconfirmation{'rescardnumber'} = $resborrower->{'cardnumber'}; |
| 897 |
$needsconfirmation{'resbranchname'} = $branchname; |
898 |
$needsconfirmation{'resborrowernumber'} = $resborrower->{'borrowernumber'}; |
| 898 |
$needsconfirmation{'resreservedate'} = format_date($res->{'reservedate'}); |
899 |
$needsconfirmation{'resbranchname'} = $branchname; |
|
|
900 |
$needsconfirmation{'resreservedate'} = format_date($res->{'reservedate'}); |
| 901 |
} |
| 902 |
} |
| 899 |
} |
903 |
} |
| 900 |
} |
904 |
} |
| 901 |
return ( \%issuingimpossible, \%needsconfirmation ); |
905 |
return ( \%issuingimpossible, \%needsconfirmation ); |
| 902 |
} |
906 |
} |
| 903 |
|
907 |
|
| 904 |
=head2 AddIssue |
908 |
=head2 AddIssue |