Getting (translated) label instead of (untranslated) names in getFinancialAccountForFinancialTypeByRelationship()
Error:
Notice: Undefined offset: 0 in CRM_Financial_BAO_FinancialAccount::getFinancialAccountForFinancialTypeByRelationship()
(regel 257 van /civicrm/CRM/Financial/BAO/FinancialAccount.php).
CiviCRM is in dutch, so getting $accountRelationships with $accountRelationships = CRM_Core_PseudoConstant::accountOptionValues('account_relationship', NULL);
returns an array with dutch labels.
$incomeAccountRelationshipID = array_search('Income Account is', $accountRelationships);
will give a php notice.
Solution:
$accountRelationships = CRM_Core_OptionGroup::values('account_relationship', FALSE, FALSE, FALSE, NULL, 'name');
See civicrm-566-get-names-in-getFinancialAccountForFinancialTypeByRelationship.patch