Improve issue rule for current user

This commit is contained in:
Alexander Meindl 2015-09-10 14:34:27 +02:00
parent ccbc919b11
commit 77377332ef
4 changed files with 23 additions and 25 deletions

View File

@ -21,10 +21,10 @@
<br /><br />
<p>
<%= content_tag(:label, l(:label_rule_issue_assigned_to_change)) %>
<%= check_box_tag 'settings[issue_assigned_to_change]', 1, @settings[:issue_assigned_to_change] %>
<%= content_tag(:label, l(:label_rule_issue_current_user_status)) %>
<%= check_box_tag 'settings[issue_current_user_status]', 1, @settings[:issue_current_user_status] %>
<span style="vertical-align: top; margin-left: 15px;">
<%= l(:field_status) %> x: <%= select_tag 'settings[issue_assigned_to_x]', options_for_select(rule_status.collect{|column| [column.name, column.id]}, @settings[:issue_assigned_to_x]), :multiple => true, :size => 6, :style => "width:150px" %>
<%= l(:field_status) %> x: <%= select_tag 'settings[issue_assign_to_x]', options_for_select(rule_status.collect{|column| [column.name, column.id]}, @settings[:issue_assign_to_x]), :multiple => true, :size => 6, :style => "width:150px" %>
</span>
</p>
<em class="info"><%= t(:rule_issue_assigned_to_change_info) %></em>
<em class="info"><%= t(:rule_issue_current_user_status_info) %></em>

View File

@ -56,16 +56,16 @@ de:
permission_hide_in_memberbox: "In Memberbox ausblenden"
permission_show_hidden_roles_in_memberbox: "Versteckte Rollen in Memberbox anzeigen"
permission_edit_closed_issues: "Geschlossene Tickets bearbeiten"
menu_roles_info: "Nur den ausgewählten Rollen wird der Menüpunkt angezeigt. Sobald ein Mitglied in einem Projekt die Role besitzt, wird der Menupunkt angezeigt."
menu_roles_info: "Nur den ausgewählten Rollen wird der Menüpunkt angezeigt. Sobald ein Mitglied in einem Projekt die Rolle besitzt, wird der Menüpunkt angezeigt."
label_rule_issue_close_with_open_children: Tickets mit offenen Untertickets können nicht geschlossen werden
top_rules_help: "Hier können Regeln konfiguriert werden, die den Umgang mit Tickets festlegen. Sobald eine Regel aktiviert wurde, wirkt sich diese auf alle Projekte aus."
top_content_help: "Hier können Texte hinterlegt werden, welche an unterschiedlichen Stellen in Redmine ausgegeben werden."
label_rule_issue_status_change: "Wird \"Zugewiesen an\" nicht verändert und der Ticketstatus von x auf y geändert, dann wird das Ticket automatisch dem Ersteller zugewiesen"
rule_issue_status_change_info: "Use Case: Zur Abnahme der Tickets sollen alle Tickets automatisch dem Ersteller des Tickets zugeordnet werden, sofern kein anderer Benutzer ausgewählt wird."
label_rule_issue_assigned_to_change: "Wird \"Zugewiesen an\" verändert und der Ticketstatus unverändert den Status x besitzt, dann wird eine Meldung ausgeben, dass ein Statuswechsel notwendig ist"
rule_issue_assigned_to_change_info: "Use Case: Wenn ein Bearbeiter das Ticket auf \"In Progress\" stehen hat und weist dieses Ticket jemand anderen zu, dann würde bei dem anderen Benutzer das Ticket immer noch auf \"In Progress\" stehen. Das will man eventuell unterbinden, da dieser selbst nie entschieden hat an diesem Ticket zu arbeiten und sehr wahrscheinlich auch gar nicht daran arbeitet."
label_rule_issue_current_user_status: "Der Ticketstatus x ist nur erlaubt, wenn \"Zugewiesen an\" der aktuelle Benutzer zugewiesen wird."
rule_issue_current_user_status_info: "Use Case: Ein Benutzer soll nur den Status auf \"In Progress\" selbst stellen können, um damit anzuzeigen, dass er an dem Ticket (gerade) arbeitet."
activerecord:
errors:
messages:
issue_cannot_close_with_open_children: "Das Ticket kann nicht geschlossen werden, bevor nicht alle Untertickets geschlossen wurden."
issue_assigned_to_requires_status_change: "Die Änderung von \"Zugewiesen an\" erfordert auch eine Änderung des Ticketstatus."
issue_current_user_status: "Der ausgewählte Status erfordet, dass \"Zugewiesen an\" Dir selbst zugeordnet wird."

View File

