bug 5825: (follow-up) consult item-level_itypes

This patch teaches GetHoldsQueueItems to consult
the item-level_itypes system preference and return
the item-level or bib-level item type accordingly.

To test:

- Arrange so that an item that shows up on the holds queue
  report has one item type while its bib has a different one.
- Run the report with item-level_itypes ON.  Verify that
  the item-level item type is displayed.
- Change item-level_itypes to OFF.  Run the report again and
  verify that the bib-level item type is displayed.

Signed-off-by: Galen Charlton <gmc@esilibrary.com>
This commit is contained in:
Galen Charlton 2013-08-16 15:36:10 +00:00
parent 572d46e639
commit 484b7ec732

View file

@ -119,7 +119,7 @@ sub GetHoldsQueueItems {
my $dbh = C4::Context->dbh;
my @bind_params = ();
my $query = q/SELECT tmp_holdsqueue.*, biblio.author, items.ccode, items.itype, items.location, items.enumchron, items.cn_sort, biblioitems.publishercode,biblio.copyrightdate,biblioitems.publicationyear,biblioitems.pages,biblioitems.size,biblioitems.publicationyear,biblioitems.isbn,items.copynumber
my $query = q/SELECT tmp_holdsqueue.*, biblio.author, items.ccode, items.itype, biblioitems.itemtype, items.location, items.enumchron, items.cn_sort, biblioitems.publishercode,biblio.copyrightdate,biblioitems.publicationyear,biblioitems.pages,biblioitems.size,biblioitems.publicationyear,biblioitems.isbn,items.copynumber
FROM tmp_holdsqueue
JOIN biblio USING (biblionumber)
LEFT JOIN biblioitems USING (biblionumber)
@ -141,6 +141,13 @@ sub GetHoldsQueueItems {
$row->{parts} = GetRecordValue('parts',$record,'')->[0]->{subfield};
$row->{numbers} = GetRecordValue('numbers',$record,'')->[0]->{subfield};
}
# return the bib-level or item-level itype per syspref
if (!C4::Context->preference('item-level_itypes')) {
$row->{itype} = $row->{itemtype};
}
delete $row->{itemtype};
push @$items, $row;
}
return $items;