diff --git a/messages/de/base.php b/messages/de/base.php index 8541238e..533797a1 100644 --- a/messages/de/base.php +++ b/messages/de/base.php @@ -178,4 +178,7 @@ '{userName} started working on Task {task} in space {spaceName}.' => '{userName} hat begonnen, an der Aufgabe {task} im Space {spaceName} zu arbeiten.', '{userName} works on task {task}.' => '{userName} arbeitet an der Aufgabe {task}.', 'Task content ID' => '', + "Archived" => "Archiviert", + "List: {name}" => "Liste: {name}", + "Due Date" => "Fälligkeitsdatum" ]; diff --git a/models/forms/TaskFilter.php b/models/forms/TaskFilter.php index b27f9e90..d24effa7 100644 --- a/models/forms/TaskFilter.php +++ b/models/forms/TaskFilter.php @@ -35,6 +35,7 @@ class TaskFilter extends Model public const FILTER_SPACE = 'spaces'; public const FILTER_DATE_START = 'date_start'; public const FILTER_DATE_END = 'date_end'; + public const FILTER_ARCHIVED = "archived"; public $filters = []; @@ -88,13 +89,19 @@ public function query() { $this->validate(); - $query = Task::find()->readable()->andWhere('content.archived = 0'); + $query = Task::find()->readable(); + + if ($this->isFilterActive(static::FILTER_ARCHIVED)) { + $query->andWhere("content.archived = 1"); + } else { + $query->andWhere("content.archived = 0"); + } if ($this->contentContainer) { $query->contentContainer($this->contentContainer); } elseif (!empty($this->spaces)) { - $query->joinWith(['content', 'content.contentContainer', 'content.createdBy']); + $query->joinWith(['content.contentContainer', 'content.createdBy']); $query->andWhere(['IN', 'contentcontainer.guid', $this->spaces]); } else { // exclude archived content from global view @@ -134,12 +141,15 @@ public function query() if (! empty($this->date_start) && ! empty($this->date_end)) { $query->andWhere( - ['or', - ['and', + [ + 'or', + [ + 'and', CalendarUtils::getStartCriteria($this->date_start, 'start_datetime', '>='), CalendarUtils::getStartCriteria($this->date_end, 'start_datetime', '<='), ], - ['and', + [ + 'and', CalendarUtils::getEndCriteria($this->date_start, 'end_datetime', '>='), CalendarUtils::getEndCriteria($this->date_end, 'end_datetime', '<='), ], diff --git a/models/lists/TaskList.php b/models/lists/TaskList.php index ad441e68..0993ba6a 100644 --- a/models/lists/TaskList.php +++ b/models/lists/TaskList.php @@ -11,7 +11,6 @@ use humhub\modules\content\components\ActiveQueryContent; use humhub\modules\content\components\ContentContainerActiveRecord; -use humhub\modules\content\models\ContentContainer; use humhub\modules\content\models\ContentTag; use humhub\modules\tasks\models\Sortable; use humhub\modules\tasks\models\Task; @@ -50,7 +49,7 @@ public function afterSave($insert, $changedAttributes) */ public function getTasks() { - return Task::find()->andWhere(['task_list_id' => $this->id])->readable(); + return Task::find()->where(['task_list_id' => $this->id])->andWhere(["content.archived" => 0])->readable(); } public function load($data, $formName = null) @@ -65,7 +64,7 @@ public function load($data, $formName = null) */ public function getNonCompletedTasks() { - return $this->getTasks()->where(['!=', 'task.status', Task::STATUS_COMPLETED])->orderBy(['sort_order' => SORT_ASC, 'updated_at' => SORT_DESC]); + return $this->getTasks()->andWhere(['!=', 'task.status', Task::STATUS_COMPLETED])->orderBy(['sort_order' => SORT_ASC, 'updated_at' => SORT_DESC]); } /** @@ -92,7 +91,7 @@ public function getCompletedTasks() */ public function getTasksByStatus($status) { - return $this->getTasks()->where(['task.status' => $status]); + return $this->getTasks()->andWhere(['task.status' => $status]); } /** @@ -129,7 +128,8 @@ public static function findByFilter($container, $filters = []) $includes = is_array($filters[static::FILTER_STATUS_INCLUDE]) ? $filters[static::FILTER_STATUS_INCLUDE] : [$filters[static::FILTER_STATUS_INCLUDE]]; $query->andWhere( - ['OR', + [ + 'OR', ['IS', 'task.id', new Expression("NULL")], ['IN', 'task.status', $includes], ], @@ -152,7 +152,8 @@ public static function findOverviewLists(ContentContainerActiveRecord $container $includes = [Task::STATUS_IN_PROGRESS, Task::STATUS_PENDING_REVIEW, Task::STATUS_PENDING]; $query->andWhere( - ['OR', + [ + 'OR', ['IN', 'task.status', $includes], ['IS', 'task.id', new Expression("NULL")], ['task_list_setting.hide_if_completed' => '0'], @@ -176,7 +177,8 @@ public static function findHiddenLists(ContentContainerActiveRecord $container) $subQuery = Task::find()->where('task.task_list_id = content_tag.id')->andWhere(['IN', 'task.status', $includes]); $query->andWhere( - ['AND', + [ + 'AND', ['NOT EXISTS', $subQuery], ['IS NOT', 't.id', new Expression("NULL")], ['task_list_setting.hide_if_completed' => '1'], diff --git a/models/lists/UnsortedTaskList.php b/models/lists/UnsortedTaskList.php index 1242e20c..027d9f7f 100644 --- a/models/lists/UnsortedTaskList.php +++ b/models/lists/UnsortedTaskList.php @@ -25,7 +25,7 @@ public function getTasks() */ public function getNonCompletedTasks() { - return $this->getTasks()->where(['!=', 'task.status', Task::STATUS_COMPLETED])->orderBy(['sort_order' => SORT_ASC, 'task.updated_at' => SORT_DESC]); + return $this->getTasks()->where(['!=', 'task.status', Task::STATUS_COMPLETED])->andWhere(["content.archived" => 0])->orderBy(['sort_order' => SORT_ASC, 'task.updated_at' => SORT_DESC]); } /** diff --git a/module.json b/module.json index 34ae1dce..155fc027 100644 --- a/module.json +++ b/module.json @@ -1,26 +1,21 @@ { - "id": "tasks", - "name": "Tasks", - "description": "Create tasks, assign users, set deadlines, and organize projects to keep your team on track.", - "keywords": [ - "task", - "todo", - "project", - "management" - ], - "version": "1.8.8", - "homepage": "https://github.com/humhub/tasks", - "humhub": { - "minVersion": "1.14" - }, - "screenshots": [ - "resources/screenshot1.png", - "resources/screenshot2.png", - "resources/screenshot3.png", - "resources/screenshot4.png", - "resources/screenshot5.png", - "resources/screenshot6.png", - "resources/screenshot7.png", - "resources/screenshot8.png" - ] + "id": "tasks", + "name": "Tasks", + "description": "Create tasks, assign users, set deadlines, and organize projects to keep your team on track.", + "keywords": ["task", "todo", "project", "management"], + "version": "1.8.9", + "homepage": "https://github.com/humhub/tasks", + "humhub": { + "minVersion": "1.14" + }, + "screenshots": [ + "resources/screenshot1.png", + "resources/screenshot2.png", + "resources/screenshot3.png", + "resources/screenshot4.png", + "resources/screenshot5.png", + "resources/screenshot6.png", + "resources/screenshot7.png", + "resources/screenshot8.png" + ] } diff --git a/views/global/index.php b/views/global/index.php index 63cfd75e..b87000da 100644 --- a/views/global/index.php +++ b/views/global/index.php @@ -3,7 +3,6 @@ use humhub\modules\tasks\assets\Assets; use humhub\modules\tasks\widgets\search\TaskSearchList; use humhub\modules\tasks\widgets\search\TaskFilterNavigation; -use humhub\modules\tasks\models\forms\TaskFilter; /* @var $this \humhub\modules\ui\view\components\View */ /* @var $filter TaskFilter */ @@ -24,5 +23,4 @@ = TaskSearchList::widget(['filter' => $filter]) ?> - - + \ No newline at end of file diff --git a/views/list/index.php b/views/list/index.php index ba1e0c75..391bbb5b 100644 --- a/views/list/index.php +++ b/views/list/index.php @@ -1,4 +1,5 @@ -