diff options
-rw-r--r-- | src/org/traccar/WebDataHandler.java | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/src/org/traccar/WebDataHandler.java b/src/org/traccar/WebDataHandler.java index 3e47ada70..a8e20c698 100644 --- a/src/org/traccar/WebDataHandler.java +++ b/src/org/traccar/WebDataHandler.java @@ -24,6 +24,7 @@ import org.traccar.database.IdentityManager; import org.traccar.helper.Checksum; import org.traccar.model.Device; import org.traccar.model.Position; +import org.traccar.model.Group; import javax.inject.Inject; import javax.ws.rs.client.Client; @@ -139,6 +140,18 @@ public class WebDataHandler extends BaseDataHandler { request = request.replace("{gprmc}", formatSentence(position)); } + if (request.contains("{group}")) { + String deviceGroupName = ""; + if (device.getGroupId() != 0) { + Group group = Context.getGroupsManager().getById(device.getGroupId()); + if (group != null) { + deviceGroupName = group.getName(); + } + } + + request = request.replace("{group}", URLEncoder.encode(deviceGroupName, StandardCharsets.UTF_8.name())); + } + return request; } |