diff --git a/CRM/Price/BAO/LineItem.php b/CRM/Price/BAO/LineItem.php index 22a420297892..8251e1276017 100644 --- a/CRM/Price/BAO/LineItem.php +++ b/CRM/Price/BAO/LineItem.php @@ -1268,4 +1268,19 @@ public static function entityTables(): array { ]; } + /** + * Add contribution id select where. + * + * This overrides the parent to PREVENT additional entity_id based + * clauses being added. Additional filters joining on the participant + * and membership tables just seem too non-performant. + * + * @inheritDoc + */ + public function addSelectWhereClause(): array { + $clauses['contribution_id'] = CRM_Utils_SQL::mergeSubquery('Contribution'); + CRM_Utils_Hook::selectWhereClause($this, $clauses); + return $clauses; + } + }