|
Lines 1620-1625
holdallowed => Hold policy for this branch and itemtype. Possible values:
Link Here
|
| 1620 |
returnbranch => branch to which to return item. Possible values: |
1620 |
returnbranch => branch to which to return item. Possible values: |
| 1621 |
noreturn: do not return, let item remain where checked in (floating collections) |
1621 |
noreturn: do not return, let item remain where checked in (floating collections) |
| 1622 |
homebranch: return to item's home branch |
1622 |
homebranch: return to item's home branch |
|
|
1623 |
holdingbranch: return to issuer branch |
| 1623 |
|
1624 |
|
| 1624 |
This searches branchitemrules in the following order: |
1625 |
This searches branchitemrules in the following order: |
| 1625 |
|
1626 |
|
|
Lines 1738-1743
fields from the reserves table of the Koha database, and
Link Here
|
| 1738 |
C<biblioitemnumber>. It also has the key C<ResFound>, whose value is |
1739 |
C<biblioitemnumber>. It also has the key C<ResFound>, whose value is |
| 1739 |
either C<Waiting>, C<Reserved>, or 0. |
1740 |
either C<Waiting>, C<Reserved>, or 0. |
| 1740 |
|
1741 |
|
|
|
1742 |
=item C<WasReturned> |
| 1743 |
|
| 1744 |
Value 1 if return is successful. |
| 1745 |
|
| 1746 |
=item C<NeedsTransfer> |
| 1747 |
|
| 1748 |
If AutomaticItemReturn is disabled, return branch is given as value of NeedsTransfer. |
| 1749 |
|
| 1741 |
=back |
1750 |
=back |
| 1742 |
|
1751 |
|
| 1743 |
C<$iteminformation> is a reference-to-hash, giving information about the |
1752 |
C<$iteminformation> is a reference-to-hash, giving information about the |
|
Lines 1769-1775
sub AddReturn {
Link Here
|
| 1769 |
return (0, { BadBarcode => $barcode }); # no barcode means no item or borrower. bail out. |
1778 |
return (0, { BadBarcode => $barcode }); # no barcode means no item or borrower. bail out. |
| 1770 |
} |
1779 |
} |
| 1771 |
my $issue = GetItemIssue($itemnumber); |
1780 |
my $issue = GetItemIssue($itemnumber); |
| 1772 |
# warn Dumper($iteminformation); |
1781 |
|
| 1773 |
if ($issue and $issue->{borrowernumber}) { |
1782 |
if ($issue and $issue->{borrowernumber}) { |
| 1774 |
$borrower = C4::Members::GetMemberDetails($issue->{borrowernumber}) |
1783 |
$borrower = C4::Members::GetMemberDetails($issue->{borrowernumber}) |
| 1775 |
or die "Data inconsistency: barcode $barcode (itemnumber:$itemnumber) claims to be issued to non-existant borrowernumber '$issue->{borrowernumber}'\n" |
1784 |
or die "Data inconsistency: barcode $barcode (itemnumber:$itemnumber) claims to be issued to non-existant borrowernumber '$issue->{borrowernumber}'\n" |
|
Lines 1789-1797
sub AddReturn {
Link Here
|
| 1789 |
my $item = GetItem($itemnumber) or die "GetItem($itemnumber) failed"; |
1798 |
my $item = GetItem($itemnumber) or die "GetItem($itemnumber) failed"; |
| 1790 |
# full item data, but no borrowernumber or checkout info (no issue) |
1799 |
# full item data, but no borrowernumber or checkout info (no issue) |
| 1791 |
# we know GetItem should work because GetItemnumberFromBarcode worked |
1800 |
# we know GetItem should work because GetItemnumberFromBarcode worked |
| 1792 |
my $hbr = GetBranchItemRule($item->{'homebranch'}, $item->{'itype'})->{'returnbranch'} || "homebranch"; |
1801 |
my $hbr = GetBranchItemRule($item->{'homebranch'}, $item->{'itype'})->{'returnbranch'} || "homebranch"; |
| 1793 |
# get the proper branch to which to return the item |
1802 |
# get the proper branch to which to return the item |
| 1794 |
$hbr = $item->{$hbr} || $branch ; |
1803 |
my $returnbranch = $item->{$hbr} || $branch ; |
| 1795 |
# if $hbr was "noreturn" or any other non-item table value, then it should 'float' (i.e. stay at this branch) |
1804 |
# if $hbr was "noreturn" or any other non-item table value, then it should 'float' (i.e. stay at this branch) |
| 1796 |
|
1805 |
|
| 1797 |
my $borrowernumber = $borrower->{'borrowernumber'} || undef; # we don't know if we had a borrower or not |
1806 |
my $borrowernumber = $borrower->{'borrowernumber'} || undef; # we don't know if we had a borrower or not |
|
Lines 1818-1826
sub AddReturn {
Link Here
|
| 1818 |
|
1827 |
|
| 1819 |
# check if the book is in a permanent collection.... |
1828 |
# check if the book is in a permanent collection.... |
| 1820 |
# FIXME -- This 'PE' attribute is largely undocumented. afaict, there's no user interface that reflects this functionality. |
1829 |
# FIXME -- This 'PE' attribute is largely undocumented. afaict, there's no user interface that reflects this functionality. |
| 1821 |
if ( $hbr ) { |
1830 |
if ( $returnbranch ) { |
| 1822 |
my $branches = GetBranches(); # a potentially expensive call for a non-feature. |
1831 |
my $branches = GetBranches(); # a potentially expensive call for a non-feature. |
| 1823 |
$branches->{$hbr}->{PE} and $messages->{'IsPermanent'} = $hbr; |
1832 |
$branches->{$returnbranch}->{PE} and $messages->{'IsPermanent'} = $returnbranch; |
| 1824 |
} |
1833 |
} |
| 1825 |
|
1834 |
|
| 1826 |
# check if the return is allowed at this branch |
1835 |
# check if the return is allowed at this branch |
|
Lines 2019-2039
sub AddReturn {
Link Here
|
| 2019 |
DelUniqueDebarment({ borrowernumber => $borrowernumber, type => 'OVERDUES' }); |
2028 |
DelUniqueDebarment({ borrowernumber => $borrowernumber, type => 'OVERDUES' }); |
| 2020 |
} |
2029 |
} |
| 2021 |
|
2030 |
|
| 2022 |
# FIXME: make this comment intelligible. |
2031 |
# Transfer to returnbranch if Automatic transfer set or append message NeedsTransfer |
| 2023 |
#adding message if holdingbranch is non equal a userenv branch to return the document to homebranch |
2032 |
if (($doreturn or $messages->{'NotIssued'}) and !$resfound and ($branch ne $returnbranch) and not $messages->{'WrongTransfer'}){ |
| 2024 |
#we check, if we don't have reserv or transfert for this document, if not, return it to homebranch . |
2033 |
if (C4::Context->preference("AutomaticItemReturn" ) or |
| 2025 |
|
|
|
| 2026 |
if ( !$is_in_rotating_collection && ($doreturn or $messages->{'NotIssued'}) and !$resfound and ($branch ne $hbr) and not $messages->{'WrongTransfer'}){ |
| 2027 |
if ( C4::Context->preference("AutomaticItemReturn" ) or |
| 2028 |
(C4::Context->preference("UseBranchTransferLimits") and |
2034 |
(C4::Context->preference("UseBranchTransferLimits") and |
| 2029 |
! IsBranchTransferAllowed($branch, $hbr, $item->{C4::Context->preference("BranchTransferLimitsType")} ) |
2035 |
! IsBranchTransferAllowed($branch, $returnbranch, $item->{C4::Context->preference("BranchTransferLimitsType")} ) |
| 2030 |
)) { |
2036 |
)) { |
| 2031 |
$debug and warn sprintf "about to call ModItemTransfer(%s, %s, %s)", $item->{'itemnumber'},$branch, $hbr; |
2037 |
$debug and warn sprintf "about to call ModItemTransfer(%s, %s, %s)", $item->{'itemnumber'},$branch, $returnbranch; |
| 2032 |
$debug and warn "item: " . Dumper($item); |
2038 |
$debug and warn "item: " . Dumper($item); |
| 2033 |
ModItemTransfer($item->{'itemnumber'}, $branch, $hbr); |
2039 |
ModItemTransfer($item->{'itemnumber'}, $branch, $returnbranch); |
| 2034 |
$messages->{'WasTransfered'} = 1; |
2040 |
$messages->{'WasTransfered'} = 1; |
| 2035 |
} else { |
2041 |
} else { |
| 2036 |
$messages->{'NeedsTransfer'} = 1; # TODO: instead of 1, specify branchcode that the transfer SHOULD go to, $item->{homebranch} |
2042 |
$messages->{'NeedsTransfer'} = $returnbranch; |
| 2037 |
} |
2043 |
} |
| 2038 |
} |
2044 |
} |
| 2039 |
|
2045 |
|
| 2040 |
- |
|
|