summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorFrederic Guillot <fred@kanboard.net>2017-01-22 17:06:39 -0500
committerFrederic Guillot <fred@kanboard.net>2017-01-22 17:06:39 -0500
commit3be442bfc5035db2af52cc15d29ef1875c2cad96 (patch)
treee03703fc613af5ace7cbbcfec59ad31aa03f8eb6
parent91266df1c9eeb6f6679c5a534af68df35bc951a2 (diff)
Avoid PHP notice when validation fail
-rw-r--r--app/Controller/ColumnController.php18
-rw-r--r--app/Template/column/edit.php1
2 files changed, 10 insertions, 9 deletions
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 @@
</div>
<form method="post" action="<?= $this->url->href('ColumnController', 'update', array('project_id' => $project['id'], 'column_id' => $column['id'])) ?>" autocomplete="off">
-
<?= $this->form->csrf() ?>
<?= $this->form->hidden('id', $values) ?>