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