aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorAbyss777 <abyss@fox5.ru>2017-03-14 09:29:24 +0500
committerAbyss777 <abyss@fox5.ru>2017-03-14 09:29:24 +0500
commit31ab23aeacce2ed9777ea38cdaf4cda199fc3a86 (patch)
tree22355163b18d9f4c85fc51317ccbaddc44be84a2 /src
parent632e6ad06c435ca8d044e5ae3209cde36cf42743 (diff)
downloadtraccar-server-31ab23aeacce2ed9777ea38cdaf4cda199fc3a86.tar.gz
traccar-server-31ab23aeacce2ed9777ea38cdaf4cda199fc3a86.tar.bz2
traccar-server-31ab23aeacce2ed9777ea38cdaf4cda199fc3a86.zip
Fix forceSettings applying
Diffstat (limited to 'src')
-rw-r--r--src/org/traccar/reports/ReportUtils.java30
1 files changed, 21 insertions, 9 deletions
diff --git a/src/org/traccar/reports/ReportUtils.java b/src/org/traccar/reports/ReportUtils.java
index 3699b1bea..9614ecf71 100644
--- a/src/org/traccar/reports/ReportUtils.java
+++ b/src/org/traccar/reports/ReportUtils.java
@@ -32,25 +32,37 @@ public final class ReportUtils {
}
public static String getDistanceUnit(long userId) {
- String unit = Context.getPermissionsManager().getUser(userId).getDistanceUnit();
- if (unit == null || Context.getPermissionsManager().getServer().getForceSettings()) {
- unit = Context.getPermissionsManager().getServer().getDistanceUnit();
+ String unit;
+ String userUnit = Context.getPermissionsManager().getUser(userId).getDistanceUnit();
+ String serverUnit = Context.getPermissionsManager().getServer().getDistanceUnit();
+ if (Context.getPermissionsManager().getServer().getForceSettings()) {
+ unit = serverUnit != null ? serverUnit : userUnit;
+ } else {
+ unit = userUnit != null ? userUnit : serverUnit;
}
return unit != null ? unit : "km";
}
public static String getSpeedUnit(long userId) {
- String unit = Context.getPermissionsManager().getUser(userId).getSpeedUnit();
- if (unit == null || Context.getPermissionsManager().getServer().getForceSettings()) {
- unit = Context.getPermissionsManager().getServer().getSpeedUnit();
+ String unit;
+ String userUnit = Context.getPermissionsManager().getUser(userId).getSpeedUnit();
+ String serverUnit = Context.getPermissionsManager().getServer().getSpeedUnit();
+ if (Context.getPermissionsManager().getServer().getForceSettings()) {
+ unit = serverUnit != null ? serverUnit : userUnit;
+ } else {
+ unit = userUnit != null ? userUnit : serverUnit;
}
return unit != null ? unit : "kn";
}
public static TimeZone getTimezone(long userId) {
- String timezone = Context.getPermissionsManager().getUser(userId).getTimezone();
- if (timezone == null || Context.getPermissionsManager().getServer().getForceSettings()) {
- timezone = Context.getPermissionsManager().getServer().getTimezone();
+ String timezone;
+ String userTimezone = Context.getPermissionsManager().getUser(userId).getTimezone();
+ String serverTimezone = Context.getPermissionsManager().getServer().getTimezone();
+ if (Context.getPermissionsManager().getServer().getForceSettings()) {
+ timezone = serverTimezone != null ? serverTimezone : userTimezone;
+ } else {
+ timezone = userTimezone != null ? userTimezone : serverTimezone;
}
return timezone != null ? TimeZone.getTimeZone(timezone) : TimeZone.getDefault();
}