Patch level : 12.00 1368

Files correlati     : cg0.exe

Commento:
Corretto controllo partite iva e codci fiscali duplicati
This commit is contained in:
Alessandro Bonazzi 2024-11-07 07:57:52 +01:00
parent cf41c9d3df
commit c93c07fb10

View File

@ -212,9 +212,12 @@ HIDDEN bool no_dup_iva(TMask_field& f, KEY key)
{ {
const bool only_one_paiv = ini_get_bool(CONFIG_DITTA, "cg", "OnlyOnePaIV"); const bool only_one_paiv = ini_get_bool(CONFIG_DITTA, "cg", "OnlyOnePaIV");
TRectype from(LF_CLIFO); TRectype from(LF_CLIFO);
TString8 stato = m.get(F_STATOPAIV);
if (stato.blank())
stato = "IT";
from.put(CLI_TIPOCF, m.get(F_TIPOCF)); from.put(CLI_TIPOCF, m.get(F_TIPOCF));
from.put(CLI_STATOPAIV, m.get(F_STATOPAIV)); from.put(CLI_STATOPAIV, stato);
from.put(CLI_PAIV, m.get(F_PAIV)); from.put(CLI_PAIV, m.get(F_PAIV));
TCursor c(new TRelation(LF_CLIFO), "", 5, &from, &from); TCursor c(new TRelation(LF_CLIFO), "", 5, &from, &from);
@ -234,7 +237,7 @@ HIDDEN bool no_dup_iva(TMask_field& f, KEY key)
const bool multi_clifo = dup_cf != 0L; const bool multi_clifo = dup_cf != 0L;
const bool not_dup = (alleg != "4" && alleg != "7" & alleg != "G"); const bool not_dup = (alleg != "4" && alleg != "7" & alleg != "G");
const char * tipo = c.curr().get(CLI_TIPOCF) == "C" ? "cliente" : "fornitore"; const char * tipo = m.get(F_TIPOCF) == "C" ? "cliente" : "fornitore";
if (only_one_paiv) if (only_one_paiv)
{ {
@ -243,7 +246,7 @@ HIDDEN bool no_dup_iva(TMask_field& f, KEY key)
if (supervisor()) if (supervisor())
{ {
if (not_dup) if (not_dup)
return f.error_box(FR("Partita IVA gia' utilizzata per il codice %s ld\nsenza avere indicato il valore 4, 7 o G nell'inserimento in allegato"), return f.error_box(FR("Partita IVA gia' utilizzata per il codice %s %ld\nsenza avere indicato il valore 4, 7 o G nell'inserimento in allegato"),
tipo, dup_cf); tipo, dup_cf);
} }
else else