diff --git a/configurations/sharepoint-woo/mappings/xxllnc-suite-to-publications.json b/configurations/sharepoint-woo/mappings/xxllnc-suite-to-publications.json index 7a2ea214..744823b1 100644 --- a/configurations/sharepoint-woo/mappings/xxllnc-suite-to-publications.json +++ b/configurations/sharepoint-woo/mappings/xxllnc-suite-to-publications.json @@ -1,26 +1,26 @@ { "name": "Xxllnc suite to Publication", - "description": "", - "version": "", - "reference": "", + "version": "0.0.1", "mapping": { - "title": "omschrijving", - "summary": "zaaktypeomschrijving", - "description": "zaaktypeomschrijving", - "published" : "", - "modified" : "{{ 'now'|date(H:i:sTm-d-Y') }}", - "status": "Concept", - "catalog": "", - "publicationType": "" - }, - "unset": [], - "cast": { - "title": "unsetIfValue==omschrijving", - "summary": "unsetIfValue==zaaktypeomschrijving", - "description": "unsetIfValue==zaaktypeomschrijving", - "published" : "unsetIfValue==", - "catalog": "unsetIfValue==", - "publicationType": "unsetIfValue==" + "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 %}", + "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 %}]", + "status": "Concept" + }, + "unset": [ + "" + ], + "cast": { + "title": "unsetIfValue==omschrijving", + "summary": "unsetIfValue==zaaktypeomschrijving", + "description": "unsetIfValue==zaaktypeomschrijving", + "category": "unsetIfValue==", + "published": "unsetIfValue==startdatum", + "attachments": "jsonToArray" }, "passThrough": false } \ No newline at end of file diff --git a/configurations/sharepoint-woo/synchronizations/xxllnc-suite-to-publications.json b/configurations/sharepoint-woo/synchronizations/xxllnc-suite-to-publications.json index 6dfedf86..91922ef1 100644 --- a/configurations/sharepoint-woo/synchronizations/xxllnc-suite-to-publications.json +++ b/configurations/sharepoint-woo/synchronizations/xxllnc-suite-to-publications.json @@ -7,13 +7,19 @@ "sourceHash": "", "sourceTargetMapping": "1", "sourceConfig": { - "idPosition": "id", - "resultsPosition": "results", - "endpoint": "/tlb/zaaksysteem/api/v1/zaken", - "headers": [], - "query.startdatum__gte": "2024-07-06", - "query.einddatum__lt": "2024-08-01" - }, + "idPosition": "identificatie", + "resultsPosition": "results", + "endpoint": "\/tlb\/zaaksysteem\/api\/v1\/zaken", + "headers": [], + "query.startdatum__gte": "2024-08-01", + "query.einddatum__lt": "2025-01-01", + "usesPagination": "false", + "extraDataConfigs.0.staticEndpoint": "/tlb/zaaksysteem/api/v1/zaken/{{ originId }}/informatieobjecten", + "extraDataConfigs.0.mergeExtraData": "true", + "extraDataConfigs.0.keyToSetExtraData": "files", + "extraDataConfigs.0.resultsLocation": "results", + "extraDataConfigs.0.extraDataConfigPerResult.staticEndpoint": "/tlb/zaaksysteem/api/v1/informatieobjecten/{{ originId }}" + }, "targetId": "1/1", "targetType": "register/schema" } \ No newline at end of file diff --git a/lib/Db/Synchronization.php b/lib/Db/Synchronization.php index 208bef2c..473524b0 100644 --- a/lib/Db/Synchronization.php +++ b/lib/Db/Synchronization.php @@ -65,6 +65,21 @@ public function __construct() { $this->addType(fieldName:'followUps', type: 'json'); } + /** + * Checks through sourceConfig if the source of this sync uses pagination + * + * @return bool true if its uses pagination + */ + public function usesPagination(): bool + { + if (isset($this->sourceConfig['usesPagination']) === true && ($this->sourceConfig['usesPagination'] === false || $this->sourceConfig['usesPagination'] === 'false')) { + return false; + } + + // By default sources use basic pagination. + return true; + } + public function getJsonFields(): array { return array_keys( diff --git a/lib/Service/SynchronizationService.php b/lib/Service/SynchronizationService.php index 0b205ff1..3f51accd 100644 --- a/lib/Service/SynchronizationService.php +++ b/lib/Service/SynchronizationService.php @@ -554,7 +554,7 @@ public function getAllObjectsFromApi(Synchronization $synchronization, ?bool $is $objects = array_merge($objects, $this->getAllObjectsFromArray($body, $synchronization)); } - if ($useNextEndpoint === false) { + if ($useNextEndpoint === false && $synchronization->usesPagination() === true) { do { $config = $this->getNextPage(config: $config, sourceConfig: $sourceConfig, currentPage: $currentPage); $response = $this->callService->call(source: $source, endpoint: $endpoint, method: 'GET', config: $config)->getResponse();