Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

RA-1988 - When seething dates to midnight, change the required Global property from allowChangingVisitTime to allowConvertingTimezones #457

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,8 @@
import org.openmrs.api.VisitService;
import org.openmrs.api.context.Context;
import org.openmrs.module.appui.AppUiConstants;
import org.openmrs.module.coreapps.CoreAppsConstants;
import org.openmrs.ui.framework.SimpleObject;
import org.openmrs.ui.framework.UiFrameworkConstants;
import org.openmrs.ui.framework.UiUtils;
import org.openmrs.ui.framework.annotation.SpringBean;
import org.springframework.transaction.annotation.Transactional;
Expand All @@ -40,10 +40,10 @@ public SimpleObject setDuration(@SpringBean("visitService") VisitService visitSe
@RequestParam(value="stopDate", required = false) Date stopDate,
HttpServletRequest request, UiUtils ui) {

boolean allowChangingVisitTime = BooleanUtils.toBoolean(Context.getAdministrationService().getGlobalProperty(CoreAppsConstants.GP_ALLOW_CHANGING_VISIT_TIME));
boolean allowConvertingTimezones = BooleanUtils.toBoolean(Context.getAdministrationService().getGlobalProperty(UiFrameworkConstants.GP_TIMEZONE_CONVERSIONS));
Copy link
Member

@dkayiwa dkayiwa Nov 8, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@icrc-toliveira i find the name of GP_ALLOW_CHANGING_VISIT_TIME easier to understand than what you changed it to.

Secondly, do you mind explaining how just changing the used global property fixes the reported bug?


if (!isSameDay(startDate, visit.getStartDatetime())) {
if(!allowChangingVisitTime){
if(!allowConvertingTimezones){
visit.setStartDatetime(new DateTime(startDate).toDateMidnight().toDate());
}else{
visit.setStartDatetime(new DateTime(startDate).toDate());
Expand Down