summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJean-Philippe Lang <jp_lang@yahoo.fr>2008-08-31 16:45:46 +0000
committerJean-Philippe Lang <jp_lang@yahoo.fr>2008-08-31 16:45:46 +0000
commit068448d7344914af6cead07728a1a017c39d51c6 (patch)
tree7b681527b8b907dfee1d89d56ae4bc35c8aaa115
parentef83abe72559a7048662c46cb29eb92da6475473 (diff)
downloadredmine-068448d7344914af6cead07728a1a017c39d51c6.tar.gz
redmine-068448d7344914af6cead07728a1a017c39d51c6.zip
Sync with trunk r1778.
git-svn-id: http://redmine.rubyforge.org/svn/branches/work@1779 e93f8b46-1217-0410-a6f0-8f06a7374b81
-rw-r--r--groups/app/controllers/application.rb6
-rw-r--r--groups/app/controllers/projects_controller.rb1
-rw-r--r--groups/app/controllers/timelog_controller.rb40
-rw-r--r--groups/app/helpers/settings_helper.rb1
-rw-r--r--groups/app/helpers/timelog_helper.rb8
-rw-r--r--groups/app/models/project.rb6
-rw-r--r--groups/app/models/user.rb2
-rw-r--r--groups/app/views/settings/_general.rhtml3
-rw-r--r--groups/app/views/settings/_projects.rhtml12
-rw-r--r--groups/app/views/timelog/details.rhtml6
-rw-r--r--groups/app/views/timelog/report.rhtml2
-rw-r--r--groups/config/routes.rb2
-rw-r--r--groups/config/settings.yml2
-rw-r--r--groups/extra/svn/Redmine.pm2
-rw-r--r--groups/lang/bg.yml1
-rw-r--r--groups/lang/cs.yml1
-rw-r--r--groups/lang/da.yml1
-rw-r--r--groups/lang/de.yml1
-rw-r--r--groups/lang/en.yml1
-rw-r--r--groups/lang/es.yml1
-rw-r--r--groups/lang/fi.yml1
-rw-r--r--groups/lang/fr.yml1
-rw-r--r--groups/lang/he.yml1
-rw-r--r--groups/lang/hu.yml1
-rw-r--r--groups/lang/it.yml1
-rw-r--r--groups/lang/ja.yml1
-rw-r--r--groups/lang/ko.yml1
-rw-r--r--groups/lang/lt.yml1
-rw-r--r--groups/lang/nl.yml1
-rw-r--r--groups/lang/no.yml1
-rw-r--r--groups/lang/pl.yml1
-rw-r--r--groups/lang/pt-br.yml1
-rw-r--r--groups/lang/pt.yml1
-rw-r--r--groups/lang/ro.yml1
-rw-r--r--groups/lang/ru.yml1
-rw-r--r--groups/lang/sr.yml1
-rw-r--r--groups/lang/sv.yml1
-rw-r--r--groups/lang/th.yml1
-rw-r--r--groups/lang/uk.yml1
-rw-r--r--groups/lang/zh-tw.yml1
-rw-r--r--groups/lang/zh.yml1
-rw-r--r--groups/test/functional/timelog_controller_test.rb54
-rw-r--r--groups/test/unit/project_test.rb11
43 files changed, 161 insertions, 24 deletions
diff --git a/groups/app/controllers/application.rb b/groups/app/controllers/application.rb
index 7a56e61f0..d21d0bd8c 100644
--- a/groups/app/controllers/application.rb
+++ b/groups/app/controllers/application.rb
@@ -95,11 +95,15 @@ class ApplicationController < ActionController::Base
end
true
end
+
+ def deny_access
+ User.current.logged? ? render_403 : require_login
+ end
# Authorize the user for the requested action
def authorize(ctrl = params[:controller], action = params[:action])
allowed = User.current.allowed_to?({:controller => ctrl, :action => action}, @project)
- allowed ? true : (User.current.logged? ? render_403 : require_login)
+ allowed ? true : deny_access
end
# make sure that the user is a member of the project (or admin) if project is private
diff --git a/groups/app/controllers/projects_controller.rb b/groups/app/controllers/projects_controller.rb
index 747c26bd2..4e0b126e8 100644
--- a/groups/app/controllers/projects_controller.rb
+++ b/groups/app/controllers/projects_controller.rb
@@ -69,6 +69,7 @@ class ProjectsController < ApplicationController
:order => 'name')
@project = Project.new(params[:project])
if request.get?
+ @project.identifier = Project.next_identifier if Setting.sequential_project_identifiers?
@project.trackers = Tracker.all
@project.is_public = Setting.default_projects_public?
@project.enabled_module_names = Redmine::AccessControl.available_project_modules
diff --git a/groups/app/controllers/timelog_controller.rb b/groups/app/controllers/timelog_controller.rb
index f331cdbe4..897a50fe5 100644
--- a/groups/app/controllers/timelog_controller.rb
+++ b/groups/app/controllers/timelog_controller.rb
@@ -17,7 +17,8 @@
class TimelogController < ApplicationController
menu_item :issues
- before_filter :find_project, :authorize
+ before_filter :find_project, :authorize, :only => [:edit, :destroy]
+ before_filter :find_optional_project, :only => [:report, :details]
verify :method => :post, :only => :destroy, :redirect_to => { :action => :details }
@@ -53,11 +54,12 @@ class TimelogController < ApplicationController
}
# Add list and boolean custom fields as available criterias
- @project.all_issue_custom_fields.select {|cf| %w(list bool).include? cf.field_format }.each do |cf|
+ custom_fields = (@project.nil? ? IssueCustomField.for_all : @project.all_issue_custom_fields)
+ custom_fields.select {|cf| %w(list bool).include? cf.field_format }.each do |cf|
@available_criterias["cf_#{cf.id}"] = {:sql => "(SELECT c.value FROM #{CustomValue.table_name} c WHERE c.custom_field_id = #{cf.id} AND c.customized_type = 'Issue' AND c.customized_id = #{Issue.table_name}.id)",
:format => cf.field_format,
:label => cf.name}
- end
+ end if @project
# Add list and boolean time entry custom fields
TimeEntryCustomField.find(:all).select {|cf| %w(list bool).include? cf.field_format }.each do |cf|
@@ -83,9 +85,10 @@ class TimelogController < ApplicationController
sql << " FROM #{TimeEntry.table_name}"
sql << " LEFT JOIN #{Issue.table_name} ON #{TimeEntry.table_name}.issue_id = #{Issue.table_name}.id"
sql << " LEFT JOIN #{Project.table_name} ON #{TimeEntry.table_name}.project_id = #{Project.table_name}.id"
- sql << " WHERE (%s)" % @project.project_condition(Setting.display_subprojects_issues?)
- sql << " AND (%s)" % Project.allowed_to_condition(User.current, :view_time_entries)
- sql << " AND spent_on BETWEEN '%s' AND '%s'" % [ActiveRecord::Base.connection.quoted_date(@from.to_time), ActiveRecord::Base.connection.quoted_date(@to.to_time)]
+ sql << " WHERE"
+ sql << " (%s) AND" % @project.project_condition(Setting.display_subprojects_issues?) if @project
+ sql << " (%s) AND" % Project.allowed_to_condition(User.current, :view_time_entries)
+ sql << " (spent_on BETWEEN '%s' AND '%s')" % [ActiveRecord::Base.connection.quoted_date(@from.to_time), ActiveRecord::Base.connection.quoted_date(@to.to_time)]
sql << " GROUP BY #{sql_group_by}, tyear, tmonth, tweek, spent_on"
@hours = ActiveRecord::Base.connection.select_all(sql)
@@ -138,8 +141,13 @@ class TimelogController < ApplicationController
sort_update
cond = ARCondition.new
- cond << (@issue.nil? ? @project.project_condition(Setting.display_subprojects_issues?) :
- ["#{TimeEntry.table_name}.issue_id = ?", @issue.id])
+ if @project.nil?
+ cond << Project.allowed_to_condition(User.current, :view_time_entries)
+ elsif @issue.nil?
+ cond << @project.project_condition(Setting.display_subprojects_issues?)
+ else
+ cond << ["#{TimeEntry.table_name}.issue_id = ?", @issue.id]
+ end
retrieve_date_range
cond << ['spent_on BETWEEN ? AND ?', @from, @to]
@@ -197,7 +205,7 @@ class TimelogController < ApplicationController
@time_entry.destroy
flash[:notice] = l(:notice_successful_delete)
redirect_to :back
- rescue RedirectBackError
+ rescue ::ActionController::RedirectBackError
redirect_to :action => 'details', :project_id => @time_entry.project
end
@@ -219,6 +227,16 @@ private
render_404
end
+ def find_optional_project
+ if !params[:issue_id].blank?
+ @issue = Issue.find(params[:issue_id])
+ @project = @issue.project
+ elsif !params[:project_id].blank?
+ @project = Project.find(params[:project_id])
+ end
+ deny_access unless User.current.allowed_to?(:view_time_entries, @project, :global => true)
+ end
+
# Retrieves the date range based on predefined ranges or specific from/to param dates
def retrieve_date_range
@free_period = false
@@ -261,7 +279,7 @@ private
end
@from, @to = @to, @from if @from && @to && @from > @to
- @from ||= (TimeEntry.minimum(:spent_on, :include => :project, :conditions => @project.project_condition(Setting.display_subprojects_issues?)) || Date.today) - 1
- @to ||= (TimeEntry.maximum(:spent_on, :include => :project, :conditions => @project.project_condition(Setting.display_subprojects_issues?)) || Date.today)
+ @from ||= (TimeEntry.minimum(:spent_on, :include => :project, :conditions => Project.allowed_to_condition(User.current, :view_time_entries)) || Date.today) - 1
+ @to ||= (TimeEntry.maximum(:spent_on, :include => :project, :conditions => Project.allowed_to_condition(User.current, :view_time_entries)) || Date.today)
end
end
diff --git a/groups/app/helpers/settings_helper.rb b/groups/app/helpers/settings_helper.rb
index d88269f7d..47e691334 100644
--- a/groups/app/helpers/settings_helper.rb
+++ b/groups/app/helpers/settings_helper.rb
@@ -19,6 +19,7 @@ module SettingsHelper
def administration_settings_tabs
tabs = [{:name => 'general', :partial => 'settings/general', :label => :label_general},
{:name => 'authentication', :partial => 'settings/authentication', :label => :label_authentication},
+ {:name => 'projects', :partial => 'settings/projects', :label => :label_project_plural},
{:name => 'issues', :partial => 'settings/issues', :label => :label_issue_tracking},
{:name => 'notifications', :partial => 'settings/notifications', :label => l(:field_mail_notification)},
{:name => 'mail_handler', :partial => 'settings/mail_handler', :label => l(:label_incoming_emails)},
diff --git a/groups/app/helpers/timelog_helper.rb b/groups/app/helpers/timelog_helper.rb
index 2c1225a7c..f55a8ffe7 100644
--- a/groups/app/helpers/timelog_helper.rb
+++ b/groups/app/helpers/timelog_helper.rb
@@ -16,6 +16,14 @@
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
module TimelogHelper
+ def render_timelog_breadcrumb
+ links = []
+ links << link_to(l(:label_project_all), {:project_id => nil, :issue_id => nil})
+ links << link_to(h(@project), {:project_id => @project, :issue_id => nil}) if @project
+ links << link_to_issue(@issue) if @issue
+ breadcrumb links
+ end
+
def activity_collection_for_select_options
activities = Enumeration::get_values('ACTI')
collection = []
diff --git a/groups/app/models/project.rb b/groups/app/models/project.rb
index f7feb7349..20d558682 100644
--- a/groups/app/models/project.rb
+++ b/groups/app/models/project.rb
@@ -239,6 +239,12 @@ class Project < ActiveRecord::Base
enabled_modules << EnabledModule.new(:name => name.to_s)
end
end
+
+ # Returns an auto-generated project identifier based on the last identifier used
+ def self.next_identifier
+ p = Project.find(:first, :order => 'created_on DESC')
+ p.nil? ? nil : p.identifier.to_s.succ
+ end
protected
def validate
diff --git a/groups/app/models/user.rb b/groups/app/models/user.rb
index 0e02cb78c..a89737113 100644
--- a/groups/app/models/user.rb
+++ b/groups/app/models/user.rb
@@ -269,7 +269,7 @@ class User < ActiveRecord::Base
elsif options[:global]
# authorize if user has at least one role that has this permission
roles = memberships.collect {|m| m.role}.uniq
- roles.detect {|r| r.allowed_to?(action)}
+ roles.detect {|r| r.allowed_to?(action)} || (self.logged? ? Role.non_member.allowed_to?(action) : Role.anonymous.allowed_to?(action))
else
false
end
diff --git a/groups/app/views/settings/_general.rhtml b/groups/app/views/settings/_general.rhtml
index 1d17a003e..bb56c43db 100644
--- a/groups/app/views/settings/_general.rhtml
+++ b/groups/app/views/settings/_general.rhtml
@@ -46,9 +46,6 @@
<p><label><%= l(:setting_feeds_limit) %></label>
<%= text_field_tag 'settings[feeds_limit]', Setting.feeds_limit, :size => 6 %></p>
-
-<p><label><%= l(:setting_default_projects_public) %></label>
-<%= check_box_tag 'settings[default_projects_public]', 1, Setting.default_projects_public? %><%= hidden_field_tag 'settings[default_projects_public]', 0 %></p>
</div>
<%= submit_tag l(:button_save) %>
diff --git a/groups/app/views/settings/_projects.rhtml b/groups/app/views/settings/_projects.rhtml
new file mode 100644
index 000000000..1cd4f6e9b
--- /dev/null
+++ b/groups/app/views/settings/_projects.rhtml
@@ -0,0 +1,12 @@
+<% form_tag({:action => 'edit', :tab => 'projects'}) do %>
+
+<div class="box tabular settings">
+<p><label><%= l(:setting_default_projects_public) %></label>
+<%= check_box_tag 'settings[default_projects_public]', 1, Setting.default_projects_public? %><%= hidden_field_tag 'settings[default_projects_public]', 0 %></p>
+
+<p><label><%= l(:setting_sequential_project_identifiers) %></label>
+<%= check_box_tag 'settings[sequential_project_identifiers]', 1, Setting.sequential_project_identifiers? %><%= hidden_field_tag 'settings[sequential_project_identifiers]', 0 %></p>
+</div>
+
+<%= submit_tag l(:button_save) %>
+<% end %>
diff --git a/groups/app/views/timelog/details.rhtml b/groups/app/views/timelog/details.rhtml
index f111cbfc0..db62fae66 100644
--- a/groups/app/views/timelog/details.rhtml
+++ b/groups/app/views/timelog/details.rhtml
@@ -2,11 +2,9 @@
<%= link_to_if_authorized l(:button_log_time), {:controller => 'timelog', :action => 'edit', :project_id => @project, :issue_id => @issue}, :class => 'icon icon-time' %>
</div>
-<h2><%= l(:label_spent_time) %></h2>
+<%= render_timelog_breadcrumb %>
-<% if @issue %>
-<h3><%= link_to(@project.name, {:action => 'details', :project_id => @project}) %> / <%= link_to_issue(@issue) %></h3>
-<% end %>
+<h2><%= l(:label_spent_time) %></h2>
<% form_remote_tag( :url => {}, :method => :get, :update => 'content' ) do %>
<%= hidden_field_tag 'project_id', params[:project_id] %>
diff --git a/groups/app/views/timelog/report.rhtml b/groups/app/views/timelog/report.rhtml
index 97251bc11..eea0d0fc7 100644
--- a/groups/app/views/timelog/report.rhtml
+++ b/groups/app/views/timelog/report.rhtml
@@ -2,6 +2,8 @@
<%= link_to_if_authorized l(:button_log_time), {:controller => 'timelog', :action => 'edit', :project_id => @project, :issue_id => @issue}, :class => 'icon icon-time' %>
</div>
+<%= render_timelog_breadcrumb %>
+
<h2><%= l(:label_spent_time) %></h2>
<% form_remote_tag(:url => {}, :update => 'content') do %>
diff --git a/groups/config/routes.rb b/groups/config/routes.rb
index 4213df915..6f686e295 100644
--- a/groups/config/routes.rb
+++ b/groups/config/routes.rb
@@ -22,7 +22,7 @@ ActionController::Routing::Routes.draw do |map|
map.connect 'projects/:project_id/news/:action', :controller => 'news'
map.connect 'projects/:project_id/documents/:action', :controller => 'documents'
map.connect 'projects/:project_id/boards/:action/:id', :controller => 'boards'
- map.connect 'projects/:project_id/timelog/:action/:id', :controller => 'timelog'
+ map.connect 'projects/:project_id/timelog/:action/:id', :controller => 'timelog', :project_id => /.+/
map.connect 'boards/:board_id/topics/:action/:id', :controller => 'messages'
map.with_options :controller => 'repositories' do |omap|
diff --git a/groups/config/settings.yml b/groups/config/settings.yml
index ac79edb8d..e1ad341de 100644
--- a/groups/config/settings.yml
+++ b/groups/config/settings.yml
@@ -118,6 +118,8 @@ display_subprojects_issues:
default: 1
default_projects_public:
default: 1
+sequential_project_identifiers:
+ default: 0
# encodings used to convert repository files content to UTF-8
# multiple values accepted, comma separated
repositories_encodings:
diff --git a/groups/extra/svn/Redmine.pm b/groups/extra/svn/Redmine.pm
index 09a85fb09..2619196c7 100644
--- a/groups/extra/svn/Redmine.pm
+++ b/groups/extra/svn/Redmine.pm
@@ -200,7 +200,7 @@ sub access_handler {
}
my $method = $r->method;
- return OK if defined $read_only_methods{$method};
+ return OK unless defined $read_only_methods{$method};
my $project_id = get_project_identifier($r);
diff --git a/groups/lang/bg.yml b/groups/lang/bg.yml
index 1f174e29f..ddc3368ef 100644
--- a/groups/lang/bg.yml
+++ b/groups/lang/bg.yml
@@ -636,3 +636,4 @@ field_parent_title: Parent page
label_issue_watchers: Watchers
setting_commit_logs_encoding: Commit messages encoding
button_quote: Quote
+setting_sequential_project_identifiers: Generate sequential project identifiers
diff --git a/groups/lang/cs.yml b/groups/lang/cs.yml
index 609e95478..767fcdbde 100644
--- a/groups/lang/cs.yml
+++ b/groups/lang/cs.yml
@@ -641,3 +641,4 @@ field_parent_title: Parent page
label_issue_watchers: Watchers
setting_commit_logs_encoding: Commit messages encoding
button_quote: Quote
+setting_sequential_project_identifiers: Generate sequential project identifiers
diff --git a/groups/lang/da.yml b/groups/lang/da.yml
index a76e7ea5c..8f8905f32 100644
--- a/groups/lang/da.yml
+++ b/groups/lang/da.yml
@@ -638,3 +638,4 @@ field_parent_title: Parent page
label_issue_watchers: Watchers
setting_commit_logs_encoding: Commit messages encoding
button_quote: Quote
+setting_sequential_project_identifiers: Generate sequential project identifiers
diff --git a/groups/lang/de.yml b/groups/lang/de.yml
index e309dfb57..1f6c6291d 100644
--- a/groups/lang/de.yml
+++ b/groups/lang/de.yml
@@ -637,3 +637,4 @@ field_parent_title: Parent page
label_issue_watchers: Watchers
setting_commit_logs_encoding: Commit messages encoding
button_quote: Quote
+setting_sequential_project_identifiers: Generate sequential project identifiers
diff --git a/groups/lang/en.yml b/groups/lang/en.yml
index 7763b44b5..9cb6a7b65 100644
--- a/groups/lang/en.yml
+++ b/groups/lang/en.yml
@@ -220,6 +220,7 @@ setting_display_subprojects_issues: Display subprojects issues on main projects
setting_enabled_scm: Enabled SCM
setting_mail_handler_api_enabled: Enable WS for incoming emails
setting_mail_handler_api_key: API key
+setting_sequential_project_identifiers: Generate sequential project identifiers
project_module_issue_tracking: Issue tracking
project_module_time_tracking: Time tracking
diff --git a/groups/lang/es.yml b/groups/lang/es.yml
index fc9540a02..e4b4f0668 100644
--- a/groups/lang/es.yml
+++ b/groups/lang/es.yml
@@ -639,3 +639,4 @@ field_parent_title: Parent page
label_issue_watchers: Watchers
setting_commit_logs_encoding: Commit messages encoding
button_quote: Quote
+setting_sequential_project_identifiers: Generate sequential project identifiers
diff --git a/groups/lang/fi.yml b/groups/lang/fi.yml
index 6eb16bfac..3ec7a6b50 100644
--- a/groups/lang/fi.yml
+++ b/groups/lang/fi.yml
@@ -636,3 +636,4 @@ field_parent_title: Parent page
label_issue_watchers: Watchers
setting_commit_logs_encoding: Commit messages encoding
button_quote: Quote
+setting_sequential_project_identifiers: Generate sequential project identifiers
diff --git a/groups/lang/fr.yml b/groups/lang/fr.yml
index 81e44949f..f40a3f3d1 100644
--- a/groups/lang/fr.yml
+++ b/groups/lang/fr.yml
@@ -220,6 +220,7 @@ setting_display_subprojects_issues: Afficher par défaut les demandes des sous-p
setting_enabled_scm: SCM activés
setting_mail_handler_api_enabled: "Activer le WS pour la réception d'emails"
setting_mail_handler_api_key: Clé de protection de l'API
+setting_sequential_project_identifiers: Générer des identifiants de projet séquentiels
project_module_issue_tracking: Suivi des demandes
project_module_time_tracking: Suivi du temps passé
diff --git a/groups/lang/he.yml b/groups/lang/he.yml
index 77fe32e53..e89e65c61 100644
--- a/groups/lang/he.yml
+++ b/groups/lang/he.yml
@@ -636,3 +636,4 @@ field_parent_title: Parent page
label_issue_watchers: Watchers
setting_commit_logs_encoding: Commit messages encoding
button_quote: Quote
+setting_sequential_project_identifiers: Generate sequential project identifiers
diff --git a/groups/lang/hu.yml b/groups/lang/hu.yml
index 208b6fe1e..f8bfb93e8 100644
--- a/groups/lang/hu.yml
+++ b/groups/lang/hu.yml
@@ -637,3 +637,4 @@ field_parent_title: Parent page
label_issue_watchers: Watchers
setting_commit_logs_encoding: Commit messages encoding
button_quote: Quote
+setting_sequential_project_identifiers: Generate sequential project identifiers
diff --git a/groups/lang/it.yml b/groups/lang/it.yml
index d123e913a..e1ef6f8fe 100644
--- a/groups/lang/it.yml
+++ b/groups/lang/it.yml
@@ -636,3 +636,4 @@ field_parent_title: Parent page
label_issue_watchers: Watchers
setting_commit_logs_encoding: Commit messages encoding
button_quote: Quote
+setting_sequential_project_identifiers: Generate sequential project identifiers
diff --git a/groups/lang/ja.yml b/groups/lang/ja.yml
index 5a728fb02..dda73dc26 100644
--- a/groups/lang/ja.yml
+++ b/groups/lang/ja.yml
@@ -637,3 +637,4 @@ field_parent_title: Parent page
label_issue_watchers: Watchers
setting_commit_logs_encoding: Commit messages encoding
button_quote: Quote
+setting_sequential_project_identifiers: Generate sequential project identifiers
diff --git a/groups/lang/ko.yml b/groups/lang/ko.yml
index 16bd65364..be7eab1fb 100644
--- a/groups/lang/ko.yml
+++ b/groups/lang/ko.yml
@@ -636,3 +636,4 @@ field_parent_title: Parent page
label_issue_watchers: Watchers
setting_commit_logs_encoding: Commit messages encoding
button_quote: Quote
+setting_sequential_project_identifiers: Generate sequential project identifiers
diff --git a/groups/lang/lt.yml b/groups/lang/lt.yml
index 2a75a95ea..da581d678 100644
--- a/groups/lang/lt.yml
+++ b/groups/lang/lt.yml
@@ -639,3 +639,4 @@ field_parent_title: Parent page
label_issue_watchers: Watchers
setting_commit_logs_encoding: Commit messages encoding
button_quote: Quote
+setting_sequential_project_identifiers: Generate sequential project identifiers
diff --git a/groups/lang/nl.yml b/groups/lang/nl.yml
index f79e78994..b1c5756be 100644
--- a/groups/lang/nl.yml
+++ b/groups/lang/nl.yml
@@ -637,3 +637,4 @@ field_parent_title: Parent page
label_issue_watchers: Watchers
setting_commit_logs_encoding: Commit messages encoding
button_quote: Quote
+setting_sequential_project_identifiers: Generate sequential project identifiers
diff --git a/groups/lang/no.yml b/groups/lang/no.yml
index 6643f9c86..7113b416a 100644
--- a/groups/lang/no.yml
+++ b/groups/lang/no.yml
@@ -637,3 +637,4 @@ field_parent_title: Parent page
label_issue_watchers: Watchers
setting_commit_logs_encoding: Commit messages encoding
button_quote: Quote
+setting_sequential_project_identifiers: Generate sequential project identifiers
diff --git a/groups/lang/pl.yml b/groups/lang/pl.yml
index 2df921b71..e9ffcda2c 100644
--- a/groups/lang/pl.yml
+++ b/groups/lang/pl.yml
@@ -636,3 +636,4 @@ field_parent_title: Parent page
label_issue_watchers: Watchers
setting_commit_logs_encoding: Commit messages encoding
button_quote: Quote
+setting_sequential_project_identifiers: Generate sequential project identifiers
diff --git a/groups/lang/pt-br.yml b/groups/lang/pt-br.yml
index 8cd171b72..b4064bf58 100644
--- a/groups/lang/pt-br.yml
+++ b/groups/lang/pt-br.yml
@@ -636,3 +636,4 @@ field_parent_title: Parent page
label_issue_watchers: Watchers
setting_commit_logs_encoding: Commit messages encoding
button_quote: Quote
+setting_sequential_project_identifiers: Generate sequential project identifiers
diff --git a/groups/lang/pt.yml b/groups/lang/pt.yml
index 5562ca4ac..1d4d043f5 100644
--- a/groups/lang/pt.yml
+++ b/groups/lang/pt.yml
@@ -636,3 +636,4 @@ field_parent_title: Parent page
label_issue_watchers: Watchers
setting_commit_logs_encoding: Commit messages encoding
button_quote: Quote
+setting_sequential_project_identifiers: Generate sequential project identifiers
diff --git a/groups/lang/ro.yml b/groups/lang/ro.yml
index 5bb49ecec..acb5ff8ec 100644
--- a/groups/lang/ro.yml
+++ b/groups/lang/ro.yml
@@ -636,3 +636,4 @@ field_parent_title: Parent page
label_issue_watchers: Watchers
setting_commit_logs_encoding: Commit messages encoding
button_quote: Quote
+setting_sequential_project_identifiers: Generate sequential project identifiers
diff --git a/groups/lang/ru.yml b/groups/lang/ru.yml
index 01cdcd478..b0e137aa9 100644
--- a/groups/lang/ru.yml
+++ b/groups/lang/ru.yml
@@ -640,3 +640,4 @@ field_parent_title: Parent page
label_issue_watchers: Watchers
setting_commit_logs_encoding: Commit messages encoding
button_quote: Quote
+setting_sequential_project_identifiers: Generate sequential project identifiers
diff --git a/groups/lang/sr.yml b/groups/lang/sr.yml
index 566a46d9f..4e262369e 100644
--- a/groups/lang/sr.yml
+++ b/groups/lang/sr.yml
@@ -637,3 +637,4 @@ field_parent_title: Parent page
label_issue_watchers: Watchers
setting_commit_logs_encoding: Commit messages encoding
button_quote: Quote
+setting_sequential_project_identifiers: Generate sequential project identifiers
diff --git a/groups/lang/sv.yml b/groups/lang/sv.yml
index 4cb1f073b..3bb337e3d 100644
--- a/groups/lang/sv.yml
+++ b/groups/lang/sv.yml
@@ -637,3 +637,4 @@ field_parent_title: Parent page
label_issue_watchers: Watchers
setting_commit_logs_encoding: Commit messages encoding
button_quote: Quote
+setting_sequential_project_identifiers: Generate sequential project identifiers
diff --git a/groups/lang/th.yml b/groups/lang/th.yml
index 2c3977de2..a9708716e 100644
--- a/groups/lang/th.yml
+++ b/groups/lang/th.yml
@@ -639,3 +639,4 @@ field_parent_title: Parent page
label_issue_watchers: Watchers
setting_commit_logs_encoding: Commit messages encoding
button_quote: Quote
+setting_sequential_project_identifiers: Generate sequential project identifiers
diff --git a/groups/lang/uk.yml b/groups/lang/uk.yml
index 7ba152413..cb4e17383 100644
--- a/groups/lang/uk.yml
+++ b/groups/lang/uk.yml
@@ -638,3 +638,4 @@ field_parent_title: Parent page
label_issue_watchers: Watchers
setting_commit_logs_encoding: Commit messages encoding
button_quote: Quote
+setting_sequential_project_identifiers: Generate sequential project identifiers
diff --git a/groups/lang/zh-tw.yml b/groups/lang/zh-tw.yml
index 6a1441364..b91bef8f9 100644
--- a/groups/lang/zh-tw.yml
+++ b/groups/lang/zh-tw.yml
@@ -637,3 +637,4 @@ field_parent_title: Parent page
label_issue_watchers: Watchers
setting_commit_logs_encoding: Commit messages encoding
button_quote: Quote
+setting_sequential_project_identifiers: Generate sequential project identifiers
diff --git a/groups/lang/zh.yml b/groups/lang/zh.yml
index bfe551093..dbc531119 100644
--- a/groups/lang/zh.yml
+++ b/groups/lang/zh.yml
@@ -637,3 +637,4 @@ enumeration_issue_priorities: 问题优先级
enumeration_doc_categories: 文档类别
enumeration_activities: 活动(时间跟踪)
button_quote: Quote
+setting_sequential_project_identifiers: Generate sequential project identifiers
diff --git a/groups/test/functional/timelog_controller_test.rb b/groups/test/functional/timelog_controller_test.rb
index 7b4622daa..28f2a28e2 100644
--- a/groups/test/functional/timelog_controller_test.rb
+++ b/groups/test/functional/timelog_controller_test.rb
@@ -78,7 +78,7 @@ class TimelogControllerTest < Test::Unit::TestCase
assert_equal 2, entry.user_id
end
- def destroy
+ def test_destroy
@request.session[:user_id] = 2
post :destroy, :id => 1
assert_redirected_to 'projects/ecookbook/timelog/details'
@@ -91,6 +91,29 @@ class TimelogControllerTest < Test::Unit::TestCase
assert_template 'report'
end
+ def test_report_all_projects
+ get :report
+ assert_response :success
+ assert_template 'report'
+ end
+
+ def test_report_all_projects_denied
+ r = Role.anonymous
+ r.permissions.delete(:view_time_entries)
+ r.permissions_will_change!
+ r.save
+ get :report
+ assert_redirected_to '/account/login'
+ end
+
+ def test_report_all_projects_one_criteria
+ get :report, :columns => 'week', :from => "2007-04-01", :to => "2007-04-30", :criterias => ['project']
+ assert_response :success
+ assert_template 'report'
+ assert_not_nil assigns(:total_hours)
+ assert_equal "8.65", "%.2f" % assigns(:total_hours)
+ end
+
def test_report_all_time
get :report, :project_id => 1, :criterias => ['project', 'issue']
assert_response :success
@@ -148,7 +171,18 @@ class TimelogControllerTest < Test::Unit::TestCase
assert_not_nil assigns(:total_hours)
assert_equal "0.00", "%.2f" % assigns(:total_hours)
end
-
+
+ def test_report_all_projects_csv_export
+ get :report, :columns => 'month', :from => "2007-01-01", :to => "2007-06-30", :criterias => ["project", "member", "activity"], :format => "csv"
+ assert_response :success
+ assert_equal 'text/csv', @response.content_type
+ lines = @response.body.chomp.split("\n")
+ # Headers
+ assert_equal 'Project,Member,Activity,2007-1,2007-2,2007-3,2007-4,2007-5,2007-6,Total', lines.first
+ # Total row
+ assert_equal 'Total,"","","","",154.25,8.65,"","",162.90', lines.last
+ end
+
def test_report_csv_export
get :report, :project_id => 1, :columns => 'month', :from => "2007-01-01", :to => "2007-06-30", :criterias => ["project", "member", "activity"], :format => "csv"
assert_response :success
@@ -159,6 +193,14 @@ class TimelogControllerTest < Test::Unit::TestCase
# Total row
assert_equal 'Total,"","","","",154.25,8.65,"","",162.90', lines.last
end
+
+ def test_details_all_projects
+ get :details
+ assert_response :success
+ assert_template 'details'
+ assert_not_nil assigns(:total_hours)
+ assert_equal "162.90", "%.2f" % assigns(:total_hours)
+ end
def test_details_at_project_level
get :details, :project_id => 1
@@ -218,6 +260,14 @@ class TimelogControllerTest < Test::Unit::TestCase
assert assigns(:items).first.is_a?(TimeEntry)
end
+ def test_details_all_projects_csv_export
+ get :details, :format => 'csv'
+ assert_response :success
+ assert_equal 'text/csv', @response.content_type
+ assert @response.body.include?("Date,User,Activity,Project,Issue,Tracker,Subject,Hours,Comment\n")
+ assert @response.body.include?("\n04/21/2007,redMine Admin,Design,eCookbook,3,Bug,Error 281 when updating a recipe,1.0,\"\"\n")
+ end
+
def test_details_csv_export
get :details, :project_id => 1, :format => 'csv'
assert_response :success
diff --git a/groups/test/unit/project_test.rb b/groups/test/unit/project_test.rb
index 0bd28dbc9..45a346361 100644
--- a/groups/test/unit/project_test.rb
+++ b/groups/test/unit/project_test.rb
@@ -130,4 +130,15 @@ class ProjectTest < Test::Unit::TestCase
assert_equal [1, 2, 3], parent.rolled_up_trackers.collect(&:id)
assert_equal [2, 3], child.rolled_up_trackers.collect(&:id)
end
+
+ def test_next_identifier
+ ProjectCustomField.delete_all
+ Project.create!(:name => 'last', :identifier => 'p2008040')
+ assert_equal 'p2008041', Project.next_identifier
+ end
+
+ def test_next_identifier_first_project
+ Project.delete_all
+ assert_nil Project.next_identifier
+ end
end