From: <sie...@us...> - 2014-03-24 01:26:34
|
Revision: 6238 http://sourceforge.net/p/moneymanagerex/code/6238 Author: siena123 Date: 2014-03-24 01:26:28 +0000 (Mon, 24 Mar 2014) Log Message: ----------- Fix currency error message on new database Modified Paths: -------------- trunk/src/model/Model_Currency.cpp trunk/src/model/Model_Currency.h Modified: trunk/src/model/Model_Currency.cpp =================================================================== --- trunk/src/model/Model_Currency.cpp 2014-03-24 01:26:01 UTC (rev 6237) +++ trunk/src/model/Model_Currency.cpp 2014-03-24 01:26:28 UTC (rev 6238) @@ -19,6 +19,7 @@ #include "Model_Currency.h" #include <wx/numformatter.h> +bool Model_Currency::init_currencies_ = false; Model_Currency::Model_Currency() : Model<DB_Table_CURRENCYFORMATS_V1>() @@ -37,9 +38,9 @@ { Model_Currency& ins = Singleton<Model_Currency>::instance(); ins.db_ = db; - bool init_currencies = !ins.exists(db); + init_currencies_ = !ins.exists(db); ins.ensure(db); - if (init_currencies) + if (init_currencies_) { ins.initialize(); // Initialises currency data in database. } @@ -98,7 +99,7 @@ if (currency) { return currency; } - else + else if (!init_currencies_) { wxASSERT(false); //Base Currency ID is invalid for (const auto c : Model_Currency::instance().all()) @@ -121,6 +122,7 @@ void Model_Currency::SetBaseCurrency(Data* r) { + init_currencies_ = false; Model_Infotable::instance().SetBaseCurrencyID(r->CURRENCYID); } Modified: trunk/src/model/Model_Currency.h =================================================================== --- trunk/src/model/Model_Currency.h 2014-03-24 01:26:01 UTC (rev 6237) +++ trunk/src/model/Model_Currency.h 2014-03-24 01:26:28 UTC (rev 6238) @@ -46,6 +46,7 @@ static Model_Currency& instance(); private: + static bool init_currencies_; void initialize(); public: This was sent by MMEX an easy to use, money management application. |