View | Details | Raw Unified | Return to bug 19300
Collapse All | Expand All

(-)a/C4/Reserves.pm (-51 lines)
Lines 127-134 BEGIN { Link Here
127
127
128
        &IsAvailableForItemLevelRequest
128
        &IsAvailableForItemLevelRequest
129
129
130
        &OPACItemHoldsAllowed
131
132
        &AlterPriority
130
        &AlterPriority
133
        &ToggleLowestPriority
131
        &ToggleLowestPriority
134
132
Lines 1752-1805 sub _ShiftPriorityByDateAndPriority { Link Here
1752
    return $new_priority;  # so the caller knows what priority they wind up receiving
1750
    return $new_priority;  # so the caller knows what priority they wind up receiving
1753
}
1751
}
1754
1752
1755
=head2 OPACItemHoldsAllowed
1756
1757
  OPACItemHoldsAllowed($item_record,$borrower_record);
1758
1759
Checks issuingrules, using the borrowers categorycode, the itemtype, and branchcode to see
1760
if specific item holds are allowed, returns true if so.
1761
1762
=cut
1763
1764
sub OPACItemHoldsAllowed {
1765
    my ($item,$borrower) = @_;
1766
1767
    my $branchcode = $item->{homebranch} or die "No homebranch";
1768
    my $itype;
1769
    my $dbh = C4::Context->dbh;
1770
    if (C4::Context->preference('item-level_itypes')) {
1771
       # We can't trust GetItem to honour the syspref, so safest to do it ourselves
1772
       # When GetItem is fixed, we can remove this
1773
       $itype = $item->{itype};
1774
    }
1775
    else {
1776
       my $query = "SELECT itemtype FROM biblioitems WHERE biblioitemnumber = ? ";
1777
       my $sth = $dbh->prepare($query);
1778
       $sth->execute($item->{biblioitemnumber});
1779
       if (my $data = $sth->fetchrow_hashref()){
1780
           $itype = $data->{itemtype};
1781
       }
1782
    }
1783
1784
    my $query = "SELECT opacitemholds,categorycode,itemtype,branchcode FROM issuingrules WHERE
1785
          (issuingrules.categorycode = ? OR issuingrules.categorycode = '*')
1786
        AND
1787
          (issuingrules.itemtype = ? OR issuingrules.itemtype = '*')
1788
        AND
1789
          (issuingrules.branchcode = ? OR issuingrules.branchcode = '*')
1790
        ORDER BY
1791
          issuingrules.categorycode desc,
1792
          issuingrules.itemtype desc,
1793
          issuingrules.branchcode desc
1794
       LIMIT 1";
1795
    my $sth = $dbh->prepare($query);
1796
    $sth->execute($borrower->{categorycode},$itype,$branchcode);
1797
    my $data = $sth->fetchrow_hashref;
1798
    my $opacitemholds = uc substr ($data->{opacitemholds}, 0, 1);
1799
    return '' if $opacitemholds eq 'N';
1800
    return $opacitemholds;
1801
}
1802
1803
=head2 MoveReserve
1753
=head2 MoveReserve
1804
1754
1805
  MoveReserve( $itemnumber, $borrowernumber, $cancelreserve )
1755
  MoveReserve( $itemnumber, $borrowernumber, $cancelreserve )
1806
- 

Return to bug 19300