Commit 6d5299c85d63a25fbab82853c54797221d5e1ef8
Exists in
master
and in
79 other branches
Merge branch 'develop' of https://gitlab.irap.omp.eu/CDPP/AMDA_IHM into develop
Showing
2 changed files
with
59 additions
and
15 deletions
Show diff stats
js/app/views/CatalogUI.js
... | ... | @@ -153,25 +153,51 @@ Ext.define('amdaUI.CatalogUI', { |
153 | 153 | var stops= []; |
154 | 154 | if (this.TTGrid.getStore().getTotalCount() <= 0) |
155 | 155 | return; |
156 | - Ext.Array.each(this.TTGrid.getStore().data.first.value, function (item, index) { | |
157 | - starts[index] = (item.raw.start); | |
158 | - stops[index] = (item.raw.stop); | |
156 | + reqObj = { | |
157 | + 'typeTT': 'catalog', | |
158 | + } | |
159 | + AmdaAction.readCacheIntervals(reqObj, function(result, e) | |
160 | + { | |
161 | + if (!result) { | |
162 | + myDesktopApp.errorMsg(e.message); | |
163 | + Ext.defer(function () { | |
164 | + Ext.Msg.toFront() | |
165 | + }, 10); | |
166 | + | |
167 | + return; | |
168 | + } else if (!result.success) | |
169 | + { | |
170 | + if (result.message) | |
171 | + myDesktopApp.errorMsg(result.message); | |
172 | + else | |
173 | + myDesktopApp.errorMsg('Unknown error during catalog survey dates update'); | |
174 | + | |
175 | + Ext.defer(function () { | |
176 | + Ext.Msg.toFront() | |
177 | + }, 10); | |
178 | + | |
179 | + return; | |
180 | + } | |
181 | + Ext.Array.each(result.intervals, function (item, index) { | |
182 | + starts[index] = (item.start); | |
183 | + stops[index] = (item.stop); | |
159 | 184 | }); |
160 | 185 | if(starts.length !== 0 || stops.length !== 0) { |
161 | 186 | |
162 | - starts.sort(); | |
163 | - stops.sort(); | |
164 | - s = new Date(starts[0]); | |
165 | - e = new Date(stops[stops.length - 1]); | |
166 | - if(! ttObj.get('surveyStart') ){ | |
187 | + starts.sort(); | |
188 | + stops.sort(); | |
189 | + s = new Date(starts[0]); | |
190 | + e = new Date(stops[stops.length - 1]); | |
191 | + if(! ttObj.get('surveyStart') ){ | |
167 | 192 | ttObj.set('surveyStart', s); |
168 | 193 | this.status.isModified = true; |
169 | - } | |
170 | - if(! ttObj.get('surveyStop') ){ | |
194 | + } | |
195 | + if(! ttObj.get('surveyStop') ){ | |
171 | 196 | ttObj.set('surveyStop', e); |
172 | 197 | this.status.isModified = true; |
198 | + } | |
173 | 199 | } |
174 | - } | |
200 | + }); | |
175 | 201 | }, |
176 | 202 | |
177 | 203 | createTT: function (catId) { |
... | ... | @@ -183,7 +209,7 @@ Ext.define('amdaUI.CatalogUI', { |
183 | 209 | descr = 'Generated by CDPP/Amda Catalog Module \n' + 'From Catalog: ' + this.object.get('name') + '\nOn: ' + date + '\n'; |
184 | 210 | ttObj.set('description', descr + this.object.get('description')); |
185 | 211 | ttObj.set('contact', this.object.get('contact')); |
186 | - this.updateSurveyDates(ttObj); | |
212 | + //this.updateSurveyDates(ttObj); | |
187 | 213 | timeTabNode.set('object', ttObj); |
188 | 214 | var explorerTree = Ext.getCmp(amdaUI.ExplorerUI.RESRC_TAB.TREE_ID); |
189 | 215 | var ttRootNode = explorerTree.getRootNode().findChild('id', 'timeTable-treeRootNode', true); |
... | ... | @@ -619,7 +645,6 @@ Ext.define('amdaUI.CatalogUI', { |
619 | 645 | loadObject: function () { |
620 | 646 | // load object into form |
621 | 647 | this.object.set('created', this.convertUTCDateToLocalDate(this.object.get('created'))); |
622 | - this.updateSurveyDates(this.object); | |
623 | 648 | this.formPanel.getForm().loadRecord(this.object); |
624 | 649 | |
625 | 650 | this.status = null; |
... | ... | @@ -721,7 +746,7 @@ Ext.define('amdaUI.CatalogUI', { |
721 | 746 | if (this.TTGrid.getStore().getTotalCount() > 0) |
722 | 747 | { |
723 | 748 | // update TimeTable object which the content of form |
724 | - this.updateSurveyDates(this.object); | |
749 | + | |
725 | 750 | basicForm.updateRecord(this.object); |
726 | 751 | var me = this; |
727 | 752 | this.checkIntervalsStatusForSave(function () { | ... | ... |
php/classes/TimeTableMgr.php
... | ... | @@ -87,10 +87,29 @@ class TimeTableMgr extends AmdaObjectMgr |
87 | 87 | if ($attribute->tagName != 'intervals') { |
88 | 88 | $attributesToReturn[$attribute->tagName] = $attribute->nodeValue; |
89 | 89 | } else { |
90 | - $nbInt++; | |
90 | + | |
91 | + // get 'surveyStart' and | |
92 | + if($attributesToReturn['surveyStart'] == "" || $attributesToReturn['surveyStop'] == "" ){ | |
93 | + if($nbInt == 0){ | |
94 | + foreach ($attribute->childNodes as $ch ){ | |
95 | + if($ch->tagName == 'start') $start = $ch->nodeValue; | |
96 | + if($ch->tagName == 'stop') $stop = $ch->nodeValue; | |
97 | + } | |
98 | + }else{ | |
99 | + foreach ($attribute->childNodes as $ch ){ | |
100 | + if($ch->tagName == 'start' && $start > $ch->nodeValue) $start = $ch->nodeValue; | |
101 | + if($ch->tagName == 'stop' && $stop < $ch->nodeValue) $stop = $ch->nodeValue; | |
102 | + } | |
103 | + } | |
104 | + } | |
105 | + $nbInt++; | |
91 | 106 | } |
92 | 107 | } |
93 | 108 | } |
109 | + if($attributesToReturn['surveyStart'] == "") | |
110 | + $attributesToReturn['surveyStart'] = $start; | |
111 | + if($attributesToReturn['surveyStop'] == "" ) | |
112 | + $attributesToReturn['surveyStop'] = $stop; | |
94 | 113 | $attributesToReturn['nbIntervals'] = $nbInt; |
95 | 114 | |
96 | 115 | return $attributesToReturn; | ... | ... |