Skip to content

Commit

Permalink
Merge pull request civicrm#14026 from seamuslee001/5.13
Browse files Browse the repository at this point in the history
Port Code Style Fixes to 5.13 from master
  • Loading branch information
totten authored Apr 11, 2019
2 parents 401bf6e + 669c9ff commit 33484eb
Show file tree
Hide file tree
Showing 90 changed files with 577 additions and 518 deletions.
4 changes: 2 additions & 2 deletions CRM/Contact/ActionMapping.php
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,6 @@
+--------------------------------------------------------------------+
*/

use Civi\ActionSchedule\RecipientBuilder;

/**
* Class CRM_Contact_ActionMapping
Expand Down Expand Up @@ -142,7 +141,8 @@ public function createQuery($schedule, $phase, $defaultParams) {
'casEntityIdField' => 'e.id',
'casContactTableAlias' => NULL,
]);
$query->where('1'); // possible to have no "where" in this case
// possible to have no "where" in this case
$query->where('1');
}

$query['casDateField'] = 'e.' . $dateDBField;
Expand Down
59 changes: 28 additions & 31 deletions CRM/Contact/BAO/Contact.php
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ class CRM_Contact_BAO_Contact extends CRM_Contact_DAO_Contact {
*
* @var array
*/
static $_commPrefs = array(
public static $_commPrefs = array(
'do_not_phone',
'do_not_email',
'do_not_mail',
Expand All @@ -75,7 +75,7 @@ class CRM_Contact_BAO_Contact extends CRM_Contact_DAO_Contact {
*
* @var array
*/
static $_greetingTypes = array(
public static $_greetingTypes = array(
'addressee',
'email_greeting',
'postal_greeting',
Expand All @@ -86,14 +86,14 @@ class CRM_Contact_BAO_Contact extends CRM_Contact_DAO_Contact {
*
* @var array
*/
static $_importableFields = array();
public static $_importableFields = array();

/**
* Static field for all the contact information that we can potentially export.
*
* @var array
*/
static $_exportableFields = NULL;
public static $_exportableFields = NULL;

/**
* Class constructor.
Expand Down Expand Up @@ -462,7 +462,8 @@ public static function ensureGreetingParamsAreSet(&$params) {
if (!empty($params['contact_id']) && !empty($missingGreetingParams)) {
$savedGreetings = civicrm_api3('Contact', 'getsingle', array(
'id' => $params['contact_id'],
'return' => array_keys($missingGreetingParams))
'return' => array_keys($missingGreetingParams),
)
);

foreach (array_keys($missingGreetingParams) as $missingGreetingParam) {
Expand Down Expand Up @@ -1489,7 +1490,7 @@ public static function importableFields(
* True when used during search, might conflict with export param?.
*
* @param bool $withMultiRecord
*
* @param bool $checkPermissions
* @return array
* array of exportable Fields
*/
Expand Down Expand Up @@ -1524,8 +1525,7 @@ public static function &exportableFields($contactType = 'Individual', $status =
'Household',
'Organization',
'All',
)
)) {
))) {
$fields = array_merge($fields, CRM_Core_OptionValue::getFields('', $contactType));
}
// add current employer for individuals
Expand Down Expand Up @@ -1591,10 +1591,10 @@ public static function &exportableFields($contactType = 'Individual', $status =
}
else {
foreach (array(
'Individual',
'Household',
'Organization',
) as $type) {
'Individual',
'Household',
'Organization',
) as $type) {
$fields = array_merge($fields,
CRM_Core_BAO_CustomField::getFieldsForImport($type, FALSE, FALSE, $search, $checkPermissions, $withMultiRecord)
);
Expand Down Expand Up @@ -2387,23 +2387,21 @@ public static function formatProfileContactParams(
}
}
}
elseif (in_array($key,
array(
'nick_name',
'job_title',
'middle_name',
'birth_date',
'gender_id',
'current_employer',
'prefix_id',
'suffix_id',
)) &&
($value == '' || !isset($value)) &&
($session->get('authSrc') & (CRM_Core_Permission::AUTH_SRC_CHECKSUM + CRM_Core_Permission::AUTH_SRC_LOGIN)) == 0 ||
($key == 'current_employer' && empty($params['current_employer']))) {
// CRM-10128: if auth source is not checksum / login && $value is blank, do not fill $data with empty value
// to avoid update with empty values
continue;
elseif (in_array($key, array(
'nick_name',
'job_title',
'middle_name',
'birth_date',
'gender_id',
'current_employer',
'prefix_id',
'suffix_id',
)) && ($value == '' || !isset($value)) &&
($session->get('authSrc') & (CRM_Core_Permission::AUTH_SRC_CHECKSUM + CRM_Core_Permission::AUTH_SRC_LOGIN)) == 0 ||
($key == 'current_employer' && empty($params['current_employer']))) {
// CRM-10128: if auth source is not checksum / login && $value is blank, do not fill $data with empty value
// to avoid update with empty values
continue;
}
else {
$data[$key] = $value;
Expand Down Expand Up @@ -3416,8 +3414,7 @@ public static function triggerInfo(&$info, $tableName = NULL) {
array('table' => 'civicrm_im', 'column' => 'contact_id'),
array('table' => 'civicrm_phone', 'column' => 'contact_id'),
array('table' => 'civicrm_website', 'column' => 'contact_id'),
)
)
))
->alterTriggerInfo($info, $tableName);

