Bugzilla – Attachment 192116 Details for
Bug 41268
Circulation rules script has many conditionals
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 41268: use variables rather than conditionals
Bug-41268-use-variables-rather-than-conditionals.patch (text/plain), 3.88 KB, created by
Eric Phetteplace
on 2026-01-28 04:22:32 UTC
(
hide
)
Description:
Bug 41268: use variables rather than conditionals
Filename:
MIME Type:
Creator:
Eric Phetteplace
Created:
2026-01-28 04:22:32 UTC
Size:
3.88 KB
patch
obsolete
>From bc752b4d6eb3247cf98f9ba34712f0592441dd21 Mon Sep 17 00:00:00 2001 >From: Nick Clemens <nick@bywatersolutions.com> >Date: Tue, 18 Nov 2025 21:54:43 +0000 >Subject: [PATCH] Bug 41268: use variables rather than conditionals > >Testing plan: > >- Apply patch >- Run tests >- Go to admin > circ and fine rules >- Create a few Holds and bookings policies > - For All Libraries > - For a specific library >- Delete the policies >- (optional) a simple `SELECT * FROM circulation_rules` can confirm policies were created/deleted correctly > >Signed-off-by: Eric Phetteplace <ephetteplace@cca.edu> >--- > admin/smart-rules.pl | 75 ++++++++++---------------------------------- > 1 file changed, 16 insertions(+), 59 deletions(-) > >diff --git a/admin/smart-rules.pl b/admin/smart-rules.pl >index 7f5448f511..577b434315 100755 >--- a/admin/smart-rules.pl >+++ b/admin/smart-rules.pl >@@ -204,66 +204,23 @@ if ( $op eq 'cud-delete' ) { > ); > } > } elsif ( $op eq 'cud-delete-branch-item' ) { >- my $itemtype = $input->param('itemtype'); >- if ( $branch eq "*" ) { >- if ( $itemtype eq "*" ) { >- Koha::CirculationRules->set_rules( >- { >- branchcode => undef, >- itemtype => undef, >- rules => { >- holdallowed => undef, >- hold_fulfillment_policy => undef, >- bookings_lead_period => undef, >- bookings_trail_period => undef, >- returnbranch => undef, >- } >- } >- ); >- } else { >- Koha::CirculationRules->set_rules( >- { >- branchcode => undef, >- itemtype => $itemtype, >- rules => { >- holdallowed => undef, >- hold_fulfillment_policy => undef, >- bookings_lead_period => undef, >- bookings_trail_period => undef, >- returnbranch => undef, >- } >- } >- ); >- } >- } elsif ( $itemtype eq "*" ) { >- Koha::CirculationRules->set_rules( >- { >- branchcode => $branch, >- itemtype => undef, >- rules => { >- holdallowed => undef, >- hold_fulfillment_policy => undef, >- bookings_lead_period => undef, >- bookings_trail_period => undef, >- returnbranch => undef, >- } >- } >- ); >- } else { >- Koha::CirculationRules->set_rules( >- { >- branchcode => $branch, >- itemtype => $itemtype, >- rules => { >- holdallowed => undef, >- hold_fulfillment_policy => undef, >- bookings_lead_period => undef, >- bookings_trail_period => undef, >- returnbranch => undef, >- } >+ my $itemtype = $input->param('itemtype'); >+ my $rule_branch = $branch eq '*' ? undef : $branch; >+ my $rule_itemtype = >+ $itemtype eq '*' ? undef : $itemtype; #NOTE: This shouldn't be a thing - is a branch default rule if '*' >+ Koha::CirculationRules->set_rules( >+ { >+ branchcode => $rule_branch, >+ itemtype => $rule_itemtype, >+ rules => { >+ holdallowed => undef, >+ hold_fulfillment_policy => undef, >+ bookings_lead_period => undef, >+ bookings_trail_period => undef, >+ returnbranch => undef, > } >- ); >- } >+ } >+ ); > } > > # save the values entered >-- >2.52.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 41268
:
189689
|
192116
|
192343
|
192344
|
192382
|
192383