From 4638903ee125245f800c6b0e0934ed7360f651f8 Mon Sep 17 00:00:00 2001 From: IDfr Date: Mon, 28 Nov 2022 17:16:00 +0100 Subject: [PATCH] Update exportSitra.server.model.js --- .../server/models/exportSitra.server.model.js | 52 +++++++++++++++++-- 1 file changed, 47 insertions(+), 5 deletions(-) diff --git a/modules/products/server/models/exportSitra.server.model.js b/modules/products/server/models/exportSitra.server.model.js index 3ecda9f..2948319 100644 --- a/modules/products/server/models/exportSitra.server.model.js +++ b/modules/products/server/models/exportSitra.server.model.js @@ -1471,6 +1471,19 @@ function __buildSubType(product, root, rootFieldList, unwantedTypes) { blockCategory + '.' + blockField + '.referencesTopoguides' ); } + if (itinerary.referencesCartographiques) { + blockItinerary.referencesCartographiques = { + libelleFr: product.itinerary.referencesCartographiques, + libelleEn: product.itinerary.referencesCartographiques, + libelleEs: product.itinerary.referencesCartographiques, + libelleIt: product.itinerary.referencesCartographiques, + libelleDe: product.itinerary.referencesCartographiques, + libelleNl: product.itinerary.referencesCartographiques + }; + fieldList.push( + blockCategory + '.' + blockField + '.referencesCartographiques' + ); + } if (Object.keys(blockItinerary).length) { blockData[blockField] = blockItinerary; } @@ -3683,11 +3696,6 @@ function __buildPrestation(product, root, rootFieldList, unwantedTypes) { ); root.informationsPrestataireActivites.prestataireActivites = true; } - if (root.informationsPrestataireActivites.prestataireActivites) { - rootFieldList.push( - 'informationsPrestataireActivites.prestataireActivites' - ); - } } if (product.language && product.language.length) { @@ -3733,6 +3741,40 @@ function __buildPrestation(product, root, rootFieldList, unwantedTypes) { rootFieldList.push('prestations.tailleGroupeMax'); } + if (root.informationsPrestataireActivites && + root.informationsPrestataireActivites.prestataireActivites + ) { + if (!root.informationsPrestataireActivites) { + root.informationsPrestataireActivites = {}; + } + root.informationsPrestataireActivites.prestataireActivites = true; + rootFieldList.push('informationsPrestataireActivites.prestataireActivites'); + } + + if (product.isActivityProvider){ + root.informationsPrestataireActivites = {}; + root.informationsPrestataireActivites.prestataireActivites = true; + rootFieldList.push('informationsPrestataireActivites.prestataireActivites'); + // Prestation + if (product.prestation && product.prestation.length) { + root.informationsPrestataireActivites.activitesSportives = __buildTypeKeyArray( + product.prestation, + ['ActiviteSportivePrestation'], + unwantedTypes + ); + } + rootFieldList.push('informationsPrestataireActivites.activitesSportives'); + // Prestation + if (product.prestation && product.prestation.length) { + root.informationsPrestataireActivites.activitesCulturelles = __buildTypeKeyArray( + product.prestation, + ['ActiviteCulturellePrestation'], + unwantedTypes + ); + } + rootFieldList.push('informationsPrestataireActivites.activitesCulturelles'); + } + if (Object.keys(prestation).length) { root.prestations = prestation; } else {