Bugzilla – Attachment 151473 Details for
Bug 33758
Add a parameter to use the intranet_catalog_biblio_enhancements_toolbar_button Plugin hook
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 33758 - Add a parameter to use the intranet_catalog_biblio_enhancements_toolbar_button Plugin hook
Bug-33758---Add-a-parameter-to-use-the-intranetcat.patch (text/plain), 3.44 KB, created by
ByWater Sandboxes
on 2023-05-19 12:13:09 UTC
(
hide
)
Description:
Bug 33758 - Add a parameter to use the intranet_catalog_biblio_enhancements_toolbar_button Plugin hook
Filename:
MIME Type:
Creator:
ByWater Sandboxes
Created:
2023-05-19 12:13:09 UTC
Size:
3.44 KB
patch
obsolete
>From 8177fa9822409087a73d42ca345e53f00ce2c3ee Mon Sep 17 00:00:00 2001 >From: Nicolas Giraud <nicolas.giraud@inlibro.com> >Date: Thu, 18 May 2023 11:27:41 -0400 >Subject: [PATCH] Bug 33758 - Add a parameter to use the > intranet_catalog_biblio_enhancements_toolbar_button Plugin hook > >This patch adds a parameter to call the method intranet_catalog_biblio_enhancements_toolbar_button with a biblionumber in the page catalogue/detail.pl. > >Modification of cat-toolbar.inc to display new buttons correctly. > >To test : >1. Apply the patch >2. Take a plugin who implements the method intranet_catalog_biblio_enhancements_toolbar_button >3. Check if the parameter "biblionumber" is passed correctly at this method >4. Create the new button in HTML in the plugin method >(button must be like the ones that are in the toolbar of the page detail.pl) >5. Go to the page in browser and check if the new button is displayed > >Signed-off-by: Sally <sally.healey@cheshiresharedservices.gov.uk> >--- > catalogue/detail.pl | 37 +++++++++++++------ > .../prog/en/includes/cat-toolbar.inc | 4 +- > 2 files changed, 27 insertions(+), 14 deletions(-) > >diff --git a/catalogue/detail.pl b/catalogue/detail.pl >index 48bd799879..12a5337066 100755 >--- a/catalogue/detail.pl >+++ b/catalogue/detail.pl >@@ -20,6 +20,7 @@ use Modern::Perl; > > use CGI qw ( -utf8 ); > use HTML::Entities; >+use Try::Tiny qw( catch try ); > use C4::Auth qw( get_template_and_user ); > use C4::Context; > use C4::Koha qw( >@@ -74,17 +75,6 @@ my ( $template, $borrowernumber, $cookie, $flags ) = get_template_and_user( > } > ); > >-# Determine if we should be offering any enhancement plugin buttons >-if ( C4::Context->config('enable_plugins') ) { >- # Only pass plugins that can offer a toolbar button >- my @plugins = Koha::Plugins->new()->GetPlugins({ >- method => 'intranet_catalog_biblio_enhancements_toolbar_button' >- }); >- $template->param( >- plugins => \@plugins, >- ); >-} >- > my $biblionumber = $query->param('biblionumber'); > $biblionumber = HTML::Entities::encode($biblionumber); > my $biblio = Koha::Biblios->find( $biblionumber ); >@@ -98,6 +88,31 @@ unless ( $biblio ) { > exit; > } > >+# Determine if we should be offering any enhancement plugin buttons >+if ( C4::Context->config('enable_plugins') ) { >+ # Only pass plugins that can offer a toolbar button >+ my @plugins = Koha::Plugins->new()->GetPlugins({ >+ method => 'intranet_catalog_biblio_enhancements_toolbar_button' >+ }); >+ my $buttons = ""; >+ foreach my $plugin (@plugins) { >+ try { >+ $buttons .= $plugin->intranet_catalog_biblio_enhancements_toolbar_button( >+ { >+ biblionumber => $biblionumber, >+ } >+ ); >+ } >+ catch { >+ warn "$_"; >+ }; >+ } >+ >+ $template->param( >+ buttons => $buttons, >+ ); >+} >+ > my $marc_record = eval { $biblio->metadata->record }; > my $invalid_marc_record = $@ || !$marc_record; > if ($invalid_marc_record) { >diff --git a/koha-tmpl/intranet-tmpl/prog/en/includes/cat-toolbar.inc b/koha-tmpl/intranet-tmpl/prog/en/includes/cat-toolbar.inc >index b9a4c3184f..fdee52d002 100644 >--- a/koha-tmpl/intranet-tmpl/prog/en/includes/cat-toolbar.inc >+++ b/koha-tmpl/intranet-tmpl/prog/en/includes/cat-toolbar.inc >@@ -206,9 +206,7 @@ > [% END %] > [% END %] > >-[% FOREACH p IN plugins %] >- [% p.intranet_catalog_biblio_enhancements_toolbar_button | $raw %] >-[% END %] >+[% buttons %] > > </div> > >-- >2.30.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 33758
:
151426
|
151434
|
151473
|
158160
|
163798