aboutsummaryrefslogtreecommitdiff
path: root/src/main/java/org/traccar/reports
diff options
context:
space:
mode:
authorAnton Tananaev <anton@traccar.org>2022-06-11 08:28:41 -0700
committerAnton Tananaev <anton@traccar.org>2022-06-11 08:28:41 -0700
commita401b40ee3b69d5679031a1e1d7287a0a56f4160 (patch)
tree30b0a1dfdc6b396dcb12947f19307b749e531446 /src/main/java/org/traccar/reports
parent5b269c0e309b70866ad167fb148eafcbad5a8b26 (diff)
downloadtrackermap-server-a401b40ee3b69d5679031a1e1d7287a0a56f4160.tar.gz
trackermap-server-a401b40ee3b69d5679031a1e1d7287a0a56f4160.tar.bz2
trackermap-server-a401b40ee3b69d5679031a1e1d7287a0a56f4160.zip
Inject velocity engine
Diffstat (limited to 'src/main/java/org/traccar/reports')
-rw-r--r--src/main/java/org/traccar/reports/common/ReportUtils.java8
1 files changed, 6 insertions, 2 deletions
diff --git a/src/main/java/org/traccar/reports/common/ReportUtils.java b/src/main/java/org/traccar/reports/common/ReportUtils.java
index 706475241..95c43f8a0 100644
--- a/src/main/java/org/traccar/reports/common/ReportUtils.java
+++ b/src/main/java/org/traccar/reports/common/ReportUtils.java
@@ -16,6 +16,7 @@
*/
package org.traccar.reports.common;
+import org.apache.velocity.app.VelocityEngine;
import org.apache.velocity.tools.generic.DateTool;
import org.apache.velocity.tools.generic.NumberTool;
import org.jxls.area.Area;
@@ -74,18 +75,21 @@ public class ReportUtils {
private final IdentityManager identityManager;
private final DeviceManager deviceManager;
private final TripsConfig tripsConfig;
+ private final VelocityEngine velocityEngine;
private final Geocoder geocoder;
@Inject
public ReportUtils(
Config config, Storage storage, PermissionsService permissionsService, IdentityManager identityManager,
- DeviceManager deviceManager, TripsConfig tripsConfig, @Nullable Geocoder geocoder) {
+ DeviceManager deviceManager, TripsConfig tripsConfig, VelocityEngine velocityEngine,
+ @Nullable Geocoder geocoder) {
this.config = config;
this.storage = storage;
this.permissionsService = permissionsService;
this.identityManager = identityManager;
this.deviceManager = deviceManager;
this.tripsConfig = tripsConfig;
+ this.velocityEngine = velocityEngine;
this.geocoder = geocoder;
}
@@ -153,7 +157,7 @@ public class ReportUtils {
context.putVar("distanceUnit", UserUtil.getDistanceUnit(server, user));
context.putVar("speedUnit", UserUtil.getSpeedUnit(server, user));
context.putVar("volumeUnit", UserUtil.getVolumeUnit(server, user));
- context.putVar("webUrl", Context.getVelocityEngine().getProperty("web.url"));
+ context.putVar("webUrl", velocityEngine.getProperty("web.url"));
context.putVar("dateTool", new DateTool());
context.putVar("numberTool", new NumberTool());
context.putVar("timezone", UserUtil.getTimezone(server, user));