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

(-)a/C4/Items.pm (-6 / +3 lines)
Lines 942-951 sub GetItemsInfo { Link Here
942
           holding.branchcode,
942
           holding.branchcode,
943
           holding.branchname,
943
           holding.branchname,
944
           holding.opac_info as holding_branch_opac_info,
944
           holding.opac_info as holding_branch_opac_info,
945
           home.opac_info as home_branch_opac_info
945
           home.opac_info as home_branch_opac_info,
946
    ";
946
           IF(tmp_holdsqueue.itemnumber,1,0) AS has_pending_hold
947
    $query .= ",IF(tmp_holdsqueue.itemnumber,1,0) AS has_pending_hold" if !C4::Context->preference('AllowItemsOnHoldCheckoutSIP');
948
    $query .= "
949
     FROM items
947
     FROM items
950
     LEFT JOIN branches AS holding ON items.holdingbranch = holding.branchcode
948
     LEFT JOIN branches AS holding ON items.holdingbranch = holding.branchcode
951
     LEFT JOIN branches AS home ON items.homebranch=home.branchcode
949
     LEFT JOIN branches AS home ON items.homebranch=home.branchcode
Lines 957-965 sub GetItemsInfo { Link Here
957
     LEFT JOIN serial USING (serialid)
955
     LEFT JOIN serial USING (serialid)
958
     LEFT JOIN itemtypes   ON   itemtypes.itemtype         = "
956
     LEFT JOIN itemtypes   ON   itemtypes.itemtype         = "
959
     . (C4::Context->preference('item-level_itypes') ? 'items.itype' : 'biblioitems.itemtype');
957
     . (C4::Context->preference('item-level_itypes') ? 'items.itype' : 'biblioitems.itemtype');
960
    $query .= "
961
    LEFT JOIN tmp_holdsqueue USING (itemnumber)" if !C4::Context->preference('AllowItemsOnHoldCheckoutSIP');
962
    $query .= q|
958
    $query .= q|
959
    LEFT JOIN tmp_holdsqueue USING (itemnumber)
963
    LEFT JOIN localization ON itemtypes.itemtype = localization.code
960
    LEFT JOIN localization ON itemtypes.itemtype = localization.code
964
        AND localization.entity = 'itemtypes'
961
        AND localization.entity = 'itemtypes'
965
        AND localization.lang = ?
962
        AND localization.lang = ?
(-)a/t/db_dependent/Items.t (-7 / +4 lines)
Lines 313-330 subtest 'GetItemsInfo tests' => sub { Link Here
313
    is( $results[0]->{ restrictedvalueopac }, "Restricted Access OPAC",
313
    is( $results[0]->{ restrictedvalueopac }, "Restricted Access OPAC",
314
        'GetItemsInfo returns a restricted value description (OPAC)' );
314
        'GetItemsInfo returns a restricted value description (OPAC)' );
315
315
316
    t::lib::Mocks::mock_preference( 'AllowItemsOnHoldCheckout', 0 );
317
    #place item into holds queue
316
    #place item into holds queue
318
    my $dbh = C4::Context->dbh;
317
    my $dbh = C4::Context->dbh;
318
    @results = GetItemsInfo( $biblio->biblionumber );
319
    is( $results[0]->{ has_pending_hold }, "0",
320
        'Hold not marked as pending/unavailable if nothing in tmp_holdsqueue for item' );
321
319
    $dbh->do(q{INSERT INTO tmp_holdsqueue (biblionumber, itemnumber, surname, borrowernumber ) VALUES (?, ?, "Zorro", 42)}, undef, $item_bibnum, $itemnumber);
322
    $dbh->do(q{INSERT INTO tmp_holdsqueue (biblionumber, itemnumber, surname, borrowernumber ) VALUES (?, ?, "Zorro", 42)}, undef, $item_bibnum, $itemnumber);
320
    @results = GetItemsInfo( $biblio->biblionumber );
323
    @results = GetItemsInfo( $biblio->biblionumber );
321
    is( $results[0]->{ has_pending_hold }, "1",
324
    is( $results[0]->{ has_pending_hold }, "1",
322
        'Hold marked as pending/unavailable if not AllowItemsOnHoldCheckout' );
325
        'Hold marked as pending/unavailable if not AllowItemsOnHoldCheckout' );
323
    t::lib::Mocks::mock_preference( 'AllowItemsOnHoldCheckout', 1 );
324
    @results = GetItemsInfo( $biblio->biblionumber );
325
    is( $results[0]->{ has_pending_hold }, undef,
326
        'Hold not marked as pending/unavailable if AllowItemsOnHoldCheckout' );
327
328
326
329
    $schema->storage->txn_rollback;
327
    $schema->storage->txn_rollback;
330
};
328
};
331
- 

Return to bug 23233