Skip to content

Commit

Permalink
fix templates
Browse files Browse the repository at this point in the history
  • Loading branch information
Dennis Eichhorn committed Apr 17, 2024
1 parent 98d1d54 commit 4cc1911
Show file tree
Hide file tree
Showing 3 changed files with 39 additions and 34 deletions.
15 changes: 14 additions & 1 deletion Admin/Install/attributes.json
Original file line number Diff line number Diff line change
Expand Up @@ -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": {
Expand Down Expand Up @@ -102,7 +115,7 @@
{
"name": "measure",
"l11n": {
"en": "measure",
"en": "Measure",
"de": "Maßnahme"
},
"value_type": 1,
Expand Down
10 changes: 7 additions & 3 deletions Controller/ApiController.php
Original file line number Diff line number Diff line change
Expand Up @@ -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 = [];
Expand Down Expand Up @@ -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;
Expand Down Expand Up @@ -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;
Expand Down
48 changes: 18 additions & 30 deletions Controller/BackendController.php
Original file line number Diff line number Diff line change
Expand Up @@ -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'] = [];

Expand Down

0 comments on commit 4cc1911

Please sign in to comment.