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

(-)a/C4/Reserves.pm (-27 lines)
Lines 1288-1320 sub IsAvailableForItemLevelRequest { Link Here
1288
    }
1288
    }
1289
}
1289
}
1290
1290
1291
sub _get_itype {
1292
    my $item = shift;
1293
1294
    my $itype;
1295
    if (C4::Context->preference('item-level_itypes')) {
1296
        # We can't trust GetItem to honour the syspref, so safest to do it ourselves
1297
        # When GetItem is fixed, we can remove this
1298
        $itype = $item->{itype};
1299
    }
1300
    else {
1301
        # XXX This is a bit dodgy. It relies on biblio itemtype column having different name.
1302
        # So if we already have a biblioitems join when calling this function,
1303
        # we don't need to access the database again
1304
        $itype = $item->{itemtype};
1305
    }
1306
    unless ($itype) {
1307
        my $dbh = C4::Context->dbh;
1308
        my $query = "SELECT itemtype FROM biblioitems WHERE biblioitemnumber = ? ";
1309
        my $sth = $dbh->prepare($query);
1310
        $sth->execute($item->{biblioitemnumber});
1311
        if (my $data = $sth->fetchrow_hashref()){
1312
            $itype = $data->{itemtype};
1313
        }
1314
    }
1315
    return $itype;
1316
}
1317
1318
=head2 AlterPriority
1291
=head2 AlterPriority
1319
1292
1320
  AlterPriority( $where, $reserve_id, $prev_priority, $next_priority, $first_priority, $last_priority );
1293
  AlterPriority( $where, $reserve_id, $prev_priority, $next_priority, $first_priority, $last_priority );
(-)a/t/db_dependent/Reserves.t (-3 / +1 lines)
Lines 630-642 my $limit = Koha::Item::Transfer::Limit->new( Link Here
630
is( C4::Reserves::IsAvailableForItemLevelRequest($item, $patron, $pickup_branch), 0, "Item level request not available due to transfer limit" );
630
is( C4::Reserves::IsAvailableForItemLevelRequest($item, $patron, $pickup_branch), 0, "Item level request not available due to transfer limit" );
631
t::lib::Mocks::mock_preference( 'UseBranchTransferLimits',  '0' );
631
t::lib::Mocks::mock_preference( 'UseBranchTransferLimits',  '0' );
632
632
633
my $itype = C4::Reserves::_get_itype($item);
634
my $categorycode = $borrower->{categorycode};
633
my $categorycode = $borrower->{categorycode};
635
my $holdingbranch = $item->{holdingbranch};
634
my $holdingbranch = $item->{holdingbranch};
636
Koha::CirculationRules->set_rules(
635
Koha::CirculationRules->set_rules(
637
    {
636
    {
638
        categorycode => $categorycode,
637
        categorycode => $categorycode,
639
        itemtype     => $itype,
638
        itemtype     => $item->effective_itemtype,
640
        branchcode   => $holdingbranch,
639
        branchcode   => $holdingbranch,
641
        rules => {
640
        rules => {
642
            onshelfholds => 1,
641
            onshelfholds => 1,
643
- 

Return to bug 24468