CiviCRM 4.6.4/Wordpress.
During API call for Contribution get and parameter id = xxxx, api returns A fatal error was triggered: CiviCRM is not of the type Int
.
Adding a return statement in wp-content/plugins/civicrm/civicrm/CRM/Contribute/BAO/Query.php
solves the issue but unsure if this will affect other Contribution tasks in production..
Also tried a clean install of 4.6.4 on Wordpress and same issue.
{
"trace": "#0 /vagrant/donate/wp-content/plugins/civicrm/civicrm/CRM/Utils/Type.php(269): CRM_Core_Error::fatal('CiviCRM is not ...')\n#1 /vagrant/donate/wp-content/plugins/civicrm/civicrm/CRM/Contact/BAO/Query.php(5238): CRM_Utils_Type::escape('CiviCRM', 'Int')\n#2 /vagrant/donate/wp-content/plugins/civicrm/civicrm/CRM/Contribute/BAO/Query.php(373): CRM_Contact_BAO_Query::buildClause('civicrm_contrib...', '=', 'CiviCRM', 'Int')\n#3 /vagrant/donate/wp-content/plugins/civicrm/civicrm/CRM/Contribute/BAO/Query.php(251): CRM_Contribute_BAO_Query::whereClauseSingle(Array, Object(CRM_Contact_BAO_Query))\n#4 /vagrant/donate/wp-content/plugins/civicrm/civicrm/CRM/Core/Component.php(298): CRM_Contribute_BAO_Query::where(Object(CRM_Contact_BAO_Query))\n#5 /vagrant/donate/wp-content/plugins/civicrm/civicrm/CRM/Contact/BAO/Query.php(1894): CRM_Core_Component::alterQuery(Object(CRM_Contact_BAO_Query), 'where')\n#6 /vagrant/donate/wp-content/plugins/civicrm/civicrm/CRM/Contact/BAO/Query.php(499): CRM_Contact_BAO_Query->whereClause()\n#7 /vagrant/donate/wp-content/plugins/civicrm/civicrm/CRM/Contact/BAO/Query.php(461): CRM_Contact_BAO_Query->initialize()\n#8 /vagrant/donate/wp-content/plugins/civicrm/civicrm/api/v3/utils.php(595): CRM_Contact_BAO_Query->__construct(Array, Array, NULL, false, false, 2, false)\n#9 /vagrant/donate/wp-content/plugins/civicrm/civicrm/api/v3/Contribution.php(217): _civicrm_api3_get_query_object(Array, 2, 'Contribution')\n#10 /vagrant/donate/wp-content/plugins/civicrm/civicrm/Civi/API/Provider/MagicFunctionProvider.php(89): civicrm_api3_contribution_get(Array)\n#11 /vagrant/donate/wp-content/plugins/civicrm/civicrm/Civi/API/Kernel.php(96): Civi\\API\\Provider\\MagicFunctionProvider->invoke(Array)\n#12 /vagrant/donate/wp-content/plugins/civicrm/civicrm/api/api.php(23): Civi\\API\\Kernel->run('Contribution', 'get', Array, NULL)\n#13 /vagrant/donate/wp-content/plugins/civicrm/civicrm/CRM/Utils/REST.php(404): civicrm_api('Contribution', 'get', Array)\n#14 /vagrant/donate/wp-content/plugins/civicrm/civicrm/CRM/Utils/REST.php(640): CRM_Utils_REST::process(Array, Array)\n#15 [internal function]: CRM_Utils_REST::ajax()\n#16 /vagrant/donate/wp-content/plugins/civicrm/civicrm/CRM/Core/Invoke.php(278): call_user_func(Array)\n#17 /vagrant/donate/wp-content/plugins/civicrm/civicrm/CRM/Core/Invoke.php(86): CRM_Core_Invoke::runItem(Array)\n#18 /vagrant/donate/wp-content/plugins/civicrm/civicrm/CRM/Core/Invoke.php(54): CRM_Core_Invoke::_invoke(Array)\n#19 /vagrant/donate/wp-content/plugins/civicrm/civicrm.php(1188): CRM_Core_Invoke::invoke(Array)\n#20 [internal function]: CiviCRM_For_WordPress->invoke('')\n#21 /vagrant/donate/wp-includes/class-wp-hook.php(298): call_user_func_array(Array, Array)\n#22 /vagrant/donate/wp-includes/class-wp-hook.php(323): WP_Hook->apply_filters('', Array)\n#23 /vagrant/donate/wp-includes/plugin.php(453): WP_Hook->do_action(Array)\n#24 /vagrant/donate/wp-admin/admin.php(222): do_action('toplevel_page_C...')\n#25 {main}",
"is_error": 1,
"error_message": "A fatal error was triggered: CiviCRM is not of the type Int"
}
The code
CRM.api3('Contribution', 'get', {
"debug": 1,
"sequential": 1
}).done(function(result) {
// do something
});