|
@@ -54,17 +54,20 @@
|
54
|
54
|
window.close();
|
55
|
55
|
});
|
56
|
56
|
deleteButton.clicked.connect(function() {
|
57
|
|
- var query = new QSqlQuery();
|
58
|
|
- query.prepare("DELETE FROM inventory WHERE item = :item AND time = :timestamp");
|
59
|
|
- query.bind(":item", Number(itemField.text));
|
60
|
|
- query.bind(":timestamp", timeField.text);
|
61
|
|
- query.exec();
|
62
|
|
- query.prepare("UPDATE items SET quantity = (SELECT balance FROM item_history(:item) ORDER BY time DESC LIMIT 1) WHERE id = :item2");
|
63
|
|
- query.bind(":item", Number(itemField.text));
|
64
|
|
- query.bind(":item2", Number(itemField.text));
|
65
|
|
- query.exec();
|
66
|
|
- query = query.invalidate();
|
67
|
|
- window.close();
|
|
57
|
+ var proceed = displayWarning(TTR("editinventorytransaction", "Are you sure?"), TTR("editinventorytransaction", "Deleting this transaction can not be undone. Continue?"));
|
|
58
|
+ if(proceed) {
|
|
59
|
+ var query = new QSqlQuery();
|
|
60
|
+ query.prepare("DELETE FROM inventory WHERE item = :item AND time = :timestamp");
|
|
61
|
+ query.bind(":item", Number(itemField.text));
|
|
62
|
+ query.bind(":timestamp", timeField.text);
|
|
63
|
+ query.exec();
|
|
64
|
+ query.prepare("UPDATE items SET quantity = (SELECT balance FROM item_history(:item) ORDER BY time DESC LIMIT 1) WHERE id = :item2");
|
|
65
|
+ query.bind(":item", Number(itemField.text));
|
|
66
|
+ query.bind(":item2", Number(itemField.text));
|
|
67
|
+ query.exec();
|
|
68
|
+ query = query.invalidate();
|
|
69
|
+ window.close();
|
|
70
|
+ }
|
68
|
71
|
});
|
69
|
72
|
]]>
|
70
|
73
|
</program>
|