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

(-)a/C4/Reserves.pm (-27 lines)
Lines 1289-1321 sub IsAvailableForItemLevelRequest { Link Here
1289
    }
1289
    }
1290
}
1290
}
1291
1291
1292
sub _get_itype {
1293
    my $item = shift;
1294
1295
    my $itype;
1296
    if (C4::Context->preference('item-level_itypes')) {
1297
        # We can't trust GetItem to honour the syspref, so safest to do it ourselves
1298
        # When GetItem is fixed, we can remove this
1299
        $itype = $item->{itype};
1300
    }
1301
    else {
1302
        # XXX This is a bit dodgy. It relies on biblio itemtype column having different name.
1303
        # So if we already have a biblioitems join when calling this function,
1304
        # we don't need to access the database again
1305
        $itype = $item->{itemtype};
1306
    }
1307
    unless ($itype) {
1308
        my $dbh = C4::Context->dbh;
1309
        my $query = "SELECT itemtype FROM biblioitems WHERE biblioitemnumber = ? ";
1310
        my $sth = $dbh->prepare($query);
1311
        $sth->execute($item->{biblioitemnumber});
1312
        if (my $data = $sth->fetchrow_hashref()){
1313
            $itype = $data->{itemtype};
1314
        }
1315
    }
1316
    return $itype;
1317
}
1318
1319
=head2 AlterPriority
1292
=head2 AlterPriority
1320
1293
1321
  AlterPriority( $where, $reserve_id, $prev_priority, $next_priority, $first_priority, $last_priority );
1294
  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