/** * @see org.openmrs.module.htmlformentry.widget.Widget#getValue(org.openmrs.module.htmlformentry.FormEntryContext, javax.servlet.http.HttpServletRequest) */ @Override public Object getValue(FormEntryContext context, HttpServletRequest request) { // get the values from the associated date and time widgets Date date = dateWidget.getValue(context, request); Date time = (Date) timeWidget.getValue(context, request); return HtmlFormEntryUtil.combineDateAndTime(date, time); }
/** * @see org.openmrs.module.htmlformentry.action.FormSubmissionControllerAction#validateSubmission(org.openmrs.module.htmlformentry.FormEntryContext, * javax.servlet.http.HttpServletRequest) */ @Override public Collection<FormSubmissionError> validateSubmission(FormEntryContext context, HttpServletRequest submission) { List<FormSubmissionError> ret = new ArrayList<FormSubmissionError>(); try { if (dateWidget != null) { Date date = dateWidget.getValue(context, submission); if (date != null) { if (OpenmrsUtil.compare(date, new Date()) > 0) { ret.add(new FormSubmissionError(dateWidget, Context.getMessageSourceService().getMessage( "htmlformentry.error.cannotBeInFuture"))); } } } } catch (Exception ex) { ret.add(new FormSubmissionError(dateWidget, ex.getMessage())); } return ret; }
Date dateCreated = startDateWidget.getValue(context, submission); if (dateCreated == null) throw new Exception("htmlformentry.error.required"); Date startDate = startDateWidget.getValue(context, submission); Date endDate = discontinuedDateWidget.getValue(context, submission); if (startDate != null && endDate != null && startDate.getTime() > endDate.getTime()) if (discontinuedReasonWidget != null && discontinuedDateWidget != null) { String discReason = (String) discontinuedReasonWidget.getValue(context, submission); Date endDate = discontinuedDateWidget.getValue(context, submission); if (endDate == null && !StringUtils.isEmpty(discReason)) throw new Exception("htmlformentry.error.discontinuedReasonEnteredWithoutDate");
/** * @see org.openmrs.module.htmlformentry.action.FormSubmissionControllerAction#handleSubmission(org.openmrs.module.htmlformentry.FormEntrySession, * javax.servlet.http.HttpServletRequest) */ @Override public void handleSubmission(FormEntrySession session, HttpServletRequest submission) { if (session.getContext().getMode() != Mode.VIEW) { Date selectedDate = null; if (dateWidget != null) { selectedDate = (Date) dateWidget.getValue(session.getContext(), submission); } session.getSubmissionActions().enrollInProgram(program, selectedDate, states); } }
date = dateWidget.getValue(context, submission);
Date dateCreated = startDateWidget.getValue(context, submission); if (dateCreated == null) throw new Exception("htmlformentry.error.required"); Date startDate = startDateWidget.getValue(context, submission); Date endDate = discontinuedDateWidget.getValue(context, submission); if (startDate != null && endDate != null && startDate.getTime() > endDate.getTime()) if (discontinuedReasonWidget != null && discontinuedDateWidget != null) { String discReason = (String) discontinuedReasonWidget.getValue(context, submission); Date endDate = discontinuedDateWidget.getValue(context, submission); if (endDate == null && !StringUtils.isEmpty(discReason)) throw new Exception("htmlformentry.error.discontinuedReasonEnteredWithoutDate");
Date date = (Date) dateWidget.getValue(context, submission); if (timeWidget != null) { Date time = (Date) timeWidget.getValue(context, submission);
@Override public void handleSubmission(FormEntrySession session, HttpServletRequest submission) { Date date = null; Concept exitReasonConcept = null; Concept causeOfDeathConcept = null; String otherReason = null; if (dateWidget != null) { date = dateWidget.getValue(session.getContext(), submission); } if (reasonForExitWidget != null) { Object value = reasonForExitWidget.getValue(session.getContext(), submission); exitReasonConcept = (Concept) HtmlFormEntryUtil.convertToType(value.toString().trim(), Concept.class); } if (causeOfDeathWidget != null) { Object value = causeOfDeathWidget.getValue(session.getContext(), submission); causeOfDeathConcept = (Concept) HtmlFormEntryUtil.convertToType(value.toString().trim(), Concept.class); } if (otherReasonWidget != null) { otherReason = otherReasonWidget.getValue(session.getContext(), submission); } // only if user submits both date and reason we allow to exit from care, and this is done // to make sure a user is able to submit a form with <exitfromcare> tag, without filling that // section, however if it is filled initially, user can't resubmit after changing the date and // reason fields to null back if (date != null && exitReasonConcept != null) { session.getSubmissionActions().exitFromCare(date, exitReasonConcept, causeOfDeathConcept, otherReason); } }
@Override public void handleSubmission(FormEntrySession session, HttpServletRequest submission) { String regCode = null; if (regWidget.getValue(session.getContext(), submission) != null) regCode = ((String) regWidget.getValue(session.getContext(), submission)); Date startDate = startDateWidget.getValue(session.getContext(), submission); Date discontinuedDate = null; if (discontinuedDateWidget != null){ discontinuedDate = discontinuedDateWidget.getValue(session.getContext(), submission); } String discontinuedReasonStr = null; if (discontinuedReasonWidget != null){ discontinuedReasonStr = (String) discontinuedReasonWidget.getValue(session.getContext(), submission); } if (!StringUtils.isEmpty(regCode)){ if (session.getContext().getMode() == Mode.ENTER || (session.getContext().getMode() == Mode.EDIT && regDrugOrders == null)) { enterStandardRegimen(session, submission, regCode, startDate, discontinuedDate, discontinuedReasonStr); } else if (session.getContext().getMode() == Mode.EDIT) { editStandardRegimen(session, submission, regCode, startDate, discontinuedDate, discontinuedReasonStr); } } else if (regDrugOrders != null){ //void all existing orders in standard regimen -- this is if you un-select an existing standardRegimen //these are already part of the encounter, so will be updated when encounter is saved. voidDrugOrders(regDrugOrders, session); } }
exitDate = dateWidget.getValue(context, submission); if (exitDate != null) { if (OpenmrsUtil.compare(exitDate, new Date()) > 0) { if (obsList != null && obsList.size() == 0) { if (exitReasonAnswerConcept == null) { if (dateWidget != null && dateWidget.getValue(context, submission) != null) { ret.add(new FormSubmissionError(context.getFieldName(reasonForExitErrorWidget), Context.getMessageSourceService() .getMessage("htmlformentry.error.required")));
String accessionNumberValue = null; if (dateWidget != null) obsDatetime = (Date) dateWidget.getValue(session.getContext(), submission); if (accessionNumberWidget != null) accessionNumberValue = (String) accessionNumberWidget.getValue(session.getContext(), submission);
orderTag.startDate = startDateWidget.getValue(session.getContext(), submission); if (orderDurationWidget != null){ String orderDurationStr = (String) orderDurationWidget.getValue(session.getContext(), submission); orderTag.discontinuedDate = discontinuedDateWidget.getValue(session.getContext(), submission);
date = null; } else { date = dateWidget.getValue(session.getContext(), request); checked = date != null;
public void handleSubmission(FormEntrySession session, HttpServletRequest submission) { if (dateWidget != null) { Date date = (Date) dateWidget.getValue(session.getContext(), submission); Date previousDate = session.getSubmissionActions().getCurrentEncounter().getEncounterDatetime();