Patch level : 10.0

Files correlati     : cg0
Ricompilazione Demo : [ ]
Commento            :
Migliorato controllo di congruenza tra codice fiscale e sesso


git-svn-id: svn://10.65.10.50/branches/R_10_00@21794 c028cbd2-c16b-5b4b-a496-9718f37d4682
This commit is contained in:
guy 2011-03-15 14:09:37 +00:00
parent 2b40852824
commit 95a1a7ecb8
2 changed files with 12 additions and 10 deletions

View File

@ -1689,6 +1689,7 @@ TCursor::TCursor(TRelation* r, const char* fil, int nkey,
: _if(r), _nkey(nkey), _fexpr(NULL), _frozen(false), _filter_update(false),
_filterfunction_update(false), _filter_limit(0), _filterfunction(NULL)
{
CHECK(r, "Null cursor relation");
file().setkey(_nkey);
_pos = 0;
_totrec = 0;

View File

@ -449,8 +449,8 @@ HIDDEN bool _xt_cf_val(TMask_field& f, KEY key)
if ((sesso == 'F' && gn < 40) || (sesso == 'M' && gn > 40))
{
passed = passed = fld_sex.yesno_box(TR("Sesso non congruente al codice fiscale:\n"
"correzione automatica?"));
if (data.full()) // Non dare segnalazioni inutili sul sesso se manca la data di nascita
passed = fld_sex.yesno_box(TR("Sesso incongruente col codice fiscale:\ncorrezione automatica?"));
if (passed) fld_sex.set(sesso == 'M' ? "F" : "M");
else return true;
}
@ -459,7 +459,7 @@ HIDDEN bool _xt_cf_val(TMask_field& f, KEY key)
// Controllo data di nascita
wm = "ABCDEHLMPRST";
if (data.not_empty())
if (data.full())
{
const TDate d(data);
int err = 0;
@ -472,8 +472,9 @@ HIDDEN bool _xt_cf_val(TMask_field& f, KEY key)
if (err != 0)
{
const char* const what = err==1 ? TR("Anno") : (err==2 ? TR("Mese") : TR("Giorno"));
passed = fld_dat.yesno_box(FR("%s di nascita non congruente al codice fiscale: correzione automatica?"), what);
if (passed) data.cut(0);
passed = fld_dat.yesno_box(FR("%s di nascita incongruente col codice fiscale:\ncorrezione automatica?"), what);
if (passed)
data.cut(0);
else return true;
}
}
@ -484,7 +485,7 @@ HIDDEN bool _xt_cf_val(TMask_field& f, KEY key)
if (mn > 0)
{
int anno = atoi(cf.mid(6, 2));
anno += anno < 5 ? 2000 : 1900;
anno += anno < 10 ? 2000 : 1900;
const TDate d(gn, mn, anno);
fld_dat.set(d.string());
}
@ -494,7 +495,7 @@ HIDDEN bool _xt_cf_val(TMask_field& f, KEY key)
const char* const codcom = cf.mid(11, 4);
if (com.full() && com != codcom)
{
passed = fld_com.yesno_box(TR("Comune non congruente al codice fiscale: correzione automatica?"));
passed = fld_com.yesno_box(TR("Comune incongruente col codice fiscale:\ncorrezione automatica?"));
if (passed) com.cut(0);
else return true;
}
@ -550,7 +551,7 @@ HIDDEN bool _fixlen_val(TMask_field& f, KEY)
const int length = get_int_val_param(0);
const bool ok = s.len() == length;
if (!ok)
f.error_box(FR("La lunghezza del campo deve essere %d"), length);
f.error_box(FR("La lunghezza del campo deve essere %d caratteri"), length);
return ok;
}
@ -631,7 +632,7 @@ HIDDEN bool _numcalc_val(TMask_field& f, KEY k)
if (s[0] != '#')
{
TString err; err << "Cannot load variable " << s << " in " << e;
TString err; err << "Can't load variable " << s << " in " << e;
return f.error_box((const char*)err);
}
e.setvar(i, f.evaluate_field(s));
@ -652,7 +653,7 @@ HIDDEN bool _strcalc_val(TMask_field& f, KEY k)
const char* s = e.varname(i);
if (s[0] != '#')
{
TString err; err << "Cannot load variable " << s << " in " << e;
TString err; err << "Can't load variable " << s << " in " << e;
return f.error_box((const char*)err);
}
e.setvar(i, f.evaluate_field(s));