diff --git a/app/controllers/projects_controller.rb b/app/controllers/projects_controller.rb index 92c024ed29..5c76b514ee 100644 --- a/app/controllers/projects_controller.rb +++ b/app/controllers/projects_controller.rb @@ -193,9 +193,16 @@ class ProjectsController < ApplicationController end def types + flash[:notice] = [] + + unless params.has_key? :project + params[:project] = { "type_ids" => Type.standard_type.id } + flash[:notice] << l(:notice_automatic_set_of_standard_type) + end + params[:project].assert_valid_keys("type_ids") if @project.update_attributes(params[:project]) - flash[:notice] = l('notice_successful_update') + flash[:notice] << l('notice_successful_update') else flash[:error] = l('timelines.cannot_update_planning_element_types') end diff --git a/app/models/type.rb b/app/models/type.rb index f281a52ed5..df0875043a 100644 --- a/app/models/type.rb +++ b/app/models/type.rb @@ -91,6 +91,10 @@ class Type < ActiveRecord::Base Status.where(status_table[:id].in(old_id_subselect).or(status_table[:id].in(new_id_subselect))) end + def self.standard_type + @@standard_type ||= Type.where(is_standard: true).first + end + def statuses return [] if new_record? @statuses ||= Type.statuses([id]) diff --git a/config/locales/de.yml b/config/locales/de.yml index 7859cf1c18..697b20ae08 100644 --- a/config/locales/de.yml +++ b/config/locales/de.yml @@ -1030,6 +1030,7 @@ de: notice_to_many_principals_to_display: "Es gibt zu viele Treffer.\nBitte engen Sie die Suche ein, indem sie den Namen der Person (oder der Gruppe) eingeben." notice_unable_delete_time_entry: "Der Zeiterfassungseintrag konnte nicht gelöscht werden." notice_unable_delete_version: "Die Version konnte nicht gelöscht werden." + notice_automatic_set_of_standard_type: "Der Standard-Typ wurde automatisch gesetzt." # Default format for numbers number: diff --git a/config/locales/en.yml b/config/locales/en.yml index 3e3db1b157..feeaa6b3f9 100644 --- a/config/locales/en.yml +++ b/config/locales/en.yml @@ -1012,13 +1012,10 @@ en: notice_to_many_principals_to_display: "There are too many results.\nNarrow down the search by typing in the name of the new member (or group)." notice_unable_delete_time_entry: "Unable to delete time log entry." notice_unable_delete_version: "Unable to delete version." + notice_automatic_set_of_standard_type: "Set standard type automatically." # Default format for numbers number: - - - - format: delimiter: "" precision: 3