From dc98079b06a4e107941cdfd27b48889823111390 Mon Sep 17 00:00:00 2001 From: Tim Otten Date: Tue, 6 Jan 2015 13:21:23 -0800 Subject: [PATCH] INFRA-132 - CRM/Profile - phpcbf --- CRM/Profile/Form.php | 15 ++++++++------- CRM/Profile/Form/Edit.php | 3 +-- CRM/Profile/Form/Search.php | 3 ++- CRM/Profile/Page/Dynamic.php | 9 +++++---- CRM/Profile/Page/Listings.php | 1 - CRM/Profile/Page/MultipleRecordFieldsListing.php | 16 ++++++++++------ CRM/Profile/Page/Router.php | 1 - CRM/Profile/Selector/Listings.php | 8 +++----- 8 files changed, 29 insertions(+), 27 deletions(-) diff --git a/CRM/Profile/Form.php b/CRM/Profile/Form.php index a1e45d6627..95c44a49dc 100644 --- a/CRM/Profile/Form.php +++ b/CRM/Profile/Form.php @@ -209,8 +209,7 @@ class CRM_Profile_Form extends CRM_Core_Form { if ($this->_mode == self::MODE_EDIT) { //specifies the action being done on a multi record field $multiRecordAction = CRM_Utils_Request::retrieve('multiRecord', 'String', $this); - $this->_multiRecord = (!is_numeric($multiRecordAction)) ? - CRM_Core_Action::resolve($multiRecordAction) : $multiRecordAction; + $this->_multiRecord = (!is_numeric($multiRecordAction)) ? CRM_Core_Action::resolve($multiRecordAction) : $multiRecordAction; if ($this->_multiRecord) { $this->set('multiRecord', $this->_multiRecord); } @@ -321,7 +320,7 @@ class CRM_Profile_Form extends CRM_Core_Form { array(1 => $this->_gid) )); } elseif (empty($this->_multiRecordFields)) { - CRM_Core_Error::fatal(ts('No Multi-Record Fields configured for this profile (gid=%1)', + CRM_Core_Error::fatal(ts('No Multi-Record Fields configured for this profile (gid=%1)', array(1 => $this->_gid) )); } @@ -450,7 +449,7 @@ class CRM_Profile_Form extends CRM_Core_Form { $fieldIds[] = CRM_Core_BAO_CustomField::getKeyID($key); } - $defaultValues = array( ); + $defaultValues = array(); if ($this->_multiRecord && $this->_multiRecord == CRM_Core_Action::UPDATE) { $defaultValues = CRM_Core_BAO_CustomValueTable::getEntityValues($this->_id, NULL, $fieldIds, TRUE); if ($this->_recordExists == TRUE) { @@ -590,9 +589,11 @@ class CRM_Profile_Form extends CRM_Core_Form { case self::MODE_REGISTER: CRM_Utils_Hook::buildProfile($this->_ufGroup['name']); break; + case self::MODE_SEARCH: CRM_Utils_Hook::searchProfile($this->_ufGroup['name']); break; + default: } @@ -649,7 +650,7 @@ class CRM_Profile_Form extends CRM_Core_Form { if ( ($profileType != 'Contact' && !$this->_isContactActivityProfile) && - (($profileSubType && !empty($contactSubtypes) && (!in_array($profileSubType,$contactSubtypes))) || + (($profileSubType && !empty($contactSubtypes) && (!in_array($profileSubType, $contactSubtypes))) || ($profileType != $contactType)) ) { $return = TRUE; @@ -1067,8 +1068,8 @@ class CRM_Profile_Form extends CRM_Core_Form { 1 => array($this->_recordId, 'Integer'), 2 => array($this->_id, 'Integer') ); - CRM_Core_DAO::executeQuery($sql, $sqlParams); - CRM_Core_Session::setStatus(ts('Your record has been deleted.'), ts('Deleted'), 'success'); + CRM_Core_DAO::executeQuery($sql, $sqlParams); + CRM_Core_Session::setStatus(ts('Your record has been deleted.'), ts('Deleted'), 'success'); } } return; diff --git a/CRM/Profile/Form/Edit.php b/CRM/Profile/Form/Edit.php index 2f9c4dc291..6fa5ec876e 100644 --- a/CRM/Profile/Form/Edit.php +++ b/CRM/Profile/Form/Edit.php @@ -151,8 +151,7 @@ SELECT module,is_reserved // set the title if ($this->_multiRecord && $this->_customGroupTitle) { - $groupTitle = ($this->_multiRecord & CRM_Core_Action::UPDATE) ? - 'Edit ' . $this->_customGroupTitle . ' Record' : $this->_customGroupTitle; + $groupTitle = ($this->_multiRecord & CRM_Core_Action::UPDATE) ? 'Edit ' . $this->_customGroupTitle . ' Record' : $this->_customGroupTitle; } else { $groupTitle = $this->_ufGroup['title']; diff --git a/CRM/Profile/Form/Search.php b/CRM/Profile/Form/Search.php index f7af34b6be..f89d2e173d 100644 --- a/CRM/Profile/Form/Search.php +++ b/CRM/Profile/Form/Search.php @@ -130,5 +130,6 @@ class CRM_Profile_Form_Search extends CRM_Profile_Form { * * @return void */ - public function postProcess() {} + public function postProcess() { + } } diff --git a/CRM/Profile/Page/Dynamic.php b/CRM/Profile/Page/Dynamic.php index 31b05bec99..6411708729 100644 --- a/CRM/Profile/Page/Dynamic.php +++ b/CRM/Profile/Page/Dynamic.php @@ -135,8 +135,7 @@ class CRM_Profile_Page_Dynamic extends CRM_Core_Page { //specifies the action being done on a multi record field $multiRecordAction = CRM_Utils_Request::retrieve('multiRecord', 'String', $this); - $this->_multiRecord = (!is_numeric($multiRecordAction)) ? - CRM_Core_Action::resolve($multiRecordAction) : $multiRecordAction; + $this->_multiRecord = (!is_numeric($multiRecordAction)) ? CRM_Core_Action::resolve($multiRecordAction) : $multiRecordAction; if ($this->_multiRecord) { $this->set('multiRecord', $this->_multiRecord); } @@ -321,9 +320,11 @@ class CRM_Profile_Page_Dynamic extends CRM_Core_Page { //CRM-14338 // Create a unique, non-empty index for each field. $index = $field['title']; - if ($index === '') $index = ' '; - while (array_key_exists($index, $labels)) + if ($index === '') { $index = ' '; + } + while (array_key_exists($index, $labels)) { $index .= ' '; + } $labels[$index] = preg_replace('/\s+|\W+/', '_', $name); } diff --git a/CRM/Profile/Page/Listings.php b/CRM/Profile/Page/Listings.php index 2b6fdc8844..b56a54c8d0 100644 --- a/CRM/Profile/Page/Listings.php +++ b/CRM/Profile/Page/Listings.php @@ -264,7 +264,6 @@ class CRM_Profile_Page_Listings extends CRM_Core_Page { } } - // set the params in session $session = CRM_Core_Session::singleton(); $session->set('profileParams', $this->_params); diff --git a/CRM/Profile/Page/MultipleRecordFieldsListing.php b/CRM/Profile/Page/MultipleRecordFieldsListing.php index 6c7b883337..5e2bd8bef1 100644 --- a/CRM/Profile/Page/MultipleRecordFieldsListing.php +++ b/CRM/Profile/Page/MultipleRecordFieldsListing.php @@ -180,7 +180,7 @@ class CRM_Profile_Page_MultipleRecordFieldsListing extends CRM_Core_Page_Basic { NULL, CRM_Core_Permission::EDIT ); - $multiRecordFields = array( ); + $multiRecordFields = array(); $fieldIDs = NULL; $result = NULL; $multiRecordFieldsWithSummaryListing = CRM_Core_BAO_UFGroup::shiftMultiRecordFields($fields, $multiRecordFields, TRUE); @@ -219,12 +219,12 @@ class CRM_Profile_Page_MultipleRecordFieldsListing extends CRM_Core_Page_Basic { $this->_customGroupTitle = $groupDetail[$customGroupId]['title']; } if ($fieldIDs && !empty($fieldIDs) && $this->_contactId) { - $options = array( ); + $options = array(); $returnProperities = array('html_type', 'data_type', 'date_format', 'time_format', 'default_value', 'is_required'); foreach ($fieldIDs as $key => $fieldID) { $fieldIDs[$key] = !is_numeric($fieldID) ? CRM_Core_BAO_CustomField::getKeyID($fieldID) : $fieldID; $param = array('id' => $fieldIDs[$key]); - $returnValues = array( ); + $returnValues = array(); CRM_Core_DAO::commonRetrieve('CRM_Core_DAO_CustomField', $param, $returnValues, $returnProperities); if ($returnValues['data_type'] == 'Date') { $dateFields[$fieldIDs[$key]] = 1; @@ -317,10 +317,12 @@ class CRM_Profile_Page_MultipleRecordFieldsListing extends CRM_Core_Page_Basic { $supportedDataTypes = array('Float', 'String', 'Int'); $editable = in_array($spec['data_type'], $supportedDataTypes); break; + case 'TextArea': $editable = TRUE; $fieldAttributes['data-type'] = 'textarea'; break; + case 'Radio': case 'Select': case 'Select Country': @@ -340,7 +342,9 @@ class CRM_Profile_Page_MultipleRecordFieldsListing extends CRM_Core_Page_Basic { $op = NULL; if ($this->_pageViewType == 'profileDataView') { - $actionParams = array('recordId' => $recId, 'gid' => $this->_profileId, + $actionParams = array( + 'recordId' => $recId, + 'gid' => $this->_profileId, 'id' => $this->_contactId); $op = 'profile.multiValue.row'; } @@ -385,14 +389,14 @@ class CRM_Profile_Page_MultipleRecordFieldsListing extends CRM_Core_Page_Basic { } } - $headers = array( ); + $headers = array(); if (!empty($fieldIDs)) { foreach ($fieldIDs as $fieldID) { $headers[$fieldID] = ($this->_pageViewType == 'profileDataView') ? $customGroupInfo[$fieldID]['fieldLabel'] : $fieldLabels[$fieldID]['label']; } } $this->assign('dateFields', $dateFields); - $this->assign('dateFieldsVals',$dateFieldsVals); + $this->assign('dateFieldsVals', $dateFieldsVals); $this->assign('cgcount', $cgcount); $this->assign('customGroupTitle', $this->_customGroupTitle); $this->assign('headers', $headers); diff --git a/CRM/Profile/Page/Router.php b/CRM/Profile/Page/Router.php index 035e3e5c33..384ce13dd4 100644 --- a/CRM/Profile/Page/Router.php +++ b/CRM/Profile/Page/Router.php @@ -74,7 +74,6 @@ class CRM_Profile_Page_Router extends CRM_Core_Page { $profileGID = CRM_Utils_Request::retrieve('gid', 'Integer', $controller, TRUE); } - // make sure that this profile enables mapping // CRM-8609 $isMap = diff --git a/CRM/Profile/Selector/Listings.php b/CRM/Profile/Selector/Listings.php index a11f97e010..bdb01b7e07 100644 --- a/CRM/Profile/Selector/Listings.php +++ b/CRM/Profile/Selector/Listings.php @@ -571,7 +571,6 @@ class CRM_Profile_Selector_Listings extends CRM_Core_Selector_Base implements CR } } - $multipleSelectFields = array('preferred_communication_method' => 1); $multiRecordTableId = NULL; if ($this->_multiRecordTableName) { @@ -591,8 +590,7 @@ class CRM_Profile_Selector_Listings extends CRM_Core_Selector_Base implements CR } $row = array(); $empty = TRUE; - $row[] = CRM_Contact_BAO_Contact_Utils::getImage($result->contact_sub_type ? - $result->contact_sub_type : $result->contact_type, + $row[] = CRM_Contact_BAO_Contact_Utils::getImage($result->contact_sub_type ? $result->contact_sub_type : $result->contact_type, FALSE, $result->contact_id, $showProfileOverlay @@ -738,8 +736,8 @@ class CRM_Profile_Selector_Listings extends CRM_Core_Selector_Base implements CR * according to multi record custom field values */ public function setMultiRecordTableName($fields) { - $customGroupId = $multiRecordTableName = NULL; - $selectorSet = FALSE; + $customGroupId = $multiRecordTableName = NULL; + $selectorSet = FALSE; foreach ($fields as $field => $properties) { if (!CRM_Core_BAO_CustomField::getKeyID($field)) { -- 2.25.1