diff --git a/frontend/client/src/views/admin/layouts/list.js b/frontend/client/src/views/admin/layouts/list.js index c28550d37b..c0caeed08c 100644 --- a/frontend/client/src/views/admin/layouts/list.js +++ b/frontend/client/src/views/admin/layouts/list.js @@ -34,6 +34,8 @@ Espo.define('Views.Admin.Layouts.List', 'Views.Admin.Layouts.Rows', function (De editable: true, ignoreList: [], + + ignoreTypeList: [], setup: function () { Dep.prototype.setup.call(this); @@ -115,6 +117,9 @@ Espo.define('Views.Admin.Layouts.List', 'Views.Admin.Layouts.Rows', function (De if (this.ignoreList.indexOf(name) != -1) { return false; } + if (this.ignoreTypeList.indexOf(model.getFieldParam(name, 'type')) != -1) { + return false; + } return !model.getFieldParam(name, 'disabled'); } diff --git a/frontend/client/src/views/admin/layouts/mass-update.js b/frontend/client/src/views/admin/layouts/mass-update.js index ece3944606..d28d1b654a 100644 --- a/frontend/client/src/views/admin/layouts/mass-update.js +++ b/frontend/client/src/views/admin/layouts/mass-update.js @@ -17,9 +17,9 @@ * * You should have received a copy of the GNU General Public License * along with EspoCRM. If not, see http://www.gnu.org/licenses/. - ************************************************************************/ + ************************************************************************/ -Espo.define('Views.Admin.Layouts.MassUpdate', 'Views.Admin.Layouts.Rows', function (Dep) { +Espo.define('Views.Admin.Layouts.MassUpdate', 'Views.Admin.Layouts.Rows', function (Dep) { return Dep.extend({ @@ -28,6 +28,8 @@ Espo.define('Views.Admin.Layouts.MassUpdate', 'Views.Admin.Layouts.Rows', functi editable: false, ignoreList: [], + + ignoreTypeList: ['duration'], setup: function () { Dep.prototype.setup.call(this); @@ -54,7 +56,7 @@ Espo.define('Views.Admin.Layouts.MassUpdate', 'Views.Admin.Layouts.Rows', functi label: this.getLanguage().translate(layout[i], 'fields', this.scope) }); this.enabledFieldsList.push(layout[i]); - } + } for (var i in allFields) { if (!_.contains(this.enabledFieldsList, allFields[i])) { @@ -70,14 +72,14 @@ Espo.define('Views.Admin.Layouts.MassUpdate', 'Views.Admin.Layouts.Rows', functi this.rowLayout[i].label = this.getLanguage().translate(this.rowLayout[i].name, 'fields', this.scope); } - this.wait(false); + this.wait(false); }.bind(this), false); - }.bind(this)); + }.bind(this)); }, fetch: function () { var layout = []; - $("#layout ul.enabled > li").each(function (i, el) { + $("#layout ul.enabled > li").each(function (i, el) { layout.push($(el).data('name')); }.bind(this)); return layout; @@ -91,6 +93,9 @@ Espo.define('Views.Admin.Layouts.MassUpdate', 'Views.Admin.Layouts.Rows', functi if (this.ignoreList.indexOf(name) != -1) { return false; } + if (this.ignoreTypeList.indexOf(model.getFieldParam(name, 'type')) != -1) { + return false; + } return !model.getFieldParam(name, 'disabled'); } diff --git a/frontend/client/src/views/fields/duration.js b/frontend/client/src/views/fields/duration.js index ca39fd09b5..0b05ff905f 100644 --- a/frontend/client/src/views/fields/duration.js +++ b/frontend/client/src/views/fields/duration.js @@ -33,25 +33,25 @@ Espo.define('Views.Fields.Duration', 'Views.Fields.Enum', function (Dep) { data: function () { return _.extend({ durationOptions: this.durationOptions, - }, Dep.prototype.data.call(this)); + }, Dep.prototype.data.call(this)); }, calculateSeconds: function () { - this.seconds = 0; + this.seconds = 0; var start = this.model.get(this.startField); var end = this.model.get(this.endField); if (this.mode == 'edit' || this.mode == 'detail') { this.seconds = this.model.getFieldParam(this.name, 'default') || 0; - } + } if (start && end) { - this.seconds = moment(this.model.get(this.endField)).unix() - moment(this.model.get(this.startField)).unix(); + this.seconds = moment(this.model.get(this.endField)).unix() - moment(this.model.get(this.startField)).unix(); } else { if (start) { var end = this._getDateEnd(); this.model.set(this.endField, end, {silent: true}); } - } + } }, init: function () { @@ -119,28 +119,31 @@ Espo.define('Views.Fields.Duration', 'Views.Fields.Enum', function (Dep) { }, afterRender: function () { - this.startFieldView = this.getParentView().getView(this.startField); - this.endFieldView = this.getParentView().getView(this.endField); + var parentView = this.getParentView(); + if (parentView && 'getView' in parentView) { + this.startFieldView = parentView.getView(this.startField); + this.endFieldView = parentView.getView(this.endField); + } if (this.mode == 'edit') { this.$duration = this.$el.find('[name="' + this.name + '"]'); - this.$duration.on('change', function () { + this.$duration.on('change', function () { this.seconds = parseInt(this.$duration.val()); this.updateDateEnd(); this.$duration.find('option.custom').remove(); - }.bind(this)); - } + }.bind(this)); + } this.stopListening(this.model, 'change:' + this.endField); this.stopListening(this.model, 'change:' + this.endField); - this.listenTo(this.model, 'change:' + this.endField, function () { + this.listenTo(this.model, 'change:' + this.endField, function () { var start = this.model.get(this.startField); var end = this.model.get(this.endField); if (!end || !start) { return; - } + } this.seconds = moment(end).unix() - moment(start).unix(); this.updateDuration(); @@ -178,7 +181,7 @@ Espo.define('Views.Fields.Duration', 'Views.Fields.Enum', function (Dep) { var endUnix; var end; if (seconds) { - endUnix = moment.utc(start).unix() + seconds; + endUnix = moment.utc(start).unix() + seconds; end = moment.unix(endUnix).utc().format(this.getDateTime().internalDateTimeFormat); } else { end = start; @@ -204,7 +207,7 @@ Espo.define('Views.Fields.Duration', 'Views.Fields.Enum', function (Dep) { this.setup(); this.render(); } - } else { + } else { if (this.mode == 'edit') { this.$duration.find('option.custom').remove(); var $o = $('