diff options
author | Abyss777 <abyss@fox5.ru> | 2016-11-23 11:41:11 +0500 |
---|---|---|
committer | Abyss777 <abyss@fox5.ru> | 2016-11-23 11:41:11 +0500 |
commit | b14169a2b7bfcaecaa0f5ea9baafad4e7e4f1ae2 (patch) | |
tree | a82bf3699fc76a6a46da9835de846970db7722e3 /src/org/traccar/reports/Summary.java | |
parent | 5f867c6077f79a2a1d3b8ec18f78c3a2657ba698 (diff) | |
download | trackermap-server-b14169a2b7bfcaecaa0f5ea9baafad4e7e4f1ae2.tar.gz trackermap-server-b14169a2b7bfcaecaa0f5ea9baafad4e7e4f1ae2.tar.bz2 trackermap-server-b14169a2b7bfcaecaa0f5ea9baafad4e7e4f1ae2.zip |
- Pass client timezone to excel template
- Templates: adjust timezone, use "https" in links
Diffstat (limited to 'src/org/traccar/reports/Summary.java')
-rw-r--r-- | src/org/traccar/reports/Summary.java | 9 |
1 files changed, 7 insertions, 2 deletions
diff --git a/src/org/traccar/reports/Summary.java b/src/org/traccar/reports/Summary.java index 95a3737a1..d7d8ab417 100644 --- a/src/org/traccar/reports/Summary.java +++ b/src/org/traccar/reports/Summary.java @@ -25,9 +25,11 @@ import java.util.ArrayList; import java.util.Collection; import java.util.Date; +import org.joda.time.DateTime; import org.jxls.transform.poi.PoiTransformer; import org.jxls.util.JxlsHelper; import org.traccar.Context; +import org.traccar.helper.DateUtil; import org.traccar.model.Position; import org.traccar.reports.model.SummaryReport; @@ -82,8 +84,10 @@ public final class Summary { public static void getExcel(OutputStream outputStream, long userId, Collection<Long> deviceIds, Collection<Long> groupIds, - Date from, Date to) throws SQLException, IOException { - Collection<SummaryReport> summaries = getObjects(userId, deviceIds, groupIds, from, to); + String fromString, String toString) throws SQLException, IOException { + DateTime from = DateUtil.parseDateTime(fromString); + DateTime to = DateUtil.parseDateTime(toString); + Collection<SummaryReport> summaries = getObjects(userId, deviceIds, groupIds, from.toDate(), to.toDate()); String templatePath = Context.getConfig().getString("report.templatesPath", "templates/export/"); try (InputStream inputStream = new FileInputStream(templatePath + "/summary.xlsx")) { @@ -93,6 +97,7 @@ public final class Summary { jxlsContext.putVar("to", to); jxlsContext.putVar("distanceUnit", ReportUtils.getDistanceUnit(userId)); jxlsContext.putVar("speedUnit", ReportUtils.getSpeedUnit(userId)); + jxlsContext.putVar("timezone", from.getZone()); JxlsHelper.getInstance().setUseFastFormulaProcessor(false) .processTemplate(inputStream, outputStream, jxlsContext); } |