From a964bc8e549c1798f3b80e096552c3db5d9fc5c6 Mon Sep 17 00:00:00 2001 From: Edsel Date: Fri, 20 Mar 2015 12:20:00 +0530 Subject: [PATCH] CIVI-28 Added check for viewable lineitems in contribution search results --- CRM/Contribute/Selector/Search.php | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/CRM/Contribute/Selector/Search.php b/CRM/Contribute/Selector/Search.php index c6d4701406..1655f0b426 100644 --- a/CRM/Contribute/Selector/Search.php +++ b/CRM/Contribute/Selector/Search.php @@ -358,11 +358,23 @@ class CRM_Contribute_Selector_Search extends CRM_Core_Selector_Base implements C $allCampaigns = CRM_Campaign_BAO_Campaign::getCampaigns(NULL, NULL, FALSE, FALSE, FALSE, TRUE); while ($result->fetch()) { + $checkLineItem = FALSE; $row = array(); $permissions[] = CRM_Core_Permission::VIEW; if (!CRM_Core_Permission::check('view contributions of type ' . CRM_Contribute_PseudoConstant::financialType($result->financial_type_id))) { continue; } + // Now check for lineItems + $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 ($checkLineItem) { + continue; + } if (!CRM_Core_Permission::check('edit contributions of type ' . CRM_Contribute_PseudoConstant::financialType($result->financial_type_id))) { unset($permissions[array_search(CRM_Core_Permission::EDIT, $permissions)]); $mask = CRM_Core_Action::mask($permissions); -- 2.25.1