Skip to content

Commit

Permalink
BTHA-188: Avoid calculating opportunity detail for deleted contribution
Browse files Browse the repository at this point in the history
  • Loading branch information
olayiwola-compucorp committed Aug 19, 2024
1 parent ad19a83 commit e4f38f7
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion CRM/Civicase/Service/CaseSalesOrderOpportunityCalculator.php
Original file line number Diff line number Diff line change
Expand Up @@ -172,7 +172,10 @@ private function calculateOpportunityFinancialAmount($contributions) {
private function getContributions($caseId) {
$contributions = Contribution::get(FALSE)
->addSelect('*', 'Opportunity_Details.Quotation')
->addWhere('Opportunity_Details.Case_Opportunity', '=', $caseId);
->addWhere('Opportunity_Details.Case_Opportunity', '=', $caseId)
->addJoin('CaseSalesOrder AS case_sales_order', 'INNER',
['Opportunity_Details.Quotation', '=', 'case_sales_order.id']
);

if ($this->deletingContributionId !== NULL) {
$contributions->addWhere('id', '!=', $this->deletingContributionId);
Expand Down

0 comments on commit e4f38f7

Please sign in to comment.