Amount/Unit progress
This commit is contained in:
parent
26f6e4b7c7
commit
d75cb0a32f
@ -85,7 +85,7 @@ public class ShoppingListEntry
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
updateAmount();
|
return updateAmount();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
catch(Exception e)
|
catch(Exception e)
|
||||||
@ -182,11 +182,11 @@ public class ShoppingListEntry
|
|||||||
if(currentAmount + this.getAmount() > 0)
|
if(currentAmount + this.getAmount() > 0)
|
||||||
{
|
{
|
||||||
// Update the amount
|
// Update the amount
|
||||||
String updateQuery = "UPDATE listEntries set=? WHERE listId=? AND productId=? AND unit=?";
|
String updateQuery = "UPDATE listEntries set amount=? WHERE listId=? AND productId=? AND unit=?";
|
||||||
preparedStmt = conn.prepareStatement(updateQuery);
|
preparedStmt = conn.prepareStatement(updateQuery);
|
||||||
|
|
||||||
preparedStmt.setFloat(1, currentAmount + this.getAmount());
|
preparedStmt.setFloat(1, currentAmount + this.getAmount());
|
||||||
preparedStmt.setLong(2, this.getProduct().getId());
|
preparedStmt.setLong(2, this.getParentList().getId());
|
||||||
preparedStmt.setLong(3, this.getProduct().getId());
|
preparedStmt.setLong(3, this.getProduct().getId());
|
||||||
preparedStmt.setLong(4, this.getUnit().getId());
|
preparedStmt.setLong(4, this.getUnit().getId());
|
||||||
|
|
||||||
@ -194,11 +194,11 @@ public class ShoppingListEntry
|
|||||||
|
|
||||||
long numAffectedRows = preparedStmt.executeUpdate();
|
long numAffectedRows = preparedStmt.executeUpdate();
|
||||||
Miscellaneous.logEvent("AMOUNT OF UPDATED ROWS: " + numAffectedRows, 5);
|
Miscellaneous.logEvent("AMOUNT OF UPDATED ROWS: " + numAffectedRows, 5);
|
||||||
ResultSet rs = preparedStmt.getGeneratedKeys();
|
// ResultSet rs = preparedStmt.getGeneratedKeys();
|
||||||
if (numAffectedRows > 0)
|
if (numAffectedRows > 0)
|
||||||
{
|
{
|
||||||
Miscellaneous.logEvent("Amount added to existing entry.", 2);
|
Miscellaneous.logEvent("Amount added to existing entry.", 2);
|
||||||
rs.close();
|
// rs.close();
|
||||||
preparedStmt.close();
|
preparedStmt.close();
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
@ -217,11 +217,11 @@ public class ShoppingListEntry
|
|||||||
|
|
||||||
long numAffectedRows = preparedStmt.executeUpdate();
|
long numAffectedRows = preparedStmt.executeUpdate();
|
||||||
Miscellaneous.logEvent("AMOUNT OF UPDATED ROWS: " + numAffectedRows, 5);
|
Miscellaneous.logEvent("AMOUNT OF UPDATED ROWS: " + numAffectedRows, 5);
|
||||||
ResultSet rs = preparedStmt.getGeneratedKeys();
|
// ResultSet rs = preparedStmt.getGeneratedKeys();
|
||||||
if (numAffectedRows > 0)
|
if (numAffectedRows > 0)
|
||||||
{
|
{
|
||||||
Miscellaneous.logEvent("Resulting amount < 0, entry deleted.", 2);
|
Miscellaneous.logEvent("Resulting amount < 0, entry deleted.", 2);
|
||||||
rs.close();
|
// rs.close();
|
||||||
preparedStmt.close();
|
preparedStmt.close();
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
@ -111,7 +111,7 @@ public class Start
|
|||||||
exitWithError(Settings.languageBlock.get("productNotFound") + " " + productName);
|
exitWithError(Settings.languageBlock.get("productNotFound") + " " + productName);
|
||||||
|
|
||||||
for(ShoppingListEntry entry : list.getEntries())
|
for(ShoppingListEntry entry : list.getEntries())
|
||||||
{
|
{bestehende reduzieren
|
||||||
if(entry.getProduct().equals(p))
|
if(entry.getProduct().equals(p))
|
||||||
{
|
{
|
||||||
if(entry.delete())
|
if(entry.delete())
|
||||||
|
Loading…
Reference in New Issue
Block a user