Bugzilla – Attachment 107596 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.14 KB, created by
Tomás Cohen Arazi (tcohen)
on 2020-07-30 15:32:39 UTC
(
hide
)
Description:
Bug 26063: Use Koha::Plugins->call for some other hooks
Filename:
MIME Type:
Creator:
Tomás Cohen Arazi (tcohen)
Created:
2020-07-30 15:32:39 UTC
Size:
5.14 KB
patch
obsolete
>From ea161cc99d353c0723d55ae016450e5853889616 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 > >Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io> >--- > 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 0e0a30936b..56f9a9e15e 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.28.0
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