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..cb0711b1 100644 --- a/public/include/pages/account/workers.inc.php +++ b/public/include/pages/account/workers.inc.php @@ -1,5 +1,4 @@ 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');