Merge pull request #17285 from agh1/no-rendered-icons-in-data-source
[civicrm-core.git] / js / crm.backbone.js
index ad27bec160ba00b51e20d0625e2484f842815962..c7960305fa2e1a21a83f4b1eacdcdc6bcc2355fa 100644 (file)
@@ -1,4 +1,4 @@
-(function($, _) {
+(function($, _, Backbone) {
   if (!CRM.Backbone) CRM.Backbone = {};
 
   /**
       },
       toCrmCriteria: function() {
         var result = (this.get('id')) ? {id: this.get('id')} : {};
-        if (this.crmReturn != null) {
+        if (!_.isEmpty(this.crmReturn)) {
           result.return = this.crmReturn;
         }
         return result;
       },
       toCrmCriteria: function() {
         var result = (this.crmCriteria) ? _.extend({}, this.crmCriteria) : {};
-        if (this.crmReturn != null) {
+        if (!_.isEmpty(this.crmReturn)) {
           result.return = this.crmReturn;
-        } else if (this.model && this.model.prototype.crmReturn != null) {
+        } else if (this.model && !_.isEmpty(this.model.prototype.crmReturn)) {
           result.return = this.model.prototype.crmReturn;
         }
         return result;
      });
      collection.fetch({
       success: function(collection) {
-        if (collection.length == 0) {
+        if (collection.length === 0) {
           var attrs = _.extend({}, collection.crmCriteria, options.defaults || {});
           var model = collection._prepareModel(attrs, options);
           options.success(model);
       model.trigger('error', model, resp, options);
     };
   };
-})(CRM.$, CRM._);
+})(CRM.$, CRM._, CRM.BB);