From 4c47c96ad2f72d2ebfc8556da6a4e3fe3a210991 Mon Sep 17 00:00:00 2001 From: Dennis Eichhorn Date: Sun, 12 May 2024 00:06:29 +0000 Subject: [PATCH] bug fixes --- .github/workflows/greetings.yml | 2 +- Admin/Install/SearchCommands.php | 1 + Controller/ApiAttributeController.php | 2 +- Controller/ApiController.php | 13 +++++++++---- Controller/BackendController.php | 13 ++++++++----- Models/Attribute/TaskAttributeTypeMapper.php | 2 +- Models/TaskMapper.php | 3 +-- Theme/Backend/Components/Tasks/list.tpl.php | 4 ++-- Theme/Backend/Lang/Navigation.de.lang.php | 2 +- Theme/Backend/dashboard-task.tpl.php | 4 ++-- Theme/Backend/task-create.tpl.php | 8 ++++---- Theme/Backend/task-dashboard.tpl.php | 8 ++++---- Theme/Backend/task-list.tpl.php | 4 ++-- Theme/Backend/task-view.tpl.php | 6 +++--- 14 files changed, 40 insertions(+), 32 deletions(-) diff --git a/.github/workflows/greetings.yml b/.github/workflows/greetings.yml index adb8716..75cb759 100755 --- a/.github/workflows/greetings.yml +++ b/.github/workflows/greetings.yml @@ -9,5 +9,5 @@ jobs: - uses: actions/first-interaction@v1 with: repo-token: ${{ secrets.GITHUB_TOKEN }} - issue-message: 'Thank you for createing this issue. We will check it as soon as possible.' + issue-message: 'Thank you for creating this issue. We will check it as soon as possible.' pr-message: 'Thank you for your pull request. We will check it as soon as possible.' diff --git a/Admin/Install/SearchCommands.php b/Admin/Install/SearchCommands.php index 1cdfbfd..7e6ccc3 100755 --- a/Admin/Install/SearchCommands.php +++ b/Admin/Install/SearchCommands.php @@ -34,6 +34,7 @@ return [ 'dest' => '\Modules\Tasks\Controller\SearchController:searchGeneral', 'verb' => RouteVerb::ANY, 'active' => true, + 'order' => 2, 'permission' => [ 'module' => SearchController::NAME, 'type' => PermissionType::READ, diff --git a/Controller/ApiAttributeController.php b/Controller/ApiAttributeController.php index 174e579..1fe58fc 100644 --- a/Controller/ApiAttributeController.php +++ b/Controller/ApiAttributeController.php @@ -66,7 +66,7 @@ final class ApiAttributeController extends Controller ->where('id', (int) $request->getData('type')) ->execute(); - if (!$type->repeatable) { + if (!$type->isRepeatable) { $attr = TaskAttributeMapper::count() ->with('type') ->where('type/id', $type->id) diff --git a/Controller/ApiController.php b/Controller/ApiController.php index f457926..9f3023d 100755 --- a/Controller/ApiController.php +++ b/Controller/ApiController.php @@ -201,13 +201,13 @@ final class ApiController extends Controller */ public function createNotifications(TaskElement $ele, int $type, RequestAbstract $request) : void { - $accChecked = []; - $grpChecked = []; + $accChecked = [$ele->createdBy->id]; + //$grpChecked = []; $task = TaskMapper::get() ->with('taskElements') ->with('taskElements/accRelation') - ->with('taskElements/grpRelation') + //->with('taskElements/grpRelation') ->where('id', $ele->task) ->execute(); @@ -225,6 +225,8 @@ final class ApiController extends Controller continue; } + $accChecked[] = $rel->relation->id; + $profile = ProfileMapper::count() ->where('account', $rel->relation->id) ->executeCount(); @@ -246,10 +248,10 @@ final class ApiController extends Controller : $task->redirect; $this->createModel($request->header->account, $notification, NotificationMapper::class, 'notification', $request->getOrigin()); - $accChecked[] = $rel->relation->id; } // Group relations + /* Ignore groups since they are not directly mentioned foreach ($element->grpRelation as $rel) { if (\in_array($rel->relation->id, $grpChecked)) { continue; @@ -291,6 +293,7 @@ final class ApiController extends Controller $grpChecked[] = $rel->relation->id; } + */ } } @@ -398,9 +401,11 @@ final class ApiController extends Controller $task->priority = (int) $request->getData('priority'); } + /* if ($request->hasData('tags')) { $task->tags = $this->app->moduleManager->get('Tag', 'Api')->createTagsFromRequest($request); } + */ $element = new TaskElement(); $element->addTo(new NullAccount($request->getDataInt('forward') ?? $request->header->account)); diff --git a/Controller/BackendController.php b/Controller/BackendController.php index 847cda6..89f02ad 100755 --- a/Controller/BackendController.php +++ b/Controller/BackendController.php @@ -212,19 +212,22 @@ final class BackendController extends Controller implements DashboardElementInte $view->setTemplate('/Modules/Tasks/Theme/Backend/dashboard-task'); $view->data['nav'] = $this->app->moduleManager->get('Navigation')->createNavigationMid(1001101001, $request, $response); - /** @var \Modules\Tasks\Models\Task[] $tasks */ - $tasks = TaskMapper::getAnyRelatedToUser($request->header->account) + $limit = new \DateTime('now'); + $limit->modify('+14 days'); + + $view->data['tasks'] = TaskMapper::getAnyRelatedToUser($request->header->account) ->with('tags') ->with('tags/title') ->sort('taskElements/createdAt', OrderType::DESC) - ->limit(5) ->where('id', 0, '>') ->where('type', TaskType::SINGLE) + ->where('start', $limit->format('Y-m-d'), '<') + ->where('due', $limit->format('Y-m-d'), '<') + ->where('done', null) ->where('tags/title/language', $response->header->l11n->language) + ->limit(5) ->execute(); - $view->data['tasks'] = $tasks; - return $view; } diff --git a/Models/Attribute/TaskAttributeTypeMapper.php b/Models/Attribute/TaskAttributeTypeMapper.php index f24e1f6..d1bf22d 100644 --- a/Models/Attribute/TaskAttributeTypeMapper.php +++ b/Models/Attribute/TaskAttributeTypeMapper.php @@ -42,7 +42,7 @@ final class TaskAttributeTypeMapper extends DataMapperFactory 'task_attr_type_datatype' => ['name' => 'task_attr_type_datatype', 'type' => 'int', 'internal' => 'datatype'], 'task_attr_type_fields' => ['name' => 'task_attr_type_fields', 'type' => 'int', 'internal' => 'fields'], 'task_attr_type_custom' => ['name' => 'task_attr_type_custom', 'type' => 'bool', 'internal' => 'custom'], - 'task_attr_type_repeatable' => ['name' => 'task_attr_type_repeatable', 'type' => 'bool', 'internal' => 'repeatable'], + 'task_attr_type_repeatable' => ['name' => 'task_attr_type_repeatable', 'type' => 'bool', 'internal' => 'isRepeatable'], 'task_attr_type_internal' => ['name' => 'task_attr_type_internal', 'type' => 'bool', 'internal' => 'isInternal'], 'task_attr_type_pattern' => ['name' => 'task_attr_type_pattern', 'type' => 'string', 'internal' => 'validationPattern'], 'task_attr_type_required' => ['name' => 'task_attr_type_required', 'type' => 'bool', 'internal' => 'isRequired'], diff --git a/Models/TaskMapper.php b/Models/TaskMapper.php index 6af5294..a01152f 100755 --- a/Models/TaskMapper.php +++ b/Models/TaskMapper.php @@ -417,8 +417,7 @@ final class TaskMapper extends DataMapperFactory ->andWhere(AccountRelationMapper::TABLE . '.task_account_account', '=', $user) ->andWhere(TaskSeenMapper::TABLE . '.task_seen_task', '=', null); - $sth = self::$db->con->prepare($query->toSql()); - $sth->execute(); + $sth = $query->execute(); $fetched = $sth->fetchAll(\PDO::FETCH_COLUMN); if ($fetched === false) { diff --git a/Theme/Backend/Components/Tasks/list.tpl.php b/Theme/Backend/Components/Tasks/list.tpl.php index 119c433..18ef016 100755 --- a/Theme/Backend/Components/Tasks/list.tpl.php +++ b/Theme/Backend/Components/Tasks/list.tpl.php @@ -19,7 +19,7 @@ use phpOMS\Uri\UriFactory; ?>
-
+
getHtml('News', 'News'); ?>
@@ -55,5 +55,5 @@ use phpOMS\Uri\UriFactory;
-
+
diff --git a/Theme/Backend/Lang/Navigation.de.lang.php b/Theme/Backend/Lang/Navigation.de.lang.php index 5c9b9a8..295825a 100755 --- a/Theme/Backend/Lang/Navigation.de.lang.php +++ b/Theme/Backend/Lang/Navigation.de.lang.php @@ -13,7 +13,7 @@ declare(strict_types=1); return ['Navigation' => [ - 'Analysis' => 'Analyse', + 'Analysis' => 'Auswertung', 'Create' => 'Erstellen', 'Tasks' => 'Aufgaben', ]]; diff --git a/Theme/Backend/dashboard-task.tpl.php b/Theme/Backend/dashboard-task.tpl.php index 61265bf..541076f 100755 --- a/Theme/Backend/dashboard-task.tpl.php +++ b/Theme/Backend/dashboard-task.tpl.php @@ -19,7 +19,7 @@ $tasksList = $this->data['tasks'] ?? []; ?>
-
+
getHtml('Tasks', 'Tasks'); ?>
@@ -59,5 +59,5 @@ $tasksList = $this->data['tasks'] ?? []; - + \ No newline at end of file diff --git a/Theme/Backend/task-create.tpl.php b/Theme/Backend/task-create.tpl.php index 9a75297..96b5c74 100755 --- a/Theme/Backend/task-create.tpl.php +++ b/Theme/Backend/task-create.tpl.php @@ -20,7 +20,7 @@ echo $this->data['nav']->render(); ?>
-
+
getHtml('Task'); ?>
@@ -69,11 +69,11 @@ echo $this->data['nav']->render(); ?>
-
+
-
+
getHtml('Media'); ?>
@@ -91,7 +91,7 @@ echo $this->data['nav']->render(); ?>
-
+
diff --git a/Theme/Backend/task-dashboard.tpl.php b/Theme/Backend/task-dashboard.tpl.php index b8617cb..22650d8 100755 --- a/Theme/Backend/task-dashboard.tpl.php +++ b/Theme/Backend/task-dashboard.tpl.php @@ -32,7 +32,7 @@ echo $this->data['nav']->render(); ?>
-
+
getHtml('YourOpen'); ?> ()download
@@ -102,13 +102,13 @@ echo $this->data['nav']->render(); ?>
-
+
-
+
getHtml('OpenGiven'); ?> (data['given']); ?>)download
@@ -172,7 +172,7 @@ echo $this->data['nav']->render(); ?>
-
+
diff --git a/Theme/Backend/task-list.tpl.php b/Theme/Backend/task-list.tpl.php index 7fb1af7..0cd0762 100644 --- a/Theme/Backend/task-list.tpl.php +++ b/Theme/Backend/task-list.tpl.php @@ -26,7 +26,7 @@ echo $this->data['nav']->render(); ?>
-
+
getHtml('All'); ?>download
@@ -101,6 +101,6 @@ echo $this->data['nav']->render(); ?> getHtml('Previous', '0', '0'); ?>getHtml('Next', '0', '0'); ?> - + diff --git a/Theme/Backend/task-view.tpl.php b/Theme/Backend/task-view.tpl.php index e6e133b..46adf7c 100644 --- a/Theme/Backend/task-view.tpl.php +++ b/Theme/Backend/task-view.tpl.php @@ -386,13 +386,13 @@ echo $this->data['nav']->render(); ?>
- -