@ -34,7 +34,7 @@ en:
label_project_overview_content: "Project guide"
project_overview_content_info: "Here you can add your text, which will be shown on the project overview page. For example you can link to a wiki page, which is/should be project wide available to every team member. The aim is to reach a better project standard and to maintain a unique wiki structure."
label_global_sidebar: "Global sidebar"
global_sidebar_info: "Enter a project wide available text message here. This sidebar text will be displayed at the project overview, the ticket pages and the wiki pages."
global_sidebar_info: "Enter a project wide available text message here. This sidebar text will be displayed at the project overview, the issue pages and the wiki pages."
label_global_wiki_sidebar: "Global wiki sidebar"
global_wiki_sidebar_info: 'Enter a project wide available text message for your wiki sidebar, here. This sidebar text will be displayed at the wiki pages only. Use this space for Macros like "Last changed pages" for example. In case a project specific sidebar is used (wiki page), this will be preferably displayed in the sidebar instead.'
label_global_wiki_header: "Project wide wiki header"
@ -52,20 +52,20 @@ en:
overview_top_info: "Here you can add your text, which will be shown on the overview page at the top. For example you can link to a wiki page."
overview_bottom_info: "Here you can add your text, which will be shown on the overview page at the bottom. For example you can link to a wiki page."
label_settings_macros: "Macros"
label_top_macros_help_html: "Here you get a list of all avaiable Redmine macros of your installation, which are provided by Redmine and the Redmine plugins."
label_top_macros_help_html: "Here you get a list of all available Redmine macros of your installation, which are provided by Redmine and the Redmine plugins."
permission_hide_in_memberbox: "Hide in memberbox"
permission_show_hidden_roles_in_memberbox: "Show hidden roles in memberbox"
permission_show_hidden_roles_in_memberbox: "Show hidden roles in member box"
permission_edit_closed_issues: "Edit closed issues"
menu_roles_info: "Only members of selected roles will see this menu entry."
label_rule_issue_close_with_open_children: Issues with open sub-issues cannot be closed
top_rules_help: "Here you can define rules, which are used in issues of all projects."
top_content_help: "Here you can define texts, which will be displayed in diverse areas of Redmine."
label_rule_issue_status_change: "If \"Assigned to\" is unchanged and the issue status changed from x to y, than the author is assigned to the issue"
label_rule_issue_status_change: "If \"Assignee\" is unchanged and the issue status changed from x to y, than the author is assigned to the issue"
rule_issue_status_change_info: "Use Case: issues should be automatically assigned to autor, if the status changes to \"Approval\"."
label_rule_issue_assigned_to_change: "If \"Assigned to\" has changed and the issue status is unchanged with status x, than the user gets a message, that a status change is required"
rule_issue_assigned_to_change_info: "Use Case: issue status \"In Progress\" should only assigned from user the user itselve, who is working on the issue. If someone else already was assigend to the issue with \"In progress\" and assign the issue to another user, the other user is not really working on it - in most of the cases."
label_rule_issue_current_user_status: "Current issue status x is only allowed if \"Assignee\" is the current user."
rule_issue_current_user_status_info: "Use Case: Users are only allowed to change the status to \"In Progress\" if they are the person who is actually working on the issue right now."
activerecord:
errors:
messages:
issue_cannot_close_with_open_children: "This issue can only be closed, if all sub-issues ared closed, too."
issue_assigned_to_requires_status_change: "Changing \"Assigned to\" requires a change of the issue status, too."
issue_cannot_close_with_open_children: "This issue can only be closed, if all sub-issues are closed, too."
issue_current_user_status: "The selected status requires that the \"Assignee\" is yourself."

View File

@ -10,7 +10,7 @@ module RedmineTweaks
base.class_eval do
alias_method_chain :editable?, :closed_edit
validate :validate_open_sub_issues
validate :validate_assigned_to_changed
validate :validate_current_user_status
before_save :change_status_with_assigned_to_change
end
end
@ -42,14 +42,12 @@ module RedmineTweaks
end
end
def validate_assigned_to_changed
return true unless RedmineTweaks.settings[:issue_assigned_to_change]
return true if RedmineTweaks.settings[:issue_assigned_to_x].nil?
if assigned_to_id_changed? &&
!status_id_changed? &&
!assigned_to_id_was.blank? &&
(RedmineTweaks.settings[:issue_assigned_to_x].include?status_id.to_s)
errors.add :base, :issue_assigned_to_requires_status_change
def validate_current_user_status
return true unless RedmineTweaks.settings[:issue_current_user_status]
return true if RedmineTweaks.settings[:issue_assign_to_x].nil?
if (RedmineTweaks.settings[:issue_assign_to_x].include?status_id.to_s) &&
(assigned_to_id.blank? || assigned_to_id != User.current.id)
errors.add :base, :issue_current_user_status
end
end