Fix broken api get filter on financial_type
authoreileen <emcnaughton@wikimedia.org>
Thu, 13 Dec 2018 20:24:34 +0000 (09:24 +1300)
committereileen <emcnaughton@wikimedia.org>
Thu, 13 Dec 2018 20:24:34 +0000 (09:24 +1300)
CRM/Contribute/Page/ManagePremiums.php
CRM/Contribute/Page/Premium.php
CRM/Financial/DAO/FinancialType.php
api/v3/FinancialType.php
tests/phpunit/api/v3/FinancialTypeTest.php
xml/schema/Financial/FinancialType.xml

index 94859108a4645bd472e4e4d150cfbd4d7ccf6cef..65fb5952587cff522d8b0b05b9f56973c4e6a19c 100644 (file)
@@ -152,7 +152,7 @@ class CRM_Contribute_Page_ManagePremiums extends CRM_Core_Page_Basic {
       );
       // 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);
index 61d8cfb4f61c8435befb88c278f826d582144c70..a24eb3960cc4648bfdf63821a95c777af0b49911 100644 (file)
@@ -168,7 +168,7 @@ class CRM_Contribute_Page_Premium extends CRM_Core_Page_Basic {
         );
         // 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);
         }
       }
     }
index 0ba7aa946fc5a7a83399b13f6e9b3ed1088214bf..516fe493e83301965f1bf0ea594ce2d9e6f2abb4 100644 (file)
@@ -6,7 +6,7 @@
  *
  * Generated from xml/schema/CRM/Financial/FinancialType.xml
  * DO NOT EDIT.  Generated by CRM_Core_CodeGen
- * (GenCodeChecksum:2313c49e821b4a909bf3c54e72576e9b)
+ * (GenCodeChecksum:760550280aaa0da48232ebdfb11170f9)
  */
 
 /**
@@ -118,11 +118,6 @@ class CRM_Financial_DAO_FinancialType extends CRM_Core_DAO {
             'type' => 'Text',
             'label' => ts("Name"),
           ],
-          'pseudoconstant' => [
-            'table' => 'civicrm_financial_type',
-            'keyColumn' => 'id',
-            'labelColumn' => 'name',
-          ]
         ],
         'description' => [
           'name' => 'description',
index dc438dbb460310ee472328c9c6796d2843419b7f..ab13f47df48537890c2f1805ad594ee5c4a32b2e 100644 (file)
@@ -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']);
 }
 
 /**
index db5e35a5ceafb81e05f523f18ea00af06758bb15..58fe078929a6f0e6d1c33fe552dad336cd21ad1e 100644 (file)
@@ -73,12 +73,13 @@ class api_v3_FinancialTypeTest extends CiviUnitTestCase {
 
       // 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);
 
@@ -98,7 +99,7 @@ class api_v3_FinancialTypeTest extends CiviUnitTestCase {
       $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);
     }
index 8e93b6c82ec3816d8de0c33f615835a3f043cc69..bbdca886dae8338a792992bab2dcfc2aed1cec63 100644 (file)
       <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>