Skip to content
Snippets Groups Projects
Unverified Commit 09c195fb authored by Peter Rotich's avatar Peter Rotich Committed by GitHub
Browse files

Merge pull request #4914 from greezybacon/issue/task-thread-edit

task: Implement edit of task thread
parents 35b260f9 394ddee8
No related branches found
No related tags found
No related merge requests found
......@@ -204,8 +204,24 @@ class TaskModel extends VerySimpleModel {
return $this->setFlag(self::ISOPEN);
}
function isAssigned() {
return ($this->isOpen() && ($this->getStaffId() || $this->getTeamId()));
function isAssigned($to=null) {
if (!$this->isOpen())
return false;
if (is_null($to))
return ($this->getStaffId() || $this->getTeamId());
switch (true) {
case $to instanceof Staff:
return ($to->getId() == $this->getStaffId() ||
$to->isTeamMember($this->getTeamId()));
break;
case $to instanceof Team:
return ($to->getId() == $this->getTeamId());
break;
}
return false;
}
function isOverdue() {
......
......@@ -138,6 +138,13 @@ class TEA_EditThreadEntry extends ThreadEntryAction {
&& ($role = $thisstaff->getRole($T->getDeptId(), $T->isAssigned($thisstaff)))
&& $role->hasPerm(ThreadEntry::PERM_EDIT)
)
|| ($T instanceof Task
&& $T->getDept()->getManagerId() == $thisstaff->getId()
)
|| ($T instanceof Task
&& ($role = $thisstaff->getRole($T->getDeptId(), $T->isAssigned($thisstaff)))
&& $role->hasPerm(ThreadEntry::PERM_EDIT)
)
);
}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment