diff --git a/codepot/src/codepot/controllers/issue.php b/codepot/src/codepot/controllers/issue.php index 76700abc..7448fbc2 100644 --- a/codepot/src/codepot/controllers/issue.php +++ b/codepot/src/codepot/controllers/issue.php @@ -146,6 +146,7 @@ class Issue extends Controller { $this->load->model ('ProjectModel', 'projects'); $this->load->model ('IssueModel', 'issues'); + $this->load->model ('CodeModel', 'code'); $login = $this->login->getUser (); if (CODEPOT_SIGNIN_COMPULSORY && $login['id'] == '') @@ -217,11 +218,16 @@ class Issue extends Controller } else { + + $related_code_revisions = $this->code->getRelatedRevisions ($project->id, $issue->id); + if ($related_code_revisions === FALSE) $related_code_revisions = array(); + $data['issue_type_array'] = $this->issuehelper->_get_type_array($this->lang); $data['issue_status_array'] = $this->issuehelper->_get_status_array($this->lang); $data['issue_priority_array'] = $this->issuehelper->_get_priority_array($this->lang); $data['project'] = $project; $data['issue'] = $issue; + $data['related_code_revisions'] = $related_code_revisions; $this->load->view ($this->VIEW_SHOW, $data); } } diff --git a/codepot/src/codepot/models/codemodel.php b/codepot/src/codepot/models/codemodel.php index 30629db8..c9da28e4 100644 --- a/codepot/src/codepot/models/codemodel.php +++ b/codepot/src/codepot/models/codemodel.php @@ -39,6 +39,29 @@ class CodeModel extends Model return $query->result(); } + function getRelatedRevisions ($projectid, $issueid) + { + $this->db->trans_begin (); + + $this->db->from ('issue'); + $this->db->join ('issue_coderev', 'issue.projectid = issue_coderev.projectid AND issue.id = issue_coderev.issueid'); + $this->db->where ('issue_coderev.projectid', (string)$projectid); + $this->db->where ('issue_coderev.issueid', $issueid); + $this->db->order_by ('issue_coderev.projectid ASC'); + $this->db->order_by ('issue_coderev.coderev ASC'); + $this->db->select ('issue_coderev.projectid, issue_coderev.coderev'); + $query = $this->db->get (); + if ($this->db->trans_status() === FALSE) + { + $this->errmsg = $this->db->_error_message(); + $this->db->trans_rollback (); + return FALSE; + } + + $this->db->trans_commit (); + return $query->result(); + } + function getReviews ($projectid, $revision) { $this->db->trans_begin (); diff --git a/codepot/src/codepot/views/issue_show.php b/codepot/src/codepot/views/issue_show.php index 413d3c50..a22a6b6e 100644 --- a/codepot/src/codepot/views/issue_show.php +++ b/codepot/src/codepot/views/issue_show.php @@ -1001,7 +1001,7 @@ function print_issue_state ($con, $issue, $old, $issue_type_array, $issue_status