- // CRM-7368 allow user to set or edit PCP link for contributions
- $siteHasPCPs = CRM_Contribute_PseudoConstant::pcPage();
- if (!CRM_Utils_Array::crmIsEmptyArray($siteHasPCPs)) {
- $this->assign('siteHasPCPs', 1);
- $pcpDataUrl = CRM_Utils_System::url('civicrm/ajax/rest',
- 'className=CRM_Contact_Page_AJAX&fnName=getPCPList&json=1&context=contact&reset=1',
- FALSE, NULL, FALSE
- );
- $this->assign('pcpDataUrl', $pcpDataUrl);
- $this->addElement('text', 'pcp_made_through', ts('Credit to a Personal Campaign Page'));
- $this->addElement('hidden', 'pcp_made_through_id', '', array('id' => 'pcp_made_through_id'));
- $this->addElement('checkbox', 'pcp_display_in_roll', ts('Display in Honor Roll?'), NULL);
- $this->addElement('text', 'pcp_roll_nickname', ts('Name (for Honor Roll)'));
- $this->addElement('textarea', 'pcp_personal_note', ts('Personal Note (for Honor Roll)'));
- }
-
- // If we have a contact for this contribution, pass cid= to the dataUrl to exclude current contact from autocomplete results
- if ($this->_contactID) {
- $dataUrl = CRM_Utils_System::url('civicrm/ajax/rest',
- "className=CRM_Contact_Page_AJAX&fnName=getContactList&json=1&reset=1&context=softcredit&cid={$this->_contactID}",
- FALSE, NULL, FALSE
- );
- } else {
- $dataUrl = CRM_Utils_System::url('civicrm/ajax/rest',
- 'className=CRM_Contact_Page_AJAX&fnName=getContactList&json=1&reset=1&context=softcredit',
- FALSE, NULL, FALSE
- );
- }
- $this->assign('dataUrl', $dataUrl);
- $this->addElement('text', 'soft_credit_to', ts('Soft Credit To'));
- // Tell tpl to hide Soft Credit field if contribution is linked directly to a PCP Page
- if (CRM_Utils_Array::value('pcp_made_through_id', $this->_values)) {
- $this->assign('pcpLinked', 1);
- }
- $this->addElement('hidden', 'soft_contact_id', '', array('id' => 'soft_contact_id'));