@@ -16,61 +16,66 | |||||
16 | # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. |
|
16 | # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. | |
17 |
|
17 | |||
18 | class IssuesController < ApplicationController |
|
18 | class IssuesController < ApplicationController | |
19 |
|
|
19 | layout 'base' | |
20 |
|
|
20 | before_filter :find_project, :authorize | |
21 |
|
21 | |||
22 |
|
|
22 | helper :custom_fields | |
23 |
|
|
23 | include CustomFieldsHelper | |
24 |
|
24 | |||
25 |
|
|
25 | def show | |
26 | @status_options = @issue.status.workflows.find(:all, :conditions => ["role_id=? and tracker_id=?", self.logged_in_user.role_for_project(@project.id), @issue.tracker.id]).collect{ |w| w.new_status } if self.logged_in_user |
|
26 | @status_options = @issue.status.workflows.find(:all, :include => :new_status, :conditions => ["role_id=? and tracker_id=?", self.logged_in_user.role_for_project(@project.id), @issue.tracker.id]).collect{ |w| w.new_status } if self.logged_in_user | |
27 | @custom_values = @issue.custom_values.find(:all, :include => :custom_field) |
|
27 | @custom_values = @issue.custom_values.find(:all, :include => :custom_field) | |
28 |
|
|
28 | end | |
29 |
|
29 | |||
30 |
|
|
30 | def edit | |
31 |
|
|
31 | @priorities = Enumeration::get_values('IPRI') | |
32 |
|
32 | if request.get? | ||
33 | if request.get? |
|
33 | @custom_values = @project.custom_fields_for_issues(@issue.tracker).collect { |x| @issue.custom_values.find_by_custom_field_id(x.id) || CustomValue.new(:custom_field => x, :customized => @issue) } | |
34 | @custom_values = @project.custom_fields_for_issues(@issue.tracker).collect { |x| @issue.custom_values.find_by_custom_field_id(x.id) || CustomValue.new(:custom_field => x, :customized => @issue) } |
|
34 | else | |
35 | else |
|
35 | begin | |
36 |
|
|
36 | # Retrieve custom fields and values | |
37 |
|
|
37 | @custom_values = @project.custom_fields_for_issues(@issue.tracker).collect { |x| CustomValue.new(:custom_field => x, :customized => @issue, :value => params["custom_fields"][x.id.to_s]) } | |
38 |
|
|
38 | @issue.custom_values = @custom_values | |
39 |
|
|
39 | @issue.attributes = params[:issue] | |
40 |
|
|
40 | if @issue.save | |
41 |
|
|
41 | flash[:notice] = l(:notice_successful_update) | |
42 |
|
|
42 | redirect_to :action => 'show', :id => @issue | |
43 | end |
|
43 | end | |
44 | end |
|
44 | rescue ActiveRecord::StaleObjectError | |
45 | end |
|
45 | # Optimistic locking exception | |
46 |
|
46 | flash[:notice] = l(:notice_locking_conflict) | ||
47 | def change_status |
|
47 | end | |
48 | @history = @issue.histories.build(params[:history]) |
|
48 | end | |
|
49 | end | |||
|
50 | ||||
|
51 | def change_status | |||
|
52 | @history = @issue.histories.build(params[:history]) | |||
49 | @status_options = @issue.status.workflows.find(:all, :conditions => ["role_id=? and tracker_id=?", self.logged_in_user.role_for_project(@project.id), @issue.tracker.id]).collect{ |w| w.new_status } if self.logged_in_user |
|
53 | @status_options = @issue.status.workflows.find(:all, :conditions => ["role_id=? and tracker_id=?", self.logged_in_user.role_for_project(@project.id), @issue.tracker.id]).collect{ |w| w.new_status } if self.logged_in_user | |
50 |
|
54 | if params[:confirm] | ||
51 | if params[:confirm] |
|
55 | begin | |
52 |
|
|
56 | @history.author_id = self.logged_in_user.id if self.logged_in_user | |
53 |
|
57 | @issue.status = @history.status | ||
54 | if @history.save |
|
58 | @issue.fixed_version_id = (params[:issue][:fixed_version_id]) | |
55 | @issue.status = @history.status |
|
59 | @issue.assigned_to_id = (params[:issue][:assigned_to_id]) | |
56 |
|
|
60 | @issue.lock_version = (params[:issue][:lock_version]) | |
57 | @issue.assigned_to_id = (params[:issue][:assigned_to_id]) |
|
61 | if @issue.save | |
58 | if @issue.save |
|
62 | flash[:notice] = l(:notice_successful_update) | |
59 | flash[:notice] = l(:notice_successful_update) |
|
63 | Mailer.deliver_issue_change_status(@issue) if Permission.find_by_controller_and_action(@params[:controller], @params[:action]).mail_enabled? | |
60 | Mailer.deliver_issue_change_status(@issue) if Permission.find_by_controller_and_action(@params[:controller], @params[:action]).mail_enabled? |
|
64 | redirect_to :action => 'show', :id => @issue | |
61 | redirect_to :action => 'show', :id => @issue |
|
65 | end | |
62 | end |
|
66 | rescue ActiveRecord::StaleObjectError | |
63 | end |
|
67 | # Optimistic locking exception | |
64 | end |
|
68 | flash[:notice] = l(:notice_locking_conflict) | |
|
69 | end | |||
|
70 | end | |||
65 | @assignable_to = @project.members.find(:all, :include => :user).collect{ |m| m.user } |
|
71 | @assignable_to = @project.members.find(:all, :include => :user).collect{ |m| m.user } | |
66 |
|
72 | end | ||
67 | end |
|
73 | ||
68 |
|
74 | def destroy | ||
69 | def destroy |
|
75 | @issue.destroy | |
70 | @issue.destroy |
|
76 | redirect_to :controller => 'projects', :action => 'list_issues', :id => @project | |
71 | redirect_to :controller => 'projects', :action => 'list_issues', :id => @project |
|
77 | end | |
72 | end |
|
78 | ||
73 |
|
||||
74 | def add_attachment |
|
79 | def add_attachment | |
75 | # Save the attachment |
|
80 | # Save the attachment | |
76 | if params[:attachment][:file].size > 0 |
|
81 | if params[:attachment][:file].size > 0 | |
@@ -94,7 +99,7 class IssuesController < ApplicationController | |||||
94 |
|
99 | |||
95 | private |
|
100 | private | |
96 | def find_project |
|
101 | def find_project | |
97 | @issue = Issue.find(params[:id]) |
|
102 | @issue = Issue.find(params[:id], :include => [:project, :tracker, :status, :author, :priority, :category]) | |
98 | @project = @issue.project |
|
103 | @project = @issue.project | |
99 | end |
|
104 | end | |
100 | end |
|
105 | end |
@@ -24,6 +24,7 | |||||
24 | <p><label for="history_notes"><%=l(:field_notes)%></label> |
|
24 | <p><label for="history_notes"><%=l(:field_notes)%></label> | |
25 | <%= text_area 'history', 'notes', :cols => 60, :rows => 10 %></p> |
|
25 | <%= text_area 'history', 'notes', :cols => 60, :rows => 10 %></p> | |
26 | </div> |
|
26 | </div> | |
27 |
|
27 | |||
|
28 | <%= hidden_field 'issue', 'lock_version' %> | |||
28 | <%= submit_tag l(:button_save) %> |
|
29 | <%= submit_tag l(:button_save) %> | |
29 | <%= end_form_tag %> |
|
30 | <%= end_form_tag %> |
@@ -21,6 +21,6 | |||||
21 | </select></p> |
|
21 | </select></p> | |
22 | <!--[eoform:issue]--> |
|
22 | <!--[eoform:issue]--> | |
23 | </div> |
|
23 | </div> | |
24 |
|
24 | <%= f.hidden_field :lock_version %> | ||
25 | <%= submit_tag l(:button_save) %> |
|
25 | <%= submit_tag l(:button_save) %> | |
26 | <% end %> No newline at end of file |
|
26 | <% end %> |
@@ -49,7 +49,7 | |||||
49 | <div class="box"> |
|
49 | <div class="box"> | |
50 | <h3><%=l(:label_history)%></h3> |
|
50 | <h3><%=l(:label_history)%></h3> | |
51 | <table width="100%"> |
|
51 | <table width="100%"> | |
52 | <% for history in @issue.histories.find(:all, :include => :author) %> |
|
52 | <% for history in @issue.histories.find(:all, :include => [:author, :status]) %> | |
53 | <tr> |
|
53 | <tr> | |
54 | <td><%= format_date(history.created_on) %></td> |
|
54 | <td><%= format_date(history.created_on) %></td> | |
55 | <td><%= history.author.display_name %></td> |
|
55 | <td><%= history.author.display_name %></td> |
@@ -120,7 +120,8 class Setup < ActiveRecord::Migration | |||||
120 | t.column "assigned_to_id", :integer |
|
120 | t.column "assigned_to_id", :integer | |
121 | t.column "priority_id", :integer, :default => 0, :null => false |
|
121 | t.column "priority_id", :integer, :default => 0, :null => false | |
122 | t.column "fixed_version_id", :integer |
|
122 | t.column "fixed_version_id", :integer | |
123 | t.column "author_id", :integer, :default => 0, :null => false |
|
123 | t.column "author_id", :integer, :default => 0, :null => false | |
|
124 | t.column "lock_version", :integer, :default => 0, :null => false | |||
124 | t.column "created_on", :timestamp |
|
125 | t.column "created_on", :timestamp | |
125 | t.column "updated_on", :timestamp |
|
126 | t.column "updated_on", :timestamp | |
126 | end |
|
127 | end |
@@ -58,6 +58,7 notice_successful_update: Erfolgreiches Update. | |||||
58 | notice_successful_delete: Erfolgreiche Auslassung. |
|
58 | notice_successful_delete: Erfolgreiche Auslassung. | |
59 | notice_successful_connection: Erfolgreicher Anschluß. |
|
59 | notice_successful_connection: Erfolgreicher Anschluß. | |
60 | notice_file_not_found: Erbetene Akte besteht nicht oder ist gelöscht worden. |
|
60 | notice_file_not_found: Erbetene Akte besteht nicht oder ist gelöscht worden. | |
|
61 | notice_locking_conflict: Data have been updated by another user. | |||
61 |
|
62 | |||
62 | gui_validation_error: 1 Störung |
|
63 | gui_validation_error: 1 Störung | |
63 | gui_validation_error_plural: %d Störungen |
|
64 | gui_validation_error_plural: %d Störungen |
@@ -58,6 +58,7 notice_successful_update: Successful update. | |||||
58 | notice_successful_delete: Successful deletion. |
|
58 | notice_successful_delete: Successful deletion. | |
59 | notice_successful_connection: Successful connection. |
|
59 | notice_successful_connection: Successful connection. | |
60 | notice_file_not_found: Requested file doesn't exist or has been deleted. |
|
60 | notice_file_not_found: Requested file doesn't exist or has been deleted. | |
|
61 | notice_locking_conflict: Data have been updated by another user. | |||
61 |
|
62 | |||
62 | gui_validation_error: 1 error |
|
63 | gui_validation_error: 1 error | |
63 | gui_validation_error_plural: %d errors |
|
64 | gui_validation_error_plural: %d errors |
@@ -58,6 +58,7 notice_successful_update: Successful update. | |||||
58 | notice_successful_delete: Successful deletion. |
|
58 | notice_successful_delete: Successful deletion. | |
59 | notice_successful_connection: Successful connection. |
|
59 | notice_successful_connection: Successful connection. | |
60 | notice_file_not_found: Requested file doesn't exist or has been deleted. |
|
60 | notice_file_not_found: Requested file doesn't exist or has been deleted. | |
|
61 | notice_locking_conflict: Data have been updated by another user. | |||
61 |
|
62 | |||
62 | gui_validation_error: 1 error |
|
63 | gui_validation_error: 1 error | |
63 | gui_validation_error_plural: %d errores |
|
64 | gui_validation_error_plural: %d errores |
@@ -58,6 +58,7 notice_successful_update: Mise à jour effectuée avec succès. | |||||
58 | notice_successful_delete: Suppression effectuée avec succès. |
|
58 | notice_successful_delete: Suppression effectuée avec succès. | |
59 | notice_successful_connection: Connection réussie. |
|
59 | notice_successful_connection: Connection réussie. | |
60 | notice_file_not_found: Le fichier demandé n'existe pas ou a été supprimé. |
|
60 | notice_file_not_found: Le fichier demandé n'existe pas ou a été supprimé. | |
|
61 | notice_locking_conflict: Les données ont été mises à jour par un autre utilisateur. Mise à jour impossible. | |||
61 |
|
62 | |||
62 | gui_validation_error: 1 erreur |
|
63 | gui_validation_error: 1 erreur | |
63 | gui_validation_error_plural: %d erreurs |
|
64 | gui_validation_error_plural: %d erreurs |
General Comments 0
You need to be logged in to leave comments.
Login now