Bug 21468

Summary: Plugins need hooks for checkin and checkout actions
Product: Koha Reporter: Magnus Enger <magnus>
Component: Plugin architectureAssignee: Martin Renvoize (ashimema) <martin.renvoize>
Status: CLOSED FIXED QA Contact: Testopia <testopia>
Severity: enhancement    
Priority: P5 - low CC: cslone, dcook, fridolin.somers, jonathan.druart, josef.moravec, kyle, lucas, magnus, martin.renvoize, niamh.walker-headon, tomascohen
Version: Main   
Hardware: All   
OS: All   
See Also: https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=23112
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=25855
Change sponsored?: --- Patch complexity: ---
Documentation contact: Documentation submission:
Text to go in the release notes:
This enhancement adds plugin hooks to allow plugins to take action after check-in and check-out circulation events.
Version(s) released in:
20.11.00
Circulation function:
Bug Depends on: 7317, 25855    
Bug Blocks: 26063    
Attachments: Bug 21468: Unit tests for AddIssue
Bug 21468: Add 'issue' action for _after_circ_actions
Bug 21468: Unit tests for AddIssue
Bug 21468: Add 'issue' action for _after_circ_actions
Bug 21468: Unit tests for AddIssue
Bug 21468: Add 'checkout' action for _after_circ_actions
Bug 21468: Unit tests for AddReturn
Bug 21468: Add 'checkin' action for _after_circ_actions
Bug 21468: Unit tests for AddIssue
Bug 21468: Add 'checkout' action for _after_circ_actions
Bug 21468: Unit tests for AddReturn
Bug 21468: Add 'checkin' action for _after_circ_actions
Bug 21468: (QA follow-up) Enhance tests
Bug 21468: Unit tests for AddIssue
Bug 21468: Add 'checkout' action for _after_circ_actions
Bug 21468: Unit tests for AddReturn
Bug 21468: Add 'checkin' action for _after_circ_actions
Bug 21468: (QA follow-up) Enhance tests
Bug 21468: (QA follow-up) SImplify payload

Description Magnus Enger 2018-10-02 09:09:05 UTC
Some ILL backends/plugins will need hooks into the checkin/checkout process, so statuses can be changed or API calls made in respons to these circulation events.
Comment 1 Katrin Fischer 2020-06-25 13:39:48 UTC
+1
Comment 2 Martin Renvoize (ashimema) 2020-06-29 13:57:45 UTC
Looks like Tomas has already started on this one :).. See bug 25885 for a post_renewal hook
Comment 3 Katrin Fischer 2020-06-29 13:59:05 UTC
(In reply to Martin Renvoize from comment #2)
> Looks like Tomas has already started on this one :).. See bug 25885 for a
> post_renewal hook

A bit different, but maybe something that could be copied for this bug in part.
Comment 4 Martin Renvoize (ashimema) 2020-07-06 10:44:48 UTC Comment hidden (obsolete)
Comment 5 Martin Renvoize (ashimema) 2020-07-06 10:44:51 UTC Comment hidden (obsolete)
Comment 6 Martin Renvoize (ashimema) 2020-07-06 10:49:56 UTC Comment hidden (obsolete)
Comment 7 Martin Renvoize (ashimema) 2020-07-06 10:49:59 UTC Comment hidden (obsolete)
Comment 8 Martin Renvoize (ashimema) 2020-07-06 12:48:38 UTC
Created attachment 106580 [details] [review]
Bug 21468: Unit tests for AddIssue

This patch adds a unit test for the addition of a call to the
_after_circ_action hook in AddIssue.
Comment 9 Martin Renvoize (ashimema) 2020-07-06 12:48:41 UTC
Created attachment 106581 [details] [review]
Bug 21468: Add 'checkout' action for _after_circ_actions

This patch adds a call to _after_circ_actions into AddIssue and passes
an appropriate payload for plugins to utilise after issuing items.
Comment 10 Martin Renvoize (ashimema) 2020-07-06 12:48:44 UTC
Created attachment 106582 [details] [review]
Bug 21468: Unit tests for AddReturn
Comment 11 Martin Renvoize (ashimema) 2020-07-06 12:48:47 UTC
Created attachment 106583 [details] [review]
Bug 21468: Add 'checkin' action for _after_circ_actions
Comment 12 Tomás Cohen Arazi (tcohen) 2020-07-15 05:29:38 UTC
Created attachment 106883 [details] [review]
Bug 21468: Unit tests for AddIssue

