Merge remote-tracking branch 'upstream/4.6' into 4.6-master-2015-04-20-23-29-59
[civicrm-core.git] / js / crm.backbone.js
index ad27bec160ba00b51e20d0625e2484f842815962..e384466213b1cae524f0b7f3939cea3b60acc4fb 100644 (file)
       },
       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);