[Koha-bugs] [Bug 39405] New hook overwrite_calc_fine for graduated fines calculation
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=39405 --- Comment #6 from Clemens Tubach --- (In reply to Jonathan Druart from comment #4) > For discussion: > The first parameter "item" is confusing, it's not a Koha::Item object. > > Maybe we should pass something that is not too tight to the current > signature of CalcFine (so the plugin won't break when/if we change it). > > If you need item's info, then pass the item object (or the item's id?) I talked with Raphael and Paul. We will pass the itemnumber and get the Koha:item into the plugin. -- You are receiving this mail because: You are watching all bug changes. ___ Koha-bugs mailing list [email protected] https://lists.koha-community.org/cgi-bin/mailman/listinfo/koha-bugs website : http://www.koha-community.org/ git : http://git.koha-community.org/ bugs : http://bugs.koha-community.org/
[Koha-bugs] [Bug 39405] New hook overwrite_calc_fine for graduated fines calculation
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=39405 --- Comment #17 from Tomás Cohen Arazi (tcohen) --- I added the requested tests aiming to help this patchset make it to the crossing line. I still think, as discussed in person at Marseille, that some warning should be displayed on the circulation page when a plugin overrides rules. As Arthur pointed out, it is not a terribly hard thing to do. I leave it to the QA person to decide if it should be done here or in a separate bug. -- You are receiving this mail because: You are watching all bug changes. ___ Koha-bugs mailing list [email protected] https://lists.koha-community.org/cgi-bin/mailman/listinfo/koha-bugs website : http://www.koha-community.org/ git : http://git.koha-community.org/ bugs : http://bugs.koha-community.org/
[Koha-bugs] [Bug 39405] New hook overwrite_calc_fine for graduated fines calculation
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=39405 Tomás Cohen Arazi (tcohen) changed: What|Removed |Added CC||[email protected] Status|Needs Signoff |Failed QA --- Comment #10 from Tomás Cohen Arazi (tcohen) --- Hi Ralph. Good job here. A couple QA remarks: - In the tests file you introduce, you correctly add a subtest that wraps all actions inside a DB transaction. [GOOD] - Even though you wrap the subtest inside a transaction, some data is generated OUTSIDE the transaction i.e. `$branch` and `$category`. Those two should be generated inside the subtest and within the transaction. Otherwise running the test pollutes the DB [BLOCKER] - The hook is added to Koha::Plugin::Test [GOOD] - The fact that your code skips 'undefined result' plugin hook calls is not tested [BLOCKER] - The fact your code will pick the first available value is not tested [BLOCKER] I will submit a patch now, creating two new sample plugins you can use for writing those tests. -- You are receiving this mail because: You are watching all bug changes. ___ Koha-bugs mailing list [email protected] https://lists.koha-community.org/cgi-bin/mailman/listinfo/koha-bugs website : http://www.koha-community.org/ git : http://git.koha-community.org/ bugs : http://bugs.koha-community.org/
[Koha-bugs] [Bug 39405] New hook overwrite_calc_fine for graduated fines calculation
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=39405 --- Comment #8 from Raphael Straub --- (In reply to Clemens Tubach from comment #6) > We will pass the itemnumber and get the Koha:item > into the plugin. A new patch that does this is attached. -- You are receiving this mail because: You are watching all bug changes. ___ Koha-bugs mailing list [email protected] https://lists.koha-community.org/cgi-bin/mailman/listinfo/koha-bugs website : http://www.koha-community.org/ git : http://git.koha-community.org/ bugs : http://bugs.koha-community.org/
[Koha-bugs] [Bug 39405] New hook overwrite_calc_fine for graduated fines calculation
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=39405 Paul Derscheid changed: What|Removed |Added CC||[email protected] --- Comment #2 from Paul Derscheid --- Please also document the new hook on the wiki and ask for a commit to the kitchen-sink-plugin on github. -- You are receiving this mail because: You are watching all bug changes. ___ Koha-bugs mailing list [email protected] https://lists.koha-community.org/cgi-bin/mailman/listinfo/koha-bugs website : http://www.koha-community.org/ git : http://git.koha-community.org/ bugs : http://bugs.koha-community.org/
[Koha-bugs] [Bug 39405] New hook overwrite_calc_fine for graduated fines calculation
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=39405 Jonathan Druart changed: What|Removed |Added CC||[email protected] --- Comment #3 from Jonathan Druart --- Note: Ideally we should return the same structure than CalCFine (ie. an array, not an arrayref). But we cannot: Koha/Plugins.pm 80 sub call { 95 my $response = eval { $plugin->$method(@args) }; -- You are receiving this mail because: You are watching all bug changes. ___ Koha-bugs mailing list [email protected] https://lists.koha-community.org/cgi-bin/mailman/listinfo/koha-bugs website : http://www.koha-community.org/ git : http://git.koha-community.org/ bugs : http://bugs.koha-community.org/
[Koha-bugs] [Bug 39405] New hook overwrite_calc_fine for graduated fines calculation
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=39405 --- Comment #16 from Tomás Cohen Arazi (tcohen) --- Created attachment 180344 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=180344&action=edit Bug 39405: Add more plugin examples to build tests Signed-off-by: Tomas Cohen Arazi -- You are receiving this mail because: You are watching all bug changes. ___ Koha-bugs mailing list [email protected] https://lists.koha-community.org/cgi-bin/mailman/listinfo/koha-bugs website : http://www.koha-community.org/ git : http://git.koha-community.org/ bugs : http://bugs.koha-community.org/
[Koha-bugs] [Bug 39405] New hook overwrite_calc_fine for graduated fines calculation
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=39405 Tomás Cohen Arazi (tcohen) changed: What|Removed |Added Attachment #180095|0 |1 is obsolete|| Attachment #180111|0 |1 is obsolete|| Attachment #180127|0 |1 is obsolete|| --- Comment #14 from Tomás Cohen Arazi (tcohen) --- Created attachment 180342 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=180342&action=edit Bug 39405: Add hook overwrite_calc_fine to override CalcFine in Overdues.pm This new hook allows to overwrite the koha standard calculation of fines. This can be useful if your library has a fine policy with graduated fines per overdue letter. To test: 1) Apply patch. 2) Run prove -v t/db_dependent/Circulation/CalcFine.t 3) Run prove -v t/db_dependent/Koha/Plugins/Overdues.t 4) Sign off. Sponsored-by: Karlsruhe Institute of Technology (KIT) Signed-off-by: Tomas Cohen Arazi -- You are receiving this mail because: You are watching all bug changes. ___ Koha-bugs mailing list [email protected] https://lists.koha-community.org/cgi-bin/mailman/listinfo/koha-bugs website : http://www.koha-community.org/ git : http://git.koha-community.org/ bugs : http://bugs.koha-community.org/
[Koha-bugs] [Bug 39405] New hook overwrite_calc_fine for graduated fines calculation
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=39405 --- Comment #15 from Tomás Cohen Arazi (tcohen) --- Created attachment 180343 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=180343&action=edit Bug 39405: (follow-up) Simplify code for choosing the first fine values This patch avoids the introduction of a `foreach` loop and a `return` call inside of it, by using grep on the array assignment, and then just returning the first element on it, if any. No behavior change is expected. The code becomes easier to read and spot what is doing. Signed-off-by: Tomas Cohen Arazi -- You are receiving this mail because: You are watching all bug changes. ___ Koha-bugs mailing list [email protected] https://lists.koha-community.org/cgi-bin/mailman/listinfo/koha-bugs website : http://www.koha-community.org/ git : http://git.koha-community.org/ bugs : http://bugs.koha-community.org/
[Koha-bugs] [Bug 39405] New hook overwrite_calc_fine for graduated fines calculation
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=39405 Tomás Cohen Arazi (tcohen) changed: What|Removed |Added Status|Failed QA |Signed Off -- You are receiving this mail because: You are watching all bug changes. ___ Koha-bugs mailing list [email protected] https://lists.koha-community.org/cgi-bin/mailman/listinfo/koha-bugs website : http://www.koha-community.org/ git : http://git.koha-community.org/ bugs : http://bugs.koha-community.org/
[Koha-bugs] [Bug 39405] New hook overwrite_calc_fine for graduated fines calculation
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=39405
--- Comment #5 from Arthur Suzuki ---
there should be a check on the circulation rules definition page, if any
installed plugin implement this hook.
You could check if any plugin implement the hook by using this code (found in
C4/Letters.pm)
if ( C4::Context->config("enable_plugins") ) {
my @plugins = Koha::Plugins->new->GetPlugins(
{
method => 'before_send_messages',
}
);
That could be in another dependent bug :)
--
You are receiving this mail because:
You are watching all bug changes.
___
Koha-bugs mailing list
[email protected]
https://lists.koha-community.org/cgi-bin/mailman/listinfo/koha-bugs
website : http://www.koha-community.org/
git : http://git.koha-community.org/
bugs : http://bugs.koha-community.org/
[Koha-bugs] [Bug 39405] New hook overwrite_calc_fine for graduated fines calculation
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=39405 --- Comment #9 from Tomás Cohen Arazi (tcohen) --- Created attachment 180111 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=180111&action=edit Bug 39405: (follow-up) Simplify code for choosing the first fine values This patch avoids the introduction of a `foreach` loop and a `return` call inside of it, by using grep on the array assignment, and then just returning the first element on it, if any. No behavior change is expected. The code becomes easier to read and spot what is doing. Signed-off-by: Tomas Cohen Arazi -- You are receiving this mail because: You are watching all bug changes. ___ Koha-bugs mailing list [email protected] https://lists.koha-community.org/cgi-bin/mailman/listinfo/koha-bugs website : http://www.koha-community.org/ git : http://git.koha-community.org/ bugs : http://bugs.koha-community.org/
[Koha-bugs] [Bug 39405] New hook overwrite_calc_fine for graduated fines calculation
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=39405 --- Comment #13 from Raphael Straub --- (In reply to Tomás Cohen Arazi (tcohen) from comment #10) > - The fact that your code skips 'undefined result' plugin hook calls is not > tested [BLOCKER] > - The fact your code will pick the first available value is not tested > [BLOCKER] I think, we cannot test these two facts as long as Koha::Plugins->call() calls the plugin hooks and returns the results in an arbitrary order. -- You are receiving this mail because: You are watching all bug changes. ___ Koha-bugs mailing list [email protected] https://lists.koha-community.org/cgi-bin/mailman/listinfo/koha-bugs website : http://www.koha-community.org/ git : http://git.koha-community.org/ bugs : http://bugs.koha-community.org/
[Koha-bugs] [Bug 39405] New hook overwrite_calc_fine for graduated fines calculation
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=39405 --- Comment #11 from Tomás Cohen Arazi (tcohen) --- Created attachment 180127 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=180127&action=edit Bug 39405: Add more plugin examples to build tests Signed-off-by: Tomas Cohen Arazi -- You are receiving this mail because: You are watching all bug changes. ___ Koha-bugs mailing list [email protected] https://lists.koha-community.org/cgi-bin/mailman/listinfo/koha-bugs website : http://www.koha-community.org/ git : http://git.koha-community.org/ bugs : http://bugs.koha-community.org/
[Koha-bugs] [Bug 39405] New hook overwrite_calc_fine for graduated fines calculation
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=39405 --- Comment #12 from Tomás Cohen Arazi (tcohen) --- (In reply to Tomás Cohen Arazi (tcohen) from comment #10) > I will submit a patch now, creating two new sample plugins you can use for > writing those tests. Added 3 plugins, actually. -- You are receiving this mail because: You are watching all bug changes. ___ Koha-bugs mailing list [email protected] https://lists.koha-community.org/cgi-bin/mailman/listinfo/koha-bugs website : http://www.koha-community.org/ git : http://git.koha-community.org/ bugs : http://bugs.koha-community.org/
[Koha-bugs] [Bug 39405] New hook overwrite_calc_fine for graduated fines calculation
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=39405 Raphael Straub changed: What|Removed |Added Attachment #179582|0 |1 is obsolete|| --- Comment #7 from Raphael Straub --- Created attachment 180095 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=180095&action=edit Bug 39405: Add hook overwrite_calc_fine to override CalcFine in Overdues.pm This new hook allows to overwrite the koha standard calculation of fines. This can be useful if your library has a fine policy with graduated fines per overdue letter. To test: 1) Apply patch. 2) Run prove -v t/db_dependent/Circulation/CalcFine.t 3) Run prove -v t/db_dependent/Koha/Plugins/Overdues.t 4) Sign off. Sponsored-by: Karlsruhe Institute of Technology (KIT) -- You are receiving this mail because: You are watching all bug changes. ___ Koha-bugs mailing list [email protected] https://lists.koha-community.org/cgi-bin/mailman/listinfo/koha-bugs website : http://www.koha-community.org/ git : http://git.koha-community.org/ bugs : http://bugs.koha-community.org/
[Koha-bugs] [Bug 39405] New hook overwrite_calc_fine for graduated fines calculation
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=39405 Arthur Suzuki changed: What|Removed |Added CC||[email protected] -- You are receiving this mail because: You are watching all bug changes. ___ Koha-bugs mailing list [email protected] https://lists.koha-community.org/cgi-bin/mailman/listinfo/koha-bugs website : http://www.koha-community.org/ git : http://git.koha-community.org/ bugs : http://bugs.koha-community.org/
[Koha-bugs] [Bug 39405] New hook overwrite_calc_fine for graduated fines calculation
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=39405 --- Comment #4 from Jonathan Druart --- For discussion: The first parameter "item" is confusing, it's not a Koha::Item object. Maybe we should pass something that is not too tight to the current signature of CalcFine (so the plugin won't break when/if we change it). If you need item's info, then pass the item object (or the item's id?) -- You are receiving this mail because: You are watching all bug changes. ___ Koha-bugs mailing list [email protected] https://lists.koha-community.org/cgi-bin/mailman/listinfo/koha-bugs website : http://www.koha-community.org/ git : http://git.koha-community.org/ bugs : http://bugs.koha-community.org/
[Koha-bugs] [Bug 39405] New hook overwrite_calc_fine for graduated fines calculation
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=39405 Michaela Sieber changed: What|Removed |Added CC||[email protected] ||o.uk, ||[email protected] -- You are receiving this mail because: You are watching all bug changes. ___ Koha-bugs mailing list [email protected] https://lists.koha-community.org/cgi-bin/mailman/listinfo/koha-bugs website : http://www.koha-community.org/ git : http://git.koha-community.org/ bugs : http://bugs.koha-community.org/
[Koha-bugs] [Bug 39405] New hook overwrite_calc_fine for graduated fines calculation
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=39405 --- Comment #1 from Raphael Straub --- Created attachment 179582 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=179582&action=edit Bug 39405: Add hook overwrite_calc_fine to override CalcFine in Overdues.pm This new hook allows to overwrite the koha standard calculation of fines. This can be useful if your library has a fine policy with graduated fines per overdue letter. To test: 1) Apply patch. 2) Run prove -v t/db_dependent/Circulation/CalcFine.t 3) Run prove -v t/db_dependent/Koha/Plugins/Overdues.t 4) Sign off. Sponsored-by: Karlsruhe Institute of Technology (KIT) -- You are receiving this mail because: You are the assignee for the bug. You are watching all bug changes. ___ Koha-bugs mailing list [email protected] https://lists.koha-community.org/cgi-bin/mailman/listinfo/koha-bugs website : http://www.koha-community.org/ git : http://git.koha-community.org/ bugs : http://bugs.koha-community.org/
[Koha-bugs] [Bug 39405] New hook overwrite_calc_fine for graduated fines calculation
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=39405 Michaela Sieber changed: What|Removed |Added Change sponsored?|--- |Sponsored Text to go in the||This new hook allows to release notes||overwrite the koha standard ||calculation of fines. This ||can be useful if your ||library has a fine policy ||with graduated fines per ||overdue letter. CC||[email protected], ||[email protected], ||[email protected], ||[email protected] -- You are receiving this mail because: You are watching all bug changes. You are the assignee for the bug. ___ Koha-bugs mailing list [email protected] https://lists.koha-community.org/cgi-bin/mailman/listinfo/koha-bugs website : http://www.koha-community.org/ git : http://git.koha-community.org/ bugs : http://bugs.koha-community.org/
[Koha-bugs] [Bug 39405] New hook overwrite_calc_fine for graduated fines calculation
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=39405 Raphael Straub changed: What|Removed |Added CC|[email protected] | Assignee|[email protected] |[email protected] |ity.org | Patch complexity|--- |Small patch Status|NEW |Needs Signoff -- You are receiving this mail because: You are the assignee for the bug. You are watching all bug changes. ___ Koha-bugs mailing list [email protected] https://lists.koha-community.org/cgi-bin/mailman/listinfo/koha-bugs website : http://www.koha-community.org/ git : http://git.koha-community.org/ bugs : http://bugs.koha-community.org/
