aboutsummaryrefslogtreecommitdiff
path: root/src/org/traccar/reports
diff options
context:
space:
mode:
authorAnton Tananaev <anton.tananaev@gmail.com>2017-09-06 21:08:31 +1200
committerGitHub <noreply@github.com>2017-09-06 21:08:31 +1200
commitf0578c7b5f8737e019a9cf05935d2caaa940f0ca (patch)
tree778b00dd1a6162007cb08239d475884843a678ba /src/org/traccar/reports
parent3e5167131c758dd6e75e0f5d9b265a1514baac0c (diff)
parentfe5e6f7e1aaa01dfe8d61af46c3b818f8c566a25 (diff)
downloadtrackermap-server-f0578c7b5f8737e019a9cf05935d2caaa940f0ca.tar.gz
trackermap-server-f0578c7b5f8737e019a9cf05935d2caaa940f0ca.tar.bz2
trackermap-server-f0578c7b5f8737e019a9cf05935d2caaa940f0ca.zip
Merge pull request #3507 from Abyss777/units_attributes
Move units to attributes and add volume units
Diffstat (limited to 'src/org/traccar/reports')
-rw-r--r--src/org/traccar/reports/ReportUtils.java11
1 files changed, 8 insertions, 3 deletions
diff --git a/src/org/traccar/reports/ReportUtils.java b/src/org/traccar/reports/ReportUtils.java
index 74cdaf9b5..5f718feac 100644
--- a/src/org/traccar/reports/ReportUtils.java
+++ b/src/org/traccar/reports/ReportUtils.java
@@ -62,15 +62,19 @@ public final class ReportUtils {
}
public static String getDistanceUnit(long userId) {
- return (String) Context.getPermissionsManager().lookupPreference(userId, "distanceUnit", "km");
+ return (String) Context.getPermissionsManager().lookupAttribute(userId, "distanceUnit", "km");
}
public static String getSpeedUnit(long userId) {
- return (String) Context.getPermissionsManager().lookupPreference(userId, "speedUnit", "kn");
+ return (String) Context.getPermissionsManager().lookupAttribute(userId, "speedUnit", "kn");
+ }
+
+ public static String getVolumeUnit(long userId) {
+ return (String) Context.getPermissionsManager().lookupAttribute(userId, "volumeUnit", "ltr");
}
public static TimeZone getTimezone(long userId) {
- String timezone = (String) Context.getPermissionsManager().lookupPreference(userId, "timezone", null);
+ String timezone = (String) Context.getPermissionsManager().lookupAttribute(userId, "timezone", null);
return timezone != null ? TimeZone.getTimeZone(timezone) : TimeZone.getDefault();
}
@@ -137,6 +141,7 @@ public final class ReportUtils {
org.jxls.common.Context jxlsContext = PoiTransformer.createInitialContext();
jxlsContext.putVar("distanceUnit", getDistanceUnit(userId));
jxlsContext.putVar("speedUnit", getSpeedUnit(userId));
+ jxlsContext.putVar("volumeUnit", getVolumeUnit(userId));
jxlsContext.putVar("webUrl", Context.getVelocityEngine().getProperty("web.url"));
jxlsContext.putVar("dateTool", new DateTool());
jxlsContext.putVar("numberTool", new NumberTool());