$this->assign('context', $context);
CRM_Contribute_BAO_Contribution::getValues($params, $values, $ids);
-
- $softParams = array('contribution_id' => CRM_Utils_Array::value('contribution_id', $values));
- $softContribution = CRM_Contribute_BAO_Contribution::getSoftContribution($softParams, TRUE);
-// if ($softContribution) {
-// $values = array_merge($values, $softContribution);
-// }
CRM_Contribute_BAO_Contribution::resolveDefaults($values);
if (CRM_Utils_Array::value('contribution_page_id', $values)) {
}
//get soft credit record if exists.
- //FIXME: The next line seems really inefficient. Can't we just check the length of the array?
- if ($softContribution = CRM_Contribute_BAO_Contribution::getSoftContribution($softParams)) {
-
- $softContribution['softCreditToName'] = CRM_Core_DAO::getFieldValue('CRM_Contact_DAO_Contact',
- $softContribution['soft_credit_to'], 'display_name'
- );
- //hack to avoid dispalyName conflict
- //for viewing softcredit record.
- $softContribution['displayName'] = CRM_Core_DAO::getFieldValue('CRM_Contact_DAO_Contact',
- $values['contact_id'], 'display_name'
- );
- $values = array_merge($values, $softContribution);
+ $softParams = array('contribution_id' => CRM_Utils_Array::value('contribution_id', $values));
+ $softContribution = CRM_Contribute_BAO_Contribution::getSoftContribution($softParams);
+ if (!empty($softContribution)) {
+ foreach($softContribution as &$individualSoftContribution) {
+ $individualSoftContribution['softCreditToName'] = CRM_Core_DAO::getFieldValue('CRM_Contact_DAO_Contact',
+ $individualSoftContribution['soft_credit_to'], 'display_name'
+ );
+ //hack to avoid displayName conflict
+ //for viewing softcredit record.
+ $individualSoftContribution['displayName'] = CRM_Core_DAO::getFieldValue('CRM_Contact_DAO_Contact',
+ $values['contact_id'], 'display_name'
+ );
+
+ }
+ $values['softContributions'] = $softContribution;
}
$lineItems = array();
{/if}
</table>
- {if $softCreditToName and !$pcp_id} {* We show soft credit name with PCP section if contribution is linked to a PCP. *}
+ {if $softContributions and !$pcp_id} {* We show soft credit name with PCP section if contribution is linked to a PCP. *}
<div class="crm-accordion-wrapper ">
<div class="crm-accordion-header">
{ts}Soft Credit{/ts}
</div>
<div class="crm-accordion-body">
<table class="crm-info-panel">
+ {foreach from=$softContributions item="softCont"}
+ {if $softCont }
<tr>
<td class="label">{ts}Soft Credit To{/ts}</td>
- <td><a href="{crmURL p="civicrm/contact/view" q="reset=1&cid=`$soft_credit_to`"}" id="view_contact" title="{ts}View contact record{/ts}">{$softCreditToName}</a></td>
+ <td><a href="{crmURL p="civicrm/contact/view" q="reset=1&cid=`$softCont.soft_credit_to`"}" id="view_contact" title="{ts}View contact record{/ts}">{$softCont.softCreditToName}</a></td>
<td class="label">{ts}Amount{/ts}</td>
- <td>{$soft_credit_amount|crmMoney:$currency}</td>
+ <td>{$softCont.soft_credit_amount|crmMoney:$currency}</td>
</tr>
+ {/if}
+ {/foreach}
</table>
</div>
</div>