diff --git a/include/class.thread.php b/include/class.thread.php index cb5912922eb9f5b3a2c95b075241e3bacc499c72..b06bd0432458f9e062c0a7877274da191d0fb26e 100644 --- a/include/class.thread.php +++ b/include/class.thread.php @@ -2952,6 +2952,10 @@ abstract class ThreadEntryAction { return 'icon-' . $class::$icon; } + function getObJectId() { + return $this->entry->getThread()->getObjectId(); + } + function __construct(ThreadEntry $thread) { $this->entry = $thread; } diff --git a/include/class.thread_actions.php b/include/class.thread_actions.php index 497eb92197242a3dd181a637a0e423b29f4793b6..3423b17c8a3e1ac62ef266ed0560f88b2e27021c 100644 --- a/include/class.thread_actions.php +++ b/include/class.thread_actions.php @@ -135,7 +135,8 @@ class TEA_EditThreadEntry extends ThreadEntryAction { && $T->getDept()->getManagerId() == $thisstaff->getId() ) || ($T instanceof Ticket - && $thisstaff->getRole($T->getDeptId())->hasPerm(ThreadEntry::PERM_EDIT) + && ($role = $thisstaff->getRole($T->getDeptId(), $T->isAssigned($thisstaff))) + && $role->hasPerm(ThreadEntry::PERM_EDIT) ) ); } @@ -469,14 +470,19 @@ JS private function trigger__get() { $vars = array( - 'description' => Format::htmlchars($this->entry->getBody()) - ); - return $this->getTicketsAPI()->addTask($this->entry->getThread()->getObjectId(), - $vars); + 'description' => Format::htmlchars($this->entry->getBody())); + if (($f= TaskForm::getInstance()->getField('description'))) { + $k = 'attach:'.$f->getId(); + foreach ($this->entry->getAttachments() as $a) + if (!$a->inline && $a->file) + $vars[$k][] = $a->file->getId(); + } + + return $this->getTicketsAPI()->addTask($this->getObjectId(), $vars); } private function trigger__post() { - return $this->getTicketsAPI()->addTask($this->entry->getThread()->getObjectId()); + return $this->getTicketsAPI()->addTask($this->getObjectId()); } }