Bugzilla – Attachment 102766 Details for
Bug 25114
Remove duplicated logic from GetLoanLength()
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 25089: Remove duplicated logic from GetLoanLength()
Bug-25089-Remove-duplicated-logic-from-GetLoanLeng.patch (text/plain), 3.09 KB, created by
Lari Taskula
on 2020-04-11 20:01:49 UTC
(
hide
)
Description:
Bug 25089: Remove duplicated logic from GetLoanLength()
Filename:
MIME Type:
Creator:
Lari Taskula
Created:
2020-04-11 20:01:49 UTC
Size:
3.09 KB
patch
obsolete
>From 17aee03bca87118b32964ce64115b5bb534dca89 Mon Sep 17 00:00:00 2001 >From: Lari Taskula <lari.taskula@hypernova.fi> >Date: Sat, 11 Apr 2020 19:48:48 +0000 >Subject: [PATCH] Bug 25089: Remove duplicated logic from GetLoanLength() > >Remove duplicated logic for searching circulation rules. > >This can be replaced with get_effective_rules(). > >To test: >1. prove t/db_dependent/Circulation/GetHardDueDate.t > >https://bugs.koha-community.org/show_bug.cgi?id=25114 >--- > C4/Circulation.pm | 71 +++++++++-------------------------------------- > 1 file changed, 13 insertions(+), 58 deletions(-) > >diff --git a/C4/Circulation.pm b/C4/Circulation.pm >index 747d660ea6..b22799fba2 100644 >--- a/C4/Circulation.pm >+++ b/C4/Circulation.pm >@@ -1540,50 +1540,6 @@ Get loan length for an itemtype, a borrower type and a branch > sub GetLoanLength { > my ( $categorycode, $itemtype, $branchcode ) = @_; > >- # Set search precedences >- my @params = ( >- { >- categorycode => $categorycode, >- itemtype => $itemtype, >- branchcode => $branchcode, >- }, >- { >- categorycode => $categorycode, >- itemtype => undef, >- branchcode => $branchcode, >- }, >- { >- categorycode => undef, >- itemtype => $itemtype, >- branchcode => $branchcode, >- }, >- { >- categorycode => undef, >- itemtype => undef, >- branchcode => $branchcode, >- }, >- { >- categorycode => $categorycode, >- itemtype => $itemtype, >- branchcode => undef, >- }, >- { >- categorycode => $categorycode, >- itemtype => undef, >- branchcode => undef, >- }, >- { >- categorycode => undef, >- itemtype => $itemtype, >- branchcode => undef, >- }, >- { >- categorycode => undef, >- itemtype => undef, >- branchcode => undef, >- }, >- ); >- > # Initialize default values > my $rules = { > issuelength => 0, >@@ -1591,21 +1547,20 @@ sub GetLoanLength { > lengthunit => 'days', > }; > >- # Search for rules! >- foreach my $rule_name (qw( issuelength renewalperiod lengthunit )) { >- foreach my $params (@params) { >- my $rule = Koha::CirculationRules->search( >- { >- rule_name => $rule_name, >- %$params, >- } >- )->next(); >+ my $found = Koha::CirculationRules->get_effective_rules( { >+ branchcode => $branchcode, >+ categorycode => $categorycode, >+ itemtype => $itemtype, >+ rules => [ >+ 'issuelength', >+ 'renewalperiod', >+ 'lengthunit' >+ ], >+ } ); > >- if ($rule) { >- $rules->{$rule_name} = $rule->rule_value; >- last; >- } >- } >+ # Search for rules! >+ foreach my $rule_name (keys %$found) { >+ $rules->{$rule_name} = $found->{$rule_name}; > } > > return $rules; >-- >2.17.1
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 25114
:
102766
|
102767
|
102768
|
105785
|
108349