summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--app/models/issue.rb25
-rw-r--r--app/models/version.rb11
-rw-r--r--app/views/issues/_form.rhtml6
-rw-r--r--app/views/issues/_form_update.rhtml6
-rw-r--r--app/views/issues/bulk_edit.rhtml2
-rw-r--r--app/views/issues/context_menu.rhtml4
-rw-r--r--app/views/projects/settings/_versions.rhtml13
-rw-r--r--app/views/versions/_form.rhtml1
-rw-r--r--config/locales/bg.yml4
-rw-r--r--config/locales/bs.yml4
-rw-r--r--config/locales/ca.yml4
-rw-r--r--config/locales/cs.yml4
-rw-r--r--config/locales/da.yml4
-rw-r--r--config/locales/de.yml4
-rw-r--r--config/locales/el.yml4
-rw-r--r--config/locales/en.yml5
-rw-r--r--config/locales/es.yml4
-rw-r--r--config/locales/fi.yml4
-rw-r--r--config/locales/fr.yml5
-rw-r--r--config/locales/gl.yml4
-rw-r--r--config/locales/he.yml4
-rw-r--r--config/locales/hu.yml4
-rw-r--r--config/locales/it.yml4
-rw-r--r--config/locales/ja.yml4
-rw-r--r--config/locales/ko.yml4
-rw-r--r--config/locales/lt.yml4
-rw-r--r--config/locales/nl.yml4
-rw-r--r--config/locales/no.yml4
-rw-r--r--config/locales/pl.yml4
-rw-r--r--config/locales/pt-BR.yml4
-rw-r--r--config/locales/pt.yml4
-rw-r--r--config/locales/ro.yml4
-rw-r--r--config/locales/ru.yml4
-rw-r--r--config/locales/sk.yml4
-rw-r--r--config/locales/sl.yml4
-rw-r--r--config/locales/sr.yml4
-rw-r--r--config/locales/sv.yml4
-rw-r--r--config/locales/th.yml4
-rw-r--r--config/locales/tr.yml4
-rw-r--r--config/locales/uk.yml4
-rw-r--r--config/locales/vi.yml4
-rw-r--r--config/locales/zh-TW.yml4
-rw-r--r--config/locales/zh.yml4
-rw-r--r--db/migrate/20091108092559_add_versions_status.rb9
-rw-r--r--public/stylesheets/application.css2
-rw-r--r--test/fixtures/issues.yml32
-rw-r--r--test/fixtures/versions.yml3
-rw-r--r--test/unit/issue_test.rb51
-rw-r--r--test/unit/version_test.rb1
49 files changed, 293 insertions, 15 deletions
diff --git a/app/models/issue.rb b/app/models/issue.rb
index f7b2f8a36..ea6eb1307 100644
--- a/app/models/issue.rb
+++ b/app/models/issue.rb
@@ -143,6 +143,14 @@ class Issue < ActiveRecord::Base
if start_date && soonest_start && start_date < soonest_start
errors.add :start_date, :invalid
end
+
+ if fixed_version
+ if !assignable_versions.include?(fixed_version)
+ errors.add :fixed_version_id, :inclusion
+ elsif reopened? && fixed_version.closed?
+ errors.add_to_base I18n.t(:error_can_not_reopen_issue_on_closed_version)
+ end
+ end
end
def validate_on_create
@@ -193,6 +201,18 @@ class Issue < ActiveRecord::Base
self.status.is_closed?
end
+ # Return true if the issue is being reopened
+ def reopened?
+ if !new_record? && status_id_changed?
+ status_was = IssueStatus.find_by_id(status_id_was)
+ status_new = IssueStatus.find_by_id(status_id)
+ if status_was && status_new && status_was.is_closed? && !status_new.is_closed?
+ return true
+ end
+ end
+ false
+ end
+
# Returns true if the issue is overdue
def overdue?
!due_date.nil? && (due_date < Date.today) && !status.is_closed?
@@ -203,6 +223,11 @@ class Issue < ActiveRecord::Base
project.assignable_users
end
+ # Versions that the issue can be assigned to
+ def assignable_versions
+ @assignable_versions ||= (project.versions.open + [Version.find_by_id(fixed_version_id_was)]).compact.uniq.sort
+ end
+
# Returns true if this issue is blocked by another issue that is still open
def blocked?
!relations_to.detect {|ir| ir.relation_type == 'blocks' && !ir.issue_from.closed?}.nil?
diff --git a/app/models/version.rb b/app/models/version.rb
index 13d33e256..dc72e8212 100644
--- a/app/models/version.rb
+++ b/app/models/version.rb
@@ -22,11 +22,16 @@ class Version < ActiveRecord::Base
acts_as_attachable :view_permission => :view_files,
:delete_permission => :manage_files
+ VERSION_STATUSES = %w(open locked closed)
+
validates_presence_of :name
validates_uniqueness_of :name, :scope => [:project_id]
validates_length_of :name, :maximum => 60
validates_format_of :effective_date, :with => /^\d{4}-\d{2}-\d{2}$/, :message => :not_a_date, :allow_nil => true
-
+ validates_inclusion_of :status, :in => VERSION_STATUSES
+
+ named_scope :open, :conditions => {:status => 'open'}
+
def start_date
effective_date
end
@@ -45,6 +50,10 @@ class Version < ActiveRecord::Base
@spent_hours ||= TimeEntry.sum(:hours, :include => :issue, :conditions => ["#{Issue.table_name}.fixed_version_id = ?", id]).to_f
end
+ def closed?
+ status == 'closed'
+ end
+
# Returns true if the version is completed: due date reached and no open issues
def completed?
effective_date && (effective_date <= Date.today) && (open_issues_count == 0)
diff --git a/app/views/issues/_form.rhtml b/app/views/issues/_form.rhtml
index fac2d6a36..c61c79d60 100644
--- a/app/views/issues/_form.rhtml
+++ b/app/views/issues/_form.rhtml
@@ -32,9 +32,9 @@
{:controller => 'projects', :action => 'add_issue_category', :id => @project},
:class => 'small', :tabindex => 199) if authorize_for('projects', 'add_issue_category') %></p>
<% end %>
-<%= content_tag('p', f.select(:fixed_version_id,
- (@project.versions.sort.collect {|v| [v.name, v.id]}),
- { :include_blank => true })) unless @project.versions.empty? %>
+<% unless @issue.assignable_versions.empty? %>
+<p><%= f.select :fixed_version_id, (@issue.assignable_versions.collect {|v| [v.name, v.id]}), :include_blank => true %></p>
+<% end %>
</div>
<div class="splitcontentright">
diff --git a/app/views/issues/_form_update.rhtml b/app/views/issues/_form_update.rhtml
index 3f17a0300..5304ee23a 100644
--- a/app/views/issues/_form_update.rhtml
+++ b/app/views/issues/_form_update.rhtml
@@ -5,8 +5,8 @@
</div>
<div class="splitcontentright">
<p><%= f.select :done_ratio, ((0..10).to_a.collect {|r| ["#{r*10} %", r*10] }) %></p>
-<%= content_tag('p', f.select(:fixed_version_id,
- (@project.versions.sort.collect {|v| [v.name, v.id]}),
- { :include_blank => true })) unless @project.versions.empty? %>
+<% unless @issue.assignable_versions.empty? %>
+<p><%= f.select :fixed_version_id, (@issue.assignable_versions.collect {|v| [v.name, v.id]}), :include_blank => true %></p>
+<% end %>
</div>
</div>
diff --git a/app/views/issues/bulk_edit.rhtml b/app/views/issues/bulk_edit.rhtml
index 4ea9ffd32..10a5bb5a2 100644
--- a/app/views/issues/bulk_edit.rhtml
+++ b/app/views/issues/bulk_edit.rhtml
@@ -27,7 +27,7 @@
<label><%= l(:field_fixed_version) %>:
<%= select_tag('fixed_version_id', content_tag('option', l(:label_no_change_option), :value => '') +
content_tag('option', l(:label_none), :value => 'none') +
- options_from_collection_for_select(@project.versions.sort, :id, :name)) %></label>
+ options_from_collection_for_select(@project.versions.open.sort, :id, :name)) %></label>
</p>
<p>
diff --git a/app/views/issues/context_menu.rhtml b/app/views/issues/context_menu.rhtml
index ae9a1afcb..073f12bd6 100644
--- a/app/views/issues/context_menu.rhtml
+++ b/app/views/issues/context_menu.rhtml
@@ -27,11 +27,11 @@
<% end -%>
</ul>
</li>
- <% unless @project.nil? || @project.versions.empty? -%>
+ <% unless @project.nil? || @project.versions.open.empty? -%>
<li class="folder">
<a href="#" class="submenu"><%= l(:field_fixed_version) %></a>
<ul>
- <% @project.versions.sort.each do |v| -%>
+ <% @project.versions.open.sort.each do |v| -%>
<li><%= context_menu_link v.name, {:controller => 'issues', :action => 'bulk_edit', :ids => @issues.collect(&:id), 'fixed_version_id' => v, :back_to => @back}, :method => :post,
:selected => (@issue && v == @issue.fixed_version), :disabled => !@can[:update] %></li>
<% end -%>
diff --git a/app/views/projects/settings/_versions.rhtml b/app/views/projects/settings/_versions.rhtml
index 1f66dec43..95b72f178 100644
--- a/app/views/projects/settings/_versions.rhtml
+++ b/app/views/projects/settings/_versions.rhtml
@@ -1,22 +1,25 @@
<% if @project.versions.any? %>
-<table class="list">
+<table class="list versions">
<thead>
<th><%= l(:label_version) %></th>
<th><%= l(:field_effective_date) %></th>
<th><%= l(:field_description) %></th>
+ <th><%= l(:field_status) %></th>
<th><%= l(:label_wiki_page) unless @project.wiki.nil? %></th>
<th style="width:15%"></th>
- <th style="width:15%"></th>
</thead>
<tbody>
<% for version in @project.versions.sort %>
- <tr class="<%= cycle 'odd', 'even' %>">
+ <tr class="version <%= cycle 'odd', 'even' %> <%=h version.status %>">
<td><%= link_to h(version.name), :controller => 'versions', :action => 'show', :id => version %></td>
<td align="center"><%= format_date(version.effective_date) %></td>
<td><%=h version.description %></td>
+ <td><%= l("version_status_#{version.status}") %></td>
<td><%= link_to(h(version.wiki_page_title), :controller => 'wiki', :page => Wiki.titleize(version.wiki_page_title)) unless version.wiki_page_title.blank? || @project.wiki.nil? %></td>
- <td align="center"><%= link_to_if_authorized l(:button_edit), { :controller => 'versions', :action => 'edit', :id => version }, :class => 'icon icon-edit' %></td>
- <td align="center"><%= link_to_if_authorized l(:button_delete), {:controller => 'versions', :action => 'destroy', :id => version}, :confirm => l(:text_are_you_sure), :method => :post, :class => 'icon icon-del' %></td>
+ <td class="buttons">
+ <%= link_to_if_authorized l(:button_edit), {:controller => 'versions', :action => 'edit', :id => version }, :class => 'icon icon-edit' %>
+ <%= link_to_if_authorized l(:button_delete), {:controller => 'versions', :action => 'destroy', :id => version}, :confirm => l(:text_are_you_sure), :method => :post, :class => 'icon icon-del' %>
+ </td>
</tr>
<% end; reset_cycle %>
</tbody>
diff --git a/app/views/versions/_form.rhtml b/app/views/versions/_form.rhtml
index adc83b573..dfdbc18fe 100644
--- a/app/views/versions/_form.rhtml
+++ b/app/views/versions/_form.rhtml
@@ -3,6 +3,7 @@
<div class="box">
<p><%= f.text_field :name, :size => 60, :required => true %></p>
<p><%= f.text_field :description, :size => 60 %></p>
+<p><%= f.select :status, Version::VERSION_STATUSES.collect {|s| [l("version_status_#{s}"), s]} %></p>
<p><%= f.text_field :wiki_page_title, :label => :label_wiki_page, :size => 60, :disabled => @project.wiki.nil? %></p>
<p><%= f.text_field :effective_date, :size => 10 %><%= calendar_for('version_effective_date') %></p>
</div>
diff --git a/config/locales/bg.yml b/config/locales/bg.yml
index 46551d695..c35138a1e 100644
--- a/config/locales/bg.yml
+++ b/config/locales/bg.yml
@@ -827,3 +827,7 @@ bg:
field_active: Active
enumeration_system_activity: System Activity
permission_delete_issue_watchers: Delete watchers
+ version_status_closed: closed
+ version_status_locked: locked
+ version_status_open: open
+ error_can_not_reopen_issue_on_closed_version: An issue assigned to a closed version can not be reopened
diff --git a/config/locales/bs.yml b/config/locales/bs.yml
index d7460488a..f8bf5b13e 100644
--- a/config/locales/bs.yml
+++ b/config/locales/bs.yml
@@ -851,3 +851,7 @@ bs:
field_active: Active
enumeration_system_activity: System Activity
permission_delete_issue_watchers: Delete watchers
+ version_status_closed: closed
+ version_status_locked: locked
+ version_status_open: open
+ error_can_not_reopen_issue_on_closed_version: An issue assigned to a closed version can not be reopened
diff --git a/config/locales/ca.yml b/config/locales/ca.yml
index 24bb33eb2..6a85787be 100644
--- a/config/locales/ca.yml
+++ b/config/locales/ca.yml
@@ -830,3 +830,7 @@ ca:
field_active: Active
enumeration_system_activity: System Activity
permission_delete_issue_watchers: Delete watchers
+ version_status_closed: closed
+ version_status_locked: locked
+ version_status_open: open
+ error_can_not_reopen_issue_on_closed_version: An issue assigned to a closed version can not be reopened
diff --git a/config/locales/cs.yml b/config/locales/cs.yml
index c1c429d56..68cbb412c 100644
--- a/config/locales/cs.yml
+++ b/config/locales/cs.yml
@@ -833,3 +833,7 @@ cs:
field_active: Active
enumeration_system_activity: System Activity
permission_delete_issue_watchers: Delete watchers
+ version_status_closed: closed
+ version_status_locked: locked
+ version_status_open: open
+ error_can_not_reopen_issue_on_closed_version: An issue assigned to a closed version can not be reopened
diff --git a/config/locales/da.yml b/config/locales/da.yml
index 7ebea2c70..00d430b77 100644
--- a/config/locales/da.yml
+++ b/config/locales/da.yml
@@ -853,3 +853,7 @@ da:
field_active: Active
enumeration_system_activity: System Activity
permission_delete_issue_watchers: Delete watchers
+ version_status_closed: closed
+ version_status_locked: locked
+ version_status_open: open
+ error_can_not_reopen_issue_on_closed_version: An issue assigned to a closed version can not be reopened
diff --git a/config/locales/de.yml b/config/locales/de.yml
index 8f99608f7..f9ffc1067 100644
--- a/config/locales/de.yml
+++ b/config/locales/de.yml
@@ -853,3 +853,7 @@ de:
field_active: Active
enumeration_system_activity: System Activity
permission_delete_issue_watchers: Delete watchers
+ version_status_closed: closed
+ version_status_locked: locked
+ version_status_open: open
+ error_can_not_reopen_issue_on_closed_version: An issue assigned to a closed version can not be reopened
diff --git a/config/locales/el.yml b/config/locales/el.yml
index 6147bd5cc..ce4fc2647 100644
--- a/config/locales/el.yml
+++ b/config/locales/el.yml
@@ -833,3 +833,7 @@ el:
field_active: Active
enumeration_system_activity: System Activity
permission_delete_issue_watchers: Delete watchers
+ version_status_closed: closed
+ version_status_locked: locked
+ version_status_open: open
+ error_can_not_reopen_issue_on_closed_version: An issue assigned to a closed version can not be reopened
diff --git a/config/locales/en.yml b/config/locales/en.yml
index 71e599a59..eedf48df5 100644
--- a/config/locales/en.yml
+++ b/config/locales/en.yml
@@ -155,6 +155,7 @@ en:
error_issue_not_found_in_project: 'The issue was not found or does not belong to this project'
error_no_tracker_in_project: 'No tracker is associated to this project. Please check the Project settings.'
error_no_default_issue_status: 'No default issue status is defined. Please check your configuration (Go to "Administration -> Issue statuses").'
+ error_can_not_reopen_issue_on_closed_version: 'An issue assigned to a closed version can not be reopened'
warning_attachments_not_saved: "{{count}} file(s) could not be saved."
@@ -749,6 +750,10 @@ en:
status_active: active
status_registered: registered
status_locked: locked
+
+ version_status_open: open
+ version_status_locked: locked
+ version_status_closed: closed
field_active: Active
diff --git a/config/locales/es.yml b/config/locales/es.yml
index e76929dc6..864cd141d 100644
--- a/config/locales/es.yml
+++ b/config/locales/es.yml
@@ -874,3 +874,7 @@ es:
field_active: Active
enumeration_system_activity: System Activity
permission_delete_issue_watchers: Delete watchers
+ version_status_closed: closed
+ version_status_locked: locked
+ version_status_open: open
+ error_can_not_reopen_issue_on_closed_version: An issue assigned to a closed version can not be reopened
diff --git a/config/locales/fi.yml b/config/locales/fi.yml
index fffddc6f7..34214fee0 100644
--- a/config/locales/fi.yml
+++ b/config/locales/fi.yml
@@ -863,3 +863,7 @@ fi:
field_active: Active
enumeration_system_activity: System Activity
permission_delete_issue_watchers: Delete watchers
+ version_status_closed: closed
+ version_status_locked: locked
+ version_status_open: open
+ error_can_not_reopen_issue_on_closed_version: An issue assigned to a closed version can not be reopened
diff --git a/config/locales/fr.yml b/config/locales/fr.yml
index 82936b4a3..2c4dbf6f0 100644
--- a/config/locales/fr.yml
+++ b/config/locales/fr.yml
@@ -177,6 +177,7 @@ fr:
error_scm_command_failed: "Une erreur s'est produite lors de l'accès au dépôt: {{value}}"
error_scm_annotate: "L'entrée n'existe pas ou ne peut pas être annotée."
error_issue_not_found_in_project: "La demande n'existe pas ou n'appartient pas à ce projet"
+ error_can_not_reopen_issue_on_closed_version: 'Une demande assignée à une version fermée ne peut pas être réouverte'
warning_attachments_not_saved: "{{count}} fichier(s) n'ont pas pu être sauvegardés."
@@ -767,6 +768,10 @@ fr:
status_registered: enregistré
status_locked: vérouillé
+ version_status_open: ouvert
+ version_status_locked: vérouillé
+ version_status_closed: fermé
+
text_select_mail_notifications: Actions pour lesquelles une notification par e-mail est envoyée
text_regexp_info: ex. ^[A-Z0-9]+$
text_min_max_length_info: 0 pour aucune restriction
diff --git a/config/locales/gl.yml b/config/locales/gl.yml
index 00bdbbfb9..b2a8d49d1 100644
--- a/config/locales/gl.yml
+++ b/config/locales/gl.yml
@@ -853,3 +853,7 @@ gl:
field_active: Active
enumeration_system_activity: System Activity
permission_delete_issue_watchers: Delete watchers
+ version_status_closed: closed
+ version_status_locked: locked
+ version_status_open: open
+ error_can_not_reopen_issue_on_closed_version: An issue assigned to a closed version can not be reopened
diff --git a/config/locales/he.yml b/config/locales/he.yml
index ecf582096..d60b94e4b 100644
--- a/config/locales/he.yml
+++ b/config/locales/he.yml
@@ -837,3 +837,7 @@ he:
field_active: Active
enumeration_system_activity: System Activity
permission_delete_issue_watchers: Delete watchers
+ version_status_closed: closed
+ version_status_locked: locked
+ version_status_open: open
+ error_can_not_reopen_issue_on_closed_version: An issue assigned to a closed version can not be reopened
diff --git a/config/locales/hu.yml b/config/locales/hu.yml
index 70b0d00af..b7c9dff69 100644
--- a/config/locales/hu.yml
+++ b/config/locales/hu.yml
@@ -858,3 +858,7 @@
field_active: Active
enumeration_system_activity: System Activity
permission_delete_issue_watchers: Delete watchers
+ version_status_closed: closed
+ version_status_locked: locked
+ version_status_open: open
+ error_can_not_reopen_issue_on_closed_version: An issue assigned to a closed version can not be reopened
diff --git a/config/locales/it.yml b/config/locales/it.yml
index d51e24085..7d6ccac21 100644
--- a/config/locales/it.yml
+++ b/config/locales/it.yml
@@ -840,3 +840,7 @@ it:
field_active: Active
enumeration_system_activity: System Activity
permission_delete_issue_watchers: Delete watchers
+ version_status_closed: closed
+ version_status_locked: locked
+ version_status_open: open
+ error_can_not_reopen_issue_on_closed_version: An issue assigned to a closed version can not be reopened
diff --git a/config/locales/ja.yml b/config/locales/ja.yml
index 35121b709..9e70679e9 100644
--- a/config/locales/ja.yml
+++ b/config/locales/ja.yml
@@ -862,3 +862,7 @@ ja:
field_active: Active
enumeration_system_activity: System Activity
permission_delete_issue_watchers: Delete watchers
+ version_status_closed: closed
+ version_status_locked: locked
+ version_status_open: open
+ error_can_not_reopen_issue_on_closed_version: An issue assigned to a closed version can not be reopened
diff --git a/config/locales/ko.yml b/config/locales/ko.yml
index 82ab8050a..4441ebe60 100644
--- a/config/locales/ko.yml
+++ b/config/locales/ko.yml
@@ -893,3 +893,7 @@ ko:
field_active: Active
enumeration_system_activity: System Activity
permission_delete_issue_watchers: Delete watchers
+ version_status_closed: closed
+ version_status_locked: locked
+ version_status_open: open
+ error_can_not_reopen_issue_on_closed_version: An issue assigned to a closed version can not be reopened
diff --git a/config/locales/lt.yml b/config/locales/lt.yml
index fbe3c67d2..3d7fcc6cb 100644
--- a/config/locales/lt.yml
+++ b/config/locales/lt.yml
@@ -863,3 +863,7 @@ lt:
field_active: Active
enumeration_system_activity: System Activity
permission_delete_issue_watchers: Delete watchers
+ version_status_closed: closed
+ version_status_locked: locked
+ version_status_open: open
+ error_can_not_reopen_issue_on_closed_version: An issue assigned to a closed version can not be reopened
diff --git a/config/locales/nl.yml b/config/locales/nl.yml
index 9f89b811e..4212d445d 100644
--- a/config/locales/nl.yml
+++ b/config/locales/nl.yml
@@ -815,3 +815,7 @@ nl:
field_active: Active
enumeration_system_activity: System Activity
permission_delete_issue_watchers: Delete watchers
+ version_status_closed: closed
+ version_status_locked: locked
+ version_status_open: open
+ error_can_not_reopen_issue_on_closed_version: An issue assigned to a closed version can not be reopened
diff --git a/config/locales/no.yml b/config/locales/no.yml
index c22200cb8..df91bdf4f 100644
--- a/config/locales/no.yml
+++ b/config/locales/no.yml
@@ -828,3 +828,7 @@
field_active: Active
enumeration_system_activity: System Activity
permission_delete_issue_watchers: Delete watchers
+ version_status_closed: closed
+ version_status_locked: locked
+ version_status_open: open
+ error_can_not_reopen_issue_on_closed_version: An issue assigned to a closed version can not be reopened
diff --git a/config/locales/pl.yml b/config/locales/pl.yml
index 4f6a28c60..fa232a296 100644
--- a/config/locales/pl.yml
+++ b/config/locales/pl.yml
@@ -856,3 +856,7 @@ pl:
field_active: Aktywne
enumeration_system_activity: Aktywność Systemowa
permission_delete_issue_watchers: Delete watchers
+ version_status_closed: closed
+ version_status_locked: locked
+ version_status_open: open
+ error_can_not_reopen_issue_on_closed_version: An issue assigned to a closed version can not be reopened
diff --git a/config/locales/pt-BR.yml b/config/locales/pt-BR.yml
index 287a06846..51d5221e2 100644
--- a/config/locales/pt-BR.yml
+++ b/config/locales/pt-BR.yml
@@ -859,3 +859,7 @@ pt-BR:
field_active: Ativo
enumeration_system_activity: Atividade do sistema
permission_delete_issue_watchers: Deletar observadores
+ version_status_closed: closed
+ version_status_locked: locked
+ version_status_open: open
+ error_can_not_reopen_issue_on_closed_version: An issue assigned to a closed version can not be reopened
diff --git a/config/locales/pt.yml b/config/locales/pt.yml
index 2086af479..e9c6423a0 100644
--- a/config/locales/pt.yml
+++ b/config/locales/pt.yml
@@ -845,3 +845,7 @@ pt:
field_active: Active
enumeration_system_activity: System Activity
permission_delete_issue_watchers: Delete watchers
+ version_status_closed: closed
+ version_status_locked: locked
+ version_status_open: open
+ error_can_not_reopen_issue_on_closed_version: An issue assigned to a closed version can not be reopened
diff --git a/config/locales/ro.yml b/config/locales/ro.yml
index c3b8dd2fc..b62449617 100644
--- a/config/locales/ro.yml
+++ b/config/locales/ro.yml
@@ -830,3 +830,7 @@ ro:
field_active: Active
enumeration_system_activity: System Activity
permission_delete_issue_watchers: Delete watchers
+ version_status_closed: closed
+ version_status_locked: locked
+ version_status_open: open
+ error_can_not_reopen_issue_on_closed_version: An issue assigned to a closed version can not be reopened
diff --git a/config/locales/ru.yml b/config/locales/ru.yml
index c885447f3..14b003341 100644
--- a/config/locales/ru.yml
+++ b/config/locales/ru.yml
@@ -941,3 +941,7 @@ ru:
field_active: Active
enumeration_system_activity: System Activity
permission_delete_issue_watchers: Delete watchers
+ version_status_closed: closed
+ version_status_locked: locked
+ version_status_open: open
+ error_can_not_reopen_issue_on_closed_version: An issue assigned to a closed version can not be reopened
diff --git a/config/locales/sk.yml b/config/locales/sk.yml
index 59a5faa33..efb0325b6 100644
--- a/config/locales/sk.yml
+++ b/config/locales/sk.yml
@@ -832,3 +832,7 @@ sk:
field_active: Active
enumeration_system_activity: System Activity
permission_delete_issue_watchers: Delete watchers
+ version_status_closed: closed
+ version_status_locked: locked
+ version_status_open: open
+ error_can_not_reopen_issue_on_closed_version: An issue assigned to a closed version can not be reopened
diff --git a/config/locales/sl.yml b/config/locales/sl.yml
index bfc5e087f..d3a6a3113 100644
--- a/config/locales/sl.yml
+++ b/config/locales/sl.yml
@@ -829,3 +829,7 @@ sl:
field_active: Active
enumeration_system_activity: System Activity
permission_delete_issue_watchers: Delete watchers
+ version_status_closed: closed
+ version_status_locked: locked
+ version_status_open: open
+ error_can_not_reopen_issue_on_closed_version: An issue assigned to a closed version can not be reopened
diff --git a/config/locales/sr.yml b/config/locales/sr.yml
index 0f8ed1095..90f3a2122 100644
--- a/config/locales/sr.yml
+++ b/config/locales/sr.yml
@@ -848,3 +848,7 @@
field_active: Active
enumeration_system_activity: System Activity
permission_delete_issue_watchers: Delete watchers
+ version_status_closed: closed
+ version_status_locked: locked
+ version_status_open: open
+ error_can_not_reopen_issue_on_closed_version: An issue assigned to a closed version can not be reopened
diff --git a/config/locales/sv.yml b/config/locales/sv.yml
index d775e953e..301debd95 100644
--- a/config/locales/sv.yml
+++ b/config/locales/sv.yml
@@ -881,3 +881,7 @@ sv:
enumeration_doc_categories: Dokumentkategorier
enumeration_activities: Aktiviteter (tidsuppföljning)
enumeration_system_activity: Systemaktivitet
+ version_status_closed: closed
+ version_status_locked: locked
+ version_status_open: open
+ error_can_not_reopen_issue_on_closed_version: An issue assigned to a closed version can not be reopened
diff --git a/config/locales/th.yml b/config/locales/th.yml
index fb6b36e07..24d16bf31 100644
--- a/config/locales/th.yml
+++ b/config/locales/th.yml
@@ -830,3 +830,7 @@ th:
field_active: Active
enumeration_system_activity: System Activity
permission_delete_issue_watchers: Delete watchers
+ version_status_closed: closed
+ version_status_locked: locked
+ version_status_open: open
+ error_can_not_reopen_issue_on_closed_version: An issue assigned to a closed version can not be reopened
diff --git a/config/locales/tr.yml b/config/locales/tr.yml
index d51e4654b..d835ab1a8 100644
--- a/config/locales/tr.yml
+++ b/config/locales/tr.yml
@@ -860,3 +860,7 @@ tr:
field_active: Active
enumeration_system_activity: System Activity
permission_delete_issue_watchers: Delete watchers
+ version_status_closed: closed
+ version_status_locked: locked
+ version_status_open: open
+ error_can_not_reopen_issue_on_closed_version: An issue assigned to a closed version can not be reopened
diff --git a/config/locales/uk.yml b/config/locales/uk.yml
index c14f604cc..3502c52d0 100644
--- a/config/locales/uk.yml
+++ b/config/locales/uk.yml
@@ -829,3 +829,7 @@ uk:
field_active: Active
enumeration_system_activity: System Activity
permission_delete_issue_watchers: Delete watchers
+ version_status_closed: closed
+ version_status_locked: locked
+ version_status_open: open
+ error_can_not_reopen_issue_on_closed_version: An issue assigned to a closed version can not be reopened
diff --git a/config/locales/vi.yml b/config/locales/vi.yml
index 766b462a5..6ae808512 100644
--- a/config/locales/vi.yml
+++ b/config/locales/vi.yml
@@ -892,3 +892,7 @@ vi:
field_active: Active
enumeration_system_activity: System Activity
permission_delete_issue_watchers: Delete watchers
+ version_status_closed: closed
+ version_status_locked: locked
+ version_status_open: open
+ error_can_not_reopen_issue_on_closed_version: An issue assigned to a closed version can not be reopened
diff --git a/config/locales/zh-TW.yml b/config/locales/zh-TW.yml
index a9cd42e6e..05b4b214c 100644
--- a/config/locales/zh-TW.yml
+++ b/config/locales/zh-TW.yml
@@ -923,3 +923,7 @@
enumeration_doc_categories: 文件分類
enumeration_activities: 活動 (時間追蹤)
enumeration_system_activity: 系統活動
+ version_status_closed: closed
+ version_status_locked: locked
+ version_status_open: open
+ error_can_not_reopen_issue_on_closed_version: An issue assigned to a closed version can not be reopened
diff --git a/config/locales/zh.yml b/config/locales/zh.yml
index 596a08df5..bb60315b0 100644
--- a/config/locales/zh.yml
+++ b/config/locales/zh.yml
@@ -855,3 +855,7 @@ zh:
field_active: Active
enumeration_system_activity: System Activity
permission_delete_issue_watchers: Delete watchers
+ version_status_closed: closed
+ version_status_locked: locked
+ version_status_open: open
+ error_can_not_reopen_issue_on_closed_version: An issue assigned to a closed version can not be reopened
diff --git a/db/migrate/20091108092559_add_versions_status.rb b/db/migrate/20091108092559_add_versions_status.rb
new file mode 100644
index 000000000..d71d490af
--- /dev/null
+++ b/db/migrate/20091108092559_add_versions_status.rb
@@ -0,0 +1,9 @@
+class AddVersionsStatus < ActiveRecord::Migration
+ def self.up
+ add_column :versions, :status, :string, :default => 'open'
+ end
+
+ def self.down
+ remove_column :versions, :status
+ end
+end
diff --git a/public/stylesheets/application.css b/public/stylesheets/application.css
index a5e845d8b..5042c1282 100644
--- a/public/stylesheets/application.css
+++ b/public/stylesheets/application.css
@@ -124,6 +124,8 @@ tr.message td.last_message { font-size: 80%; }
tr.message.locked td.subject a { background-image: url(../images/locked.png); }
tr.message.sticky td.subject a { background-image: url(../images/sticky.png); font-weight: bold; }
+tr.version.closed, tr.version.closed a { color: #999; }
+
tr.user td { width:13%; }
tr.user td.email { width:18%; }
tr.user td { white-space: nowrap; }
diff --git a/test/fixtures/issues.yml b/test/fixtures/issues.yml
index f7917639b..03197458d 100644
--- a/test/fixtures/issues.yml
+++ b/test/fixtures/issues.yml
@@ -157,3 +157,35 @@ issues_010:
status_id: 1
start_date: <%= Date.today.to_s(:db) %>
due_date: <%= 1.days.from_now.to_date.to_s(:db) %>
+issues_011:
+ created_on: <%= 3.days.ago.to_date.to_s(:db) %>
+ project_id: 1
+ updated_on: <%= 1.day.ago.to_date.to_s(:db) %>
+ priority_id: 5
+ subject: Closed issue on a closed version
+ id: 11
+ fixed_version_id: 1
+ category_id: 1
+ description:
+ tracker_id: 1
+ assigned_to_id:
+ author_id: 2
+ status_id: 5
+ start_date: <%= 1.day.ago.to_date.to_s(:db) %>
+ due_date:
+issues_012:
+ created_on: <%= 3.days.ago.to_date.to_s(:db) %>
+ project_id: 1
+ updated_on: <%= 1.day.ago.to_date.to_s(:db) %>
+ priority_id: 5
+ subject: Closed issue on a locked version
+ id: 12
+ fixed_version_id: 2
+ category_id: 1
+ description:
+ tracker_id: 1
+ assigned_to_id:
+ author_id: 2
+ status_id: 5
+ start_date: <%= 1.day.ago.to_date.to_s(:db) %>
+ due_date:
diff --git a/test/fixtures/versions.yml b/test/fixtures/versions.yml
index 9306811f2..bcecb67d5 100644
--- a/test/fixtures/versions.yml
+++ b/test/fixtures/versions.yml
@@ -7,6 +7,7 @@ versions_001:
id: 1
description: Beta
effective_date: 2006-07-01
+ status: closed
versions_002:
created_on: 2006-07-19 21:00:33 +02:00
name: "1.0"
@@ -15,6 +16,7 @@ versions_002:
id: 2
description: Stable release
effective_date: <%= 20.day.from_now.to_date.to_s(:db) %>
+ status: locked
versions_003:
created_on: 2006-07-19 21:00:33 +02:00
name: "2.0"
@@ -23,4 +25,5 @@ versions_003:
id: 3
description: Future version
effective_date:
+ status: open
\ No newline at end of file
diff --git a/test/unit/issue_test.rb b/test/unit/issue_test.rb
index 147d31f8c..a8010cf48 100644
--- a/test/unit/issue_test.rb
+++ b/test/unit/issue_test.rb
@@ -20,6 +20,7 @@ require File.dirname(__FILE__) + '/../test_helper'
class IssueTest < ActiveSupport::TestCase
fixtures :projects, :users, :members, :member_roles,
:trackers, :projects_trackers,
+ :versions,
:issue_statuses, :issue_categories, :issue_relations, :workflows,
:enumerations,
:issues,
@@ -184,6 +185,56 @@ class IssueTest < ActiveSupport::TestCase
assert !issue1.reload.closed?
end
+ def test_assignable_versions
+ issue = Issue.new(:project_id => 1, :tracker_id => 1, :author_id => 1, :status_id => 1, :fixed_version_id => 1, :subject => 'New issue')
+ assert_equal ['open'], issue.assignable_versions.collect(&:status).uniq
+ end
+
+ def test_should_not_be_able_to_assign_a_new_issue_to_a_closed_version
+ issue = Issue.new(:project_id => 1, :tracker_id => 1, :author_id => 1, :status_id => 1, :fixed_version_id => 1, :subject => 'New issue')
+ assert !issue.save
+ assert_not_nil issue.errors.on(:fixed_version_id)
+ end
+
+ def test_should_not_be_able_to_assign_a_new_issue_to_a_locked_version
+ issue = Issue.new(:project_id => 1, :tracker_id => 1, :author_id => 1, :status_id => 1, :fixed_version_id => 2, :subject => 'New issue')
+ assert !issue.save
+ assert_not_nil issue.errors.on(:fixed_version_id)
+ end
+
+ def test_should_be_able_to_assign_a_new_issue_to_an_open_version
+ issue = Issue.new(:project_id => 1, :tracker_id => 1, :author_id => 1, :status_id => 1, :fixed_version_id => 3, :subject => 'New issue')
+ assert issue.save
+ end
+
+ def test_should_be_able_to_update_an_issue_assigned_to_a_closed_version
+ issue = Issue.find(11)
+ assert_equal 'closed', issue.fixed_version.status
+ issue.subject = 'Subject changed'
+ assert issue.save
+ end
+
+ def test_should_not_be_able_to_reopen_an_issue_assigned_to_a_closed_version
+ issue = Issue.find(11)
+ issue.status_id = 1
+ assert !issue.save
+ assert_not_nil issue.errors.on_base
+ end
+
+ def test_should_be_able_to_reopen_and_reassign_an_issue_assigned_to_a_closed_version
+ issue = Issue.find(11)
+ issue.status_id = 1
+ issue.fixed_version_id = 3
+ assert issue.save
+ end
+
+ def test_should_be_able_to_reopen_an_issue_assigned_to_a_locked_version
+ issue = Issue.find(12)
+ assert_equal 'locked', issue.fixed_version.status
+ issue.status_id = 1
+ assert issue.save
+ end
+
def test_move_to_another_project_with_same_category
issue = Issue.find(1)
assert issue.move_to(Project.find(2))
diff --git a/test/unit/version_test.rb b/test/unit/version_test.rb
index 7df857927..5702fd181 100644
--- a/test/unit/version_test.rb
+++ b/test/unit/version_test.rb
@@ -26,6 +26,7 @@ class VersionTest < ActiveSupport::TestCase
def test_create
v = Version.new(:project => Project.find(1), :name => '1.1', :effective_date => '2011-03-25')
assert v.save
+ assert_equal 'open', v.status
end
def test_invalid_effective_date_validation