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

Return to bug 19300