From 542ac21b94a8eec05b3f194f5ffbe4e19f511738 Mon Sep 17 00:00:00 2001 From: Tomas Cohen Arazi Date: Thu, 11 May 2017 13:07:37 -0300 Subject: [PATCH] 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 Signed-off-by: Marcel de Rooy Signed-off-by: Kyle M Hall --- 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 2f23036212..e42ba0272b 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.39.5