// Update phone table to populate phone_numeric field
Expand Down
5 changes: 2 additions & 3 deletions CRM/Contact/BAO/Contact/Permission.php
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ class CRM_Contact_BAO_Contact_Permission {
* @see CRM_Contact_BAO_Contact_Permission::allow
*
* @return array
* list of contact IDs the logged in user has the given permission for
* list of contact IDs the logged in user has the given permission for
*/
public static function allowList($contact_ids, $type = CRM_Core_Permission::VIEW) {
$result_set = [];
Expand Down Expand Up @@ -114,7 +114,7 @@ public static function allowList($contact_ids, $type = CRM_Core_Permission::VIEW

// if some have been rejected, double check for permissions inherited by relationship
if (count($result_set) < count($contact_ids)) {
$rejected_contacts = array_diff_key($contact_ids, $result_set);
$rejected_contacts = array_diff_key($contact_ids, $result_set);
// @todo consider storing these to the acl cache for next time, since we have fetched.
$allowed_by_relationship = self::relationshipList($rejected_contacts, $type);
foreach ($allowed_by_relationship as $contact_id) {
Expand Down Expand Up @@ -427,7 +427,6 @@ public static function relationshipList($contact_ids, $type) {
return array_keys($result_set);
}


/**
* @param int $contactID
* @param CRM_Core_Form $form
Expand Down
8 changes: 5 additions & 3 deletions CRM/Contact/BAO/Group.php
Original file line number Diff line number Diff line change
Expand Up @@ -751,7 +751,7 @@ public static function createHiddenSmartGroup($params) {
* @todo there seems little reason for the small number of functions that call this to pass in
* params that then need to be translated in this function since they are coding them when calling
*/
static public function getGroupListSelector(&$params) {
public static function getGroupListSelector(&$params) {
// format the params
$params['offset'] = ($params['page'] - 1) * $params['rp'];
$params['rowCount'] = $params['rp'];
Expand Down Expand Up @@ -999,11 +999,13 @@ public static function getGroupList(&$params) {
$values[$object->id]['org_info'] = "<a href='{$contactUrl}'>{$object->org_name}</a>";
}
else {
$values[$object->id]['org_info'] = ''; // Empty cell
// Empty cell
$values[$object->id]['org_info'] = '';
}
}
else {
$values[$object->id]['org_info'] = NULL; // Collapsed column if all cells are NULL
// Collapsed column if all cells are NULL
$values[$object->id]['org_info'] = NULL;
}
if ($object->created_id) {
$contactUrl = CRM_Utils_System::url('civicrm/contact/view', "reset=1&cid={$object->created_id}");
Expand Down
2 changes: 1 addition & 1 deletion CRM/Contact/BAO/GroupContact.php
Original file line number Diff line number Diff line change
Expand Up @@ -318,7 +318,7 @@ public static function getGroupList($contactId = 0, $visibility = FALSE) {
* @param bool $includeSmartGroups
* Include or Exclude Smart Group(s)
*
* @return array|int $values
* @return array|int
* the relevant data object values for the contact or the total count when $count is TRUE
*/
public static function getContactGroup(
Expand Down
2 changes: 1 addition & 1 deletion CRM/Contact/BAO/GroupContactCache.php
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@
*/
class CRM_Contact_BAO_GroupContactCache extends CRM_Contact_DAO_GroupContactCache {

static $_alreadyLoaded = [];
public static $_alreadyLoaded = [];

/**
* Get a list of caching modes.
Expand Down
2 changes: 1 addition & 1 deletion CRM/Contact/BAO/GroupNestingCache.php
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ class CRM_Contact_BAO_GroupNestingCache {
*
* @throws \Exception
*/
static public function update() {
public static function update() {
// lets build the tree in memory first

$sql = "
Expand Down
3 changes: 3 additions & 0 deletions CRM/Contact/BAO/ProximityQuery.php
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,9 @@ class CRM_Contact_BAO_ProximityQuery {
* This version has been taken from Drupal's location module: http://drupal.org/project/location
*/

/**
* @var string
*/
static protected $_earthFlattening;
static protected $_earthRadiusSemiMinor;
static protected $_earthRadiusSemiMajor;
Expand Down
Loading

0 comments on commit 33484eb

Please sign in to comment.