diff --git a/ShoppingList/src/com/jens/rhasspy/shoppinglist/ShoppingListEntry.java b/ShoppingList/src/com/jens/rhasspy/shoppinglist/ShoppingListEntry.java index a16126b..45765b8 100644 --- a/ShoppingList/src/com/jens/rhasspy/shoppinglist/ShoppingListEntry.java +++ b/ShoppingList/src/com/jens/rhasspy/shoppinglist/ShoppingListEntry.java @@ -195,13 +195,14 @@ public class ShoppingListEntry if(condition) { // Update the amount - String updateQuery = "UPDATE listEntries SET amount=? WHERE listId=? AND productId=? AND unit=?"; + String updateQuery = "UPDATE listEntries set amount=? WHERE listId=? AND productId=? AND unit=?"; preparedStmt = conn.prepareStatement(updateQuery); if(delete) preparedStmt.setFloat(1, currentAmount - this.getAmount()); else preparedStmt.setFloat(1, currentAmount + this.getAmount()); + preparedStmt.setLong(2, this.getParentList().getId()); preparedStmt.setLong(3, this.getProduct().getId()); preparedStmt.setLong(4, this.getUnit().getId()); diff --git a/ShoppingList/src/com/jens/rhasspy/shoppinglist/Start.java b/ShoppingList/src/com/jens/rhasspy/shoppinglist/Start.java index 4ac4bf1..2c84f81 100644 --- a/ShoppingList/src/com/jens/rhasspy/shoppinglist/Start.java +++ b/ShoppingList/src/com/jens/rhasspy/shoppinglist/Start.java @@ -128,8 +128,23 @@ public class Start DatabaseHandler.getInstance().disconnect(); System.exit(0); } - else - exitWithError(Settings.languageBlock.get("couldNotRemoveProdFromList") + " " + entry.toString()); + exitWithError(Settings.languageBlock.get("productNotFound") + " " + productName); + +// for(ShoppingListEntry entry : list.getEntries()) +// { +// if(entry.getProduct().equals(p)) +// { +// if(entry.delete()) +// { +// DatabaseHandler.getInstance().disconnect(); +// System.exit(0); +// } +// else +// Miscellaneous.logEvent(Settings.languageBlock.get("couldNotRemoveProdFromList") + " " + productName, 2); +// } +// } +// else +// exitWithError(Settings.languageBlock.get("couldNotRemoveProdFromList") + " " + entry.toString()); // for(ShoppingListEntry entry : list.getEntries()) // {