Added sell commodity feature.
This commit is contained in:
@@ -25,6 +25,8 @@ void ShopService::addShopItem(QSharedPointer<Voucher> voucher, QSharedPointer<IS
|
||||
vItem->setVatType(item->vatType());
|
||||
|
||||
voucher->addItem(vItem);
|
||||
|
||||
updateRelatedItem(vItem.data(), count);
|
||||
}
|
||||
|
||||
void ShopService::calculate(QSharedPointer<Voucher> voucher)
|
||||
@@ -106,6 +108,18 @@ void ShopService::pay(QSharedPointer<Voucher> 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);
|
||||
}
|
||||
}
|
||||
|
||||
QList<QSharedPointer<Voucher> > ShopService::savedVouchers()
|
||||
{
|
||||
return all(QString("status = %1").arg(QString::number(Voucher::NOT_PAID)));
|
||||
|
||||
Reference in New Issue
Block a user