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)
committerTomas Cohen Arazi <tomascohen@gmail.com>
Mon, 8 Jun 2015 18:20:23 +0000 (15:20 -0300)
commitd82aeb352f35ec37fdd62fed7e9a713168a21c28
treed3a2e31133940349dce1dc3a2ceb36edd0bc60ba
parenta215c79cc9ce512eb2994ebfe4bdd07c79fef871
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>
C4/Utils/DataTables/Members.pm