Lines 1717-1729
sub AddReturn {
Link Here
|
1717 |
$branch = C4::Context->userenv->{'branch'} unless $branch; # we trust userenv to be a safe fallback/default |
1717 |
$branch = C4::Context->userenv->{'branch'} unless $branch; # we trust userenv to be a safe fallback/default |
1718 |
my $messages; |
1718 |
my $messages; |
1719 |
my $borrower; |
1719 |
my $borrower; |
1720 |
my $biblio; |
|
|
1721 |
my $doreturn = 1; |
1720 |
my $doreturn = 1; |
1722 |
my $validTransfert = 0; |
1721 |
my $validTransfert = 0; |
1723 |
my $stat_type = 'return'; |
1722 |
my $stat_type = 'return'; |
1724 |
|
1723 |
|
1725 |
# get information on item |
1724 |
# get information on item |
1726 |
my $itemnumber = GetItemnumberFromBarcode( $barcode ); |
1725 |
my $itemnumber = GetItemnumberFromBarcode( $barcode ); |
|
|
1726 |
my $biblio = GetBiblioFromItemNumber($itemnumber); |
1727 |
unless ($itemnumber) { |
1727 |
unless ($itemnumber) { |
1728 |
return (0, { BadBarcode => $barcode }); # no barcode means no item or borrower. bail out. |
1728 |
return (0, { BadBarcode => $barcode }); # no barcode means no item or borrower. bail out. |
1729 |
} |
1729 |
} |
Lines 1773-1778
sub AddReturn {
Link Here
|
1773 |
return ( $doreturn, $messages, $issue, $borrower ); |
1773 |
return ( $doreturn, $messages, $issue, $borrower ); |
1774 |
} |
1774 |
} |
1775 |
|
1775 |
|
|
|
1776 |
# if we try a checkin that would result in a forbidden branchtransfer, refuse the return as well |
1777 |
# first, find branchtransferlimit value for this item |
1778 |
my $branchtransferlimitvalue = $biblio->{itemtype}; |
1779 |
$branchtransferlimitvalue = $item->{itype} |
1780 |
if C4::Context->preference("item-level_itypes") |
1781 |
&& C4::Context->preference("BranchTransferLimitsType") eq 'itemtype'; |
1782 |
$branchtransferlimitvalue = $item->{ccode} |
1783 |
if C4::Context->preference("item-level_itypes") |
1784 |
&& C4::Context->preference("BranchTransferLimitsType") eq 'ccode'; |
1785 |
if ( $hbr ne $branch |
1786 |
&& ( |
1787 |
C4::Context->preference("IndependentBranches") |
1788 |
or ( C4::Context->preference("UseBranchTransferLimits") |
1789 |
and not IsBranchTransferAllowed($hbr, $branch, $branchtransferlimitvalue ) ) |
1790 |
) |
1791 |
) { |
1792 |
$messages->{'Wrongbranch'} = { |
1793 |
Wrongbranch => $branch, |
1794 |
Rightbranch => $message |
1795 |
}; |
1796 |
$doreturn = 0; |
1797 |
return ( $doreturn, $messages, $issue, $borrower ); |
1798 |
} |
1799 |
|
1776 |
if ( $item->{'withdrawn'} ) { # book has been cancelled |
1800 |
if ( $item->{'withdrawn'} ) { # book has been cancelled |
1777 |
$messages->{'withdrawn'} = 1; |
1801 |
$messages->{'withdrawn'} = 1; |
1778 |
$doreturn = 0 if C4::Context->preference("BlockReturnOfWithdrawnItems"); |
1802 |
$doreturn = 0 if C4::Context->preference("BlockReturnOfWithdrawnItems"); |
Lines 3225-3231
Code is either an itemtype or collection doe depending on the pref BranchTransfe
Link Here
|
3225 |
|
3249 |
|
3226 |
sub IsBranchTransferAllowed { |
3250 |
sub IsBranchTransferAllowed { |
3227 |
my ( $toBranch, $fromBranch, $code ) = @_; |
3251 |
my ( $toBranch, $fromBranch, $code ) = @_; |
3228 |
|
|
|
3229 |
if ( $toBranch eq $fromBranch ) { return 1; } ## Short circuit for speed. |
3252 |
if ( $toBranch eq $fromBranch ) { return 1; } ## Short circuit for speed. |
3230 |
|
3253 |
|
3231 |
my $limitType = C4::Context->preference("BranchTransferLimitsType"); |
3254 |
my $limitType = C4::Context->preference("BranchTransferLimitsType"); |
3232 |
- |
|
|