diff --git a/grantprograms.php b/grantprograms.php index 4dc17c015960507b118d4d637c0477b4c5d4c34f..0ca5727a0fc7ca5dcb02bd45415d7ba4359b0378 100644 --- a/grantprograms.php +++ b/grantprograms.php @@ -1,4 +1,4 @@ -<?php + <?php require_once 'grantprograms.civix.php'; define('PAY_GRANTS', 5); define('DELETE_GRANTS', 1); @@ -480,7 +480,7 @@ function grantprograms_civicrm_pageRun( &$page ) { if ($page->getVar('_name') == "CRM_Custom_Page_Option") { $params['id'] = $page->getVar('_fid'); $params['custom_group_id'] = $page->getVar('_gid'); - CRM_Core_BAO_CustomField::retrieve(&$params, &$defaults); + CRM_Core_BAO_CustomField::retrieve($params, $defaults); $optionValues = CRM_Core_BAO_OptionValue::getOptionValuesArray($defaults['option_group_id']); $smarty = CRM_Core_Smarty::singleton(); foreach ($optionValues as $key => $value) { @@ -700,11 +700,15 @@ function grantprograms_civicrm_post($op, $objectName, $objectId, &$objectRef) { $grantProgram = $grantPrograms[$params['grant_program_id']]; $grantType = $grantTypes[$params['grant_type_id']]; $grantStatus = $grantStatus[$params['status_id']]; + $grantIneligibleReasons = CRM_Core_OptionGroup::values('reason_grant_ineligible'); $page->assign('grant_type', $grantType); $page->assign('grant_programs', $grantProgram); $page->assign('grant_status', $grantStatus); - $page->assign('params', $params); + if (CRM_Utils_Array::value('grant_rejected_reason_id', $params)) { + $params['grant_rejected_reason'] = $grantIneligibleReasons[$params['grant_rejected_reason_id']]; + } + $page->assign('grant', $params); CRM_Grant_BAO_GrantProgram::sendMail($params['contact_id'], $params, $grantStatus); } diff --git a/sql/message_templates/grant_approved_html.tpl b/sql/message_templates/grant_approved_html.tpl index 233e270ee1d9caa53137e6b2c8ae2369975d9ce3..2d8b756bbf62de152291f92eea0a1f414d88deef 100644 --- a/sql/message_templates/grant_approved_html.tpl +++ b/sql/message_templates/grant_approved_html.tpl @@ -13,7 +13,7 @@ <p>This is being sent to you as a receipt of {$grant_status} grant.</p> Grant Program Name: {$grant_programs} <br> Grant Type : {$grant_type}<br> -Total Amount : {$params.amount_total}<br> +Total Amount : {$grant.amount_total}<br> {if customField} {foreach from=$customField key=key item=data} <b>{$customGroup.$key}</b><br> diff --git a/sql/message_templates/grant_approved_text.tpl b/sql/message_templates/grant_approved_text.tpl index 45e577153b1fa123221794e1d248400b3593ef53..93b230a4c901d2eea94bed510d7d5f0c22848830 100644 --- a/sql/message_templates/grant_approved_text.tpl +++ b/sql/message_templates/grant_approved_text.tpl @@ -2,7 +2,7 @@ Dear {contact.display_name}, This is being sent to you as a receipt of {$grant_status} grant. Grant Program Name: {$grant_programs} <br> Grant Type {$grant_type} -Total Amount: {$params.amount_total} +Total Amount: {$grant.amount_total} {if customField} {foreach from=$customField key=key item=data} {$customGroup.$key} diff --git a/sql/message_templates/grant_awaiting_info_html.tpl b/sql/message_templates/grant_awaiting_info_html.tpl index 233e270ee1d9caa53137e6b2c8ae2369975d9ce3..2d8b756bbf62de152291f92eea0a1f414d88deef 100644 --- a/sql/message_templates/grant_awaiting_info_html.tpl +++ b/sql/message_templates/grant_awaiting_info_html.tpl @@ -13,7 +13,7 @@ <p>This is being sent to you as a receipt of {$grant_status} grant.</p> Grant Program Name: {$grant_programs} <br> Grant Type : {$grant_type}<br> -Total Amount : {$params.amount_total}<br> +Total Amount : {$grant.amount_total}<br> {if customField} {foreach from=$customField key=key item=data} <b>{$customGroup.$key}</b><br> diff --git a/sql/message_templates/grant_awaiting_info_text.tpl b/sql/message_templates/grant_awaiting_info_text.tpl index 45e577153b1fa123221794e1d248400b3593ef53..93b230a4c901d2eea94bed510d7d5f0c22848830 100644 --- a/sql/message_templates/grant_awaiting_info_text.tpl +++ b/sql/message_templates/grant_awaiting_info_text.tpl @@ -2,7 +2,7 @@ Dear {contact.display_name}, This is being sent to you as a receipt of {$grant_status} grant. Grant Program Name: {$grant_programs} <br> Grant Type {$grant_type} -Total Amount: {$params.amount_total} +Total Amount: {$grant.amount_total} {if customField} {foreach from=$customField key=key item=data} {$customGroup.$key} diff --git a/sql/message_templates/grant_eligible_html.tpl b/sql/message_templates/grant_eligible_html.tpl index 233e270ee1d9caa53137e6b2c8ae2369975d9ce3..2d8b756bbf62de152291f92eea0a1f414d88deef 100644 --- a/sql/message_templates/grant_eligible_html.tpl +++ b/sql/message_templates/grant_eligible_html.tpl @@ -13,7 +13,7 @@ <p>This is being sent to you as a receipt of {$grant_status} grant.</p> Grant Program Name: {$grant_programs} <br> Grant Type : {$grant_type}<br> -Total Amount : {$params.amount_total}<br> +Total Amount : {$grant.amount_total}<br> {if customField} {foreach from=$customField key=key item=data} <b>{$customGroup.$key}</b><br> diff --git a/sql/message_templates/grant_eligible_text.tpl b/sql/message_templates/grant_eligible_text.tpl index 45e577153b1fa123221794e1d248400b3593ef53..93b230a4c901d2eea94bed510d7d5f0c22848830 100644 --- a/sql/message_templates/grant_eligible_text.tpl +++ b/sql/message_templates/grant_eligible_text.tpl @@ -2,7 +2,7 @@ Dear {contact.display_name}, This is being sent to you as a receipt of {$grant_status} grant. Grant Program Name: {$grant_programs} <br> Grant Type {$grant_type} -Total Amount: {$params.amount_total} +Total Amount: {$grant.amount_total} {if customField} {foreach from=$customField key=key item=data} {$customGroup.$key} diff --git a/sql/message_templates/grant_ineligible_html.tpl b/sql/message_templates/grant_ineligible_html.tpl index 42c503f98ca1b9f91bdbef6833dacf3b70f7fa4d..44922458c0ee51205e5169ab771325284ce38ded 100644 --- a/sql/message_templates/grant_ineligible_html.tpl +++ b/sql/message_templates/grant_ineligible_html.tpl @@ -13,11 +13,11 @@ <p>This is being sent to you as a receipt of {$grant_status} grant.</p> Grant Program Name: {$grant_programs} <br> Grant Type : {$grant_type}<br> -Total Amount : {$params.amount_total}<br> -{if $grant_decision_reason} -Grant Decision Reason: -{$grant_decision_reason} -{/if}<br> +Total Amount : {$grant.amount_total}<br> +{if $grant.grant_rejected_reason} +Grant Ineligible Reason: +{$grant.$grant.grant_rejected_reason}<br> +{/if} {if customField} {foreach from=$customField key=key item=data} <b>{$customGroup.$key}</b><br> diff --git a/sql/message_templates/grant_ineligible_text.tpl b/sql/message_templates/grant_ineligible_text.tpl index f221566cca2fb19cd84536e89e89014c0b510a46..8cd8dd987e90b911a20b7835f51191b2fdabf0eb 100644 --- a/sql/message_templates/grant_ineligible_text.tpl +++ b/sql/message_templates/grant_ineligible_text.tpl @@ -2,10 +2,10 @@ Dear {contact.display_name}, This is being sent to you as a receipt of {$grant_status} grant. Grant Program Name: {$grant_programs} <br> Grant Type {$grant_type} -Total Amount: {$params.amount_total} -{if $grant_decision_reason} -Grant Decision Reason: -{$grant_decision_reason} +Total Amount: {$grant.amount_total} +{if $grant.grant_rejected_reason} +Grant Ineligible Reason: +{$grant.grant_rejected_reason}<br> {/if} {if customField} {foreach from=$customField key=key item=data} diff --git a/sql/message_templates/grant_paid_html.tpl b/sql/message_templates/grant_paid_html.tpl index 233e270ee1d9caa53137e6b2c8ae2369975d9ce3..2d8b756bbf62de152291f92eea0a1f414d88deef 100644 --- a/sql/message_templates/grant_paid_html.tpl +++ b/sql/message_templates/grant_paid_html.tpl @@ -13,7 +13,7 @@ <p>This is being sent to you as a receipt of {$grant_status} grant.</p> Grant Program Name: {$grant_programs} <br> Grant Type : {$grant_type}<br> -Total Amount : {$params.amount_total}<br> +Total Amount : {$grant.amount_total}<br> {if customField} {foreach from=$customField key=key item=data} <b>{$customGroup.$key}</b><br> diff --git a/sql/message_templates/grant_paid_text.tpl b/sql/message_templates/grant_paid_text.tpl index 45e577153b1fa123221794e1d248400b3593ef53..93b230a4c901d2eea94bed510d7d5f0c22848830 100644 --- a/sql/message_templates/grant_paid_text.tpl +++ b/sql/message_templates/grant_paid_text.tpl @@ -2,7 +2,7 @@ Dear {contact.display_name}, This is being sent to you as a receipt of {$grant_status} grant. Grant Program Name: {$grant_programs} <br> Grant Type {$grant_type} -Total Amount: {$params.amount_total} +Total Amount: {$grant.amount_total} {if customField} {foreach from=$customField key=key item=data} {$customGroup.$key} diff --git a/sql/message_templates/grant_submitted_html.tpl b/sql/message_templates/grant_submitted_html.tpl index 233e270ee1d9caa53137e6b2c8ae2369975d9ce3..2d8b756bbf62de152291f92eea0a1f414d88deef 100644 --- a/sql/message_templates/grant_submitted_html.tpl +++ b/sql/message_templates/grant_submitted_html.tpl @@ -13,7 +13,7 @@ <p>This is being sent to you as a receipt of {$grant_status} grant.</p> Grant Program Name: {$grant_programs} <br> Grant Type : {$grant_type}<br> -Total Amount : {$params.amount_total}<br> +Total Amount : {$grant.amount_total}<br> {if customField} {foreach from=$customField key=key item=data} <b>{$customGroup.$key}</b><br> diff --git a/sql/message_templates/grant_submitted_text.tpl b/sql/message_templates/grant_submitted_text.tpl index 45e577153b1fa123221794e1d248400b3593ef53..93b230a4c901d2eea94bed510d7d5f0c22848830 100644 --- a/sql/message_templates/grant_submitted_text.tpl +++ b/sql/message_templates/grant_submitted_text.tpl @@ -2,7 +2,7 @@ Dear {contact.display_name}, This is being sent to you as a receipt of {$grant_status} grant. Grant Program Name: {$grant_programs} <br> Grant Type {$grant_type} -Total Amount: {$params.amount_total} +Total Amount: {$grant.amount_total} {if customField} {foreach from=$customField key=key item=data} {$customGroup.$key} diff --git a/sql/message_templates/grant_withdrawn_html.tpl b/sql/message_templates/grant_withdrawn_html.tpl index b05dd946290858a7532fd941f386c2bf33bc55e7..0749e5eb674cb9ab0c73e0c1e07634283a42556a 100644 --- a/sql/message_templates/grant_withdrawn_html.tpl +++ b/sql/message_templates/grant_withdrawn_html.tpl @@ -13,7 +13,7 @@ <p>This is being sent to you as a receipt of {$grant_status} grant.</p> Grant Program Name : {$grant_programs} <br> Grant Type : {$grant_type}<br> -Total Amount : {$params.amount_total}<br> +Total Amount : {$grant.amount_total}<br> {if customField} {foreach from=$customField key=key item=data} <b>{$customGroup.$key}</b><br> diff --git a/sql/message_templates/grant_withdrawn_text.tpl b/sql/message_templates/grant_withdrawn_text.tpl index 45e577153b1fa123221794e1d248400b3593ef53..93b230a4c901d2eea94bed510d7d5f0c22848830 100644 --- a/sql/message_templates/grant_withdrawn_text.tpl +++ b/sql/message_templates/grant_withdrawn_text.tpl @@ -2,7 +2,7 @@ Dear {contact.display_name}, This is being sent to you as a receipt of {$grant_status} grant. Grant Program Name: {$grant_programs} <br> Grant Type {$grant_type} -Total Amount: {$params.amount_total} +Total Amount: {$grant.amount_total} {if customField} {foreach from=$customField key=key item=data} {$customGroup.$key}