diff --git a/Admin/Install/attributes.json b/Admin/Install/attributes.json index f43dcff..9fd124d 100755 --- a/Admin/Install/attributes.json +++ b/Admin/Install/attributes.json @@ -33,6 +33,19 @@ "default_value": "", "values": [] }, + { + "name": "bill", + "l11n": { + "en": "Bill", + "de": "Beleg" + }, + "value_type": "int", + "is_custom_allowed": true, + "validation_pattern": "", + "is_required": false, + "default_value": "", + "values": [] + }, { "name": "lot_external", "l11n": { @@ -102,7 +115,7 @@ { "name": "measure", "l11n": { - "en": "measure", + "en": "Measure", "de": "Maßnahme" }, "value_type": 1, diff --git a/Controller/ApiController.php b/Controller/ApiController.php index d9dcfa0..0eec400 100755 --- a/Controller/ApiController.php +++ b/Controller/ApiController.php @@ -197,7 +197,7 @@ public function apiTaskCreate(RequestAbstract $request, ResponseAbstract $respon * * @since 1.0.0 */ - private function createNotifications(TaskElement $ele, int $type, RequestAbstract $request) : void + public function createNotifications(TaskElement $ele, int $type, RequestAbstract $request) : void { $accChecked = []; $grpChecked = []; @@ -239,7 +239,9 @@ private function createNotifications(TaskElement $ele, int $type, RequestAbstrac $notification->type = $type; $notification->category = PermissionCategory::TASK; $notification->element = $task->id; - $notification->redirect = '{/base}/task/view?{?}&id=' . $element->task; + $notification->redirect = empty($task->redirect) + ? '{/base}/task/view?{?}&id=' . $element->task + : $task->redirect; $this->createModel($request->header->account, $notification, NotificationMapper::class, 'notification', $request->getOrigin()); $accChecked[] = $rel->relation->id; @@ -277,7 +279,9 @@ private function createNotifications(TaskElement $ele, int $type, RequestAbstrac $notification->type = $type; $notification->category = PermissionCategory::TASK; $notification->element = $task->id; - $notification->redirect = '{/base}/task/view?{?}&id=' . $element->task; + $notification->redirect = empty($task->redirect) + ? '{/base}/task/view?{?}&id=' . $element->task + : $task->redirect; $this->createModel($request->header->account, $notification, NotificationMapper::class, 'notification', $request->getOrigin()); $accChecked[] = $account->id; diff --git a/Controller/BackendController.php b/Controller/BackendController.php index bdb1b2d..8054283 100755 --- a/Controller/BackendController.php +++ b/Controller/BackendController.php @@ -162,37 +162,25 @@ public function viewTaskList(RequestAbstract $request, ResponseAbstract $respons $view->setTemplate('/Modules/Tasks/Theme/Backend/task-list'); $view->data['nav'] = $this->app->moduleManager->get('Navigation')->createNavigationMid(1001101001, $request, $response); - if ($isModerator) { - $mapperQuery = TaskMapper::getAll() - ->with('tags') - ->with('tags/title') - ->with('createdBy') - ->where('status', TaskStatus::OPEN, '!=') - ->where('type', TaskType::SINGLE) - ->sort('createdAt', OrderType::DESC) - ->limit(25); - } else { - $mapperQuery = TaskMapper::getAnyRelatedToUser($request->header->account) - ->with('tags') - ->with('tags/title') - ->with('createdBy') - ->where('status', TaskStatus::OPEN, '!=') - ->where('type', TaskType::SINGLE) - ->where('tags/title/language', $response->header->l11n->language) - ->sort('createdAt', OrderType::DESC) - ->limit(25); - } + $mapperQuery = $isModerator + ? TaskMapper::getAll() + : TaskMapper::getAnyRelatedToUser($request->header->account); - if ($request->getData('ptype') === 'p') { - $view->data['tasks'] = $mapperQuery->where('id', $request->getDataInt('offset') ?? 0, '<') - ->executeGetArray(); - } elseif ($request->getData('ptype') === 'n') { - $view->data['tasks'] = $mapperQuery->where('id', $request->getDataInt('offset') ?? 0, '>') - ->executeGetArray(); - } else { - $view->data['tasks'] = $mapperQuery->where('id', 0, '>') - ->executeGetArray(); - } + $view->data['tasks'] = $mapperQuery + ->with('tags') + ->with('tags/title') + ->with('createdBy') + ->where('status', TaskStatus::OPEN, '!=') + ->where('type', TaskType::SINGLE) + ->where('tags/title/language', $response->header->l11n->language) + ->sort('createdAt', OrderType::DESC) + ->limit(25) + ->paginate( + 'id', + $request->getData('ptype'), + $request->getDataInt('offset') + ) + ->executeGetArray(); $view->data['task_media'] = [];