From 32d0ec7749ae3582041ebc3bfb962883e31880f3 Mon Sep 17 00:00:00 2001 From: Martin Brodbeck Date: Tue, 23 Jan 2024 10:39:43 +0100 Subject: [PATCH 1/2] Allow import of multiple sales at once. --- src/core/jsonutil.cpp | 6 ++++-- src/gui/mainwindow.cpp | 27 +++++++++++++++------------ 2 files changed, 19 insertions(+), 14 deletions(-) diff --git a/src/core/jsonutil.cpp b/src/core/jsonutil.cpp index bd24b4e..095a7b0 100644 --- a/src/core/jsonutil.cpp +++ b/src/core/jsonutil.cpp @@ -102,8 +102,10 @@ void JsonUtil::importSales(const std::filesystem::path &filePath, Marketplace *m int source_no = jsonValues["source_no"]; if (source_no == cashPointNo) { - throw std::runtime_error("Die Kassen-Nr. der zu imporierenden Daten wird von dieser Kasse " - "hier bereits verwendet."); + std::string ret = "Die Kassen-Nr. "; + ret += std::to_string(source_no); + ret += " der zu imporierenden Daten wird von dieser Kasse hier bereits verwendet."; + throw std::runtime_error(ret); } market->setSalesToDelete(jsonValues["source_no"]); diff --git a/src/gui/mainwindow.cpp b/src/gui/mainwindow.cpp index d61a95e..a94b7f1 100644 --- a/src/gui/mainwindow.cpp +++ b/src/gui/mainwindow.cpp @@ -504,27 +504,30 @@ void MainWindow::onImportSalesJsonActionTriggered() { QSettings settings; - auto filename = QFileDialog::getOpenFileName(this, "Umsätze/Transaktionen importieren", + auto filenames = QFileDialog::getOpenFileNames(this, "Umsätze/Transaktionen importieren", QString(), "JSON Dateien (*.json)"); - if (filename.isEmpty()) + if (filenames.isEmpty()) return; + for(auto filename: filenames) { #if defined(_WIN64) || defined(_WIN32) - fs::path filePath(filename.toStdWString()); + fs::path filePath(filename.toStdWString()); #else - fs::path filePath(filename.toStdString()); + fs::path filePath(filename.toStdString()); #endif - delete m_ui.salesView->model(); - try { - JsonUtil::importSales(filePath, m_marketplace.get(), - settings.value("global/cashPointNo").toInt()); - } catch (std::runtime_error &err) { - QMessageBox(QMessageBox::Icon::Warning, "Import nicht möglich", err.what(), QMessageBox::Ok, - this) - .exec(); + delete m_ui.salesView->model(); + try { + JsonUtil::importSales(filePath, m_marketplace.get(), + settings.value("global/cashPointNo").toInt()); + } catch (std::runtime_error &err) { + QMessageBox(QMessageBox::Icon::Warning, "Import nicht möglich", err.what(), QMessageBox::Ok, + this) + .exec(); + } } + setSaleModel(); updateStatLabel(); } From 7f11ba4e5d715f14d6723c729d748e8d3473a057 Mon Sep 17 00:00:00 2001 From: Martin Brodbeck Date: Tue, 23 Jan 2024 10:42:04 +0100 Subject: [PATCH 2/2] new version 1.8.0 --- CMakeLists.txt | 2 +- de.rustysoft.kima2.metainfo.xml.in | 4 ++-- meson.build | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 57f98d9..d74482a 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1,6 +1,6 @@ cmake_minimum_required(VERSION 3.10) -project(kima2 VERSION 1.7.2) +project(kima2 VERSION 1.8.0) set(CMAKE_MODULE_PATH "${CMAKE_HOME_DIRECTORY}/cmake") diff --git a/de.rustysoft.kima2.metainfo.xml.in b/de.rustysoft.kima2.metainfo.xml.in index d70963a..9f228f7 100644 --- a/de.rustysoft.kima2.metainfo.xml.in +++ b/de.rustysoft.kima2.metainfo.xml.in @@ -9,12 +9,12 @@ GPL-3.0-or-later - +

- A small cash point program for children’s stuff markets. German language only. + A small cash point program for children's stuff markets. German language only.

diff --git a/meson.build b/meson.build index a0f8b23..0f06586 100644 --- a/meson.build +++ b/meson.build @@ -1,4 +1,4 @@ -project('kima2', 'cpp', default_options : ['cpp_std=c++20'], version : '1.6.1') +project('kima2', 'cpp', default_options : ['cpp_std=c++20'], version : '1.8.0') conf_data = configuration_data() conf_data.set('PROJECT_VERSION', '"' + meson.project_version() + '"')