dev/core#1374 Fix search formValue handling on contribution search
authoreileen <emcnaughton@wikimedia.org>
Fri, 8 Nov 2019 21:42:00 +0000 (10:42 +1300)
committereileen <emcnaughton@wikimedia.org>
Fri, 8 Nov 2019 23:47:46 +0000 (12:47 +1300)
commite9f51713e9913ee2f5dd5f3f65af6ff027af4cca
tree167c917d51f74e6a90016d28d2cea7fad03711f6
parentd13f737ea048f888053d851bd59ac7b46b690c69
dev/core#1374 Fix search formValue handling on contribution search

This fixes 2 issues
1) Search params being lost when editing a related entity per
https://lab.civicrm.org/dev/core/issues/1374
2) force=1&sort_name=p not working in contribution search url

In digging I concluded the problem is we have 3 underlying arrays which we keep jumbling together

1) formValues - the actual submitted values, augmented by any  url passed params
2) the default values - values to load by default on the form
3) our working query params - a copy of formValues that we have prepared for the query

We need to stop mangling them. I added subtle code comments
CRM/Contact/Form/Search/Advanced.php
CRM/Contribute/Form/Search.php
CRM/Core/Form/Search.php
tests/phpunit/CRM/Contact/BAO/SavedSearchTest.php