Fixed loading of saved vouchers.

master
Josef Rokos 1 year ago
parent de2bab90de
commit 12dd6ddba0

@ -156,7 +156,7 @@ public:
pSession = ptrSession.data(); pSession = ptrSession.data();
} }
*pSession += qx::dao::delete_by_id(entity); *pSession += qx::dao::delete_by_id(entity, pSession->database());
if (!pSession->isValid()) { if (!pSession->isValid()) {
qDebug() << pSession->firstError().text(); qDebug() << pSession->firstError().text();

@ -60,10 +60,6 @@ void ShopService::calculate(VoucherPtr voucher)
loadSettings(); loadSettings();
if (voucher->items().isEmpty()) {
load(voucher);
}
foreach (QSharedPointer<VoucherItem> item, voucher->items()) { foreach (QSharedPointer<VoucherItem> item, voucher->items()) {
if (item->refId() == ROUNDING_ITEM) if (item->refId() == ROUNDING_ITEM)
@ -384,6 +380,9 @@ void ShopService::moveItems(QList<VoucherItemPtr> items, VoucherPtr source, Vouc
it->setVoucher(target); it->setVoucher(target);
} }
calculate(target);
update(target, &session);
if (source->items().isEmpty()) if (source->items().isEmpty())
{ {
erase(source, &session); erase(source, &session);

Loading…
Cancel
Save