Bugzilla – Attachment 107562 Details for
Bug 26063
Use Koha::Plugins->call for other hooks
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 26063: Use Koha::Plugins->call for some other hooks
Bug-26063-Use-KohaPlugins-call-for-some-other-hook.patch (text/plain), 5.09 KB, created by
Jonathan Druart
on 2020-07-30 08:34:06 UTC
(
hide
)
Description:
Bug 26063: Use Koha::Plugins->call for some other hooks
Filename:
MIME Type:
Creator:
Jonathan Druart
Created:
2020-07-30 08:34:06 UTC
Size:
5.09 KB
patch
obsolete
>From 61b5da5678f35c7032fcd39f6ba3cec38f43e2a0 Mon Sep 17 00:00:00 2001 >From: Jonathan Druart <jonathan.druart@bugs.koha-community.org> >Date: Wed, 29 Jul 2020 15:11:24 +0200 >Subject: [PATCH] Bug 26063: Use Koha::Plugins->call for some other hooks > >--- > C4/Biblio.pm | 27 ++++++++------------------- > Koha/Item.pm | 24 +++++++----------------- > opac/opac-detail.pl | 32 ++++++++++---------------------- > opac/opac-search.pl | 30 +++++++++--------------------- > 4 files changed, 34 insertions(+), 79 deletions(-) > >diff --git a/C4/Biblio.pm b/C4/Biblio.pm >index 41bdcc504a..f62798db08 100644 >--- a/C4/Biblio.pm >+++ b/C4/Biblio.pm >@@ -3446,26 +3446,15 @@ sub _after_biblio_action_hooks { > my $biblio_id = $args->{biblio_id}; > my $action = $args->{action}; > >- if ( C4::Context->config("enable_plugins") ) { >- >- my @plugins = Koha::Plugins->new->GetPlugins({ >- method => 'after_biblio_action', >- }); >- >- if (@plugins) { >- >- my $biblio = Koha::Biblios->find( $biblio_id ); >- >- foreach my $plugin ( @plugins ) { >- try { >- $plugin->after_biblio_action({ action => $action, biblio => $biblio, biblio_id => $biblio_id }); >- } >- catch { >- warn "$_"; >- }; >- } >+ my $biblio = Koha::Biblios->find( $biblio_id ); >+ Koha::Plugins->call( >+ 'after_biblio_action', >+ { >+ action => $action, >+ biblio => $biblio, >+ biblio_id => $biblio_id, > } >- } >+ ); > } > > __END__ >diff --git a/Koha/Item.pm b/Koha/Item.pm >index 9560a567cb..29406b551d 100644 >--- a/Koha/Item.pm >+++ b/Koha/Item.pm >@@ -832,24 +832,14 @@ sub _after_item_action_hooks { > > my $action = $params->{action}; > >- if ( C4::Context->config("enable_plugins") ) { >- >- my @plugins = Koha::Plugins->new->GetPlugins({ >- method => 'after_item_action', >- }); >- >- if (@plugins) { >- >- foreach my $plugin ( @plugins ) { >- try { >- $plugin->after_item_action({ action => $action, item => $self, item_id => $self->itemnumber }); >- } >- catch { >- warn "$_"; >- }; >- } >+ Koha::Plugins->call( >+ 'after_item_action', >+ { >+ action => $action, >+ item => $self, >+ item_id => $self->itemnumber, > } >- } >+ ); > } > > =head3 _type >diff --git a/opac/opac-detail.pl b/opac/opac-detail.pl >index 66a12d8ccb..94a935f0c8 100755 >--- a/opac/opac-detail.pl >+++ b/opac/opac-detail.pl >@@ -185,29 +185,17 @@ if ( $xslfile ) { > anonymous_session => ($borrowernumber) ? 0 : 1 > }; > >- if ( C4::Context->config("enable_plugins") ) { >- >- my @plugins = Koha::Plugins->new->GetPlugins({ >- method => 'opac_detail_xslt_variables', >- }); >- >- if (@plugins) { >- foreach my $plugin ( @plugins ) { >- try { >- my $plugin_variables = $plugin->opac_detail_xslt_variables( >- { >- biblio_id => $biblionumber, >- lang => $lang, >- patron_id => $borrowernumber >- } >- ); >- $variables = { %$variables, %$plugin_variables }; >- } >- catch { >- warn "$_"; >- }; >- } >+ my @plugin_responses = Koha::Plugins->call( >+ 'opac_detail_xslt_variables', >+ { >+ biblio_id => $biblionumber, >+ lang => $lang, >+ patron_id => $borrowernumber >+ > } >+ ); >+ for my $plugin_variables ( @plugin_responses ) { >+ $variables = { %$variables, %$plugin_variables }; > } > > $template->param( >diff --git a/opac/opac-search.pl b/opac/opac-search.pl >index 3a512f830b..70e140bc0c 100755 >--- a/opac/opac-search.pl >+++ b/opac/opac-search.pl >@@ -649,28 +649,16 @@ if (C4::Context->preference('OpacHiddenItemsExceptions')){ > } > > my $variables = { anonymous_session => ($borrowernumber) ? 0 : 1 }; >-if ( C4::Context->config("enable_plugins") ) { >- >- my @plugins = Koha::Plugins->new->GetPlugins({ >- method => 'opac_results_xslt_variables', >- }); >- >- if (@plugins) { >- foreach my $plugin ( @plugins ) { >- try { >- my $plugin_variables = $plugin->opac_results_xslt_variables( >- { >- lang => $lang, >- patron_id => $borrowernumber >- } >- ); >- $variables = { %$variables, %$plugin_variables }; >- } >- catch { >- warn "$_"; >- }; >- } >+ >+my @plugin_responses = Koha::Plugins->call( >+ 'opac_results_xslt_variables', >+ { >+ lang => $lang, >+ patron_id => $borrowernumber > } >+); >+for my $plugin_variables ( @plugin_responses ) { >+ $variables = { %$variables, %$plugin_variables }; > } > > for (my $i=0;$i<@servers;$i++) { >-- >2.20.1
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 26063
:
107366
|
107498
|
107561
|
107562
|
107595
|
107596