Lines 1480-1492
sub AddReturn {
Link Here
|
1480 |
$branch = C4::Context->userenv->{'branch'} unless $branch; # we trust userenv to be a safe fallback/default |
1480 |
$branch = C4::Context->userenv->{'branch'} unless $branch; # we trust userenv to be a safe fallback/default |
1481 |
my $messages; |
1481 |
my $messages; |
1482 |
my $borrower; |
1482 |
my $borrower; |
1483 |
my $biblio; |
|
|
1484 |
my $doreturn = 1; |
1483 |
my $doreturn = 1; |
1485 |
my $validTransfert = 0; |
1484 |
my $validTransfert = 0; |
1486 |
my $stat_type = 'return'; |
1485 |
my $stat_type = 'return'; |
1487 |
|
1486 |
|
1488 |
# get information on item |
1487 |
# get information on item |
1489 |
my $itemnumber = GetItemnumberFromBarcode( $barcode ); |
1488 |
my $itemnumber = GetItemnumberFromBarcode( $barcode ); |
|
|
1489 |
my $biblio = GetBiblioFromItemNumber($itemnumber); |
1490 |
unless ($itemnumber) { |
1490 |
unless ($itemnumber) { |
1491 |
return (0, { BadBarcode => $barcode }); # no barcode means no item or borrower. bail out. |
1491 |
return (0, { BadBarcode => $barcode }); # no barcode means no item or borrower. bail out. |
1492 |
} |
1492 |
} |
Lines 1525-1531
sub AddReturn {
Link Here
|
1525 |
} |
1525 |
} |
1526 |
|
1526 |
|
1527 |
# if indy branches and returning to different branch, refuse the return |
1527 |
# if indy branches and returning to different branch, refuse the return |
1528 |
if ($hbr ne $branch && C4::Context->preference("IndependantBranches")){ |
1528 |
# if we try a checkin that would result in a forbidden branchtransfer, refuse the return as well |
|
|
1529 |
|
1530 |
# first, find branchtransferlimit value for this item |
1531 |
my $branchtransferlimitvalue=''; |
1532 |
if ( C4::Context->preference("item-level_itypes") && C4::Context->preference("BranchTransferLimitsType") eq 'itemtype' ) { |
1533 |
$branchtransferlimitvalue=$item->{itype}; |
1534 |
} elsif (C4::Context->preference("item-level_itypes") && C4::Context->preference("BranchTransferLimitsType") eq 'ccode' ) { |
1535 |
$branchtransferlimitvalue=$item->{ccode}; |
1536 |
} else { |
1537 |
$branchtransferlimitvalue=$biblio->{itemtype}; |
1538 |
} |
1539 |
if (($hbr ne $branch && C4::Context->preference("IndependantBranches")) or (!IsBranchTransferAllowed($hbr, $branch, $branchtransferlimitvalue ))) { |
1529 |
$messages->{'Wrongbranch'} = { |
1540 |
$messages->{'Wrongbranch'} = { |
1530 |
Wrongbranch => $branch, |
1541 |
Wrongbranch => $branch, |
1531 |
Rightbranch => $hbr, |
1542 |
Rightbranch => $hbr, |
Lines 2927-2933
Code is either an itemtype or collection doe depending on the pref BranchTransfe
Link Here
|
2927 |
|
2938 |
|
2928 |
sub IsBranchTransferAllowed { |
2939 |
sub IsBranchTransferAllowed { |
2929 |
my ( $toBranch, $fromBranch, $code ) = @_; |
2940 |
my ( $toBranch, $fromBranch, $code ) = @_; |
2930 |
|
|
|
2931 |
if ( $toBranch eq $fromBranch ) { return 1; } ## Short circuit for speed. |
2941 |
if ( $toBranch eq $fromBranch ) { return 1; } ## Short circuit for speed. |
2932 |
|
2942 |
|
2933 |
my $limitType = C4::Context->preference("BranchTransferLimitsType"); |
2943 |
my $limitType = C4::Context->preference("BranchTransferLimitsType"); |
2934 |
- |
|
|