Files
api-collections/collections/elixForms API v2/EFTL processing/CCT - Liquidazione Compensi/DSAN/Check richiedente in partecipanti.yml
T

81 lines
3.3 KiB
YAML

info:
name: Check richiedente in partecipanti
type: http
seq: 4
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",
"nominativiAmmessi": ";MAMMI Pier Paolo;;"
}
}
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="checkUtentePartecipante" type="string"][% utentePartecipante = "Utente non ammesso alla compilazione perché non partecipante al contratto!"; %][/VAR]
[VAR name="rsProponenteCognome" type="string"][TAG]GETVALUEBYTAG,RSP_COGNOME,REQUEST,IUQOID[/TAG][/VAR]
[VAR name="rsProponenteNome" type="string"][TAG]GETVALUEBYTAG,RSP_COGNOME,REQUEST,IUQOID[/TAG][/VAR]
[VAR name="responsabili" type="string"][TAG]GETVALUEBYTAG,CONTRATTO_RESPONSABILI,REQUEST,IUQOID[/TAG][/VAR]
[VAR name="partecipanti" type="string"][TAG]GETVALUEBYTAG,CONTRATTO_PARTECIPANTI,REQUEST,IUQOID[/TAG][/VAR]
[!-- [VAR name="nominativoUtentePlain" type="string"][TAG]GETVALUEBYTAG,RICHIEDENTE_NOMINATIVO,REQUEST,IUQOID[/TAG][/VAR] --]
[VAR name="nominativoUtentePlain" type="string"][% nominativoUtentePlain = "mammi Pier Paolo"; %][/VAR]
[!-- Hack for the CONTAIN below... --]
[VAR name="nominativoUtente" type="string"][% nominativoUtente = " " + nominativoUtentePlain + ", CF: "; %][/VAR]
[!-- Il richiedente non deve essere il RS proponente --]
[!-- Il richiedente deve comparire fra i responsabili --]
[!-- Il richiedente deve comparire fra i partecipanti --]
[!-- Il richiedente deve comparire fra i nominativi ammessi (DEBUG) --]
[IF]
[CONDITION][% nominativoUtentePlain == rsProponenteCognome + " " + rsProponenteNome %][/CONDITION]
[THEN][% checkUtentePartecipante = "Il Responsabile Scientifico proponente non deve compilare la DSAN"; %][/THEN]
[ELSE IF]
[CONDITION][CONTAINS varname="responsabili"][VALUE_OF varname="nominativoUtente" /][/CONTAINS][/CONDITION]
[THEN][% checkUtentePartecipante = ""; %][/THEN]
[/ELSE IF]
[ELSE IF]
[CONDITION][CONTAINS varname="partecipanti"][VALUE_OF varname="nominativoUtente" /][/CONTAINS][/CONDITION]
[THEN][% checkUtentePartecipante = ""; %][/THEN]
[/ELSE IF]
[ELSE IF]
[CONDITION][CONTAINS varname="nominativiAmmessi"][VALUE_OF varname="nominativoUtentePlain" /][/CONTAINS][/CONDITION]
[THEN][% checkUtentePartecipante = ""; %][/THEN]
[/ELSE IF]
[/IF]
[%= checkUtentePartecipante %]
[/EFTL]
`);
settings:
encodeUrl: true
timeout: 0
followRedirects: true
maxRedirects: 5