X-Git-Url: https://vcs.fsf.org/?a=blobdiff_plain;f=CRM%2FContribute%2FSelector%2FSearch.php;h=9d5fba445d0f9a3f6c319df58f05e09310420542;hb=be274d8ad290a7c5654add70af32db08a0667811;hp=32d153ebb2ced809d573b7fbffdfe0845fc59bbd;hpb=fe46b2a38ec53f9a1be723c512840facded8845d;p=civicrm-core.git diff --git a/CRM/Contribute/Selector/Search.php b/CRM/Contribute/Selector/Search.php index 32d153ebb2..9d5fba445d 100644 --- a/CRM/Contribute/Selector/Search.php +++ b/CRM/Contribute/Selector/Search.php @@ -358,7 +358,38 @@ 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()) { + $links = self::links($componentId, + $componentAction, + $qfKey, + $componentContext + ); + $checkLineItem = FALSE; $row = array(); + // 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 (!CRM_Core_Permission::check('edit contributions of type ' . CRM_Contribute_PseudoConstant::financialType($items['financial_type_id']))) { + unset($links[CRM_Core_Action::UPDATE]); + break; + } + if (!CRM_Core_Permission::check('delete contributions of type ' . CRM_Contribute_PseudoConstant::financialType($items['financial_type_id']))) { + unset($links[CRM_Core_Action::DELETE]); + break; + } + } + 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)) { @@ -395,11 +426,7 @@ class CRM_Contribute_Selector_Search extends CRM_Core_Selector_Base implements C ); $row['action'] = CRM_Core_Action::formLink( - self::links($componentId, - $componentAction, - $qfKey, - $componentContext - ), + $links, $mask, $actions, ts('more'), FALSE,