This commit is contained in:
2016-08-03 18:32:48 +02:00
13 changed files with 120 additions and 21 deletions
+13
View File
@@ -25,6 +25,8 @@ void ShopService::addShopItem(VoucherPtr voucher, QSharedPointer<IShopItem> item
vItem->setVatType(item->vatType());
voucher->addItem(vItem);
updateRelatedItem(vItem.data(), count);
}
void ShopService::calculate(VoucherPtr voucher)
@@ -106,6 +108,17 @@ void ShopService::pay(VoucherPtr voucher)
tx.commit();
}
void ShopService::updateRelatedItem(VoucherItem* item, int countAdded)
{
IPlugin *plugin = Context::instance().plugin(item->itemPlugin());
IService *srv = (plugin != NULL ? plugin->service<IService>() : NULL);
ISellableService *selSrv = dynamic_cast<ISellableService*>(srv);
if (selSrv != NULL)
{
selSrv->addedToVoucher(item->refId(), countAdded);
}
}
void ShopService::moveItems(QList<VoucherItemPtr> items, VoucherPtr source, VoucherPtr target)
{
Transaction tx;