Use constant

This commit is contained in:
2018-08-12 05:47:25 +05:30
parent dc36f24333
commit 6559524f46
2 changed files with 15 additions and 11 deletions

View File

@ -7,6 +7,8 @@ define('GRANT_SCHOLARSHIP_CUSTOM_GROUP', 'grant_scholarship');
define('GRANT_SCHOLARSHIP_CUSTOM_FIELD', 'is_grant_scholarship');
define('GRANT_SCHOLARSHIP_CUSTOM_TABLE_NAME', 'civicrm_value_grant_scholarship');
define('GRANT_SCHOLARSHIP_YEAR_DIFF', 10);
define('GRANT_DATE_CHECK_FIELD', 'decision_date');
define('GRANT_AMOUNT_CHECK_FIELD', 'amount_granted');
/**
* Implements hook_civicrm_config().
*
@ -224,8 +226,8 @@ function annualgrantbudgets_civicrm_validateForm($formName, &$fields, &$files, &
if ($formName == 'CRM_Grant_Form_Grant' && !($form->_action & CRM_Core_Action::DELETE)) {
if (empty($fields['financial_type_id'])
|| empty($fields['status_id'])
|| empty($fields['decision_date'])
|| empty($fields['amount_granted'])
|| empty($fields[GRANT_DATE_CHECK_FIELD])
|| empty($fields[GRANT_AMOUNT_CHECK_FIELD])
) {
return;
}
@ -239,7 +241,7 @@ function annualgrantbudgets_civicrm_validateForm($formName, &$fields, &$files, &
}
list($isError, $grantBudget) = CRM_Grant_BAO_GrantBudget::checkBudget($fields, $form->getVar('_id'));
if ($isError) {
$errors['amount_granted'] = ts("The annual budget for this grant is {$grantBudget['budget']}. Grants totaling {$grantBudget['total_amount_granted']} have been made. {$grantBudget['balance_amount']} remains.");
$errors[GRANT_AMOUNT_CHECK_FIELD] = ts("The annual budget for this grant is {$grantBudget['budget']}. Grants totaling {$grantBudget['total_amount_granted']} have been made. {$grantBudget['balance_amount']} remains.");
}
}
}