Skip to content

Commit

Permalink
Merge pull request civicrm#11 from Edzelopez/CIVI-28
Browse files Browse the repository at this point in the history
CIVI-28 Added check for permissions while search results are being displayed on contribution search, advanced search and contact summary page (Contributions tab)
  • Loading branch information
Edzelopez committed Mar 17, 2015
2 parents b37ba40 + cbbb9d3 commit c8c3890
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 2 deletions.
3 changes: 2 additions & 1 deletion CRM/Financial/BAO/FinancialType.php
Original file line number Diff line number Diff line change
Expand Up @@ -207,13 +207,14 @@ public static function permissionedFinancialTypes(&$permissions) {
$permissions['administer CiviCRM Financial Types'] = $prefix . ts('administer CiviCRM Financial Types');
}

public static function getAvailableFinancialTypes(&$financialTypes, $action) {
public static function getAvailableFinancialTypes(&$financialTypes = NULL, $action = 'view') {
$financialTypes = CRM_Contribute_PseudoConstant::financialType();

foreach ($financialTypes as $finTypeId => $type) {
if (!CRM_Core_Permission::check($action . ' contributions of type ' . $type)) {
unset($financialTypes[$finTypeId]);
}
}
return $financialTypes;
}
}
2 changes: 1 addition & 1 deletion CRM/Report/Form/Contribute/Summary.php
Original file line number Diff line number Diff line change
Expand Up @@ -153,7 +153,7 @@ public function __construct() {
'financial_type_id' => array(
'title' => ts('Financial Type'),
'operatorType' => CRM_Report_Form::OP_MULTISELECT,
'options' => CRM_Contribute_PseudoConstant::financialType(),
'options' => CRM_Financial_BAO_FinancialType::getAvailableFinancialTypes(),
'type' => CRM_Utils_Type::T_INT,
),
'contribution_page_id' => array(
Expand Down

0 comments on commit c8c3890

Please sign in to comment.