Bugzilla – Attachment 105788 Details for
Bug 25112
Koha::CirculationRules->set_rules should handle scopes per rule
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 25112: Make set_rules() handle rule scopes
Bug-25112-Make-setrules-handle-rule-scopes.patch (text/plain), 2.12 KB, created by
Joonas Kylmälä
on 2020-06-12 10:11:11 UTC
(
hide
)
Description:
Bug 25112: Make set_rules() handle rule scopes
Filename:
MIME Type:
Creator:
Joonas Kylmälä
Created:
2020-06-12 10:11:11 UTC
Size:
2.12 KB
patch
obsolete
>From 273731f2edbe08b7f7bb9b317a516731d927b5f5 Mon Sep 17 00:00:00 2001 >From: Lari Taskula <lari.taskula@hypernova.fi> >Date: Sat, 11 Apr 2020 17:58:06 +0000 >Subject: [PATCH] Bug 25112: Make set_rules() handle rule scopes >MIME-Version: 1.0 >Content-Type: text/plain; charset=UTF-8 >Content-Transfer-Encoding: 8bit > >Koha::CirculationRules->set_rules is currently too complicated to use. >Right now, in order to specify multiple rules at once, they must all >be rules that accept the same set of scopes. Otherwise we can get this >type of errors: > >1/9 set_rule cannot set 'holds_per_record' for a 'checkout_type'! > at t/db_dependent/Circulation/GetHardDueDate.t line 215. > >Validating scopes at set_rule() is good, but set_rules() should examine >each rule and pass the correct scope to set_rule() instead of passing >all scopes to every rule like it is doing now. > >To test: >1. prove t/db_dependent/Koha/CirculationRules.t >2. Observe success > >Sponsored-by: The National Library of Finland >Signed-off-by: Joonas Kylmälä <joonas.kylmala@helsinki.fi> >--- > Koha/CirculationRules.pm | 10 ++++++---- > 1 file changed, 6 insertions(+), 4 deletions(-) > >diff --git a/Koha/CirculationRules.pm b/Koha/CirculationRules.pm >index 5042e6f55d..92a20e65c8 100644 >--- a/Koha/CirculationRules.pm >+++ b/Koha/CirculationRules.pm >@@ -322,14 +322,16 @@ sub set_rule { > sub set_rules { > my ( $self, $params ) = @_; > >- my %set_params; >- $set_params{branchcode} = $params->{branchcode} if exists $params->{branchcode}; >- $set_params{categorycode} = $params->{categorycode} if exists $params->{categorycode}; >- $set_params{itemtype} = $params->{itemtype} if exists $params->{itemtype}; > my $rules = $params->{rules}; > > my $rule_objects = []; > while ( my ( $rule_name, $rule_value ) = each %$rules ) { >+ my %set_params; >+ foreach my $set_param ( values @{$RULE_KINDS->{$rule_name}->{scope}} ) { >+ if ( exists $params->{$set_param} ) { >+ $set_params{$set_param} = $params->{$set_param}; >+ } >+ } > my $rule_object = Koha::CirculationRules->set_rule( > { > %set_params, >-- >2.11.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 25112
:
102763
|
102764
|
105787
|
105788
|
107650
|
107651