diff --git a/src/fp/fplib01.cpp b/src/fp/fplib01.cpp index 7c692157e..b1a6129bc 100644 --- a/src/fp/fplib01.cpp +++ b/src/fp/fplib01.cpp @@ -1024,15 +1024,27 @@ bool TDoc_fp::initialize(TDocumentoEsteso& doc) } const TRectype& TDoc_fp::cco(const TRectype& doc) const { - TString80 conkey; - const TString& con = doc.get(DOC_CONTRATTO); - if (con.full()) - { - char tcon = doc.get_char(DOC_MODPAG); - if (tcon < 'C') tcon = 'C'; - conkey.format("%c%6ld%s", tcon, doc.get_long(DOC_CODCF), static_cast(con)); - } - return cache().get("&CON", conkey); + TString80 conkey; + const TString& con = doc.get(DOC_CONTRATTO); + if (con.full()) + { + char tcon = doc.get_char(DOC_MODPAG); + if (tcon < 'C') tcon = 'C'; + conkey.format("%c%6ld%s", tcon, doc.get_long(DOC_CODCF), static_cast(con)); + } + + static TLocalisamfile tabmod(LF_TABMOD); + // Controllo se non sono già sul record, così evito read inutili + // Lo sto facendo a mano perchè usare cache() metterebbe FP nella colonna "MOD" + if (tabmod.get("MOD") != "PA" || tabmod.get("COD") != "CON" || tabmod.get("CODTAB") != conkey) + { + tabmod.zero(); + tabmod.put("MOD", "PA"); + tabmod.put("COD", "CON"); + tabmod.put("CODTAB", conkey); + tabmod.read(); + } + return tabmod.curr(); } void TDoc_fp::log(int severity, const char* msg) { @@ -1573,7 +1585,15 @@ bool TDoc_fp::doc_to_paf(TDocumentoEsteso& doc) // Fuori dallo scope per dopo const TString16 cup = doc.get(DOC_CUP); const TString16 cig = doc.get(DOC_CIG); - const TString80 com = doc.get(DOC_CODCMS); + + // Codice commessa, spostato nel campo S5 di TABCOM + TString80 com = cco(doc).get("S5"); + // Se è una commessa della sanità bisogna aggiungere un cancelletto davanti e dietro + if(cco(doc).get_bool("B0")) + { + com.add_front_and_back("#"); + } + // SEMPRE // Azzera contratti TPaf_record& paf1000f = _paf_container.get_paf("PAF1000F"); diff --git a/src/fp/fplib05.cpp b/src/fp/fplib05.cpp index 06bc344f3..3874dd69d 100644 --- a/src/fp/fplib05.cpp +++ b/src/fp/fplib05.cpp @@ -639,8 +639,6 @@ TVariant& TFP_expression::parse_search(const TString& str, TRiga_documento& rdoc { return get_value(cache().get(tabella, search, key), campo); } - else - { - return get_value(cache().get(file, search, key), campo); - } + + return get_value(cache().get(file, search, key), campo); }