+ /**
+ * Wrapper for ajax soft contribution selector.
+ *
+ * @param array $params
+ * Associated array for params.
+ *
+ * @return array
+ * Associated array of soft contributions
+ */
+ public static function getSoftContributionSelector($params) {
+ $isTest = 0;
+ if (!empty($params['isTest'])) {
+ $isTest = $params['isTest'];
+ }
+ // Format the params.
+ $params['offset'] = ($params['page'] - 1) * $params['rp'];
+ $params['rowCount'] = $params['rp'];
+ $params['sort'] = CRM_Utils_Array::value('sortBy', $params);
+ $contactId = $params['cid'];
+
+ $filter = NULL;
+ if ($params['context'] == 'membership' && !empty($params['entityID']) && $contactId) {
+ $filter = " AND cc.id IN (SELECT contribution_id FROM civicrm_membership_payment WHERE membership_id = {$params['entityID']})";
+ }
+
+ $softCreditList = self::getSoftContributionList($contactId, $filter, $isTest, $params);
+
+ $softCreditListDT = array();
+ $softCreditListDT['data'] = array_values($softCreditList);
+ $softCreditListDT['recordsTotal'] = $params['total'];
+ $softCreditListDT['recordsFiltered'] = $params['total'];
+
+ return $softCreditListDT;
+ }
+