mirror of
https://github.com/Karaka-Management/oms-Tasks.git
synced 2026-01-10 15:18:40 +00:00
fix responsible
This commit is contained in:
parent
854cad4c1d
commit
f524e490f4
|
|
@ -136,6 +136,9 @@ final class BackendController extends Controller implements DashboardElementInte
|
|||
->with('createdBy')
|
||||
->with('tags')
|
||||
->with('tags/title')
|
||||
->with('taskElements')
|
||||
->with('taskElements/accRelation')
|
||||
->with('taskElements/accRelation/relation')
|
||||
->where('tags/title/language', $response->header->l11n->language)
|
||||
->where('type', TaskType::SINGLE)
|
||||
->where('status', TaskStatus::OPEN)
|
||||
|
|
|
|||
|
|
@ -428,6 +428,31 @@ class Task implements \JsonSerializable
|
|||
return $this->taskElements[$id] ?? new NullTaskElement();
|
||||
}
|
||||
|
||||
public function getResponsible() : array
|
||||
{
|
||||
$responsible = [];
|
||||
foreach ($this->taskElements as $element) {
|
||||
if (empty($element->accRelation)) {
|
||||
continue;
|
||||
}
|
||||
|
||||
$first = true;
|
||||
|
||||
foreach ($element->accRelation as $accRel) {
|
||||
if ($accRel->duty === DutyType::TO) {
|
||||
if ($first) {
|
||||
$responsible = [];
|
||||
}
|
||||
|
||||
$responsible[] = $accRel->relation;
|
||||
$first = false;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return $responsible;
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
|
|
|
|||
|
|
@ -161,24 +161,18 @@ echo $this->data['nav']->render(); ?>
|
|||
</span>
|
||||
</a>
|
||||
<?php endforeach; ?>
|
||||
<td data-label="<?= $this->getHtml('Creator'); ?>">
|
||||
<a class="content" href="<?= UriFactory::build('{/base}/profile/view?{?}&for=' . $task->createdBy->id); ?>">
|
||||
<?= $this->printHtml($this->renderUserName(
|
||||
'%3$s %2$s %1$s',
|
||||
[
|
||||
$task->createdBy->name1,
|
||||
$task->createdBy->name2,
|
||||
$task->createdBy->name3,
|
||||
$task->createdBy->login ?? '',
|
||||
])
|
||||
); ?>
|
||||
</a>
|
||||
<td><?php $responsibles = $task->getResponsible();
|
||||
foreach ($responsibles as $responsible) : ?>
|
||||
<a class="content" href="<?= UriFactory::build('{/base}/profile/view?for=' . $responsible->id); ?>">
|
||||
<?= $this->printHtml($responsible->name1); ?> <?= $this->printHtml($responsible->name2); ?>
|
||||
</a>
|
||||
<?php endforeach; ?>
|
||||
<td data-label="<?= $this->getHtml('Created'); ?>">
|
||||
<a href="<?= $url; ?>"><?= $this->printHtml($task->createdAt->format('Y-m-d H:i')); ?></a>
|
||||
<?php endforeach; if ($c == 0) : ?>
|
||||
<tr><td colspan="7" class="empty"><?= $this->getHtml('Empty', '0', '0'); ?>
|
||||
<?php endif; ?>
|
||||
</table>
|
||||
</table>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user