diff --git a/pe/pe1400.cpp b/pe/pe1400.cpp index a5604b821..8479da945 100644 --- a/pe/pe1400.cpp +++ b/pe/pe1400.cpp @@ -813,18 +813,18 @@ bool TPreventivo_emsk::on_dist_event(TOperable_field& o, TField_event e, long jo TPreventivo_tree& t = tree(); while (t.dett(_iddist, 0)) t.kill_node(); - TString80 codart, desc; const int last = rdist.last_row(); int n = 0; for (int r = rdist.first_row(); r > 0 && r <= last; r = rdist.succ_row(r)) { const TRectype& rd = rdist.row(r); - TRectype* rec = t.dett(_iddist, n++, true); - codart = rd.get(RDIST_CODCOMP); - rec->put(RDOC_CODART, codart); - desc = rd.get(RDIST_DESCR); + const TCodice_articolo codart = rd.get(RDIST_CODCOMP); + TString80 desc = rd.get(RDIST_DESCR); if (desc.empty()) desc = cache().get(LF_ANAMAG, codart, ANAMAG_DESCR); + + TRectype* rec = t.dett(_iddist, n++, true); + rec->put(RDOC_CODART, codart); rec->put(RDOC_DESCR, desc); rec->put(RDOC_UMQTA, rd.get(RDIST_UM)); rec->put(RDOC_QTA, rd.get(RDIST_EXPR)); @@ -1293,20 +1293,22 @@ TPreventivo_emsk::TPreventivo_emsk() : TPreventivo_msk("pe1400b"), _tree(NULL), if (_has_db) { TISAM_recordset dist("USE DIST"); - _has_db = dist.items() >= 5; + _has_db = dist.items() >= 4; } - if (!_has_db) + TMask& dist = sfield(F_DISTINTE).sheet_mask(); + TList_field& tipoa = dist.lfield(D_TIPOA); + const TToken_string cod = tipoa.get_codes(); + if (!_has_db && cod.items() >= 2) { - TMask& dist = sfield(F_DISTINTE).sheet_mask(); - TList_field& tipoa = dist.lfield(D_TIPOA); - TToken_string cod = tipoa.get_codes(); - TToken_string val = tipoa.get_values(); - if (cod.items() == 2) + TToken_string* m1 = tipoa.message(1); + tipoa.replace_items("A", TR("Articolo")); + if (m1 != NULL) { - cod.destroy(0); - val.destroy(0); - tipoa.replace_items(cod, val); + TToken_string* m0 = tipoa.message(0); + if (m0 != NULL) + *m0 = *m1; } + tipoa.disable(); } } diff --git a/pe/pe1400b.uml b/pe/pe1400b.uml index 37997b967..fdb4d5905 100644 --- a/pe/pe1400b.uml +++ b/pe/pe1400b.uml @@ -585,6 +585,7 @@ BEGIN MESSAGE HIDE,D_CODART|HIDE,D_DESART|SHOW,D_CODDIS|SHOW,D_DESDIS ITEM "A|Articolo" MESSAGE HIDE,D_CODDIS|HIDE,D_DESDIS|SHOW,D_CODART|SHOW,D_DESART + FLAGS "G" FIELD STATORIGA END