From 5a1f68146b36551f5b2350489ef2a5eb12afbd37 Mon Sep 17 00:00:00 2001 From: Pier-Paolo Mammi Date: Tue, 24 Mar 2026 16:33:05 +0100 Subject: [PATCH] add eftl on Proposta CCT for titulus dynamic naming --- .../Contratti/Contratto Esteso (IRIS GW).yml | 45 ++++++++++- .../Elenco Contraenti CSV (nominativo).yml | 75 +++++++++++++++++++ .../Elenco RS CSV (cognome nome).yml | 72 ++++++++++++++++++ .../Fascicolo e documento su Titulus.yml | 50 +++++++++++++ 4 files changed, 240 insertions(+), 2 deletions(-) create mode 100644 collections/elixForms API v2/EFTL processing/CCT - Proposta Operatore/Elenco Contraenti CSV (nominativo).yml create mode 100644 collections/elixForms API v2/EFTL processing/CCT - Proposta Operatore/Elenco RS CSV (cognome nome).yml create mode 100644 collections/elixForms API v2/EFTL processing/CCT - Proposta Operatore/Fascicolo e documento su Titulus.yml diff --git a/collections/IDEM WebServices/Contratti/Contratto Esteso (IRIS GW).yml b/collections/IDEM WebServices/Contratti/Contratto Esteso (IRIS GW).yml index 318c58d..20ba8be 100644 --- a/collections/IDEM WebServices/Contratti/Contratto Esteso (IRIS GW).yml +++ b/collections/IDEM WebServices/Contratti/Contratto Esteso (IRIS GW).yml @@ -5,13 +5,54 @@ info: http: method: GET - url: "{{IdemApiUrl}}/contratto_fs_esteso_ap.php?cod_con=ESPO_S_26_ACC_ACC_EMENDAMENTO2VABORKIDS_01" + url: "{{IdemApiUrl}}/contratto_fs_esteso_ap.php?cod_con=GIUL_F_25_CRCT_RA_MOVYON_01" params: - name: cod_con - value: ESPO_S_26_ACC_ACC_EMENDAMENTO2VABORKIDS_01 + value: GIUL_F_25_CRCT_RA_MOVYON_01 type: query auth: inherit +runtime: + scripts: + - type: after-response + code: |- + var jsonData = res.getBody(); + + var titolo = jsonData.Titolo; + var idContratto = jsonData.Identificativo; + var responsabileProponente = jsonData.responsabile_proponente.cognome + " " + jsonData.responsabile_proponente.nome; + var contraente = jsonData.contraenti_array[0]?.ragione_sociale; + + var responsabiliProponenti = ""; + for (var i = 0; i < jsonData.Responsabili_array.length; i++) + { + responsabiliProponenti += jsonData.Responsabili_array[i].cognome + " " + jsonData.Responsabili_array[i].nome + ", "; + } + responsabiliProponenti = responsabiliProponenti.slice(0, -2); + + var contraenti = ""; + for (var i = 0; i < jsonData.contraenti_array.length; i++) + { + contraenti += jsonData.contraenti_array[i].ragione_sociale + ", "; + } + contraenti = contraenti.slice(0, -2); + + var titoloFascicolo = + idContratto + " - " + + contraenti + " - " + + responsabiliProponenti + " - " + + titolo; + + var oggettoDocumento = + "Proposta di contratto / convenzione - " + + idContratto + " - " + + contraenti + " - " + + responsabiliProponenti + " - " + + titolo; + + console.log(titoloFascicolo); + console.log(oggettoDocumento); + settings: encodeUrl: true timeout: 0 diff --git a/collections/elixForms API v2/EFTL processing/CCT - Proposta Operatore/Elenco Contraenti CSV (nominativo).yml b/collections/elixForms API v2/EFTL processing/CCT - Proposta Operatore/Elenco Contraenti CSV (nominativo).yml new file mode 100644 index 0000000..54e9654 --- /dev/null +++ b/collections/elixForms API v2/EFTL processing/CCT - Proposta Operatore/Elenco Contraenti CSV (nominativo).yml @@ -0,0 +1,75 @@ +info: + name: Elenco Contraenti CSV (nominativo) + type: http + seq: 7 + +http: + method: POST + url: "{{elixFormsApiUrl}}/eftl/process/v1" + headers: + - name: x-requested-with + value: XMLHttpRequest + - name: x-api-key + value: "{{elixFormsWsAuthenticationToken}}" + - name: x-ef-request-id + value: "17144" + disabled: true + - name: x-ef-request-id + value: "15956" + body: + type: json + data: |- + { + "userDocument": "{{elixBase64EftlDocument}}", // see the pre-request script + "userContext": { + "lang": "IT", + "crlf": "\r\n", + "DEBUG": "S" + } + } + auth: inherit + +runtime: + scripts: + - type: before-request + code: |- + const { prepareEftlDocument } = require("./elixFormsJs.js") + // Copy-pasta your EFTL document below inside the template literals (`) + prepareEftlDocument(String.raw` + [EFTL][HEADER name="trimDocument" value="true" type="boolean" /] + + [VAR name="firstItem" type="number"][% firstItem = 0; %][/VAR] + [VAR name="secondItem" type="number"][% secondItem = 1; %][/VAR] + [VAR name="elencoContraentiCsv" type="string"][% elencoContraentiCsv = ""; %][/VAR] + + [VAR name="elencoContraenti" type="string"][TRIM][TAG]GETVALUEBYTAG,PROPOSTA_CCT_CONTRAENTI,REQUEST,ID_OBJECT[/TAG][/TRIM][/VAR] + [VAR name="elencoContraentiIterable" type="iterable"][SPLIT regex="\n" emptyIfBlank="true"][VALUE_OF varname="elencoContraenti" /][/SPLIT][/VAR] + [VAR name="elencoContraentiCount" type="number"][SIZE_OF varname="elencoContraentiIterable" /][/VAR] + + [VAR name="contraenteIdx" type="number"][% contraenteIdx = 0; %][/VAR] + [WHILE threshold="99"] + [CONDITION][% contraenteIdx < elencoContraentiCount %][/CONDITION] + [DO] + [VAR name="contraenteIterable" type="iterable"][SPLIT regex=", CF/PIVA: " emptyIfBlank="true"][TRIM][VALUE_OF varname="elencoContraentiIterable" index="contraenteIdx" /][/TRIM][/SPLIT][/VAR] + [VAR name="contraenteDenominazione" type="string"][VALUE_OF varname="contraenteIterable" index="firstItem" /][/VAR] + + [% elencoContraentiCsv = elencoContraentiCsv + contraenteDenominazione; %] + [% contraenteIdx = contraenteIdx + 1; %] + + [IF] + [CONDITION][% contraenteIdx < elencoContraentiCount %][/CONDITION] + [THEN] + [% elencoContraentiCsv = elencoContraentiCsv + ", "; %] + [/THEN] + [/IF] + [/DO][/WHILE] + + [%= elencoContraentiCsv %] + [/EFTL] + `); + +settings: + encodeUrl: true + timeout: 0 + followRedirects: true + maxRedirects: 5 diff --git a/collections/elixForms API v2/EFTL processing/CCT - Proposta Operatore/Elenco RS CSV (cognome nome).yml b/collections/elixForms API v2/EFTL processing/CCT - Proposta Operatore/Elenco RS CSV (cognome nome).yml new file mode 100644 index 0000000..76fa794 --- /dev/null +++ b/collections/elixForms API v2/EFTL processing/CCT - Proposta Operatore/Elenco RS CSV (cognome nome).yml @@ -0,0 +1,72 @@ +info: + name: Elenco RS CSV (cognome nome) + type: http + seq: 28 + +http: + method: POST + url: "{{elixFormsApiUrl}}/eftl/process/v1" + headers: + - name: x-requested-with + value: XMLHttpRequest + - name: x-api-key + value: "{{elixFormsWsAuthenticationToken}}" + - name: x-ef-request-id + value: "17144" + body: + type: json + data: |- + { + "userDocument": "{{elixBase64EftlDocument}}", // see the pre-request script + "userContext": { + "lang": "IT", + "crlf": "\r\n", + "DEBUG": "S" + } + } + auth: inherit + +runtime: + scripts: + - type: before-request + code: |- + const { prepareEftlDocument } = require("./elixFormsJs.js") + // Copy-pasta your EFTL document below inside the template literals (`) + prepareEftlDocument(String.raw` + [EFTL][HEADER name="trimDocument" value="true" type="boolean" /] + + [VAR name="firstItem" type="number"][% firstItem = 0; %][/VAR] + [VAR name="secondItem" type="number"][% secondItem = 1; %][/VAR] + [VAR name="elencoResponsabiliCsv" type="string"][% elencoResponsabiliCsv = ""; %][/VAR] + + [VAR name="elencoResponsabili" type="string"][TRIM][TAG]GETVALUEBYTAG,PROPOSTA_CCT_ALTRI_RS,REQUEST,ID_OBJECT[/TAG][/TRIM][/VAR] + [VAR name="elencoResponsabiliIterable" type="iterable"][SPLIT regex="\n" emptyIfBlank="true"][VALUE_OF varname="elencoResponsabili" /][/SPLIT][/VAR] + [VAR name="elencoResponsabiliCount" type="number"][SIZE_OF varname="elencoResponsabiliIterable" /][/VAR] + + [VAR name="responsabileIdx" type="number"][% responsabileIdx = 0; %][/VAR] + [WHILE threshold="99"] + [CONDITION][% responsabileIdx < elencoResponsabiliCount %][/CONDITION] + [DO] + [VAR name="responsabileIterable" type="iterable"][SPLIT regex=", CF: " emptyIfBlank="true"][TRIM][VALUE_OF varname="elencoResponsabiliIterable" index="responsabileIdx" /][/TRIM][/SPLIT][/VAR] + [VAR name="responsabileNominativo" type="string"][VALUE_OF varname="responsabileIterable" index="firstItem" /][/VAR] + + [% elencoResponsabiliCsv = elencoResponsabiliCsv + responsabileNominativo; %] + [% responsabileIdx = responsabileIdx + 1; %] + + [IF] + [CONDITION][% responsabileIdx < elencoResponsabiliCount %][/CONDITION] + [THEN] + [% elencoResponsabiliCsv = elencoResponsabiliCsv + ", "; %] + [/THEN] + [/IF] + [/DO][/WHILE] + + [%= elencoResponsabiliCsv %] + [/EFTL] + `); + +settings: + encodeUrl: true + timeout: 0 + followRedirects: true + maxRedirects: 5 diff --git a/collections/elixForms API v2/EFTL processing/CCT - Proposta Operatore/Fascicolo e documento su Titulus.yml b/collections/elixForms API v2/EFTL processing/CCT - Proposta Operatore/Fascicolo e documento su Titulus.yml new file mode 100644 index 0000000..e6f72f0 --- /dev/null +++ b/collections/elixForms API v2/EFTL processing/CCT - Proposta Operatore/Fascicolo e documento su Titulus.yml @@ -0,0 +1,50 @@ +info: + name: Fascicolo e documento su Titulus + type: http + seq: 8 + +http: + method: POST + url: "{{elixFormsApiUrl}}/eftl/process/v1" + headers: + - name: x-requested-with + value: XMLHttpRequest + - name: x-api-key + value: "{{elixFormsWsAuthenticationToken}}" + - name: x-ef-request-id + value: "17144" + disabled: true + - name: x-ef-request-id + value: "25889" + body: + type: json + data: |- + { + "userDocument": "{{elixBase64EftlDocument}}", // see the pre-request script + "userContext": { + "lang": "IT", + "crlf": "\r\n", + "DEBUG": "S" + } + } + auth: inherit + +runtime: + scripts: + - type: before-request + code: |- + const { prepareEftlDocument } = require("./elixFormsJs.js") + // Copy-pasta your EFTL document below inside the template literals (`) + prepareEftlDocument(String.raw` + [EFTL][HEADER name="trimDocument" value="true" type="boolean" /] + + [TAG]GETVALUEBYTAG,ID_IRIS,REQUEST,ID_OBJECT[/TAG] - [TAG]GETVALUEBYTAG,ELENCO_CONTRAENTI_CSV,REQUEST,ID_OBJECT[/TAG] - [TAG]GETVALUEBYTAG,ELENCO_RS_CSV,REQUEST,ID_OBJECT[/TAG] - [TAG]GETVALUEBYTAG,PROPOSTA_CCT_CONTRATTO_DESCR,REQUEST,ID_OBJECT[/TAG] + + [/EFTL] + `); + +settings: + encodeUrl: true + timeout: 0 + followRedirects: true + maxRedirects: 5