use description not labels

This commit is contained in:
Civiware Solutions 2018-11-01 22:16:25 +05:30
parent 2d27b3849a
commit 53ddc10ca1

View File

@ -204,9 +204,9 @@ function ftoverride_civicrm_buildForm($formName, &$form) {
$showElement = FALSE;
}
}
$form->assign('showElement', $showElement);
$financialTypes = [];
CRM_Financial_BAO_FinancialType::getAvailableFinancialTypes($financialTypes, $form->getVar('_action'));
$financialTypes = ftoverride_get_financialType($form->getVar('_action'));
$form->add(
'select',
'designation',
@ -249,9 +249,7 @@ function ftoverride_civicrm_buildForm($formName, &$form) {
if (empty($designations)) {
return;
}
$financialTypes = [];
CRM_Financial_BAO_FinancialType::getAvailableFinancialTypes($financialTypes, $form->getVar('_action'));
$financialTypes = ftoverride_get_financialType($form->getVar('_action'));
$designations = array_flip($designations);
$financialTypes = array_intersect_key($financialTypes, $designations);
$form->add(
@ -336,3 +334,18 @@ function ftoverride_get_designation($pageId) {
]);
return $designations;
}
function ftoverride_get_financialType($action) {
$financialTypes = [];
CRM_Financial_BAO_FinancialType::getAvailableFinancialTypes($financialTypes, $action);
$result = civicrm_api3('FinancialType', 'get', [
'return' => ["description"],
'description' => ['!=' => ""],
'id' => ['IN' => array_keys($financialTypes)],
]);
$descFinancialType = [];
if (!empty($result['values'])) {
$descFinancialType = array_column($result['values'], 'description', 'id');
}
return $descFinancialType + $financialTypes;
}