Compare commits

..

No commits in common. "be1d731de3aa4430c1b06a6e52d44df77a55183b" and "7d98033c4aaf8a388032f65e5f11958e32a50bdb" have entirely different histories.

3 changed files with 4 additions and 6 deletions

View file

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

View file

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