diff options
author | Malf Furious <m@lfurio.us> | 2018-10-20 21:43:46 -0400 |
---|---|---|
committer | Malf Furious <m@lfurio.us> | 2018-10-20 21:43:46 -0400 |
commit | b093b3affe3ac6878e2242bff310dc466687a825 (patch) | |
tree | 6d7606813f85a5e4cca705b20d6632b9ab29ae57 /app | |
parent | 9df5344050ec0a2b8bec03c7a89fff9d7d41ce2f (diff) | |
download | scrott-b093b3affe3ac6878e2242bff310dc466687a825.tar.gz scrott-b093b3affe3ac6878e2242bff310dc466687a825.zip |
issue: Add open/close data
Diffstat (limited to 'app')
-rw-r--r-- | app/class/issue.class.php | 31 |
1 files changed, 30 insertions, 1 deletions
diff --git a/app/class/issue.class.php b/app/class/issue.class.php index 651096e..5d1daec 100644 --- a/app/class/issue.class.php +++ b/app/class/issue.class.php @@ -33,9 +33,12 @@ class issue extends obj "numb", "assignee", "author", + "closer", "seen", "description", + "opened", "authored", + "closed", "due", "tags", ); @@ -62,6 +65,7 @@ class issue extends obj $issue->numb = $numb; $issue->setAuthor($owner); $issue->saveObj(); // get timestamp + $issue->opened = $issue->created; $issue->authored = $issue->created; $issue->saveObj(); return $issue; @@ -113,6 +117,27 @@ class issue extends obj } /* + * Get the user that closed this issue. If the issue is still + * open, NULL is returned. + */ + public function getCloser() : ?user + { + if (!isset($this->closer) || $this->closer == "") + return NULL; + + return new user($this->closer); + } + + /* + * Mark the user that closed this issue. + */ + public function setCloser(user $closer) : void + { + $this->closer = $closer->guid; + $this->saveObj(); + } + + /* * Get the pad this issue exists under */ public function getPad() : pad @@ -145,12 +170,16 @@ class issue extends obj /* * Mark this issue as completed and closed. */ - public function close() : void + public function close(user $closer) : void { $pad = $this->getParent()->getParent(); if ($pad) + { + $this->closed = self::getCurrentTimestamp(); + $this->setCloser($closer); $this->setParent($pad); + } } } |