Patch level : 12.0 770

Files correlati     : cg2100
Commento            :
- Corretti controllo modulo FP
- Correto caricamento campo PROTFPPRO sulle maschere
This commit is contained in:
Simone Palacino 2019-04-15 15:47:57 +02:00
parent a112d712db
commit 58955e8fa7
3 changed files with 26 additions and 26 deletions

View File

@ -123,7 +123,7 @@ TMask* TPrimanota_application::load_mask(int n)
ism.set_handler(309, sheet_clifo_handler);
ism.set_handler(CG_RATEO, sheet_rateo_handler);
ism.set_handler(CG_RISCONTO, sheet_risconto_handler);
if (!is_fp())
if (!is_fp(m))
m->hide(F_PROTFPPRO);
else
{
@ -1049,7 +1049,7 @@ void TPrimanota_application::init_modify_mode(TMask& m)
m.enable(F_BOLLACODCLI, causale().tipo_doc() == "BD");
m.enable(F_BOLLARAGCLI, causale().tipo_doc() == "BD");
}
if(!m.field(F_PROTFPPRO).hidden())
if(m.find_by_id(F_PROTFPPRO) != NULL && !m.field(F_PROTFPPRO).hidden())
m.set(F_PROTFPPRO, mov.get(MOV_PROGFPPRO));
}
@ -1564,14 +1564,14 @@ int TPrimanota_application::rewrite(const TMask& m)
return err;
}
void TPrimanota_application::clean_fppro() const
void TPrimanota_application::clean_fppro()
{
TMask& msk = curr_mask();
const KEY last_key = msk.last_key();
// Controlli: solo in mod modifica; che abbia fp (no F8); che non sono in salvataggio
if (_mode != MODE_MOD
|| !is_fp()
|| !is_fp(&msk)
|| last_key != 127 && last_key != K_SAVE)
return;
@ -1586,12 +1586,17 @@ void TPrimanota_application::clean_fppro() const
fp_db().sq_commit();
}
bool TPrimanota_application::is_fp()
bool TPrimanota_application::is_fp(TMask* m)
{
return fexist("fp0.exe") && !fp_settings().get_db_indirizzo().empty() && !fp_settings().is_f8();
static bool is_set_fpcheck = false;
if (!is_set_fpcheck)
{
_isfp = has_module(FPAUT) && !fp_settings().get_db_indirizzo().empty() && !fp_settings().is_f8();
is_set_fpcheck = true;
}
return _isfp;
}
bool TPrimanota_application::remove()
{
const bool ok = TRelation_application::remove();
@ -2336,13 +2341,13 @@ void TPrimanota_application::mask2ini(const TMask& msk, TConfig& ini)
}
}
int TPrimanota_application::save_fppro() const
int TPrimanota_application::save_fppro()
{
TMask& msk = curr_mask();
const KEY last = msk.last_key();
// Provo a vedere se hanno l'FP: se c'è l'indirizzo controllo che non sia F8 se non c'è non hanno l'FP
if (!is_fp())
if (!is_fp(&msk))
return pro_nofp;
if (!fp_db().sq_is_connect())
{
@ -2379,7 +2384,7 @@ int TPrimanota_application::save_fppro() const
TLocalisamfile clifo(LF_CAUSALI);
clifo.setkey(1);
clifo.put("CODCAUS", msk.get(F_CODCAUS));
if (clifo.read() != NOERR && clifo.get("TIPODOC") != "FA")
if (clifo.read() != NOERR || clifo.get("TIPODOC") != "FA")
return pro_notsaved;
if (last != K_SAVE) { // Se sto uscendo avvertimento di non salvataggio e salto
message_box("La registrazione del movimento non verrà salvata sul database.");

View File

@ -3827,10 +3827,9 @@ bool TPrimanota_application::quadratura_handler(TMask_field& f, KEY key)
bool TPrimanota_application::fppro_mask(TMask_field& f, KEY key)
{
if (!is_fp() || key != K_SPACE && key != K_TAB)
return true;
TMask& cg_msk = f.mask();
if (!app().get_isfp() || key != K_SPACE && key != K_TAB)
return true;
auto msk = std::make_shared<TPro_msk>(cg_msk);
//load_list(msk, key);
@ -3853,16 +3852,14 @@ bool TPrimanota_application::fppro_mask(TMask_field& f, KEY key)
bool TPro_msk::load_fppro_mask(TMask* msk, KEY k)
{
// Provo a vedere se hanno l'FP: se c'è l'indirizzo controllo che non sia F8 se non c'è non hanno l'FP
if (k != 32 || !is_fp())
if (k != 32)
return false;
if (!fp_db().sq_is_connect())
{
message_box("Attenzione connessione al database non riuscita.\nImpossibile collegarsi ai documenti in entrata.");
return false;
}
const int forn = msk->get_int(F_CODCLIFORS);
if (forn == 0)
{
@ -3995,11 +3992,6 @@ bool TPro_msk::on_field_event(TOperable_field& o, TField_event e, long jolly)
return true;
}
bool TPro_msk::is_fp()
{
return fexist("fp0.exe") && !fp_settings().get_db_indirizzo().empty() && !fp_settings().is_f8();
}
TPro_msk::TPro_msk(TMask& cg_msk) : TAutomask("cg2fppro"), _parent_mask(cg_msk)
{
TMask::set_handler(DLG_CONFIG, fppro_handler);

View File

@ -93,7 +93,8 @@ class TPrimanota_application : public TRelation_application
TEsercizi_contabili _esercizi; // Tabella degli esercizi contabili
TAssoc_array _colori; // Colori delle righe
bool _isfp;
static bool showpartite_handler(TMask_field& f, KEY k);
static bool speserimb_handler(TMask_field& f, KEY k);
static bool altrespese_handler(TMask_field& f, KEY k);
@ -195,12 +196,12 @@ protected: // TApplication
// Metodi per aggancio FPPRO (solo su operazioni di Fattura di Acquisto)
// Salvo dati fornitore e registrazione contabile sul db FPPRO
int save_fppro() const;
int save_fppro();
// Salva sul movimento il riferimento al documento in FPPRO
bool save_dbmov() const;
// Pulisce il mov e db dai firerimenti FPPRO (in MODE_MOD per edit/delete)
void clean_fppro() const;
static bool is_fp();
void clean_fppro();
bool is_fp(TMask* m);
virtual bool save(bool check_dirty);
bool get_mask_swap_file(TFilename& name) const;
@ -344,6 +345,7 @@ public:
static char row_type(const TToken_string& s);
static bool iva_notify(TSheet_field& s, int r, KEY key);
static bool cg_notify(TSheet_field& s, int r, KEY key);
bool get_isfp() const { return _isfp; }
TMask * mask(CGMaskType type) { return _msk[type]; }
@ -363,6 +365,7 @@ public:
TSheet_field& pags() const;
TString_array& pag_rows() { return _pag_rows; }
TImporto get_cgs_imp(int n) const;
TPrimanota_application();
virtual ~TPrimanota_application() { }
@ -380,7 +383,7 @@ class TPro_msk : public TAutomask
void fppro_selfatt() const;
bool on_field_event(TOperable_field& o, TField_event e, long jolly) override;
public:
static bool is_fp();
//bool is_fp();
// Carica documenti FPPRO sulla maschera
static bool load_fppro_mask(TMask* msk, KEY k = 32);
TPro_msk() = delete;