From 3be442bfc5035db2af52cc15d29ef1875c2cad96 Mon Sep 17 00:00:00 2001 From: Frederic Guillot Date: Sun, 22 Jan 2017 17:06:39 -0500 Subject: Avoid PHP notice when validation fail --- app/Controller/ColumnController.php | 18 ++++++++++-------- app/Template/column/edit.php | 1 - 2 files changed, 10 insertions(+), 9 deletions(-) (limited to 'app') diff --git a/app/Controller/ColumnController.php b/app/Controller/ColumnController.php index 8c366c6e..69167976 100644 --- a/app/Controller/ColumnController.php +++ b/app/Controller/ColumnController.php @@ -60,7 +60,7 @@ class ColumnController extends BaseController public function save() { $project = $this->getProject(); - $values = $this->request->getValues(); + $values = $this->request->getValues() + array('hide_in_dashboard' => 0); list($valid, $errors) = $this->columnValidator->validateCreation($values); @@ -70,18 +70,19 @@ class ColumnController extends BaseController $values['title'], $values['task_limit'], $values['description'], - isset($values['hide_in_dashboard']) ? $values['hide_in_dashboard'] : 0 + $values['hide_in_dashboard'] ); if ($result !== false) { $this->flash->success(t('Column created successfully.')); - return $this->response->redirect($this->helper->url->to('ColumnController', 'index', array('project_id' => $project['id'])), true); + $this->response->redirect($this->helper->url->to('ColumnController', 'index', array('project_id' => $project['id'])), true); + return; } else { $errors['title'] = array(t('Another column with the same name exists in the project')); } } - return $this->create($values, $errors); + $this->create($values, $errors); } /** @@ -112,7 +113,7 @@ class ColumnController extends BaseController public function update() { $project = $this->getProject(); - $values = $this->request->getValues(); + $values = $this->request->getValues() + array('hide_in_dashboard' => 0); list($valid, $errors) = $this->columnValidator->validateModification($values); @@ -122,18 +123,19 @@ class ColumnController extends BaseController $values['title'], $values['task_limit'], $values['description'], - isset($values['hide_in_dashboard']) ? $values['hide_in_dashboard'] : 0 + $values['hide_in_dashboard'] ); if ($result) { $this->flash->success(t('Board updated successfully.')); - return $this->response->redirect($this->helper->url->to('ColumnController', 'index', array('project_id' => $project['id']))); + $this->response->redirect($this->helper->url->to('ColumnController', 'index', array('project_id' => $project['id'])), true); + return; } else { $this->flash->failure(t('Unable to update this board.')); } } - return $this->edit($values, $errors); + $this->edit($values, $errors); } /** diff --git a/app/Template/column/edit.php b/app/Template/column/edit.php index a36c2e6c..e590b5cc 100644 --- a/app/Template/column/edit.php +++ b/app/Template/column/edit.php @@ -3,7 +3,6 @@
- form->csrf() ?> form->hidden('id', $values) ?> -- cgit v1.2.3