From 322bb648f80c91fa697b7f2b79f77094ca9b0fd0 Mon Sep 17 00:00:00 2001 From: alex Date: Tue, 8 Nov 1994 09:04:32 +0000 Subject: [PATCH] Corretti errori MI5038 e MI5042 git-svn-id: svn://10.65.10.50/trunk@560 c028cbd2-c16b-5b4b-a496-9718f37d4682 --- include/validate.cpp | 38 ++++++++++++++++++++++++-------------- 1 file changed, 24 insertions(+), 14 deletions(-) diff --git a/include/validate.cpp b/include/validate.cpp index c16f56c16..0896e68e2 100755 --- a/include/validate.cpp +++ b/include/validate.cpp @@ -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);