[Bug 40984] New: Synchronise before_ and after_authority_action hook signatures with biblio action hooks
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=40984 Bug ID: 40984 Summary: Synchronise before_ and after_authority_action hook signatures with biblio action hooks Change sponsored?: --- Product: Koha Version: Main Hardware: All OS: All Status: NEW Keywords: Hackfest Severity: minor Priority: P5 - low Component: Plugin architecture Assignee: koha-bugs@lists.koha-community.org Reporter: martin.renvoize@openfifth.co.uk QA Contact: testopia@bugs.koha-community.org CC: fridolin.somers@biblibre.com, kyle@bywatersolutions.com, m.de.rooy@rijksmuseum.nl, pedro.amorim@openfifth.co.uk, tomascohen@gmail.com, wainuiwitikapark@catalyst.net.nz Following the work on bug 36343, which standardized the signatures for before_biblio_action and after_biblio_action hooks to include a payload parameter, a similar inconsistency exists within the authority hooks. To improve the consistency and predictability of the plugin hook system, we should align the authority action hooks with the syntax established for biblios. This bug covers two related issues: Update after_authority_action hook signature: An after_authority_action hook already exists, but its signature is missing the payload parameter. We should update this hook to include the payload, bringing it in line with after_biblio_action. A deprecation period and warning should be introduced for the older signature to ensure backward compatibility for existing plugins. Create before_authority_action hook: There is currently no equivalent before_authority_action hook. We should create this new hook to allow plugins to interact with authority records before an action (like saving) is completed. This new hook should be implemented with a signature that is consistent with before_biblio_action from the outset, including the payload parameter. Completing this work will provide a more coherent and powerful interface for plugins that interact with both bibliographic and authority records. -- You are receiving this mail because: You are the assignee for the bug. You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=40984 Martin Renvoize (ashimema) <martin.renvoize@openfifth.co.uk> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|NEW |ASSIGNED Assignee|koha-bugs@lists.koha-commun |martin.renvoize@openfifth.c |ity.org |o.uk -- You are receiving this mail because: You are watching all bug changes. You are the assignee for the bug.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=40984 --- Comment #1 from Martin Renvoize (ashimema) <martin.renvoize@openfifth.co.uk> --- Created attachment 187653 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=187653&action=edit Bug 40984: Synchronize before_ and after_authority_action hooks with biblio action hooks This patch updates the authority action plugin hooks to match the signature and behavior of the biblio action hooks: 1. Created before_authority_action hook that is called before authority records are saved, allowing plugins to modify records before they are stored in the database 2. Updated after_authority_action hook to use a payload parameter containing authority, authority_id, and record, matching the pattern used by after_biblio_action hook 3. Maintained backward compatibility by passing both old parameters (authority, authority_id) and new payload parameter, with deprecation warnings logged when plugins implement the hook 4. Updated test plugin to use new payload-based signatures for both hooks 5. Added test coverage for before_authority_action hook Test plan: 1. Run: prove t/db_dependent/Koha/Plugins/authority_hooks.t 2. Run: prove t/db_dependent/Koha/Plugins/ 3. All tests should pass -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=40984 Martin Renvoize (ashimema) <martin.renvoize@openfifth.co.uk> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|ASSIGNED |Needs Signoff -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=40984 Marcel de Rooy <m.de.rooy@rijksmuseum.nl> changed: What |Removed |Added ---------------------------------------------------------------------------- QA Contact|testopia@bugs.koha-communit |m.de.rooy@rijksmuseum.nl |y.org | -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=40984 Marcel de Rooy <m.de.rooy@rijksmuseum.nl> changed: What |Removed |Added ---------------------------------------------------------------------------- Text to go in the| |IMPORTANT: The authority release notes| |and authority_id parameters | |of | |after_authority_action_hook | |s plugins have been | |deprecated! Please switch | |to using the payload hash. | |The old parameters will be | |removed in a future version | |of Koha. -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=40984 Marcel de Rooy <m.de.rooy@rijksmuseum.nl> changed: What |Removed |Added ---------------------------------------------------------------------------- Text to go in the|IMPORTANT: The authority |IMPORTANT: The authority release notes|and authority_id parameters |and authority_id parameters |of |of |after_authority_action_hook |after_authority_action_hook |s plugins have been |s plugins have been |deprecated! Please switch |deprecated! Please switch |to using the payload hash. |to using the payload hash. |The old parameters will be |The old parameters will be |removed in a future version |removed in a future version |of Koha. |of Koha. | | | |Note that this report also | |adds | |before_authority_action_hoo | |ks allowing you modify | |authority records before | |saving. -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=40984 Marcel de Rooy <m.de.rooy@rijksmuseum.nl> changed: What |Removed |Added ---------------------------------------------------------------------------- Text to go in the|IMPORTANT: The authority |IMPORTANT: The authority release notes|and authority_id parameters |and authority_id parameters |of |of |after_authority_action_hook |after_authority_action_hook |s plugins have been |s plugins have been |deprecated! Please switch |deprecated! Please switch |to using the payload hash. |to using the payload hash. |The old parameters will be |The old parameters will be |removed in a future version |removed in a future version |of Koha. |of Koha. | | |Note that this report also |Note that this report also |adds |adds |before_authority_action_hoo |before_authority_action_hoo |ks allowing you modify |ks allowing you to modify |authority records before |authority records before |saving. |saving. -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=40984 --- Comment #2 from Marcel de Rooy <m.de.rooy@rijksmuseum.nl> --- I am not so sure about this: + # Log deprecation warning if any plugin is still using the old signature + my @plugins = Koha::Plugins->get_enabled_plugins( { verbose => 0 } ); + @plugins = grep { $_->can('after_authority_action') } @plugins; + if (@plugins) { + Koha::Logger->get->warn( + "after_authority_action hook: The old signature (with authority and authority_id as direct parameters) " + . "is deprecated and will be removed in a future release. " + . "Please update your plugin to use the 'payload' parameter instead." ); + } -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=40984 --- Comment #3 from Marcel de Rooy <m.de.rooy@rijksmuseum.nl> --- Potentially flooding the logs with deprecation warns and not even checking if we use the old or the new syntax? -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=40984 Marcel de Rooy <m.de.rooy@rijksmuseum.nl> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|Needs Signoff |Failed QA --- Comment #4 from Marcel de Rooy <m.de.rooy@rijksmuseum.nl> --- # Call before hook _before_authority_action_hooks( { action => 'save', authority_id => $authid, record => $record } ); Not sure about the exact place we should add this call. It is a bit in the middle of various changes in AddAuthority now. For MARC21 we did already update fields like leader, 003, 005, 008. But did not yet update 001 and heading. Comparing with the biblio action, we do the before call after record changes in ModBiblioMarc and just before saving to biblio_metadata. Could you explain why we do it here? Shouldnt we better move it after the heading change just before the $authority->update? -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=40984 --- Comment #5 from Martin Renvoize (ashimema) <martin.renvoize@openfifth.co.uk> --- (In reply to Marcel de Rooy from comment #2)
I am not so sure about this:
+ # Log deprecation warning if any plugin is still using the old signature + my @plugins = Koha::Plugins->get_enabled_plugins( { verbose => 0 } ); + @plugins = grep { $_->can('after_authority_action') } @plugins; + if (@plugins) { + Koha::Logger->get->warn( + "after_authority_action hook: The old signature (with authority and authority_id as direct parameters) " + . "is deprecated and will be removed in a future release. " + . "Please update your plugin to use the 'payload' parameter instead." ); + }
Hmm.. seems I mis-remembered how we added a deprecation to the other bug.. just a DB update. That feels too quiet to me really but you are right, this approach could be noisy -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=40984 --- Comment #6 from Marcel de Rooy <m.de.rooy@rijksmuseum.nl> --- I just stumbled over the need of this patch in 24.11 again. But I need the authtypecode in the delete message. And I am seeing this: + my $authority = $action ne 'delete' ? Koha::Authorities->find($authority_id) : undef; So we still pass only the authid to the plugin. And I need at least the type. But even better would be passing the auth object (that we already have in DelAuthority btw) to _after_authority_action_hooks. We could do similar in AddAuthority which removes the need of looking it up again in _after_authority_action_hooks itself. -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=40984 Martin Renvoize (ashimema) <martin.renvoize@openfifth.co.uk> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|Failed QA |Needs Signoff -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=40984 Martin Renvoize (ashimema) <martin.renvoize@openfifth.co.uk> changed: What |Removed |Added ---------------------------------------------------------------------------- Attachment #187653|0 |1 is obsolete| | -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=40984 --- Comment #7 from Martin Renvoize (ashimema) <martin.renvoize@openfifth.co.uk> --- Created attachment 211060 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=211060&action=edit Bug 40984: Synchronize before_ and after_authority_action hooks with biblio action hooks This patch updates the authority action plugin hooks to match the signature and behavior of the biblio action hooks: 1. Add a before_authority_action hook, called before an authority record is saved. It is called once the record is complete, after the 001 is set and before the heading is derived from it, so plugins get the authority_id for new authorities too and can still change the record (including its heading fields) before it is stored. 2. Update the after_authority_action hook to pass its data in a payload, like after_biblio_action: authority, authority_id and record. The authority object is the one the action was done on, so for a delete plugins can still get its details, for example its authtypecode. 3. Keep the old parameters (authority and authority_id outside of the payload) so that existing plugins keep working. They are deprecated, as noted in an atomic update, as was done for the biblio hooks in bug 36343, instead of a warning logged on every action. 4. Update the test plugin to use the payload-based signatures, and add test coverage for both hooks. To test: 1. prove t/db_dependent/Koha/Plugins/authority_hooks.t 2. prove t/db_dependent/Koha/Plugins/ t/db_dependent/AuthoritiesMarc.t 3. All tests should pass 4. perl installer/data/mysql/updatedatabase.pl => Warnings for plugin authors about the changed hooks 5. Sign off :-D -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=40984 --- Comment #8 from Martin Renvoize (ashimema) <martin.renvoize@openfifth.co.uk> --- Thanks Marcel, and sorry for the very late reply. I have reworked the patch (new version attached, rebased on current main) to answer your comments. The warning (comments 2, 3 and 5): you are right, it was logged on every action as soon as any enabled plugin had the hook, whichever signature it used. It is gone. Like bug 36343 did for the biblio hooks, the deprecation is now announced once, as a warning in the database update (atomicupdate/bug_40984.pl), for plugin authors. The old authority and authority_id parameters are still passed outside of the payload, so existing plugins keep working. Where the before hook is called (comment 4): it was too early, and your suggestion was right. In biblio the hook is called once the record has all its changes, just before it is stored. It is now called in AddAuthority after the 001 is set and before the heading is derived from the record and everything is saved. That has two advantages over the first version: the authority_id is known for a new authority too (it was undefined for a create), and a plugin that changes the heading fields gets the right heading stored, as the heading is derived after the hook. The authority object (comment 6): both AddAuthority and DelAuthority already had the Koha::Authority object, so they now pass it to the after hook, which no longer looks it up again. The payload has authority, authority_id and record. For a delete, authority is the object of the authority that has just been deleted, so a plugin can get its authtypecode (and the rest of its details). This goes a little further than biblio, where biblio is undef for a delete. One consequence to be aware of: the deprecated authority parameter is now also that object, not undef, for a delete. Tests: the test plugin now reports the 001 in the before hook and the authtypecode in the after hook, and t/db_dependent/Koha/Plugins/authority_hooks.t checks that the before hook gets the authority_id and a record with its 001 set for a create, and that the after hook gets the type for create, modify and delete. Against the first version of the patch the before hook test and the delete test fail, they pass now. t/db_dependent/Koha/Plugins/, AuthoritiesMarc.t, Koha/Authorities.t and Koha/Authority.t pass, and koha-qa is clean. Setting this bug back for testing. -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=40984 David Nind <david@davidnind.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|Needs Signoff |Signed Off -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=40984 David Nind <david@davidnind.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Attachment #211060|0 |1 is obsolete| | -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=40984 --- Comment #9 from David Nind <david@davidnind.com> --- Created attachment 211181 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=211181&action=edit Bug 40984: Synchronize before_ and after_authority_action hooks with biblio action hooks This patch updates the authority action plugin hooks to match the signature and behavior of the biblio action hooks: 1. Add a before_authority_action hook, called before an authority record is saved. It is called once the record is complete, after the 001 is set and before the heading is derived from it, so plugins get the authority_id for new authorities too and can still change the record (including its heading fields) before it is stored. 2. Update the after_authority_action hook to pass its data in a payload, like after_biblio_action: authority, authority_id and record. The authority object is the one the action was done on, so for a delete plugins can still get its details, for example its authtypecode. 3. Keep the old parameters (authority and authority_id outside of the payload) so that existing plugins keep working. They are deprecated, as noted in an atomic update, as was done for the biblio hooks in bug 36343, instead of a warning logged on every action. 4. Update the test plugin to use the payload-based signatures, and add test coverage for both hooks. To test: 1. prove t/db_dependent/Koha/Plugins/authority_hooks.t 2. prove t/db_dependent/Koha/Plugins/ t/db_dependent/AuthoritiesMarc.t 3. All tests should pass 4. perl installer/data/mysql/updatedatabase.pl => Warnings for plugin authors about the changed hooks 5. Sign off :-D Signed-off-by: David Nind <david@davidnind.com> -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=40984 Marcel de Rooy <m.de.rooy@rijksmuseum.nl> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|Signed Off |Failed QA --- Comment #10 from Marcel de Rooy <m.de.rooy@rijksmuseum.nl> --- (In reply to Martin Renvoize (ashimema) from comment #8)
Thanks Marcel, and sorry for the very late reply. I have reworked the patch (new version attached, rebased on current main) to answer your comments.
The warning (comments 2, 3 and 5): you are right, it was logged on every action as soon as any enabled plugin had the hook, whichever signature it used. It is gone. Like bug 36343 did for the biblio hooks, the deprecation is now announced once, as a warning in the database update (atomicupdate/bug_40984.pl), for plugin authors. The old authority and authority_id parameters are still passed outside of the payload, so existing plugins keep working.
Where the before hook is called (comment 4): it was too early, and your suggestion was right. In biblio the hook is called once the record has all its changes, just before it is stored. It is now called in AddAuthority after the 001 is set and before the heading is derived from the record and everything is saved. That has two advantages over the first version: the authority_id is known for a new authority too (it was undefined for a create), and a plugin that changes the heading fields gets the right heading stored, as the heading is derived after the hook.
The authority object (comment 6): both AddAuthority and DelAuthority already had the Koha::Authority object, so they now pass it to the after hook, which no longer looks it up again. The payload has authority, authority_id and record. For a delete, authority is the object of the authority that has just been deleted, so a plugin can get its authtypecode (and the rest of its details). This goes a little further than biblio, where biblio is undef for a delete. One consequence to be aware of: the deprecated authority parameter is now also that object, not undef, for a delete.
Tests: the test plugin now reports the 001 in the before hook and the authtypecode in the after hook, and t/db_dependent/Koha/Plugins/authority_hooks.t checks that the before hook gets the authority_id and a record with its 001 set for a create, and that the after hook gets the type for create, modify and delete. Against the first version of the patch the before hook test and the delete test fail, they pass now. t/db_dependent/Koha/Plugins/, AuthoritiesMarc.t, Koha/Authorities.t and Koha/Authority.t pass, and koha-qa is clean.
Setting this bug back for testing.
Thx for doing so. Looks good, just a minor note: + _before_authority_action_hooks( { action => 'save', authority_id => $authid, record => $record } ); The new before hook receives the MARC record. This looks like biblio but note that there is a difference: in ModBiblioMarc we dont have $biblio object, but in AddAuthority we do have $authority already. The variable record we do already use in Biblio. But it is a bit confusing: it is the MARC record, but we could think that it is the Koha object. Record is just too common. But we are consistent :) No blocker. No action required. Just noting. sub _after_authority_action_hooks { + payload => { + authority => $authority, + authority_id => $authority_id, + record => $record, Why do we add record to the payload here? This is not done at the biblio side in the after action. If there is an object, the plugin can easily get to it: $object->record. I would recommend to remove record here. -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=40984 --- Comment #11 from Martin Renvoize (ashimema) <martin.renvoize@openfifth.co.uk> --- Created attachment 211363 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=211363&action=edit Bug 40984: (QA follow-up) Don't pass record in the after_authority_action payload after_biblio_action only passes biblio and biblio_id in its payload. The authority hook added the MARC record as well, which made the two hooks differ. Plugins that want it can get it from the authority object (authority->record), so remove it from the payload to keep both hooks in sync. The test plugin now reports the keys of the payload it receives, and the tests check that the payload only holds authority and authority_id. To test: 1. prove t/db_dependent/Koha/Plugins/authority_hooks.t 2. prove t/db_dependent/Koha/Plugins/ t/db_dependent/AuthoritiesMarc.t 3. All tests should pass -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=40984 Martin Renvoize (ashimema) <martin.renvoize@openfifth.co.uk> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|Failed QA |Signed Off --- Comment #12 from Martin Renvoize (ashimema) <martin.renvoize@openfifth.co.uk> --- Hi Marcel, Thanks for the QA, and for the careful read. On your second point, I agree. after_biblio_action only passes biblio and biblio_id, and the point of this bug is to keep the two hooks in sync, so I have removed "record" from the after_authority_action payload. Plugins that need it can use the authority object (authority->record). The payload is now authority and authority_id, matching biblio. I have attached a small follow-up patch with that change. The test plugin now reports the payload keys it receives, and the tests check that only authority and authority_id are in the payload. I also checked that the test fails if "record" is added back. On the first note about the name "record" in before_authority_action: you are right that it is the MARC record and could be mistaken for an object. I have kept it as it is, because it matches before_biblio_action and I would rather stay consistent. Happy to revisit the naming for both hooks together in a separate bug if we want something clearer. I am setting this back to Signed Off so that you can check the final change and move it to Passed QA yourself. -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=40984 Marcel de Rooy <m.de.rooy@rijksmuseum.nl> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|Signed Off |Passed QA Patch complexity|--- |Small patch -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=40984 Marcel de Rooy <m.de.rooy@rijksmuseum.nl> changed: What |Removed |Added ---------------------------------------------------------------------------- Attachment #211181|0 |1 is obsolete| | Attachment #211363|0 |1 is obsolete| | -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=40984 --- Comment #13 from Marcel de Rooy <m.de.rooy@rijksmuseum.nl> --- Created attachment 211466 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=211466&action=edit Bug 40984: Synchronize before_ and after_authority_action hooks with biblio action hooks This patch updates the authority action plugin hooks to match the signature and behavior of the biblio action hooks: 1. Add a before_authority_action hook, called before an authority record is saved. It is called once the record is complete, after the 001 is set and before the heading is derived from it, so plugins get the authority_id for new authorities too and can still change the record (including its heading fields) before it is stored. 2. Update the after_authority_action hook to pass its data in a payload, like after_biblio_action: authority, authority_id and record. The authority object is the one the action was done on, so for a delete plugins can still get its details, for example its authtypecode. 3. Keep the old parameters (authority and authority_id outside of the payload) so that existing plugins keep working. They are deprecated, as noted in an atomic update, as was done for the biblio hooks in bug 36343, instead of a warning logged on every action. 4. Update the test plugin to use the payload-based signatures, and add test coverage for both hooks. To test: 1. prove t/db_dependent/Koha/Plugins/authority_hooks.t 2. prove t/db_dependent/Koha/Plugins/ t/db_dependent/AuthoritiesMarc.t 3. All tests should pass 4. perl installer/data/mysql/updatedatabase.pl => Warnings for plugin authors about the changed hooks 5. Sign off :-D Signed-off-by: David Nind <david@davidnind.com> Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl> -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=40984 --- Comment #14 from Marcel de Rooy <m.de.rooy@rijksmuseum.nl> --- Created attachment 211467 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=211467&action=edit Bug 40984: (QA follow-up) Don't pass record in the after_authority_action payload after_biblio_action only passes biblio and biblio_id in its payload. The authority hook added the MARC record as well, which made the two hooks differ. Plugins that want it can get it from the authority object (authority->record), so remove it from the payload to keep both hooks in sync. The test plugin now reports the keys of the payload it receives, and the tests check that the payload only holds authority and authority_id. To test: 1. prove t/db_dependent/Koha/Plugins/authority_hooks.t 2. prove t/db_dependent/Koha/Plugins/ t/db_dependent/AuthoritiesMarc.t 3. All tests should pass Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl> -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=40984 --- Comment #15 from Marcel de Rooy <m.de.rooy@rijksmuseum.nl> --- (In reply to Martin Renvoize (ashimema) from comment #12)
Hi Marcel,
Thanks for the QA, and for the careful read.
On your second point, I agree. after_biblio_action only passes biblio and biblio_id, and the point of this bug is to keep the two hooks in sync, so I have removed "record" from the after_authority_action payload. Plugins that need it can use the authority object (authority->record). The payload is now authority and authority_id, matching biblio.
I have attached a small follow-up patch with that change. The test plugin now reports the payload keys it receives, and the tests check that only authority and authority_id are in the payload. I also checked that the test fails if "record" is added back.
On the first note about the name "record" in before_authority_action: you are right that it is the MARC record and could be mistaken for an object. I have kept it as it is, because it matches before_biblio_action and I would rather stay consistent. Happy to revisit the naming for both hooks together in a separate bug if we want something clearer.
I am setting this back to Signed Off so that you can check the final change and move it to Passed QA yourself.
Thx. -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=40984 --- Comment #16 from Marcel de Rooy <m.de.rooy@rijksmuseum.nl> --- Side note: We could still improve by mocking the after when testing the before hook or vice versa to prevent additional output. -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=40984 Martin Renvoize (ashimema) <martin.renvoize@openfifth.co.uk> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|Passed QA |Pushed to main Version(s)| |26.11.00 released in| | --- Comment #17 from Martin Renvoize (ashimema) <martin.renvoize@openfifth.co.uk> --- Pushed to main for 26.11 as RM Assistant, bugs only now we're in feature freeze -- You are receiving this mail because: You are watching all bug changes.
participants (1)
-
bugzilla-daemon@bugs.koha-community.org