fix: Improve error handling in product composition insertion and fix ItemNumberDelegate::setEditorData
This commit is contained in:
+13
-2
@@ -308,11 +308,22 @@ void formProduct::save()
|
||||
|
||||
if(!qry.exec())
|
||||
{
|
||||
// todo: barrar lo creado
|
||||
// barrar lo creado: eliminar las composiciones ya insertadas para este producto
|
||||
if (!insertedElementCodes.isEmpty())
|
||||
{
|
||||
QSqlQuery qryDel = QSqlQuery(dApp->Enterprise());
|
||||
qryDel.prepare(QString("DELETE FROM ELEMENTCOMPOSITION WHERE CODE = :CODE AND ELEMENT_CODE IN (%1)").arg(QString(insertedElementCodes.size(), '?').replace('?', ":ELEMENT_CODE")));
|
||||
qryDel.bindValue(":CODE", ui->editCode->text());
|
||||
for (int j = 0; j < insertedElementCodes.size(); ++j)
|
||||
{
|
||||
qryDel.bindValue(QString(":ELEMENT_CODE%1").arg(j), insertedElementCodes.at(j));
|
||||
}
|
||||
qryDel.exec();
|
||||
}
|
||||
qDebug() << "Error ejecutando el query: " << qry.lastError().text() << "\n";
|
||||
dApp->Enterprise().close();
|
||||
return;
|
||||
}
|
||||
}}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user