[Koha-bugs] [Bug 26351] Add plugin hooks to transform item barcodes
bugzilla-daemon at bugs.koha-community.org
bugzilla-daemon at bugs.koha-community.org
Fri Sep 11 14:38:17 CEST 2020
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=26351
--- Comment #7 from Julian Maurice <julian.maurice at biblibre.com> ---
(In reply to Kyle M Hall from comment #6)
> In it's current state, the last plugin 'wins'. A couple solutions would be
> to:
> A) Modify call() to feed the result of the last plugin call into the next one
> B) Split the hooks into separate methods
>
> I'm much more inclined to go with B. What do you think Julian?
I think A would not work in all cases. There can be more than one parameter and
it's not necessarily the same thing as the return value.
B would work in the example I mentioned, but would not work in other cases,
like two plugins implementing the same method, one for transforming, the other
for doing something else.
I've seen a pattern somewhere else that could work : plugins modify directly
the parameters
my $params = { barcode => $barcode };
Koha::Plugins->call($hook_name, $params);
$barcode = $params->{barcode};
It's not very intuitive, but it should work as expected in all cases, and
there's no need to modify Koha::Plugins->call.
--
You are receiving this mail because:
You are watching all bug changes.
More information about the Koha-bugs
mailing list