Bug 23233: Remove use of AllowItemsOnHoldCheckout from C4::Items::GetItemsInfo
Signed-off-by: Joonas Kylmälä <joonas.kylmala@helsinki.fi> Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org> Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
This commit is contained in:
parent
f543583926
commit
f4746340c1
2 changed files with 7 additions and 12 deletions
|
@ -948,10 +948,8 @@ sub GetItemsInfo {
|
|||
holding.branchcode,
|
||||
holding.branchname,
|
||||
holding.opac_info as holding_branch_opac_info,
|
||||
home.opac_info as home_branch_opac_info
|
||||
";
|
||||
$query .= ",IF(tmp_holdsqueue.itemnumber,1,0) AS has_pending_hold" if !C4::Context->preference('AllowItemsOnHoldCheckoutSIP');
|
||||
$query .= "
|
||||
home.opac_info as home_branch_opac_info,
|
||||
IF(tmp_holdsqueue.itemnumber,1,0) AS has_pending_hold
|
||||
FROM items
|
||||
LEFT JOIN branches AS holding ON items.holdingbranch = holding.branchcode
|
||||
LEFT JOIN branches AS home ON items.homebranch=home.branchcode
|
||||
|
@ -963,9 +961,8 @@ sub GetItemsInfo {
|
|||
LEFT JOIN serial USING (serialid)
|
||||
LEFT JOIN itemtypes ON itemtypes.itemtype = "
|
||||
. (C4::Context->preference('item-level_itypes') ? 'items.itype' : 'biblioitems.itemtype');
|
||||
$query .= "
|
||||
LEFT JOIN tmp_holdsqueue USING (itemnumber)" if !C4::Context->preference('AllowItemsOnHoldCheckoutSIP');
|
||||
$query .= q|
|
||||
LEFT JOIN tmp_holdsqueue USING (itemnumber)
|
||||
LEFT JOIN localization ON itemtypes.itemtype = localization.code
|
||||
AND localization.entity = 'itemtypes'
|
||||
AND localization.lang = ?
|
||||
|
|
|
@ -313,18 +313,16 @@ subtest 'GetItemsInfo tests' => sub {
|
|||
is( $results[0]->{ restrictedvalueopac }, "Restricted Access OPAC",
|
||||
'GetItemsInfo returns a restricted value description (OPAC)' );
|
||||
|
||||
t::lib::Mocks::mock_preference( 'AllowItemsOnHoldCheckout', 0 );
|
||||
#place item into holds queue
|
||||
my $dbh = C4::Context->dbh;
|
||||
@results = GetItemsInfo( $biblio->biblionumber );
|
||||
is( $results[0]->{ has_pending_hold }, "0",
|
||||
'Hold not marked as pending/unavailable if nothing in tmp_holdsqueue for item' );
|
||||
|
||||
$dbh->do(q{INSERT INTO tmp_holdsqueue (biblionumber, itemnumber, surname, borrowernumber ) VALUES (?, ?, "Zorro", 42)}, undef, $item_bibnum, $itemnumber);
|
||||
@results = GetItemsInfo( $biblio->biblionumber );
|
||||
is( $results[0]->{ has_pending_hold }, "1",
|
||||
'Hold marked as pending/unavailable if not AllowItemsOnHoldCheckout' );
|
||||
t::lib::Mocks::mock_preference( 'AllowItemsOnHoldCheckout', 1 );
|
||||
@results = GetItemsInfo( $biblio->biblionumber );
|
||||
is( $results[0]->{ has_pending_hold }, undef,
|
||||
'Hold not marked as pending/unavailable if AllowItemsOnHoldCheckout' );
|
||||
|
||||
|
||||
$schema->storage->txn_rollback;
|
||||
};
|
||||
|
|
Loading…
Reference in a new issue