Patch level : 12.0 1044

Files correlati     : cg0.exe cg0200a.msk cgtbbnp.msk
Commento        :

Agiunto supporto per IBAN esteri all'anagrafica clienti e alle banche di presentazione
This commit is contained in:
Alessandro Bonazzi 2021-03-30 00:02:03 +02:00
parent 91c2808ea5
commit 9f360072ac

View File

@ -944,18 +944,23 @@ HIDDEN bool _iban_val(TMask_field& f, KEY key)
{ {
bool ok = true; bool ok = true;
if (f.to_check(key)) if (f.to_check(key) || key == K_ENTER)
{ {
TMask& m = f.mask(); TMask& m = f.mask();
const int nparms = get_val_param_count(); const int nparms = get_val_param_count();
CHECKD(nparms == 10 , "IBAN_CHECK deve avere 10 parametri: ", nparms); CHECKD((nparms >= 8) && (nparms <= 10) , "IBAN_CHECK deve avere 8, 9, o 10 parametri: ", nparms);
int id[9]; int id[10];
for (int i = 0; i < 9; i++) for (int i = 0; i < nparms; i++)
id[i] = get_int_val_param(i); id[i] = get_int_val_param(i);
if (nparms < 9)
id[8] = -1;
if (nparms < 10)
id[9] = 0;
bool pres = get_int_val_param(9); bool pres = get_int_val_param(9);
TString80 iban = m.get(id[0]); TString80 iban = m.get(id[0]);
@ -999,7 +1004,7 @@ HIDDEN bool _iban_val(TMask_field& f, KEY key)
} }
} }
} }
if (f.final_check(key) && f.dlg() == id[2]) if (key == K_ENTER && f.dlg() == id[2])
{ {
TString msg; TString msg;
@ -1040,29 +1045,32 @@ HIDDEN bool _iban_val(TMask_field& f, KEY key)
} }
} }
} }
cin = m.get(id[2]); if (cc.full())
if (italy)
{ {
bcin = m.get(id[4]); cin = m.get(id[2]);
abi = m.get(id[5]); if (italy)
cab = m.get(id[6]);
}
build_IBAN(iban, iso, cin, bcin, abi, cab, cc);
const int err = iban_check(iban, msg);
if (err != 0)
{
msg.insert(TR("Codice IBAN errato:\n"));
if (err > 1) // Errore grave
ok = error_box(msg);
else
{ {
msg << '\n' << TR("Si desidera continuare ugualmente?"); bcin = m.get(id[4]);
ok = yesno_box(msg); abi = m.get(id[5]);
cab = m.get(id[6]);
}
build_IBAN(iban, iso, cin, bcin, abi, cab, cc);
const int err = iban_check(iban, msg);
if (err != 0)
{
msg.insert(TR("Codice IBAN errato:\n"));
if (err > 1) // Errore grave
ok = error_box(msg);
else
{
msg << '\n' << TR("Si desidera continuare ugualmente?");
ok = yesno_box(msg);
}
} }
} }
m.set(id[0], ok ? iban : EMPTY_STRING); m.set(id[0], ok && cc.full() ? iban : EMPTY_STRING);
} }
} }
return ok; return ok;
@ -1175,5 +1183,3 @@ bool validate(
_parms = &parms; _parms = &parms;
return (fn >= 0 && fn < MAX_FUNC) ? _global_val_func[fn](f, k) : true; return (fn >= 0 && fn < MAX_FUNC) ? _global_val_func[fn](f, k) : true;
} }