From 8d97ce35f75009130d93021223686b61f3c6eb87 Mon Sep 17 00:00:00 2001 From: Tomas Cohen Arazi Date: Thu, 11 May 2017 13:07:37 -0300 Subject: [PATCH] [SIGNED OFF] Bug 18579: Make EmbedItemsAvailability handle control fields correctly This patch makes the EmbedItemsAvailability filter handle the biblio.biblionumber > control field mapping gracefully. Right now, it was assuming a regular data field was used, and such is not the case for UNIMARC (001). To test: - Apply the tests patch - Run: $ sudo koha-shell kohadev k$ cd kohaclone k$ prove t/db_dependent/Koha/Filter/EmbedItemsAvailability.t => FAIL: Tests fail to run - Apply this patch - Run: k$ prove t/db_dependent/Koha/Filter/EmbedItemsAvailability.t => SUCCESS: Tests pass! - Sign off :-D Sponsored-by: ByWater Solutions Signed-off-by: Katrin Fischer --- Koha/Filter/MARC/EmbedItemsAvailability.pm | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/Koha/Filter/MARC/EmbedItemsAvailability.pm b/Koha/Filter/MARC/EmbedItemsAvailability.pm index 2f23036..e42ba02 100644 --- a/Koha/Filter/MARC/EmbedItemsAvailability.pm +++ b/Koha/Filter/MARC/EmbedItemsAvailability.pm @@ -72,7 +72,9 @@ sub _processrecord { my $record = shift; my ($biblionumber_field, $biblionumber_subfield) = GetMarcFromKohaField("biblio.biblionumber", ''); - my $biblionumber = $record->field($biblionumber_field)->subfield($biblionumber_subfield); + my $biblionumber = ( $biblionumber_field > 9 ) + ? $record->field($biblionumber_field)->subfield($biblionumber_subfield) + : $record->field($biblionumber_field)->data(); my $not_onloan_items = Koha::Items->search({ biblionumber => $biblionumber, -- 2.7.4