Project

General

Profile

Feature #18212

Updated by Toshi MARUYAMA over 9 years ago

I have fixed this issue on my local redmine.  

 Add the following code after the 73 line of app/models/issue.rb 

  validate :closed_before_sub_issues 
 

 Add the closed_before_sub_issues method: 

 <pre><code class="ruby"> 
 def closed_before_sub_issues 
     closedIssueStatus = IssueStatus.find_by_is_closed true 
     if closedIssueStatus && status_id == closedIssueStatus.id 
       if descendants.any? { |childIssue| childIssue.status_id != closedIssueStatus.id} 
         errors.add :status_id, :cant_close_before_sub_issues_closed 
       end 
     end 
   end 
 </code></pre> 

 Add error message in the en.yml: 
 cant_close_before_sub_issues_closed: can change the status to closed before the all the sub issue are not closed  

Back