Bug 23095

Summary: Circulation rules not displayed (empty vs null)
Product: Koha Reporter: Jonathan Druart <jonathan.druart>
Component: Architecture, internals, and plumbingAssignee: Jonathan Druart <jonathan.druart>
Status: CLOSED FIXED QA Contact: Tomás Cohen Arazi <tomascohen>
Severity: major    
Priority: P5 - low CC: fridolin.somers, lucas, tomascohen
Version: Main   
Hardware: All   
OS: All   
See Also: https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=18928
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=23104
Change sponsored?: --- Patch complexity: ---
Documentation contact: Documentation submission:
Text to go in the release notes:
Version(s) released in:
19.11.00,19.05.01
Bug Depends on: 18925    
Bug Blocks:    
Attachments: Bug 23095: Correctly display circulation rules (0 vs undef)
Bug 23095: Correctly display circulation rules (0 vs undef)
Bug 23095: Correctly display circulation rules (0 vs undef)

Description Jonathan Druart 2019-06-11 15:44:02 UTC
From the following commit:
  commit d1303ca834dd0b08fc1d44476cfbbb8b729b6165
  Bug 18925: (follow-up) Fix null/empty behavior

The global test must have been adjusted as well to catch empty strings.

Actually we are expecting the plugin to return undef but the template variable contains an empty string.

So the test should only be [% IF var != '' %] instead of [% IF var.defined && var != '' %] but I prefer to keep it as it for now.
Comment 1 Jonathan Druart 2019-06-11 15:47:16 UTC
Created attachment 90502 [details] [review]
Bug 23095: Correctly display circulation rules (0 vs undef)

From the following commit:
  commit d1303ca834dd0b08fc1d44476cfbbb8b729b6165
  Bug 18925: (follow-up) Fix null/empty behavior

The global test must have been adjusted as well to catch empty strings.

Actually we are expecting the plugin to return undef but the template variable contains an empty string.

So the test should only be [% IF var != '' %] instead of [% IF var.defined && var != '' %]
but I prefer to keep it as it for now.

Test plan:
In the section "Default checkout, hold policy by patron category"
Set total checkouts = blank
    total on-site checkouts = blank
    total holds = 0
Save
=> Without this patch the line will not appear
=> With this patch applied there must be "unlimited, unlimited, 0"
Comment 2 Mark Tompsett 2019-06-11 16:53:56 UTC
Created attachment 90510 [details] [review]
Bug 23095: Correctly display circulation rules (0 vs undef)

From the following commit:
  commit d1303ca834dd0b08fc1d44476cfbbb8b729b6165
  Bug 18925: (follow-up) Fix null/empty behavior

The global test must have been adjusted as well to catch empty strings.

Actually we are expecting the plugin to return undef but the template variable contains an empty string.

So the test should only be [% IF var != '' %] instead of [% IF var.defined && var != '' %]
but I prefer to keep it as it for now.

Test plan:
In the section "Default checkout, hold policy by patron category"
Set total checkouts = blank
    total on-site checkouts = blank
    total holds = 0
Save
=> Without this patch the line will not appear
=> With this patch applied there must be "unlimited, unlimited, 0"

Signed-off-by: Mark Tompsett <mtompset@hotmail.com>
Comment 3 Jonathan Druart 2019-06-12 14:02:19 UTC
(In reply to Jonathan Druart from comment #1)
> Actually we are expecting the plugin to return undef but the template
> variable contains an empty string.

That's wrong, it's an empty string in DB.
Comment 4 Tomás Cohen Arazi 2019-06-12 18:53:22 UTC Comment hidden (obsolete)
Comment 5 Tomás Cohen Arazi 2019-06-12 20:04:28 UTC
Created attachment 90540 [details] [review]
Bug 23095: Correctly display circulation rules (0 vs undef)

From the following commit:
  commit d1303ca834dd0b08fc1d44476cfbbb8b729b6165
  Bug 18925: (follow-up) Fix null/empty behavior

The global test must have been adjusted as well to catch empty strings.

Actually we are expecting the plugin to return undef but the template variable contains an empty string.

So the test should only be [% IF var != '' %] instead of [% IF var.defined && var != '' %]
but I prefer to keep it as it for now.

Test plan:
In the section "Default checkout, hold policy by patron category"
Set total checkouts = blank
    total on-site checkouts = blank
    total holds = 0
Save
=> Without this patch the line will not appear
=> With this patch applied there must be "unlimited, unlimited, 0"

Signed-off-by: Mark Tompsett <mtompset@hotmail.com>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
Comment 6 Martin Renvoize 2019-06-13 11:07:49 UTC
Nice work!

Pushed to master for 19.11.00
Comment 7 Fridolin Somers 2019-06-17 07:51:43 UTC
Pushed to 19.05.x for 19.05.01
Comment 8 Lucas Gass 2019-06-26 14:28:59 UTC
no backport for 18.11.x series as it is missing the dependency