Bug 14344: uninitialized value warning C4/Utils/DataTables/Members.pm
commitc8a83c0804b36bf3e814b8483c013bc716d1d806
authorTomas Cohen Arazi <tomascohen@gmail.com>
Fri, 5 Jun 2015 15:01:28 +0000 (5 12:01 -0300)
committerLiz Rea <wizzyrea@gmail.com>
Mon, 15 Jun 2015 22:21:23 +0000 (16 10:21 +1200)
tree2a4e1e000ee72fda4f1751b3e514fbf6a115663a
parentdd6bb8fb380721323bc2f3b331430c7315f19b6d
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>
Signed-off-by: Liz Rea <wizzyrea@gmail.com>
C4/Utils/DataTables/Members.pm