From 10f8c8e1ae2acd1b9fe0ece0ab4a386873beba9a Mon Sep 17 00:00:00 2001 From: Ralf Becker Date: Thu, 22 Aug 2013 07:30:01 +0000 Subject: [PATCH] not failing if filter or dates widgets are not there --- timesheet/js/app.js | 15 ++++++--------- 1 file changed, 6 insertions(+), 9 deletions(-) diff --git a/timesheet/js/app.js b/timesheet/js/app.js index cc1640c99b..8ec0defbb8 100644 --- a/timesheet/js/app.js +++ b/timesheet/js/app.js @@ -56,13 +56,12 @@ app.timesheet = AppJS.extend( et2_ready: function(et2) { // call parent - this._super.apply(this, arguments); + if (typeof et2.templates['timesheet.index'] != "undefined") { this.timesheet_filter_change(); } - }, /** @@ -70,14 +69,12 @@ app.timesheet = AppJS.extend( */ timesheet_filter_change: function() { - if (etemplate2.getByApplication('timesheet')[0].widgetContainer.getWidgetById('filter').value === "custom") + var filter = this.et2.getWidgetById('filter'); + var dates = this.et2.getWidgetById('timesheet.index.dates'); + + if (filter && dates) { - etemplate2.getByApplication('timesheet')[0].widgetContainer.getWidgetById('timesheet.index.dates').set_disabled(false); - } - else - { - etemplate2.getByApplication('timesheet')[0].widgetContainer.getWidgetById('timesheet.index.dates').set_disabled(true); + dates.set_disabled(filter.value !== "custom"); } }, - });