diff --git a/softcreditcustomfields.php b/softcreditcustomfields.php index 517ac82..8cebf3d 100644 --- a/softcreditcustomfields.php +++ b/softcreditcustomfields.php @@ -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)) { diff --git a/templates/CRM/Contribute/Form/Search/SoftCredit-Search.tpl b/templates/CRM/Contribute/Form/Search/SoftCredit-Search.tpl new file mode 100644 index 0000000..9d0f0af --- /dev/null +++ b/templates/CRM/Contribute/Form/Search/SoftCredit-Search.tpl @@ -0,0 +1,14 @@ +{if $contributionSoftGroupTree} +
+
+ {include file="CRM/Custom/Form/Search.tpl" groupTree=$contributionSoftGroupTree showHideLinks=false} +
+ + +{/if}