Bugzilla – Attachment 180433 Details for
Bug 39405
Add plugin hook `overwrite_calc_fine` to override fine calculation
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 39405: (follow-up) Add the parameter borrowernumber to the overwrite_calc_fine plugin hook
Bug-39405-follow-up-Add-the-parameter-borrowernumb.patch (text/plain), 3.48 KB, created by
Raphael Straub
on 2025-04-03 07:52:45 UTC
(
hide
)
Description:
Bug 39405: (follow-up) Add the parameter borrowernumber to the overwrite_calc_fine plugin hook
Filename:
MIME Type:
Creator:
Raphael Straub
Created:
2025-04-03 07:52:45 UTC
Size:
3.48 KB
patch
obsolete
>From 8af5fa1705403ff4982473f49566de8ecb5ffe0f Mon Sep 17 00:00:00 2001 >From: Raphael Straub <raphael.straub@kit.edu> >Date: Tue, 1 Apr 2025 13:39:01 +0000 >Subject: [PATCH] Bug 39405: (follow-up) Add the parameter borrowernumber to > the overwrite_calc_fine plugin hook > >This patch adds the borrowernumber as a parameter to the overwrite_calc_fine >plugin hook. E.g., the borrower is needed for calculating graduated fines. > >Sponsored-by: Karlsruhe Institute of Technology (KIT) >--- > C4/Overdues.pm | 11 ++++++----- > t/db_dependent/Koha/Plugins/Overdues.t | 8 +++++++- > t/lib/plugins/Koha/Plugin/Test.pm | 1 + > 3 files changed, 14 insertions(+), 6 deletions(-) > >diff --git a/C4/Overdues.pm b/C4/Overdues.pm >index 71509e034b..24176210a4 100644 >--- a/C4/Overdues.pm >+++ b/C4/Overdues.pm >@@ -227,11 +227,12 @@ sub CalcFine { > my @fines = grep { defined $_ } Koha::Plugins->call( > 'overwrite_calc_fine', > { >- itemnumber => $item->{itemnumber}, >- categorycode => $bortype, >- branchcode => $branchcode, >- due_date => $due_dt, >- end_date => $end_date, >+ itemnumber => $item->{itemnumber}, >+ borrowernumber => $item->{borrowernumber}, >+ categorycode => $bortype, >+ branchcode => $branchcode, >+ due_date => $due_dt, >+ end_date => $end_date, > } > ); > >diff --git a/t/db_dependent/Koha/Plugins/Overdues.t b/t/db_dependent/Koha/Plugins/Overdues.t >index edde9f9d12..d044817c17 100755 >--- a/t/db_dependent/Koha/Plugins/Overdues.t >+++ b/t/db_dependent/Koha/Plugins/Overdues.t >@@ -54,6 +54,7 @@ subtest 'overwrite_calc_fine hook tests' => sub { > my $library = $builder->build_object( { class => 'Koha::Libraries', } ); > my $category = $builder->build_object( { class => 'Koha::Patron::Categories', } ); > my $item = $builder->build_sample_item; >+ my $patron = $builder->build_object( { class => 'Koha::Patrons', } ); > > Koha::Plugins->new->InstallPlugins(); > my $test_plugin = Koha::Plugin::Test->new->disable(); >@@ -129,13 +130,18 @@ subtest 'overwrite_calc_fine hook tests' => sub { > $empty_value_plugin->disable(); > $bad_value_plugin->disable(); > >+ my $borrowernumber = $patron->borrowernumber; >+ my $overdue = $item->unblessed; >+ $overdue->{borrowernumber} = $borrowernumber; >+ > my $itemnumber = $item->itemnumber; > my $branchcode = $library->branchcode; > my $categorycode = $category->categorycode; > >- warnings_like { CalcFine( $item->unblessed, $category->categorycode, $library->branchcode, $due_date, $end_date ); } >+ warnings_like { CalcFine( $overdue, $category->categorycode, $library->branchcode, $due_date, $end_date ); } > [ > qr/itemnumber:$itemnumber/, >+ qr/borrowernumber:$borrowernumber/, > qr/branchcode:$branchcode/, > qr/categorycode:$categorycode/, > qr/due_date_type:DateTime/, >diff --git a/t/lib/plugins/Koha/Plugin/Test.pm b/t/lib/plugins/Koha/Plugin/Test.pm >index b3539b1ac6..4b5dccbb4d 100644 >--- a/t/lib/plugins/Koha/Plugin/Test.pm >+++ b/t/lib/plugins/Koha/Plugin/Test.pm >@@ -452,6 +452,7 @@ sub overwrite_calc_fine { > my ( $self, $params ) = @_; > > warn "itemnumber:" . $params->{itemnumber}; >+ warn "borrowernumber:" . $params->{borrowernumber}; > warn "branchcode:" . $params->{branchcode}; > warn "categorycode:" . $params->{categorycode}; > warn "due_date_type:" . ref( $params->{due_date} ); >-- >2.39.5
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
|
Splinter Review
Attachments on
bug 39405
:
179582
|
180095
|
180111
|
180127
|
180342
|
180343
|
180344
|
180433
|
180439
|
180440
|
180441
|
180442
|
180486
|
180505
|
180506
|
180507
|
180508