From: Coleman Watts Date: Thu, 7 Mar 2013 01:38:00 +0000 (-0800) Subject: Restore context to CRM.api CRM-12029 X-Git-Url: https://vcs.fsf.org/?a=commitdiff_plain;h=fbc3a95aae936e4ce76dcec1ccb549c6ef0d8efd;p=civicrm-core.git Restore context to CRM.api CRM-12029 --- diff --git a/js/jquery/jquery.crmeditable.js b/js/jquery/jquery.crmeditable.js index af3ba75491..de115b638e 100644 --- a/js/jquery/jquery.crmeditable.js +++ b/js/jquery/jquery.crmeditable.js @@ -82,7 +82,6 @@ return fieldName; } - var checkable = function () { $(this).change (function() { var params={sequential:1}; diff --git a/js/rest.js b/js/rest.js index 1e07f11105..8cec7c8167 100644 --- a/js/rest.js +++ b/js/rest.js @@ -141,23 +141,23 @@ var CRM = CRM || {}; params.json = 1; } // Pass copy of settings into closure to preserve its value during multiple requests - (function(stg) { + (function(stg, that) { $.ajax({ url: stg.ajaxURL.indexOf('http') === 0 ? stg.ajaxURL : CRM.url(stg.ajaxURL), dataType: 'json', data: params, type: action.indexOf('get') < 0 ? 'POST' : 'GET', success: function(result) { - stg.callBack.call(this, result, stg); + stg.callBack.call(that, result, stg); } }); - })($.extend({}, settings)); + })($.extend({}, settings), this); }; // Backwards compatible with jQuery fn $.fn.crmAPI = function(entity, action, params, options) { console && console.log && console.log('Calling crmAPI from jQuery is deprecated. Please use CRM.api() instead.'); - return CRM.api(entity, action, params, options); + return CRM.api.call(this, entity, action, params, options); }; $.fn.crmAutocomplete = function (params, options) {