X-Git-Url: https://vcs.fsf.org/?a=blobdiff_plain;f=js%2Frest.js;h=434dcdf312ef63172d04cb2bc6f200f052c9c80f;hb=a5db8e6f23a5fe5a90dfade39766c5bf0f7f8d27;hp=118b4c7f0e7837c073099118332086aeec9ffe86;hpb=0779ccc2cfb33bb15a89896a51ed8ce4efc59168;p=civicrm-core.git diff --git a/js/rest.js b/js/rest.js index 118b4c7f0e..434dcdf312 100644 --- a/js/rest.js +++ b/js/rest.js @@ -1,6 +1,6 @@ /* +--------------------------------------------------------------------+ - | CiviCRM version 4.3 | + | CiviCRM version 4.4 | +--------------------------------------------------------------------+ | This file is a part of CiviCRM. | | | @@ -86,8 +86,7 @@ var CRM = CRM || {}; */ CRM.api = function(entity, action, params, options) { // Default settings - var json = false, - settings = { + var settings = { context: null, success: function(result, settings) { return true; @@ -122,24 +121,11 @@ var CRM = CRM || {}; return true; }; } - for (var i in params) { - if (i.slice(0, 4) == 'api.' || typeof(params[i]) == 'Object') { - json = true; - break; - } - } - if (json) { - params = { - entity: entity, - action: action, - json: JSON.stringify(params) - }; - } - else { - params.entity = entity; - params.action = action; - params.json = 1; - } + params = { + entity: entity, + action: action, + json: JSON.stringify(params) + }; // Pass copy of settings into closure to preserve its value during multiple requests (function(stg) { $.ajax({ @@ -160,6 +146,15 @@ var CRM = CRM || {}; return CRM.api.call(this, entity, action, params, options); }; + /** + * FIXME: This function is not documented, is not used anywhere in the codebase, and doesn't + * clearly differentiate field elements which store the "contact id" versus the "contact label". + * My guess is that it's designed more for "quick-search" and less for "CRUD forms". + * + * @param params + * @param options + * @return {*} + */ $.fn.crmAutocomplete = function (params, options) { if (typeof params == 'undefined') params = {}; if (typeof options == 'undefined') options = {};