910 int rc = QMessageBox::warning(this, tr("Delete product"), tr("Delete %1").arg(product->name), |
910 int rc = QMessageBox::warning(this, tr("Delete product"), tr("Delete %1").arg(product->name), |
911 QMessageBox::Yes | QMessageBox::No, QMessageBox::No); |
911 QMessageBox::Yes | QMessageBox::No, QMessageBox::No); |
912 if (rc == QMessageBox::No) |
912 if (rc == QMessageBox::No) |
913 return; |
913 return; |
914 |
914 |
|
915 /* |
|
916 * First delete any pictures for this product. |
|
917 */ |
|
918 QSqlQuery query; |
|
919 query.prepare("DELETE FROM products_pics WHERE uuid=:uuid"); |
|
920 query.bindValue(":uuid", product->uuid); |
|
921 query.exec(); |
|
922 if (query.lastError().isValid()) { |
|
923 qWarning() << "on_deleteButton_clicked()" << query.lastError(); |
|
924 QMessageBox::warning(this, tr("Database error"), tr("MySQL error: %1\n%2\n%3") |
|
925 .arg(query.lastError().nativeErrorCode()).arg(query.lastError().driverText()).arg(query.lastError().databaseText())); |
|
926 } |
|
927 |
915 DB_product::dele(this, this->recno); |
928 DB_product::dele(this, this->recno); |
916 |
929 |
917 this->close(); |
930 this->close(); |
918 this->setResult(1); |
931 this->setResult(1); |
919 } |
932 } |