Skip to content
Snippets Groups Projects
Commit 394ddee8 authored by Jared Hancock's avatar Jared Hancock
Browse files

task: Implement edit of task thread

This fixes an issue where, for task threads, if an agent has the thread edit
permission, the agent was neither able to edit his or her own entries, nor the
entries of other agents.
parent 35b260f9
No related branches found
No related tags found
No related merge requests found
...@@ -204,8 +204,24 @@ class TaskModel extends VerySimpleModel { ...@@ -204,8 +204,24 @@ class TaskModel extends VerySimpleModel {
return $this->setFlag(self::ISOPEN); return $this->setFlag(self::ISOPEN);
} }
function isAssigned() { function isAssigned($to=null) {
return ($this->isOpen() && ($this->getStaffId() || $this->getTeamId())); 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() { function isOverdue() {
......
...@@ -138,6 +138,13 @@ class TEA_EditThreadEntry extends ThreadEntryAction { ...@@ -138,6 +138,13 @@ class TEA_EditThreadEntry extends ThreadEntryAction {
&& ($role = $thisstaff->getRole($T->getDeptId(), $T->isAssigned($thisstaff))) && ($role = $thisstaff->getRole($T->getDeptId(), $T->isAssigned($thisstaff)))
&& $role->hasPerm(ThreadEntry::PERM_EDIT) && $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.
Please register or to comment