diff --git a/configurations/sharepoint-woo/mappings/xxllnc-suite-to-publications.json b/configurations/sharepoint-woo/mappings/xxllnc-suite-to-publications.json
index 744823b..57ab360 100644
--- a/configurations/sharepoint-woo/mappings/xxllnc-suite-to-publications.json
+++ b/configurations/sharepoint-woo/mappings/xxllnc-suite-to-publications.json
@@ -5,7 +5,7 @@
"title": "omschrijving",
"summary": "zaaktypeomschrijving",
"description": "zaaktypeomschrijving",
- "category": "{% if zaaktypecode|default %}{% set wooVerzoekenEnBesluiten = ['LP00000431', 'B1873', 'cherry'] %}{% set klachtoordelen = ['LP00000091', 'LP00001132', 'LP00000121', 'B0757', 'LP00000832', 'LP00001096'] %}{% if zaaktypecode in wooVerzoekenEnBesluiten %}{{ 'Woo-verzoeken en -besluiten' }}{% elseif zaaktypecode in klachtoordelen %}{{ 'Klachtoordelen' }}{% endif %}{% endif %}",
+ "category": "{% if zaaktypecode|default %}{% set wooVerzoekenEnBesluiten = ['LP00000431', 'B1873'] %}{% set klachtoordelen = ['LP00000091', 'LP00001132', 'LP00000121', 'B0757', 'LP00000832', 'LP00001096'] %}{% if zaaktypecode in wooVerzoekenEnBesluiten %}{{ 'Woo-verzoeken en -besluiten' }}{% elseif zaaktypecode in klachtoordelen %}{{ 'Klachtoordelen' }}{% endif %}{% endif %}",
"published": "startdatum",
"modified": "{{ 'now'|date('H:i:sTm-d-Y') }}",
"attachments": "[{% if files|default %}{% for file in files %} { {% if file['titel']|default %}\"title\": \"{{ file['titel'] }}\",{% endif %}\"labels\": [\"{{ 'Informatieverzoek' }}\"],{% if file['formaat']|default %}\"extension\": \"{{ file['formaat']|split('/')|last }}\",\"type\": \"{{ file['formaat'] }}\",{% endif %}{% if file['inhoud']|default and file['formaat']|default %}\"accessUrl\": \"data:{{ file['formaat'] }};base64,{{ file.inhoud }}\"{% endif %} }{{ loop.last ? '' : ',' }} {% endfor %}{% endif %}]",
diff --git a/configurations/sharepoint-woo/synchronizations/xxllnc-suite-to-publications.json b/configurations/sharepoint-woo/synchronizations/xxllnc-suite-to-publications.json
index 91922ef..d5672fd 100644
--- a/configurations/sharepoint-woo/synchronizations/xxllnc-suite-to-publications.json
+++ b/configurations/sharepoint-woo/synchronizations/xxllnc-suite-to-publications.json
@@ -5,6 +5,7 @@
"sourceId": "1",
"sourceType": "api",
"sourceHash": "",
+ "sourceHashMapping": "1",
"sourceTargetMapping": "1",
"sourceConfig": {
"idPosition": "identificatie",
@@ -13,6 +14,7 @@
"headers": [],
"query.startdatum__gte": "2024-08-01",
"query.einddatum__lt": "2025-01-01",
+ "query.maximaleVertrouwelijkheidaanduiding": "openbaar",
"usesPagination": "false",
"extraDataConfigs.0.staticEndpoint": "/tlb/zaaksysteem/api/v1/zaken/{{ originId }}/informatieobjecten",
"extraDataConfigs.0.mergeExtraData": "true",
@@ -21,5 +23,17 @@
"extraDataConfigs.0.extraDataConfigPerResult.staticEndpoint": "/tlb/zaaksysteem/api/v1/informatieobjecten/{{ originId }}"
},
"targetId": "1/1",
- "targetType": "register/schema"
+ "targetType": "register/schema",
+ "conditions": {
+ "if": [
+ {
+ "or": [
+ { "in": [{ "var": "zaaktypecode" }, ["LP00000431", "B1873"]] },
+ { "in": [{ "var": "zaaktypecode" }, ["LP00000091", "LP00001132", "LP00000121", "B0757", "LP00000832", "LP00001096"]] }
+ ]
+ },
+ true,
+ false
+ ]
+ }
}
\ No newline at end of file
diff --git a/lib/Service/SynchronizationService.php b/lib/Service/SynchronizationService.php
index 3f51acc..53198ab 100644
--- a/lib/Service/SynchronizationService.php
+++ b/lib/Service/SynchronizationService.php
@@ -98,6 +98,16 @@ public function synchronize(Synchronization $synchronization, ?bool $isTest = fa
$objectList = $this->getAllObjectsFromSource(synchronization: $synchronization, isTest: $isTest);
foreach ($objectList as $key => $object) {
+
+ // Check if object adheres to conditions.
+ // Take note, JsonLogic::apply() returns a range of return types, so checking it with '=== false' or '!== true' does not work properly.
+ if ($synchronization->getConditions() !== [] && !JsonLogic::apply($synchronization->getConditions(), $object)) {
+
+ // @todo log that this object is not valid
+ unset($objectList[$key]);
+ continue;
+ }
+
// If the source configuration contains a dot notation for the id position, we need to extract the id from the source object
$originId = $this->getOriginId($synchronization, $object);
@@ -340,12 +350,6 @@ public function synchronizeContract(SynchronizationContract $synchronizationCont
$synchronizationContract->setSourceLastChanged(new DateTime());
$synchronizationContract->setSourceLastChecked(new DateTime());
- // Check if object adheres to conditions.
- // Take note, JsonLogic::apply() returns a range of return types, so checking it with '=== false' or '!== true' does not work properly.
- if ($synchronization->getConditions() !== [] && !JsonLogic::apply($synchronization->getConditions(), $object)) {
- return $synchronizationContract;
- }
-
// If no source target mapping is defined, use original object
if (empty($synchronization->getSourceTargetMapping()) === true) {
$targetObject = $object;
diff --git a/src/entities/synchronization/synchronization.mock.ts b/src/entities/synchronization/synchronization.mock.ts
index 8a885fb..711def2 100644
--- a/src/entities/synchronization/synchronization.mock.ts
+++ b/src/entities/synchronization/synchronization.mock.ts
@@ -6,6 +6,7 @@ export const mockSynchronizationData = (): TSynchronization[] => [
id: 1,
name: 'Synchronization 1',
description: 'Synchronization 1',
+ conditions: '{"!!": { "var": "valid" }}',
sourceId: 'source1',
sourceType: 'api',
sourceHash: 'source1',
@@ -29,6 +30,7 @@ export const mockSynchronizationData = (): TSynchronization[] => [
id: 2,
name: 'Synchronization 2',
description: 'Synchronization 2',
+ conditions: '{"!!": { "var": "valid" }}',
sourceId: 'source2',
sourceType: 'api',
sourceHash: 'source2',
diff --git a/src/entities/synchronization/synchronization.ts b/src/entities/synchronization/synchronization.ts
index c9bac36..ac0fb2f 100644
--- a/src/entities/synchronization/synchronization.ts
+++ b/src/entities/synchronization/synchronization.ts
@@ -8,6 +8,7 @@ export class Synchronization extends ReadonlyBaseClass implements TSynchronizati
public id: number
public name: string
public description: string
+ public conditions: string
public sourceId: string
public sourceType: string
public sourceHash: string
@@ -32,6 +33,7 @@ export class Synchronization extends ReadonlyBaseClass implements TSynchronizati
id: synchronization.id || null,
name: synchronization.name || '',
description: synchronization.description || '',
+ conditions: synchronization.conditions || '',
sourceId: synchronization.sourceId || '',
sourceType: synchronization.sourceType || '',
sourceHash: synchronization.sourceHash || '',
@@ -60,6 +62,7 @@ export class Synchronization extends ReadonlyBaseClass implements TSynchronizati
id: z.number().nullable(),
name: z.string(),
description: z.string(),
+ conditions: z.string(),
sourceId: z.string(),
sourceType: z.string(),
sourceHash: z.string(),
diff --git a/src/entities/synchronization/synchronization.types.ts b/src/entities/synchronization/synchronization.types.ts
index 7dcf47a..97cb745 100644
--- a/src/entities/synchronization/synchronization.types.ts
+++ b/src/entities/synchronization/synchronization.types.ts
@@ -2,6 +2,7 @@ export type TSynchronization = {
id: number
name: string
description: string
+ conditions: string
sourceId: string
sourceType: string
sourceHash: string
diff --git a/src/modals/Synchronization/EditSynchronization.vue b/src/modals/Synchronization/EditSynchronization.vue
index 1a76f1b..2aa443f 100644
--- a/src/modals/Synchronization/EditSynchronization.vue
+++ b/src/modals/Synchronization/EditSynchronization.vue
@@ -81,6 +81,9 @@ import { synchronizationStore, navigationStore, sourceStore, mappingStore } from
+
+
@@ -199,6 +202,7 @@ export default {
synchronizationItem: { // Initialize with empty fields
name: '',
description: '',
+ conditions: '',
sourceId: '',
sourceType: '',
sourceConfig: {
@@ -274,7 +278,10 @@ export default {
mounted() {
if (this.IS_EDIT) {
// If there is a synchronization item in the store, use it
- this.synchronizationItem = { ...synchronizationStore.synchronizationItem }
+ this.synchronizationItem = {
+ ...synchronizationStore.synchronizationItem,
+ conditions: JSON.stringify(synchronizationStore.synchronizationItem.conditions),
+ }
// update targetTypeOptions with the synchronization item target type
this.targetTypeOptions.value = this.targetTypeOptions.options.find(option => option.id === this.synchronizationItem.targetType)
@@ -529,6 +536,7 @@ export default {
sourceId: this.sourceOptions.sourceValue?.id || null,
sourceType: this.typeOptions.value?.id || null,
sourceTargetMapping: this.sourceTargetMappingOptions.sourceValue?.id || null,
+ conditions: JSON.parse(this.synchronizationItem.conditions) || null,
targetType: this.targetTypeOptions.value?.id || null,
targetId: targetId || null,
targetSourceMapping: this.sourceTargetMappingOptions.targetValue?.id || null,
diff --git a/src/views/Mapping/MappingDetails.vue b/src/views/Mapping/MappingDetails.vue
index 72257fb..dc4c771 100644
--- a/src/views/Mapping/MappingDetails.vue
+++ b/src/views/Mapping/MappingDetails.vue
@@ -160,9 +160,6 @@ import { mappingStore, navigationStore } from '../../store/store.js'
disable-menu
:size="44" />
-
- {{ value }}
-