Commit 2ff71abaaf707c0209967c7998651174cefb0be5
1 parent
2b2bb263
Exists in
master
and in
79 other branches
correcting survey dates update
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,25 +153,51 @@ Ext.define('amdaUI.CatalogUI', { | ||
153 | var stops= []; | 153 | var stops= []; |
154 | if (this.TTGrid.getStore().getTotalCount() <= 0) | 154 | if (this.TTGrid.getStore().getTotalCount() <= 0) |
155 | return; | 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 | if(starts.length !== 0 || stops.length !== 0) { | 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 | ttObj.set('surveyStart', s); | 192 | ttObj.set('surveyStart', s); |
168 | this.status.isModified = true; | 193 | this.status.isModified = true; |
169 | - } | ||
170 | - if(! ttObj.get('surveyStop') ){ | 194 | + } |
195 | + if(! ttObj.get('surveyStop') ){ | ||
171 | ttObj.set('surveyStop', e); | 196 | ttObj.set('surveyStop', e); |
172 | this.status.isModified = true; | 197 | this.status.isModified = true; |
198 | + } | ||
173 | } | 199 | } |
174 | - } | 200 | + }); |
175 | }, | 201 | }, |
176 | 202 | ||
177 | createTT: function (catId) { | 203 | createTT: function (catId) { |
@@ -183,7 +209,7 @@ Ext.define('amdaUI.CatalogUI', { | @@ -183,7 +209,7 @@ Ext.define('amdaUI.CatalogUI', { | ||
183 | descr = 'Generated by CDPP/Amda Catalog Module \n' + 'From Catalog: ' + this.object.get('name') + '\nOn: ' + date + '\n'; | 209 | descr = 'Generated by CDPP/Amda Catalog Module \n' + 'From Catalog: ' + this.object.get('name') + '\nOn: ' + date + '\n'; |
184 | ttObj.set('description', descr + this.object.get('description')); | 210 | ttObj.set('description', descr + this.object.get('description')); |
185 | ttObj.set('contact', this.object.get('contact')); | 211 | ttObj.set('contact', this.object.get('contact')); |
186 | - this.updateSurveyDates(ttObj); | 212 | + //this.updateSurveyDates(ttObj); |
187 | timeTabNode.set('object', ttObj); | 213 | timeTabNode.set('object', ttObj); |
188 | var explorerTree = Ext.getCmp(amdaUI.ExplorerUI.RESRC_TAB.TREE_ID); | 214 | var explorerTree = Ext.getCmp(amdaUI.ExplorerUI.RESRC_TAB.TREE_ID); |
189 | var ttRootNode = explorerTree.getRootNode().findChild('id', 'timeTable-treeRootNode', true); | 215 | var ttRootNode = explorerTree.getRootNode().findChild('id', 'timeTable-treeRootNode', true); |
@@ -619,7 +645,6 @@ Ext.define('amdaUI.CatalogUI', { | @@ -619,7 +645,6 @@ Ext.define('amdaUI.CatalogUI', { | ||
619 | loadObject: function () { | 645 | loadObject: function () { |
620 | // load object into form | 646 | // load object into form |
621 | this.object.set('created', this.convertUTCDateToLocalDate(this.object.get('created'))); | 647 | this.object.set('created', this.convertUTCDateToLocalDate(this.object.get('created'))); |
622 | - this.updateSurveyDates(this.object); | ||
623 | this.formPanel.getForm().loadRecord(this.object); | 648 | this.formPanel.getForm().loadRecord(this.object); |
624 | 649 | ||
625 | this.status = null; | 650 | this.status = null; |
@@ -721,7 +746,7 @@ Ext.define('amdaUI.CatalogUI', { | @@ -721,7 +746,7 @@ Ext.define('amdaUI.CatalogUI', { | ||
721 | if (this.TTGrid.getStore().getTotalCount() > 0) | 746 | if (this.TTGrid.getStore().getTotalCount() > 0) |
722 | { | 747 | { |
723 | // update TimeTable object which the content of form | 748 | // update TimeTable object which the content of form |
724 | - this.updateSurveyDates(this.object); | 749 | + |
725 | basicForm.updateRecord(this.object); | 750 | basicForm.updateRecord(this.object); |
726 | var me = this; | 751 | var me = this; |
727 | this.checkIntervalsStatusForSave(function () { | 752 | this.checkIntervalsStatusForSave(function () { |
php/classes/TimeTableMgr.php
@@ -87,10 +87,29 @@ class TimeTableMgr extends AmdaObjectMgr | @@ -87,10 +87,29 @@ class TimeTableMgr extends AmdaObjectMgr | ||
87 | if ($attribute->tagName != 'intervals') { | 87 | if ($attribute->tagName != 'intervals') { |
88 | $attributesToReturn[$attribute->tagName] = $attribute->nodeValue; | 88 | $attributesToReturn[$attribute->tagName] = $attribute->nodeValue; |
89 | } else { | 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 | $attributesToReturn['nbIntervals'] = $nbInt; | 113 | $attributesToReturn['nbIntervals'] = $nbInt; |
95 | 114 | ||
96 | return $attributesToReturn; | 115 | return $attributesToReturn; |