Bugzilla – Attachment 189689 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.53 KB, created by
Nick Clemens (kidclamp)
on 2025-11-18 21:55:10 UTC
(
hide
)
Description:
Bug 41268: use variables rather than conditionals
Filename:
MIME Type:
Creator:
Nick Clemens (kidclamp)
Created:
2025-11-18 21:55:10 UTC
Size:
3.53 KB
patch
obsolete
>From 9317e5e56e9febd94dfd45041ea7677821571fef 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 > >--- > 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 7f5448f511c..577b4343155 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.39.5
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