Bugzilla – Attachment 144143 Details for
Bug 32262
smart-rules: Some rules can be created but are not visible on interface
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 32262: Handle non-existing circ rules
Bug-32262-Handle-non-existing-circ-rules.patch (text/plain), 5.60 KB, created by
Jonathan Druart
on 2022-11-22 08:40:12 UTC
(
hide
)
Description:
Bug 32262: Handle non-existing circ rules
Filename:
MIME Type:
Creator:
Jonathan Druart
Created:
2022-11-22 08:40:12 UTC
Size:
5.60 KB
patch
obsolete
>From 926b5aee57b7da819217b58dba694c273e765f99 Mon Sep 17 00:00:00 2001 >From: Jonathan Druart <jonathan.druart@bugs.koha-community.org> >Date: Tue, 22 Nov 2022 09:34:44 +0100 >Subject: [PATCH] Bug 32262: Handle non-existing circ rules > >Some rules are not displayed on the UI, even if they exist in the DB, >that's confusing. >That's because we are implicitely returning 'undef' from >CirculationRules.Search, and perl returns an empty string for undef in >a string context. Which means "rules.defined" is always true. > >This patch is ugly and really hope somebody else will come with a better >solution. > >Test plan: >I don't know, search for regressions on the circ rule UI?... :D >--- > Koha/Template/Plugin/CirculationRules.pm | 1 + > .../prog/en/modules/admin/smart-rules.tt | 14 +++++++------- > 2 files changed, 8 insertions(+), 7 deletions(-) > >diff --git a/Koha/Template/Plugin/CirculationRules.pm b/Koha/Template/Plugin/CirculationRules.pm >index 5e00e456380..a295599a074 100644 >--- a/Koha/Template/Plugin/CirculationRules.pm >+++ b/Koha/Template/Plugin/CirculationRules.pm >@@ -88,6 +88,7 @@ sub Search { > > return $rule if $params->{want_rule}; > return $rule->rule_value if $rule; >+ return 'undef'; > } > > =head3 Renewals >diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/smart-rules.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/admin/smart-rules.tt >index 593b9dab8ee..b4ff7c4dced 100644 >--- a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/smart-rules.tt >+++ b/koha-tmpl/intranet-tmpl/prog/en/modules/admin/smart-rules.tt >@@ -812,7 +812,7 @@ > [% SET patron_maxonsiteissueqty = CirculationRules.Search( branchcode, c, undef, 'patron_maxonsiteissueqty' ) %] > [% SET max_holds = CirculationRules.Search( branchcode, c, undef, 'max_holds' ) %] > >- [% IF ( patron_maxissueqty.defined && patron_maxissueqty != '' ) || ( patron_maxonsiteissueqty.defined && patron_maxonsiteissueqty != '' ) || ( max_holds.defined && max_holds != '' ) %] >+ [% IF patron_maxissueqty != 'undef' || patron_maxonsiteissueqty != 'undef' || max_holds != 'undef' %] > <tr> > <td> > [% IF c == undef %] >@@ -822,21 +822,21 @@ > [% END %] > </td> > <td> >- [% IF patron_maxissueqty.defined && patron_maxissueqty != '' %] >+ [% IF patron_maxissueqty != '' && patron_maxissueqty != 'undef' %] > [% patron_maxissueqty | html %] > [% ELSE %] > <span>Unlimited</span> > [% END %] > </td> > <td> >- [% IF patron_maxonsiteissueqty.defined && patron_maxonsiteissueqty != '' %] >+ [% IF patron_maxonsiteissueqty != '' && patron_maxonsiteissueqty != 'undef' %] > [% patron_maxonsiteissueqty | html %] > [% ELSE %] > <span>Unlimited</span> > [% END %] > </td> > <td> >- [% IF max_holds.defined && max_holds != '' %] >+ [% IF max_holds != '' && max_holds != 'undef' %] > [% max_holds | html %] > [% ELSE %] > <span>Unlimited</span> >@@ -891,7 +891,7 @@ > > [% SET waiting_hold_cancellation = CirculationRules.Search( current_branch, c, i, 'waiting_hold_cancellation' ) %] > >- [% IF ( waiting_hold_cancellation.defined && waiting_hold_cancellation != '' ) %] >+ [% IF ( waiting_hold_cancellation != '' && waiting_hold_cancellation != 'undef' ) %] > <tr> > <td> > [% IF c == '*' %] >@@ -971,13 +971,13 @@ > [% NEXT UNLESS c %] > [% SET open_article_requests_limit = CirculationRules.Search( branchcode, c, undef, 'open_article_requests_limit' ) %] > >- [% IF ( open_article_requests_limit.defined && open_article_requests_limit != '' ) %] >+ [% IF ( open_article_requests_limit != '' && open_article_requests_limit != 'undef' ) %] > <tr> > <td> > [% Categories.GetName(c) | html %] > </td> > <td> >- [% IF open_article_requests_limit.defined && open_article_requests_limit != '' %] >+ [% IF open_article_requests_limit != '' && open_article_requests_limit != 'undef' %] > [% open_article_requests_limit | html %] > [% ELSE %] > <span>Unlimited</span> >-- >2.25.1
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 32262
: 144143