From 12dd6ddba09eedaf6b29b1ce2948917b7ddd69d1 Mon Sep 17 00:00:00 2001 From: Josef Rokos Date: Mon, 5 Jun 2023 22:31:59 +0200 Subject: [PATCH] Fixed loading of saved vouchers. --- core/service.h | 2 +- shop/shopservice.cpp | 7 +++---- 2 files changed, 4 insertions(+), 5 deletions(-) diff --git a/core/service.h b/core/service.h index 69c9d78..6dcf5ac 100644 --- a/core/service.h +++ b/core/service.h @@ -156,7 +156,7 @@ public: pSession = ptrSession.data(); } - *pSession += qx::dao::delete_by_id(entity); + *pSession += qx::dao::delete_by_id(entity, pSession->database()); if (!pSession->isValid()) { qDebug() << pSession->firstError().text(); diff --git a/shop/shopservice.cpp b/shop/shopservice.cpp index 9e17a10..ce77cb1 100644 --- a/shop/shopservice.cpp +++ b/shop/shopservice.cpp @@ -60,10 +60,6 @@ void ShopService::calculate(VoucherPtr voucher) loadSettings(); - if (voucher->items().isEmpty()) { - load(voucher); - } - foreach (QSharedPointer item, voucher->items()) { if (item->refId() == ROUNDING_ITEM) @@ -384,6 +380,9 @@ void ShopService::moveItems(QList items, VoucherPtr source, Vouc it->setVoucher(target); } + calculate(target); + update(target, &session); + if (source->items().isEmpty()) { erase(source, &session);