Skip to content

Commit

Permalink
Merge pull request #22494 from eileenmcnaughton/fin
Browse files Browse the repository at this point in the history
Remove handling for impossible array
  • Loading branch information
eileenmcnaughton authored Jan 13, 2022
2 parents 4526b69 + 8489e9e commit 156c4c2
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 25 deletions.
2 changes: 1 addition & 1 deletion CRM/Contact/BAO/Query.php
Original file line number Diff line number Diff line change
Expand Up @@ -2038,7 +2038,7 @@ public function whereClauseSingle(&$values, $isForcePrimaryOnly = FALSE) {
* @return string
* @throws \CRM_Core_Exception
*/
public function whereClause($isForcePrimaryEmailOnly = NULL) {
public function whereClause($isForcePrimaryEmailOnly = NULL): string {
$this->_where[0] = [];
$this->_qill[0] = [];

Expand Down
37 changes: 13 additions & 24 deletions CRM/Financial/BAO/FinancialType.php
Original file line number Diff line number Diff line change
Expand Up @@ -356,33 +356,22 @@ public static function buildPermissionedClause(&$whereClauses, $component = NULL
if (!self::isACLFinancialTypeStatus()) {
return FALSE;
}
if (is_array($whereClauses)) {
if ($component == 'contribution') {
$types = self::getAllEnabledAvailableFinancialTypes();
if (empty($types)) {
$whereClauses[] = ' ' . $alias . '.financial_type_id IN (0)';
}
else {
$whereClauses[] = ' ' . $alias . '.financial_type_id IN (' . implode(',', array_keys($types)) . ')';
}
$column = "financial_type_id";
}
else {
if ($component == 'contribution') {
$types = self::getAllEnabledAvailableFinancialTypes();
$column = "financial_type_id";
}
if ($component == 'membership') {
self::getAvailableMembershipTypes($types, CRM_Core_Action::VIEW);
$column = "membership_type_id";
}
if (!empty($whereClauses)) {
$whereClauses .= ' AND ';
}
if (empty($types)) {
$whereClauses .= " civicrm_{$component}.{$column} IN (0)";
return;
}
$whereClauses .= " civicrm_{$component}.{$column} IN (" . implode(',', array_keys($types)) . ")";
if ($component == 'membership') {
self::getAvailableMembershipTypes($types, CRM_Core_Action::VIEW);
$column = "membership_type_id";
}
if (!empty($whereClauses)) {
$whereClauses .= ' AND ';
}
if (empty($types)) {
$whereClauses .= " civicrm_{$component}.{$column} IN (0)";
return;
}
$whereClauses .= " civicrm_{$component}.{$column} IN (" . implode(',', array_keys($types)) . ")";
}

/**
Expand Down

0 comments on commit 156c4c2

Please sign in to comment.