diff options
Diffstat (limited to 'app/model/issue.php')
-rw-r--r-- | app/model/issue.php | 46 |
1 files changed, 38 insertions, 8 deletions
diff --git a/app/model/issue.php b/app/model/issue.php index 4300bbb..910cb14 100644 --- a/app/model/issue.php +++ b/app/model/issue.php @@ -23,7 +23,7 @@ if (isAction("iss-mesg-add")) { $form = new form(); $form->text("issue"); - $form->text("mesg"); + $form->text("mesg", false); if (!$form->populate(input())) return; @@ -36,19 +36,49 @@ if (isAction("iss-mesg-add")) return; } - if (!$user->canCreateSub($issue)) + if (isset($form->mesg) && $form->mesg != "") { - logError(ERROR, "You do not have permission to post to this issue"); - return; + if (!$user->canCreateSub($issue)) + { + logError(ERROR, "You do not have permission to post to this issue"); + return; + } + + $mesg = mesg::initNew($form->mesg, $user, $issue); + + if ($mesg->setAttachment("attachment")) + logError(NOTICE, "Saved attachment " . $mesg->attachment); } - $mesg = mesg::initNew($form->mesg, $user, $issue); + if (isset(input()['advIssue'])) + { + if (!$user->canModify($issue)) + { + logError(ERROR, "You do not have permission to move this issue"); + return; + } - if ($mesg->setAttachment("attachment")) - logError(NOTICE, "Saved attachment " . $mesg->attachment); + $issue->advance($user); - if (isset(input()['closeIssue'])) + if ($issue->isOpen()) + { + $sgename = $issue->getParent()->name; + $log = mesg::initNewLog("%s advanced issue to '" . $sgename . "'", $user, $issue); + } + else + { + $log = mesg::initNewLog("%s closed issue", $user, $issue); + } + } + + else if (isset(input()['closeIssue'])) { + if (!$user->canModify($issue)) + { + logError(ERROR, "You do not have permission to close this issue"); + return; + } + $issue->close($user); logError(NOTICE, "Issue #" . $issue->numb . " closed"); $log = mesg::initNewLog("% closed issue", $user, $issue); |