Bug 27861 - Warning in C4/XSLT.pm - use of uninitialized value in numeric eq (==)
Summary: Warning in C4/XSLT.pm - use of uninitialized value in numeric eq (==)
Status: CLOSED FIXED
Alias: None
Product: Koha
Classification: Unclassified
Component: Templates (show other bugs)
Version: master
Hardware: All All
: P5 - low normal (vote)
Assignee: Fridolin Somers
QA Contact: Testopia
URL:
Keywords:
Depends on:
Blocks: 25790
  Show dependency treegraph
 
Reported: 2021-03-04 14:46 UTC by Fridolin Somers
Modified: 2022-05-17 11:57 UTC (History)
4 users (show)

See Also:
Change sponsored?: ---
Patch complexity: Trivial patch
Documentation contact:
Documentation submission:
Text to go in the release notes:
Version(s) released in:
21.05.00,20.11.06,20.05.12


Attachments
Bug 27861: Warning in C4/XSLT.pm - use of uninitialized value in numeric eq (==) (1.23 KB, patch)
2021-03-04 16:34 UTC, Fridolin Somers
Details | Diff | Splinter Review
Bug 27861: Warning in C4/XSLT.pm - use of uninitialized value in numeric eq (==) (1.33 KB, patch)
2021-04-16 12:47 UTC, Owen Leonard
Details | Diff | Splinter Review
Bug 27861: Warning in C4/XSLT.pm - use of uninitialized value in numeric eq (==) (1.39 KB, patch)
2021-04-19 13:06 UTC, Martin Renvoize
Details | Diff | Splinter Review

Note You need to log in before you can comment on or make changes to this bug.
Description Fridolin Somers 2021-03-04 14:46:53 UTC
In C4/XSLT.pm :
 elsif ( exists $itemtypes->{ $item->effective_itemtype }
            && $itemtypes->{ $item->effective_itemtype }->{notforloan} == 1 )

itemtype.notforloan is null by default, its generated a warning in logs.
Comment 1 Fridolin Somers 2021-03-04 16:34:07 UTC
Created attachment 117752 [details] [review]
Bug 27861: Warning in C4/XSLT.pm - use of uninitialized value in numeric eq (==)

In C4/XSLT.pm :
 elsif ( exists $itemtypes->{ $item->effective_itemtype }
            && $itemtypes->{ $item->effective_itemtype }->{notforloan} == 1 )

itemtype.notforloan is null by default, its generated a warning in logs.

Test plan :
1) Choose a record with itemtype.notforloan = NULL
2) Display the record using XSLT
3) See patch removed warning
Comment 2 Owen Leonard 2021-04-15 12:37:51 UTC
I couldn't reproduce this error. The data in my test system didn't have NULL in itemtypes.notforloan, it had zero. But I tested both ways.
Comment 3 Fridolin Somers 2021-04-16 11:50:42 UTC
(In reply to Owen Leonard from comment #2)
> I couldn't reproduce this error. The data in my test system didn't have NULL
> in itemtypes.notforloan, it had zero. But I tested both ways.

Ahhh I found it :
You need to perform a search (with XSLT display) at OPAC.
Staff interface does not call this code.

Please retry.
Comment 4 Owen Leonard 2021-04-16 12:47:10 UTC
Created attachment 119731 [details] [review]
Bug 27861: Warning in C4/XSLT.pm - use of uninitialized value in numeric eq (==)

In C4/XSLT.pm :
 elsif ( exists $itemtypes->{ $item->effective_itemtype }
            && $itemtypes->{ $item->effective_itemtype }->{notforloan} == 1 )

itemtype.notforloan is null by default, its generated a warning in logs.

Test plan :
1) Choose a record with itemtype.notforloan = NULL
2) Perform a search in the OPAC which will return results which
   include the record using XSLT
3) See patch removed warning

Signed-off-by: Owen Leonard <oleonard@myacpl.org>
Comment 5 Owen Leonard 2021-04-16 12:47:48 UTC
(In reply to Fridolin Somers from comment #3)

> You need to perform a search (with XSLT display) at OPAC.

That was it! I modified the test plan in the commit message.
Comment 6 Martin Renvoize 2021-04-19 13:06:22 UTC
Created attachment 119852 [details] [review]
Bug 27861: Warning in C4/XSLT.pm - use of uninitialized value in numeric eq (==)

In C4/XSLT.pm :
 elsif ( exists $itemtypes->{ $item->effective_itemtype }
            && $itemtypes->{ $item->effective_itemtype }->{notforloan} == 1 )

itemtype.notforloan is null by default, its generated a warning in logs.

Test plan :
1) Choose a record with itemtype.notforloan = NULL
2) Perform a search in the OPAC which will return results which
   include the record using XSLT
3) See patch removed warning

Signed-off-by: Owen Leonard <oleonard@myacpl.org>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Comment 7 Jonathan Druart 2021-04-21 08:47:04 UTC
Pushed to master for 21.05, thanks to everybody involved!
Comment 8 Fridolin Somers 2021-04-29 09:41:50 UTC
Pushed to 20.11.x for 20.11.06
Comment 9 Andrew Fuerste-Henry 2021-05-24 15:24:21 UTC
Pushed to 20.05.x for 20.05.12
Comment 10 Victor Grousset/tuxayo 2021-05-24 16:56:50 UTC
Not backported to oldoldstable (19.11.x). Feel free to ask if it's needed.