[Fix #9] Make article desc mandatory if sellerno is 0
This commit is contained in:
parent
4fb6d2f98b
commit
6c0441992f
3 changed files with 20 additions and 3 deletions
|
@ -260,6 +260,9 @@ void MainWindow::checkSellerNo(bool ctrlPressed)
|
||||||
auto seller = marketplace_->findSellerWithSellerNo(sellerNo);
|
auto seller = marketplace_->findSellerWithSellerNo(sellerNo);
|
||||||
if (seller) {
|
if (seller) {
|
||||||
PriceDialog priceDialog(this);
|
PriceDialog priceDialog(this);
|
||||||
|
if(sellerNo == 0) {
|
||||||
|
priceDialog.setForceDesc(true);
|
||||||
|
}
|
||||||
auto dialogResult = priceDialog.exec();
|
auto dialogResult = priceDialog.exec();
|
||||||
if (dialogResult == QDialog::Accepted) {
|
if (dialogResult == QDialog::Accepted) {
|
||||||
int price = priceDialog.getPrice();
|
int price = priceDialog.getPrice();
|
||||||
|
|
|
@ -4,8 +4,9 @@
|
||||||
|
|
||||||
#include <QMessageBox>
|
#include <QMessageBox>
|
||||||
|
|
||||||
PriceDialog::PriceDialog(QWidget* parent, Qt::WindowFlags f) : QDialog(parent, f)
|
PriceDialog::PriceDialog(QWidget* parent, bool forceDesc, Qt::WindowFlags f) : QDialog(parent, f)
|
||||||
{
|
{
|
||||||
|
forceDesc_ = forceDesc;
|
||||||
ui_.setupUi(this);
|
ui_.setupUi(this);
|
||||||
ui_.priceSpinBox->setFocus();
|
ui_.priceSpinBox->setFocus();
|
||||||
}
|
}
|
||||||
|
@ -21,7 +22,18 @@ void PriceDialog::accept()
|
||||||
"Es sind nur 0,50 Cent-Schritte erlaubt.", QMessageBox::StandardButton::Ok,
|
"Es sind nur 0,50 Cent-Schritte erlaubt.", QMessageBox::StandardButton::Ok,
|
||||||
this)
|
this)
|
||||||
.exec();
|
.exec();
|
||||||
|
} else if (forceDesc_ && ui_.descEdit->text().trimmed().isEmpty()) {
|
||||||
|
QMessageBox(QMessageBox::Icon::Warning, "Artikelbeschreibung fehlt",
|
||||||
|
"Da Sie auf das Sonderkonto buchen ist eine Artikelbeschreibung erforderlich.",
|
||||||
|
QMessageBox::StandardButton::Ok, this)
|
||||||
|
.exec();
|
||||||
|
ui_.descEdit->setFocus();
|
||||||
} else {
|
} else {
|
||||||
QDialog::accept();
|
QDialog::accept();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void PriceDialog::setForceDesc(bool force)
|
||||||
|
{
|
||||||
|
forceDesc_ = force;
|
||||||
|
}
|
|
@ -10,15 +10,17 @@ class PriceDialog : public QDialog
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
|
|
||||||
public:
|
public:
|
||||||
PriceDialog(QWidget* parent = nullptr,
|
PriceDialog(QWidget* parent = nullptr, bool forceDesc = false,
|
||||||
Qt::WindowFlags f = Qt::WindowTitleHint | Qt::WindowSystemMenuHint);
|
Qt::WindowFlags f = Qt::WindowTitleHint | Qt::WindowSystemMenuHint);
|
||||||
int getPrice() const;
|
int getPrice() const;
|
||||||
std::string getDescription() const;
|
std::string getDescription() const;
|
||||||
|
void setForceDesc(bool force);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
void on_model_duplicateSellerNo(const QString& message);
|
void on_model_duplicateSellerNo(const QString& message);
|
||||||
virtual void accept() override;
|
virtual void accept() override;
|
||||||
Ui::PriceDialog ui_;
|
Ui::PriceDialog ui_;
|
||||||
|
bool forceDesc_;
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif
|
#endif
|
Loading…
Reference in a new issue