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