Corretti errori MI5038 e MI5042

git-svn-id: svn://10.65.10.50/trunk@560 c028cbd2-c16b-5b4b-a496-9718f37d4682
This commit is contained in:
alex 1994-11-08 09:04:32 +00:00
parent 5a7b03a3b2
commit 322bb648f8

View File

@ -67,8 +67,8 @@ HIDDEN bool _emptycopy_val(TEdit_field& f, KEY)
bool pi_check(const char * st, const char * paiva)
{
int tot = 0, y;
TFixed_string stato (st);
TFixed_string pi (paiva);
TString16 stato (st);
TString16 pi (paiva);
if ((stato.not_empty()) && (stato != "IT")) return TRUE;
if (pi.empty()) return TRUE;
@ -100,6 +100,8 @@ bool pi_check(const char * st, const char * paiva)
// Controlla la partita iva se e' non vuota ed italiana
HIDDEN bool _pi_val(TEdit_field& f, KEY)
{
if (f.mask().query_mode()) return TRUE;
TString16 stato(f.mask().get(atoi(get_val_param(0)))), pi(f.get());
if (stato.not_empty() && stato != "IT") return TRUE;
@ -126,7 +128,7 @@ HIDDEN bool _pi_val(TEdit_field& f, KEY)
HIDDEN bool __cf_check (const char * codcf)
{
const TFixed_string cf (codcf);
const TString16 cf (codcf);
if (cf.len() != 16) return FALSE;
const TFixed_string tab("ABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789");
@ -185,10 +187,10 @@ HIDDEN bool __cf_check (const char * codcf)
bool cf_check (const char * stato, const char * codcf)
{
TFixed_string cf (codcf);
TString16 cf (codcf);
if (cf.empty())
return TRUE;
const bool ok = (cf.len() == 11) ? pi_check(stato, cf) : __cf_check(cf);
const bool ok = (cf.len() == 11 && isdigit(cf[0])) ? pi_check(stato, cf) : __cf_check(cf);
return ok;
}
@ -197,12 +199,19 @@ HIDDEN bool _cf_val(TEdit_field& f, KEY key)
{
if (f.mask().query_mode()) return TRUE;
const TFixed_string cf(f.get());
if (cf.empty()) return TRUE;
if (cf.len() == 11)
return _pi_val(f, key);
const TString16 cf(f.get());
bool ok = TRUE;
bool ok = __cf_check(cf);
if (cf.empty()) return TRUE;
if (cf.len() == 11 && isdigit(cf[0]))
{
TString16 stato(f.mask().get(atoi(get_val_param(0))));
if (stato.not_empty() && stato != "IT") return TRUE;
ok = pi_check (stato, cf);
}
else
ok = __cf_check(cf);
if (!ok)
{
if(f.dirty())
@ -285,11 +294,12 @@ HIDDEN bool _xt_cf_val(TEdit_field& f, KEY key)
if (!_cf_val(f, key)) return FALSE;
if (cf.len() == 11)
if (cf.len() == 11 && isdigit(cf[0]))
{
if (!_xt_pi_val(f, key)) return FALSE;
TString16 stato(f.mask().get(atoi(get_val_param(0))));
if ((stato.not_empty()) && (stato != "IT")) return TRUE;
// if (!_xt_pi_val(f, key)) return FALSE;
// TString16 stato(f.mask().get(atoi(get_val_param(0))));
// if ((stato.not_empty()) && (stato != "IT")) return TRUE;
return TRUE;
}
bool passed = __cf_check(cf);