From e37a4189859398e250ee66a6d4ba15cb32002315 Mon Sep 17 00:00:00 2001 From: hyung-hwan Date: Tue, 16 Sep 2014 03:07:21 +0000 Subject: [PATCH] changed the issue creation page to set the owner to the current signed-in user if he/she is a member. if not, the issue goes to the first user --- codepot/src/codepot/controllers/issue.php | 20 +++++++++++++++----- 1 file changed, 15 insertions(+), 5 deletions(-) diff --git a/codepot/src/codepot/controllers/issue.php b/codepot/src/codepot/controllers/issue.php index c612d43d..105549d1 100644 --- a/codepot/src/codepot/controllers/issue.php +++ b/codepot/src/codepot/controllers/issue.php @@ -335,7 +335,7 @@ class Issue extends Controller { $data['message'] = 'DATABASE ERROR'; $data['issue'] = $issue; - $this->load->view ($this->VIEW_EDIT, $data); + $this->load->view ($this->VIEW_EDIT, $data); } else { @@ -347,7 +347,7 @@ class Issue extends Controller { $data['message'] = $this->lang->line('MSG_FORM_INPUT_INCOMPLETE'); $data['issue'] = $issue; - $this->load->view ($this->VIEW_EDIT, $data); + $this->load->view ($this->VIEW_EDIT, $data); } } else @@ -369,7 +369,7 @@ class Issue extends Controller else { $data['issue'] = $issue; - $this->load->view ($this->VIEW_EDIT, $data); + $this->load->view ($this->VIEW_EDIT, $data); } } else @@ -381,10 +381,20 @@ class Issue extends Controller $issue->type = $this->issuehelper->TYPE_DEFECT; $issue->status = $this->issuehelper->STATUS_NEW; $issue->priority = $this->issuehelper->PRIORITY_OTHER; - $issue->owner = (count($project->members) > 0)? $project->members[0]: ''; + if ($this->projects->projectHasMember($project->id, $login['id'])) + { + // let the current user be the issue owner if he/she is a + // project memeber. + $issue->owner = $login['id']; + } + else + { + // if not, assign the issue to the first member. + $issue->owner = (count($project->members) > 0)? $project->members[0]: ''; + } $data['issue'] = $issue; - $this->load->view ($this->VIEW_EDIT, $data); + $this->load->view ($this->VIEW_EDIT, $data); } }