Skip to content

Commit

Permalink
IOrderBL.getTimeZone: shall return system timezone in case org has no…
Browse files Browse the repository at this point in the history
  • Loading branch information
teosarca committed Sep 18, 2019
1 parent 6a18d11 commit afc640d
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -228,5 +228,6 @@ public interface IOrderBL extends ISingletonService

ProjectId getProjectIdOrNull(OrderLineId orderLineId);

/** @return organization's timezone or system timezone; never returns null */
ZoneId getTimeZone(I_C_Order order);
}
Original file line number Diff line number Diff line change
Expand Up @@ -91,6 +91,7 @@
import de.metas.util.Services;
import de.metas.util.collections.CollectionUtils;
import de.metas.util.lang.CoalesceUtil;
import de.metas.util.time.SystemTime;
import lombok.NonNull;

public class OrderBL implements IOrderBL
Expand Down Expand Up @@ -1067,6 +1068,7 @@ public ZoneId getTimeZone(@NonNull final I_C_Order order)
final IOrgDAO ordersRepo = Services.get(IOrgDAO.class);

final OrgId orgId = OrgId.ofRepoIdOrAny(order.getAD_Org_ID());
return ordersRepo.getOrgInfoById(orgId).getTimeZone();
final ZoneId timeZone = ordersRepo.getOrgInfoById(orgId).getTimeZone();
return timeZone != null ? timeZone : SystemTime.zoneId();
}
}

0 comments on commit afc640d

Please sign in to comment.