From b8d15d544ccc74365328ce59876071c43d848443 Mon Sep 17 00:00:00 2001 From: Andrew Engelbrecht Date: Wed, 4 Jan 2017 16:45:12 -0500 Subject: [PATCH] fix display of contacts' recurring contributions https://rt.gnu.org/Ticket/Display.html?id=1176733 if you look at a contact, click contributions, then click on "view" next to a recurring payment (not all users have these), then the server would crash and give a backtrace. this patch fixes that issue. the issue was due to a sort-by-id failing because multiple tables are queried, more than one of which has an id column. therefore the "id" column name was redundant and threw an SQL error. this patch specifies the desired table with the specified id column. i worked a bit on this patch and received help from ruben, who corrected my less than perfect original patch. --- CRM/Contribute/BAO/ContributionRecur.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CRM/Contribute/BAO/ContributionRecur.php b/CRM/Contribute/BAO/ContributionRecur.php index 5845950f9a..a84557b6ee 100644 --- a/CRM/Contribute/BAO/ContributionRecur.php +++ b/CRM/Contribute/BAO/ContributionRecur.php @@ -443,7 +443,7 @@ INNER JOIN civicrm_contribution con ON ( con.id = mp.contribution_id ) public static function getTemplateContribution($id) { $templateContribution = civicrm_api3('Contribution', 'get', array( 'contribution_recur_id' => $id, - 'options' => array('limit' => 1, 'sort' => array('id DESC')), + 'options' => array('limit' => 1, 'sort' => array('civicrm_contribution_recur.id DESC')), 'sequential' => 1, 'contribution_test' => '', )); -- 2.25.1