Minor fixes

This commit is contained in:
Frederic Guillot
2016-05-28 20:26:23 -04:00
parent 729c933d00
commit 9370797095
12 changed files with 18 additions and 16 deletions

View File

@@ -28,6 +28,7 @@ use Symfony\Component\Console\Command\Command;
* @property \Kanboard\Model\ProjectUserRoleModel $projectUserRoleModel * @property \Kanboard\Model\ProjectUserRoleModel $projectUserRoleModel
* @property \Kanboard\Core\Plugin\Loader $pluginLoader * @property \Kanboard\Core\Plugin\Loader $pluginLoader
* @property \Kanboard\Core\Http\Client $httpClient * @property \Kanboard\Core\Http\Client $httpClient
* @property \Kanboard\Core\Queue\QueueManager $queueManager
* @property \Symfony\Component\EventDispatcher\EventDispatcher $dispatcher * @property \Symfony\Component\EventDispatcher\EventDispatcher $dispatcher
*/ */
abstract class BaseCommand extends Command abstract class BaseCommand extends Command

View File

@@ -64,7 +64,7 @@ class CategoryController extends BaseController
list($valid, $errors) = $this->categoryValidator->validateCreation($values); list($valid, $errors) = $this->categoryValidator->validateCreation($values);
if ($valid) { if ($valid) {
if ($this->categoryModel->create($values)) { if ($this->categoryModel->create($values) !== false) {
$this->flash->success(t('Your category have been created successfully.')); $this->flash->success(t('Your category have been created successfully.'));
return $this->response->redirect($this->helper->url->to('CategoryController', 'index', array('project_id' => $project['id']))); return $this->response->redirect($this->helper->url->to('CategoryController', 'index', array('project_id' => $project['id'])));
} else { } else {

View File

@@ -66,7 +66,7 @@ class ColumnController extends BaseController
list($valid, $errors) = $this->columnValidator->validateCreation($values); list($valid, $errors) = $this->columnValidator->validateCreation($values);
if ($valid) { if ($valid) {
if ($this->columnModel->create($project['id'], $values['title'], $values['task_limit'], $values['description'])) { if ($this->columnModel->create($project['id'], $values['title'], $values['task_limit'], $values['description']) !== false) {
$this->flash->success(t('Column created successfully.')); $this->flash->success(t('Column created successfully.'));
return $this->response->redirect($this->helper->url->to('ColumnController', 'index', array('project_id' => $project['id'])), true); return $this->response->redirect($this->helper->url->to('ColumnController', 'index', array('project_id' => $project['id'])), true);
} else { } else {

View File

@@ -76,7 +76,7 @@ class CommentController extends BaseController
list($valid, $errors) = $this->commentValidator->validateCreation($values); list($valid, $errors) = $this->commentValidator->validateCreation($values);
if ($valid) { if ($valid) {
if ($this->commentModel->create($values)) { if ($this->commentModel->create($values) !== false) {
$this->flash->success(t('Comment added successfully.')); $this->flash->success(t('Comment added successfully.'));
} else { } else {
$this->flash->failure(t('Unable to create your comment.')); $this->flash->failure(t('Unable to create your comment.'));

View File

@@ -18,6 +18,9 @@ class CustomFilterController extends BaseController
* Display list of filters * Display list of filters
* *
* @access public * @access public
* @param array $values
* @param array $errors
* @throws \Kanboard\Core\Controller\PageNotFoundException
*/ */
public function index(array $values = array(), array $errors = array()) public function index(array $values = array(), array $errors = array())
{ {
@@ -47,7 +50,7 @@ class CustomFilterController extends BaseController
list($valid, $errors) = $this->customFilterValidator->validateCreation($values); list($valid, $errors) = $this->customFilterValidator->validateCreation($values);
if ($valid) { if ($valid) {
if ($this->customFilterModel->create($values)) { if ($this->customFilterModel->create($values) !== false) {
$this->flash->success(t('Your custom filter have been created successfully.')); $this->flash->success(t('Your custom filter have been created successfully.'));
return $this->response->redirect($this->helper->url->to('CustomFilterController', 'index', array('project_id' => $project['id']))); return $this->response->redirect($this->helper->url->to('CustomFilterController', 'index', array('project_id' => $project['id'])));
} else { } else {
@@ -101,6 +104,10 @@ class CustomFilterController extends BaseController
* Edit a custom filter (display the form) * Edit a custom filter (display the form)
* *
* @access public * @access public
* @param array $values
* @param array $errors
* @throws AccessForbiddenException
* @throws \Kanboard\Core\Controller\PageNotFoundException
*/ */
public function edit(array $values = array(), array $errors = array()) public function edit(array $values = array(), array $errors = array())
{ {

View File

@@ -54,7 +54,7 @@ class SubtaskController extends BaseController
list($valid, $errors) = $this->subtaskValidator->validateCreation($values); list($valid, $errors) = $this->subtaskValidator->validateCreation($values);
if ($valid) { if ($valid) {
if ($this->subtaskModel->create($values)) { if ($this->subtaskModel->create($values) !== false) {
$this->flash->success(t('Sub-task added successfully.')); $this->flash->success(t('Sub-task added successfully.'));
} else { } else {
$this->flash->failure(t('Unable to create your sub-task.')); $this->flash->failure(t('Unable to create your sub-task.'));

View File

@@ -81,7 +81,7 @@ class SwimlaneController extends BaseController
list($valid, $errors) = $this->swimlaneValidator->validateCreation($values); list($valid, $errors) = $this->swimlaneValidator->validateCreation($values);
if ($valid) { if ($valid) {
if ($this->swimlaneModel->create($values)) { if ($this->swimlaneModel->create($values) !== false) {
$this->flash->success(t('Your swimlane have been created successfully.')); $this->flash->success(t('Your swimlane have been created successfully.'));
return $this->response->redirect($this->helper->url->to('SwimlaneController', 'index', array('project_id' => $project['id']))); return $this->response->redirect($this->helper->url->to('SwimlaneController', 'index', array('project_id' => $project['id'])));
} else { } else {

View File

@@ -76,7 +76,7 @@ class TaskExternalLinkController extends BaseController
$values = $this->request->getValues(); $values = $this->request->getValues();
list($valid, $errors) = $this->externalLinkValidator->validateCreation($values); list($valid, $errors) = $this->externalLinkValidator->validateCreation($values);
if ($valid && $this->taskExternalLinkModel->create($values)) { if ($valid && $this->taskExternalLinkModel->create($values) !== false) {
$this->flash->success(t('Link added successfully.')); $this->flash->success(t('Link added successfully.'));
return $this->response->redirect($this->helper->url->to('TaskViewController', 'show', array('task_id' => $task['id'], 'project_id' => $task['project_id'])), true); return $this->response->redirect($this->helper->url->to('TaskViewController', 'show', array('task_id' => $task['id'], 'project_id' => $task['project_id'])), true);
} }

View File

@@ -40,11 +40,6 @@ class TaskHelper extends Base
return $this->taskModel->getRecurrenceBasedateList(); return $this->taskModel->getRecurrenceBasedateList();
} }
public function canRemove(array $task)
{
return $this->taskPermission->canRemoveTask($task);
}
public function selectAssignee(array $users, array $values, array $errors = array(), array $attributes = array()) public function selectAssignee(array $users, array $values, array $errors = array(), array $attributes = array())
{ {
$attributes = array_merge(array('tabindex="3"'), $attributes); $attributes = array_merge(array('tabindex="3"'), $attributes);

View File

@@ -56,7 +56,7 @@ class UserImport extends Base
$row = $this->prepare($row); $row = $this->prepare($row);
if ($this->validateCreation($row)) { if ($this->validateCreation($row)) {
if ($this->userModel->create($row)) { if ($this->userModel->create($row) !== false) {
$this->logger->debug('UserImport: imported successfully line '.$line_number); $this->logger->debug('UserImport: imported successfully line '.$line_number);
$this->counter++; $this->counter++;
} else { } else {

View File

@@ -3,7 +3,6 @@
namespace Kanboard\Model; namespace Kanboard\Model;
use Kanboard\Event\CommentEvent; use Kanboard\Event\CommentEvent;
use Kanboard\Core\Base; use Kanboard\Core\Base;
/** /**
@@ -114,7 +113,7 @@ class CommentModel extends Base
$values['date_creation'] = time(); $values['date_creation'] = time();
$comment_id = $this->db->table(self::TABLE)->persist($values); $comment_id = $this->db->table(self::TABLE)->persist($values);
if ($comment_id) { if ($comment_id !== false) {
$event = new CommentEvent(array('id' => $comment_id) + $values); $event = new CommentEvent(array('id' => $comment_id) + $values);
$this->dispatcher->dispatch(self::EVENT_CREATE, $event); $this->dispatcher->dispatch(self::EVENT_CREATE, $event);
$this->userMentionModel->fireEvents($values['comment'], self::EVENT_USER_MENTION, $event); $this->userMentionModel->fireEvents($values['comment'], self::EVENT_USER_MENTION, $event);

View File

@@ -218,7 +218,7 @@ class SubtaskModel extends Base
$this->prepareCreation($values); $this->prepareCreation($values);
$subtask_id = $this->db->table(self::TABLE)->persist($values); $subtask_id = $this->db->table(self::TABLE)->persist($values);
if ($subtask_id) { if ($subtask_id !== false) {
$this->container['dispatcher']->dispatch( $this->container['dispatcher']->dispatch(
self::EVENT_CREATE, self::EVENT_CREATE,
new SubtaskEvent(array('id' => $subtask_id) + $values) new SubtaskEvent(array('id' => $subtask_id) + $values)