Bugzilla – Attachment 188702 Details for
Bug 31550
ILS-DI: Add OPAC description for some item fields
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 31550: Add fields to get opac description on ILSDI web service
Bug-31550-Add-fields-to-get-opac-description-on-IL.patch (text/plain), 3.93 KB, created by
David Nind
on 2025-10-30 17:39:57 UTC
(
hide
)
Description:
Bug 31550: Add fields to get opac description on ILSDI web service
Filename:
MIME Type:
Creator:
David Nind
Created:
2025-10-30 17:39:57 UTC
Size:
3.93 KB
patch
obsolete
>From 9dcf2e1bb89fa7aaaa4b369d582dd6124bc1ba54 Mon Sep 17 00:00:00 2001 >From: Thibaud Guillot <thibaud.guillot@biblibre.com> >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 > >Sponsored-by: BibLibre >Signed-off-by: David Nind <david@davidnind.com> >--- > C4/ILSDI/Services.pm | 20 +++++++++++++++----- > t/db_dependent/AuthorisedValues.t | 12 ++++++++++-- > 2 files changed, 25 insertions(+), 7 deletions(-) > >diff --git a/C4/ILSDI/Services.pm b/C4/ILSDI/Services.pm >index 597a9ddd1d..0269bc111b 100644 >--- a/C4/ILSDI/Services.pm >+++ b/C4/ILSDI/Services.pm >@@ -262,11 +262,21 @@ sub GetRecords { > $item{'homebranchname'} = $home_library ? $home_library->branchname : ''; > $item{'holdingbranchname'} = $holding_library ? $holding_library->branchname : ''; > >- if ( $item->location ) { >- my $authorised_value = Koha::AuthorisedValues->get_description_by_koha_field( >- { frameworkcode => '', kohafield => 'items.location', authorised_value => $item->location } ); >- if ($authorised_value) { >- $item{location_description} = $authorised_value->{opac_description}; >+ my $item_strings = $item->strings_map; >+ foreach my $field ( keys %{$item_strings} ) { >+ if ( $item->$field ) { >+ my $authorised_value = >+ Koha::AuthorisedValues->get_description_by_koha_field( >+ { >+ frameworkcode => '', >+ kohafield => 'items.' . $field, >+ authorised_value => $item->$field >+ } >+ ); >+ if ($authorised_value) { >+ $item{ $field . '_description' } = >+ $authorised_value->{opac_description}; >+ } > } > } > >diff --git a/t/db_dependent/AuthorisedValues.t b/t/db_dependent/AuthorisedValues.t >index 069614504a..08f09efca4 100755 >--- a/t/db_dependent/AuthorisedValues.t >+++ b/t/db_dependent/AuthorisedValues.t >@@ -228,8 +228,7 @@ subtest 'search_by_*_field + find_by_koha_field + get_description + authorised_v > > }; > subtest 'find_by_koha_field' => sub { >- plan tests => 3; >- >+ plan tests => 4; > # Test authorised_value = 0 > my $av; > $av = Koha::AuthorisedValues->find_by_koha_field( { kohafield => 'items.restricted', authorised_value => 0 } ); >@@ -243,6 +242,15 @@ subtest 'search_by_*_field + find_by_koha_field + get_description + authorised_v > $av = Koha::AuthorisedValues->find_by_koha_field( > { kohafield => 'items.restricted', authorised_value => undef } ); > is( $av, undef, ); >+ # Test get authorised_value->opac_description if kohafield is in array >+ my @authorised_kohafields = ( 'location', 'ccode', 'permanent_location', 'notforloan', 'itemlost', 'withdrawn', 'damaged', 'restricted' ); >+ foreach my $kohafield (@authorised_kohafields) { >+ $av = Koha::AuthorisedValues->find_by_koha_field( { kohafield => 'items.' . $kohafield, authorised_value => 'location_1' } ); >+ if ($av) { >+ is( >+ $av->opac_description, 'location_1', "items.$kohafield description added correctly" ); >+ } >+ } > }; > subtest 'get_description_by_koha_field' => sub { > plan tests => 4; >-- >2.39.5
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
|
Splinter Review
Attachments on
bug 31550
:
140431
|
140432
|
144979
|
145041
|
145042
|
154370
|
154371
|
154372
|
154373
|
154374
|
154858
|
154859
|
154860
|
188560
| 188702