Bugzilla – Attachment 89024 Details for
Bug 18928
Move `holdallowed`, `hold_fulfillment_policy` and `returnbranch` into the `circulation_rules` table.
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 18928: Use get_effective_rule in GetBranchItemRule
Bug-18928-Use-geteffectiverule-in-GetBranchItemRul.patch (text/plain), 3.30 KB, created by
Jonathan Druart
on 2019-04-29 15:21:47 UTC
(
hide
)
Description:
Bug 18928: Use get_effective_rule in GetBranchItemRule
Filename:
MIME Type:
Creator:
Jonathan Druart
Created:
2019-04-29 15:21:47 UTC
Size:
3.30 KB
patch
obsolete
>From 820dd855b1262c0fee7e69b4fd4bd42399574701 Mon Sep 17 00:00:00 2001 >From: Jonathan Druart <jonathan.druart@bugs.koha-community.org> >Date: Mon, 29 Apr 2019 11:14:27 -0400 >Subject: [PATCH] Bug 18928: Use get_effective_rule in GetBranchItemRule > >--- > C4/Circulation.pm | 74 +++++++++++++++++++++---------------------------------- > 1 file changed, 28 insertions(+), 46 deletions(-) > >diff --git a/C4/Circulation.pm b/C4/Circulation.pm >index cca10d706e..6d0a9049e7 100644 >--- a/C4/Circulation.pm >+++ b/C4/Circulation.pm >@@ -1722,58 +1722,40 @@ Neither C<$branchcode> nor C<$itemtype> should be '*'. > sub GetBranchItemRule { > my ( $branchcode, $itemtype ) = @_; > >- # Set search precedences >- my @params = ( >- { >- branchcode => $branchcode, >- categorycode => undef, >- itemtype => $itemtype, >- }, >- { >- branchcode => $branchcode, >- categorycode => undef, >- itemtype => undef, >- }, >+ # Search for rules! >+ my $holdallowed_rule = Koha::CirculationRules->get_effective_rule( > { >- branchcode => undef, >- categorycode => undef, >- itemtype => $itemtype, >- }, >+ branchcode => $branchcode, >+ itemtype => $itemtype, >+ rule_name => 'holdallowed', >+ } >+ ); >+ my $hold_fulfillment_policy_rule = Koha::CirculationRules->get_effective_rule( > { >- branchcode => undef, >- categorycode => undef, >- itemtype => undef, >- }, >+ branchcode => $branchcode, >+ itemtype => $itemtype, >+ rule_name => 'hold_fulfillment_policy', >+ } > ); >- >- # Initialize default values >- my $rules = { >- holdallowed => undef, >- hold_fulfillment_policy => undef, >- returnbranch => undef, >- }; >- >- # Search for rules! >- foreach my $rule_name (qw( holdallowed hold_fulfillment_policy returnbranch )) { >- foreach my $params (@params) { >- my $rule = Koha::CirculationRules->search( >- { >- rule_name => $rule_name, >- %$params, >- } >- )->next(); >- >- if ( $rule ) { >- $rules->{$rule_name} = $rule->rule_value; >- last; >- } >+ my $returnbranch_rule = Koha::CirculationRules->get_effective_rule( >+ { >+ branchcode => $branchcode, >+ itemtype => $itemtype, >+ rule_name => 'returnbranch', > } >- } >+ ); > > # built-in default circulation rule >- $rules->{holdallowed} = 2 unless ( defined $rules->{holdallowed} ); >- $rules->{hold_fulfillment_policy} = 'any' unless ( defined $rules->{hold_fulfillment_policy} ); >- $rules->{returnbranch} = 'homebranch' unless ( defined $rules->{returnbranch} ); >+ my $rules; >+ $rules->{holdallowed} = defined $holdallowed_rule >+ ? $holdallowed_rule->rule_value >+ : 2; >+ $rules->{hold_fulfillment_policy} = defined $hold_fulfillment_policy_rule >+ ? $hold_fulfillment_policy_rule->rule_value >+ : 'any'; >+ $rules->{returnbranch} = defined $returnbranch_rule >+ ? $returnbranch_rule->rule_value >+ : 'homebranch'; > > return $rules; > } >-- >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 18928
:
65241
|
65242
|
71005
|
71006
|
81096
|
81097
|
81098
|
81099
|
82933
|
82934
|
82935
|
82936
|
85487
|
85488
|
85489
|
85490
|
85491
|
86134
|
86135
|
86136
|
86137
|
86138
|
86139
|
88659
|
89017
|
89018
|
89019
|
89020
|
89021
|
89022
|
89023
|
89024
|
89333
|
89334
|
89336
|
89338
|
89339
|
89340
|
89341
|
89342
|
89343
|
89344
|
89345
|
89346
|
89347
|
89348
|
89349
|
89377
|
89402
|
89427
|
89428
|
89429
|
89430
|
89431
|
89432
|
89433
|
89434
|
89435
|
89436
|
89437
|
89438
|
89440
|
89441
|
89442
|
89443
|
89444
|
89445
|
89446
|
89447
|
89448
|
89449
|
89450
|
89451
|
89628
|
89629
|
89630
|
89631
|
89632
|
89633
|
89634
|
89635
|
89636
|
89637
|
89638
|
90501
|
91082
|
91083
|
91084
|
91085
|
91086
|
91087
|
91088
|
91089
|
91090
|
91091
|
91092
|
91093
|
91094