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

(-)a/C4/Items.pm (-6 / +3 lines)
Lines 948-957 sub GetItemsInfo { Link Here
948
           holding.branchcode,
948
           holding.branchcode,
949
           holding.branchname,
949
           holding.branchname,
950
           holding.opac_info as holding_branch_opac_info,
950
           holding.opac_info as holding_branch_opac_info,
951
           home.opac_info as home_branch_opac_info
951
           home.opac_info as home_branch_opac_info,
952
    ";
952
           IF(tmp_holdsqueue.itemnumber,1,0) AS has_pending_hold
953
    $query .= ",IF(tmp_holdsqueue.itemnumber,1,0) AS has_pending_hold" if !C4::Context->preference('AllowItemsOnHoldCheckoutSIP');
954
    $query .= "
955
     FROM items
953
     FROM items
956
     LEFT JOIN branches AS holding ON items.holdingbranch = holding.branchcode
954
     LEFT JOIN branches AS holding ON items.holdingbranch = holding.branchcode
957
     LEFT JOIN branches AS home ON items.homebranch=home.branchcode
955
     LEFT JOIN branches AS home ON items.homebranch=home.branchcode
Lines 963-971 sub GetItemsInfo { Link Here
963
     LEFT JOIN serial USING (serialid)
961
     LEFT JOIN serial USING (serialid)
964
     LEFT JOIN itemtypes   ON   itemtypes.itemtype         = "
962
     LEFT JOIN itemtypes   ON   itemtypes.itemtype         = "
965
     . (C4::Context->preference('item-level_itypes') ? 'items.itype' : 'biblioitems.itemtype');
963
     . (C4::Context->preference('item-level_itypes') ? 'items.itype' : 'biblioitems.itemtype');
966
    $query .= "
967
    LEFT JOIN tmp_holdsqueue USING (itemnumber)" if !C4::Context->preference('AllowItemsOnHoldCheckoutSIP');
968
    $query .= q|
964
    $query .= q|
965
    LEFT JOIN tmp_holdsqueue USING (itemnumber)
969
    LEFT JOIN localization ON itemtypes.itemtype = localization.code
966
    LEFT JOIN localization ON itemtypes.itemtype = localization.code
970
        AND localization.entity = 'itemtypes'
967
        AND localization.entity = 'itemtypes'
971
        AND localization.lang = ?
968
        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