Bug 12143 - hiding alternate address on patron self registration doesn't hide heading

This patch fixes the following issue: in OPAC self registration form,
even if all alternate address fields are configured as hidden,
the heading for "Alternate address" still shows.

To test:

1/ Confirm the issue: hide all alternate adres field names (i.e., enter
B_address|B_address2|B_city|B_state|B_zipcode|B_country|B_phone|
B_email|contactnote into PatronSelfRegistrationBorrowerUnwantedField
system prefrence).
2/ Observe that "Alternate address" section heading still shows
in patron self registration form ("your personal details" tab),
despite that all section fields are configured as hidden.
3/ Apply patch.
4/ Reload OPAC self registration form; confirm that "Alternate address"
is not displyed any longer, and the issue is now fixed.
5/ Remove some field name (e.g. B_address2) from
PatronSelfRegistrationBorrowerUnwantedField; ensure that "Alternate
address" heading does show if at least one section field is not
hidden.
6/ Test steps 1-5 should be performed/repeated in both bootstrap
and prog OPAC themes.

Followed test plan with prog and bootstrap themes, works as expected.
Signed-off-by: Marc Véron <veron@veron.ch>

Signed-off-by: Katrin Fischer <Katrin.Fischer.83@web.de>
Signed-off-by: Chris Cormack <chrisc@catalyst.net.nz>
Bug 12443 - Initial re-factoring of buildQuery

This patch reduces three repeated code fragments into a single
internal subroutine, which is easier to read, has comments,
and should make it easier to refactor more buildQuery code
in the future.

_TEST PLAN_

Before applying

1) Run a bunch of different searches in the staff client and OPAC
in separate tabs

2) Apply the patch

3) Run the same searches again (maybe in yet more tabs) and notice
that the results are exactly the same.

Signed-off-by: Bernardo Gonzalez Kriegel <bgkriegel@gmail.com>
Same results, no errors.

Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Signed-off-by: Tomas Cohen Arazi <tomascohen@gmail.com>
Bug 12443: (QA followup) Unit tests for _build_initial_query

This followup adds uint tests for the newly introduced function.
It is really basic, but covers all scenarios for the new function,
and will help us prevent regressions in future patches.

Regards
To+

Signed-off-by: Tomas Cohen Arazi <tomascohen@gmail.com>