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