[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);
|
||||
if (seller) {
|
||||
PriceDialog priceDialog(this);
|
||||
if(sellerNo == 0) {
|
||||
priceDialog.setForceDesc(true);
|
||||
}
|
||||
auto dialogResult = priceDialog.exec();
|
||||
if (dialogResult == QDialog::Accepted) {
|
||||
int price = priceDialog.getPrice();
|
||||
|
|
|
@ -4,8 +4,9 @@
|
|||
|
||||
#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_.priceSpinBox->setFocus();
|
||||
}
|
||||
|
@ -21,7 +22,18 @@ void PriceDialog::accept()
|
|||
"Es sind nur 0,50 Cent-Schritte erlaubt.", QMessageBox::StandardButton::Ok,
|
||||
this)
|
||||
.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 {
|
||||
QDialog::accept();
|
||||
}
|
||||
}
|
||||
|
||||
void PriceDialog::setForceDesc(bool force)
|
||||
{
|
||||
forceDesc_ = force;
|
||||
}
|
|
@ -10,15 +10,17 @@ class PriceDialog : public QDialog
|
|||
Q_OBJECT
|
||||
|
||||
public:
|
||||
PriceDialog(QWidget* parent = nullptr,
|
||||
Qt::WindowFlags f = Qt::WindowTitleHint | Qt::WindowSystemMenuHint);
|
||||
PriceDialog(QWidget* parent = nullptr, bool forceDesc = false,
|
||||
Qt::WindowFlags f = Qt::WindowTitleHint | Qt::WindowSystemMenuHint);
|
||||
int getPrice() const;
|
||||
std::string getDescription() const;
|
||||
void setForceDesc(bool force);
|
||||
|
||||
private:
|
||||
void on_model_duplicateSellerNo(const QString& message);
|
||||
virtual void accept() override;
|
||||
Ui::PriceDialog ui_;
|
||||
bool forceDesc_;
|
||||
};
|
||||
|
||||
#endif
|
Loading…
Reference in a new issue