improve item count handling

This commit is contained in:
buzz-lightsnack-2007 2024-02-25 07:37:12 +08:00
parent a85786554c
commit 10558cc9b4

View file

@ -220,7 +220,7 @@ public class OnTransact extends javax.swing.JFrame {
private void transaction_check(java.awt.event.WindowEvent evt) {//GEN-FIRST:event_transaction_check
boolean CLOSING_STATE = false;
if (transaction.items_count > 0) {
if (transaction.items_count <= 0) {
CLOSING_STATE = true;
} else {
CLOSING_STATE = confirm_discard();
@ -271,7 +271,13 @@ public class OnTransact extends javax.swing.JFrame {
}
private static boolean confirm_discard() {
Boolean USER_CHOICE = WindowManagement.confirm("Discrding Items", "There are currently items in the cart. Would you want to discard this?", true);
/* Confirm discarding items.
Returns:
(boolean) the user's selection
*/
Boolean USER_CHOICE = WindowManagement.confirm("Discarding Items", "There are currently items in the cart. Would you want to discard this?", true);
return (USER_CHOICE);
};