INFRA-132 - CRM/Profile - phpcbf
authorTim Otten <totten@civicrm.org>
Tue, 6 Jan 2015 21:21:23 +0000 (13:21 -0800)
committerTim Otten <totten@civicrm.org>
Tue, 6 Jan 2015 23:07:44 +0000 (15:07 -0800)
CRM/Profile/Form.php
CRM/Profile/Form/Edit.php
CRM/Profile/Form/Search.php
CRM/Profile/Page/Dynamic.php
CRM/Profile/Page/Listings.php
CRM/Profile/Page/MultipleRecordFieldsListing.php
CRM/Profile/Page/Router.php
CRM/Profile/Selector/Listings.php

index a1e45d6627184340c8dd53b66b15432b39dceebd..95c44a49dc4280629e79e8d9b2b54d91647a9f44 100644 (file)
@@ -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;
index 2f9c4dc291e7acd0874e2fdc99702fe95ea8965a..6fa5ec876ec08509f485a2f148a1cbd9624e2a9a 100644 (file)
@@ -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'];
index f7af34b6be3152c49c0f99c5d125edca163012b3..f89d2e173dd738c537e2662c3b26ad37344d595e 100644 (file)
@@ -130,5 +130,6 @@ class CRM_Profile_Form_Search extends CRM_Profile_Form {
    *
    * @return void
    */
-  public function postProcess() {}
+  public function postProcess() {
+  }
 }
index 31b05bec99a86dbd13f20448007d49f11a38ed1f..6411708729a8059b64044247fb07436ea508f484 100644 (file)
@@ -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);
       }
index 2b6fdc8844b88c6ec12ad91bd5a3ca94a4216427..b56a54c8d0fe70a6f7e755053dd7ba4f6f20d8ad 100644 (file)
@@ -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);
index 6c7b883337385a8bf0014c4567dffdd490226bd5..5e2bd8bef11fc1298278e4b52e783b49c29ca829 100644 (file)
@@ -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);
index 035e3e5c33a0c78ab17bef3cc39a5e6d268b9b61..384ce13dd4d76d9f5bd345d81f81ce1f009cfead 100644 (file)
@@ -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 =
index a11f97e0107f25c3941d80d9737ccb18c6324bd0..bdb01b7e0706d4a9924bd66e2ea53bdc5781f5fb 100644 (file)
@@ -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)) {