$item_count = 6;
$showSoftCreditRow = 2;
- $showCreateNew = true;
+ $showCreateNew = TRUE;
if ($form->_action & CRM_Core_Action::UPDATE) {
$form->_softCreditInfo = CRM_Contribute_BAO_ContributionSoft::getSoftContribution($form->_id, TRUE);
if (!empty($form->_softCreditInfo['soft_credit'])) {
$showSoftCreditRow = count($form->_softCreditInfo['soft_credit']);
$showSoftCreditRow++;
- $showCreateNew = false;
+ $showCreateNew = FALSE;
}
}
if (CRM_Utils_Array::value('pcp_made_through_id', $form->_values)) {
$form->assign('pcpLinked', 1);
}
- $form->addElement('hidden', 'soft_contact_id', '', array('id' => 'soft_contact_id'));
}
/**
*/
static function setDefaultValues(&$defaults, &$form) {
if (!empty($form->_softCreditInfo['soft_credit'])) {
- foreach($form->_softCreditInfo['soft_credit'] as $key => $value) {
+ foreach ($form->_softCreditInfo['soft_credit'] as $key => $value) {
$defaults["soft_credit_amount[$key]"] = $value['amount'];
$defaults["soft_credit_contact_select_id[$key]"] = $value['contact_id'];
}
$defaults['pcp_roll_nickname'] = CRM_Utils_Array::value('pcp_roll_nickname', $pcpInfo);
$defaults['pcp_personal_note'] = CRM_Utils_Array::value('pcp_personal_note', $pcpInfo);
}
-
}
}
$('#pcp_made_through').autocomplete(pcpURL,
{ width : 360, selectFirst : false, matchContains: true
}).result( function(event, data, formatted) {
- cj( "#pcp_made_through_id" ).val( data[1] );
+ $("#pcp_made_through_id" ).val( data[1]);
});
+
+ var rowCnt = 1;
+ $('input[name^="soft_credit_contact_select_id["]').each(function(){
+ if ($(this).val()){
+ var dataUrl = CRM.url('civicrm/ajax/rest',
+ 'className=CRM_Contact_Page_AJAX&fnName=getContactList&json=1&context=contact&id=' + $(this).val());
+ $.ajax({
+ url : dataUrl,
+ success : function(html){
+ htmlText = html.split( '|' , 2);
+ $('#soft_credit_contact_' + rowCnt).val(htmlText[0]);
+ rowCnt++;
+ }
+ });
+ }
+ });
+
});