CRM-13981 - Fix default value bug introduced in
133e2c9
This commit cleans up a useless foreach loop that didn't do anything (the conditional would always evaluate to TRUE)
and fixes a bug with setting default values:
It seems that with Quickform, calling $form->setDefults with $defaults['foo']['bar'] = $value is "almost" equivalent to
$defaults["foo[bar]"] = $value but with one key difference: the latter always trumps the former.
So because the buildProfile function uses the latter method to set country default value to defaultContactCountry
(e.g. United States), that would always override the "correct" default value which is set here.