-(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);