https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=31550
--- Comment #2 from Thibaud Guillot <[email protected]> --- Comment on attachment 140431 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=140431 Bug 31552: Add fields to get opac description on ILSDI web service >From e618b742c79ba17b4418685c229e27dd1de244c0 Mon Sep 17 00:00:00 2001 >From: Thibaud Guillot <[email protected]> >Date: Mon, 12 Sep 2022 11:04:07 +0200 >Subject: [PATCH] Bug 31550: Add fields to get opac description on ILSDI web > service > >Test plan > >1) Active your ILS-DI syspref >2) Have some authorised values linked to one or more concern >fields >3) Choose an item and go to >'cgi-bin/koha/opac/ilsdi.pl?service=GetRecords&id=<itemId>' >4) The XML file contains item fields with some of them the code associated to >the authorized values. >5) Apply this patch >6) Repeat step 3 and see the new fields with specific "_description" >suffix added and contains opac description from authorized values > >https://bugs.koha-community.org/show_bug.cgi?id=31550 >--- > C4/ILSDI/Services.pm | 13 +++++++++---- > 1 file changed, 9 insertions(+), 4 deletions(-) > >diff --git a/C4/ILSDI/Services.pm b/C4/ILSDI/Services.pm >index f6bf6bcc14..b8e23c4a5b 100644 >--- a/C4/ILSDI/Services.pm >+++ b/C4/ILSDI/Services.pm >@@ -253,10 +253,15 @@ sub GetRecords { > $item{'homebranchname'} = $home_library ? > $home_library->branchname : ''; > $item{'holdingbranchname'} = $holding_library ? > $holding_library->branchname : ''; > >- if ($item->location) { >- my $authorised_value = >Koha::AuthorisedValues->find_by_koha_field({ kohafield => 'items.location', >authorised_value => $item->location }); >- if ($authorised_value) { >- $item{location_description} = >$authorised_value->opac_description; >+ my @item_fields_description = ( 'location', 'ccode', >'permanent_location', 'notforloan', 'itemlost', 'withdrawn', 'damaged', >'restricted' ); >+ >+ foreach (@item_fields_description) { >+ >+ if ( $item->$_ ) { >+ my $authorised_value = >Koha::AuthorisedValues->find_by_koha_field( { kohafield => 'items.' . $_, >authorised_value => $item->$_ } ); >+ if ($authorised_value) { >+ $item{ $_ . _description } = >$authorised_value->opac_description; >+ } > } > } > >-- >2.25.1 -- You are receiving this mail because: You are watching all bug changes. You are the assignee for the bug. _______________________________________________ Koha-bugs mailing list [email protected] https://lists.koha-community.org/cgi-bin/mailman/listinfo/koha-bugs website : http://www.koha-community.org/ git : http://git.koha-community.org/ bugs : http://bugs.koha-community.org/
