Lines 1580-1585
holdallowed => Hold policy for this branch and itemtype. Possible values:
Link Here
|
1580 |
returnbranch => branch to which to return item. Possible values: |
1580 |
returnbranch => branch to which to return item. Possible values: |
1581 |
noreturn: do not return, let item remain where checked in (floating collections) |
1581 |
noreturn: do not return, let item remain where checked in (floating collections) |
1582 |
homebranch: return to item's home branch |
1582 |
homebranch: return to item's home branch |
|
|
1583 |
holdingbranch: return to issuer branch |
1583 |
|
1584 |
|
1584 |
This searches branchitemrules in the following order: |
1585 |
This searches branchitemrules in the following order: |
1585 |
|
1586 |
|
Lines 1695-1700
fields from the reserves table of the Koha database, and
Link Here
|
1695 |
C<biblioitemnumber>. It also has the key C<ResFound>, whose value is |
1696 |
C<biblioitemnumber>. It also has the key C<ResFound>, whose value is |
1696 |
either C<Waiting>, C<Reserved>, or 0. |
1697 |
either C<Waiting>, C<Reserved>, or 0. |
1697 |
|
1698 |
|
|
|
1699 |
=item C<WasReturned> |
1700 |
|
1701 |
Value 1 if return is successful. |
1702 |
|
1703 |
=item C<NeedsTransfer> |
1704 |
|
1705 |
If AutomaticItemReturn is disabled, return branch is given as value of NeedsTransfer. |
1706 |
|
1698 |
=back |
1707 |
=back |
1699 |
|
1708 |
|
1700 |
C<$iteminformation> is a reference-to-hash, giving information about the |
1709 |
C<$iteminformation> is a reference-to-hash, giving information about the |
Lines 1726-1732
sub AddReturn {
Link Here
|
1726 |
return (0, { BadBarcode => $barcode }); # no barcode means no item or borrower. bail out. |
1735 |
return (0, { BadBarcode => $barcode }); # no barcode means no item or borrower. bail out. |
1727 |
} |
1736 |
} |
1728 |
my $issue = GetItemIssue($itemnumber); |
1737 |
my $issue = GetItemIssue($itemnumber); |
1729 |
# warn Dumper($iteminformation); |
|
|
1730 |
if ($issue and $issue->{borrowernumber}) { |
1738 |
if ($issue and $issue->{borrowernumber}) { |
1731 |
$borrower = C4::Members::GetMemberDetails($issue->{borrowernumber}) |
1739 |
$borrower = C4::Members::GetMemberDetails($issue->{borrowernumber}) |
1732 |
or die "Data inconsistency: barcode $barcode (itemnumber:$itemnumber) claims to be issued to non-existant borrowernumber '$issue->{borrowernumber}'\n" |
1740 |
or die "Data inconsistency: barcode $barcode (itemnumber:$itemnumber) claims to be issued to non-existant borrowernumber '$issue->{borrowernumber}'\n" |
Lines 1746-1763
sub AddReturn {
Link Here
|
1746 |
my $item = GetItem($itemnumber) or die "GetItem($itemnumber) failed"; |
1754 |
my $item = GetItem($itemnumber) or die "GetItem($itemnumber) failed"; |
1747 |
# full item data, but no borrowernumber or checkout info (no issue) |
1755 |
# full item data, but no borrowernumber or checkout info (no issue) |
1748 |
# we know GetItem should work because GetItemnumberFromBarcode worked |
1756 |
# we know GetItem should work because GetItemnumberFromBarcode worked |
1749 |
my $hbr = GetBranchItemRule($item->{'homebranch'}, $item->{'itype'})->{'returnbranch'} || "homebranch"; |
1757 |
my $hbr = GetBranchItemRule($item->{'homebranch'}, $item->{'itype'})->{'returnbranch'} || "homebranch"; |
1750 |
# get the proper branch to which to return the item |
1758 |
# get the proper branch to which to return the item |
1751 |
$hbr = $item->{$hbr} || $branch ; |
1759 |
my $returnbranch = $item->{$hbr} || $branch ; |
1752 |
# if $hbr was "noreturn" or any other non-item table value, then it should 'float' (i.e. stay at this branch) |
1760 |
# if $hbr was "noreturn" or any other non-item table value, then it should 'float' (i.e. stay at this branch) |
1753 |
|
1761 |
|
1754 |
my $borrowernumber = $borrower->{'borrowernumber'} || undef; # we don't know if we had a borrower or not |
1762 |
my $borrowernumber = $borrower->{'borrowernumber'} || undef; # we don't know if we had a borrower or not |
1755 |
|
1763 |
|
1756 |
# check if the book is in a permanent collection.... |
1764 |
# check if the book is in a permanent collection.... |
1757 |
# FIXME -- This 'PE' attribute is largely undocumented. afaict, there's no user interface that reflects this functionality. |
1765 |
# FIXME -- This 'PE' attribute is largely undocumented. afaict, there's no user interface that reflects this functionality. |
1758 |
if ( $hbr ) { |
1766 |
if ( $returnbranch ) { |
1759 |
my $branches = GetBranches(); # a potentially expensive call for a non-feature. |
1767 |
my $branches = GetBranches(); # a potentially expensive call for a non-feature. |
1760 |
$branches->{$hbr}->{PE} and $messages->{'IsPermanent'} = $hbr; |
1768 |
$branches->{$returnbranch}->{PE} and $messages->{'IsPermanent'} = $returnbranch; |
1761 |
} |
1769 |
} |
1762 |
|
1770 |
|
1763 |
# check if the return is allowed at this branch |
1771 |
# check if the return is allowed at this branch |
Lines 1929-1949
sub AddReturn {
Link Here
|
1929 |
DelUniqueDebarment({ borrowernumber => $borrowernumber, type => 'OVERDUES' }); |
1937 |
DelUniqueDebarment({ borrowernumber => $borrowernumber, type => 'OVERDUES' }); |
1930 |
} |
1938 |
} |
1931 |
|
1939 |
|
1932 |
# FIXME: make this comment intelligible. |
1940 |
# Transfer to returnbranch if Automatic transfer set or append message NeedsTransfer |
1933 |
#adding message if holdingbranch is non equal a userenv branch to return the document to homebranch |
1941 |
if (($doreturn or $messages->{'NotIssued'}) and !$resfound and ($branch ne $returnbranch) and not $messages->{'WrongTransfer'}){ |
1934 |
#we check, if we don't have reserv or transfert for this document, if not, return it to homebranch . |
1942 |
if (C4::Context->preference("AutomaticItemReturn" ) or |
1935 |
|
|
|
1936 |
if (($doreturn or $messages->{'NotIssued'}) and !$resfound and ($branch ne $hbr) and not $messages->{'WrongTransfer'}){ |
1937 |
if ( C4::Context->preference("AutomaticItemReturn" ) or |
1938 |
(C4::Context->preference("UseBranchTransferLimits") and |
1943 |
(C4::Context->preference("UseBranchTransferLimits") and |
1939 |
! IsBranchTransferAllowed($branch, $hbr, $item->{C4::Context->preference("BranchTransferLimitsType")} ) |
1944 |
! IsBranchTransferAllowed($branch, $returnbranch, $item->{C4::Context->preference("BranchTransferLimitsType")} ) |
1940 |
)) { |
1945 |
)) { |
1941 |
$debug and warn sprintf "about to call ModItemTransfer(%s, %s, %s)", $item->{'itemnumber'},$branch, $hbr; |
1946 |
$debug and warn sprintf "about to call ModItemTransfer(%s, %s, %s)", $item->{'itemnumber'},$branch, $returnbranch; |
1942 |
$debug and warn "item: " . Dumper($item); |
1947 |
$debug and warn "item: " . Dumper($item); |
1943 |
ModItemTransfer($item->{'itemnumber'}, $branch, $hbr); |
1948 |
ModItemTransfer($item->{'itemnumber'}, $branch, $returnbranch); |
1944 |
$messages->{'WasTransfered'} = 1; |
1949 |
$messages->{'WasTransfered'} = 1; |
1945 |
} else { |
1950 |
} else { |
1946 |
$messages->{'NeedsTransfer'} = 1; # TODO: instead of 1, specify branchcode that the transfer SHOULD go to, $item->{homebranch} |
1951 |
$messages->{'NeedsTransfer'} = $returnbranch; |
1947 |
} |
1952 |
} |
1948 |
} |
1953 |
} |
1949 |
return ( $doreturn, $messages, $issue, $borrower ); |
1954 |
return ( $doreturn, $messages, $issue, $borrower ); |