138 lines
6.6 KiB
YAML
138 lines
6.6 KiB
YAML
info:
|
|
name: Elenco partecipanti per dropdown con chiave
|
|
type: http
|
|
seq: 14
|
|
|
|
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: "21223"
|
|
body:
|
|
type: json
|
|
data: |-
|
|
{
|
|
"userDocument": "{{elixBase64EftlDocument}}", // see the pre-request script
|
|
"userContext": {
|
|
"lang": "IT",
|
|
"crlf": "\r\n"
|
|
}
|
|
}
|
|
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="newLine" type="string"][VALUE_OF varname="crlf" /][/VAR]
|
|
|
|
[VAR name="responsabili" type="string"][TRIM][TAG]GETVALUEBYTAG,CONTRATTO_RESPONSABILI,REQUEST,IUQOID[/TAG][/TRIM][/VAR]
|
|
[VAR name="partecipanti" type="string"][TRIM][TAG]GETVALUEBYTAG,CONTRATTO_PARTECIPANTI,REQUEST,IUQOID[/TAG][/TRIM][/VAR]
|
|
|
|
[!-- Aggiungi primo elemento "nullo" --]
|
|
[VAR name="ripartizioniElenco" type="string"][% ripartizioniElenco = "[0] ---" + newLine; %][/VAR]
|
|
|
|
[VAR name="responsabiliIterable" type="iterable"][SPLIT regex="\n"][VALUE_OF varname="responsabili" /][/SPLIT][/VAR]
|
|
[VAR name="partecipantiIterable" type="iterable"][SPLIT regex="\n"][VALUE_OF varname="partecipanti" /][/SPLIT][/VAR]
|
|
|
|
[VAR name="responsabiliCount" type="number"][SIZE_OF varname="responsabiliIterable" /][/VAR]
|
|
[VAR name="partecipantiCount" type="number"][SIZE_OF varname="partecipantiIterable" /][/VAR]
|
|
|
|
[VAR name="personaIdx" type="string"][% personaIdx = 0; %][/VAR]
|
|
[VAR name="dropdownIdx" type="string"][% dropdownIdx = 0; %][/VAR]
|
|
|
|
[VAR name="firstItem" type="number"][% firstItem = 0; %][/VAR]
|
|
[VAR name="secondItem" type="number"][% secondItem = 1; %][/VAR]
|
|
|
|
[WHILE threshold="99"]
|
|
[CONDITION][% personaIdx < responsabiliCount %][/CONDITION]
|
|
[DO]
|
|
[VAR name="responsabileFull" type="string"][VALUE_OF varname="responsabiliIterable" index="personaIdx" /][/VAR]
|
|
[VAR name="responsabileIterable" type="iterable"][SPLIT regex=", CF: "][TRIM][VALUE_OF varname="responsabileFull" /][/TRIM][/SPLIT][/VAR]
|
|
|
|
[!-- Recupera il nominativo --]
|
|
[VAR name="responsabileNominativo" type="string"][VALUE_OF varname="responsabileIterable" index="firstItem" /][/VAR]
|
|
|
|
[!-- Recupera il codice fiscale --]
|
|
[VAR name="responsabileResto" type="string"][VALUE_OF varname="responsabileIterable" index="secondItem" /][/VAR]
|
|
[VAR name="responsabileRestoIterable" type="iterable"][SPLIT regex=", Qualifica: "][VALUE_OF varname="responsabileResto" /][/SPLIT][/VAR]
|
|
[VAR name="responsabileCodiceFiscale" type="string"][VALUE_OF varname="responsabileRestoIterable" index="firstItem" /][/VAR]
|
|
|
|
[% personaIdx = personaIdx + 1; %]
|
|
[% dropdownIdx = dropdownIdx + 1; %]
|
|
|
|
[!-- HACK ignobile per recuperare il numero che altrimenti verrebbe emesso come "1.0", etc... --]
|
|
[VAR name="responsabileKeyIterable" type="iterable"][SPLIT regex="\."][% dropdownIdx + "" %][/SPLIT][/VAR]
|
|
[VAR name="responsabileKey" type="string"][VALUE_OF varname="responsabileKeyIterable" index="firstItem" /][/VAR]
|
|
|
|
[% ripartizioniElenco = ripartizioniElenco + "[" + responsabileKey + "] " + responsabileNominativo + " (CF: " + responsabileCodiceFiscale + ")"; %]
|
|
|
|
[IF]
|
|
[CONDITION][% personaIdx < responsabiliCount %][/CONDITION]
|
|
[THEN]
|
|
[% ripartizioniElenco = ripartizioniElenco + newLine; %]
|
|
[/THEN]
|
|
[ELSE IF]
|
|
[CONDITION][IS_NOT_EMPTY varname="partecipanti" /][/CONDITION]
|
|
[THEN]
|
|
[% ripartizioniElenco = ripartizioniElenco + newLine; %]
|
|
[/THEN]
|
|
[/ELSE IF]
|
|
[/IF]
|
|
[/DO]
|
|
[/WHILE]
|
|
|
|
[IF][CONDITION][IS_NOT_EMPTY varname="partecipanti" /][/CONDITION][THEN]
|
|
[% personaIdx = 0; %]
|
|
[WHILE threshold="99"]
|
|
[CONDITION][% personaIdx < partecipantiCount %][/CONDITION]
|
|
[DO]
|
|
[VAR name="partecipanteFull" type="string"][VALUE_OF varname="partecipantiIterable" index="personaIdx" /][/VAR]
|
|
[VAR name="partecipanteIterable" type="iterable"][SPLIT regex=", CF: "][TRIM][VALUE_OF varname="partecipanteFull" /][/TRIM][/SPLIT][/VAR]
|
|
|
|
[!-- Recupera il nominativo --]
|
|
[VAR name="partecipanteNominativo" type="string"][VALUE_OF varname="partecipanteIterable" index="firstItem" /][/VAR]
|
|
|
|
[!-- Recupera il codice fiscale --]
|
|
[VAR name="partecipanteResto" type="string"][VALUE_OF varname="partecipanteIterable" index="secondItem" /][/VAR]
|
|
[VAR name="partecipanteRestoIterable" type="iterable"][SPLIT regex=", Qualifica: "][VALUE_OF varname="partecipanteResto" /][/SPLIT][/VAR]
|
|
[VAR name="partecipanteCodiceFiscale" type="string"][VALUE_OF varname="partecipanteRestoIterable" index="firstItem" /][/VAR]
|
|
|
|
[% personaIdx = personaIdx + 1; %]
|
|
[% dropdownIdx = dropdownIdx + 1; %]
|
|
|
|
[!-- HACK ignobile per recuperare il numero che altrimenti verrebbe emesso come "1.0", etc... --]
|
|
[VAR name="partecipanteKeyIterable" type="iterable"][SPLIT regex="\."][% dropdownIdx + "" %][/SPLIT][/VAR]
|
|
[VAR name="partecipanteKey" type="string"][VALUE_OF varname="partecipanteKeyIterable" index="firstItem" /][/VAR]
|
|
|
|
[% ripartizioniElenco = ripartizioniElenco + "[" + partecipanteKey + "] " + partecipanteNominativo + " (CF: " + partecipanteCodiceFiscale + ")"; %]
|
|
|
|
[IF]
|
|
[CONDITION][% personaIdx < partecipantiCount %][/CONDITION]
|
|
[THEN]
|
|
[% ripartizioniElenco = ripartizioniElenco + newLine; %]
|
|
[/THEN]
|
|
[/IF]
|
|
[/DO]
|
|
[/WHILE]
|
|
[/THEN][/IF]
|
|
|
|
[%= ripartizioniElenco %]
|
|
[/EFTL]
|
|
`);
|
|
|
|
settings:
|
|
encodeUrl: true
|
|
timeout: 0
|
|
followRedirects: true
|
|
maxRedirects: 5
|