Skip to content

Commit d2179d0

Browse files
committed
Allow setting text fields in WFS based on tags in fylr objects
1 parent 7a523c8 commit d2179d0

3 files changed

Lines changed: 16 additions & 5 deletions

File tree

l10n/custom-data-type-nfis-geometry.csv

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -68,6 +68,7 @@ server.config.parameter.system.nfisGeoservices.wfs_configuration.geometry_fields
6868
server.config.parameter.system.nfisGeoservices.wfs_configuration.geometry_fields.tags.wfs_field_name.label,Name des WFS-Zielfeldes,Name of WFS target field
6969
server.config.parameter.system.nfisGeoservices.wfs_configuration.geometry_fields.tags.fylr_tags_path.label,Pfad zu den Tags im fylr-Objekt,Path to tags in fylr object
7070
server.config.parameter.system.nfisGeoservices.wfs_configuration.geometry_fields.tags.fylr_tag_id.label,Tag-ID,Tag ID
71+
server.config.parameter.system.nfisGeoservices.wfs_configuration.geometry_fields.tags.wfs_field_value.label,Im WFS-Zielfeld einzutragender Wert (true/false falls leer),Value to enter in WFS target field (true/false if empty)
7172
server.config.parameter.system.nfisGeoservices.wfs_configuration.geometry_fields.wfs_pool_field.label,WFS-Zielfeld für die Poolbezeichnung,WFS target field for pool name
7273
server.config.parameter.system.nfisGeoservices.wfs_configuration.geometry_fields.pool_names.label,Poolbezeichnungen für Datenübertragung,Pool names for data transfer
7374
server.config.parameter.system.nfisGeoservices.linked_objects.label,Verknüpfte Objekte,Linked objects

manifest.master.yml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -149,6 +149,9 @@ base_config:
149149
- name: fylr_tag_id
150150
type: int
151151
position: 2
152+
- name: wfs_field_value
153+
type: text
154+
position: 3
152155
- name: wfs_pool_field
153156
type: text
154157
position: 13

src/server/sendDataToGeoserver.js

Lines changed: 12 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -218,13 +218,20 @@ async function addFieldsToChangeMap(object, fieldConfiguration, changeMap) {
218218
async function addTagsToChangeMap(object, fieldConfiguration, changeMap) {
219219
if (!fieldConfiguration.tags) return;
220220

221-
for (let tag of fieldConfiguration.tags) {
222-
const wfsFieldName = tag.wfs_field_name;
223-
const tagsPath = tag.fylr_tags_path ?? '_tags';
224-
const tagId = tag.fylr_tag_id;
221+
for (let tagConfiguration of fieldConfiguration.tags) {
222+
const wfsFieldName = tagConfiguration.wfs_field_name;
223+
const wfsFieldValue = tagConfiguration.wfs_field_value;
224+
const tagsPath = tagConfiguration.fylr_tags_path ?? '_tags';
225+
const tagId = tagConfiguration.fylr_tag_id;
226+
225227
if (wfsFieldName && tagId) {
226228
const tags = (await getFieldValues(object, tagsPath.split('.')))[0];
227-
changeMap[wfsFieldName] = tags.find(entry => entry._id === tagId) !== undefined;
229+
const tag = tags.find(entry => entry._id === tagId);
230+
if (wfsFieldValue) {
231+
if (tag !== undefined) changeMap[wfsFieldName] = wfsFieldValue;
232+
} else {
233+
changeMap[wfsFieldName] = tag !== undefined;
234+
}
228235
}
229236
}
230237
}

0 commit comments

Comments
 (0)