}
CRM_Core_Resources::singleton()
->addScriptFile('civicrm', 'templates/CRM/Batch/Form/Entry.js', 1, 'html-header')
+ ->addScriptFile('civicrm', 'templates/CRM/Contribute/Form/PCP.js.tpl', 1, 'html-header')
->addSetting(array('batch' => array('type_id' => $this->_batchInfo['type_id'])))
->addSetting(array('setting' => array('monetaryThousandSeparator' => CRM_Core_Config::singleton()->monetaryThousandSeparator)))
->addSetting(array('setting' => array('monetaryDecimalPoint' => CRM_Core_Config::singleton()->monetaryDecimalPoint)));
'headerPattern' => '/^soft_credit_contact_id$/i',
'where' => 'civicrm_contribution_soft.contact_id',
),
+ 'contribution_pcp_title' => array(
+ 'name' => 'contribution_pcp_title',
+ 'title' => 'Personal Campaign Page Title',
+ 'headerPattern' => '/^contribution_pcp_title$/i',
+ 'where' => 'contribution_pcp.title',
+ ),
);
return $extraFields;
AND b.is_test = 0
AND b.receive_date >= $startDate
AND b.receive_date < $endDate
- $additionalWhere
+ $additionalWhere
GROUP BY currency
";
$dao = CRM_Core_DAO::executeQuery($query, CRM_Core_DAO::$_nullArray);
$contactContributionsSQL = "
SELECT contribution.id AS id
FROM civicrm_contribution contribution
- LEFT JOIN civicrm_line_item i ON i.contribution_id = contribution.id AND i.entity_table = 'civicrm_contribution' $liWhere
- WHERE contribution.is_test = 0 AND contribution.contact_id = {$contactId}
- $additionalWhere
+ LEFT JOIN civicrm_line_item i ON i.contribution_id = contribution.id AND i.entity_table = 'civicrm_contribution' $liWhere
+ WHERE contribution.is_test = 0 AND contribution.contact_id = {$contactId}
+ $additionalWhere
AND i.id IS NULL";
$contactSoftCreditContributionsSQL = "
$query->_tables['civicrm_contribution_soft_contact'] = 1;
$query->_tables['civicrm_contribution_soft_phone'] = 1;
}
+
+ if (!empty($query->_returnProperties['contribution_soft_credit_pcp_id'])) {
+ $query->_select['contribution_soft_credit_pcp_id'] = "civicrm_contribution_soft.pcp_id as contribution_soft_credit_pcp_id";
+ $query->_element['contribution_soft_credit_pcp_id'] = 1;
+ $query->_tables['civicrm_contribution'] = 1;
+ $query->_tables['civicrm_contribution_soft'] = 1;
+ }
+
if (!empty($query->_returnProperties['contribution_campaign_title'])) {
$query->_select['contribution_campaign_title'] = "civicrm_campaign.title as contribution_campaign_title";
$query->_element['contribution_campaign_title'] = $query->_tables['civicrm_campaign'] = 1;
}
}
+ self::addPCPFields($form);
+
+ $form->assign('showSoftCreditRow', $showSoftCreditRow);
+ $form->assign('rowCount', $item_count);
+ $form->addElement('hidden', 'sct_default_id',
+ CRM_Core_OptionGroup::getDefaultValue("soft_credit_type"),
+ array('id' => 'sct_default_id')
+ );
+ }
+
+ /**
+ * Add PCP fields for the new contribution form and others.
+ *
+ * @param CRM_Core_Form &$form
+ * The form being built.
+ * @param string $suffix
+ * A suffix to add to field names.
+ */
+ public static function addPCPFields(&$form, $suffix = '') {
// CRM-7368 allow user to set or edit PCP link for contributions
$siteHasPCPs = CRM_Contribute_PseudoConstant::pcPage();
if (!CRM_Utils_Array::crmIsEmptyArray($siteHasPCPs)) {
$form->assign('siteHasPCPs', 1);
// Fixme: Not a true entityRef field. Relies on PCP.js.tpl
- $form->add('text', 'pcp_made_through_id', ts('Credit to a Personal Campaign Page'), array('class' => 'twenty', 'placeholder' => ts('- select -')));
+ $form->add('text', "pcp_made_through_id$suffix", ts('Credit to a Personal Campaign Page'), array('class' => 'twenty', 'placeholder' => ts('- select -')));
// stores the label
- $form->add('hidden', 'pcp_made_through');
- $form->addElement('checkbox', 'pcp_display_in_roll', ts('Display in Honor Roll?'), NULL);
- $form->addElement('text', 'pcp_roll_nickname', ts('Name (for Honor Roll)'));
- $form->addElement('textarea', 'pcp_personal_note', ts('Personal Note (for Honor Roll)'));
+ $form->add('hidden', "pcp_made_through$suffix");
+ $form->addElement('checkbox', "pcp_display_in_roll$suffix", ts('Display in Honor Roll?'), NULL);
+ $form->addElement('text', "pcp_roll_nickname$suffix", ts('Name (for Honor Roll)'));
+ $form->addElement('textarea', "pcp_personal_note$suffix", ts('Personal Note (for Honor Roll)'));
}
- $form->assign('showSoftCreditRow', $showSoftCreditRow);
- $form->assign('rowCount', $item_count);
- $form->addElement('hidden', 'sct_default_id',
- CRM_Core_OptionGroup::getDefaultValue("soft_credit_type"),
- array('id' => 'sct_default_id')
- );
}
/**
'name' => 'contribution_note',
'title' => ts('Contribution Note'),
),
+ 'contribution_soft_credit_pcp_id' => array(
+ 'name' => 'contribution_soft_credit_pcp_id',
+ 'title' => ts('Personal Campaign Page'),
+ ),
);
}
return self::$_contriBatchEntryFields;
$SCTDefaultValue = CRM_Core_OptionGroup::getValue('soft_credit_type', 'Gift', 'name');
}
$form->addElement('hidden', 'sct_default_id', $SCTDefaultValue, array('id' => 'sct_default_id'));
+ CRM_Contribute_Form_SoftCredit::addPCPFields($form, "[$rowNumber]");
}
elseif ($fieldName == 'currency') {
$form->addCurrency($name, $title, $required);
{$form.soft_credit_contact_id.$rowNumber.html|crmAddClass:big}
{$form.soft_credit_amount.$rowNumber.label} {$form.soft_credit_amount.$rowNumber.html|crmAddClass:eight}
</div>
- <div class="compressed crm-grid-cell">{$form.soft_credit_type.$rowNumber.html}</div>
+ {elseif $n eq 'soft_credit_type'}
+ <div class="compressed crm-grid-cell">
+ {$form.soft_credit_type.$rowNumber.html}
+ {$form.pcp_made_through_id.$rowNumber.label} {$form.pcp_made_through_id.$rowNumber.html}{$form.pcp_made_through.$rowNumber.html}
+ {$form.pcp_display_in_roll.$rowNumber.label} {$form.pcp_display_in_roll.$rowNumber.html}
+ {$form.pcp_roll_nickname.$rowNumber.label} {$form.pcp_roll_nickname.$rowNumber.html}
+ {$form.pcp_personal_note.$rowNumber.label} {$form.pcp_personal_note.$rowNumber.html}
+ </div>
{elseif in_array( $fields.$n.html_type, array('Radio', 'CheckBox'))}
<div class="compressed crm-grid-cell"> {$form.field.$rowNumber.$n.html}</div>
{elseif $n eq 'total_amount'}