From a524901bfeb38494d777cc3d6266526c5733984d Mon Sep 17 00:00:00 2001 From: Joey Schulze Date: Tue, 17 Jan 2012 22:55:14 +0100 Subject: [PATCH] Return error message when no products have been selected --- ordersatz_pos.php | 4 +++- utils.php | 3 +++ 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/ordersatz_pos.php b/ordersatz_pos.php index 1d9d915..6b682ad 100644 --- a/ordersatz_pos.php +++ b/ordersatz_pos.php @@ -235,8 +235,10 @@ function cb_pdf() $tmpdir = mk_tempdir(); $result = ordersatz_write($_SESSION['ordersatz'], $tmpdir, false); - if ($result !== true) + if ($result !== true) { + rm_tempdir($tmpdir); return array('error' => $result); + } return array('tmpdir' => substr($tmpdir,strlen($_SESSION['sys']['basedir']))); } diff --git a/utils.php b/utils.php index 9f9261f..a9ae57e 100644 --- a/utils.php +++ b/utils.php @@ -137,6 +137,9 @@ function ordersatz_write($id, $dir, $send) $result = query_db($sql); + if (count($result) == 0) + return "Keine Artikel zur Bestellung ausgewählt"; + $f = fopen(FNAME_ITEMS, 'w'); foreach ($result as $row) { -- 2.20.1