$qfKey,
$componentContext
);
-
- $checkLineItem = FALSE;
// Set defaults to empty to prevent e-notices.
$row = ['amount_level' => ''];
- // Now check for lineItems
- if (CRM_Financial_BAO_FinancialType::isACLFinancialTypeStatus()) {
- $lineItems = CRM_Price_BAO_LineItem::getLineItemsByContributionID($result->id);
- foreach ($lineItems as $items) {
- if (!CRM_Core_Permission::check('view contributions of type ' . CRM_Contribute_PseudoConstant::financialType($items['financial_type_id']))) {
- $checkLineItem = TRUE;
- break;
- }
- if (!CRM_Core_Permission::check('edit contributions of type ' . CRM_Contribute_PseudoConstant::financialType($items['financial_type_id']))) {
- unset($links[CRM_Core_Action::UPDATE]);
- }
- if (!CRM_Core_Permission::check('delete contributions of type ' . CRM_Contribute_PseudoConstant::financialType($items['financial_type_id']))) {
- unset($links[CRM_Core_Action::DELETE]);
- }
- }
- if ($checkLineItem) {
- continue;
- }
- if (!CRM_Core_Permission::check('edit contributions of type ' . CRM_Contribute_PseudoConstant::financialType($result->financial_type_id))) {
- unset($links[CRM_Core_Action::UPDATE]);
- }
- if (!CRM_Core_Permission::check('delete contributions of type ' . CRM_Contribute_PseudoConstant::financialType($result->financial_type_id))) {
- unset($links[CRM_Core_Action::DELETE]);
- }
- }
// the columns we are interested in
foreach (self::$_properties as $property) {
if (property_exists($result, $property)) {
);
$isPayLater = FALSE;
- if ($result->is_pay_later && ($row['contribution_status_name'] ?? NULL) == 'Pending') {
+ if ($result->is_pay_later && ($row['contribution_status_name'] ?? NULL) === 'Pending') {
$isPayLater = TRUE;
$row['contribution_status'] .= ' (' . ts('Pay Later') . ')';
$links[CRM_Core_Action::ADD] = [
$row['checkbox'] = CRM_Core_Form::CB_PREFIX . $result->contribution_id;
$actions = [
- 'id' => $result->contribution_id,
- 'cid' => $result->contact_id,
+ 'id' => (int) $result->contribution_id,
+ 'cid' => (int) $result->contact_id,
'cxt' => $this->_context,
+ 'financial_type_id' => $result->financial_type_id ? (int) $result->financial_type_id : NULL,
];
if (in_array($row['contribution_status_name'], ['Partially paid', 'Pending refund']) || $isPayLater) {
FALSE,
'contribution.selector.row',
'Contribution',
- $result->contribution_id
+ (int) $result->contribution_id
);
$row['contact_type'] = CRM_Contact_BAO_Contact_Utils::getImage($result->contact_sub_type ? $result->contact_sub_type : $result->contact_type, FALSE, $result->contact_id
}
if ($objectName === 'MembershipType') {
$financialType = CRM_Core_PseudoConstant::getName('CRM_Member_BAO_MembershipType', 'financial_type_id', CRM_Member_BAO_MembershipType::getMembershipType($objectID)['financial_type_id']);
+ }
+ if ($objectName === 'Contribution') {
+ // Now check for lineItems
+ if (CRM_Financial_BAO_FinancialType::isACLFinancialTypeStatus()) {
+ $lineItems = CRM_Price_BAO_LineItem::getLineItemsByContributionID((int) $objectID);
+ foreach ($lineItems as $item) {
+ $financialType = CRM_Core_PseudoConstant::getName('CRM_Contribute_BAO_Contribution', 'financial_type_id', $item['financial_type_id']);
+ if (!CRM_Core_Permission::check('view contributions of type ' . $financialType)) {
+ // Remove all links & early return for this contribution if there is an un-viewable financial type.
+ $links = [];
+ return;
+ }
+ if (!CRM_Core_Permission::check('edit contributions of type ' . $financialType)) {
+ unset($links[CRM_Core_Action::UPDATE]);
+ }
+ if (!CRM_Core_Permission::check('delete contributions of type ' . $financialType)) {
+ unset($links[CRM_Core_Action::DELETE]);
+ }
+ }
+ $financialTypeID = $values['financial_type_id'] ?? CRM_Core_DAO::getFieldValue('CRM_Contribute_DAO_Contribution', $objectID, 'financial_type_id');
+ $financialType = CRM_Core_PseudoConstant::getName('CRM_Contribute_BAO_Contribution', 'financial_type_id', $financialTypeID);
+ }
+ }
+
+ if (!empty($financialType)) {
$hasEditPermission = CRM_Core_Permission::check('edit contributions of type ' . $financialType);
$hasDeletePermission = CRM_Core_Permission::check('delete contributions of type ' . $financialType);
if (!$hasDeletePermission || !$hasEditPermission) {