diff --git a/ftoverride.php b/ftoverride.php index bc908a8..ccceef9 100644 --- a/ftoverride.php +++ b/ftoverride.php @@ -316,6 +316,22 @@ function ftoverride_civicrm_pre($op, $objectName, $id, &$params) { } } +/** + * Implements hook_civicrm_validateForm(). + * + * @link http://wiki.civicrm.org/confluence/display/CRMDOC/hook_civicrm_validateForm + */ +function ftoverride_civicrm_validateForm($formName, &$fields, &$files, &$form, &$errors) { + if ('CRM_Contribute_Form_Contribution_Main' == $formName) { + if (!empty($fields['designation']) + && $fields['designation'] == 'other_financial_type' + && empty($fields['designation_note']) + ) { + $errors['designation_note'] = ts('Please provide other information about designation.'); + } + } +} + /** * Implements hook_civicrm_buildAmount(). *