Bugzilla – Attachment 131103 Details for
Bug 30180
Deprecate after_hold_create hook
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 30180: (follow-up) Add temporary deprecation warning
Bug-30180-follow-up-Add-temporary-deprecation-warn.patch (text/plain), 3.49 KB, created by
Tomás Cohen Arazi (tcohen)
on 2022-02-25 08:57:33 UTC
(
hide
)
Description:
Bug 30180: (follow-up) Add temporary deprecation warning
Filename:
MIME Type:
Creator:
Tomás Cohen Arazi (tcohen)
Created:
2022-02-25 08:57:33 UTC
Size:
3.49 KB
patch
obsolete
>From 1ebdca5fa45e58bcd3817bb093f35d94435def76 Mon Sep 17 00:00:00 2001 >From: Tomas Cohen Arazi <tomascohen@theke.io> >Date: Fri, 25 Feb 2022 05:54:11 -0300 >Subject: [PATCH] Bug 30180: (follow-up) Add temporary deprecation warning > >This patch adds a temporary deprecation warning to let users know the >plugin needs to get updated before the next release. > >To test: >1. Apply this patch >2. Run: > $ kshell > k$ prove t/db_dependent/Koha/Plugins/Holds_hooks.t >=> SUCCESS: Tests pass, warning is displayed >3. Sign off :-D > >Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io> >--- > Koha/Plugins.pm | 3 +++ > t/db_dependent/Koha/Plugins/Holds_hooks.t | 11 ++++++----- > 2 files changed, 9 insertions(+), 5 deletions(-) > >diff --git a/Koha/Plugins.pm b/Koha/Plugins.pm >index 033ba28376..f7b716638d 100644 >--- a/Koha/Plugins.pm >+++ b/Koha/Plugins.pm >@@ -78,6 +78,9 @@ sub call { > if (C4::Context->config('enable_plugins')) { > my @plugins = $class->new({ enable_plugins => 1 })->GetPlugins({ method => $method }); > @plugins = grep { $_->can($method) } @plugins; >+ # TODO: Remove warn when after_hold_create is removed from the codebase >+ warn "after_hold_create is deprecated and will be removed soon. Contact the following plugin's authors: " . join( ', ', map {$_->{metadata}->{name}} @plugins) >+ if $method eq 'after_hold_create' and @plugins; > foreach my $plugin (@plugins) { > my $response = eval { $plugin->$method(@args) }; > if ($@) { >diff --git a/t/db_dependent/Koha/Plugins/Holds_hooks.t b/t/db_dependent/Koha/Plugins/Holds_hooks.t >index d1dd61f033..47aaa3eee4 100755 >--- a/t/db_dependent/Koha/Plugins/Holds_hooks.t >+++ b/t/db_dependent/Koha/Plugins/Holds_hooks.t >@@ -72,12 +72,13 @@ subtest 'after_hold_create() hook tests' => sub { > my $biblio = $builder->build_sample_biblio(); > my $item_1 = $builder->build_sample_item( { biblionumber => $biblio->biblionumber } ); > >- warning_like { AddReserve({ >+ warnings_like { AddReserve({ > branchcode => $patron->branchcode, > borrowernumber => $patron->borrowernumber, > biblionumber => $item_1->biblionumber }); } >- qr/after_hold_create called with parameter Koha::Hold/, >- 'AddReserve calls the after_hold_create hook'; >+ [ qr/after_hold_create is deprecated and will be removed soon/, >+ qr/after_hold_create called with parameter Koha::Hold/ ], >+ 'AddReserve calls the after_hold_create hook, deprecation warning found'; > > $schema->storage->txn_rollback; > Koha::Plugins::Methods->delete; >@@ -113,7 +114,7 @@ subtest 'after_hold_action (placed) hook tests' => sub { > my $biblio = $builder->build_sample_biblio(); > my $item_1 = $builder->build_sample_item( { biblionumber => $biblio->biblionumber } ); > >- warning_like { >+ warnings_like { > AddReserve( > { branchcode => $patron->branchcode, > borrowernumber => $patron->borrowernumber, >@@ -121,7 +122,7 @@ subtest 'after_hold_action (placed) hook tests' => sub { > } > ); > } >- qr/after_hold_action called with action: place, ref: Koha::Hold/, 'AddReserve calls the after_hold_action hook'; >+ [ qr/after_hold_create is deprecated and will be removed soon/, qr/after_hold_action called with action: place, ref: Koha::Hold/, ], 'AddReserve calls the after_hold_action hook'; > > $schema->storage->txn_rollback; > Koha::Plugins::Methods->delete; >-- >2.35.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 30180
:
131101
|
131102
|
131103
|
133415
|
133416
|
133417
|
133818
|
133819
|
133820