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

(-)a/C4/Reserves.pm (-51 lines)
Lines 126-133 BEGIN { Link Here
126
126
127
        &IsAvailableForItemLevelRequest
127
        &IsAvailableForItemLevelRequest
128
128
129
        &OPACItemHoldsAllowed
130
131
        &AlterPriority
129
        &AlterPriority
132
        &ToggleLowestPriority
130
        &ToggleLowestPriority
133
131
Lines 1723-1776 sub _ShiftPriorityByDateAndPriority { Link Here
1723
    return $new_priority;  # so the caller knows what priority they wind up receiving
1721
    return $new_priority;  # so the caller knows what priority they wind up receiving
1724
}
1722
}
1725
1723
1726
=head2 OPACItemHoldsAllowed
1727
1728
  OPACItemHoldsAllowed($item_record,$borrower_record);
1729
1730
Checks issuingrules, using the borrowers categorycode, the itemtype, and branchcode to see
1731
if specific item holds are allowed, returns true if so.
1732
1733
=cut
1734
1735
sub OPACItemHoldsAllowed {
1736
    my ($item,$borrower) = @_;
1737
1738
    my $branchcode = $item->{homebranch} or die "No homebranch";
1739
    my $itype;
1740
    my $dbh = C4::Context->dbh;
1741
    if (C4::Context->preference('item-level_itypes')) {
1742
       # We can't trust GetItem to honour the syspref, so safest to do it ourselves
1743
       # When GetItem is fixed, we can remove this
1744
       $itype = $item->{itype};
1745
    }
1746
    else {
1747
       my $query = "SELECT itemtype FROM biblioitems WHERE biblioitemnumber = ? ";
1748
       my $sth = $dbh->prepare($query);
1749
       $sth->execute($item->{biblioitemnumber});
1750
       if (my $data = $sth->fetchrow_hashref()){
1751
           $itype = $data->{itemtype};
1752
       }
1753
    }
1754
1755
    my $query = "SELECT opacitemholds,categorycode,itemtype,branchcode FROM issuingrules WHERE
1756
          (issuingrules.categorycode = ? OR issuingrules.categorycode = '*')
1757
        AND
1758
          (issuingrules.itemtype = ? OR issuingrules.itemtype = '*')
1759
        AND
1760
          (issuingrules.branchcode = ? OR issuingrules.branchcode = '*')
1761
        ORDER BY
1762
          issuingrules.categorycode desc,
1763
          issuingrules.itemtype desc,
1764
          issuingrules.branchcode desc
1765
       LIMIT 1";
1766
    my $sth = $dbh->prepare($query);
1767
    $sth->execute($borrower->{categorycode},$itype,$branchcode);
1768
    my $data = $sth->fetchrow_hashref;
1769
    my $opacitemholds = uc substr ($data->{opacitemholds}, 0, 1);
1770
    return '' if $opacitemholds eq 'N';
1771
    return $opacitemholds;
1772
}
1773
1774
=head2 MoveReserve
1724
=head2 MoveReserve
1775
1725
1776
  MoveReserve( $itemnumber, $borrowernumber, $cancelreserve )
1726
  MoveReserve( $itemnumber, $borrowernumber, $cancelreserve )
1777
- 

Return to bug 19300