Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

dev/core#597 Fix broken api get filter on financial_type #13273

Merged
merged 1 commit into from
Dec 17, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion CRM/Contribute/Page/ManagePremiums.php
Original file line number Diff line number Diff line change
Expand Up @@ -152,7 +152,7 @@ public function browse() {
);
// Financial Type
if (!empty($dao->financial_type_id)) {
$premiums[$dao->id]['financial_type'] = CRM_Core_PseudoConstant::getLabel('CRM_Financial_BAO_FinancialType', 'financial_type', $dao->financial_type_id);
$premiums[$dao->id]['financial_type'] = CRM_Core_PseudoConstant::getLabel('CRM_Contribute_BAO_Product', 'financial_type_id', $dao->financial_type_id);
}
}
$this->assign('rows', $premiums);
Expand Down
2 changes: 1 addition & 1 deletion CRM/Contribute/Page/Premium.php
Original file line number Diff line number Diff line change
Expand Up @@ -168,7 +168,7 @@ public function browse() {
);
// Financial Type
if (!empty($premiumsProductDao->financial_type_id)) {
$premiums[$productDAO->id]['financial_type'] = CRM_Core_PseudoConstant::getLabel('CRM_Financial_BAO_FinancialType', 'financial_type', $premiumsProductDao->financial_type_id);
$premiums[$productDAO->id]['financial_type'] = CRM_Core_PseudoConstant::getLabel('CRM_Contribute_BAO_Product', 'financial_type_id', $premiumsProductDao->financial_type_id);
}
}
}
Expand Down
7 changes: 1 addition & 6 deletions CRM/Financial/DAO/FinancialType.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
*
* Generated from xml/schema/CRM/Financial/FinancialType.xml
* DO NOT EDIT. Generated by CRM_Core_CodeGen
* (GenCodeChecksum:2313c49e821b4a909bf3c54e72576e9b)
* (GenCodeChecksum:760550280aaa0da48232ebdfb11170f9)
*/

/**
Expand Down Expand Up @@ -118,11 +118,6 @@ public static function &fields() {
'type' => 'Text',
'label' => ts("Name"),
],
'pseudoconstant' => [
'table' => 'civicrm_financial_type',
'keyColumn' => 'id',
'labelColumn' => 'name',
]
],
'description' => [
'name' => 'description',
Expand Down
2 changes: 0 additions & 2 deletions api/v3/FinancialType.php
Original file line number Diff line number Diff line change
Expand Up @@ -44,8 +44,6 @@ function civicrm_api3_financial_type_create($params) {

function _civicrm_api3_financial_type_create_spec(&$params) {
$params['name']['api.required'] = 1;
$params['name']['type'] = CRM_Utils_Type::T_STRING;
unset($params['name']['pseudoconstant']);
}

/**
Expand Down
5 changes: 3 additions & 2 deletions tests/phpunit/api/v3/FinancialTypeTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -73,12 +73,13 @@ public function testCreateUpdateFinancialTypeCustomField() {

// create financial type with custom field
$financialType = $this->callAPISuccess('FinancialType', 'create', array_merge($params, $customFields));
$this->callAPISuccessGetSingle('FinancialType', ['name' => $financialTypeName]);

// get financial type to check custom field value
$expectedResult = array_filter(array_merge($params, $customFields), function($var) {
return (!is_null($var) && $var != '');
});
$result = $this->callAPISuccessGetSingle('FinancialType', [
$this->callAPISuccessGetSingle('FinancialType', [
'id' => $financialType['id'],
], $expectedResult);

Expand All @@ -98,7 +99,7 @@ public function testCreateUpdateFinancialTypeCustomField() {
$expectedResult = array_filter(array_merge($params, $customFields), function($var) {
return (!is_null($var) && $var != '');
});
$result = $this->callAPISuccessGetSingle('FinancialType', [
$this->callAPISuccessGetSingle('FinancialType', [
'id' => $financialType['id'],
], $expectedResult);
}
Expand Down
5 changes: 0 additions & 5 deletions xml/schema/Financial/FinancialType.xml
Original file line number Diff line number Diff line change
Expand Up @@ -36,11 +36,6 @@
<label>Name</label>
</html>
<add>1.3</add>
<pseudoconstant>
<table>civicrm_financial_type</table>
<keyColumn>id</keyColumn>
<labelColumn>name</labelColumn>
</pseudoconstant>
</field>
<field>
<name>accounting_code</name>
Expand Down