Amount/Unit progress
This commit is contained in:
		| @@ -85,7 +85,7 @@ public class ShoppingListEntry | ||||
| 			} | ||||
| 			else | ||||
| 			{ | ||||
| 				updateAmount(); | ||||
| 				return updateAmount(); | ||||
| 			} | ||||
| 		} | ||||
| 		catch(Exception e) | ||||
| @@ -182,11 +182,11 @@ public class ShoppingListEntry | ||||
| 	        	if(currentAmount + this.getAmount() > 0) | ||||
| 	        	{ | ||||
| 	        		// 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.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(4, this.getUnit().getId()); | ||||
| 		 | ||||
| @@ -194,11 +194,11 @@ public class ShoppingListEntry | ||||
| 					 | ||||
| 					long numAffectedRows = preparedStmt.executeUpdate(); | ||||
| 				    Miscellaneous.logEvent("AMOUNT OF UPDATED ROWS: " + numAffectedRows, 5); | ||||
| 				    ResultSet rs = preparedStmt.getGeneratedKeys(); | ||||
| //				    ResultSet rs = preparedStmt.getGeneratedKeys(); | ||||
| 				    if (numAffectedRows > 0) | ||||
| 				    { | ||||
| 				    	Miscellaneous.logEvent("Amount added to existing entry.", 2); | ||||
| 				    	rs.close(); | ||||
| //				    	rs.close(); | ||||
| 						preparedStmt.close(); | ||||
| 						return true; | ||||
| 				    }					     | ||||
| @@ -217,11 +217,11 @@ public class ShoppingListEntry | ||||
| 					 | ||||
| 					long numAffectedRows = preparedStmt.executeUpdate(); | ||||
| 				    Miscellaneous.logEvent("AMOUNT OF UPDATED ROWS: " + numAffectedRows, 5); | ||||
| 				    ResultSet rs = preparedStmt.getGeneratedKeys(); | ||||
| //				    ResultSet rs = preparedStmt.getGeneratedKeys(); | ||||
| 				    if (numAffectedRows > 0) | ||||
| 				    { | ||||
| 				    	Miscellaneous.logEvent("Resulting amount < 0, entry deleted.", 2); | ||||
| 				    	rs.close(); | ||||
| //				    	rs.close(); | ||||
| 						preparedStmt.close(); | ||||
| 						return true; | ||||
| 				    } | ||||
|   | ||||
| @@ -111,7 +111,7 @@ public class Start | ||||
| 				    		exitWithError(Settings.languageBlock.get("productNotFound") + " " + productName); | ||||
| 				    	 | ||||
| 			    		for(ShoppingListEntry entry : list.getEntries()) | ||||
| 			    		{ | ||||
| 			    		{bestehende reduzieren | ||||
| 			    			if(entry.getProduct().equals(p)) | ||||
| 			    			{ | ||||
| 					    		if(entry.delete()) | ||||
|   | ||||
		Reference in New Issue
	
	Block a user