Skip to content

Commit

Permalink
[NFC] Reformat Contact_Form_Search_Advanced
Browse files Browse the repository at this point in the history
Fix array style
  • Loading branch information
eileenmcnaughton committed Nov 8, 2019
1 parent fe8d0a0 commit 3fe39b9
Showing 1 changed file with 27 additions and 27 deletions.
54 changes: 27 additions & 27 deletions CRM/Contact/Form/Search/Advanced.php
Original file line number Diff line number Diff line change
Expand Up @@ -64,19 +64,19 @@ public function buildQuickForm() {
CRM_Contact_Form_Search_Criteria::basic($this);
}

$allPanes = array();
$paneNames = array(
$allPanes = [];
$paneNames = [
ts('Address Fields') => 'location',
ts('Custom Fields') => 'custom',
ts('Activities') => 'activity',
ts('Relationships') => 'relationship',
ts('Demographics') => 'demographics',
ts('Notes') => 'notes',
ts('Change Log') => 'changeLog',
);
];

//check if there are any custom data searchable fields
$extends = array_merge(array('Contact', 'Individual', 'Household', 'Organization'),
$extends = array_merge(['Contact', 'Individual', 'Household', 'Organization'],
CRM_Contact_BAO_ContactType::subTypes()
);
$groupDetails = CRM_Core_BAO_CustomGroup::getGroupDetail(NULL, TRUE,
Expand All @@ -95,7 +95,7 @@ public function buildQuickForm() {

$components = CRM_Core_Component::getEnabledComponents();

$componentPanes = array();
$componentPanes = [];
foreach ($components as $name => $component) {
if (in_array($name, array_keys($this->_searchOptions)) &&
$this->_searchOptions[$name] &&
Expand All @@ -106,29 +106,29 @@ public function buildQuickForm() {
}
}

usort($componentPanes, array('CRM_Utils_Sort', 'cmpFunc'));
usort($componentPanes, ['CRM_Utils_Sort', 'cmpFunc']);
foreach ($componentPanes as $name => $pane) {
// FIXME: we should change the use of $name here to keyword
$paneNames[$pane['title']] = $pane['name'];
}

$hookPanes = array();
$hookPanes = [];
CRM_Contact_BAO_Query_Hook::singleton()->registerAdvancedSearchPane($hookPanes);
$paneNames = array_merge($paneNames, $hookPanes);

$this->_paneTemplatePath = array();
$this->_paneTemplatePath = [];
foreach ($paneNames as $name => $type) {
if (!array_key_exists($type, $this->_searchOptions) && !in_array($type, $hookPanes)) {
continue;
}

$allPanes[$name] = array(
$allPanes[$name] = [
'url' => CRM_Utils_System::url('civicrm/contact/search/advanced',
"snippet=1&searchPane=$type&qfKey={$this->controller->_key}"
),
'open' => 'false',
'id' => $type,
);
];

// see if we need to include this paneName in the current form
if ($this->_searchPane == $type || !empty($_POST["hidden_{$type}"]) ||
Expand Down Expand Up @@ -236,10 +236,10 @@ public function postProcess() {
// FIXME: couldn't figure out a good place to do this,
// FIXME: so leaving this as a dependency for now
if (array_key_exists('contribution_amount_low', $this->_formValues)) {
foreach (array(
'contribution_amount_low',
'contribution_amount_high',
) as $f) {
foreach ([
'contribution_amount_low',
'contribution_amount_high',
] as $f) {
$this->_formValues[$f] = CRM_Utils_Rule::cleanMoney($this->_formValues[$f]);
}
}
Expand All @@ -259,7 +259,7 @@ public function postProcess() {
}

if (isset($this->_groupID) && empty($this->_formValues['group'])) {
$this->_formValues['group'] = array($this->_groupID => 1);
$this->_formValues['group'] = [$this->_groupID => 1];
}

//search for civicase
Expand All @@ -269,12 +269,12 @@ public function postProcess() {
!$this->_formValues['case_owner'] &&
!$this->_force
) {
foreach (array(
'case_type_id',
'case_status_id',
'case_deleted',
'case_tags',
) as $caseCriteria) {
foreach ([
'case_type_id',
'case_status_id',
'case_deleted',
'case_tags',
] as $caseCriteria) {
if (!empty($this->_formValues[$caseCriteria])) {
$allCases = TRUE;
$this->_formValues['case_owner'] = 1;
Expand Down Expand Up @@ -337,7 +337,7 @@ public function normalizeFormValues() {
}

$config = CRM_Core_Config::singleton();
$specialParams = array(
$specialParams = [
'financial_type_id',
'contribution_soft_credit_type_id',
'contribution_status',
Expand All @@ -355,11 +355,11 @@ public function normalizeFormValues() {
'group',
'contact_tags',
'preferred_communication_method',
);
$changeNames = array(
];
$changeNames = [
'status_id' => 'activity_status_id',
'priority_id' => 'activity_priority_id',
);
];
CRM_Contact_BAO_Query::processSpecialFormValue($this->_formValues, $specialParams, $changeNames);

$taglist = CRM_Utils_Array::value('contact_taglist', $this->_formValues);
Expand Down Expand Up @@ -407,7 +407,7 @@ public function normalizeDefaultValues($defaults) {
// This tag is a tagset
unset($defaults['contact_tags'][$key]);
if (!isset($defaults[$element])) {
$defaults[$element] = array();
$defaults[$element] = [];
}
$defaults[$element][] = $tagId;
}
Expand All @@ -434,7 +434,7 @@ public function loadDefaultCountryBasedOnState(&$defaults) {
$defaults['country'] = CRM_Core_DAO::singleValueQuery(
"SELECT country_id FROM civicrm_state_province
WHERE id = %1",
array(1 => array($defaults['state_province'][0], 'Integer'))
[1 => [$defaults['state_province'][0], 'Integer']]
);
}
}
Expand Down

0 comments on commit 3fe39b9

Please sign in to comment.