From d4343b472d8b9d7beab6f5a0225f649e9d118db9 Mon Sep 17 00:00:00 2001 From: Tim Otten Date: Sun, 14 Dec 2014 00:42:31 -0800 Subject: [PATCH] CrmAttachment - Fix bug wherein multiple CrmAttachments mix up their targets. --- js/angular-crmAttachment.js | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/js/angular-crmAttachment.js b/js/angular-crmAttachment.js index 07578cbd2a..b9957c831c 100644 --- a/js/angular-crmAttachment.js +++ b/js/angular-crmAttachment.js @@ -8,12 +8,10 @@ // crmAttachment manages the list of files which are attached to a given entity angular.module('crmAttachment').factory('CrmAttachments', function (crmApi, crmStatus, FileUploader, $q) { - var _target; - // @param target an Object(entity_table:'',entity_id:'') or function which generates an object function CrmAttachments(target) { - _target = target; var crmAttachments = this; + this._target = target; this.files = []; this.uploader = new FileUploader({ url: CRM.url('civicrm/ajax/attachment'), @@ -37,7 +35,7 @@ angular.extend(CrmAttachments.prototype, { // @return Object(entity_table:'',entity_id:'') getTarget: function () { - return (angular.isFunction(_target) ? _target() : _target); + return (angular.isFunction(this._target) ? this._target() : this._target); }, // @return Promise load: function load() { -- 2.25.1