Added setting for default VAT type on Direct sell dialog. Fixed some compiler warnings.
This commit is contained in:
+11
-8
@@ -190,17 +190,17 @@ void ShopForm::loadButtons()
|
||||
btn->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Fixed);
|
||||
((QGridLayout*)ui->favorites->layout())->addWidget(btn, i + 1, j);
|
||||
|
||||
if (btnMap[btnName] != NULL)
|
||||
if (btnMap[btnName] != nullptr)
|
||||
{
|
||||
btn->setText(btnMap[btnName]->shortName());
|
||||
connect(btn, &FavButton::clicked, [this, btnMap, btn](bool){
|
||||
FavoritItemPtr item = btnMap[btn->objectName()];
|
||||
|
||||
IPlugin *plugin = Context::instance().plugin(item->pluginId());
|
||||
IService *service = (plugin != NULL ? plugin->service<IService>() : NULL);
|
||||
IService *service = (plugin != nullptr ? plugin->service<IService>() : nullptr);
|
||||
ISellableService *selSrv = dynamic_cast<ISellableService*>(service);
|
||||
|
||||
if (selSrv != NULL)
|
||||
if (selSrv != nullptr)
|
||||
{
|
||||
addItem(selSrv->shopItem(item->refId()), 1);
|
||||
}
|
||||
@@ -236,7 +236,10 @@ void ShopForm::setEetStatusText(const QString &statusText)
|
||||
|
||||
void ShopForm::on_directSale_clicked()
|
||||
{
|
||||
DirectSaleForm *form = new DirectSaleForm(this);
|
||||
SettingsService srv("SHOP");
|
||||
ShopSettingsPtr settings = srv.loadSettings<ShopSettings>();
|
||||
|
||||
DirectSaleForm *form = new DirectSaleForm(this, settings->defaultVat());
|
||||
form->setAttribute(Qt::WA_DeleteOnClose);
|
||||
|
||||
connect(form, &QDialog::accepted, [this, form](){
|
||||
@@ -316,7 +319,7 @@ void ShopForm::on_loadButton_clicked()
|
||||
void ShopForm::onCountChanged(int oldCount/* = 0*/)
|
||||
{
|
||||
VoucherItem *item = qobject_cast<VoucherItem*>(sender());
|
||||
if (item != NULL && item->count() == 0)
|
||||
if (item != nullptr && item->count() == 0)
|
||||
{
|
||||
for (int i = 0; i < m_voucher->items().count(); i++)
|
||||
{
|
||||
@@ -346,7 +349,7 @@ void ShopForm::onCountChanged(int oldCount/* = 0*/)
|
||||
srv.updateVoucher(m_voucher);
|
||||
}
|
||||
|
||||
if (item != NULL)
|
||||
if (item != nullptr)
|
||||
{
|
||||
int countAdded = item->count() - oldCount;
|
||||
srv.updateRelatedItem(item, countAdded);
|
||||
@@ -437,7 +440,7 @@ void ShopForm::addItem(QSharedPointer<IShopItem> item, int count)
|
||||
}
|
||||
|
||||
IPlugin *plugin = Context::instance().plugin(item->pluginId());
|
||||
IService *service = (plugin != NULL ? plugin->service<IService>() : NULL);
|
||||
IService *service = (plugin != nullptr ? plugin->service<IService>() : nullptr);
|
||||
ISellableService *selSrv = dynamic_cast<ISellableService*>(service);
|
||||
|
||||
auto addFunc = [this](QSharedPointer<IShopItem> shopItem, int itemCount){
|
||||
@@ -448,7 +451,7 @@ void ShopForm::addItem(QSharedPointer<IShopItem> item, int count)
|
||||
onCountChanged();
|
||||
};
|
||||
|
||||
if (selSrv != NULL && selSrv->seller() != NULL)
|
||||
if (selSrv != nullptr && selSrv->seller() != nullptr)
|
||||
{
|
||||
ISeller *seller = selSrv->seller();
|
||||
|
||||
|
||||
Reference in New Issue
Block a user