Bugzilla – Attachment 180506 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) Simplify code for choosing the first fine values
Bug-39405-follow-up-Simplify-code-for-choosing-the.patch (text/plain), 1.43 KB, created by
Martin Renvoize (ashimema)
on 2025-04-03 12:57:29 UTC
(
hide
)
Description:
Bug 39405: (follow-up) Simplify code for choosing the first fine values
Filename:
MIME Type:
Creator:
Martin Renvoize (ashimema)
Created:
2025-04-03 12:57:29 UTC
Size:
1.43 KB
patch
obsolete
>From 7a5463bde83621b31accc2b5c2714c8dbfc34dcb Mon Sep 17 00:00:00 2001 >From: Tomas Cohen Arazi <tomascohen@theke.io> >Date: Tue, 1 Apr 2025 11:54:30 +0200 >Subject: [PATCH] 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 <tomascohen@theke.io> >Signed-off-by: Martin Renvoize <martin.renvoize@openfifth.co.uk> >--- > C4/Overdues.pm | 8 ++++---- > 1 file changed, 4 insertions(+), 4 deletions(-) > >diff --git a/C4/Overdues.pm b/C4/Overdues.pm >index 314928e4230..71509e034bd 100644 >--- a/C4/Overdues.pm >+++ b/C4/Overdues.pm >@@ -224,7 +224,7 @@ sub CalcFine { > > # Call the plugin hook overwrite_calc_fine of all plugins and return > # the first defined fine. >- my @fines = Koha::Plugins->call( >+ my @fines = grep { defined $_ } Koha::Plugins->call( > 'overwrite_calc_fine', > { > itemnumber => $item->{itemnumber}, >@@ -234,9 +234,9 @@ sub CalcFine { > end_date => $end_date, > } > ); >- foreach my $fine (@fines) { >- return @$fine if ( defined $fine ); >- } >+ >+ return @{ $fines[0] } >+ if scalar @fines; > > my $start_date = $due_dt->clone(); > >-- >2.49.0
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