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 | |
| parent | 9df5344050ec0a2b8bec03c7a89fff9d7d41ce2f (diff) | |
| download | scrott-b093b3affe3ac6878e2242bff310dc466687a825.tar.gz scrott-b093b3affe3ac6878e2242bff310dc466687a825.zip | |
issue:  Add open/close data
Diffstat (limited to '')
| -rw-r--r-- | app/class/issue.class.php | 31 | ||||
| -rw-r--r-- | srvs/mysql.sql | 3 | 
2 files changed, 33 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); +        }      }  } diff --git a/srvs/mysql.sql b/srvs/mysql.sql index 178fb57..9f3193b 100644 --- a/srvs/mysql.sql +++ b/srvs/mysql.sql @@ -181,9 +181,12 @@ CREATE TABLE issues (      numb        int(32)             NOT NULL    DEFAULT 0,      assignee    varchar(8)          NOT NULL    DEFAULT '',      author      varchar(8)          NOT NULL    DEFAULT '', +    closer      varchar(8)          NOT NULL    DEFAULT '',      seen        int(1)              NOT NULL    DEFAULT 0,      /* has the assignee seen this yet? */      description text                NOT NULL, +    opened      varchar(64)         NOT NULL    DEFAULT '',      authored    varchar(64)         NOT NULL    DEFAULT '', +    closed      varchar(64)         NOT NULL    DEFAULT '',      due         varchar(64)         NOT NULL    DEFAULT '',      tags        text                NOT NULL, | 