This patch adds a unit test for the addition of a call to the
_after_circ_action hook in AddIssue.

Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
Comment 13 Tomás Cohen Arazi (tcohen) 2020-07-15 05:29:43 UTC
Created attachment 106884 [details] [review]
Bug 21468: Add 'checkout' action for _after_circ_actions

This patch adds a call to _after_circ_actions into AddIssue and passes
an appropriate payload for plugins to utilise after issuing items.

Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
Comment 14 Tomás Cohen Arazi (tcohen) 2020-07-15 05:29:49 UTC
Created attachment 106885 [details] [review]
Bug 21468: Unit tests for AddReturn

Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
Comment 15 Tomás Cohen Arazi (tcohen) 2020-07-15 05:29:55 UTC
Created attachment 106886 [details] [review]
Bug 21468: Add 'checkin' action for _after_circ_actions

Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
Comment 16 Tomás Cohen Arazi (tcohen) 2020-07-15 05:30:00 UTC
Created attachment 106887 [details] [review]
Bug 21468: (QA follow-up) Enhance tests

Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
Comment 17 Katrin Fischer 2020-07-18 16:15:05 UTC
Could we have a test plan for this? There is not much description in the patches themselves.
Comment 18 Tomás Cohen Arazi (tcohen) 2020-07-18 18:35:34 UTC
Running the tests is the plan. They prove that check-in and check-out actions call the plugin hook on installed plugins.
Comment 19 Martin Renvoize (ashimema) 2020-07-19 06:34:51 UTC
Yup, what Tomas said. The unit tests prove the new feature works as expected so test plan would be to cast your eye over them to ensure they make sense and then run them to ensure they pass.  In terms of regression testing, test check-ins and checkouts in the UI to ensure they still happen and run Circuaction.t to ensure it still passed too.
Comment 20 Tomás Cohen Arazi (tcohen) 2020-07-23 14:57:05 UTC
Created attachment 107261 [details] [review]
Bug 21468: Unit tests for AddIssue

This patch adds a unit test for the addition of a call to the
_after_circ_action hook in AddIssue.

Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
Comment 21 Tomás Cohen Arazi (tcohen) 2020-07-23 14:57:12 UTC
Created attachment 107262 [details] [review]
Bug 21468: Add 'checkout' action for _after_circ_actions

This patch adds a call to _after_circ_actions into AddIssue and passes
an appropriate payload for plugins to utilise after issuing items.

Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
Comment 22 Tomás Cohen Arazi (tcohen) 2020-07-23 14:57:18 UTC
Created attachment 107263 [details] [review]
Bug 21468: Unit tests for AddReturn

Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
Comment 23 Tomás Cohen Arazi (tcohen) 2020-07-23 14:57:26 UTC
Created attachment 107264 [details] [review]
Bug 21468: Add 'checkin' action for _after_circ_actions

Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
Comment 24 Tomás Cohen Arazi (tcohen) 2020-07-23 14:57:33 UTC
Created attachment 107265 [details] [review]
Bug 21468: (QA follow-up) Enhance tests

Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
Comment 25 Tomás Cohen Arazi (tcohen) 2020-07-23 14:57:42 UTC
Created attachment 107266 [details] [review]
Bug 21468: (QA follow-up) SImplify payload

This patch simplifies the payload as suggested on bug 25855. It also
keeps some specific params that cannot be deduced from the passed
checkout object, (e.g. if it is an onsite checkout).

Tests are cleared and added for this special exceptions.

Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
Comment 26 Jonathan Druart 2020-07-30 15:48:48 UTC
Pushed to master for 20.11, thanks to everybody involved!
Comment 27 Lucas Gass (lukeg) 2020-07-31 21:35:40 UTC
enhancement will not be backported to 20.05.x series
Comment 28 Fridolin Somers 2020-11-20 12:39:31 UTC
I see it is in wiki https://wiki.koha-community.org/wiki/Koha_Plugin_Hooks
Super :D