https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=40984

--- Comment #8 from Martin Renvoize (ashimema) 
<[email protected]> ---
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.
_______________________________________________
Koha-bugs mailing list -- [email protected]
To unsubscribe send an email to [email protected]
website : http://www.koha-community.org/
git : http://git.koha-community.org/
bugs : http://bugs.koha-community.org/

Reply via email to