From 7e4938f279dd08f2803c87388875082c3858864f Mon Sep 17 00:00:00 2001 From: Sebastian Grewe Date: Tue, 2 Jul 2013 21:08:26 +0200 Subject: [PATCH 1/2] Fixing PHP warnings on account workers page * Fixes PHP Warning if no workers are updated * Fixes PHP Warning in worker class if data is empty Fixes #339 --- public/include/classes/worker.class.php | 4 ++++ public/include/pages/account/workers.inc.php | 3 ++- 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/public/include/classes/worker.class.php b/public/include/classes/worker.class.php index 6cac9827..0aff7a62 100644 --- a/public/include/classes/worker.class.php +++ b/public/include/classes/worker.class.php @@ -42,6 +42,10 @@ class Worker { **/ public function updateWorkers($account_id, $data) { $this->debug->append("STA " . __METHOD__, 4); + if (!is_array($data)) { + $this->setErrorMessage('No workers to update'); + return false; + } $username = $this->user->getUserName($account_id); $iFailed = 0; foreach ($data as $key => $value) { diff --git a/public/include/pages/account/workers.inc.php b/public/include/pages/account/workers.inc.php index ccdae2b8..35affca8 100644 --- a/public/include/pages/account/workers.inc.php +++ b/public/include/pages/account/workers.inc.php @@ -1,4 +1,5 @@ isAuthenticated()) { } break; case 'update': - if ($worker->updateWorkers($_SESSION['USERDATA']['id'], $_POST['data'])) { + if ($worker->updateWorkers($_SESSION['USERDATA']['id'], @$_POST['data'])) { $_SESSION['POPUP'][] = array('CONTENT' => 'Worker updated'); } else { $_SESSION['POPUP'][] = array('CONTENT' => $worker->getError(), 'TYPE' => 'errormsg'); From 591fc3733b8cf65458450a504dbed2daf0fa523b Mon Sep 17 00:00:00 2001 From: Sebastian Grewe Date: Tue, 2 Jul 2013 21:10:12 +0200 Subject: [PATCH 2/2] removing error reporting for debugging --- public/include/pages/account/workers.inc.php | 2 -- 1 file changed, 2 deletions(-) diff --git a/public/include/pages/account/workers.inc.php b/public/include/pages/account/workers.inc.php index 35affca8..cb0711b1 100644 --- a/public/include/pages/account/workers.inc.php +++ b/public/include/pages/account/workers.inc.php @@ -1,6 +1,4 @@