src/EditSupplier.cpp

Thu, 17 Feb 2022 21:41:52 +0100

author
Michiel Broek <mbroek@mbse.eu>
date
Thu, 17 Feb 2022 21:41:52 +0100
changeset 18
d0ca50776b0b
parent 17
f0bcdbd3d36f
child 21
15e5879df8dc
permissions
-rw-r--r--

Fixed missing arrows on combobox and spinboxes in the qdarkstyle theme. Changed suppliers editor icon in the menu.

10
8aa2bd9ba9e8 Added the EditSupplier popup window. It is now ready to validate the form data.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
1 /**
8aa2bd9ba9e8 Added the EditSupplier popup window. It is now ready to validate the form data.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
2 * EditSupplier.cpp is part of bmsapp.
8aa2bd9ba9e8 Added the EditSupplier popup window. It is now ready to validate the form data.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
3 *
8aa2bd9ba9e8 Added the EditSupplier popup window. It is now ready to validate the form data.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
4 * bmsapp is free software: you can redistribute it and/or modify
8aa2bd9ba9e8 Added the EditSupplier popup window. It is now ready to validate the form data.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
5 * it under the terms of the GNU General Public License as published by
8aa2bd9ba9e8 Added the EditSupplier popup window. It is now ready to validate the form data.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
6 * the Free Software Foundation, either version 3 of the License, or
8aa2bd9ba9e8 Added the EditSupplier popup window. It is now ready to validate the form data.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
7 * (at your option) any later version.
8aa2bd9ba9e8 Added the EditSupplier popup window. It is now ready to validate the form data.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
8 *
8aa2bd9ba9e8 Added the EditSupplier popup window. It is now ready to validate the form data.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
9 * bmsapp is distributed in the hope that it will be useful,
8aa2bd9ba9e8 Added the EditSupplier popup window. It is now ready to validate the form data.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
8aa2bd9ba9e8 Added the EditSupplier popup window. It is now ready to validate the form data.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
8aa2bd9ba9e8 Added the EditSupplier popup window. It is now ready to validate the form data.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
12 * GNU General Public License for more details.
8aa2bd9ba9e8 Added the EditSupplier popup window. It is now ready to validate the form data.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
13 *
8aa2bd9ba9e8 Added the EditSupplier popup window. It is now ready to validate the form data.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
14 * You should have received a copy of the GNU General Public License
8aa2bd9ba9e8 Added the EditSupplier popup window. It is now ready to validate the form data.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
15 * along with this program. If not, see <http://www.gnu.org/licenses/>.
8aa2bd9ba9e8 Added the EditSupplier popup window. It is now ready to validate the form data.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
16 */
8aa2bd9ba9e8 Added the EditSupplier popup window. It is now ready to validate the form data.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
17 #include "EditSupplier.h"
8aa2bd9ba9e8 Added the EditSupplier popup window. It is now ready to validate the form data.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
18 #include "../ui/ui_EditSupplier.h"
8aa2bd9ba9e8 Added the EditSupplier popup window. It is now ready to validate the form data.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
19 #include "bmsapp.h"
8aa2bd9ba9e8 Added the EditSupplier popup window. It is now ready to validate the form data.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
20
8aa2bd9ba9e8 Added the EditSupplier popup window. It is now ready to validate the form data.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
21
8aa2bd9ba9e8 Added the EditSupplier popup window. It is now ready to validate the form data.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
22 EditSupplier::EditSupplier(int id, QWidget *parent) : QDialog(parent), ui(new Ui::EditSupplier)
8aa2bd9ba9e8 Added the EditSupplier popup window. It is now ready to validate the form data.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
23 {
8aa2bd9ba9e8 Added the EditSupplier popup window. It is now ready to validate the form data.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
24 QSqlQuery query;
8aa2bd9ba9e8 Added the EditSupplier popup window. It is now ready to validate the form data.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
25
11
c9cdc15d3caf The Supplier editor saves changes and inserts new suppliers. It sends a signal to InventorySuppliers when done (always for now). Refresh the table still doesn't work. Added a missing iconn in the Inventory menus dropdown.
Michiel Broek <mbroek@mbse.eu>
parents: 10
diff changeset
26 qDebug() << "EditSupplier record:" << id;
10
8aa2bd9ba9e8 Added the EditSupplier popup window. It is now ready to validate the form data.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
27 ui->setupUi(this);
11
c9cdc15d3caf The Supplier editor saves changes and inserts new suppliers. It sends a signal to InventorySuppliers when done (always for now). Refresh the table still doesn't work. Added a missing iconn in the Inventory menus dropdown.
Michiel Broek <mbroek@mbse.eu>
parents: 10
diff changeset
28 this->recno = id;
10
8aa2bd9ba9e8 Added the EditSupplier popup window. It is now ready to validate the form data.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
29
17
f0bcdbd3d36f Forgot one signal in Setup. EditSupplier now has signals to track edit changes. The Window header has ** mark if anything is changed. Added errors message boxes.
Michiel Broek <mbroek@mbse.eu>
parents: 11
diff changeset
30 WindowTitle();
f0bcdbd3d36f Forgot one signal in Setup. EditSupplier now has signals to track edit changes. The Window header has ** mark if anything is changed. Added errors message boxes.
Michiel Broek <mbroek@mbse.eu>
parents: 11
diff changeset
31 if (id >= 0) {
10
8aa2bd9ba9e8 Added the EditSupplier popup window. It is now ready to validate the form data.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
32 query.prepare("SELECT * FROM inventory_suppliers WHERE record = :recno");
8aa2bd9ba9e8 Added the EditSupplier popup window. It is now ready to validate the form data.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
33 query.bindValue(":recno", id);
8aa2bd9ba9e8 Added the EditSupplier popup window. It is now ready to validate the form data.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
34 query.exec();
8aa2bd9ba9e8 Added the EditSupplier popup window. It is now ready to validate the form data.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
35 query.next();
8aa2bd9ba9e8 Added the EditSupplier popup window. It is now ready to validate the form data.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
36
8aa2bd9ba9e8 Added the EditSupplier popup window. It is now ready to validate the form data.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
37 ui->nameEdit->setText(query.value(1).toString());
8aa2bd9ba9e8 Added the EditSupplier popup window. It is now ready to validate the form data.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
38 ui->addressEdit->setText(query.value(2).toString());
8aa2bd9ba9e8 Added the EditSupplier popup window. It is now ready to validate the form data.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
39 ui->cityEdit->setText(query.value(3).toString());
8aa2bd9ba9e8 Added the EditSupplier popup window. It is now ready to validate the form data.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
40 ui->zipEdit->setText(query.value(4).toString());
8aa2bd9ba9e8 Added the EditSupplier popup window. It is now ready to validate the form data.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
41 ui->countryEdit->setText(query.value(5).toString());
8aa2bd9ba9e8 Added the EditSupplier popup window. It is now ready to validate the form data.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
42 ui->webEdit->setText(query.value(6).toString());
8aa2bd9ba9e8 Added the EditSupplier popup window. It is now ready to validate the form data.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
43 ui->emailEdit->setText(query.value(7).toString());
8aa2bd9ba9e8 Added the EditSupplier popup window. It is now ready to validate the form data.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
44 ui->phoneEdit->setText(query.value(8).toString());
11
c9cdc15d3caf The Supplier editor saves changes and inserts new suppliers. It sends a signal to InventorySuppliers when done (always for now). Refresh the table still doesn't work. Added a missing iconn in the Inventory menus dropdown.
Michiel Broek <mbroek@mbse.eu>
parents: 10
diff changeset
45 ui->notesEdit->setPlainText(query.value(9).toString());
10
8aa2bd9ba9e8 Added the EditSupplier popup window. It is now ready to validate the form data.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
46 }
17
f0bcdbd3d36f Forgot one signal in Setup. EditSupplier now has signals to track edit changes. The Window header has ** mark if anything is changed. Added errors message boxes.
Michiel Broek <mbroek@mbse.eu>
parents: 11
diff changeset
47 connect(ui->nameEdit, &QLineEdit::textChanged, this, &EditSupplier::is_changed);
f0bcdbd3d36f Forgot one signal in Setup. EditSupplier now has signals to track edit changes. The Window header has ** mark if anything is changed. Added errors message boxes.
Michiel Broek <mbroek@mbse.eu>
parents: 11
diff changeset
48 connect(ui->addressEdit, &QLineEdit::textChanged, this, &EditSupplier::is_changed);
f0bcdbd3d36f Forgot one signal in Setup. EditSupplier now has signals to track edit changes. The Window header has ** mark if anything is changed. Added errors message boxes.
Michiel Broek <mbroek@mbse.eu>
parents: 11
diff changeset
49 connect(ui->cityEdit, &QLineEdit::textChanged, this, &EditSupplier::is_changed);
f0bcdbd3d36f Forgot one signal in Setup. EditSupplier now has signals to track edit changes. The Window header has ** mark if anything is changed. Added errors message boxes.
Michiel Broek <mbroek@mbse.eu>
parents: 11
diff changeset
50 connect(ui->zipEdit, &QLineEdit::textChanged, this, &EditSupplier::is_changed);
f0bcdbd3d36f Forgot one signal in Setup. EditSupplier now has signals to track edit changes. The Window header has ** mark if anything is changed. Added errors message boxes.
Michiel Broek <mbroek@mbse.eu>
parents: 11
diff changeset
51 connect(ui->countryEdit, &QLineEdit::textChanged, this, &EditSupplier::is_changed);
f0bcdbd3d36f Forgot one signal in Setup. EditSupplier now has signals to track edit changes. The Window header has ** mark if anything is changed. Added errors message boxes.
Michiel Broek <mbroek@mbse.eu>
parents: 11
diff changeset
52 connect(ui->webEdit, &QLineEdit::textChanged, this, &EditSupplier::is_changed);
f0bcdbd3d36f Forgot one signal in Setup. EditSupplier now has signals to track edit changes. The Window header has ** mark if anything is changed. Added errors message boxes.
Michiel Broek <mbroek@mbse.eu>
parents: 11
diff changeset
53 connect(ui->emailEdit, &QLineEdit::textChanged, this, &EditSupplier::is_changed);
f0bcdbd3d36f Forgot one signal in Setup. EditSupplier now has signals to track edit changes. The Window header has ** mark if anything is changed. Added errors message boxes.
Michiel Broek <mbroek@mbse.eu>
parents: 11
diff changeset
54 connect(ui->phoneEdit, &QLineEdit::textChanged, this, &EditSupplier::is_changed);
f0bcdbd3d36f Forgot one signal in Setup. EditSupplier now has signals to track edit changes. The Window header has ** mark if anything is changed. Added errors message boxes.
Michiel Broek <mbroek@mbse.eu>
parents: 11
diff changeset
55 connect(ui->notesEdit, SIGNAL(textChanged()), this, SLOT(is_changed()));
10
8aa2bd9ba9e8 Added the EditSupplier popup window. It is now ready to validate the form data.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
56 }
8aa2bd9ba9e8 Added the EditSupplier popup window. It is now ready to validate the form data.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
57
8aa2bd9ba9e8 Added the EditSupplier popup window. It is now ready to validate the form data.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
58
8aa2bd9ba9e8 Added the EditSupplier popup window. It is now ready to validate the form data.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
59 EditSupplier::~EditSupplier()
8aa2bd9ba9e8 Added the EditSupplier popup window. It is now ready to validate the form data.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
60 {
11
c9cdc15d3caf The Supplier editor saves changes and inserts new suppliers. It sends a signal to InventorySuppliers when done (always for now). Refresh the table still doesn't work. Added a missing iconn in the Inventory menus dropdown.
Michiel Broek <mbroek@mbse.eu>
parents: 10
diff changeset
61 qDebug() << "EditSupplier closed";
10
8aa2bd9ba9e8 Added the EditSupplier popup window. It is now ready to validate the form data.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
62 delete ui;
11
c9cdc15d3caf The Supplier editor saves changes and inserts new suppliers. It sends a signal to InventorySuppliers when done (always for now). Refresh the table still doesn't work. Added a missing iconn in the Inventory menus dropdown.
Michiel Broek <mbroek@mbse.eu>
parents: 10
diff changeset
63 emit entry_changed();
10
8aa2bd9ba9e8 Added the EditSupplier popup window. It is now ready to validate the form data.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
64 }
8aa2bd9ba9e8 Added the EditSupplier popup window. It is now ready to validate the form data.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
65
8aa2bd9ba9e8 Added the EditSupplier popup window. It is now ready to validate the form data.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
66
17
f0bcdbd3d36f Forgot one signal in Setup. EditSupplier now has signals to track edit changes. The Window header has ** mark if anything is changed. Added errors message boxes.
Michiel Broek <mbroek@mbse.eu>
parents: 11
diff changeset
67 /*
f0bcdbd3d36f Forgot one signal in Setup. EditSupplier now has signals to track edit changes. The Window header has ** mark if anything is changed. Added errors message boxes.
Michiel Broek <mbroek@mbse.eu>
parents: 11
diff changeset
68 * Window header, mark any change with '**'
f0bcdbd3d36f Forgot one signal in Setup. EditSupplier now has signals to track edit changes. The Window header has ** mark if anything is changed. Added errors message boxes.
Michiel Broek <mbroek@mbse.eu>
parents: 11
diff changeset
69 */
f0bcdbd3d36f Forgot one signal in Setup. EditSupplier now has signals to track edit changes. The Window header has ** mark if anything is changed. Added errors message boxes.
Michiel Broek <mbroek@mbse.eu>
parents: 11
diff changeset
70 void EditSupplier::WindowTitle()
f0bcdbd3d36f Forgot one signal in Setup. EditSupplier now has signals to track edit changes. The Window header has ** mark if anything is changed. Added errors message boxes.
Michiel Broek <mbroek@mbse.eu>
parents: 11
diff changeset
71 {
f0bcdbd3d36f Forgot one signal in Setup. EditSupplier now has signals to track edit changes. The Window header has ** mark if anything is changed. Added errors message boxes.
Michiel Broek <mbroek@mbse.eu>
parents: 11
diff changeset
72 QString txt;
f0bcdbd3d36f Forgot one signal in Setup. EditSupplier now has signals to track edit changes. The Window header has ** mark if anything is changed. Added errors message boxes.
Michiel Broek <mbroek@mbse.eu>
parents: 11
diff changeset
73
f0bcdbd3d36f Forgot one signal in Setup. EditSupplier now has signals to track edit changes. The Window header has ** mark if anything is changed. Added errors message boxes.
Michiel Broek <mbroek@mbse.eu>
parents: 11
diff changeset
74 if (this->recno < 0) {
f0bcdbd3d36f Forgot one signal in Setup. EditSupplier now has signals to track edit changes. The Window header has ** mark if anything is changed. Added errors message boxes.
Michiel Broek <mbroek@mbse.eu>
parents: 11
diff changeset
75 txt = QString(tr("BMSapp - Add new supplier"));
f0bcdbd3d36f Forgot one signal in Setup. EditSupplier now has signals to track edit changes. The Window header has ** mark if anything is changed. Added errors message boxes.
Michiel Broek <mbroek@mbse.eu>
parents: 11
diff changeset
76 } else {
f0bcdbd3d36f Forgot one signal in Setup. EditSupplier now has signals to track edit changes. The Window header has ** mark if anything is changed. Added errors message boxes.
Michiel Broek <mbroek@mbse.eu>
parents: 11
diff changeset
77 txt = QString(tr("BMSapp - Edit supplier %1").arg(this->recno));
f0bcdbd3d36f Forgot one signal in Setup. EditSupplier now has signals to track edit changes. The Window header has ** mark if anything is changed. Added errors message boxes.
Michiel Broek <mbroek@mbse.eu>
parents: 11
diff changeset
78 }
f0bcdbd3d36f Forgot one signal in Setup. EditSupplier now has signals to track edit changes. The Window header has ** mark if anything is changed. Added errors message boxes.
Michiel Broek <mbroek@mbse.eu>
parents: 11
diff changeset
79
f0bcdbd3d36f Forgot one signal in Setup. EditSupplier now has signals to track edit changes. The Window header has ** mark if anything is changed. Added errors message boxes.
Michiel Broek <mbroek@mbse.eu>
parents: 11
diff changeset
80 if (this->textIsChanged) {
f0bcdbd3d36f Forgot one signal in Setup. EditSupplier now has signals to track edit changes. The Window header has ** mark if anything is changed. Added errors message boxes.
Michiel Broek <mbroek@mbse.eu>
parents: 11
diff changeset
81 txt.append((QString(" **")));
f0bcdbd3d36f Forgot one signal in Setup. EditSupplier now has signals to track edit changes. The Window header has ** mark if anything is changed. Added errors message boxes.
Michiel Broek <mbroek@mbse.eu>
parents: 11
diff changeset
82 }
f0bcdbd3d36f Forgot one signal in Setup. EditSupplier now has signals to track edit changes. The Window header has ** mark if anything is changed. Added errors message boxes.
Michiel Broek <mbroek@mbse.eu>
parents: 11
diff changeset
83 setWindowTitle(txt);
f0bcdbd3d36f Forgot one signal in Setup. EditSupplier now has signals to track edit changes. The Window header has ** mark if anything is changed. Added errors message boxes.
Michiel Broek <mbroek@mbse.eu>
parents: 11
diff changeset
84 }
f0bcdbd3d36f Forgot one signal in Setup. EditSupplier now has signals to track edit changes. The Window header has ** mark if anything is changed. Added errors message boxes.
Michiel Broek <mbroek@mbse.eu>
parents: 11
diff changeset
85
f0bcdbd3d36f Forgot one signal in Setup. EditSupplier now has signals to track edit changes. The Window header has ** mark if anything is changed. Added errors message boxes.
Michiel Broek <mbroek@mbse.eu>
parents: 11
diff changeset
86
10
8aa2bd9ba9e8 Added the EditSupplier popup window. It is now ready to validate the form data.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
87 void EditSupplier::onOKButtonClicked()
8aa2bd9ba9e8 Added the EditSupplier popup window. It is now ready to validate the form data.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
88 {
11
c9cdc15d3caf The Supplier editor saves changes and inserts new suppliers. It sends a signal to InventorySuppliers when done (always for now). Refresh the table still doesn't work. Added a missing iconn in the Inventory menus dropdown.
Michiel Broek <mbroek@mbse.eu>
parents: 10
diff changeset
89 QSqlQuery query;
c9cdc15d3caf The Supplier editor saves changes and inserts new suppliers. It sends a signal to InventorySuppliers when done (always for now). Refresh the table still doesn't work. Added a missing iconn in the Inventory menus dropdown.
Michiel Broek <mbroek@mbse.eu>
parents: 10
diff changeset
90
10
8aa2bd9ba9e8 Added the EditSupplier popup window. It is now ready to validate the form data.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
91 /* If there are errors in the form, show a message and do "return;" */
11
c9cdc15d3caf The Supplier editor saves changes and inserts new suppliers. It sends a signal to InventorySuppliers when done (always for now). Refresh the table still doesn't work. Added a missing iconn in the Inventory menus dropdown.
Michiel Broek <mbroek@mbse.eu>
parents: 10
diff changeset
92 if (ui->nameEdit->text().length() < 2) {
17
f0bcdbd3d36f Forgot one signal in Setup. EditSupplier now has signals to track edit changes. The Window header has ** mark if anything is changed. Added errors message boxes.
Michiel Broek <mbroek@mbse.eu>
parents: 11
diff changeset
93 QMessageBox::warning(this, tr("Edit Supplier"), tr("Name empty or too short."));
11
c9cdc15d3caf The Supplier editor saves changes and inserts new suppliers. It sends a signal to InventorySuppliers when done (always for now). Refresh the table still doesn't work. Added a missing iconn in the Inventory menus dropdown.
Michiel Broek <mbroek@mbse.eu>
parents: 10
diff changeset
94 return;
c9cdc15d3caf The Supplier editor saves changes and inserts new suppliers. It sends a signal to InventorySuppliers when done (always for now). Refresh the table still doesn't work. Added a missing iconn in the Inventory menus dropdown.
Michiel Broek <mbroek@mbse.eu>
parents: 10
diff changeset
95 }
10
8aa2bd9ba9e8 Added the EditSupplier popup window. It is now ready to validate the form data.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
96
17
f0bcdbd3d36f Forgot one signal in Setup. EditSupplier now has signals to track edit changes. The Window header has ** mark if anything is changed. Added errors message boxes.
Michiel Broek <mbroek@mbse.eu>
parents: 11
diff changeset
97 if (this->textIsChanged) {
11
c9cdc15d3caf The Supplier editor saves changes and inserts new suppliers. It sends a signal to InventorySuppliers when done (always for now). Refresh the table still doesn't work. Added a missing iconn in the Inventory menus dropdown.
Michiel Broek <mbroek@mbse.eu>
parents: 10
diff changeset
98 if (this->recno == -1) {
c9cdc15d3caf The Supplier editor saves changes and inserts new suppliers. It sends a signal to InventorySuppliers when done (always for now). Refresh the table still doesn't work. Added a missing iconn in the Inventory menus dropdown.
Michiel Broek <mbroek@mbse.eu>
parents: 10
diff changeset
99 query.prepare("INSERT INTO inventory_suppliers SET name = :name, address = :address, city = :city, zip = :zip, "
c9cdc15d3caf The Supplier editor saves changes and inserts new suppliers. It sends a signal to InventorySuppliers when done (always for now). Refresh the table still doesn't work. Added a missing iconn in the Inventory menus dropdown.
Michiel Broek <mbroek@mbse.eu>
parents: 10
diff changeset
100 "country = :country, website = :web, email = :email, phone = :phone, notes = :notes, uuid = :uuid");
c9cdc15d3caf The Supplier editor saves changes and inserts new suppliers. It sends a signal to InventorySuppliers when done (always for now). Refresh the table still doesn't work. Added a missing iconn in the Inventory menus dropdown.
Michiel Broek <mbroek@mbse.eu>
parents: 10
diff changeset
101 } else {
c9cdc15d3caf The Supplier editor saves changes and inserts new suppliers. It sends a signal to InventorySuppliers when done (always for now). Refresh the table still doesn't work. Added a missing iconn in the Inventory menus dropdown.
Michiel Broek <mbroek@mbse.eu>
parents: 10
diff changeset
102 query.prepare("UPDATE inventory_suppliers SET name = :name, address = :address, city = :city, zip = :zip, "
c9cdc15d3caf The Supplier editor saves changes and inserts new suppliers. It sends a signal to InventorySuppliers when done (always for now). Refresh the table still doesn't work. Added a missing iconn in the Inventory menus dropdown.
Michiel Broek <mbroek@mbse.eu>
parents: 10
diff changeset
103 "country = :country, website = :web, email = :email, phone = :phone, notes = :notes WHERE record = :recno");
c9cdc15d3caf The Supplier editor saves changes and inserts new suppliers. It sends a signal to InventorySuppliers when done (always for now). Refresh the table still doesn't work. Added a missing iconn in the Inventory menus dropdown.
Michiel Broek <mbroek@mbse.eu>
parents: 10
diff changeset
104 }
c9cdc15d3caf The Supplier editor saves changes and inserts new suppliers. It sends a signal to InventorySuppliers when done (always for now). Refresh the table still doesn't work. Added a missing iconn in the Inventory menus dropdown.
Michiel Broek <mbroek@mbse.eu>
parents: 10
diff changeset
105 query.bindValue(":name", ui->nameEdit->text());
c9cdc15d3caf The Supplier editor saves changes and inserts new suppliers. It sends a signal to InventorySuppliers when done (always for now). Refresh the table still doesn't work. Added a missing iconn in the Inventory menus dropdown.
Michiel Broek <mbroek@mbse.eu>
parents: 10
diff changeset
106 query.bindValue(":address", ui->addressEdit->text());
c9cdc15d3caf The Supplier editor saves changes and inserts new suppliers. It sends a signal to InventorySuppliers when done (always for now). Refresh the table still doesn't work. Added a missing iconn in the Inventory menus dropdown.
Michiel Broek <mbroek@mbse.eu>
parents: 10
diff changeset
107 query.bindValue(":city", ui->cityEdit->text());
c9cdc15d3caf The Supplier editor saves changes and inserts new suppliers. It sends a signal to InventorySuppliers when done (always for now). Refresh the table still doesn't work. Added a missing iconn in the Inventory menus dropdown.
Michiel Broek <mbroek@mbse.eu>
parents: 10
diff changeset
108 query.bindValue(":zip", ui->zipEdit->text());
c9cdc15d3caf The Supplier editor saves changes and inserts new suppliers. It sends a signal to InventorySuppliers when done (always for now). Refresh the table still doesn't work. Added a missing iconn in the Inventory menus dropdown.
Michiel Broek <mbroek@mbse.eu>
parents: 10
diff changeset
109 query.bindValue(":country", ui->countryEdit->text());
c9cdc15d3caf The Supplier editor saves changes and inserts new suppliers. It sends a signal to InventorySuppliers when done (always for now). Refresh the table still doesn't work. Added a missing iconn in the Inventory menus dropdown.
Michiel Broek <mbroek@mbse.eu>
parents: 10
diff changeset
110 query.bindValue(":web", ui->webEdit->text());
c9cdc15d3caf The Supplier editor saves changes and inserts new suppliers. It sends a signal to InventorySuppliers when done (always for now). Refresh the table still doesn't work. Added a missing iconn in the Inventory menus dropdown.
Michiel Broek <mbroek@mbse.eu>
parents: 10
diff changeset
111 query.bindValue(":email", ui->emailEdit->text());
c9cdc15d3caf The Supplier editor saves changes and inserts new suppliers. It sends a signal to InventorySuppliers when done (always for now). Refresh the table still doesn't work. Added a missing iconn in the Inventory menus dropdown.
Michiel Broek <mbroek@mbse.eu>
parents: 10
diff changeset
112 query.bindValue(":phone", ui->phoneEdit->text());
c9cdc15d3caf The Supplier editor saves changes and inserts new suppliers. It sends a signal to InventorySuppliers when done (always for now). Refresh the table still doesn't work. Added a missing iconn in the Inventory menus dropdown.
Michiel Broek <mbroek@mbse.eu>
parents: 10
diff changeset
113 query.bindValue(":notes", ui->notesEdit->toPlainText());
c9cdc15d3caf The Supplier editor saves changes and inserts new suppliers. It sends a signal to InventorySuppliers when done (always for now). Refresh the table still doesn't work. Added a missing iconn in the Inventory menus dropdown.
Michiel Broek <mbroek@mbse.eu>
parents: 10
diff changeset
114 if (this->recno == -1) {
c9cdc15d3caf The Supplier editor saves changes and inserts new suppliers. It sends a signal to InventorySuppliers when done (always for now). Refresh the table still doesn't work. Added a missing iconn in the Inventory menus dropdown.
Michiel Broek <mbroek@mbse.eu>
parents: 10
diff changeset
115 query.bindValue(":uuid", QUuid::createUuid().toString().mid(1, 36));
c9cdc15d3caf The Supplier editor saves changes and inserts new suppliers. It sends a signal to InventorySuppliers when done (always for now). Refresh the table still doesn't work. Added a missing iconn in the Inventory menus dropdown.
Michiel Broek <mbroek@mbse.eu>
parents: 10
diff changeset
116 } else {
c9cdc15d3caf The Supplier editor saves changes and inserts new suppliers. It sends a signal to InventorySuppliers when done (always for now). Refresh the table still doesn't work. Added a missing iconn in the Inventory menus dropdown.
Michiel Broek <mbroek@mbse.eu>
parents: 10
diff changeset
117 query.bindValue(":recno", this->recno);
c9cdc15d3caf The Supplier editor saves changes and inserts new suppliers. It sends a signal to InventorySuppliers when done (always for now). Refresh the table still doesn't work. Added a missing iconn in the Inventory menus dropdown.
Michiel Broek <mbroek@mbse.eu>
parents: 10
diff changeset
118 }
c9cdc15d3caf The Supplier editor saves changes and inserts new suppliers. It sends a signal to InventorySuppliers when done (always for now). Refresh the table still doesn't work. Added a missing iconn in the Inventory menus dropdown.
Michiel Broek <mbroek@mbse.eu>
parents: 10
diff changeset
119 query.exec();
c9cdc15d3caf The Supplier editor saves changes and inserts new suppliers. It sends a signal to InventorySuppliers when done (always for now). Refresh the table still doesn't work. Added a missing iconn in the Inventory menus dropdown.
Michiel Broek <mbroek@mbse.eu>
parents: 10
diff changeset
120 if (query.lastError().isValid()) {
17
f0bcdbd3d36f Forgot one signal in Setup. EditSupplier now has signals to track edit changes. The Window header has ** mark if anything is changed. Added errors message boxes.
Michiel Broek <mbroek@mbse.eu>
parents: 11
diff changeset
121 qDebug() << "EditSupplier" << query.lastError();
f0bcdbd3d36f Forgot one signal in Setup. EditSupplier now has signals to track edit changes. The Window header has ** mark if anything is changed. Added errors message boxes.
Michiel Broek <mbroek@mbse.eu>
parents: 11
diff changeset
122 QMessageBox::warning(this, tr("Database error"),
f0bcdbd3d36f Forgot one signal in Setup. EditSupplier now has signals to track edit changes. The Window header has ** mark if anything is changed. Added errors message boxes.
Michiel Broek <mbroek@mbse.eu>
parents: 11
diff changeset
123 tr("MySQL error: %1\n%2\n%3")
f0bcdbd3d36f Forgot one signal in Setup. EditSupplier now has signals to track edit changes. The Window header has ** mark if anything is changed. Added errors message boxes.
Michiel Broek <mbroek@mbse.eu>
parents: 11
diff changeset
124 .arg(query.lastError().nativeErrorCode())
f0bcdbd3d36f Forgot one signal in Setup. EditSupplier now has signals to track edit changes. The Window header has ** mark if anything is changed. Added errors message boxes.
Michiel Broek <mbroek@mbse.eu>
parents: 11
diff changeset
125 .arg(query.lastError().driverText())
f0bcdbd3d36f Forgot one signal in Setup. EditSupplier now has signals to track edit changes. The Window header has ** mark if anything is changed. Added errors message boxes.
Michiel Broek <mbroek@mbse.eu>
parents: 11
diff changeset
126 .arg(query.lastError().databaseText()));
f0bcdbd3d36f Forgot one signal in Setup. EditSupplier now has signals to track edit changes. The Window header has ** mark if anything is changed. Added errors message boxes.
Michiel Broek <mbroek@mbse.eu>
parents: 11
diff changeset
127 } else {
f0bcdbd3d36f Forgot one signal in Setup. EditSupplier now has signals to track edit changes. The Window header has ** mark if anything is changed. Added errors message boxes.
Michiel Broek <mbroek@mbse.eu>
parents: 11
diff changeset
128 qDebug() << "EditSupplier Saved";
11
c9cdc15d3caf The Supplier editor saves changes and inserts new suppliers. It sends a signal to InventorySuppliers when done (always for now). Refresh the table still doesn't work. Added a missing iconn in the Inventory menus dropdown.
Michiel Broek <mbroek@mbse.eu>
parents: 10
diff changeset
129 }
10
8aa2bd9ba9e8 Added the EditSupplier popup window. It is now ready to validate the form data.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
130
11
c9cdc15d3caf The Supplier editor saves changes and inserts new suppliers. It sends a signal to InventorySuppliers when done (always for now). Refresh the table still doesn't work. Added a missing iconn in the Inventory menus dropdown.
Michiel Broek <mbroek@mbse.eu>
parents: 10
diff changeset
131 this->close();
c9cdc15d3caf The Supplier editor saves changes and inserts new suppliers. It sends a signal to InventorySuppliers when done (always for now). Refresh the table still doesn't work. Added a missing iconn in the Inventory menus dropdown.
Michiel Broek <mbroek@mbse.eu>
parents: 10
diff changeset
132 this->setResult(1);
c9cdc15d3caf The Supplier editor saves changes and inserts new suppliers. It sends a signal to InventorySuppliers when done (always for now). Refresh the table still doesn't work. Added a missing iconn in the Inventory menus dropdown.
Michiel Broek <mbroek@mbse.eu>
parents: 10
diff changeset
133 } else {
c9cdc15d3caf The Supplier editor saves changes and inserts new suppliers. It sends a signal to InventorySuppliers when done (always for now). Refresh the table still doesn't work. Added a missing iconn in the Inventory menus dropdown.
Michiel Broek <mbroek@mbse.eu>
parents: 10
diff changeset
134 /* Not saving */
c9cdc15d3caf The Supplier editor saves changes and inserts new suppliers. It sends a signal to InventorySuppliers when done (always for now). Refresh the table still doesn't work. Added a missing iconn in the Inventory menus dropdown.
Michiel Broek <mbroek@mbse.eu>
parents: 10
diff changeset
135 this->close();
c9cdc15d3caf The Supplier editor saves changes and inserts new suppliers. It sends a signal to InventorySuppliers when done (always for now). Refresh the table still doesn't work. Added a missing iconn in the Inventory menus dropdown.
Michiel Broek <mbroek@mbse.eu>
parents: 10
diff changeset
136 this->setResult(0);
c9cdc15d3caf The Supplier editor saves changes and inserts new suppliers. It sends a signal to InventorySuppliers when done (always for now). Refresh the table still doesn't work. Added a missing iconn in the Inventory menus dropdown.
Michiel Broek <mbroek@mbse.eu>
parents: 10
diff changeset
137 }
c9cdc15d3caf The Supplier editor saves changes and inserts new suppliers. It sends a signal to InventorySuppliers when done (always for now). Refresh the table still doesn't work. Added a missing iconn in the Inventory menus dropdown.
Michiel Broek <mbroek@mbse.eu>
parents: 10
diff changeset
138 }
c9cdc15d3caf The Supplier editor saves changes and inserts new suppliers. It sends a signal to InventorySuppliers when done (always for now). Refresh the table still doesn't work. Added a missing iconn in the Inventory menus dropdown.
Michiel Broek <mbroek@mbse.eu>
parents: 10
diff changeset
139
c9cdc15d3caf The Supplier editor saves changes and inserts new suppliers. It sends a signal to InventorySuppliers when done (always for now). Refresh the table still doesn't work. Added a missing iconn in the Inventory menus dropdown.
Michiel Broek <mbroek@mbse.eu>
parents: 10
diff changeset
140
17
f0bcdbd3d36f Forgot one signal in Setup. EditSupplier now has signals to track edit changes. The Window header has ** mark if anything is changed. Added errors message boxes.
Michiel Broek <mbroek@mbse.eu>
parents: 11
diff changeset
141 void EditSupplier::is_changed()
11
c9cdc15d3caf The Supplier editor saves changes and inserts new suppliers. It sends a signal to InventorySuppliers when done (always for now). Refresh the table still doesn't work. Added a missing iconn in the Inventory menus dropdown.
Michiel Broek <mbroek@mbse.eu>
parents: 10
diff changeset
142 {
c9cdc15d3caf The Supplier editor saves changes and inserts new suppliers. It sends a signal to InventorySuppliers when done (always for now). Refresh the table still doesn't work. Added a missing iconn in the Inventory menus dropdown.
Michiel Broek <mbroek@mbse.eu>
parents: 10
diff changeset
143 this->textIsChanged = true;
17
f0bcdbd3d36f Forgot one signal in Setup. EditSupplier now has signals to track edit changes. The Window header has ** mark if anything is changed. Added errors message boxes.
Michiel Broek <mbroek@mbse.eu>
parents: 11
diff changeset
144 WindowTitle();
10
8aa2bd9ba9e8 Added the EditSupplier popup window. It is now ready to validate the form data.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
145 }
8aa2bd9ba9e8 Added the EditSupplier popup window. It is now ready to validate the form data.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
146
8aa2bd9ba9e8 Added the EditSupplier popup window. It is now ready to validate the form data.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
147
8aa2bd9ba9e8 Added the EditSupplier popup window. It is now ready to validate the form data.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
148 void EditSupplier::onCancelButtonClicked()
8aa2bd9ba9e8 Added the EditSupplier popup window. It is now ready to validate the form data.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
149 {
8aa2bd9ba9e8 Added the EditSupplier popup window. It is now ready to validate the form data.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
150 this->close();
8aa2bd9ba9e8 Added the EditSupplier popup window. It is now ready to validate the form data.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
151 this->setResult(0);
8aa2bd9ba9e8 Added the EditSupplier popup window. It is now ready to validate the form data.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
152 }

mercurial