Lines 42-47
use C4::Koha qw(
Link Here
|
42 |
GetKohaAuthorisedValueLib |
42 |
GetKohaAuthorisedValueLib |
43 |
); |
43 |
); |
44 |
use C4::Overdues qw(CalcFine UpdateFine); |
44 |
use C4::Overdues qw(CalcFine UpdateFine); |
|
|
45 |
use C4::RotatingCollections qw(GetCollectionItemBranches); |
45 |
use Algorithm::CheckDigits; |
46 |
use Algorithm::CheckDigits; |
46 |
|
47 |
|
47 |
use Data::Dumper; |
48 |
use Data::Dumper; |
Lines 1919-1933
sub AddReturn {
Link Here
|
1919 |
logaction("CIRCULATION", "RETURN", $borrowernumber, $item->{'itemnumber'}) |
1920 |
logaction("CIRCULATION", "RETURN", $borrowernumber, $item->{'itemnumber'}) |
1920 |
if C4::Context->preference("ReturnLog"); |
1921 |
if C4::Context->preference("ReturnLog"); |
1921 |
|
1922 |
|
1922 |
# FIXME: make this comment intelligible. |
1923 |
# IF |
1923 |
#adding message if holdingbranch is non equal a userenv branch to return the document to homebranch |
1924 |
# a) The item is so far returnable or hasn't been issued |
1924 |
#we check, if we don't have reserv or transfert for this document, if not, return it to homebranch . |
1925 |
# b) There is no hold for this item for pickup at this branch |
1925 |
|
1926 |
# c) The item's branch is not this branch |
1926 |
if (($doreturn or $messages->{'NotIssued'}) and !$resfound and ($branch ne $hbr) and not $messages->{'WrongTransfer'}){ |
1927 |
# c) The should not have been transferred to another branch instead of this one |
|
|
1928 |
# d) The item is not part of a rotating collection that is currently at this branch |
1929 |
# THEN this return should be considered a transfer |
1930 |
# |
1931 |
# This transfer should be considered valid UNLESS |
1932 |
# a) AutomaticItemReturn is enabled |
1933 |
# OR |
1934 |
# b) There is branch transfer limit that should prevent this item from being transfered to this branch |
1935 |
# |
1936 |
# If the transfer is not valid, a new transfer back to the item's branch will be created |
1937 |
if ( |
1938 |
( $doreturn or $messages->{'NotIssued'} ) |
1939 |
and !$resfound |
1940 |
and $branch ne $hbr |
1941 |
and !$messages->{'WrongTransfer'} |
1942 |
and [GetCollectionItemBranches( $item->{'itemnumber'} )]->[1] ne $branch |
1943 |
){ |
1927 |
if ( C4::Context->preference("AutomaticItemReturn" ) or |
1944 |
if ( C4::Context->preference("AutomaticItemReturn" ) or |
1928 |
(C4::Context->preference("UseBranchTransferLimits") and |
1945 |
(C4::Context->preference("UseBranchTransferLimits") and |
1929 |
! IsBranchTransferAllowed($branch, $hbr, $item->{C4::Context->preference("BranchTransferLimitsType")} ) |
1946 |
! IsBranchTransferAllowed($branch, $hbr, $item->{C4::Context->preference("BranchTransferLimitsType")} ) |
1930 |
)) { |
1947 |
) |
|
|
1948 |
) { |
1931 |
$debug and warn sprintf "about to call ModItemTransfer(%s, %s, %s)", $item->{'itemnumber'},$branch, $hbr; |
1949 |
$debug and warn sprintf "about to call ModItemTransfer(%s, %s, %s)", $item->{'itemnumber'},$branch, $hbr; |
1932 |
$debug and warn "item: " . Dumper($item); |
1950 |
$debug and warn "item: " . Dumper($item); |
1933 |
ModItemTransfer($item->{'itemnumber'}, $branch, $hbr); |
1951 |
ModItemTransfer($item->{'itemnumber'}, $branch, $hbr); |
Lines 1936-1941
sub AddReturn {
Link Here
|
1936 |
$messages->{'NeedsTransfer'} = 1; # TODO: instead of 1, specify branchcode that the transfer SHOULD go to, $item->{homebranch} |
1954 |
$messages->{'NeedsTransfer'} = 1; # TODO: instead of 1, specify branchcode that the transfer SHOULD go to, $item->{homebranch} |
1937 |
} |
1955 |
} |
1938 |
} |
1956 |
} |
|
|
1957 |
|
1939 |
return ( $doreturn, $messages, $issue, $borrower ); |
1958 |
return ( $doreturn, $messages, $issue, $borrower ); |
1940 |
} |
1959 |
} |
1941 |
|
1960 |
|