From b8992c4480ced3b2ddd62bd5d0e64620d0d931d2 Mon Sep 17 00:00:00 2001 From: Eileen McNaughton Date: Mon, 22 Aug 2022 15:47:19 +1200 Subject: [PATCH] Fix imported statuses & contribution id storage on import job --- CRM/Contribute/Import/Parser/Contribution.php | 20 +++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/CRM/Contribute/Import/Parser/Contribution.php b/CRM/Contribute/Import/Parser/Contribution.php index 2111ded8f5..fb3b355cb9 100644 --- a/CRM/Contribute/Import/Parser/Contribution.php +++ b/CRM/Contribute/Import/Parser/Contribution.php @@ -445,9 +445,7 @@ class CRM_Contribute_Import_Parser_Contribution extends CRM_Import_Parser { return; } - // process pledge payment assoc w/ the contribution - $this->processPledgePayments($formatted); - $this->setImportStatus($rowNumber, $this->getStatus(self::PLEDGE_PAYMENT)); + $this->setImportStatus($rowNumber, $this->processPledgePayments($formatted) ? $this->getStatus(self::PLEDGE_PAYMENT) : $this->getStatus(self::VALID), '', $newContribution['id']); return; } $labels = [ @@ -494,12 +492,11 @@ class CRM_Contribute_Import_Parser_Contribution extends CRM_Import_Parser { //return soft valid since we need to show how soft credits were added if (!empty($formatted['soft_credit'])) { - $this->setImportStatus($rowNumber, $this->getStatus(self::SOFT_CREDIT)); + $this->setImportStatus($rowNumber, $this->getStatus(self::SOFT_CREDIT), '', $newContribution['id']); return; } - $this->processPledgePayments($formatted); - $this->setImportStatus($rowNumber, $this->getStatus(self::PLEDGE_PAYMENT)); + $this->setImportStatus($rowNumber, $this->processPledgePayments($formatted) ? $this->getStatus(self::PLEDGE_PAYMENT) : $this->getStatus(self::VALID), '', $newContribution['id']); return; } @@ -560,13 +557,12 @@ class CRM_Contribute_Import_Parser_Contribution extends CRM_Import_Parser { //return soft valid since we need to show how soft credits were added if (!empty($formatted['soft_credit'])) { - $this->setImportStatus($rowNumber, $this->getStatus(self::SOFT_CREDIT), ''); + $this->setImportStatus($rowNumber, $this->getStatus(self::SOFT_CREDIT), '', $newContribution['id']); return; } // process pledge payment assoc w/ the contribution - $this->processPledgePayments($formatted); - $this->setImportStatus($rowNumber, $this->getStatus(self::PLEDGE_PAYMENT)); + $this->setImportStatus($rowNumber, $this->processPledgePayments($formatted) ? $this->getStatus(self::PLEDGE_PAYMENT) : $this->getStatus(self::VALID), $newContribution['id']); return; } @@ -598,8 +594,10 @@ class CRM_Contribute_Import_Parser_Contribution extends CRM_Import_Parser { * Process pledge payments. * * @param array $formatted + * + * @return bool */ - private function processPledgePayments(array $formatted) { + private function processPledgePayments(array $formatted): bool { if (!empty($formatted['pledge_payment_id']) && !empty($formatted['pledge_id'])) { //get completed status $completeStatusID = CRM_Core_PseudoConstant::getKey('CRM_Contribute_BAO_Contribution', 'contribution_status_id', 'Completed'); @@ -615,7 +613,9 @@ class CRM_Contribute_Import_Parser_Contribution extends CRM_Import_Parser { NULL, $formatted['total_amount'] ); + return TRUE; } + return FALSE; } /** -- 2.25.1