Adds an option to generate sequential project identifiers.
Disabled by default, it can be enabled on the 'Projects' tab in application settings. git-svn-id: http://redmine.rubyforge.org/svn/trunk@1777 e93f8b46-1217-0410-a6f0-8f06a7374b81
This commit is contained in:
parent
25b4139028
commit
dbad26c87d
@ -69,6 +69,7 @@ class ProjectsController < ApplicationController
|
|||||||
:order => 'name')
|
:order => 'name')
|
||||||
@project = Project.new(params[:project])
|
@project = Project.new(params[:project])
|
||||||
if request.get?
|
if request.get?
|
||||||
|
@project.identifier = Project.next_identifier if Setting.sequential_project_identifiers?
|
||||||
@project.trackers = Tracker.all
|
@project.trackers = Tracker.all
|
||||||
@project.is_public = Setting.default_projects_public?
|
@project.is_public = Setting.default_projects_public?
|
||||||
@project.enabled_module_names = Redmine::AccessControl.available_project_modules
|
@project.enabled_module_names = Redmine::AccessControl.available_project_modules
|
||||||
|
@ -19,6 +19,7 @@ module SettingsHelper
|
|||||||
def administration_settings_tabs
|
def administration_settings_tabs
|
||||||
tabs = [{:name => 'general', :partial => 'settings/general', :label => :label_general},
|
tabs = [{:name => 'general', :partial => 'settings/general', :label => :label_general},
|
||||||
{:name => 'authentication', :partial => 'settings/authentication', :label => :label_authentication},
|
{: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 => 'issues', :partial => 'settings/issues', :label => :label_issue_tracking},
|
||||||
{:name => 'notifications', :partial => 'settings/notifications', :label => l(:field_mail_notification)},
|
{:name => 'notifications', :partial => 'settings/notifications', :label => l(:field_mail_notification)},
|
||||||
{:name => 'mail_handler', :partial => 'settings/mail_handler', :label => l(:label_incoming_emails)},
|
{:name => 'mail_handler', :partial => 'settings/mail_handler', :label => l(:label_incoming_emails)},
|
||||||
|
@ -238,6 +238,12 @@ class Project < ActiveRecord::Base
|
|||||||
enabled_modules << EnabledModule.new(:name => name.to_s)
|
enabled_modules << EnabledModule.new(:name => name.to_s)
|
||||||
end
|
end
|
||||||
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
|
protected
|
||||||
def validate
|
def validate
|
||||||
|
@ -46,9 +46,6 @@
|
|||||||
|
|
||||||
<p><label><%= l(:setting_feeds_limit) %></label>
|
<p><label><%= l(:setting_feeds_limit) %></label>
|
||||||
<%= text_field_tag 'settings[feeds_limit]', Setting.feeds_limit, :size => 6 %></p>
|
<%= 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>
|
</div>
|
||||||
|
|
||||||
<%= submit_tag l(:button_save) %>
|
<%= submit_tag l(:button_save) %>
|
||||||
|
12
app/views/settings/_projects.rhtml
Normal file
12
app/views/settings/_projects.rhtml
Normal file
@ -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 %>
|
@ -118,6 +118,8 @@ display_subprojects_issues:
|
|||||||
default: 1
|
default: 1
|
||||||
default_projects_public:
|
default_projects_public:
|
||||||
default: 1
|
default: 1
|
||||||
|
sequential_project_identifiers:
|
||||||
|
default: 0
|
||||||
# encodings used to convert repository files content to UTF-8
|
# encodings used to convert repository files content to UTF-8
|
||||||
# multiple values accepted, comma separated
|
# multiple values accepted, comma separated
|
||||||
repositories_encodings:
|
repositories_encodings:
|
||||||
|
@ -636,3 +636,4 @@ field_parent_title: Parent page
|
|||||||
label_issue_watchers: Watchers
|
label_issue_watchers: Watchers
|
||||||
setting_commit_logs_encoding: Commit messages encoding
|
setting_commit_logs_encoding: Commit messages encoding
|
||||||
button_quote: Quote
|
button_quote: Quote
|
||||||
|
setting_sequential_project_identifiers: Generate sequential project identifiers
|
||||||
|
@ -641,3 +641,4 @@ field_parent_title: Parent page
|
|||||||
label_issue_watchers: Watchers
|
label_issue_watchers: Watchers
|
||||||
setting_commit_logs_encoding: Commit messages encoding
|
setting_commit_logs_encoding: Commit messages encoding
|
||||||
button_quote: Quote
|
button_quote: Quote
|
||||||
|
setting_sequential_project_identifiers: Generate sequential project identifiers
|
||||||
|
@ -638,3 +638,4 @@ field_parent_title: Parent page
|
|||||||
label_issue_watchers: Watchers
|
label_issue_watchers: Watchers
|
||||||
setting_commit_logs_encoding: Commit messages encoding
|
setting_commit_logs_encoding: Commit messages encoding
|
||||||
button_quote: Quote
|
button_quote: Quote
|
||||||
|
setting_sequential_project_identifiers: Generate sequential project identifiers
|
||||||
|
@ -637,3 +637,4 @@ field_parent_title: Parent page
|
|||||||
label_issue_watchers: Watchers
|
label_issue_watchers: Watchers
|
||||||
setting_commit_logs_encoding: Commit messages encoding
|
setting_commit_logs_encoding: Commit messages encoding
|
||||||
button_quote: Quote
|
button_quote: Quote
|
||||||
|
setting_sequential_project_identifiers: Generate sequential project identifiers
|
||||||
|
@ -219,6 +219,7 @@ setting_display_subprojects_issues: Display subprojects issues on main projects
|
|||||||
setting_enabled_scm: Enabled SCM
|
setting_enabled_scm: Enabled SCM
|
||||||
setting_mail_handler_api_enabled: Enable WS for incoming emails
|
setting_mail_handler_api_enabled: Enable WS for incoming emails
|
||||||
setting_mail_handler_api_key: API key
|
setting_mail_handler_api_key: API key
|
||||||
|
setting_sequential_project_identifiers: Generate sequential project identifiers
|
||||||
|
|
||||||
project_module_issue_tracking: Issue tracking
|
project_module_issue_tracking: Issue tracking
|
||||||
project_module_time_tracking: Time tracking
|
project_module_time_tracking: Time tracking
|
||||||
|
@ -639,3 +639,4 @@ field_parent_title: Parent page
|
|||||||
label_issue_watchers: Watchers
|
label_issue_watchers: Watchers
|
||||||
setting_commit_logs_encoding: Commit messages encoding
|
setting_commit_logs_encoding: Commit messages encoding
|
||||||
button_quote: Quote
|
button_quote: Quote
|
||||||
|
setting_sequential_project_identifiers: Generate sequential project identifiers
|
||||||
|
@ -636,3 +636,4 @@ field_parent_title: Parent page
|
|||||||
label_issue_watchers: Watchers
|
label_issue_watchers: Watchers
|
||||||
setting_commit_logs_encoding: Commit messages encoding
|
setting_commit_logs_encoding: Commit messages encoding
|
||||||
button_quote: Quote
|
button_quote: Quote
|
||||||
|
setting_sequential_project_identifiers: Generate sequential project identifiers
|
||||||
|
@ -220,6 +220,7 @@ setting_display_subprojects_issues: Afficher par défaut les demandes des sous-p
|
|||||||
setting_enabled_scm: SCM activés
|
setting_enabled_scm: SCM activés
|
||||||
setting_mail_handler_api_enabled: "Activer le WS pour la réception d'emails"
|
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_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_issue_tracking: Suivi des demandes
|
||||||
project_module_time_tracking: Suivi du temps passé
|
project_module_time_tracking: Suivi du temps passé
|
||||||
|
@ -636,3 +636,4 @@ field_parent_title: Parent page
|
|||||||
label_issue_watchers: Watchers
|
label_issue_watchers: Watchers
|
||||||
setting_commit_logs_encoding: Commit messages encoding
|
setting_commit_logs_encoding: Commit messages encoding
|
||||||
button_quote: Quote
|
button_quote: Quote
|
||||||
|
setting_sequential_project_identifiers: Generate sequential project identifiers
|
||||||
|
@ -637,3 +637,4 @@ field_parent_title: Parent page
|
|||||||
label_issue_watchers: Watchers
|
label_issue_watchers: Watchers
|
||||||
setting_commit_logs_encoding: Commit messages encoding
|
setting_commit_logs_encoding: Commit messages encoding
|
||||||
button_quote: Quote
|
button_quote: Quote
|
||||||
|
setting_sequential_project_identifiers: Generate sequential project identifiers
|
||||||
|
@ -636,3 +636,4 @@ field_parent_title: Parent page
|
|||||||
label_issue_watchers: Watchers
|
label_issue_watchers: Watchers
|
||||||
setting_commit_logs_encoding: Commit messages encoding
|
setting_commit_logs_encoding: Commit messages encoding
|
||||||
button_quote: Quote
|
button_quote: Quote
|
||||||
|
setting_sequential_project_identifiers: Generate sequential project identifiers
|
||||||
|
@ -637,3 +637,4 @@ field_parent_title: Parent page
|
|||||||
label_issue_watchers: Watchers
|
label_issue_watchers: Watchers
|
||||||
setting_commit_logs_encoding: Commit messages encoding
|
setting_commit_logs_encoding: Commit messages encoding
|
||||||
button_quote: Quote
|
button_quote: Quote
|
||||||
|
setting_sequential_project_identifiers: Generate sequential project identifiers
|
||||||
|
@ -636,3 +636,4 @@ field_parent_title: Parent page
|
|||||||
label_issue_watchers: Watchers
|
label_issue_watchers: Watchers
|
||||||
setting_commit_logs_encoding: Commit messages encoding
|
setting_commit_logs_encoding: Commit messages encoding
|
||||||
button_quote: Quote
|
button_quote: Quote
|
||||||
|
setting_sequential_project_identifiers: Generate sequential project identifiers
|
||||||
|
@ -639,3 +639,4 @@ field_parent_title: Parent page
|
|||||||
label_issue_watchers: Watchers
|
label_issue_watchers: Watchers
|
||||||
setting_commit_logs_encoding: Commit messages encoding
|
setting_commit_logs_encoding: Commit messages encoding
|
||||||
button_quote: Quote
|
button_quote: Quote
|
||||||
|
setting_sequential_project_identifiers: Generate sequential project identifiers
|
||||||
|
@ -637,3 +637,4 @@ field_parent_title: Parent page
|
|||||||
label_issue_watchers: Watchers
|
label_issue_watchers: Watchers
|
||||||
setting_commit_logs_encoding: Commit messages encoding
|
setting_commit_logs_encoding: Commit messages encoding
|
||||||
button_quote: Quote
|
button_quote: Quote
|
||||||
|
setting_sequential_project_identifiers: Generate sequential project identifiers
|
||||||
|
@ -637,3 +637,4 @@ field_parent_title: Parent page
|
|||||||
label_issue_watchers: Watchers
|
label_issue_watchers: Watchers
|
||||||
setting_commit_logs_encoding: Commit messages encoding
|
setting_commit_logs_encoding: Commit messages encoding
|
||||||
button_quote: Quote
|
button_quote: Quote
|
||||||
|
setting_sequential_project_identifiers: Generate sequential project identifiers
|
||||||
|
@ -636,3 +636,4 @@ field_parent_title: Parent page
|
|||||||
label_issue_watchers: Watchers
|
label_issue_watchers: Watchers
|
||||||
setting_commit_logs_encoding: Commit messages encoding
|
setting_commit_logs_encoding: Commit messages encoding
|
||||||
button_quote: Quote
|
button_quote: Quote
|
||||||
|
setting_sequential_project_identifiers: Generate sequential project identifiers
|
||||||
|
@ -636,3 +636,4 @@ field_parent_title: Parent page
|
|||||||
label_issue_watchers: Watchers
|
label_issue_watchers: Watchers
|
||||||
setting_commit_logs_encoding: Commit messages encoding
|
setting_commit_logs_encoding: Commit messages encoding
|
||||||
button_quote: Quote
|
button_quote: Quote
|
||||||
|
setting_sequential_project_identifiers: Generate sequential project identifiers
|
||||||
|
@ -636,3 +636,4 @@ field_parent_title: Parent page
|
|||||||
label_issue_watchers: Watchers
|
label_issue_watchers: Watchers
|
||||||
setting_commit_logs_encoding: Commit messages encoding
|
setting_commit_logs_encoding: Commit messages encoding
|
||||||
button_quote: Quote
|
button_quote: Quote
|
||||||
|
setting_sequential_project_identifiers: Generate sequential project identifiers
|
||||||
|
@ -636,3 +636,4 @@ field_parent_title: Parent page
|
|||||||
label_issue_watchers: Watchers
|
label_issue_watchers: Watchers
|
||||||
setting_commit_logs_encoding: Commit messages encoding
|
setting_commit_logs_encoding: Commit messages encoding
|
||||||
button_quote: Quote
|
button_quote: Quote
|
||||||
|
setting_sequential_project_identifiers: Generate sequential project identifiers
|
||||||
|
@ -640,3 +640,4 @@ field_parent_title: Parent page
|
|||||||
label_issue_watchers: Watchers
|
label_issue_watchers: Watchers
|
||||||
setting_commit_logs_encoding: Commit messages encoding
|
setting_commit_logs_encoding: Commit messages encoding
|
||||||
button_quote: Quote
|
button_quote: Quote
|
||||||
|
setting_sequential_project_identifiers: Generate sequential project identifiers
|
||||||
|
@ -637,3 +637,4 @@ field_parent_title: Parent page
|
|||||||
label_issue_watchers: Watchers
|
label_issue_watchers: Watchers
|
||||||
setting_commit_logs_encoding: Commit messages encoding
|
setting_commit_logs_encoding: Commit messages encoding
|
||||||
button_quote: Quote
|
button_quote: Quote
|
||||||
|
setting_sequential_project_identifiers: Generate sequential project identifiers
|
||||||
|
@ -637,3 +637,4 @@ field_parent_title: Parent page
|
|||||||
label_issue_watchers: Watchers
|
label_issue_watchers: Watchers
|
||||||
setting_commit_logs_encoding: Commit messages encoding
|
setting_commit_logs_encoding: Commit messages encoding
|
||||||
button_quote: Quote
|
button_quote: Quote
|
||||||
|
setting_sequential_project_identifiers: Generate sequential project identifiers
|
||||||
|
@ -639,3 +639,4 @@ field_parent_title: Parent page
|
|||||||
label_issue_watchers: Watchers
|
label_issue_watchers: Watchers
|
||||||
setting_commit_logs_encoding: Commit messages encoding
|
setting_commit_logs_encoding: Commit messages encoding
|
||||||
button_quote: Quote
|
button_quote: Quote
|
||||||
|
setting_sequential_project_identifiers: Generate sequential project identifiers
|
||||||
|
@ -638,3 +638,4 @@ field_parent_title: Parent page
|
|||||||
label_issue_watchers: Watchers
|
label_issue_watchers: Watchers
|
||||||
setting_commit_logs_encoding: Commit messages encoding
|
setting_commit_logs_encoding: Commit messages encoding
|
||||||
button_quote: Quote
|
button_quote: Quote
|
||||||
|
setting_sequential_project_identifiers: Generate sequential project identifiers
|
||||||
|
@ -637,3 +637,4 @@ field_parent_title: Parent page
|
|||||||
label_issue_watchers: Watchers
|
label_issue_watchers: Watchers
|
||||||
setting_commit_logs_encoding: Commit messages encoding
|
setting_commit_logs_encoding: Commit messages encoding
|
||||||
button_quote: Quote
|
button_quote: Quote
|
||||||
|
setting_sequential_project_identifiers: Generate sequential project identifiers
|
||||||
|
@ -637,3 +637,4 @@ enumeration_issue_priorities: 问题优先级
|
|||||||
enumeration_doc_categories: 文档类别
|
enumeration_doc_categories: 文档类别
|
||||||
enumeration_activities: 活动(时间跟踪)
|
enumeration_activities: 活动(时间跟踪)
|
||||||
button_quote: Quote
|
button_quote: Quote
|
||||||
|
setting_sequential_project_identifiers: Generate sequential project identifiers
|
||||||
|
@ -130,4 +130,15 @@ class ProjectTest < Test::Unit::TestCase
|
|||||||
assert_equal [1, 2, 3], parent.rolled_up_trackers.collect(&:id)
|
assert_equal [1, 2, 3], parent.rolled_up_trackers.collect(&:id)
|
||||||
assert_equal [2, 3], child.rolled_up_trackers.collect(&:id)
|
assert_equal [2, 3], child.rolled_up_trackers.collect(&:id)
|
||||||
end
|
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
|
end
|
||||||
|
Loading…
x
Reference in New Issue
Block a user