Bugzilla – Attachment 141393 Details for
Bug 31333
Add the ability to limit purchase suggestions by patron category
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 31333: (QA follow-up) Simplify code
Bug-31333-QA-follow-up-Simplify-code.patch (text/plain), 1.61 KB, created by
Tomás Cohen Arazi (tcohen)
on 2022-10-05 18:52:15 UTC
(
hide
)
Description:
Bug 31333: (QA follow-up) Simplify code
Filename:
MIME Type:
Creator:
Tomás Cohen Arazi (tcohen)
Created:
2022-10-05 18:52:15 UTC
Size:
1.61 KB
patch
obsolete
>From 090c54e7d64ad32459107df1b10386fc1506bd2c Mon Sep 17 00:00:00 2001 >From: Tomas Cohen Arazi <tomascohen@theke.io> >Date: Wed, 5 Oct 2022 15:14:22 -0300 >Subject: [PATCH] Bug 31333: (QA follow-up) Simplify code > >The new syspref is a deny-list. So not being part of the list means you >are allowed. This was not that clear reading the code, so this patch >tries to simplify the logic. Better handling on undef syspref value is >added as well to avoid useless warnings. > >This patch does the following changes: >- Uses `any` instead of `grep`. This has the effect of just returning a > boolean on the first match, instead of keep looping until de array > >Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io> >--- > Koha/Patron/Category.pm | 13 ++++++------- > 1 file changed, 6 insertions(+), 7 deletions(-) > >diff --git a/Koha/Patron/Category.pm b/Koha/Patron/Category.pm >index 39c56be14a..b700cb298c 100644 >--- a/Koha/Patron/Category.pm >+++ b/Koha/Patron/Category.pm >@@ -220,14 +220,13 @@ sub can_make_suggestions { > my ( $self ) = @_; > > if ( C4::Context->preference('suggestion') ) { >- my @patron_categories = split ',', C4::Context->preference('suggestionPatronCategoryExceptions'); >- if ( @patron_categories ) { >- my $categorycode = $self->categorycode; >- return if grep {$_ eq $categorycode } @patron_categories; >- } >- return 1; >+ >+ my @patron_categories = split ',', C4::Context->preference('suggestionPatronCategoryExceptions') // q{}; >+ >+ return !any {$_ eq $self->categorycode } @patron_categories; > } >- return; >+ >+ return 0; > } > > =head2 Internal methods >-- >2.37.3
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 31333
:
139112
|
139113
|
139114
|
139165
|
139897
|
139898
|
139935
|
139936
|
140169
|
140170
|
140171
|
140172
|
140173
|
140174
|
140270
|
140271
|
140272
|
140273
|
140274
|
140275
|
140276
|
141392
| 141393