Compare commits

...

2 commits

3 changed files with 6 additions and 4 deletions

View file

@ -106,10 +106,10 @@ void JsonUtil::exportSales(const std::string& filename, Marketplace* market, int
writer->write(root, &file);
}
void JsonUtil::importSales(const std::string& filename, Marketplace* market, int cashPointNo)
void JsonUtil::importSales(const std::filesystem::path& filePath, Marketplace* market, int cashPointNo)
{
Json::Value jsonValues;
std::ifstream file(filename);
std::ifstream file(filePath);
file >> jsonValues;
int source_no = jsonValues["source_no"].asInt();

View file

@ -12,7 +12,7 @@ class JsonUtil
static void exportSellers(const std::string& filename, Marketplace* market);
static void importSellers(const std::filesystem::path& filePath, Marketplace* market);
static void exportSales(const std::string& filename, Marketplace* market, int cashPointNo);
static void importSales(const std::string& filename, Marketplace* market, int cashPointNo);
static void importSales(const std::filesystem::path& filePath, Marketplace* market, int cashPointNo);
};
#endif

View file

@ -439,9 +439,11 @@ void MainWindow::onImportSalesJsonActionTriggered()
if (filename.isEmpty())
return;
std::filesystem::path filePath(filename.toStdWString());
delete ui_.salesView->model();
try {
JsonUtil::importSales(filename.toStdString(), marketplace_.get(),
JsonUtil::importSales(filePath, marketplace_.get(),
settings.value("global/cashPointNo").toInt());
} catch (std::runtime_error& err) {
QMessageBox(QMessageBox::Icon::Warning, "Import nicht möglich", err.what(), QMessageBox::Ok,