From b8b04199d427296105fc530b4328c9a73322d504 Mon Sep 17 00:00:00 2001 From: Skylar Ittner Date: Sat, 23 Jun 2018 14:55:40 -0600 Subject: [PATCH] Show useful error message when attempting to finish a transaction with no items --- action.php | 5 +++++ lang/en_us.php | 1 + 2 files changed, 6 insertions(+) diff --git a/action.php b/action.php index 9aca2b9..6c0a4e6 100644 --- a/action.php +++ b/action.php @@ -38,6 +38,11 @@ switch ($VARS['action']) { $database->action(function ($database) { global $VARS, $binstack, $error, $oktx; + if (empty($VARS['items'])) { + $error = lang("no items", false); + return false; + } + $items = $VARS['items']; $payments = $VARS['payments']; $customer = $VARS['customer']; diff --git a/lang/en_us.php b/lang/en_us.php index ba9ab86..c24a807 100644 --- a/lang/en_us.php +++ b/lang/en_us.php @@ -137,4 +137,5 @@ define("STRINGS", [ "card x added" => "Gift card #{arg} added.", "card x saved" => "Gift card #{arg} updated.", "open drawer" => "Open Drawer", + "no items" => "No items in transaction.", ]);