# HG changeset patch # User Tom Gottfried # Date 1476189252 -7200 # Node ID a24de34d64239492478aa1b4d07f3fd55b60d19e # Parent 78805e951c370923ba42309f6387ed04ebf046f7 Align subintervall with validity for yearly samples. Subintervall is redundant to validity for yearly samples. diff -r 78805e951c37 -r a24de34d6423 app/controller/form/Messprogramm.js --- a/app/controller/form/Messprogramm.js Mon Oct 10 16:42:30 2016 +0200 +++ b/app/controller/form/Messprogramm.js Tue Oct 11 14:34:12 2016 +0200 @@ -51,6 +51,9 @@ 'messprogrammform probenintervall combobox': { select: this.updateIntervalls }, + 'messprogrammform dayofyear [hidden]': { + change: this.alignSubIntervall + }, 'messprogrammform panel[xtype="deskriptor] combobox': { select: this.deskriptorSelect } @@ -90,15 +93,34 @@ /** * When the Probenintervall was changed, update the Sliders - * and the the numberfield. + * and the numberfield. */ - updateIntervalls: function(field, records) { + updateIntervalls: function(field) { var form = field.up('messprogrammform'); var record = form.getRecord(); form.populateIntervall(record, field.getValue()); }, /** + * When the validity period was changed, align the subintervall + * in case of yearly intervall. + */ + alignSubIntervall: function(field) { + var form = field.up('messprogrammform'); + var intervall = form.down('probenintervall').down('combobox') + .getValue(); + if (intervall == 'J') { + if (field.getName() == 'gueltigVon') { + form.down('[name=teilintervallVon]') + .setValue(field.getValue()); + } else { + form.down('[name=teilintervallBis]') + .setValue(field.getValue()); + } + } + }, + + /** * The function will open a new Window to edit the Ort of a Messprogramm */ editOrtWindow: function(button) { @@ -239,7 +261,7 @@ }, /** - * The discard function resets the Location form + * The discard function resets the form * to its original state. */ discard: function(button) { diff -r 78805e951c37 -r a24de34d6423 app/view/form/Messprogramm.js --- a/app/view/form/Messprogramm.js Mon Oct 10 16:42:30 2016 +0200 +++ b/app/view/form/Messprogramm.js Tue Oct 11 14:34:12 2016 +0200 @@ -433,6 +433,18 @@ svalLower = record.get('teilintervallVon'); } + // subintervall is redundant to validity for yearly samples + if (intervall == 'J') { + svalUpper = this.getForm().findField('gueltigBis').getValue(); + svalLower = this.getForm().findField('gueltigVon').getValue(); + b.setReadOnly(true); + v.setReadOnly(true); + s.setDisabled(true); + } else { + b.setReadOnly(false); + v.setReadOnly(false); + s.setDisabled(false); + } var intrec = intervallstore .findRecord('probenintervall',