Patch level : 12.0 nopatch

Files correlati     :
Commento        :

Si possono scrivere warning nelle maschere inserendo i valori dei campi

Interno:
I doppi apici non sono più indispensabili

Es.
negli uml
WARNING La combinazione numerazione #F_CODNUM tipo documento #THIS_FIELD non è corretta
Il Cliente #THIS_FIELD non esiste
This commit is contained in:
Alessandro Bonazzi 2021-10-21 22:23:50 +02:00
parent 61aee7848b
commit 1e878418b7
2 changed files with 27 additions and 3 deletions

View File

@ -1629,7 +1629,31 @@ void TEditable_field::test_drivers() const
// Ritorna il messaggio d'errore associato al campo
const char* TEditable_field::get_warning() const
{ return _warning ? (const char*)*_warning : ""; }
{
TString & msg = get_tmp_string(255);
TString str(_warning != nullptr ? *_warning : EMPTY_STRING);
int pos;
while ((pos = str.find("#")) >= 0)
{
if (pos > 0)
msg << str.left(pos);
int space_pos = str.find(" ", pos);
short fld = atoi(str.mid(pos + 1, space_pos - pos - 1));
if (fld == 0)
msg << get();
else
msg << mask().get(fld);
if (space_pos >= 0)
str.ltrim(space_pos);
else
str.cut(0);
}
msg << str;
return msg;
}
bool TEditable_field::parse_item(TScanner& scanner)
{
@ -1713,7 +1737,7 @@ bool TEditable_field::parse_item(TScanner& scanner)
if (scanner.key() == "WA")
{
const char* msg = dictionary_translate(scanner.string());
const char* msg = dictionary_translate(scanner.line());
set_warning(msg);
return true;
}

View File

@ -671,7 +671,7 @@ const char * TTransaction::record_header(const char * msg) const
str << get(fld, -1, _executer) << " ";
}
else
str << get(m.mid(pos + 1, space_pos - pos - 1), -1, _executer);
str << get(fld, -1, _executer);
if (space_pos >= 0)
m.ltrim(space_pos);
else