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
This commit is contained in:
Sebastian Grewe 2013-07-02 21:08:26 +02:00
parent e3d9bbcb96
commit 7e4938f279
2 changed files with 6 additions and 1 deletions

View File

@ -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) {

View File

@ -1,4 +1,5 @@
<?php
error_reporting(E_ALL);
// Make sure we are called from index.php
if (!defined('SECURITY')) die('Hacking attempt');
@ -20,7 +21,7 @@ if ($user->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');