use description not labels
This commit is contained in:
parent
2d27b3849a
commit
53ddc10ca1
@ -204,9 +204,9 @@ function ftoverride_civicrm_buildForm($formName, &$form) {
|
|||||||
$showElement = FALSE;
|
$showElement = FALSE;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
$form->assign('showElement', $showElement);
|
$form->assign('showElement', $showElement);
|
||||||
$financialTypes = [];
|
$financialTypes = ftoverride_get_financialType($form->getVar('_action'));
|
||||||
CRM_Financial_BAO_FinancialType::getAvailableFinancialTypes($financialTypes, $form->getVar('_action'));
|
|
||||||
$form->add(
|
$form->add(
|
||||||
'select',
|
'select',
|
||||||
'designation',
|
'designation',
|
||||||
@ -249,9 +249,7 @@ function ftoverride_civicrm_buildForm($formName, &$form) {
|
|||||||
if (empty($designations)) {
|
if (empty($designations)) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
$financialTypes = ftoverride_get_financialType($form->getVar('_action'));
|
||||||
$financialTypes = [];
|
|
||||||
CRM_Financial_BAO_FinancialType::getAvailableFinancialTypes($financialTypes, $form->getVar('_action'));
|
|
||||||
$designations = array_flip($designations);
|
$designations = array_flip($designations);
|
||||||
$financialTypes = array_intersect_key($financialTypes, $designations);
|
$financialTypes = array_intersect_key($financialTypes, $designations);
|
||||||
$form->add(
|
$form->add(
|
||||||
@ -336,3 +334,18 @@ function ftoverride_get_designation($pageId) {
|
|||||||
]);
|
]);
|
||||||
return $designations;
|
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;
|
||||||
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user