From e2a918bf2d53e75da5b11777bd4a81adfd1a87ab Mon Sep 17 00:00:00 2001 From: eileenmcnaugton Date: Sat, 6 Aug 2016 13:34:40 +1200 Subject: [PATCH] CRM-18259 determine presence of linked contributions more directly. The presence of pledge_payments with 'transactional statuses' was being used to determine the presence of contributions to avoid deleting - but this stopped working with the other changes on this ticket as 'Pending' is not supposedly valid for pledge payments - at least not according to the definition for the search screen. This is a better way to determine the presence of contributions anyway --- CRM/Pledge/BAO/Pledge.php | 15 +++------------ 1 file changed, 3 insertions(+), 12 deletions(-) diff --git a/CRM/Pledge/BAO/Pledge.php b/CRM/Pledge/BAO/Pledge.php index 022c7bada5..6eb92d2142 100644 --- a/CRM/Pledge/BAO/Pledge.php +++ b/CRM/Pledge/BAO/Pledge.php @@ -1147,9 +1147,9 @@ SELECT pledge.contact_id as contact_id, } return civicrm_api3('pledge_payment', 'getcount', array( - 'pledge_id' => $pledgeID, - 'status_id' => array('IN' => self::getTransactionalStatus()), - )); + 'pledge_id' => $pledgeID, + 'contribution_id' => array('NOT NULL' => TRUE), + )); } /** @@ -1177,15 +1177,6 @@ SELECT pledge.contact_id as contact_id, return array_flip(array_intersect($paymentStatus, array('Overdue', 'Pending'))); } - /** - * Get array of non transactional statuses. - * @return array - * non transactional status ids - */ - protected static function getTransactionalStatus() { - $paymentStatus = CRM_Contribute_PseudoConstant::contributionStatus(NULL, 'name'); - return array_diff(array_flip($paymentStatus), self::getNonTransactionalStatus()); - } /** * Create array for recur record for pledge. -- 2.25.1