Bug 26063

Summary: Use Koha::Plugins->call for other hooks
Product: Koha Reporter: Tomás Cohen Arazi <tomascohen>
Component: Plugin architectureAssignee: Tomás Cohen Arazi <tomascohen>
Status: CLOSED FIXED QA Contact: Testopia <testopia>
Severity: enhancement    
Priority: P5 - low CC: aleisha, jonathan.druart, lucas, tomascohen
Version: master   
Hardware: All   
OS: All   
See Also: https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=25961
Change sponsored?: --- Patch complexity: Trivial patch
Documentation contact: Documentation submission:
Text to go in the release notes:
Version(s) released in:
20.11.00
Bug Depends on: 21468, 24031, 25855, 25961    
Bug Blocks: 26138    
Attachments: Bug 26063: Use Koha::Plugins->call for circulation hooks
Bug 26063: Use Koha::Plugins->call for some other hooks
Bug 26063: Use Koha::Plugins->call for some other hooks
Bug 26063: Use Koha::Plugins->call for some other hooks
Bug 26063: Use Koha::Plugins->call for circulation hooks
Bug 26063: Use Koha::Plugins->call for some other hooks

Description Tomás Cohen Arazi 2020-07-24 19:00:15 UTC
Bug 24031 introduced the handy method and we should use it instead of using in-place helpers.
Comment 1 Tomás Cohen Arazi 2020-07-24 19:05:28 UTC
Created attachment 107366 [details] [review]
Bug 26063: Use Koha::Plugins->call for circulation hooks

This patch gets rid of a helper method used for calling the plugin
hooks.

To test:
1. Run:
   $ kshell
  k$ prove t/db_dependent/Koha/Plugins/Circulation_hooks.t
=> SUCCESS: Tests pass!
2. Apply this patch
3. Repeat 1
=> SUCCESS: Tests still pass!
4. Sign off :-D

Sponsored-by: ByWater Solutions

Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
Comment 2 Jonathan Druart 2020-07-28 08:57:34 UTC
It does not apply on top of 24031

Applying: Bug 26063: Use Koha::Plugins->call for circulation hooks
error: sha1 information is lacking or useless (C4/Circulation.pm).
error: could not build fake ancestor
Patch failed at 0001 Bug 26063: Use Koha::Plugins->call for circulation hooks

Neither on top of the PQA hook related patch.

Please build this on top of bug 25961, bug 25855 and bug 24031.
Comment 3 Tomás Cohen Arazi 2020-07-28 12:22:29 UTC
Fixed the dependencies.
Comment 4 Jonathan Druart 2020-07-29 08:17:27 UTC
Tomas, I thought that the plan was to use Koha::Plugins->call everywhere. This patch is only using it for circulation hooks.

Can we have a plan for that as well please?
Comment 5 Jonathan Druart 2020-07-29 13:11:55 UTC
Created attachment 107498 [details] [review]
Bug 26063: Use Koha::Plugins->call for some other hooks
Comment 6 Jonathan Druart 2020-07-29 13:13:25 UTC
Are there other hooks not covered?

(I did not test this last patch!)
Comment 7 Jonathan Druart 2020-07-30 08:32:37 UTC
Created attachment 107561 [details] [review]
Bug 26063: Use Koha::Plugins->call for some other hooks
Comment 8 Jonathan Druart 2020-07-30 08:34:06 UTC
Created attachment 107562 [details] [review]
Bug 26063: Use Koha::Plugins->call for some other hooks
Comment 9 Tomás Cohen Arazi 2020-07-30 15:32:35 UTC
Created attachment 107595 [details] [review]
Bug 26063: Use Koha::Plugins->call for circulation hooks

This patch gets rid of a helper method used for calling the plugin
hooks.

To test:
1. Run:
   $ kshell
  k$ prove t/db_dependent/Koha/Plugins/Circulation_hooks.t
=> SUCCESS: Tests pass!
2. Apply this patch
3. Repeat 1
=> SUCCESS: Tests still pass!
4. Sign off :-D

Sponsored-by: ByWater Solutions

Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
Comment 10 Tomás Cohen Arazi 2020-07-30 15:32:39 UTC
Created attachment 107596 [details] [review]
Bug 26063: Use Koha::Plugins->call for some other hooks

Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
Comment 11 Jonathan Druart 2020-07-30 15:47:08 UTC
Pushed to master for 20.11, thanks to everybody involved!
Comment 12 Aleisha Amohia 2020-08-04 21:49:50 UTC
Has anyone tested this without a plugin installed? I tried to do an OPAC search on a fresh install of master and I'm getting errors.

Can't use string ("0") as a HASH ref while "strict refs" in use at /home/vagrant/kohaclone/opac/opac-search.pl line 661
Comment 13 Aleisha Amohia 2020-08-04 22:04:20 UTC
I have opened Bug 26138 as this patch causes a bug when enable_plugins is 0.
Comment 14 Lucas Gass 2020-08-06 19:53:57 UTC
enhancement will not be backported to 20.05.x series