Bugzilla – Attachment 180825 Details for
Bug 39610
Allow for customizing the metadata shown on OPAC ILL request table
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 39610: Make ILL request metadata fields shown in OPAC table configurable
Bug-39610-Make-ILL-request-metadata-fields-shown-i.patch (text/plain), 5.56 KB, created by
HKS3 Tadeusz Sośnierz
on 2025-04-11 10:39:02 UTC
(
hide
)
Description:
Bug 39610: Make ILL request metadata fields shown in OPAC table configurable
Filename:
MIME Type:
Creator:
HKS3 Tadeusz Sośnierz
Created:
2025-04-11 10:39:02 UTC
Size:
5.56 KB
patch
obsolete
>From dee86df99022bd341e630687de34c481f7272d8d Mon Sep 17 00:00:00 2001 >From: =?UTF-8?q?Tadeusz=20=E2=80=9Etadzik=E2=80=9D=20So=C5=9Bnierz?= > <tadeusz@sosnierz.com> >Date: Fri, 7 Mar 2025 12:12:45 +0100 >Subject: [PATCH] Bug 39610: Make ILL request metadata fields shown in OPAC > table configurable > >Test plan: > >1. In KTD, go to http://localhost:8081/cgi-bin/koha/admin/preferences.pl?tab=&op=search&searchfield=master+switch and enable the ILL module >2. Run the following script to populate the request list for user `koha`: > > use strict; > use warnings; > > use Koha::ILL::Request; > > my $backend = 'Standard'; > my $branchcode = 'CPL'; > > for my $n (1..100) { > my $req = Koha::ILL::Request->new->load_backend($backend); > my $fields = $req->_backend->_get_core_fields(); > my @extended_attributes = map { +{ type => $_, value => "$_ for $n" } } keys %$fields; > $req->_backend->create_api({ > backend => $backend, > branchcode => $branchcode, > borrowernumber => 51, > type => 'book', > extended_attributes => \@extended_attributes, > }, $req); > } > >3. Navigate to http://localhost:8080/cgi-bin/koha/opac-illrequests.pl, log in as `koha` as needed >4. Observe only the default Author and Title being displayed >5. Go to http://localhost:8081/cgi-bin/koha/admin/preferences.pl?tab=&op=search&searchfield=ILLOpacMetadataFields > and set `author|article_author(Article Author)` as the new value >6. On http://localhost:8080/cgi-bin/koha/opac-illrequests.pl, observe how the configured metadata values are now shown, with configured names > >Sponsored-by: Wiko (https://www.wiko-berlin.de/) >--- > .../admin/preferences/interlibrary_loans.pref | 6 ++++++ > .../bootstrap/en/modules/opac-illrequests.tt | 18 +++++++----------- > opac/opac-illrequests.pl | 9 ++++++++- > 3 files changed, 21 insertions(+), 12 deletions(-) > >diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences/interlibrary_loans.pref b/koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences/interlibrary_loans.pref >index 44d8a9e83a..99440ca740 100644 >--- a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences/interlibrary_loans.pref >+++ b/koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences/interlibrary_loans.pref >@@ -48,6 +48,12 @@ Interlibrary loans: > - pref: ILLOpacbackends > class: multi > - (separated with |). If left empty, all installed backends will be enabled. >+ - >+ - "ILL request metadata displayed in the OPAC request table:" >+ - pref: ILLOpacMetadataFields >+ class: multi >+ - (separated with |). Defaults to "author|title". >+ - 'Customize the displayed name by putting its display name in brackets, like: "part_title(Chapter/Article title)".' > Workflow: > - > - pref: ILLCheckAvailability >diff --git a/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-illrequests.tt b/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-illrequests.tt >index 96ce9bc5cb..27e729daaa 100644 >--- a/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-illrequests.tt >+++ b/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-illrequests.tt >@@ -135,8 +135,9 @@ > <thead> > <tr> > <th>Request ID</th> >- <th>Author</th> >- <th>Title</th> >+ [% FOR field IN metadata_fields %] >+ <th>[% field.name | html %] </th> >+ [% END %] > <th>Requested from</th> > <th>Request type</th> > <th>Status</th> >@@ -346,20 +347,15 @@ > return data; > }, > }, >+ [% FOR field IN metadata_fields %] > { >- data: 'author', >+ data: '[% field.key | html %]', > sortable: false, > render: (data, type, row, meta) => { >- return display_extended_attribute(row, 'author'); >- }, >- }, >- { >- data: 'title', >- sortable: false, >- render: (data, type, row, meta) => { >- return display_extended_attribute(row, 'title'); >+ return display_extended_attribute(row, '[% field.key | html %]'); > }, > }, >+ [% END %] > { > data: 'ill_backend_id', > sortable: true, >diff --git a/opac/opac-illrequests.pl b/opac/opac-illrequests.pl >index 89f38b56da..b546f2639c 100755 >--- a/opac/opac-illrequests.pl >+++ b/opac/opac-illrequests.pl >@@ -83,7 +83,14 @@ if ( ( $op eq 'cud-create' || $op eq 'cancreq' || $op eq 'cud-update' ) && !$can > } > > if ( $op eq 'list' ) { >- $template->param( backends => $backends ); >+ my @metadata_fields = >+ map { / ^ ( [^\(]+ ) \( ([^\)]+) \) $ /x ? { key => $1, name => $2 } : { key => $_, name => ucfirst $_ } } >+ split /\|/, ( C4::Context->preference('ILLOpacMetadataFields') || 'author|title' ); >+ >+ $template->param( >+ backends => $backends, >+ metadata_fields => \@metadata_fields, >+ ); > } elsif ( $op eq 'view' ) { > $template->param( request => $request ); > } elsif ( $op eq 'cud-update' ) { >-- >2.47.2
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 39610
: 180825