$values['note'] = $daoNote->note;
}
$this->_contributionType = $values['financial_type_id'];
-
- $csParams = array('contribution_id' => $id);
- $softCredit = CRM_Contribute_BAO_ContributionSoft::getSoftContribution($csParams, TRUE);
-
- if (CRM_Utils_Array::value('soft_credit_to', $softCredit)) {
- $softCredit['sort_name'] = CRM_Core_DAO::getFieldValue('CRM_Contact_DAO_Contact',
- $softCredit['soft_credit_to'], 'sort_name'
- );
- }
- $values['soft_credit_to'] = CRM_Utils_Array::value('sort_name', $softCredit);
- $values['softID'] = CRM_Utils_Array::value('soft_credit_id', $softCredit);
- $values['soft_contact_id'] = CRM_Utils_Array::value('soft_credit_to', $softCredit);
-
- if (CRM_Utils_Array::value('pcp_id', $softCredit)) {
- $pcpId = CRM_Utils_Array::value('pcp_id', $softCredit);
- $pcpTitle = CRM_Core_DAO::getFieldValue('CRM_PCP_DAO_PCP', $pcpId, 'title');
- $contributionPageTitle = CRM_PCP_BAO_PCP::getPcpPageTitle($pcpId, 'contribute');
- $values['pcp_made_through'] = CRM_Utils_Array::value('sort_name', $softCredit) . " :: " . $pcpTitle . " :: " . $contributionPageTitle;
- $values['pcp_made_through_id'] = CRM_Utils_Array::value('pcp_id', $softCredit);
- $values['pcp_display_in_roll'] = CRM_Utils_Array::value('pcp_display_in_roll', $softCredit);
- $values['pcp_roll_nickname'] = CRM_Utils_Array::value('pcp_roll_nickname', $softCredit);
- $values['pcp_personal_note'] = CRM_Utils_Array::value('pcp_personal_note', $softCredit);
- }
}
/**
*/
public function preProcess() {
- $resources = CRM_Core_Resources::singleton();
- $resources->addScriptFile('civicrm', 'templates/CRM/Contribute/Form/SoftCredit.js');
-
//check permission for action.
if (!CRM_Core_Permission::checkActionPermission('CiviContribute', $this->_action)) {
CRM_Core_Error::fatal(ts('You do not have permission to access this page'));
return;
}
+ $resources = CRM_Core_Resources::singleton();
+ $resources->addScriptFile('civicrm', 'templates/CRM/Contribute/Form/SoftCredit.js');
+
$this->_formType = CRM_Utils_Array::value('formType', $_GET);
// get price set id.
// omitting contactImage from title for now since the summary overlay css doesn't work outside of our crm-container
CRM_Utils_System::setTitle(ts('Contribution from') . ' ' . $displayName);
}
-
}
function setDefaultValues() {
return $defaults;
}
+ // set soft credit defaults
+ CRM_Contribute_Form_SoftCredit::setDefaultValues($defaults);
+
if ($this->_mode) {
$config = CRM_Core_Config::singleton();
// set default country from config if no country set
'invoice_id',
'non_deductible_amount',
'fee_amount',
- 'net_amount'
+ 'net_amount',
);
foreach ($additionalDetailFields as $key) {
if (!empty($defaults[$key])) {
}
$form->addElement('hidden', 'soft_contact_id', '', array('id' => 'soft_contact_id'));
}
+
+ /**
+ * Function used to set defaults for soft credit block
+ */
+ static function setDefaultValues(&$defaults) {
+ $csParams = array('contribution_id' => $defaults['id']);
+ $softCredit = CRM_Contribute_BAO_ContributionSoft::getSoftContribution($csParams, TRUE);
+
+ if (CRM_Utils_Array::value('soft_credit_to', $softCredit)) {
+ $softCredit['sort_name'] = CRM_Core_DAO::getFieldValue('CRM_Contact_DAO_Contact',
+ $softCredit['soft_credit_to'], 'sort_name'
+ );
+ }
+ $values['soft_credit_to'] = CRM_Utils_Array::value('sort_name', $softCredit);
+ $values['softID'] = CRM_Utils_Array::value('soft_credit_id', $softCredit);
+ $values['soft_contact_id'] = CRM_Utils_Array::value('soft_credit_to', $softCredit);
+
+ if (CRM_Utils_Array::value('pcp_id', $softCredit)) {
+ $pcpId = CRM_Utils_Array::value('pcp_id', $softCredit);
+ $pcpTitle = CRM_Core_DAO::getFieldValue('CRM_PCP_DAO_PCP', $pcpId, 'title');
+ $contributionPageTitle = CRM_PCP_BAO_PCP::getPcpPageTitle($pcpId, 'contribute');
+ $values['pcp_made_through'] = CRM_Utils_Array::value('sort_name', $softCredit) . " :: " . $pcpTitle . " :: " . $contributionPageTitle;
+ $values['pcp_made_through_id'] = CRM_Utils_Array::value('pcp_id', $softCredit);
+ $values['pcp_display_in_roll'] = CRM_Utils_Array::value('pcp_display_in_roll', $softCredit);
+ $values['pcp_roll_nickname'] = CRM_Utils_Array::value('pcp_roll_nickname', $softCredit);
+ $values['pcp_personal_note'] = CRM_Utils_Array::value('pcp_personal_note', $softCredit);
+ }
+
+ }
}