Added ability to search contribution using contribution soft custom fields
This commit is contained in:
parent
54ab2b53bb
commit
7d15dd1c4d
@ -149,12 +149,30 @@ function softcreditcustomfields_civicrm_entityTypes(&$entityTypes) {
|
||||
_softcreditcustomfields_civix_civicrm_entityTypes($entityTypes);
|
||||
}
|
||||
|
||||
/**
|
||||
* Implements hook_civicrm_preProcess().
|
||||
*
|
||||
* @link http://wiki.civicrm.org/confluence/display/CRMDOC/hook_civicrm_preProcess
|
||||
*/
|
||||
function softcreditcustomfields_civicrm_preProcess($formName, &$form) {
|
||||
if (in_array($formName, ['CRM_Contribute_Form_Search', 'CRM_Contact_Form_Search_Advanced'])) {
|
||||
$extendsMap = &CRM_Core_BAO_CustomQuery::$extendsMap;
|
||||
$extendsMap['ContributionSoft'] = 'civicrm_contribution_soft';
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Implements hook_civicrm_buildForm().
|
||||
*
|
||||
* @link http://wiki.civicrm.org/confluence/display/CRMDOC/hook_civicrm_buildForm
|
||||
*/
|
||||
function softcreditcustomfields_civicrm_buildForm($formName, &$form) {
|
||||
if ('CRM_Contribute_Form_Search' == $formName) {
|
||||
CRM_Contribute_BAO_Query::addCustomFormFields($form, ['ContributionSoft']);
|
||||
CRM_Core_Region::instance('page-footer')->add(array(
|
||||
'template' => "CRM/Contribute/Form/Search/SoftCredit-Search.tpl",
|
||||
));
|
||||
}
|
||||
if ('CRM_Contribute_Form_ContributionView' == $formName) {
|
||||
$softCredits = $form->get_template_vars('softContributions');
|
||||
if (!empty($softCredits)) {
|
||||
|
14
templates/CRM/Contribute/Form/Search/SoftCredit-Search.tpl
Normal file
14
templates/CRM/Contribute/Form/Search/SoftCredit-Search.tpl
Normal file
@ -0,0 +1,14 @@
|
||||
{if $contributionSoftGroupTree}
|
||||
<div class="softcredit_custom_groups">
|
||||
<br>
|
||||
{include file="CRM/Custom/Form/Search.tpl" groupTree=$contributionSoftGroupTree showHideLinks=false}
|
||||
</div>
|
||||
|
||||
<script type="text/javascript">
|
||||
{literal}
|
||||
CRM.$(function($) {
|
||||
$('div#contribution_soft_credit_type_wrapper').append($('div.softcredit_custom_groups'));
|
||||
});
|
||||
{/literal}
|
||||
</script>
|
||||
{/if}
|
Loading…
Reference in New Issue
Block a user