Bug 14344: uninitialized value warning C4/Utils/DataTables/Members.pm
authorTomas Cohen Arazi <tomascohen@gmail.com>
Fri, 5 Jun 2015 15:01:28 +0000 (12:01 -0300)
committerChris Cormack <chrisc@catalyst.net.nz>
Mon, 8 Jun 2015 23:08:46 +0000 (11:08 +1200)
commitc0c16392b18542c733210ff5855e74492b057af1
treec5f316dd62aae58277fccd3befe9d85ad37561e0
parent494d824d4f0b17f423b6c585b3fb7942b830625c
Bug 14344: uninitialized value warning C4/Utils/DataTables/Members.pm

The condition for the assignment depends on $searchtype to be defined
and equal to 'contains'. So this change doesn't change the semantics.

-            if $term !~ /^%/
-                and $searchtype eq "contain";
+            if (defined $searchtype) && $searchtype eq "contain"
+                && $term !~ /^%/;

To test:
- Home -> Circulation -> Checkout
- Search for a user that does not exist (I searched 'whywouldthisexist') on the intranet interface.
- Look at the intranet logs
=> FAIL: you get "Use of uninitialized value $searchtype in string eq at.,,"
- Apply the patch
- Repeat the search
=> SUCCESS: No warning
- Sign off :-D

NOTE: Other pages are more forgiving. Tweaked test plan.

Signed-off-by: Mark Tompsett <mtompset@hotmail.com>
Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Signed-off-by: Tomas Cohen Arazi <tomascohen@gmail.com>
(cherry picked from commit d82aeb352f35ec37fdd62fed7e9a713168a21c28)
Signed-off-by: Chris Cormack <chrisc@catalyst.net.nz>
C4/Utils/DataTables/Members.pm