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