Skip to content

Commit 945d5c6

Browse files
wluyimadkayiwa
wluyima
authored andcommittedMar 1, 2013
When you open the edit page for a scheduled task, if you leave the page
without saving, the repeat interval unit gets changed to seconds no matter what it was previously - TRUNK-3759(cherry picked from commit ac9bb64)
1 parent aaee716 commit 945d5c6

File tree

2 files changed

+9
-7
lines changed

2 files changed

+9
-7
lines changed
 

‎web/src/main/java/org/openmrs/scheduler/web/controller/SchedulerFormController.java

+8-6
Original file line numberDiff line numberDiff line change
@@ -183,20 +183,22 @@ protected Map<String, String> referenceData(HttpServletRequest request, Object c
183183
TaskDefinition task = (TaskDefinition) command;
184184

185185
Long interval = task.getRepeatInterval();
186-
187-
if (interval == null || interval < 60)
186+
Long repeatInterval;
187+
if (interval == null || interval < 60) {
188188
map.put("units", "seconds");
189-
else if (interval < 3600) {
189+
repeatInterval = interval;
190+
} else if (interval < 3600) {
190191
map.put("units", "minutes");
191-
task.setRepeatInterval(interval / 60);
192+
repeatInterval = interval / 60;
192193
} else if (interval < 86400) {
193194
map.put("units", "hours");
194-
task.setRepeatInterval(interval / 3600);
195+
repeatInterval = interval / 3600;
195196
} else {
196197
map.put("units", "days");
197-
task.setRepeatInterval(interval / 86400);
198+
repeatInterval = interval / 86400;
198199
}
199200

201+
map.put("repeatInterval", repeatInterval.toString());
200202
return map;
201203
}
202204

‎webapp/src/main/webapp/WEB-INF/view/admin/scheduler/schedulerForm.jsp

+1-1
Original file line numberDiff line numberDiff line change
@@ -276,7 +276,7 @@ window.onload = init;
276276
<td valign="top"><openmrs:message code="Scheduler.scheduleForm.repeatInterval"/>:</td>
277277
<td>
278278
<spring:bind path="task.repeatInterval">
279-
<input type="text" id="repeatInterval" name="repeatInterval" size="10" value="${status.value}" />
279+
<input type="text" id="repeatInterval" name="repeatInterval" size="10" value="${repeatInterval}" />
280280
<select name="repeatIntervalUnits">
281281
<option value="seconds" <c:if test="${units=='seconds'}">selected</c:if>><openmrs:message code="Scheduler.scheduleForm.repeatInterval.units.seconds" /></option>
282282
<option value="minutes" <c:if test="${units=='minutes'}">selected</c:if>><openmrs:message code="Scheduler.scheduleForm.repeatInterval.units.minutes" /></option>

0 commit comments

Comments
 (0)
Please sign in to comment.