Compare commits
2 Commits
c6f0ed40d7
...
e5acc93ccd
Author | SHA1 | Date | |
---|---|---|---|
|
e5acc93ccd | ||
|
bc00ef9c70 |
@ -197,6 +197,14 @@ function ftoverride_civicrm_entityTypes(&$entityTypes) {
|
|||||||
*/
|
*/
|
||||||
function ftoverride_civicrm_buildForm($formName, &$form) {
|
function ftoverride_civicrm_buildForm($formName, &$form) {
|
||||||
if ('CRM_Contribute_Form_ContributionPage_Settings' == $formName) {
|
if ('CRM_Contribute_Form_ContributionPage_Settings' == $formName) {
|
||||||
|
$showElement = TRUE;
|
||||||
|
if ($form->getVar('_id')) {
|
||||||
|
$snippet = CRM_Utils_Array::value('snippet', $_GET);
|
||||||
|
if (empty($snippet)) {
|
||||||
|
$showElement = FALSE;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
$form->assign('showElement', $showElement);
|
||||||
$financialTypes = [];
|
$financialTypes = [];
|
||||||
CRM_Financial_BAO_FinancialType::getAvailableFinancialTypes($financialTypes, $form->getVar('_action'));
|
CRM_Financial_BAO_FinancialType::getAvailableFinancialTypes($financialTypes, $form->getVar('_action'));
|
||||||
$form->add(
|
$form->add(
|
||||||
@ -228,6 +236,13 @@ function ftoverride_civicrm_buildForm($formName, &$form) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if ('CRM_Contribute_Form_Contribution_Confirm' == $formName && $form->_flagSubmitted) {
|
||||||
|
$submitValues = $form->_params;
|
||||||
|
if (!empty($submitValues['designation'])) {
|
||||||
|
//$form->assign('contribution_designation', $submitValues['designation']);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if ('CRM_Contribute_Form_Contribution_Main' == $formName) {
|
if ('CRM_Contribute_Form_Contribution_Main' == $formName) {
|
||||||
try {
|
try {
|
||||||
$designations = ftoverride_get_designation($form->_id);
|
$designations = ftoverride_get_designation($form->_id);
|
||||||
@ -264,9 +279,17 @@ function ftoverride_civicrm_buildForm($formName, &$form) {
|
|||||||
* @link http://wiki.civicrm.org/confluence/display/CRMDOC/hook_civicrm_buildForm
|
* @link http://wiki.civicrm.org/confluence/display/CRMDOC/hook_civicrm_buildForm
|
||||||
*/
|
*/
|
||||||
function ftoverride_civicrm_pre($op, $objectName, $id, &$params) {
|
function ftoverride_civicrm_pre($op, $objectName, $id, &$params) {
|
||||||
|
if ($op == 'create' && $objectName == 'Contribution' && !empty($params['contribution_page_id'])) {
|
||||||
|
$designation = CRM_Core_Smarty::singleton()->get_template_vars('contribution_designation');
|
||||||
|
if (!empty($designation)) {
|
||||||
|
$params['financial_type_id'] = $designation;
|
||||||
|
CRM_Core_Smarty::singleton()->assign('contribution_designation', '');
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if (in_array($op, ['create', 'edit'])
|
if (in_array($op, ['create', 'edit'])
|
||||||
&& $objectName == 'ContributionPage'
|
&& $objectName == 'ContributionPage'
|
||||||
&& !empty($params['designation'])
|
&& isset($params['designation'])
|
||||||
) {
|
) {
|
||||||
if ($id) {
|
if ($id) {
|
||||||
$params['id'] = $id;
|
$params['id'] = $id;
|
||||||
|
@ -6,7 +6,7 @@
|
|||||||
{literal}
|
{literal}
|
||||||
<script type="text/javascript">
|
<script type="text/javascript">
|
||||||
CRM.$(function($) {
|
CRM.$(function($) {
|
||||||
$('div#priceset-div').after($('div.ft_override_designation-section'));
|
$('div#priceset:first').after($('div.ft_override_designation-section'));
|
||||||
});
|
});
|
||||||
</script>
|
</script>
|
||||||
{/literal}
|
{/literal}
|
||||||
|
@ -1,3 +1,4 @@
|
|||||||
|
{if $showElement}
|
||||||
<table class="ft_override_designation-block">
|
<table class="ft_override_designation-block">
|
||||||
<tr class="crm-contribution-contributionpage-settings-form-block-ft_override_designation">
|
<tr class="crm-contribution-contributionpage-settings-form-block-ft_override_designation">
|
||||||
<td scope="row" class="label" width="20%">{$form.designation.label}</td>
|
<td scope="row" class="label" width="20%">{$form.designation.label}</td>
|
||||||
@ -11,3 +12,4 @@
|
|||||||
});
|
});
|
||||||
</script>
|
</script>
|
||||||
{/literal}
|
{/literal}
|
||||||
|
{/if}
|
||||||
|
Loading…
Reference in New Issue
Block a user