Skip to content
Snippets Groups Projects
Commit 0cb53efb authored by Peter Rotich's avatar Peter Rotich
Browse files

Thread Action: New Task + Attachments

Include attachments when creating a task from a thread entry
parent ac896f4b
No related branches found
No related tags found
No related merge requests found
...@@ -2952,6 +2952,10 @@ abstract class ThreadEntryAction { ...@@ -2952,6 +2952,10 @@ abstract class ThreadEntryAction {
return 'icon-' . $class::$icon; return 'icon-' . $class::$icon;
} }
function getObJectId() {
return $this->entry->getThread()->getObjectId();
}
function __construct(ThreadEntry $thread) { function __construct(ThreadEntry $thread) {
$this->entry = $thread; $this->entry = $thread;
} }
......
...@@ -135,7 +135,8 @@ class TEA_EditThreadEntry extends ThreadEntryAction { ...@@ -135,7 +135,8 @@ class TEA_EditThreadEntry extends ThreadEntryAction {
&& $T->getDept()->getManagerId() == $thisstaff->getId() && $T->getDept()->getManagerId() == $thisstaff->getId()
) )
|| ($T instanceof Ticket || ($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 ...@@ -469,14 +470,19 @@ JS
private function trigger__get() { private function trigger__get() {
$vars = array( $vars = array(
'description' => Format::htmlchars($this->entry->getBody()) 'description' => Format::htmlchars($this->entry->getBody()));
); if (($f= TaskForm::getInstance()->getField('description'))) {
return $this->getTicketsAPI()->addTask($this->entry->getThread()->getObjectId(), $k = 'attach:'.$f->getId();
$vars); 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() { private function trigger__post() {
return $this->getTicketsAPI()->addTask($this->entry->getThread()->getObjectId()); return $this->getTicketsAPI()->addTask($this->getObjectId());
} }
} }
......
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