Commit 8bf942e1 authored by Hugo Hörnquist's avatar Hugo Hörnquist

Fix big buy remove buying items

I missed that you buy stuff by adding them to big buy, and then removing
it, allowing SQL triggers to handle all the logic. This means that for
actually removing items you need to temporarly disable that
functionality. This commit does that.
parent 5c37c4da
......@@ -234,6 +234,7 @@ void Widget::on_removeProduct_clicked()
{
if (! ui->bigBuyList->isEnabled()) return;
QModelIndex index;
QSqlQuery("UPDATE my_db_settings SET value = 0 WHERE name = 'big_buy_transfer'");
// only one row can be selected at a time, but this provides a safeguard
foreach ( QModelIndex i, ui->bigBuyList->selectionModel()->selectedRows() ) {
index = ui->bigBuyList->model()->index(i.row(), 1);
......@@ -245,6 +246,7 @@ void Widget::on_removeProduct_clicked()
if(!query.exec())
qDebug() << __LINE__ << query.lastError();
}
QSqlQuery("UPDATE my_db_settings SET value = 1 WHERE name = 'big_buy_transfer'");
requery_bigBuy(true);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment