OpenProject is the leading open source project management software for product, project and portfolio management. A powerful Jira alternative with agile planning, issue tracking, roadmaps, Gantt charts, time tracking, collaboration features, and more. Available on premises or in the cloud. ⭐ Star us on GitHub
Ruby agile-developmentangularbcfboardsbug-trackerganttgantt-chartifcissue-trackerjira-alternativekanbanopenprojectproduct-managementproject-managementproject-planningroadmaprubyscrumtimelineworkflows
Feature/remove timelog (#8557)
ulferts6826f90ee2e0
diff --git a/Gemfile.lock b/Gemfile.lockindex 9a0a5d4d813..d831fa7f833 100644--- a/Gemfile.lock+++ b/Gemfile.lock@@ -82,10 +82,15 @@ PATHspecs:openproject-boards (1.0.0)+PATH+ remote: modules/budgets+ specs:+ budgets (1.0.0)+PATHremote: modules/costsspecs:- openproject-costs (1.0.0)+ costs (1.0.0)PATHremote: modules/dashboards@@ -173,7 +178,7 @@ PATHremote: modules/reportingspecs:openproject-reporting (1.0.0)- openproject-costs+ costsreporting_enginePATH@@ -990,6 +995,7 @@ DEPENDENCIESbootsnap (~> 1.4.5)brakeman (~> 4.8.0)browser (~> 2.6.1)+ budgets!capybara (~> 3.32.0)capybara-screenshot (~> 1.0.17)carrierwave (~> 1.3.1)@@ -998,6 +1004,7 @@ DEPENDENCIEScells-rails (~> 0.0.9)commonmarker (~> 0.21.0)compare-xml (~> 0.66)+ costs!cucumber (~> 3.1.0)cucumber-rails (~> 1.8.0)daemons@@ -1051,7 +1058,6 @@ DEPENDENCIESopenproject-backlogs!openproject-bim!openproject-boards!- openproject-costs!openproject-documents!openproject-github_integration!openproject-global_roles!diff --git a/Gemfile.modules b/Gemfile.modulesindex d53c504912e..c63541d5a67 100644--- a/Gemfile.modules+++ b/Gemfile.modules@@ -27,7 +27,7 @@ group :opf_plugins dogem 'openproject-documents', path: 'modules/documents'gem 'openproject-xls_export', path: 'modules/xls_export'gem 'reporting_engine', path: 'modules/reporting_engine'- gem 'openproject-costs', path: 'modules/costs'+ gem 'costs', path: 'modules/costs'gem 'openproject-reporting', path: 'modules/reporting'gem 'openproject-meeting', path: 'modules/meeting'gem 'openproject-pdf_export', path: 'modules/pdf_export'@@ -45,6 +45,7 @@ group :opf_plugins dogem 'dashboards', path: 'modules/dashboards'gem 'openproject-boards', path: 'modules/boards'gem 'overviews', path: 'modules/overviews'+ gem 'budgets', path: 'modules/budgets'gem 'openproject-bim', path: 'modules/bim'enddiff --git a/app/contracts/model_contract.rb b/app/contracts/model_contract.rbindex 81d323656c0..741fb204d51 100644--- a/app/contracts/model_contract.rb+++ b/app/contracts/model_contract.rb@@ -54,6 +54,8 @@ class ModelContract < Reform::Contractenddef attribute_alias(db, outside)+ raise "Cannot define the alias to #{db} to be the same: #{outside}" if db == outside+attribute_aliases[db] = outsideenddiff --git a/app/contracts/work_packages/base_contract.rb b/app/contracts/work_packages/base_contract.rbindex 4635366521d..a5142780a03 100644--- a/app/contracts/work_packages/base_contract.rb+++ b/app/contracts/work_packages/base_contract.rb@@ -59,7 +59,8 @@ module WorkPackages}attribute :estimated_hours- attribute :derived_estimated_hours, writeable: false+ attribute :derived_estimated_hours,+ writeable: falseattribute :parent_id,permission: :manage_subtasks@@ -99,6 +100,8 @@ module WorkPackagesmodel.leaf? || model.schedule_manually?}+ attribute :budget+validates :due_date,date: { after_or_equal_to: :start_date,message: :greater_than_or_equal_to_start_date,@@ -183,6 +186,10 @@ module WorkPackagesmodel.try(:assignable_versions) if model.projectend+ def assignable_budgets+ model.project&.budgets+ end+privateattr_reader :candiff --git a/app/controllers/time_entries/reports_controller.rb b/app/controllers/time_entries/reports_controller.rbdeleted file mode 100644index 5113cacc103..00000000000--- a/app/controllers/time_entries/reports_controller.rb+++ /dev/null@@ -1,207 +0,0 @@-#-- encoding: UTF-8-#-- copyright-# OpenProject is an open source project management software.-# Copyright (C) 2012-2020 the OpenProject GmbH-#-# This program is free software; you can redistribute it and/or-# modify it under the terms of the GNU General Public License version 3.-#-# OpenProject is a fork of ChiliProject, which is a fork of Redmine. The copyright follows:-# Copyright (C) 2006-2017 Jean-Philippe Lang-# Copyright (C) 2010-2013 the ChiliProject Team-#-# This program is free software; you can redistribute it and/or-# modify it under the terms of the GNU General Public License-# as published by the Free Software Foundation; either version 2-# of the License, or (at your option) any later version.-#-# This program is distributed in the hope that it will be useful,-# but WITHOUT ANY WARRANTY; without even the implied warranty of-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the-# GNU General Public License for more details.-#-# You should have received a copy of the GNU General Public License-# along with this program; if not, write to the Free Software-# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.-#-# See docs/COPYRIGHT.rdoc for more details.-#++--class TimeEntries::ReportsController < ApplicationController- helper_method :gon-- menu_item :issues- before_action :find_optional_project- before_action :load_available_criterias-- include SortHelper- include TimelogHelper- include CustomFieldsHelper-- menu_item :time_entries-- def show- # Set tab param to recognize correct selected tab- params[:tab] = params[:tab] || 'report'-- @criterias = params[:criterias] || []- @criterias = @criterias.select { |criteria| @available_criterias.has_key? criteria }- @criterias.uniq!- @criterias = @criterias[0, 3]-- @columns = (params[:columns] && %w(year month week day).include?(params[:columns])) ? params[:columns] : 'month'-- retrieve_date_range-- unless @criterias.empty?- sql_select = @criterias.map { |criteria| @available_criterias[criteria][:sql] + ' AS ' + criteria }.join(', ')- sql_group_by = @criterias.map { |criteria| @available_criterias[criteria][:sql] }.join(', ')-- sql = "SELECT #{sql_select}, tyear, tmonth, tweek, spent_on, SUM(hours) AS hours"- sql << " FROM #{TimeEntry.table_name}"- sql << time_report_joins- sql << ' WHERE'- sql << ' (%s) AND' % context_sql_condition- sql << " (spent_on BETWEEN '%s' AND '%s')" % [ActiveRecord::Base.connection.quoted_date(@from), ActiveRecord::Base.connection.quoted_date(@to)]- sql << " GROUP BY #{sql_group_by}, tyear, tmonth, tweek, spent_on"-- @hours = ActiveRecord::Base.connection.select_all(sql)-- @hours.each do |row|- case @columns- when 'year'- row['year'] = row['tyear']- when 'month'- row['month'] = "#{row['tyear']}-#{row['tmonth']}"- when 'week'- row['week'] = "#{row['tyear']}-#{row['tweek']}"- when 'day'- row['day'] = "#{row['spent_on']}"- end- end-- @total_hours = @hours.inject(0) { |s, k| s = s + k['hours'].to_f }-- @periods = []- # Date#at_beginning_of_ not supported in Rails 1.2.x- date_from = @from.to_time- # 100 columns max- while date_from <= @to.to_time && @periods.length < 100- case @columns- when 'year'- @periods << "#{date_from.year}"- date_from = (date_from + 1.year).at_beginning_of_year- when 'month'- @periods << "#{date_from.year}-#{date_from.month}"- date_from = (date_from + 1.month).at_beginning_of_month- when 'week'- @periods << "#{date_from.year}-#{date_from.to_date.cweek}"- date_from = (date_from + 7.day).at_beginning_of_week- when 'day'- @periods << "#{date_from.to_date}"- date_from = date_from + 1.day- end- end- end-- respond_to do |format|- format.html do render layout: !request.xhr? end- format.csv do- render csv: report_to_csv(@criterias, @periods, @hours), filename: 'timelog.csv'- end- end- end-- private-- def load_available_criterias- @available_criterias = { 'project' => { sql: "#{TimeEntry.table_name}.project_id",- klass: Project,- label: Project.model_name.human },- 'version' => { sql: "#{WorkPackage.table_name}.version_id",- klass: Version,- label: Version.model_name.human },- 'category' => { sql: "#{WorkPackage.table_name}.category_id",- klass: Category,- label: Category.model_name.human },- 'member' => { sql: "#{TimeEntry.table_name}.user_id",- klass: User,- label: Member.model_name.human },- 'type' => { sql: "#{WorkPackage.table_name}.type_id",- klass: ::Type,- label: ::Type.model_name.human },- 'activity' => { sql: "#{TimeEntry.table_name}.activity_id",- klass: TimeEntryActivity,- label: :label_activity },- 'work_package' => { sql: "#{TimeEntry.table_name}.work_package_id",- klass: WorkPackage,- label: WorkPackage.model_name.human }- }-- # Add list and boolean custom fields as available criterias- custom_fields = (@project.nil? ? WorkPackageCustomField.for_all : @project.all_work_package_custom_fields)-- if @project- 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 = 'WorkPackage'- AND c.customized_id = #{WorkPackage.table_name}.id)",- format: cf,- label: cf.name }- end- end-- # Add list and boolean time entry custom fields- TimeEntryCustomField.all.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 = 'TimeEntry'- AND c.customized_id = #{TimeEntry.table_name}.id)",- format: cf,- label: cf.name }- end-- # Add list and boolean time entry activity custom fields- TimeEntryActivityCustomField.all.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 = 'Enumeration'- AND c.customized_id = #{TimeEntry.table_name}.activity_id)",- format: cf,- label: cf.name }- end-- call_hook(:controller_timelog_available_criterias, available_criterias: @available_criterias, project: @project)- @available_criterias- end-- def time_report_joins- sql = ''- sql << " LEFT JOIN #{WorkPackage.table_name} ON #{TimeEntry.table_name}.work_package_id = #{WorkPackage.table_name}.id"- sql << " LEFT JOIN #{Project.table_name} ON #{TimeEntry.table_name}.project_id = #{Project.table_name}.id"- # TODO: rename hook- call_hook(:controller_timelog_time_report_joins, sql: sql)- sql- end-- def default_breadcrumb- I18n.t(:label_spent_time)- end-- def context_sql_condition- if @project.nil?- project_context_sql_condition- elsif @issue.nil?- @project.project_condition(Setting.display_subprojects_work_packages?).to_sql- else- WorkPackage.self_and_descendants_of_condition(@issue)- end- end-- def project_context_sql_condition- time_entry_table = TimeEntry.arel_table- allowed_project_ids = Project.allowed_to(User.current, :view_time_entries).select(:id).arel- time_entry_table[:project_id].in(allowed_project_ids).to_sql- end-enddiff --git a/app/controllers/timelog_controller.rb b/app/controllers/timelog_controller.rbdeleted file mode 100644index cb3cc3fda48..00000000000--- a/app/controllers/timelog_controller.rb+++ /dev/null@@ -1,232 +0,0 @@-#-- encoding: UTF-8--#-- copyright-# OpenProject is an open source project management software.-# Copyright (C) 2012-2020 the OpenProject GmbH-#-# This program is free software; you can redistribute it and/or-# modify it under the terms of the GNU General Public License version 3.-#-# OpenProject is a fork of ChiliProject, which is a fork of Redmine. The copyright follows:-# Copyright (C) 2006-2017 Jean-Philippe Lang-# Copyright (C) 2010-2013 the ChiliProject Team-#-# This program is free software; you can redistribute it and/or-# modify it under the terms of the GNU General Public License-# as published by the Free Software Foundation; either version 2-# of the License, or (at your option) any later version.-#-# This program is distributed in the hope that it will be useful,-# but WITHOUT ANY WARRANTY; without even the implied warranty of-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the-# GNU General Public License for more details.-#-# You should have received a copy of the GNU General Public License-# along with this program; if not, write to the Free Software-# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.-#-# See docs/COPYRIGHT.rdoc for more details.-#++--class TimelogController < ApplicationController- helper_method :gon-- before_action :find_work_package, only: %i[new create]- before_action :find_project, only: %i[new create]- before_action :find_time_entry, only: %i[show edit update destroy]- before_action :authorize, except: [:index]- before_action :find_optional_project, only: [:index]-- include SortHelper- include TimelogHelper- include CustomFieldsHelper- include PaginationHelper- include Layout-- menu_item :time_entries-- def index- # Set tab param to recognize correct selected tab- params[:tab] = params[:tab] || 'details'-- sort_init 'spent_on', 'desc'- sort_update 'spent_on' => 'spent_on',- 'user' => 'user_id',- 'activity' => 'activity_id',- 'project' => "#{Project.table_name}.name",- 'work_package' => 'work_package_id',- 'comments' => 'comments',- 'hours' => 'hours'-- cond = ARCondition.new- if @issue- cond << WorkPackage.self_and_descendants_of_condition(@issue)- elsif @project- cond << @project.project_condition(Setting.display_subprojects_work_packages?).to_sql- end-- retrieve_date_range allow_nil: true- if @from && @to- cond << ['spent_on BETWEEN ? AND ?', @from, @to]- end-- respond_to do |format|- format.html do- render layout: layout_non_or_no_menu- end- format.csv do- # Export all entries- @entries = TimeEntry- .visible- .includes(:project,- :activity,- :user,- work_package: %i[type assigned_to priority])- .references(:projects)- .where(cond.conditions)- .distinct(false)- .order(sort_clause)-- render csv: entries_to_csv(@entries), filename: 'timelog.csv'- end- end- end-- def new- @time_entry = new_time_entry(@project, @issue, permitted_params.time_entry.to_h)-- call_hook(:controller_timelog_edit_before_save, params: params, time_entry: @time_entry)-- render action: 'edit'- end-- def create- combined_params = permitted_params- .time_entry- .to_h- .reverse_merge(project: @project,- work_package_id: @issue)-- call = TimeEntries::CreateService- .new(user: current_user)- .call(combined_params)-- @time_entry = call.result-- respond_for_saving call- end-- def edit- @time_entry.attributes = permitted_params.time_entry-- call_hook(:controller_timelog_edit_before_save, params: params, time_entry: @time_entry)- end-- def update- service = TimeEntries::UpdateService- .new(user: current_user,- model: @time_entry)- call = service.call(attributes: permitted_params.time_entry)- respond_for_saving call- end-- def destroy- if @time_entry.destroy && @time_entry.destroyed?- respond_to do |format|- format.html do- flash[:notice] = l(:notice_successful_delete)- redirect_back fallback_location: { action: 'index', project_id: @time_entry.project }- end- format.json do- render json: { text: l(:notice_successful_delete) }- end- end- else- respond_to do |format|- format.html do- flash[:error] = l(:notice_unable_delete_time_entry)- redirect_back fallback_location: { action: 'index', project_id: @time_entry.project }- end- format.json do- render json: { isError: true, text: l(:notice_unable_delete_time_entry) }- end- end- end- end-- private-- def find_time_entry- @time_entry = TimeEntry.find(params[:id])- unless @time_entry.editable_by?(User.current)- render_403- return false- end- @project = @time_entry.project- rescue ActiveRecord::RecordNotFound- render_404- end-- def find_project- @project = Project.find(project_id_from_params) if @project.nil?- rescue ActiveRecord::RecordNotFound- render_404- end-- def new_time_entry(project, work_package, attributes)- time_entry = TimeEntry.new(project: project,- work_package: work_package,- user: User.current,- spent_on: User.current.today)-- time_entry.attributes = attributes-- time_entry- end-- def respond_for_saving(call)- @errors = call.errors-- if call.success?- respond_to do |format|- format.html do- flash[:notice] = l(:notice_successful_update)- redirect_back_or_default action: 'index', project_id: @time_entry.project- end- end- else- respond_to do |format|- format.html do- render action: 'edit'- end- end- end- end-- def project_id_from_params- if params.has_key?(:project_id)- params[:project_id]- elsif params.has_key?(:time_entry) && permitted_params.time_entry.has_key?(:project_id)- permitted_params.time_entry[:project_id]- end- end-- def find_work_package- @issue = work_package_from_params- @project = @issue.project unless @issue.nil?- end-- def work_package_from_params- if params.has_key?(:work_package_id)- work_package_id = params[:work_package_id]- elsif params.has_key?(:time_entry) && permitted_params.time_entry.has_key?(:work_package_id)- work_package_id = permitted_params.time_entry[:work_package_id]- end-- WorkPackage.find_by id: work_package_id- end-- def default_breadcrumb- I18n.t(:label_spent_time)- end-enddiff --git a/app/helpers/timelog_helper.rb b/app/helpers/timelog_helper.rbdeleted file mode 100644index fe528bed465..00000000000--- a/app/helpers/timelog_helper.rb+++ /dev/null@@ -1,279 +0,0 @@-#-- encoding: UTF-8-#-- copyright-# OpenProject is an open source project management software.-# Copyright (C) 2012-2020 the OpenProject GmbH-#-# This program is free software; you can redistribute it and/or-# modify it under the terms of the GNU General Public License version 3.-#-# OpenProject is a fork of ChiliProject, which is a fork of Redmine. The copyright follows:-# Copyright (C) 2006-2017 Jean-Philippe Lang-# Copyright (C) 2010-2013 the ChiliProject Team-#-# This program is free software; you can redistribute it and/or-# modify it under the terms of the GNU General Public License-# as published by the Free Software Foundation; either version 2-# of the License, or (at your option) any later version.-#-# This program is distributed in the hope that it will be useful,-# but WITHOUT ANY WARRANTY; without even the implied warranty of-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the-# GNU General Public License for more details.-#-# You should have received a copy of the GNU General Public License-# along with this program; if not, write to the Free Software-# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.-#-# See docs/COPYRIGHT.rdoc for more details.-#++--module TimelogHelper- include ApplicationHelper-- def time_entry_tabs- [- {- name: 'details',- partial: 'timelog/time_entry_tab',- path: polymorphic_time_entries_path(@issue || @project),- label: :label_details- },- {- name: 'report',- partial: 'time_entries/reports/reports_tab',- path: polymorphic_time_entries_report_path(@issue || @project),- label: :label_report- }- ]- end-- # Returns a collection of activities for a select field. time_entry- # is optional and will be used to check if the selected TimeEntryActivity- # is active.- def activity_collection_for_select_options(time_entry = nil, project = nil)- project ||= @project- activities =- if project.nil?- TimeEntryActivity.all.active- else- TimeEntryActivity::Scopes::ActiveInProject.fetch(project)- end-- activities.map do |a|- if a.is_default? && !time_entry&.activity- [a.name, a.id, selected: true]- else- [a.name, a.id]- end- end- end-- def select_hours(data, criteria, value)- if value.to_s.empty?- data.select { |row| row[criteria].blank? }- else- data.select { |row| row[criteria].to_s == value.to_s }- end- end-- def sum_hours(data)- sum = 0- data.each do |row|- sum += row['hours'].to_f- end- sum- end-- def options_for_period_select(value)- options_for_select([[l(:label_all_time), 'all'],- [l(:label_today), 'today'],- [l(:label_yesterday), 'yesterday'],- [l(:label_this_week), 'current_week'],- [l(:label_last_week), 'last_week'],- [l(:label_last_n_days, 7), '7_days'],- [l(:label_this_month), 'current_month'],- [l(:label_last_month), 'last_month'],- [l(:label_last_n_days, 30), '30_days'],- [l(:label_this_year), 'current_year']],- value)- end-- def entries_to_csv(entries)- decimal_separator = l(:general_csv_decimal_separator)- custom_fields = TimeEntryCustomField.all- export = CSV.generate(col_sep: l(:general_csv_separator)) { |csv|- # csv header fields- headers = [TimeEntry.human_attribute_name(:spent_on),- TimeEntry.human_attribute_name(:user),- TimeEntry.human_attribute_name(:activity),- TimeEntry.human_attribute_name(:project),- TimeEntry.human_attribute_name(:issue),- TimeEntry.human_attribute_name(:type),- TimeEntry.human_attribute_name(:subject),- TimeEntry.human_attribute_name(:hours),- TimeEntry.human_attribute_name(:comments)- ]- # Export custom fields- headers += custom_fields.map(&:name)-- csv << WorkPackage::Exporter::CSV.encode_csv_columns(headers)- # csv lines- entries.each do |entry|- fields = [format_date(entry.spent_on),- entry.user,- entry.activity,- entry.project,- (entry.work_package ? entry.work_package.id : nil),- (entry.work_package ? entry.work_package.type : nil),- (entry.work_package ? entry.work_package.subject : nil),- entry.hours.to_s.gsub('.', decimal_separator),- entry.comments- ]- fields += custom_fields.map { |f| show_value(entry.custom_value_for(f)) }-- csv << WorkPackage::Exporter::CSV.encode_csv_columns(fields)- end- }- export- end-- def format_criteria_value(criteria, value)- if value.blank?- l(:label_none)- elsif k = @available_criterias[criteria][:klass]- obj = k.find_by(id: value.to_i)- if obj.is_a?(WorkPackage)- obj.visible? ? h("#{obj.type} ##{obj.id}: #{obj.subject}") : h("##{obj.id}")- else- obj- end- else- format_value(value, @available_criterias[criteria][:format])- end- end-- def report_to_csv(criterias, periods, hours)- export = CSV.generate(col_sep: l(:general_csv_separator)) { |csv|- # Column headers- headers = criterias.map { |criteria|- label = @available_criterias[criteria][:label]- label.is_a?(Symbol) ? l(label) : label- }- headers += periods- headers << l(:label_total)- csv << headers.map { |c| to_utf8_for_timelogs(c) }- # Content- report_criteria_to_csv(csv, criterias, periods, hours)- # Total row- row = [l(:label_total)] + [''] * (criterias.size - 1)- total = 0- periods.each do |period|- sum = sum_hours(select_hours(hours, @columns, period.to_s))- total += sum- row << (sum > 0 ? '%.2f' % sum : '')- end- row << '%.2f' % total- csv << row- }- export- end-- def report_criteria_to_csv(csv, criterias, periods, hours, level = 0)- hours.map { |h| h[criterias[level]].to_s }.uniq.each do |value|- hours_for_value = select_hours(hours, criterias[level], value)- next if hours_for_value.empty?- row = [''] * level- row << to_utf8_for_timelogs(format_criteria_value(criterias[level], value))- row += [''] * (criterias.length - level - 1)- total = 0- periods.each do |period|- sum = sum_hours(select_hours(hours_for_value, @columns, period.to_s))- total += sum- row << (sum > 0 ? '%.2f' % sum : '')- end- row << '%.2f' % total- csv << row-- if criterias.length > level + 1- report_criteria_to_csv(csv, criterias, periods, hours_for_value, level + 1)- end- end- end-- def to_utf8_for_timelogs(s)- s.to_s.encode(l(:general_csv_encoding), 'UTF-8'); rescue; s.to_s end-- def polymorphic_time_entries_path(object)- polymorphic_path([object, :time_entries])- end-- def polymorphic_new_time_entry_path(object)- polymorphic_path([:new, object, :time_entry,])- end-- def polymorphic_time_entries_report_path(object)- polymorphic_path([object, :time_entries, :report])- end-- # Retrieves the date range based on predefined ranges or specific from/to param dates- def retrieve_date_range(allow_nil: false)- @free_period = false- @from = nil- @to = nil-- if params[:period_type] == '1' || (params[:period_type].nil? && !params[:period].nil?)- case params[:period].to_s- when 'today'- @from = @to = Date.today- when 'yesterday'- @from = @to = Date.today - 1- when 'current_week'- @from = Date.today - (Date.today.cwday - 1) % 7- @to = @from + 6- when 'last_week'- @from = Date.today - 7 - (Date.today.cwday - 1) % 7- @to = @from + 6- when '7_days'- @from = Date.today - 7- @to = Date.today- when 'current_month'- @from = Date.civil(Date.today.year, Date.today.month, 1)- @to = (@from >> 1) - 1- when 'last_month'- @from = Date.civil(Date.today.year, Date.today.month, 1) << 1- @to = (@from >> 1) - 1- when '30_days'- @from = Date.today - 30- @to = Date.today- when 'current_year'- @from = Date.civil(Date.today.year, 1, 1)- @to = Date.civil(Date.today.year, 12, 31)- end- elsif params[:period_type] == '2' || (params[:period_type].nil? && (!params[:from].nil? || !params[:to].nil?))- begin; @from = params[:from].to_s.to_date unless params[:from].blank?; rescue; end- begin; @to = params[:to].to_s.to_date unless params[:to].blank?; rescue; end- @free_period = true- # default- end-- @from, @to = @to, @from if @from && @to && @from > @to-- unless allow_nil- @from ||= (TimeEntry.earliest_date_for_project(@project) || Date.today)- @to ||= (TimeEntry.latest_date_for_project(@project) || Date.today)- end- end-- def find_optional_project- if !params[:issue_id].blank?- @issue = WorkPackage.find(params[:issue_id])- @project = @issue.project- elsif !params[:work_package_id].blank?- @issue = WorkPackage.find(params[:work_package_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-enddiff --git a/app/models/permitted_params.rb b/app/models/permitted_params.rbindex 3b53d661fae..0f4e3da7049 100644--- a/app/models/permitted_params.rb+++ b/app/models/permitted_params.rb@@ -235,14 +235,6 @@ class PermittedParamsparams.require(:type).permit(*self.class.permitted_attributes[:move_to])end- def timelog- params.permit(:period,- :period_type,- :from,- :to,- criterias: [])- end-def searchparams.permit(*self.class.permitted_attributes[:search])end@@ -293,14 +285,6 @@ class PermittedParamswhitelist.merge(custom_field_values(:project))end- def time_entry- permitted_params = params.fetch(:time_entry, {}).permit(- :hours, :comments, :work_package_id, :activity_id, :spent_on- )-- permitted_params.merge(custom_field_values(:time_entry, required: false))- end-def newsparams.require(:news).permit(:title, :summary, :description)end@@ -523,6 +507,7 @@ class PermittedParams:due_date,:estimated_hours,:version_id,+ :budget_id,:parent_id,:priority_id,:responsible_id,@@ -539,15 +524,6 @@ class PermittedParams{ watcher_user_ids: [] }endend,- Proc.new do |args|- # avoid costly allowed_to? if the param is not there at all- if args[:params]['work_package'] &&- args[:params]['work_package'].has_key?('time_entry') &&- args[:current_user].allowed_to?(:log_time, args[:project])-- { time_entry: %i[hours activity_id comments] }- end- end,# attributes unique to :new_work_package:journal_notes,:lock_version],diff --git a/app/models/project.rb b/app/models/project.rbindex 510b5908d44..976bec97cc4 100644--- a/app/models/project.rb+++ b/app/models/project.rb@@ -138,6 +138,7 @@ class Project < ApplicationRecordjoin_table: "#{table_name_prefix}custom_fields_projects#{table_name_suffix}",association_foreign_key: 'custom_field_id'has_one :status, class_name: 'Projects::Status', dependent: :destroy+ has_many :budgets, dependent: :destroyacts_as_nested_set order_column: :name, dependent: :destroy@@ -146,10 +147,6 @@ class Project < ApplicationRecorddate_column: "#{table_name}.created_at",project_key: 'id',permission: nil- acts_as_event title: Proc.new { |o| "#{Project.model_name.human}: #{o.name}" },- url: Proc.new { |o| { controller: 'overviews/overviews', action: 'show', project_id: o } },- author: nil,- datetime: :created_atvalidates :name,presence: true,diff --git a/app/models/user.rb b/app/models/user.rbindex 91009a955d3..e27d83e1fec 100644--- a/app/models/user.rb+++ b/app/models/user.rb@@ -220,12 +220,13 @@ class User < Principaldef self.try_to_login(login, password, session = nil)# Make sure no one can sign in with an empty passwordreturn nil if password.to_s.empty?+user = find_by_login(login)user = if usertry_authentication_for_existing_user(user, password, session)elsetry_authentication_and_create_user(login, password)- end+ endunless prevent_brute_force_attack(user, login).nil?user.log_successful_login if user && !user.new_record?return userdiff --git a/app/models/work_package.rb b/app/models/work_package.rbindex 758ce110a7f..4c6c2a6037f 100644--- a/app/models/work_package.rb+++ b/app/models/work_package.rb@@ -41,6 +41,7 @@ class WorkPackage < ApplicationRecordinclude WorkPackage::Hooksinclude WorkPackages::DerivedDatesinclude WorkPackages::SpentTime+ include WorkPackages::Costsinclude ::Scopes::Scopedinclude OpenProject::Journal::AttachmentHelper@@ -549,14 +550,6 @@ class WorkPackage < ApplicationRecord.select("#{table_name}.*, COALESCE(max_depth.depth, 0)")end- def self.self_and_descendants_of_condition(work_package)- relation_subquery = Relation- .with_type_columns_not(hierarchy: nil)- .select(:to_id)- .where(from_id: work_package.id)- "#{table_name}.id IN (#{relation_subquery.to_sql}) OR #{table_name}.id = #{work_package.id}"- end-# Overrides Redmine::Acts::Customizable::ClassMethods#available_custom_fieldsdef self.available_custom_fields(work_package)WorkPackage::AvailableCustomFields.for(work_package.project, work_package.type)diff --git a/app/models/work_package/journalized.rb b/app/models/work_package/journalized.rbindex 1868d42c090..b7829e4f9f1 100644--- a/app/models/work_package/journalized.rb+++ b/app/models/work_package/journalized.rb@@ -88,6 +88,14 @@ module WorkPackage::Journalizedname: JournalizedProcs.event_name,url: JournalizedProcs.event_url+ register_journal_formatter(:cost_association) do |value, journable, field|+ association = journable.class.reflect_on_association(field.to_sym)+ if association+ record = association.class_name.constantize.find_by_id(value.to_i)+ record&.subject+ end+ end+register_on_journal_formatter(:id, 'parent_id')register_on_journal_formatter(:fraction, 'estimated_hours')register_on_journal_formatter(:fraction, 'derived_estimated_hours')@@ -96,6 +104,7 @@ module WorkPackage::Journalizedregister_on_journal_formatter(:schedule_manually, 'schedule_manually')register_on_journal_formatter(:attachment, /attachments_?\d+/)register_on_journal_formatter(:custom_field, /custom_fields_\d+/)+ register_on_journal_formatter(:cost_association, 'budget_id')# Joinedregister_on_journal_formatter :named_association, :parent_id, :project_id,diff --git a/app/models/work_packages/costs.rb b/app/models/work_packages/costs.rbnew file mode 100644index 00000000000..d3f23cecbcd--- /dev/null+++ b/app/models/work_packages/costs.rb@@ -0,0 +1,141 @@+#-- encoding: UTF-8++#-- copyright+# OpenProject is an open source project management software.+# Copyright (C) 2012-2020 the OpenProject GmbH+#+# This program is free software; you can redistribute it and/or+# modify it under the terms of the GNU General Public License version 3.+#+# OpenProject is a fork of ChiliProject, which is a fork of Redmine. The copyright follows:+# Copyright (C) 2006-2017 Jean-Philippe Lang+# Copyright (C) 2010-2013 the ChiliProject Team+#+# This program is free software; you can redistribute it and/or+# modify it under the terms of the GNU General Public License+# as published by the Free Software Foundation; either version 2+# of the License, or (at your option) any later version.+#+# This program is distributed in the hope that it will be useful,+# but WITHOUT ANY WARRANTY; without even the implied warranty of+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the+# GNU General Public License for more details.+#+# You should have received a copy of the GNU General Public License+# along with this program; if not, write to the Free Software+# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.+#+# See docs/COPYRIGHT.rdoc for more details.+#++++module WorkPackages::Costs+ extend ActiveSupport::Concern++ included do+ belongs_to :budget, inverse_of: :work_packages+ has_many :cost_entries, dependent: :delete_all++ # disabled for now, implements part of ticket blocking+ validate :validate_budget++ after_update :move_cost_entries++ associated_to_ask_before_destruction CostEntry,+ ->(work_packages) { CostEntry.on_work_packages(work_packages).count.positive? },+ method(:cleanup_cost_entries_before_destruction_of)++ def costs_enabled?+ project&.costs_enabled?+ end++ def validate_budget+ if budget_id_changed?+ unless budget_id.blank? || project.budget_ids.include?(budget_id)+ errors.add :budget, :inclusion+ end+ end+ end++ def material_costs+ if respond_to?(:cost_entries_sum) # column has been eager loaded into result set+ cost_entries_sum.to_f+ else+ ::WorkPackage::MaterialCosts.new(user: User.current).costs_of work_packages: self_and_descendants+ end+ end++ def labor_costs+ if respond_to?(:time_entries_sum) # column has been eager loaded into result set+ time_entries_sum.to_f+ else+ ::WorkPackage::LaborCosts.new(user: User.current).costs_of work_packages: self_and_descendants+ end+ end++ def overall_costs+ labor_costs + material_costs+ end++ # Wraps the association to get the Cost Object subject. Needed for the+ # Query and filtering+ def budget_subject+ budget&.subject+ end++ def move_cost_entries+ return unless saved_change_to_project_id?++ CostEntry+ .where(work_package_id: id)+ .update_all(project_id: project_id)+ end+ end++ class_methods do+ protected++ def cleanup_cost_entries_before_destruction_of(work_packages, user, to_do = { action: 'destroy' })+ work_packages = Array(work_packages)++ return false unless to_do.present?++ case to_do[:action]+ when 'destroy'+ true+ # nothing to do+ when 'nullify'+ work_packages.each do |wp|+ wp.errors.add(:base, :nullify_is_not_valid_for_cost_entries)+ end++ false+ when 'reassign'+ reassign_cost_entries_before_destruction(work_packages, user, to_do[:reassign_to_id])+ else+ false+ end+ end++ def reassign_cost_entries_before_destruction(work_packages, user, ids)+ reassign_to = ::WorkPackage+ .joins(:project)+ .merge(Project.allowed_to(user, :edit_cost_entries))+ .find_by_id(ids)++ if reassign_to.nil?+ work_packages.each do |wp|+ wp.errors.add(:base, :is_not_a_valid_target_for_cost_entries, id: ids)+ end++ false+ else+ condition = "work_package_id = #{reassign_to.id}, project_id = #{reassign_to.project_id}"+ ::WorkPackage.update_cost_entries(work_packages.map(&:id), condition)+ end+ end++ def update_cost_entries(work_packages, action)+ CostEntry.where(work_package_id: work_packages).update_all(action)+ end+ end+enddiff --git a/app/views/activities/index.html.erb b/app/views/activities/index.html.erbindex a13d74c5a6e..a2e48016f2e 100644--- a/app/views/activities/index.html.erb+++ b/app/views/activities/index.html.erb@@ -41,7 +41,7 @@ See docs/COPYRIGHT.rdoc for more details.<li class="<%= e.event_type %> <%= User.current.logged? && e.respond_to?(:event_author) && User.current == e.event_author ? 'me' : nil %>"><div class="title"><% event_type = e.event_type.start_with?('meeting') ? 'meetings' : e.event_type %>- <% event_type = e.event_type == 'cost_object' ? 'budget' : event_type %>+ <% event_type = e.event_type == 'budget' ? 'budget' : event_type %><%= icon_wrapper("icon-context icon-#{event_type}", e.event_name) %><span class="time"><%= format_time(e.event_datetime.to_time, false) %></span><% if (@project.nil? || @project != e.project) && e.project %>diff --git a/app/views/search/index.html.erb b/app/views/search/index.html.erbindex cb3f614aa1d..88a267783e1 100644--- a/app/views/search/index.html.erb+++ b/app/views/search/index.html.erb@@ -51,7 +51,7 @@ See docs/COPYRIGHT.rdoc for more details.<dt class="<%= e.event_type %>"><% event_type = e.event_type == 'meeting' ? 'meetings' : e.event_type %>- <% event_type = e.event_type == 'cost_object' ? 'budget' : event_type %>+ <% event_type = e.event_type == 'budget' ? 'budget' : event_type %><% event_type = e.event_type == 'reply' ? 'forums' : event_type %><%= icon_wrapper("icon-context icon-#{event_type}", e.event_name) %>diff --git a/app/views/settings/plugin.html.erb b/app/views/settings/plugin.html.erbindex ba18836e01c..d4983fd5068 100644--- a/app/views/settings/plugin.html.erb+++ b/app/views/settings/plugin.html.erb@@ -30,6 +30,6 @@ See docs/COPYRIGHT.rdoc for more details.<div id="settings"><%= styled_form_tag({action: 'plugin'}) do %><%= render partial: @partial, locals: {settings: @settings}%>- <%= styled_submit_tag l(:button_apply), class: '-highlight' %>+ <%= styled_submit_tag t(:button_apply), class: '-highlight' %><% end %></div>diff --git a/app/views/time_entries/reports/_report_criteria.html.erb b/app/views/time_entries/reports/_report_criteria.html.erbdeleted file mode 100644index 1dbb0d2ffa8..00000000000--- a/app/views/time_entries/reports/_report_criteria.html.erb+++ /dev/null@@ -1,48 +0,0 @@-<%#-- copyright-OpenProject is an open source project management software.-Copyright (C) 2012-2020 the OpenProject GmbH--This program is free software; you can redistribute it and/or-modify it under the terms of the GNU General Public License version 3.--OpenProject is a fork of ChiliProject, which is a fork of Redmine. The copyright follows:-Copyright (C) 2006-2017 Jean-Philippe Lang-Copyright (C) 2010-2013 the ChiliProject Team--This program is free software; you can redistribute it and/or-modify it under the terms of the GNU General Public License-as published by the Free Software Foundation; either version 2-of the License, or (at your option) any later version.--This program is distributed in the hope that it will be useful,-but WITHOUT ANY WARRANTY; without even the implied warranty of-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the-GNU General Public License for more details.--You should have received a copy of the GNU General Public License-along with this program; if not, write to the Free Software-Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.--See docs/COPYRIGHT.rdoc for more details.--++#%>--<% @hours.collect {|h| h[criterias[level]].to_s}.uniq.each do |value| %>-- <% hours_for_value = select_hours(hours, criterias[level], value) -%>- <% next if hours_for_value.empty? -%>- <tr class="<%= 'last-level' unless criterias.length > level+1 %>">- <%= ('<td></td>' * level).html_safe %>- <td><%= h(format_criteria_value(criterias[level], value)) %></td>- <%= ('<td></td>' * (criterias.length - level - 1)).html_safe -%>- <% total = 0 -%>- <% @periods.each do |period| -%>- <% sum = sum_hours(select_hours(hours_for_value, @columns, period.to_s)); total += sum -%>- <td class="hours"><%= html_hours("%.2f" % sum) if sum > 0 %></td>- <% end -%>- <td class="hours"><%= html_hours("%.2f" % total) if total > 0 %></td>- </tr>- <% if criterias.length > level+1 -%>- <%= render(partial: 'report_criteria', locals: { criterias: criterias, hours: hours_for_value, level: (level + 1) }) %>- <% end -%>- <% end %>diff --git a/app/views/time_entries/reports/_reports_tab.html.erb b/app/views/time_entries/reports/_reports_tab.html.erbdeleted file mode 100644index 8ddfba68f78..00000000000--- a/app/views/time_entries/reports/_reports_tab.html.erb+++ /dev/null@@ -1,140 +0,0 @@-<%#-- copyright-OpenProject is an open source project management software.-Copyright (C) 2012-2020 the OpenProject GmbH--This program is free software; you can redistribute it and/or-modify it under the terms of the GNU General Public License version 3.--OpenProject is a fork of ChiliProject, which is a fork of Redmine. The copyright follows:-Copyright (C) 2006-2017 Jean-Philippe Lang-Copyright (C) 2010-2013 the ChiliProject Team--This program is free software; you can redistribute it and/or-modify it under the terms of the GNU General Public License-as published by the Free Software Foundation; either version 2-of the License, or (at your option) any later version.--This program is distributed in the hope that it will be useful,-but WITHOUT ANY WARRANTY; without even the implied warranty of-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the-GNU General Public License for more details.--You should have received a copy of the GNU General Public License-along with this program; if not, write to the Free Software-Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.--See docs/COPYRIGHT.rdoc for more details.--++#%>--<%= styled_form_tag(polymorphic_time_entries_report_path(@issue || @project), method: :get, id: 'query_form', class: '-vertical') do %>- <% @criterias.each do |criteria| %>- <%= hidden_field_tag 'criterias[]', criteria, id: nil %>- <% end %>-- <div class="timelog-report-selection small-6">- <div class="grid-block">-- <div class="form--field">- <%= styled_label_tag :columns, "#{t(:label_details)}:" %>- <%= styled_select_tag 'columns', options_for_select([[l(:label_year), 'year'],- [l(:label_month), 'month'],- [l(:label_week), 'week'],- [l(:label_day_plural).titleize, 'day']], @columns),- container_class: '-slim' %>- </div>-- <div class="form--field">- <%= styled_label_tag :criterias, "#{t(:button_add)}:" %>- <% available_criterias = [[]] + (@available_criterias.keys - @criterias).collect{ |k|- [l_or_humanize(@available_criterias[k][:label]), k]- }- %>- <%= styled_select_tag('criterias[]', options_for_select(available_criterias),- id: "criterias",- disabled: (@criterias.length >= 3),- container_class: '-slim') %>- </div>- </div>- <div class="grid-block">- <%= submit_tag t(:button_apply), class: 'button -highlight' %>- <%= link_to t(:button_clear), {project_id: @project, issue_id: @issue, period_type: params[:period_type], period: params[:period], from: @from, to: @to, columns: @columns}, class: 'button' %>- </div>- </div>-<% end %>-<% unless @criterias.empty? %>- <div class="total-hours">- <p><%= t(:label_total) %>: <%= html_hours(l_hours(@total_hours)) %></p>- </div>-- <% unless @hours.empty? %>- <div class="generic-table--container">- <div class="generic-table--results-container">- <table class="generic-table" id="time-report">- <colgroup>- <% @criterias.each do |criteria| %>- <col highlight-col>- <% end %>- <% @periods.each do |period| %>- <col highlight-col>- <% end %>- <col highlight-col>- </colgroup>- <thead>- <tr>- <% @criterias.each do |criteria| %>- <th>- <div class="generic-table--sort-header-outer">- <div class="generic-table--sort-header">- <span>- <%= l_or_humanize(@available_criterias[criteria][:label]) %>- </span>- </div>- </div>- </th>- <% end %>- <% @periods.each do |period| %>- <th class="period">- <div class="generic-table--sort-header-outer">- <div class="generic-table--sort-header">- <span>- <%= period %>- </span>- </div>- </div>- </th>- <% end %>- <th class="total">- <div class="generic-table--sort-header-outer">- <div class="generic-table--sort-header">- <span>- <%= t(:label_total) %>- </span>- </div>- </div>- </th>- </tr>- </thead>- <tbody>- <%= render partial: 'report_criteria', locals: {criterias: @criterias, hours: @hours, level: 0} %>- <tr class="total">- <td><%= t(:label_total) %></td>- <%= ('<td></td>' * (@criterias.size - 1)).html_safe %>- <% total = 0 -%>- <% @periods.each do |period| -%>- <% sum = sum_hours(select_hours(@hours, @columns, period.to_s)); total += sum -%>- <td class="hours"><%= html_hours("%.2f" % sum) if sum > 0 %></td>- <% end -%>- <td class="hours"><%= html_hours("%.2f" % total) if total > 0 %></td>- </tr>- </tbody>- </table>-- </div>- </div>-- <%= other_formats_links do |f| %>- <%= f.link_to 'CSV', url: permitted_params.timelog.to_h %>- <% end %>- <% end %>-<% end %>diff --git a/app/views/time_entries/reports/show.html.erb b/app/views/time_entries/reports/show.html.erbdeleted file mode 100644index 26a0410b78b..00000000000--- a/app/views/time_entries/reports/show.html.erb+++ /dev/null@@ -1,45 +0,0 @@-<%#-- copyright-OpenProject is an open source project management software.-Copyright (C) 2012-2020 the OpenProject GmbH--This program is free software; you can redistribute it and/or-modify it under the terms of the GNU General Public License version 3.--OpenProject is a fork of ChiliProject, which is a fork of Redmine. The copyright follows:-Copyright (C) 2006-2017 Jean-Philippe Lang-Copyright (C) 2010-2013 the ChiliProject Team--This program is free software; you can redistribute it and/or-modify it under the terms of the GNU General Public License-as published by the Free Software Foundation; either version 2-of the License, or (at your option) any later version.--This program is distributed in the hope that it will be useful,-but WITHOUT ANY WARRANTY; without even the implied warranty of-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the-GNU General Public License for more details.--You should have received a copy of the GNU General Public License-along with this program; if not, write to the Free Software-Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.--See docs/COPYRIGHT.rdoc for more details.--++#%>--<%= toolbar title: t(:label_spent_time) do %>- <% if User.current.allowed_to?({controller: 'timelog', action: :new}, @project) %>- <li class="toolbar-item">- <%= link_to polymorphic_new_time_entry_path(@issue || @project), class: 'button' do %>- <%= op_icon('button--icon icon-time') %>- <span class="button--text"><%= t(:button_log_time) %></span>- <% end %>- </li>- <% end %>-<% end %>--<%= render partial: 'timelog/date_range' %>--<%= render_tabs time_entry_tabs %>--<% html_title t(:label_spent_time), t(:label_report) %>diff --git a/app/views/timelog/_date_range.html.erb b/app/views/timelog/_date_range.html.erbdeleted file mode 100644index 9197b200e0f..00000000000--- a/app/views/timelog/_date_range.html.erb+++ /dev/null@@ -1,65 +0,0 @@-<%#-- copyright-OpenProject is an open source project management software.-Copyright (C) 2012-2020 the OpenProject GmbH--This program is free software; you can redistribute it and/or-modify it under the terms of the GNU General Public License version 3.--OpenProject is a fork of ChiliProject, which is a fork of Redmine. The copyright follows:-Copyright (C) 2006-2017 Jean-Philippe Lang-Copyright (C) 2010-2013 the ChiliProject Team--This program is free software; you can redistribute it and/or-modify it under the terms of the GNU General Public License-as published by the Free Software Foundation; either version 2-of the License, or (at your option) any later version.--This program is distributed in the hope that it will be useful,-but WITHOUT ANY WARRANTY; without even the implied warranty of-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the-GNU General Public License for more details.--You should have received a copy of the GNU General Public License-along with this program; if not, write to the Free Software-Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.--See docs/COPYRIGHT.rdoc for more details.--++#%>--<% content_for :header_tags do %>- <meta name="required_script" content="timelog_date_range" />-<% end %>--<fieldset id="date-range" class="simple-filters--container">- <legend><%= l(:label_date_range) %></legend>- <ul class="simple-filters--filters">- <li class="simple-filters--filter -with-radio-buttons">- <%= styled_label_tag "period_type_list", l(:description_date_range_list), class: "hidden-for-sighted simple-filters--filter-name" %>- <%= styled_radio_button_tag 'period_type', '1',- !@free_period,- id: "period_type_list"%>- <div class="simple-filters--filter-value">- <%= styled_select_tag 'period',- options_for_period_select(params[:period]),- class: "-narrow" %>- </div>- </li>- <li class="simple-filters--filter -with-radio-buttons">- <%= styled_label_tag "period_type_interval", l(:description_date_range_interval), class: "hidden-for-sighted simple-filters--filter-name" %>- <%= styled_radio_button_tag 'period_type', '2', @free_period, id: "period_type_interval" %>- <%= styled_label_tag("from", l(:label_date_from), class: 'simple-filters--filter-name') %>- <div class="simple-filters--filter-value">- <%= styled_text_field_tag('from', @from, class: '-augmented-datepicker', size: 10) %>- </div>- <%= styled_label_tag("to", l(:label_date_to), class: 'simple-filters--filter-name') %>- <div class="simple-filters--filter-value">- <%= styled_text_field_tag('to', @to, class: '-augmented-datepicker', size: 10) %>- </div>- </li>- <li class="simple-filters--controls">- <%= styled_button_tag l(:button_apply), class: 'button -highlight -small' %>- <%= link_to l(:button_clear), polymorphic_time_entries_path(@issue || @project), class: 'button -small' %>- </li>- </ul>-</fieldset>diff --git a/app/views/timelog/_time_entry_tab.html.erb b/app/views/timelog/_time_entry_tab.html.erbdeleted file mode 100644index 61afead2d35..00000000000--- a/app/views/timelog/_time_entry_tab.html.erb+++ /dev/null@@ -1,40 +0,0 @@-<%#-- copyright-OpenProject is an open source project management software.-Copyright (C) 2012-2020 the OpenProject GmbH--This program is free software; you can redistribute it and/or-modify it under the terms of the GNU General Public License version 3.--OpenProject is a fork of ChiliProject, which is a fork of Redmine. The copyright follows:-Copyright (C) 2006-2017 Jean-Philippe Lang-Copyright (C) 2010-2013 the ChiliProject Team--This program is free software; you can redistribute it and/or-modify it under the terms of the GNU General Public License-as published by the Free Software Foundation; either version 2-of the License, or (at your option) any later version.--This program is distributed in the hope that it will be useful,-but WITHOUT ANY WARRANTY; without even the implied warranty of-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the-GNU General Public License for more details.--You should have received a copy of the GNU General Public License-along with this program; if not, write to the Free Software-Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.--See docs/COPYRIGHT.rdoc for more details.--++#%>--<div class="notification-box -warning">- <a title="close" class="notification-box--close icon-context icon-close"></a>- <div class="notification-box--content">- <%= t('deprecations.time_entries') %>- </div>-</div>-<div>- <%= other_formats_links do |f| %>- <%= f.link_to 'CSV', url: permitted_params.timelog.to_h %>- <% end %>-</div>diff --git a/app/views/timelog/edit.html.erb b/app/views/timelog/edit.html.erbdeleted file mode 100644index 8e454a48284..00000000000--- a/app/views/timelog/edit.html.erb+++ /dev/null@@ -1,67 +0,0 @@-<%#-- copyright-OpenProject is an open source project management software.-Copyright (C) 2012-2020 the OpenProject GmbH--This program is free software; you can redistribute it and/or-modify it under the terms of the GNU General Public License version 3.--OpenProject is a fork of ChiliProject, which is a fork of Redmine. The copyright follows:-Copyright (C) 2006-2017 Jean-Philippe Lang-Copyright (C) 2010-2013 the ChiliProject Team--This program is free software; you can redistribute it and/or-modify it under the terms of the GNU General Public License-as published by the Free Software Foundation; either version 2-of the License, or (at your option) any later version.--This program is distributed in the hope that it will be useful,-but WITHOUT ANY WARRANTY; without even the implied warranty of-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the-GNU General Public License for more details.--You should have received a copy of the GNU General Public License-along with this program; if not, write to the Free Software-Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.--See docs/COPYRIGHT.rdoc for more details.--++#%>--<%= toolbar title: t(:label_spent_time) %>-<%= labelled_tabular_form_for [@time_entry.project, @time_entry], as: :time_entry do |f| %>- <%= error_messages_for_contract @time_entry, @errors %>- <%= back_url_hidden_field_tag %>-- <div class="form--field">- <%= f.text_field :work_package_id, size: 6, container_class: '-xslim' %>- <div class="form--field-instructions">- <%= h("#{(@time_entry.work_package.type.nil?) ? '' : @time_entry.work_package.type.name} ##{@time_entry.work_package.id}: #{@time_entry.work_package.subject}") if @time_entry.work_package%>- </div>- </div>-- <div class="form--field -required">- <%= f.text_field :spent_on, size: 10, required: true, container_class: '-xslim', class: '-augmented-datepicker' %>- </div>-- <div class="form--field -required">- <%= f.text_field :hours, size: 6, required: true, container_class: '-xslim', class: '-number' %>- </div>-- <div class="form--field">- <%= f.text_field :comments, size: 100, container_class: '-wide' %>- </div>-- <div class="form--field -required">- <%= f.select :activity_id,- activity_collection_for_select_options(@time_entry),- prompt: "--- #{t(:actionview_instancetag_blank_option)} ---",- required: true,- container_class: '-slim' %>- </div>-- <%= render partial: "customizable/form",- locals: { form: f, all_fields: true, only_required: false } %>-- <%= call_hook(:view_timelog_edit_form_bottom, { time_entry: @time_entry, form: f }) %>- <%= f.button t(:button_save), class: 'button -highlight -with-icon icon-checkmark' %>-<% end %>diff --git a/app/views/timelog/index.html.erb b/app/views/timelog/index.html.erbdeleted file mode 100644index a054f3e5648..00000000000--- a/app/views/timelog/index.html.erb+++ /dev/null@@ -1,47 +0,0 @@-<%#-- copyright-OpenProject is an open source project management software.-Copyright (C) 2012-2020 the OpenProject GmbH--This program is free software; you can redistribute it and/or-modify it under the terms of the GNU General Public License version 3.--OpenProject is a fork of ChiliProject, which is a fork of Redmine. The copyright follows:-Copyright (C) 2006-2017 Jean-Philippe Lang-Copyright (C) 2010-2013 the ChiliProject Team--This program is free software; you can redistribute it and/or-modify it under the terms of the GNU General Public License-as published by the Free Software Foundation; either version 2-of the License, or (at your option) any later version.--This program is distributed in the hope that it will be useful,-but WITHOUT ANY WARRANTY; without even the implied warranty of-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the-GNU General Public License for more details.--You should have received a copy of the GNU General Public License-along with this program; if not, write to the Free Software-Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.--See docs/COPYRIGHT.rdoc for more details.--++#%>--<%= toolbar title: l(:label_spent_time) do %>- <% if User.current.allowed_to?({controller: :timelog, action: :new}, @project) %>- <li class="toolbar-item">- <%= link_to polymorphic_new_time_entry_path(@issue || @project), class: 'button' do %>- <%= op_icon('button--icon icon-time') %>- <span class="button--text"><%= l(:button_log_time) %></span>- <% end %>- </li>- <% end %>-<% end %>--<%= form_tag(polymorphic_path([@issue || @project, :time_entries]), method: :get, id: 'query_form') do %>- <%= render partial: 'date_range' %>-<% end %>--<%= render_tabs time_entry_tabs %>--<% html_title l(:label_spent_time) %>diff --git a/app/views/users/show.html.erb b/app/views/users/show.html.erbindex cf0f6f5ce09..75623c70e99 100644--- a/app/views/users/show.html.erb+++ b/app/views/users/show.html.erb@@ -88,7 +88,7 @@ See docs/COPYRIGHT.rdoc for more details.<li class="<%= e.event_type %>"><div class="title"><% event_type = e.event_type == 'meeting' ? 'meetings' : e.event_type %>- <% event_type = e.event_type == 'cost_object' ? 'budget' : event_type %>+ <% event_type = e.event_type == 'budget' ? 'budget' : event_type %><%= icon_wrapper("icon-context icon-#{event_type}", e.event_name) %><span class="time"><%= format_time(e.event_datetime, false) %></span><%= content_tag('span', h(e.project), class: 'project') %>diff --git a/app/views/work_packages/bulk/edit.html.erb b/app/views/work_packages/bulk/edit.html.erbindex 0ddb5abf9e6..71c216444e7 100644--- a/app/views/work_packages/bulk/edit.html.erb+++ b/app/views/work_packages/bulk/edit.html.erb@@ -132,6 +132,18 @@ See docs/COPYRIGHT.rdoc for more details.</div></div><% end %>+ <% if @project %>+ <div class="form--field">+ <label class="form--label" for='budget_id'><%= Budget.model_name.human %></label>+ <div class="form--field-container">+ <%= styled_select_tag('budget_id',+ content_tag('option', t(:label_no_change_option), :value => '') ++ content_tag('option', t(:label_none), :value => 'none') ++ options_from_collection_for_select(@project.budgets.order(Arel.sql('subject ASC')), :id, :subject))+ %>+ </div>+ </div>+ <% end %><% @custom_fields.each do |custom_field| %><div class="form--field"><%= blank_custom_field_label_tag('work_package', custom_field) %>diff --git a/app/views/work_packages/moves/new.html.erb b/app/views/work_packages/moves/new.html.erbindex f4dc97c2b13..7db30398683 100644--- a/app/views/work_packages/moves/new.html.erb+++ b/app/views/work_packages/moves/new.html.erb@@ -113,6 +113,12 @@ See docs/COPYRIGHT.rdoc for more details.options_from_collection_for_select(@target_project.possible_responsibles, :id, :name)) %></div></div>+ <div class="form--field">+ <%= styled_label_tag :budget_id, Budget.model_name.human %>+ <%= styled_select_tag('budget_id', (@target_project == @project ? content_tag('option', t(:label_no_change_option), :value => '') : "") ++ content_tag('option', t(:label_none), :value => 'none') ++ options_from_collection_for_select(@target_project.budgets, :id, :subject)) %>+ </div></div><div class="grid-content medium-6"><div class="form--field">diff --git a/config/initializers/activity.rb b/config/initializers/activity.rbindex d3fd6e2e921..da2b86224ef 100644--- a/config/initializers/activity.rb+++ b/config/initializers/activity.rb@@ -37,8 +37,6 @@ OpenProject::Activity.map do |activity|default: falseactivity.register :messages, class_name: 'Activities::MessageActivityProvider',default: false- activity.register :time_entries, class_name: 'Activities::TimeEntryActivityProvider',- default: falseendProject.register_latest_project_activity on: 'WorkPackage',@@ -58,6 +56,3 @@ Project.register_latest_project_activity on: 'WikiContent',Project.register_latest_project_activity on: 'Message',chain: 'Forum',attribute: :updated_on--Project.register_latest_project_activity on: 'TimeEntry',- attribute: :updated_ondiff --git a/config/initializers/menus.rb b/config/initializers/menus.rbindex f216212ef3d..58d7876b1be 100644--- a/config/initializers/menus.rb+++ b/config/initializers/menus.rb@@ -55,14 +55,6 @@ Redmine::MenuManager.map :top_menu do |menu|(User.current.logged? || !Setting.login_required?) &&User.current.allowed_to?(:view_news, nil, global: true)}- menu.push :time_sheet,- { controller: '/timelog', project_id: nil, action: 'index' },- context: :modules,- caption: I18n.t('label_time_sheet_menu'),- if: Proc.new {- (User.current.logged? || !Setting.login_required?) &&- User.current.allowed_to?(:view_time_entries, nil, global: true)- }menu.push :help,OpenProject::Static::Links.help_link,last: true,@@ -284,38 +276,38 @@ Redmine::MenuManager.map :admin_menu do |menu|menu.push :custom_style,{ controller: '/custom_styles', action: 'show' },- caption: :label_custom_style,+ caption: :label_custom_style,icon: 'icon2 icon-design'menu.push :colors,{ controller: '/colors', action: 'index' },- caption: :'timelines.admin_menu.colors',+ caption: :'timelines.admin_menu.colors',icon: 'icon2 icon-status'menu.push :enterprise,{ controller: '/enterprises', action: 'show' },- caption: :label_enterprise_edition,+ caption: :label_enterprise_edition,icon: 'icon2 icon-headset',if: proc { OpenProject::Configuration.ee_manager_visible? }menu.push :admin_costs,- { controller: '/settings', action: 'plugin', id: :openproject_costs },- caption: :label_cost_object_plural,+ { controller: '/settings', action: 'plugin', id: :costs },+ caption: :project_module_costs,icon: 'icon2 icon-budget'menu.push :costs_setting,- { controller: '/settings', action: 'plugin', id: :openproject_costs },- caption: :label_settings,+ { controller: '/settings', action: 'plugin', id: :costs },+ caption: :label_settings,parent: :admin_costsmenu.push :admin_backlogs,{ controller: '/settings', action: 'plugin', id: :openproject_backlogs },- caption: :label_backlogs,+ caption: :label_backlogs,icon: 'icon2 icon-backlogs'menu.push :backlogs_settings,{ controller: '/settings', action: 'plugin', id: :openproject_backlogs },- caption: :label_settings,+ caption: :label_settings,parent: :admin_backlogsend@@ -376,13 +368,6 @@ Redmine::MenuManager.map :project_menu do |menu|# Wiki menu items are added by WikiMenuItemHelper- menu.push :time_entries,- { controller: '/timelog', action: 'index' },- param: :project_id,- if: -> (project) { User.current.allowed_to?(:view_time_entries, project) },- caption: :label_time_sheet_menu,- icon: 'icon2 icon-cost-reports'-menu.push :members,{ controller: '/members', action: 'index' },param: :project_id,diff --git a/config/initializers/permissions.rb b/config/initializers/permissions.rbindex 0e68d8bcb99..2ff3667c67c 100644--- a/config/initializers/permissions.rb+++ b/config/initializers/permissions.rb@@ -182,31 +182,6 @@ OpenProject::AccessControl.map do |map|{}end- map.project_module :time_tracking do |time|- time.permission :view_time_entries,- timelog: %i[index show],- time_entry_reports: [:report]-- time.permission :log_time,- { timelog: %i[new create edit update] },- require: :loggedin-- time.permission :edit_time_entries,- { timelog: %i[new create edit update destroy] },- require: :member-- time.permission :view_own_time_entries,- timelog: %i[index report]-- time.permission :edit_own_time_entries,- { timelog: %i[new create edit update destroy] },- require: :loggedin-- time.permission :manage_project_activities,- { 'projects/time_entry_activities': %i[update] },- require: :member- end-map.project_module :news do |news|news.permission :view_news,{ news: %i[index show] },diff --git a/config/locales/en.yml b/config/locales/en.ymlindex 28b8eac3920..3e269fd4ae3 100644--- a/config/locales/en.yml+++ b/config/locales/en.yml@@ -201,9 +201,6 @@ en:concatenation:single: 'or'- deprecations:- time_entries: "This time entries view is superseded by the 'Cost reports' module. This view now only supports exporting time entry information to csv. For interactive filtering, please activate the 'Cost reports' module in the project settings."-global_search:overwritten_tabs:wiki_pages: "Wiki"@@ -873,7 +870,6 @@ en:button_generate: "Generate"button_list: "List"button_lock: "Lock"- button_log_time: "Log time"button_login: "Sign in"button_move: "Move"button_move_and_follow: "Move and follow"@@ -1061,8 +1057,6 @@ en:description_compare_to: "Compare to"description_current_position: "You are here: "description_date_from: "Enter start date"- description_date_range_interval: "Choose range by selecting start and end date"- description_date_range_list: "Choose range from list"description_date_to: "Enter end date"description_enter_number: "Enter number"description_enter_text: "Enter text"@@ -1363,7 +1357,6 @@ en:label_date_and_time: "Date and time"label_date_from: "From"label_date_from_to: "From %{start} to %{end}"- label_date_range: "Date range"label_date_to: "To"label_day_plural: "days"label_default: "Default"@@ -1510,7 +1503,6 @@ en:label_modified: "modified"label_module_plural: "Modules"label_modules: "Modules"- label_month: "Month"label_months_from: "months from"label_more: "More"label_more_than_ago: "more than days ago"@@ -1681,8 +1673,6 @@ en:label_this_week: "this week"label_this_year: "this year"label_time_entry_plural: "Spent time"- label_time_sheet_menu: "Time sheet"- label_time_tracking: "Time tracking"label_projects_menu: "Projects"label_today: "today"label_top_menu: "Top Menu"@@ -1782,7 +1772,6 @@ en:one: "1 project"other: "%{count} projects"zero: "no projects"- label_year: "Year"label_yesterday: "yesterday"auth_source:@@ -1908,7 +1897,6 @@ en:notice_successful_delete: "Successful deletion."notice_successful_update: "Successful update."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_user_missing_authentication_method: User has yet to choose a password or another way to sign in.notice_user_invitation_resent: An invitation has been sent to %{email}.present_access_key_value: "Your %{key_name} is: %{value}"@@ -2045,8 +2033,6 @@ en:project_module_work_package_tracking: "Work package tracking"project_module_news: "News"project_module_repository: "Repository"- project_module_time_tracking: "Time tracking"- project_module_timelines: "Timelines"project_module_wiki: "Wiki"query:diff --git a/config/routes.rb b/config/routes.rbindex 1fea06c6073..8576b6be883 100644--- a/config/routes.rb+++ b/config/routes.rb@@ -208,11 +208,6 @@ OpenProject::Application.routes.draw doresources :news, only: %i[index new create]- namespace :time_entries do- resource :report, controller: 'reports', only: [:show]- end- resources :time_entries, controller: 'timelog', except: [:show]-# Match everything to be the ID of the wiki page except the part that# is reserved for the format. This assumes that we have only two formats:# .txt and .html@@ -434,12 +429,6 @@ OpenProject::Application.routes.draw do# move individual wpresource :move, controller: 'work_packages/moves', only: %i[new create]- # this duplicate mapping is required for the timelog_helper- namespace :time_entries do- resource :report, controller: 'reports'- end- resources :time_entries, controller: 'timelog'-# states managed by client-side routing on work_package#indexget 'details/*state' => 'work_packages#index', on: :collection, as: :details@@ -458,13 +447,6 @@ OpenProject::Application.routes.draw doendend- namespace :time_entries do- resource :report, controller: 'reports',- only: [:show]- end-- resources :time_entries, controller: 'timelog'-resources :activity, :activities, only: :index, controller: 'activities'resources :users dodiff --git a/config/settings.yml b/config/settings.ymlindex 80a870074e8..98c70e30378 100644--- a/config/settings.yml+++ b/config/settings.yml@@ -287,7 +287,7 @@ default_projects_modules:- board_view- work_package_tracking- news- - time_tracking+ - costs- wiki# Role given to a non-admin user who creates a projectnew_project_user_role_id:diff --git a/db/migrate/migration_utils/module_renamer.rb b/db/migrate/migration_utils/module_renamer.rbnew file mode 100644index 00000000000..bae48e1e5fe--- /dev/null+++ b/db/migrate/migration_utils/module_renamer.rb@@ -0,0 +1,90 @@+#-- encoding: UTF-8++#-- copyright+# OpenProject is an open source project management software.+# Copyright (C) 2012-2020 the OpenProject GmbH+#+# This program is free software; you can redistribute it and/or+# modify it under the terms of the GNU General Public License version 3.+#+# OpenProject is a fork of ChiliProject, which is a fork of Redmine. The copyright follows:+# Copyright (C) 2006-2017 Jean-Philippe Lang+# Copyright (C) 2010-2013 the ChiliProject Team+#+# This program is free software; you can redistribute it and/or+# modify it under the terms of the GNU General Public License+# as published by the Free Software Foundation; either version 2+# of the License, or (at your option) any later version.+#+# This program is distributed in the hope that it will be useful,+# but WITHOUT ANY WARRANTY; without even the implied warranty of+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the+# GNU General Public License for more details.+#+# You should have received a copy of the GNU General Public License+# along with this program; if not, write to the Free Software+# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.+#+# See docs/COPYRIGHT.rdoc for more details.+#++++module Migration+ module MigrationUtils+ class ModuleRenamer+ class << self+ def add_to_enabled(new_module, old_modules)+ execute <<~SQL+ INSERT INTO+ enabled_modules (+ project_id,+ name+ )+ SELECT+ DISTINCT(project_id),+ '#{new_module}'+ FROM+ enabled_modules+ WHERE+ name IN (#{comma_separated_strings(old_modules)})+ SQL+ end++ def remove_from_enabled(modules)+ execute <<~SQL+ DELETE FROM+ enabled_modules+ WHERE+ name IN (#{comma_separated_strings(modules)})+ SQL+ end++ def add_to_default(new_modules, old_modules)+ # avoid creating the settings implicitly on new installations+ setting = Setting.find_by(name: 'default_projects_modules')++ return unless setting++ cleaned_setting = setting.value - Array(old_modules)++ if setting.value != cleaned_setting+ Setting.default_projects_modules = cleaned_setting + Array(new_modules)+ end+ end++ def remove_from_default(name)+ add_to_default([], name)+ end++ private++ def execute(string)+ ActiveRecord::Base.connection.execute string+ end++ def comma_separated_strings(array)+ Array(array).map { |i| "'#{i}'" }.join(', ')+ end+ end+ end+ end+enddiff --git a/db/migrate/migration_utils/setting_renamer.rb b/db/migrate/migration_utils/setting_renamer.rbindex cdd7b5a7807..f9991092015 100644--- a/db/migrate/migration_utils/setting_renamer.rb+++ b/db/migrate/migration_utils/setting_renamer.rb@@ -27,16 +27,16 @@# See docs/COPYRIGHT.rdoc for more details.#++-module Migration+module Migration::MigrationUtilsclass SettingRenamer# define all the following methods as class methodsclass << selfdef rename(source_name, target_name)ActiveRecord::Base.connection.execute <<-SQL- UPDATE #{settings_table}- SET name = #{quote_value(target_name)}- WHERE name = #{quote_value(source_name)}- SQL+ UPDATE #{settings_table}+ SET name = #{quote_value(target_name)}+ WHERE name = #{quote_value(source_name)}+ SQLendprivatediff --git a/docs/api/apiv3/endpoints/budgets.apib b/docs/api/apiv3/endpoints/budgets.apibnew file mode 100644index 00000000000..3e459d25521--- /dev/null+++ b/docs/api/apiv3/endpoints/budgets.apib@@ -0,0 +1,147 @@+# Group Budgets++*Note: Budgets are currently only implemented as a stub. Further properties of budgets might be added at a future date, however they will require the view budget permission to be displayed.*++## Linked Properties:+| Link | Description | Type | Constraints | Supported operations |+|:---------:|-------------------------------------------- | ------------- | --------------------- | -------------------- |+| self | This budget | Budget | not null | READ |++## Properties+| Property | Description | Type | Constraints | Supported operations | Condition |+| :---------: | ------------------------------------------- | ----------- | ----------- | -------------------- | --------------------------- |+| id | Budget id | Integer | x > 0 | READ | |+| subject | Budget name | String | not empty | READ | |++## Budget [/api/v3/budgets/{id}]+++ Model+ + Body++ {+ "_type" : "Budget",+ "_links" : {+ "self" : {+ "href" : "/api/v3/budgets/1",+ "title" : "Q3 2015"+ }+ },+ "id" : 1,+ "subject" : "Q3 2015"+ }+++## view Budget [GET]+++ Parameters+ + id (required, integer, `1`) ... Budget id+++ Response 200 (application/hal+json)++ [Budget][]+++ Response 403 (application/hal+json)++ Returned if the client does not have sufficient permissions.++ **Required permission:** view work packages **or** view budgets (on the budgets project)++ + Body++ {+ "_type": "Error",+ "errorIdentifier": "urn:openproject-org:api:v3:errors:MissingPermission",+ "message": "You are not allowed to see this budget."+ }++## Budgets by Project [/api/v3/projects/{id}/budgets]+++ Model+ + Body++ {+ "_links" : {+ "self" : {+ "href" : "/api/v3/projects/1/budgets"+ }+ },+ "_type" : "Collection",+ "total" : 2,+ "count" : 2,+ "_embedded" : {+ "elements" : [+ {+ "_type" : "Budget",+ "_links" : {+ "self" : {+ "href" : "/api/v3/budgets/1",+ "title" : "Q3 2015"+ }+ },+ "id" : 1,+ "subject" : "Q3 2015"+ },+ {+ "_type" : "Budget",+ "_links" : {+ "self" : {+ "href" : "/api/v3/budgets/2",+ "title" : "Q4 2015"+ }+ },+ "id" : 2,+ "subject" : "Q4 2015"+ }+ ]+ }+ }+++## view Budgets of a Project [GET]+++ Parameters+ + id (required, integer, `1`) ... Project id+++ Response 200 (application/hal+json)++ [Budgets by Project][]+++ Response 403 (application/hal+json)++ Returned if the client does not have sufficient permissions to see the budgets of the given+ project.++ **Required permission:** view work packages **or** view budgets++ *Note that you will only receive this error, if you are at least allowed to see the corresponding project.*++ + Body++ {+ "_type": "Error",+ "errorIdentifier": "urn:openproject-org:api:v3:errors:MissingPermission",+ "message": "You are not allowed to see the budgets of this project."+ }+++ Response 404 (application/hal+json)++ Returned if either:++ * the project does not exist+ * the client does not have sufficient permissions to see the project+ * the costs module is not enabled on the given project++ **Required permission:** view project++ *Note: A client without sufficient permissions shall not be able to test for the existence of a project.+ That's why a 404 is returned here, even if a 403 might be more appropriate.*++ + Body++ {+ "_type": "Error",+ "errorIdentifier": "urn:openproject-org:api:v3:errors:NotFound",+ "message": "The specified project does not exist."+ }++diff --git a/docs/api/apiv3/endpoints/time_entries.apib b/docs/api/apiv3/endpoints/time_entries.apibindex bd75c79f80a..9a6b2b98066 100644--- a/docs/api/apiv3/endpoints/time_entries.apib+++ b/docs/api/apiv3/endpoints/time_entries.apib@@ -339,6 +339,8 @@ Lists time entries. The time entries returned depend on the filters provided andCreates a new time entry applying the attributes provided in the body. Please note that while there is a fixed set of attributes, custom fields can extend a time entries' attributes and are accepted by the endpoint.++ Parameters++ Request Create time entry+ Body@@ -425,6 +427,8 @@ Creates a new time entry applying the attributes provided in the body. Please noUpdates the given time entry by applying the attributes provided in the body. Please note that while there is a fixed set of attributes, custom fields can extend a time entries' attributes and are accepted by the endpoint.++ Parameters++ Request Update time entry+ Bodydiff --git a/docs/api/apiv3/endpoints/work-packages.apib b/docs/api/apiv3/endpoints/work-packages.apibindex 6f29a5ddbf2..20e4f3c1fef 100644--- a/docs/api/apiv3/endpoints/work-packages.apib+++ b/docs/api/apiv3/endpoints/work-packages.apib@@ -27,6 +27,7 @@| author | The person that created the work package | User | not null | READ | || assignee | The person that is intended to work on the work package | User | | READ / WRITE | || availableWatchers | All users that can be added to the work package as watchers. | User | | READ | **Permission** add work package watchers |+| budget | The budget this work package is associated to | Budget | | READ / WRITE | **Permission** view cost objects || category | The category of the work package | Category | | READ / WRITE | || children | Array of all visible children of the work package | Collection | not null | READ | **Permission** view work packages || parent | Parent work package | WorkPackage | Needs to be visible (to the current user) | READ / WRITE | |diff --git a/docs/api/apiv3/index.apib b/docs/api/apiv3/index.apibindex 4a22320086d..41b7a633f70 100644--- a/docs/api/apiv3/index.apib+++ b/docs/api/apiv3/index.apib@@ -5,6 +5,7 @@<!-- include(endpoints/activities.apib) --><!-- include(endpoints/attachments.apib) -->+<!-- include(endpoints/budgets.apib) --><!-- include(endpoints/categories.apib) --><!-- include(endpoints/configuration.apib) --><!-- include(endpoints/custom-actions.apib) -->diff --git a/frontend/src/app/modules/a11y/keyboard-shortcut-service.ts b/frontend/src/app/modules/a11y/keyboard-shortcut-service.tsindex 62eb0789d7e..ced0b24dc30 100644--- a/frontend/src/app/modules/a11y/keyboard-shortcut-service.ts+++ b/frontend/src/app/modules/a11y/keyboard-shortcut-service.ts@@ -62,7 +62,6 @@ export class KeyboardShortcutService {'g a': this.projectScoped('projectActivityPath'),'g c': this.projectScoped('projectCalendarPath'),'g n': this.projectScoped('projectNewsPath'),- 'g t': this.projectScoped('projectTimelinesPath'),'n w p': this.projectScoped('projectWorkPackageNewPath'),'g e': this.accessKey('edit'),diff --git a/frontend/src/app/modules/augmenting/dynamic-scripts/timelog_date_range.js b/frontend/src/app/modules/augmenting/dynamic-scripts/timelog_date_range.jsdeleted file mode 100644index 2b72ab499e8..00000000000--- a/frontend/src/app/modules/augmenting/dynamic-scripts/timelog_date_range.js+++ /dev/null@@ -1,72 +0,0 @@-//-- copyright-// OpenProject is an open source project management software.-// Copyright (C) 2012-2020 the OpenProject GmbH-//-// This program is free software; you can redistribute it and/or-// modify it under the terms of the GNU General Public License version 3.-//-// OpenProject is a fork of ChiliProject, which is a fork of Redmine. The copyright follows:-// Copyright (C) 2006-2017 Jean-Philippe Lang-// Copyright (C) 2010-2013 the ChiliProject Team-//-// This program is free software; you can redistribute it and/or-// modify it under the terms of the GNU General Public License-// as published by the Free Software Foundation; either version 2-// of the License, or (at your option) any later version.-//-// This program is distributed in the hope that it will be useful,-// but WITHOUT ANY WARRANTY; without even the implied warranty of-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the-// GNU General Public License for more details.-//-// You should have received a copy of the GNU General Public License-// along with this program; if not, write to the Free Software-// Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.-//-// See docs/COPYRIGHT.rdoc for more details.-//++-(function($) {- $(function() {- /*- * See /app/views/timelog/_date_range.html.erb- */- if ($('#date-range').length < 1) {- return;- }- var intervalInputs = $('#to, #from'),- // select- period = $('#period'),- // radio buttons- periodOptionList = $('#period_type_list'),- periodOptionInterval = $('#period_type_interval');-- var disableInputFields = function(radioButton) {- return function () {- if (radioButton == periodOptionList) {- jQuery('#period').attr("tabindex", -1);- jQuery('#from').removeAttr("tabindex");- jQuery('#to').removeAttr("tabindex");- }- else {- jQuery('#from').attr("tabindex", -1);- jQuery('#to').attr("tabindex", -1);- jQuery('#period').removeAttr("tabindex");- }- };- };-- jQuery(document).ready(function() {- if (periodOptionInterval.is(':checked')) {- jQuery('#period').attr("tabindex", -1);- }- else {- jQuery('#from').attr("tabindex", -1);- jQuery('#to').attr("tabindex", -1);- }- });-- periodOptionList.on('change', disableInputFields(periodOptionInterval));- periodOptionInterval.on('change', disableInputFields(periodOptionList));-- });-}(jQuery));diff --git a/frontend/src/app/modules/common/path-helper/path-helper.service.ts b/frontend/src/app/modules/common/path-helper/path-helper.service.tsindex 0891da9900d..08371485be1 100644--- a/frontend/src/app/modules/common/path-helper/path-helper.service.ts+++ b/frontend/src/app/modules/common/path-helper/path-helper.service.ts@@ -175,12 +175,8 @@ export class PathHelperService {return this.projectPath(projectId) + '/news';}- public projectTimelinesPath(projectId:string) {- return this.projectPath(projectId) + '/timelines';- }-public projectTimeEntriesPath(projectIdentifier:string) {- return this.projectPath(projectIdentifier) + '/time_entries';+ return this.projectPath(projectIdentifier) + '/cost_reports';}public projectWikiPath(projectId:string) {diff --git a/frontend/src/app/modules/fields/display/field-types/wp-spent-time-display-field.module.ts b/frontend/src/app/modules/fields/display/field-types/wp-spent-time-display-field.module.tsindex a15f4bf740c..1e80cdf1dcc 100644--- a/frontend/src/app/modules/fields/display/field-types/wp-spent-time-display-field.module.ts+++ b/frontend/src/app/modules/fields/display/field-types/wp-spent-time-display-field.module.ts@@ -63,8 +63,9 @@ export class WorkPackageSpentTimeDisplayField extends DurationDisplayField {.id(this.resource.project).get().subscribe((project:ProjectResource) => {+ // Link to the cost report having the work package filter preselected. No grouping.const href = URI(this.PathHelper.projectTimeEntriesPath(project.identifier))- .search({ work_package_id: wpID })+ .search(`fields[]=WorkPackageId&operators[WorkPackageId]=%3D&values[WorkPackageId]=${wpID}&set_filter=1`).toString();link.href = href;diff --git a/frontend/src/global_styles/content/_simple_filters.lsg b/frontend/src/global_styles/content/_simple_filters.lsgindex a8fb1ce0ef4..13b0182fa3a 100644--- a/frontend/src/global_styles/content/_simple_filters.lsg+++ b/frontend/src/global_styles/content/_simple_filters.lsg@@ -83,7 +83,7 @@ By default, simple filters can have multiple fields per row (as many as the give</li><li class="simple-filters--filter -with-radio-buttons"><span class="form--radio-button-container">- <input type="radio" name="period_type" id="period_type_list" value="1" class="form--radio-button" checked="checked">+ <input type="radio" name="period_type" value="1" class="form--radio-button" checked="checked"></span><div class="simple-filters--filter-value"><span class="form--select-container">diff --git a/frontend/src/global_styles/content/modules/_costs.sass b/frontend/src/global_styles/content/modules/_costs.sassindex 2046851034d..f29563af355 100644--- a/frontend/src/global_styles/content/modules/_costs.sass+++ b/frontend/src/global_styles/content/modules/_costs.sass@@ -26,7 +26,7 @@ table.list.members.form--text-field.-tinymin-width: 60px-.cost_object.details .attributes-key-value--value p+.budget.details .attributes-key-value--value pmargin-bottom: 0.progress-bar .inner-progress.donediff --git a/lib/api/v3/root.rb b/lib/api/v3/root.rbindex 911303bf7e4..f8dbdf83df4 100644--- a/lib/api/v3/root.rb+++ b/lib/api/v3/root.rb@@ -62,7 +62,6 @@ module APImount ::API::V3::Roles::RolesAPImount ::API::V3::Statuses::StatusesAPImount ::API::V3::StringObjects::StringObjectsAPI- mount ::API::V3::TimeEntries::TimeEntriesAPImount ::API::V3::Types::TypesAPImount ::API::V3::Users::UsersAPImount ::API::V3::UserPreferences::UserPreferencesAPIdiff --git a/lib/api/v3/work_packages/schema/specific_work_package_schema.rb b/lib/api/v3/work_packages/schema/specific_work_package_schema.rbindex 4b6eadb25ff..26a19268ef3 100644--- a/lib/api/v3/work_packages/schema/specific_work_package_schema.rb+++ b/lib/api/v3/work_packages/schema/specific_work_package_schema.rb@@ -53,6 +53,7 @@ module API:assignable_categories,:assignable_priorities,:assignable_versions,+ :assignable_budgets,to: :contractdef no_caching?diff --git a/lib/api/v3/work_packages/schema/work_package_schema_representer.rb b/lib/api/v3/work_packages/schema/work_package_schema_representer.rbindex f2f8f506e24..d4c37101f7a 100644--- a/lib/api/v3/work_packages/schema/work_package_schema_representer.rb+++ b/lib/api/v3/work_packages/schema/work_package_schema_representer.rb@@ -160,7 +160,7 @@ module APIschema :spent_time,type: 'Duration',required: false,- show_if: ->(*) { represented.project&.module_enabled?('time_tracking') }+ show_if: ->(*) { represented.project&.module_enabled?('costs') }schema :percentage_done,type: 'Integer',@@ -270,6 +270,20 @@ module APIrequired: true,has_default: true+ schema_with_allowed_collection :budget,+ type: 'Budget',+ required: false,+ value_representer: ::API::V3::Budgets::BudgetRepresenter,+ link_factory: ->(budget) {+ {+ href: api_v3_paths.budget(budget.id),+ title: budget.subject+ }+ },+ show_if: ->(*) {+ represented.project&.module_enabled?(:budgets)+ }+def attribute_groups(represented.type&.attribute_groups || []).map do |group|if group.is_a?(Type::QueryGroup)diff --git a/lib/api/v3/work_packages/work_package_representer.rb b/lib/api/v3/work_packages/work_package_representer.rbindex f307843ce94..8596390a14a 100644--- a/lib/api/v3/work_packages/work_package_representer.rb+++ b/lib/api/v3/work_packages/work_package_representer.rb@@ -85,8 +85,7 @@ module APInext if represented.new_record?{- href: new_work_package_time_entry_path(represented),- type: 'text/html',+ href: api_v3_paths.time_entries,title: "Log time on #{represented.subject}"}end@@ -286,9 +285,10 @@ module APIcache_if: -> { view_time_entries_allowed? } donext if represented.new_record?+ filters = [{ work_package_id: { operator: "=", values: [represented.id.to_s] } }]+{- href: work_package_time_entries_path(represented.id),- type: 'text/html',+ href: api_v3_paths.path_for(:time_entries, filters: filters),title: 'Time entries'}end@@ -483,6 +483,13 @@ module APIrepresented.parent = new_parentend+ associated_resource :budget,+ as: :budget,+ v3_path: :budget,+ link_title_attribute: :subject,+ representer: ::API::V3::Budgets::BudgetRepresenter,+ skip_render: ->(*) { !view_budgets_allowed? }+resources :customActions,uncacheable_link: true,link: ->(*) {@@ -568,7 +575,8 @@ module APIself.to_eager_load = %i[parenttypewatchers- attachments]+ attachments+ budget]# The dynamic class generation introduced because of the custom fields interferes with# the class naming as well as prevents calls to super@@ -586,7 +594,12 @@ module APIenddef view_time_entries_allowed?- current_user_allowed_to(:view_time_entries, context: represented.project)+ current_user_allowed_to(:view_time_entries, context: represented.project) ||+ current_user_allowed_to(:view_own_time_entries, context: represented.project)+ end++ def view_budgets_allowed?+ current_user_allowed_to(:view_budgets, context: represented.project)enddef load_complete_model(model)diff --git a/lib/plugins/acts_as_event/lib/acts_as_event.rb b/lib/plugins/acts_as_event/lib/acts_as_event.rbindex 2295b32d9d5..923fd73b3ef 100644--- a/lib/plugins/acts_as_event/lib/acts_as_event.rb+++ b/lib/plugins/acts_as_event/lib/acts_as_event.rb@@ -26,6 +26,10 @@# See docs/COPYRIGHT.rdoc for more details.#+++# This now only seems to be used when rendering atom responses.+# Search as well as activities do not rely on it.+# Thus, whenever an atom link is removed for a resource, acts_as_event within that model can also be removed.+module Redminemodule Actsmodule Eventdiff --git a/lib/redmine/plugin.rb b/lib/redmine/plugin.rbindex d93364d78ef..aaae765fcd2 100644--- a/lib/redmine/plugin.rb+++ b/lib/redmine/plugin.rb@@ -92,7 +92,7 @@ module Redmine #:nodoc:endendend- def_field :name, :description, :url, :author, :author_url, :version, :settings, :bundled+ def_field :description, :url, :author, :author_url, :version, :settings, :bundledattr_reader :id# Plugin constructor@@ -100,8 +100,6 @@ module Redmine #:nodoc:id = id.to_symp = new(id)p.instance_eval(&block)- # Set a default name if it was not provided during registration- p.name(id.to_s.humanize) if p.name.nil?registered_plugins[id] = p@@ -127,12 +125,26 @@ module Redmine #:nodoc:if RedminePluginLocator.instance.has_plugin? e.plugin_id# The required plugin is going to be loaded later, defer loading this plugin(deferred_plugins[e.plugin_id] ||= []) << [id, block]- return p+ pelseraiseendend+ def name(*args)+ name = args.empty? ? instance_variable_get("@name") : instance_variable_set("@name", *args)++ case name+ when Symbol+ ::I18n.t(name)+ when NilClass+ # Default name if it was not provided during registration+ id.to_s.humanize+ else+ name+ end+ end+# returns an array of all dependencies we know of for plugin id# (might not be complete at all times!)def self.dependencies_for(id)@@ -250,9 +262,6 @@ module Redmine #:nodoc:hide_menu_item(menu_name, item)end- # N.B.: I could not find any usages of :delete_menu_item in my locally available plugins- deprecate delete_menu_item: 'Use :hide_menu_item instead'-# Allows to hide an existing +item+ in a menu.## +hide_if+ parameter can be a lambda accepting a project, the item will only be hidden ifdiff --git a/modules/backlogs/lib/open_project/backlogs/hooks.rb b/modules/backlogs/lib/open_project/backlogs/hooks.rbindex 9915e7a67a2..a988c62fbf6 100644--- a/modules/backlogs/lib/open_project/backlogs/hooks.rb+++ b/modules/backlogs/lib/open_project/backlogs/hooks.rb@@ -27,41 +27,6 @@#++module OpenProject::Backlogs::Hooks- class Hook < Redmine::Hook::Listener- include ActionView::Helpers::TagHelper- include ActionView::Context- include WorkPackagesHelper-- def work_packages_show_attributes(context = {})- work_package = context[:work_package]- attributes = context[:attributes]-- return unless work_package.backlogs_enabled?- return if context[:from] == 'OpenProject::Backlogs::WorkPackageView::FieldsParagraph'-- attributes << work_package_show_story_points_attribute(work_package)- attributes << work_package_show_remaining_hours_attribute(work_package)-- attributes- end-- private-- def work_package_show_story_points_attribute(work_package)- return nil unless work_package.is_story?-- work_package_show_table_row(:story_points, :"story-points") do- work_package.story_points ? work_package.story_points.to_s : empty_element_tag- end- end-- def work_package_show_remaining_hours_attribute(work_package)- work_package_show_table_row(:remaining_hours) do- work_package.remaining_hours ? l_hours(work_package.remaining_hours) : empty_element_tag- end- end- end-class LayoutHook < Redmine::Hook::ViewListenerinclude RbCommonHelperdiff --git a/modules/backlogs/lib/open_project/backlogs/patches/update_service_patch.rb b/modules/backlogs/lib/open_project/backlogs/patches/update_service_patch.rbindex f6a48d59f4e..7d1bb2e5db9 100644--- a/modules/backlogs/lib/open_project/backlogs/patches/update_service_patch.rb+++ b/modules/backlogs/lib/open_project/backlogs/patches/update_service_patch.rb@@ -59,11 +59,10 @@ module OpenProject::Backlogs::Patches::UpdateServicePatchattributes = { version_id: work_package.version_id }descendant_tasks.each do |task|+ # Ensure the parent is already moved to new version so that validation errors are avoided.+ task.parent = ([work_package] + all_descendants).detect { |d| d.id == task.parent_id }result.add_dependent!(set_attributes(attributes, task))endendendend---diff --git a/modules/backlogs/spec/services/work_packages/update_service_version_inheritance_spec.rb b/modules/backlogs/spec/services/work_packages/update_service_version_inheritance_spec.rbindex e506e61ea5c..9215a70b660 100644--- a/modules/backlogs/spec/services/work_packages/update_service_version_inheritance_spec.rb+++ b/modules/backlogs/spec/services/work_packages/update_service_version_inheritance_spec.rb@@ -238,7 +238,9 @@ describe WorkPackages::UpdateService, "version inheritance", type: :model doparent.reload- instance.call(version: version2)+ call = instance.call(version: version2)++ expect(call).to be_success# Because of performance, these assertions are all in one it statementexpect(child.reload.version).to eql version2diff --git a/modules/budgets/Gemfile b/modules/budgets/Gemfilenew file mode 100644index 00000000000..fa75df15632--- /dev/null+++ b/modules/budgets/Gemfile@@ -0,0 +1,3 @@+source 'https://rubygems.org'++gemspecdiff --git a/modules/budgets/app/controllers/budgets_controller.rb b/modules/budgets/app/controllers/budgets_controller.rbnew file mode 100644index 00000000000..b6f22f1fa5f--- /dev/null+++ b/modules/budgets/app/controllers/budgets_controller.rb@@ -0,0 +1,264 @@+#-- copyright+# OpenProject is an open source project management software.+# Copyright (C) 2012-2020 the OpenProject GmbH+#+# This program is free software; you can redistribute it and/or+# modify it under the terms of the GNU General Public License version 3.+#+# OpenProject is a fork of ChiliProject, which is a fork of Redmine. The copyright follows:+# Copyright (C) 2006-2017 Jean-Philippe Lang+# Copyright (C) 2010-2013 the ChiliProject Team+#+# This program is free software; you can redistribute it and/or+# modify it under the terms of the GNU General Public License+# as published by the Free Software Foundation; either version 2+# of the License, or (at your option) any later version.+#+# This program is distributed in the hope that it will be useful,+# but WITHOUT ANY WARRANTY; without even the implied warranty of+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the+# GNU General Public License for more details.+#+# You should have received a copy of the GNU General Public License+# along with this program; if not, write to the Free Software+# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.+#+# See docs/COPYRIGHT.rdoc for more details.+#++++class BudgetsController < ApplicationController+ before_action :find_budget, only: %i[show edit update copy]+ before_action :find_budgets, only: :destroy+ before_action :find_project, only: %i[new create update_material_budget_item update_labor_budget_item]+ before_action :find_optional_project, only: :index++ before_action :authorize_global, only: :index+ before_action :authorize, except: [+ # unrestricted actions+ :index,+ :update_material_budget_item,+ :update_labor_budget_item+ ]++ helper :sort+ include SortHelper+ helper :projects+ include ProjectsHelper+ helper :attachments+ include AttachmentsHelper+ helper :costlog+ include CostlogHelper+ helper :budgets+ include BudgetsHelper+ include PaginationHelper++ def index+ sort_init 'id', 'desc'+ sort_update default_budget_sort++ @budgets = visible_sorted_budgets++ respond_to do |format|+ format.html do+ render action: 'index', layout: !request.xhr?+ end+ format.csv { send_data(budgets_to_csv(@budgets), type: 'text/csv; header=present', filename: 'export.csv') }+ end+ end++ def show+ @edit_allowed = User.current.allowed_to?(:edit_budgets, @project)+ respond_to do |format|+ format.html { render action: 'show', layout: !request.xhr? }+ end+ end++ def new+ @budget ||= Budget.new+ @budget.project_id = @project.id+ @budget.fixed_date ||= Date.today++ render layout: !request.xhr?+ end++ def copy+ source = Budget.find(params[:id].to_i)+ @budget = Budget.new++ if source+ @budget.copy_from(source)+ end++ @budget.fixed_date ||= Date.today++ render action: :new, layout: !request.xhr?+ end++ def create+ @budget = Budget.new+ @budget.project_id = @project.id++ # fixed_date must be set before material_budget_items and labor_budget_items+ @budget.fixed_date = if params[:budget] && params[:budget][:fixed_date]+ params[:budget].delete(:fixed_date)+ else+ Date.today+ end++ @budget.attributes = permitted_params.budget+ @budget.attach_files(permitted_params.attachments.to_h)++ if @budget.save+ flash[:notice] = t(:notice_successful_create)+ redirect_to(params[:continue] ? { action: 'new' } : { action: 'show', id: @budget })+ else+ render action: 'new', layout: !request.xhr?+ end+ end++ def edit+ @budget.attributes = permitted_params.budget if params[:budget]+ end++ def update+ # TODO: This was simply copied over from edit in order to have+ # something as a starting point for separating the two+ # Please go ahead and start removing code where necessary++ @budget.attributes = permitted_params.budget if params[:budget]+ if params[:budget][:existing_material_budget_item_attributes].nil?+ @budget.existing_material_budget_item_attributes = ({})+ end+ if params[:budget][:existing_labor_budget_item_attributes].nil?+ @budget.existing_labor_budget_item_attributes = ({})+ end++ @budget.attach_files(permitted_params.attachments.to_h)++ if @budget.save+ flash[:notice] = t(:notice_successful_update)+ redirect_to(params[:back_to] || { action: 'show', id: @budget })+ else+ render action: 'edit'+ end+ rescue ActiveRecord::StaleObjectError+ # Optimistic locking exception+ flash.now[:error] = t(:notice_locking_conflict)+ end++ def destroy+ @budgets.each(&:destroy)+ flash[:notice] = t(:notice_successful_delete)+ redirect_to action: 'index', project_id: @project+ end++ def update_material_budget_item+ @element_id = params[:element_id]++ cost_type = CostType.where(id: params[:cost_type_id]).first++ if cost_type && params[:units].present?+ volume = Rate.parse_number_string_to_number(params[:units])+ @costs = volume * cost_type.rate_at(params[:fixed_date]).rate rescue 0.0+ @unit = volume == 1.0 ? cost_type.unit : cost_type.unit_plural+ else+ @costs = 0.0+ @unit = cost_type.try(:unit_plural) || ''+ end++ respond_to do |format|+ format.json do+ render json: render_item_as_json(@element_id, @costs, @unit, @project, :view_cost_rates)+ end+ end+ end++ def update_labor_budget_item+ @element_id = params[:element_id]+ user = User.where(id: params[:user_id]).first++ if user && params[:hours]+ hours = params[:hours].to_s.to_hours+ @costs = hours * user.rate_at(params[:fixed_date], @project).rate rescue 0.0+ else+ @costs = 0.0+ end++ respond_to do |format|+ format.json do+ render json: render_item_as_json(@element_id, @costs, @unit, @project, :view_hourly_rates)+ end+ end+ end++ private++ def find_budget+ # This function comes directly from issues_controller.rb (Redmine 0.8.4)+ @budget = Budget.includes(:project, :author).find_by(id: params[:id])+ @project = @budget.project if @budget+ rescue ActiveRecord::RecordNotFound+ render_404+ end++ def find_budgets+ # This function comes directly from issues_controller.rb (Redmine 0.8.4)++ @budgets = Budget.where(id: params[:id] || params[:ids])+ raise ActiveRecord::RecordNotFound if @budgets.empty?++ projects = @budgets.map(&:project).compact.uniq+ if projects.size == 1+ @project = projects.first+ else+ # TODO: let users bulk edit/move/destroy budgets from different projects+ render_error 'Can not bulk edit/move/destroy cost objects from different projects' and return false+ end+ rescue ActiveRecord::RecordNotFound+ render_404+ end++ def find_project+ @project = Project.find(params[:project_id])+ rescue ActiveRecord::RecordNotFound+ render_404+ end++ def find_optional_project+ @project = Project.find(params[:project_id]) unless params[:project_id].blank?+ rescue ActiveRecord::RecordNotFound+ render_404+ end++ def render_item_as_json(element_id, costs, unit, project, permission)+ response = {+ "#{element_id}_unit_name" => ActionController::Base.helpers.sanitize(unit),+ "#{element_id}_currency" => Setting.plugin_costs['costs_currency']+ }++ if current_user.allowed_to?(permission, project)+ response["#{element_id}_costs"] = number_to_currency(costs)+ response["#{element_id}_cost_value"] = costs+ end++ response+ end++ def default_budget_sort+ {+ 'id' => "#{Budget.table_name}.id",+ 'subject' => "#{Budget.table_name}.subject",+ 'fixed_date' => "#{Budget.table_name}.fixed_date"+ }+ end++ def visible_sorted_budgets+ Budget+ .visible(current_user)+ .order(sort_clause)+ .includes(:author)+ .where(project_id: @project.id)+ .page(page_param)+ .per_page(per_page_param)+ end+enddiff --git a/modules/costs/app/helpers/cost_objects_helper.rb b/modules/budgets/app/helpers/budgets_helper.rbsimilarity index 55%rename from modules/costs/app/helpers/cost_objects_helper.rbrename to modules/budgets/app/helpers/budgets_helper.rbindex bb8db4484d1..043590d2698 100644--- a/modules/costs/app/helpers/cost_objects_helper.rb+++ b/modules/budgets/app/helpers/budgets_helper.rb@@ -28,46 +28,48 @@require 'csv'-module CostObjectsHelper- include ApplicationHelper+module BudgetsHelperinclude ActionView::Helpers::NumberHelper+ include Redmine::I18n# Check if the current user is allowed to manage the budget. Based on Role# permissions.def allowed_management?- User.current.allowed_to?(:edit_cost_objects, @project)+ User.current.allowed_to?(:edit_budgets, @project)end- def cost_objects_to_csv(cost_objects)+ def budgets_to_csv(budgets)CSV.generate(col_sep: t(:general_csv_separator)) do |csv|# csv header fields- headers = ['#',- Project.model_name.human,- CostObject.human_attribute_name(:subject),- CostObject.human_attribute_name(:author),- CostObject.human_attribute_name(:fixed_date),- VariableCostObject.human_attribute_name(:material_budget),- VariableCostObject.human_attribute_name(:labor_budget),- CostObject.human_attribute_name(:spent),- CostObject.human_attribute_name(:created_on),- CostObject.human_attribute_name(:updated_on),- CostObject.human_attribute_name(:description)- ]+ headers = [+ '#',+ Project.model_name.human,+ Budget.human_attribute_name(:subject),+ Budget.human_attribute_name(:author),+ Budget.human_attribute_name(:fixed_date),+ Budget.human_attribute_name(:material_budget),+ Budget.human_attribute_name(:labor_budget),+ Budget.human_attribute_name(:spent),+ Budget.human_attribute_name(:created_at),+ Budget.human_attribute_name(:updated_at),+ Budget.human_attribute_name(:description)+ ]csv << headers.map { |c| begin; c.to_s.encode('UTF-8'); rescue; c.to_s; end }# csv lines- cost_objects.each do |cost_object|- fields = [cost_object.id,- cost_object.project.name,- cost_object.subject,- cost_object.author.name,- format_date(cost_object.fixed_date),- cost_object.kind == 'VariableCostObject' ? number_to_currency(cost_object.material_budget) : '',- cost_object.kind == 'VariableCostObject' ? number_to_currency(cost_object.labor_budget) : '',- cost_object.kind == 'VariableCostObject' ? number_to_currency(cost_object.spent) : '',- format_time(cost_object.created_on),- format_time(cost_object.updated_on),- cost_object.description- ]+ budgets.each do |budget|+ fields = [+ budget.id,+ budget.project.name,+ budget.subject,+ budget.author.name,+ format_date(budget.fixed_date),+ number_to_currency(budget.material_budget),+ number_to_currency(budget.labor_budget),+ number_to_currency(budget.spent),+ format_time(budget.created_at),+ format_time(budget.updated_at),+ budget.description+ ]csv << fields.map { |c| begin; c.to_s.encode('UTF-8'); rescue; c.to_s; end }endenddiff --git a/modules/costs/app/models/activities/cost_object_activity_provider.rb b/modules/budgets/app/models/activities/budget_activity_provider.rbsimilarity index 75%rename from modules/costs/app/models/activities/cost_object_activity_provider.rbrename to modules/budgets/app/models/activities/budget_activity_provider.rbindex c8e7355fceb..c984dfa2ee1 100644--- a/modules/costs/app/models/activities/cost_object_activity_provider.rb+++ b/modules/budgets/app/models/activities/budget_activity_provider.rb@@ -26,31 +26,31 @@# See docs/COPYRIGHT.rdoc for more details.#++-class Activities::CostObjectActivityProvider < Activities::BaseActivityProvider- activity_provider_for type: 'cost_objects',- permission: :view_cost_objects+class Activities::BudgetActivityProvider < Activities::BaseActivityProvider+ activity_provider_for type: 'budgets',+ permission: :view_budgetsdef event_query_projection[- activity_journal_projection_statement(:subject, 'cost_object_subject'),+ activity_journal_projection_statement(:subject, 'budget_subject'),activity_journal_projection_statement(:project_id, 'project_id')]enddef event_type(_event)- 'cost_object'+ 'budget'enddef event_title(event)- "#{I18n.t(:label_cost_object)} ##{event['journable_id']}: #{event['cost_object_subject']}"+ "#{I18n.t(:label_budget)} ##{event['journable_id']}: #{event['budget_subject']}"enddef event_path(event)- url_helpers.cost_object_path(url_helper_parameter(event))+ url_helpers.budget_path(url_helper_parameter(event))enddef event_url(event)- url_helpers.cost_object_url(url_helper_parameter(event))+ url_helpers.budget_url(url_helper_parameter(event))endprivatediff --git a/modules/costs/app/models/variable_cost_object.rb b/modules/budgets/app/models/budget.rbsimilarity index 54%rename from modules/costs/app/models/variable_cost_object.rbrename to modules/budgets/app/models/budget.rbindex a0f216ad9d1..cc55451cc8a 100644--- a/modules/costs/app/models/variable_cost_object.rb+++ b/modules/budgets/app/models/budget.rb@@ -26,15 +26,16 @@# See docs/COPYRIGHT.rdoc for more details.#++-class VariableCostObject < CostObject+class Budget < ApplicationRecord+ belongs_to :author, class_name: 'User', foreign_key: 'author_id'+ belongs_to :project+ has_many :work_packages, dependent: :nullifyhas_many :material_budget_items, -> {includes(:cost_type).order(Arel.sql('material_budget_items.id ASC'))- }, foreign_key: 'cost_object_id',- dependent: :destroy+ }, dependent: :destroyhas_many :labor_budget_items, -> {includes(:user).order(Arel.sql('labor_budget_items.id ASC'))- }, foreign_key: 'cost_object_id',- dependent: :destroy+ }, dependent: :destroyvalidates_associated :material_budget_itemsvalidates_associated :labor_budget_items@@ -42,22 +43,81 @@ class VariableCostObject < CostObjectafter_update :save_material_budget_itemsafter_update :save_labor_budget_items- # override acts_as_journalized method- def activity_type- self.class.superclass.plural_name+ has_many :cost_entries, through: :work_packages+ has_many :time_entries, through: :work_packages++ include ActiveModel::ForbiddenAttributesProtection++ acts_as_attachable+ acts_as_journalized++ acts_as_event type: 'cost-objects',+ title: Proc.new { |o| "#{I18n.t(:label_budget)} ##{o.id}: #{o.subject}" },+ url: Proc.new { |o| { controller: 'budgets', action: 'show', id: o.id } }++ validates_presence_of :subject, :project, :author, :fixed_date+ validates_length_of :subject, maximum: 255+ validates_length_of :subject, minimum: 1++ User.before_destroy do |user|+ Budget.replace_author_with_deleted_user user+ end++ def self.visible(user)+ includes(:project)+ .references(:projects)+ .merge(Project.allowed_to(user, :view_budgets))+ end++ def initialize(attributes = nil)+ super+ self.author = User.current if new_record?enddef copy_from(arg)- cost_object = (arg.is_a?(VariableCostObject) ? arg : self.class.find(arg))- attrs = cost_object.attributes.dup+ budget = (arg.is_a?(Budget) ? arg : self.class.find(arg))+ attrs = budget.attributes.dupsuper(attrs)- self.labor_budget_items = cost_object.labor_budget_items.map(&:dup)- self.material_budget_items = cost_object.material_budget_items.map(&:dup)+ self.labor_budget_items = budget.labor_budget_items.map(&:dup)+ self.material_budget_items = budget.material_budget_items.map(&:dup)+ end++ def budget+ material_budget + labor_budgetend- # Label of the current cost_object type for display in GUI.def type_label- I18n.t(:label_variable_cost_object)+ I18n.t(:label_budget)+ end++ # Amount of the budget spent. Expressed as as a percentage whole number+ def budget_ratio+ return 0.0 if budget.nil? || budget == 0.0++ ((spent / budget) * 100).round+ end++ def css_classes+ 'budget'+ end++ def self.replace_author_with_deleted_user(user)+ substitute = DeletedUser.first++ where(author_id: user.id).update_all(author_id: substitute.id)+ end++ def to_s+ subject+ end++ def name+ subject+ end++ # override acts_as_journalized method+ def activity_type+ self.class.plural_nameenddef material_budget@@ -74,35 +134,35 @@ class VariableCostObject < CostObjectdef spent_material@spent_material ||= begin- if cost_entries.blank?- BigDecimal('0.0000')- else- cost_entries.visible_costs(User.current, project).sum("CASE+ if cost_entries.blank?+ BigDecimal('0.0000')+ else+ cost_entries.visible_costs(User.current, project).sum("CASEWHEN #{CostEntry.table_name}.overridden_costs IS NULL THEN#{CostEntry.table_name}.costsELSE#{CostEntry.table_name}.overridden_costs END").to_d- end- end+ end+ endenddef spent_labor@spent_labor ||= begin- if time_entries.blank?- BigDecimal('0.0000')- else- time_entries.visible_costs(User.current, project).sum("CASE+ if time_entries.blank?+ BigDecimal('0.0000')+ else+ time_entries.visible_costs(User.current, project).sum("CASEWHEN #{TimeEntry.table_name}.overridden_costs IS NULL THEN#{TimeEntry.table_name}.costsELSE#{TimeEntry.table_name}.overridden_costs END").to_d- end- end+ end+ endenddef new_material_budget_item_attributes=(material_budget_item_attributes)material_budget_item_attributes.each do |_index, attributes|- material_budget_items.build(attributes) if attributes[:units].to_i > 0+ material_budget_items.build(attributes) if attributes[:units].to_i.positive?endend@@ -110,10 +170,9 @@ class VariableCostObject < CostObjectmaterial_budget_items.reject(&:new_record?).each do |material_budget_item|attributes = material_budget_item_attributes[material_budget_item.id.to_s]- if User.current.allowed_to? :edit_cost_objects, material_budget_item.cost_object.project- if attributes && attributes[:units].to_i > 0- attributes[:budget] = Rate.parse_number_string(attributes[:budget])- material_budget_item.attributes = attributes+ if User.current.allowed_to? :edit_budgets, material_budget_item.budget.project+ if attributes && attributes[:units].to_i.positive?+ material_budget_item.attributes = attributes.merge(amount: Rate.parse_number_string(attributes[:amount]))elsematerial_budget_items.delete(material_budget_item)end@@ -129,12 +188,10 @@ class VariableCostObject < CostObjectdef new_labor_budget_item_attributes=(labor_budget_item_attributes)labor_budget_item_attributes.each do |_index, attributes|- if attributes[:hours].to_i > 0 &&- attributes[:user_id].to_i > 0 &&- project.possible_assignees.map(&:id).include?(attributes[:user_id].to_i)+ if valid_labor_budget_attributes?(attributes)item = labor_budget_items.build(attributes)- item.cost_object = self # to please the labor_budget_item validation+ item.budget = self # to please the labor_budget_item validationendendend@@ -142,10 +199,9 @@ class VariableCostObject < CostObjectdef existing_labor_budget_item_attributes=(labor_budget_item_attributes)labor_budget_items.reject(&:new_record?).each do |labor_budget_item|attributes = labor_budget_item_attributes[labor_budget_item.id.to_s]- if User.current.allowed_to? :edit_cost_objects, labor_budget_item.cost_object.project- if attributes && attributes[:hours].to_i > 0 && attributes[:user_id].to_i > 0 && project.possible_assignees.map(&:id).include?(attributes[:user_id].to_i)- attributes[:budget] = Rate.parse_number_string(attributes[:budget])- labor_budget_item.attributes = attributes+ if User.current.allowed_to? :edit_budgets, labor_budget_item.budget.project+ if valid_labor_budget_attributes?(attributes)+ labor_budget_item.attributes = attributes.merge(amount: Rate.parse_number_string(attributes[:amount]))elselabor_budget_items.delete(labor_budget_item)end@@ -158,4 +214,11 @@ class VariableCostObject < CostObjectlabor_budget_item.save(validate: false)endend++ def valid_labor_budget_attributes?(attributes)+ attributes &&+ attributes[:hours].to_i.positive? &&+ attributes[:user_id].to_i.positive? &&+ project.possible_assignees.map(&:id).include?(attributes[:user_id].to_i)+ endenddiff --git a/modules/costs/lib/open_project/costs.rb b/modules/budgets/app/models/journal/budget_journal.rbsimilarity index 93%rename from modules/costs/lib/open_project/costs.rbrename to modules/budgets/app/models/journal/budget_journal.rbindex 829f93a60dc..ea020e54447 100644--- a/modules/costs/lib/open_project/costs.rb+++ b/modules/budgets/app/models/journal/budget_journal.rb@@ -26,8 +26,6 @@# See docs/COPYRIGHT.rdoc for more details.#++-module OpenProject- module Costs- require 'open_project/costs/engine'- end+class Journal::BudgetJournal < Journal::BaseJournal+ self.table_name = 'budget_journals'enddiff --git a/modules/costs/app/models/labor_budget_item.rb b/modules/budgets/app/models/labor_budget_item.rbsimilarity index 73%rename from modules/costs/app/models/labor_budget_item.rbrename to modules/budgets/app/models/labor_budget_item.rbindex f6c6faec4b9..d5899dcfd10 100644--- a/modules/costs/app/models/labor_budget_item.rb+++ b/modules/budgets/app/models/labor_budget_item.rb@@ -27,22 +27,22 @@#++class LaborBudgetItem < ApplicationRecord- belongs_to :cost_object+ belongs_to :budgetbelongs_to :userbelongs_to :principal, foreign_key: 'user_id'- include ::OpenProject::Costs::DeletedUserFallback+ include ::Costs::DeletedUserFallbackvalidates_length_of :comments, maximum: 255, allow_nil: truevalidates_presence_of :user- validates_presence_of :cost_object+ validates_presence_of :budgetvalidates_numericality_of :hours, allow_nil: falseinclude ActiveModel::ForbiddenAttributesProtection- # user_id correctness is ensured in VariableCostObject#*_labor_budget_item_attributes=+ # user_id correctness is ensured in Budget#*_labor_budget_item_attributes=def self.visible(user, project)- table = self.arel_table+ table = arel_tableview_allowed = Project.allowed_to(user, :view_hourly_rates).select(:id)view_own_allowed = Project.allowed_to(user, :view_own_hourly_rate).select(:id)@@ -53,29 +53,29 @@ class LaborBudgetItem < ApplicationRecord.in(view_own_allowed.arel).and(table[:user_id].eq(user.id)))- scope = includes([{ cost_object: :project }, :user])+ scope = includes([{ budget: :project }, :user]).references(:projects)- where(view_or_view_own)+ .where(view_or_view_own)if project- scope = scope.where(cost_object: { projects_id: project.id })+ scope.where(budget: { projects_id: project.id })endend- scope :visible_costs, lambda{|*args|+ scope :visible_costs, lambda { |*args|visible((args.first || User.current), args[1])}def costs- budget || calculated_costs+ amount || calculated_costsend- def overridden_budget?- budget.present?+ def overridden_costs?+ amount.present?end- def calculated_costs(fixed_date = cost_object.fixed_date, project_id = cost_object.project_id)- if user_id && hours && rate = HourlyRate.at_date_for_user_in_project(fixed_date, user_id, project_id)+ def calculated_costs(fixed_date = budget.fixed_date, project_id = budget.project_id)+ if user_id && hours && (rate = HourlyRate.at_date_for_user_in_project(fixed_date, user_id, project_id))rate.rate * hourselse0.0@@ -83,7 +83,7 @@ class LaborBudgetItem < ApplicationRecordenddef costs_visible_by?(usr)- usr.allowed_to?(:view_hourly_rates, cost_object.project) ||- (usr.id == user_id && usr.allowed_to?(:view_own_hourly_rate, cost_object.project))+ usr.allowed_to?(:view_hourly_rates, budget.project) ||+ (usr.id == user_id && usr.allowed_to?(:view_own_hourly_rate, budget.project))endenddiff --git a/modules/costs/app/models/material_budget_item.rb b/modules/budgets/app/models/material_budget_item.rbsimilarity index 85%rename from modules/costs/app/models/material_budget_item.rbrename to modules/budgets/app/models/material_budget_item.rbindex 068a4c64588..c7292b87a25 100644--- a/modules/costs/app/models/material_budget_item.rb+++ b/modules/budgets/app/models/material_budget_item.rb@@ -27,7 +27,7 @@#++class MaterialBudgetItem < ApplicationRecord- belongs_to :cost_object+ belongs_to :budgetbelongs_to :cost_typevalidates_length_of :comments, maximum: 255, allow_nil: true@@ -36,7 +36,7 @@ class MaterialBudgetItem < ApplicationRecordinclude ActiveModel::ForbiddenAttributesProtectiondef self.visible(user)- includes(cost_object: :project)+ includes(budget: :project).references(:projects).merge(Project.allowed_to(user, :view_cost_rates))end@@ -45,21 +45,21 @@ class MaterialBudgetItem < ApplicationRecordscope = visible(args.first || User.current)if args[1]- scope = scope.where(cost_object: { projects_id: args[1].id })+ scope = scope.where(budget: { projects_id: args[1].id })endscope}def costs- budget || calculated_costs+ amount || calculated_costsend- def overridden_budget?- budget.present?+ def overridden_costs?+ amount.present?end- def calculated_costs(fixed_date = cost_object.fixed_date)+ def calculated_costs(fixed_date = budget.fixed_date)if units && cost_type && rate = cost_type.rate_at(fixed_date)rate.rate * unitselse@@ -68,6 +68,6 @@ class MaterialBudgetItem < ApplicationRecordenddef costs_visible_by?(usr)- usr.allowed_to?(:view_cost_rates, cost_object.project)+ usr.allowed_to?(:view_cost_rates, budget.project)endenddiff --git a/modules/costs/lib/open_project/costs/work_package_filter.rb b/modules/budgets/app/models/queries/work_packages/filter/budget_filter.rbsimilarity index 76%rename from modules/costs/lib/open_project/costs/work_package_filter.rbrename to modules/budgets/app/models/queries/work_packages/filter/budget_filter.rbindex 6f30f3854eb..8aacce2c493 100644--- a/modules/costs/lib/open_project/costs/work_package_filter.rb+++ b/modules/budgets/app/models/queries/work_packages/filter/budget_filter.rb@@ -26,20 +26,19 @@# See docs/COPYRIGHT.rdoc for more details.#++-module OpenProject::Costs- class WorkPackageFilter < ::Queries::WorkPackages::Filter::WorkPackageFilter+module Queries::WorkPackages::Filter+ class BudgetFilter < ::Queries::WorkPackages::Filter::WorkPackageFilterdef allowed_values- cost_objects+ budgets.pluck(:subject, :id)enddef available?- project &&- project.module_enabled?(:costs_module)+ project&.module_enabled?(:budgets)enddef self.key- :cost_object_id+ :budget_idenddef order@@ -51,7 +50,7 @@ module OpenProject::Costsenddef dependency_class- '::API::V3::Queries::Schemas::CostObjectFilterDependencyRepresenter'+ '::API::V3::Queries::Schemas::BudgetFilterDependencyRepresenter'enddef ar_object_filter?@@ -59,21 +58,21 @@ module OpenProject::Costsenddef value_objects- available_cost_objects = cost_objects.index_by(&:id)+ available_budgets = budgets.index_by(&:id)values- .map { |cost_object_id| available_cost_objects[cost_object_id.to_i] }+ .map { |budget_id| available_budgets[budget_id.to_i] }.compactenddef human_name- WorkPackage.human_attribute_name(:cost_object)+ WorkPackage.human_attribute_name(:budget)endprivate- def cost_objects- CostObject+ def budgets+ Budget.where(project_id: project).order(Arel.sql('subject ASC'))enddiff --git a/modules/costs/app/views/cost_objects/_costs.html.erb b/modules/budgets/app/views/budgets/_costs.html.erbsimilarity index 100%rename from modules/costs/app/views/cost_objects/_costs.html.erbrename to modules/budgets/app/views/budgets/_costs.html.erbdiff --git a/modules/costs/app/views/cost_objects/_edit.html.erb b/modules/budgets/app/views/budgets/_edit.html.erbsimilarity index 84%rename from modules/costs/app/views/cost_objects/_edit.html.erbrename to modules/budgets/app/views/budgets/_edit.html.erbindex 2ef58edcf19..f7309c99b8e 100644--- a/modules/costs/app/views/cost_objects/_edit.html.erb+++ b/modules/budgets/app/views/budgets/_edit.html.erb@@ -27,13 +27,13 @@ See docs/COPYRIGHT.rdoc for more details.++#%>-<%= labelled_tabular_form_for @cost_object,- :as => :cost_object,- :url => cost_object_path(@cost_object),+<%= labelled_tabular_form_for @budget,+ :as => :budget,+ :url => budget_path(@budget),:html => {:multipart => true,- :id => 'cost_object_form',+ :id => 'budget_form',:class => 'form'} do |f| %>- <%= error_messages_for 'cost_object' %>+ <%= error_messages_for 'budget' %><%= render :partial => 'form', :locals => {:f => f} %><div class="generic-table--action-buttons"><%= styled_button_tag t(:button_submit), class: '-with-icon icon-checkmark -highlight', id: 'budget-table--submit-button'%>diff --git a/modules/costs/app/views/cost_objects/_form.html.erb b/modules/budgets/app/views/budgets/_form.html.erbsimilarity index 88%rename from modules/costs/app/views/cost_objects/_form.html.erbrename to modules/budgets/app/views/budgets/_form.html.erbindex f523f85771c..46803e5c31f 100644--- a/modules/costs/app/views/cost_objects/_form.html.erb+++ b/modules/budgets/app/views/budgets/_form.html.erb@@ -27,8 +27,6 @@ See docs/COPYRIGHT.rdoc for more details.++#%>-<%= f.hidden_field :kind %>-<% resource = budget_attachment_representer(f.object) %><div class="form--field -required">@@ -44,9 +42,7 @@ See docs/COPYRIGHT.rdoc for more details.<%= f.text_field :fixed_date, container_class: '-xslim', class: '-augmented-datepicker' %></div>-<% if @cost_object.kind == "VariableCostObject" -%>- <%= render partial: 'cost_objects/subform/material_budget_subform' %>- <%= render partial: 'cost_objects/subform/labor_budget_subform' %>-<%- end %>+<%= render partial: 'budgets/subform/material_budget_subform' %>+<%= render partial: 'budgets/subform/labor_budget_subform' %><div style="clear: both;"> </div>diff --git a/modules/costs/app/views/cost_objects/_list.html.erb b/modules/budgets/app/views/budgets/_list.html.erbsimilarity index 70%rename from modules/costs/app/views/cost_objects/_list.html.erbrename to modules/budgets/app/views/budgets/_list.html.erbindex 809b92cd76e..09abd9cbbf2 100644--- a/modules/costs/app/views/cost_objects/_list.html.erb+++ b/modules/budgets/app/views/budgets/_list.html.erb@@ -43,12 +43,12 @@ See docs/COPYRIGHT.rdoc for more details.<thead><tr><%= sort_header_tag("id", :caption => '#', :default_order => 'desc') %>- <%= sort_header_tag("subject", :caption => CostObject.human_attribute_name(:subject)) %>+ <%= sort_header_tag("subject", :caption => Budget.human_attribute_name(:subject)) %><th class="currency"><div class="generic-table--sort-header-outer"><div class="generic-table--sort-header"><span>- <%= CostObject.human_attribute_name(:budget) %>+ <%= Budget.human_attribute_name(:budget) %></span></div></div>@@ -57,7 +57,7 @@ See docs/COPYRIGHT.rdoc for more details.<div class="generic-table--sort-header-outer"><div class="generic-table--sort-header"><span>- <%= CostObject.human_attribute_name(:spent) %>+ <%= Budget.human_attribute_name(:spent) %></span></div></div>@@ -66,7 +66,7 @@ See docs/COPYRIGHT.rdoc for more details.<div class="generic-table--sort-header-outer"><div class="generic-table--sort-header"><span>- <%= CostObject.human_attribute_name(:available) %>+ <%= Budget.human_attribute_name(:available) %></span></div></div>@@ -75,7 +75,7 @@ See docs/COPYRIGHT.rdoc for more details.<div class="generic-table--sort-header-outer"><div class="generic-table--sort-header"><span>- <%= CostObject.human_attribute_name(:budget_ratio) %>+ <%= Budget.human_attribute_name(:budget_ratio) %></span></div></div>@@ -84,23 +84,23 @@ See docs/COPYRIGHT.rdoc for more details.</thead><tbody><% total_budget = BigDecimal("0"); labor_budget = BigDecimal("0"); material_budget = BigDecimal("0"); spent = BigDecimal("0") %>- <% cost_objects.each do |cost_object| %>- <tr id="cost_object-<%= cost_object.id %>" class="<%= cost_object.css_classes %>">- <td><%= link_to cost_object.id, cost_object_path(cost_object.id) %></td>- <%= content_tag(:td, link_to(h(cost_object.subject), cost_object_path(cost_object.id)), :class => 'subject') %>- <%= content_tag(:td, number_to_currency(cost_object.budget, :precision => 0), :class => 'currency') %>- <%= content_tag(:td, number_to_currency(cost_object.spent, :precision => 0), :class => 'currency') %>- <%= content_tag(:td, number_to_currency(cost_object.budget - cost_object.spent, :precision => 0), :class => 'currency') %>- <%= content_tag(:td, extended_progress_bar(cost_object.budget_ratio, :legend => "#{cost_object.budget_ratio}")) %>+ <% budgets.each do |budget| %>+ <tr id="budget-<%= budget.id %>" class="<%= budget.css_classes %>">+ <td><%= link_to budget.id, budget_path(budget.id) %></td>+ <%= content_tag(:td, link_to(h(budget.subject), budget_path(budget.id)), :class => 'subject') %>+ <%= content_tag(:td, number_to_currency(budget.budget, :precision => 0), :class => 'currency') %>+ <%= content_tag(:td, number_to_currency(budget.spent, :precision => 0), :class => 'currency') %>+ <%= content_tag(:td, number_to_currency(budget.budget - budget.spent, :precision => 0), :class => 'currency') %>+ <%= content_tag(:td, extended_progress_bar(budget.budget_ratio, :legend => "#{budget.budget_ratio}")) %><%-- total_budget += cost_object.budget- labor_budget += cost_object.labor_budget- material_budget += cost_object.material_budget- spent += cost_object.spent+ total_budget += budget.budget+ labor_budget += budget.labor_budget+ material_budget += budget.material_budget+ spent += budget.spent-%></tr><% end %>- <% if cost_objects.length > 0 %>+ <% if budgets.length > 0 %><tr><td /><td />diff --git a/modules/costs/app/views/cost_objects/_show_variable_cost_object.html.erb b/modules/budgets/app/views/budgets/_show.html.erbsimilarity index 90%rename from modules/costs/app/views/cost_objects/_show_variable_cost_object.html.erbrename to modules/budgets/app/views/budgets/_show.html.erbindex 31787f0a002..874027569ab 100644--- a/modules/costs/app/views/cost_objects/_show_variable_cost_object.html.erb+++ b/modules/budgets/app/views/budgets/_show.html.erb@@ -33,7 +33,7 @@ See docs/COPYRIGHT.rdoc for more details.</legend><div class="grid-block"><div class="grid-content medium-6">- <h4><%= VariableCostObject.human_attribute_name(:material_budget) %></h4>+ <h4><%= Budget.human_attribute_name(:material_budget) %></h4><div><div class="generic-table--container -with-footer"><div class="generic-table--results-container">@@ -85,7 +85,7 @@ See docs/COPYRIGHT.rdoc for more details.</tr></thead><tbody>- <% @cost_object.material_budget_items.each do |material_budget_item| %>+ <% @budget.material_budget_items.each do |material_budget_item| %><tr><td class="units"><%= localized_float(material_budget_item.units) %>@@ -102,7 +102,7 @@ See docs/COPYRIGHT.rdoc for more details.<td colspan="3"></td><td class="currency"><div class="generic-table--footer-outer">- <strong><%= number_to_currency(@cost_object.material_budget) %></strong>+ <strong><%= number_to_currency(@budget.material_budget) %></strong></div></td></tr>@@ -168,7 +168,7 @@ See docs/COPYRIGHT.rdoc for more details.</tr></thead><tbody>- <% @cost_object.cost_entries.visible(User.current, @project).includes(:cost_type).group_by(&:work_package).each do |work_package, cost_entries|+ <% @budget.cost_entries.visible(User.current).includes(:cost_type).group_by(&:work_package).each do |work_package, cost_entries|entries = cost_entries.inject(Hash.new) do |results, entry|result = results[entry.cost_type.id.to_s]unless result@@ -185,12 +185,12 @@ See docs/COPYRIGHT.rdoc for more details.<td class="subject"><%= link_to_work_package work_package %></td><td><%= link_to localized_float(c.units),- {- controller: "/cost_reports",- action: "index",- cost_type_id: c.cost_type,- project_id: work_package.project_id- } %>+ cost_reports_path(work_package.project_id,+ 'fields[]': 'WorkPackageId',+ 'operators[WorkPackageId]': '=',+ 'values[WorkPackageId]': work_package.id,+ unit: c.cost_type_id,+ set_filter: 1) %></td><td><%= c.cost_type %></td><td class="currency"><%= c.costs_visible_by?(User.current) ? number_to_currency(c.real_costs) : "" %></td>@@ -204,7 +204,7 @@ See docs/COPYRIGHT.rdoc for more details.<td colspan="3"></td><td class="currency"><div class="generic-table--footer-outer">- <strong><%= number_to_currency(@cost_object.spent_material) %></strong>+ <strong><%= number_to_currency(@budget.spent_material) %></strong></div></td></tr>@@ -226,7 +226,7 @@ See docs/COPYRIGHT.rdoc for more details.</legend><div class="grid-block"><div class="grid-content medium-6">- <h4><%= VariableCostObject.human_attribute_name(:labor_budget)%></h4>+ <h4><%= Budget.human_attribute_name(:labor_budget)%></h4><div><div class="generic-table--container -with-footer"><div class="generic-table--results-container">@@ -278,7 +278,7 @@ See docs/COPYRIGHT.rdoc for more details.</tr></thead><tbody>- <% @cost_object.labor_budget_items.each do |labor_budget_item| %>+ <% @budget.labor_budget_items.each do |labor_budget_item| %><tr><td class="hours"><%= l_hours(labor_budget_item.hours) %></td><td><%=h labor_budget_item.principal.name %></td>@@ -299,7 +299,7 @@ See docs/COPYRIGHT.rdoc for more details.<td colspan="3"></td><td class="currency"><div class="generic-table--footer-outer">- <strong><%= number_to_currency(@cost_object.labor_budget) %></strong>+ <strong><%= number_to_currency(@budget.labor_budget) %></strong></div></td></tr>@@ -365,7 +365,7 @@ See docs/COPYRIGHT.rdoc for more details.</tr></thead><tbody>- <% @cost_object.time_entries.visible(User.current, @project).group_by(&:work_package).each do |work_package, time_entries|+ <% @budget.time_entries.visible(User.current).group_by(&:work_package).each do |work_package, time_entries|entries = time_entries.inject(Hash.new) do |results, entry|result = results[entry.user.id.to_s]unless result@@ -383,7 +383,7 @@ See docs/COPYRIGHT.rdoc for more details.%><tr><td class="subject"><%= link_to_work_package work_package %></td>- <td class="hours"><%= link_to l_hours(t.hours), {:controller => "/timelog", :action => "index", :work_package_id => work_package} %></td>+ <td class="hours"><%= link_to l_hours(t.hours), cost_reports_path(work_package.project_id, 'fields[]': 'WorkPackageId', 'operators[WorkPackageId]': '=', 'values[WorkPackageId]': work_package.id, set_filter: 1) %></td><td><%=h t.user.name %></td><td class="currency"><%= number_to_currency(t.real_costs) %></td></tr>@@ -395,7 +395,7 @@ See docs/COPYRIGHT.rdoc for more details.<td colspan="3"></td><td class="currency"><div class="generic-table--footer-outer">- <strong><%= number_to_currency(@cost_object.spent_labor) %></strong>+ <strong><%= number_to_currency(@budget.spent_labor) %></strong></div></td></tr>diff --git a/modules/costs/app/views/cost_objects/edit.html.erb b/modules/budgets/app/views/budgets/edit.html.erbsimilarity index 87%rename from modules/costs/app/views/cost_objects/edit.html.erbrename to modules/budgets/app/views/budgets/edit.html.erbindex dbc11cd4f28..5eb8aa9f583 100644--- a/modules/costs/app/views/cost_objects/edit.html.erb+++ b/modules/budgets/app/views/budgets/edit.html.erb@@ -27,7 +27,7 @@ See docs/COPYRIGHT.rdoc for more details.++#%>-<% html_title "#{t(:label_edit)} #{t(:label_cost_object_id, id: @cost_object.id)}: #{@cost_object.subject}" %>-<%= toolbar title: t(:label_cost_object_id, id: @cost_object.id) %>+<% html_title "#{t(:label_edit)} #{t(:label_budget_id, id: @budget.id)}: #{@budget.subject}" %>+<%= toolbar title: t(:label_budget_id, id: @budget.id) %><%= render :partial => 'edit' %>diff --git a/modules/costs/app/views/cost_objects/index.html.erb b/modules/budgets/app/views/budgets/index.html.erbsimilarity index 74%rename from modules/costs/app/views/cost_objects/index.html.erbrename to modules/budgets/app/views/budgets/index.html.erbindex e8d8ca19cb7..e7ace2bd1ad 100644--- a/modules/costs/app/views/cost_objects/index.html.erb+++ b/modules/budgets/app/views/budgets/index.html.erb@@ -27,23 +27,23 @@ See docs/COPYRIGHT.rdoc for more details.++#%>-<% html_title(t(:label_cost_object_plural)) %>-<%= toolbar title: t(:label_cost_object_plural) do %>- <% if authorize_for(:cost_objects, :new) %>+<% html_title(t(:label_budget_plural)) %>+<%= toolbar title: t(:label_budget_plural) do %>+ <% if authorize_for(:budgets, :new) %><li class="toolbar-item">- <a href="<%= new_projects_cost_object_path(@project) %>" aria-label="<%= I18n.t(:button_add_cost_object) %>" id="add-budget-button" title="<%= I18n.t(:button_add_cost_object) %>" class="button -alt-highlight">+ <a href="<%= new_projects_budget_path(@project) %>" aria-label="<%= I18n.t(:button_add_budget) %>" id="add-budget-button" title="<%= I18n.t(:button_add_budget) %>" class="button -alt-highlight"><%= op_icon('button--icon icon-add') %>- <span class="button--text"><%= t(:label_cost_object) %></span>+ <span class="button--text"><%= t(:label_budget) %></span></a></li><% end %><% end %>-<% if @cost_objects.empty? %>+<% if @budgets.empty? %><%= no_results_box %><% else %>-<%= render :partial => 'list', :locals => {:cost_objects => @cost_objects} %>-<%= pagination_links_full @cost_objects %>+<%= render :partial => 'list', :locals => {:budgets => @budgets} %>+<%= pagination_links_full @budgets %><% end %><p class="other-formats">diff --git a/modules/costs/app/views/cost_objects/items/_labor_budget_item.html.erb b/modules/budgets/app/views/budgets/items/_labor_budget_item.html.erbsimilarity index 86%rename from modules/costs/app/views/cost_objects/items/_labor_budget_item.html.erbrename to modules/budgets/app/views/budgets/items/_labor_budget_item.html.erbindex c879e548af2..377cbed4d02 100644--- a/modules/costs/app/views/cost_objects/items/_labor_budget_item.html.erb+++ b/modules/budgets/app/views/budgets/items/_labor_budget_item.html.erb@@ -32,9 +32,9 @@ See docs/COPYRIGHT.rdoc for more details.index ||= "INDEX"new_or_existing = labor_budget_item.new_record? ? 'new' : 'existing'id_or_index = labor_budget_item.new_record? ? index : labor_budget_item.id- prefix = "cost_object[#{new_or_existing}_labor_budget_item_attributes][]"- id_prefix = "cost_object_#{new_or_existing}_labor_budget_item_attributes_#{id_or_index}"- name_prefix = "cost_object[#{new_or_existing}_labor_budget_item_attributes][#{id_or_index}]"+ prefix = "budget[#{new_or_existing}_labor_budget_item_attributes][]"+ id_prefix = "budget_#{new_or_existing}_labor_budget_item_attributes_#{id_or_index}"+ name_prefix = "budget[#{new_or_existing}_labor_budget_item_attributes][#{id_or_index}]"classes ||= ""classes += " budget-row-template" if templated@@ -77,14 +77,14 @@ See docs/COPYRIGHT.rdoc for more details.<% if User.current.allowed_to?(:view_cost_rates, @project)%><td class="currency budget-table--fields"><%# Keep current budget as hidden field because otherwise they will be overridden %>- <% if templated == false && !labor_budget_item.new_record? && labor_budget_item.overridden_budget? %>- <%= cost_form.hidden_field :budget, value: unitless_currency_number(labor_budget_item.budget) %>+ <% if templated == false && !labor_budget_item.new_record? && labor_budget_item.overridden_costs? %>+ <%= cost_form.hidden_field :amount, value: unitless_currency_number(labor_budget_item.amount) %><% end %>- <% cost_value = labor_budget_item.budget || labor_budget_item.calculated_costs(@cost_object.fixed_date, @cost_object.project_id) %>- <%= cost_form.hidden_field :currency, index: id_or_index, value: Setting.plugin_openproject_costs['costs_currency'] %>+ <% cost_value = labor_budget_item.amount || labor_budget_item.calculated_costs(@budget.fixed_date, @budget.project_id) %>+ <%= cost_form.hidden_field :currency, index: id_or_index, value: Setting.plugin_costs['costs_currency'] %><cost-unit-subform obj-id="<%= id_prefix %>"- obj-name="<%= "#{name_prefix}[budget]" %>">+ obj-name="<%= "#{name_prefix}[amount]" %>"><a id="<%= "#{id_prefix}_costs" %>" class="costs--edit-planned-costs-btn icon-context icon-edit" title="<%= t(:help_click_to_edit) %>"><% if labor_budget_item.costs_visible_by?(User.current) %><%= cost_form.hidden_field :cost_value, index: id_or_index, value: unitless_currency_number(cost_value) %>diff --git a/modules/costs/app/views/cost_objects/items/_material_budget_item.html.erb b/modules/budgets/app/views/budgets/items/_material_budget_item.html.erbsimilarity index 86%rename from modules/costs/app/views/cost_objects/items/_material_budget_item.html.erbrename to modules/budgets/app/views/budgets/items/_material_budget_item.html.erbindex bca54116462..57f9dac95a7 100644--- a/modules/costs/app/views/cost_objects/items/_material_budget_item.html.erb+++ b/modules/budgets/app/views/budgets/items/_material_budget_item.html.erb@@ -32,9 +32,9 @@ See docs/COPYRIGHT.rdoc for more details.index ||= "INDEX"new_or_existing = material_budget_item.new_record? ? 'new' : 'existing'id_or_index = material_budget_item.new_record? ? index : material_budget_item.id- prefix = "cost_object[#{new_or_existing}_material_budget_item_attributes][]"- id_prefix = "cost_object_#{new_or_existing}_material_budget_item_attributes_#{id_or_index}"- name_prefix = "cost_object[#{new_or_existing}_material_budget_item_attributes][#{id_or_index}]"+ prefix = "budget[#{new_or_existing}_material_budget_item_attributes][]"+ id_prefix = "budget_#{new_or_existing}_material_budget_item_attributes_#{id_or_index}"+ name_prefix = "budget[#{new_or_existing}_material_budget_item_attributes][#{id_or_index}]"classes ||= ""classes += " budget-row-template" if templated@@ -79,16 +79,16 @@ See docs/COPYRIGHT.rdoc for more details.<% if User.current.allowed_to? :view_cost_rates, @project %><td class="currency budget-table--fields"><%# Keep current budget as hidden field because otherwise they will be overridden %>- <% if templated == false && !material_budget_item.new_record? && material_budget_item.overridden_budget? %>- <%= cost_form.hidden_field :budget, value: unitless_currency_number(material_budget_item.budget) %>+ <% if templated == false && !material_budget_item.new_record? && material_budget_item.overridden_costs? %>+ <%= cost_form.hidden_field :amount, value: unitless_currency_number(material_budget_item.amount) %><% end %>- <% cost_value = material_budget_item.budget || material_budget_item.calculated_costs(@cost_object.fixed_date) %>- <%= cost_form.hidden_field :currency, index: id_or_index, value: Setting.plugin_openproject_costs['costs_currency'] %>+ <% cost_value = material_budget_item.amount || material_budget_item.calculated_costs(@budget.fixed_date) %>+ <%= cost_form.hidden_field :currency, index: id_or_index, value: Setting.plugin_costs['costs_currency'] %><%= cost_form.hidden_field :cost_value, index: id_or_index, value: unitless_currency_number(cost_value) %><cost-unit-subform obj-id="<%= id_prefix %>"- obj-name="<%= "#{name_prefix}[budget]" %>">+ obj-name="<%= "#{name_prefix}[amount]" %>"><a id="<%= id_prefix %>_costs" class="costs--edit-planned-costs-btn icon-context icon-edit" role="button" title="<%= t(:help_click_to_edit) %>"><%= number_to_currency(cost_value) %></a>diff --git a/modules/costs/app/views/cost_objects/new.html.erb b/modules/budgets/app/views/budgets/new.html.erbsimilarity index 81%rename from modules/costs/app/views/cost_objects/new.html.erbrename to modules/budgets/app/views/budgets/new.html.erbindex 5b941c23395..eb5395c8c85 100644--- a/modules/costs/app/views/cost_objects/new.html.erb+++ b/modules/budgets/app/views/budgets/new.html.erb@@ -27,14 +27,14 @@ See docs/COPYRIGHT.rdoc for more details.++#%>-<% html_title(t(:label_cost_object_new)) %>-<%= toolbar title: t(:label_cost_object_new) %>--<%= labelled_tabular_form_for @cost_object,- :url => projects_cost_objects_path(@project),- :as => :cost_object,- :html => {:multipart => true, :id => 'cost_object_form'} do |f| %>- <%= error_messages_for 'cost_object' %>+<% html_title(t(:label_budget_new)) %>+<%= toolbar title: t(:label_budget_new) %>++<%= labelled_tabular_form_for @budget,+ :url => projects_budgets_path(@project),+ :as => :budget,+ :html => {:multipart => true, :id => 'budget_form'} do |f| %>+ <%= error_messages_for 'budget' %><%= render :partial => 'form', :locals => {:f => f} %><%= styled_button_tag t(:button_create), class: '-with-icon icon-checkmark' %><%= styled_button_tag t(:button_create_and_continue), :name => 'continue',diff --git a/modules/costs/app/views/cost_objects/show.html.erb b/modules/budgets/app/views/budgets/show.html.erbsimilarity index 58%rename from modules/costs/app/views/cost_objects/show.html.erbrename to modules/budgets/app/views/budgets/show.html.erbindex 934b281e27b..ca48e09af1d 100644--- a/modules/costs/app/views/cost_objects/show.html.erb+++ b/modules/budgets/app/views/budgets/show.html.erb@@ -27,27 +27,27 @@ See docs/COPYRIGHT.rdoc for more details.++#%>-<% html_title "#{t(:label_cost_object_id, id: @cost_object.id)}: #{@cost_object.subject}" %>-<%= toolbar title: t(:label_cost_object_id, id: @cost_object.id) do %>- <% if authorize_for(:cost_objects, :edit) %>+<% html_title "#{t(:label_budget_id, id: @budget.id)}: #{@budget.subject}" %>+<%= toolbar title: t(:label_budget_id, id: @budget.id) do %>+ <% if authorize_for(:budgets, :edit) %><li class="toolbar-item">- <%= link_to({ controller: 'cost_objects', action: 'edit', id: @cost_object }, class: 'button', accesskey: accesskey(:edit)) do %>+ <%= link_to({ controller: 'budgets', action: 'edit', id: @budget }, class: 'button', accesskey: accesskey(:edit)) do %><%= op_icon('button--icon icon-edit') %><span class="button--text"><%= l(:button_update) %></span><% end %></li><% end %>- <% if authorize_for(:cost_objects, :copy) %>+ <% if authorize_for(:budgets, :copy) %><li class="toolbar-item hidden-for-mobile">- <%= link_to({ controller: 'cost_objects', action: 'copy', id: @cost_object }, class: 'button') do %>+ <%= link_to({ controller: 'budgets', action: 'copy', id: @budget }, class: 'button') do %><%= op_icon('button--icon icon-copy') %><span class="button--text"><%= l(:button_copy) %></span><% end %></li><% end %>- <% if authorize_for(:cost_objects, :copy) %>+ <% if authorize_for(:budgets, :copy) %><li class="toolbar-item">- <%= link_to({ controller: 'cost_objects', action: 'destroy', id: @cost_object }, class: 'button', method: :delete, data: { confirm: t(:text_are_you_sure)}) do %>+ <%= link_to({ controller: 'budgets', action: 'destroy', id: @budget }, class: 'button', method: :delete, data: { confirm: t(:text_are_you_sure)}) do %><%= op_icon('button--icon icon-delete') %><span class="button--text"><%= t(:button_delete) %></span><% end %>@@ -55,43 +55,43 @@ See docs/COPYRIGHT.rdoc for more details.<% end %><% end %>-<div class="<%= @cost_object.css_classes %> details">- <h3><%=h @cost_object.subject %></h3>+<div class="<%= @budget.css_classes %> details">+ <h3><%=h @budget.subject %></h3><p class="author">- <%= authoring @cost_object.created_on, @cost_object.author %>.- <%= t(:label_updated_time, value: distance_of_time_in_words(Time.now, @cost_object.updated_on)) + '.' if @cost_object.created_on != @cost_object.updated_on %>+ <%= authoring @budget.created_at, @budget.author %>.+ <%= t(:label_updated_time, value: distance_of_time_in_words(Time.now, @budget.updated_at)) + '.' if @budget.created_at != @budget.updated_at %></p><div class="attributes-group"><div class="attributes-key-value">- <div class="attributes-key-value--key"><%= CostObject.human_attribute_name(:type) %></div>+ <div class="attributes-key-value--key"><%= Budget.human_attribute_name(:type) %></div><div class="attributes-key-value--value-container"><div class="attributes-key-value--value -text">- <span><%= @cost_object.type_label %></span>+ <span><%= @budget.type_label %></span></div></div>- <div class="attributes-key-value--key"><%= CostObject.human_attribute_name(:fixed_date) %></div>+ <div class="attributes-key-value--key"><%= Budget.human_attribute_name(:fixed_date) %></div><div class="attributes-key-value--value-container"><div class="attributes-key-value--value -text">- <span><%= format_date(@cost_object.fixed_date) %></span>+ <span><%= format_date(@budget.fixed_date) %></span></div></div>- <div class="attributes-key-value--key"><%= CostObject.human_attribute_name(:budget_ratio) %></div>+ <div class="attributes-key-value--key"><%= Budget.human_attribute_name(:budget_ratio) %></div><div class="attributes-key-value--value-container"><div class="attributes-key-value--value -text"><span>- <%= extended_progress_bar(@cost_object.budget_ratio,+ <%= extended_progress_bar(@budget.budget_ratio,:width => '80px',- :legend => @cost_object.budget_ratio) %>+ :legend => @budget.budget_ratio) %></span></div></div>- <% unless format_text(@cost_object, :description, :attachments => @cost_object.attachments).empty? %>- <div class="attributes-key-value--key"><%= CostObject.human_attribute_name(:description) %></div>+ <% unless format_text(@budget, :description, :attachments => @budget.attachments).empty? %>+ <div class="attributes-key-value--key"><%= Budget.human_attribute_name(:description) %></div><div class="attributes-key-value--value-container"><div class="attributes-key-value--value -text"><span>- <%= format_text @cost_object, :description, :attachments => @cost_object.attachments %>+ <%= format_text @budget, :description, :attachments => @budget.attachments %></span></div></div>@@ -99,15 +99,15 @@ See docs/COPYRIGHT.rdoc for more details.</div></div>- <% resource = budget_attachment_representer(@cost_object) %>+ <% resource = budget_attachment_representer(@budget) %><%= list_attachments(resource) %>- <%= render :partial => "show_variable_cost_object" %>+ <%= render :partial => "show" %></div><div style="clear: both;"></div>-<% if authorize_for('cost_objects', 'edit') %>+<% if authorize_for('budgets', 'edit') %><div id="update" style="display:none;"><h3><%= t(:button_update) %></h3><%= render :partial => 'edit' %>diff --git a/modules/costs/app/views/cost_objects/subform/_labor_budget_subform.html.erb b/modules/budgets/app/views/budgets/subform/_labor_budget_subform.html.erbsimilarity index 83%rename from modules/costs/app/views/cost_objects/subform/_labor_budget_subform.html.erbrename to modules/budgets/app/views/budgets/subform/_labor_budget_subform.html.erbindex bd8cac6199a..6a9dd1fd486 100644--- a/modules/costs/app/views/cost_objects/subform/_labor_budget_subform.html.erb+++ b/modules/budgets/app/views/budgets/subform/_labor_budget_subform.html.erb@@ -27,15 +27,15 @@ See docs/COPYRIGHT.rdoc for more details.++#%>-<%# we have to assign the cost_object here as following methods depend on the item having an object -%>-<% template_object = @cost_object.labor_budget_items.build.tap do |i|- i.cost_object = @cost_object+<%# we have to assign the budget here as following methods depend on the item having an object -%>+<% template_object = @budget.labor_budget_items.build.tap do |i|+ i.budget = @budgetend -%>-<costs-budget-subform item-count="<%= @cost_object.labor_budget_items.length %>"+<costs-budget-subform item-count="<%= @budget.labor_budget_items.length %>"update-url="<%= url_for(action: :update_labor_budget_item, project_id: @project.id) %>"><fieldset id="labor_budget_items_fieldset" class="form--fieldset -collapsible">- <legend class="form--fieldset-legend"><%= VariableCostObject.human_attribute_name(:labor_budget) %></legend>+ <legend class="form--fieldset-legend"><%= Budget.human_attribute_name(:labor_budget) %></legend><div class="generic-table--container"><div class="generic-table--results-container"><table class="generic-table" id="labor_budget_items">@@ -92,9 +92,9 @@ end -%></tr></thead><tbody id="labor_budget_items_body" class="budget-item-container">- <%= render partial: "cost_objects/items/labor_budget_item", object: template_object, locals: { templated: true } %>- <%- @cost_object.labor_budget_items.each_with_index do |labor_budget_item, index| -%>- <%= render partial: 'cost_objects/items/labor_budget_item', object: labor_budget_item, locals: {index: index} %>+ <%= render partial: "budgets/items/labor_budget_item", object: template_object, locals: { templated: true } %>+ <%- @budget.labor_budget_items.each_with_index do |labor_budget_item, index| -%>+ <%= render partial: 'budgets/items/labor_budget_item', object: labor_budget_item, locals: {index: index} %><%- end -%></tbody></table>diff --git a/modules/costs/app/views/cost_objects/subform/_material_budget_subform.html.erb b/modules/budgets/app/views/budgets/subform/_material_budget_subform.html.erbsimilarity index 86%rename from modules/costs/app/views/cost_objects/subform/_material_budget_subform.html.erbrename to modules/budgets/app/views/budgets/subform/_material_budget_subform.html.erbindex 198adaa6e68..1cebe6fd0af 100644--- a/modules/costs/app/views/cost_objects/subform/_material_budget_subform.html.erb+++ b/modules/budgets/app/views/budgets/subform/_material_budget_subform.html.erb@@ -29,12 +29,12 @@ See docs/COPYRIGHT.rdoc for more details.<% if CostType.exists? %><%# Build a template object for the frontend to add new rows %>- <% template_object = @cost_object.material_budget_items.build(cost_type: CostType.default) %>+ <% template_object = @budget.material_budget_items.build(cost_type: CostType.default) %>- <costs-budget-subform item-count="<%= @cost_object.material_budget_items.length %>"+ <costs-budget-subform item-count="<%= @budget.material_budget_items.length %>"update-url="<%= url_for(action: :update_material_budget_item, project_id: @project.id) %>"><fieldset id="material_budget_items_fieldset" class="form--fieldset -collapsible">- <legend class="form--fieldset-legend"><%= VariableCostObject.human_attribute_name(:material_budget) %></legend>+ <legend class="form--fieldset-legend"><%= Budget.human_attribute_name(:material_budget) %></legend><div class="generic-table--container"><div class="generic-table--results-container"><table class="generic-table" id="material_budget_items">@@ -100,9 +100,9 @@ See docs/COPYRIGHT.rdoc for more details.</tr></thead><tbody id="material_budget_items_body" class="budget-item-container">- <%= render partial: "cost_objects/items/material_budget_item", object: template_object, locals: { templated: true } %>- <%- @cost_object.material_budget_items.each_with_index do |material_budget_item, index| -%>- <%= render partial: 'cost_objects/items/material_budget_item', object: material_budget_item, locals: {index: index} %>+ <%= render partial: "budgets/items/material_budget_item", object: template_object, locals: { templated: true } %>+ <%- @budget.material_budget_items.each_with_index do |material_budget_item, index| -%>+ <%= render partial: 'budgets/items/material_budget_item', object: material_budget_item, locals: {index: index} %><%- end -%></tbody></table>diff --git a/modules/budgets/budgets.gemspec b/modules/budgets/budgets.gemspecnew file mode 100644index 00000000000..bd40b698ec8--- /dev/null+++ b/modules/budgets/budgets.gemspec@@ -0,0 +1,10 @@+# encoding: UTF-8++Gem::Specification.new do |s|+ s.name = "budgets"+ s.version = '1.0.0'+ s.authors = ["OpenProject"]+ s.summary = "OpenProject Budgets."++ s.files = Dir["{app,config,db,lib}/**/*"]+enddiff --git a/modules/budgets/config/locales/en.yml b/modules/budgets/config/locales/en.ymlnew file mode 100644index 00000000000..501ef03445a--- /dev/null+++ b/modules/budgets/config/locales/en.yml@@ -0,0 +1,89 @@+#-- copyright+# OpenProject is an open source project management software.+# Copyright (C) 2012-2020 the OpenProject GmbH+#+# This program is free software; you can redistribute it and/or+# modify it under the terms of the GNU General Public License version 3.+#+# OpenProject is a fork of ChiliProject, which is a fork of Redmine. The copyright follows:+# Copyright (C) 2006-2017 Jean-Philippe Lang+# Copyright (C) 2010-2013 the ChiliProject Team+#+# This program is free software; you can redistribute it and/or+# modify it under the terms of the GNU General Public License+# as published by the Free Software Foundation; either version 2+# of the License, or (at your option) any later version.+#+# This program is distributed in the hope that it will be useful,+# but WITHOUT ANY WARRANTY; without even the implied warranty of+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the+# GNU General Public License for more details.+#+# You should have received a copy of the GNU General Public License+# along with this program; if not, write to the Free Software+# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.+#+# See docs/COPYRIGHT.rdoc for more details.+#++++---+en:+ activerecord:+ attributes:+ budget:+ author: "Author"+ available: "Available"+ budget: "Planned"+ budget_ratio: "Spent (ratio)"+ created_on: "Created on"+ description: "Description"+ fixed_date: "Fixed date"+ spent: "Spent"+ status: "Status"+ subject: "Subject"+ type: "Cost type"+ updated_on: "Updated on"+ work_package:+ budget_subject: "Budget title"+ budget:+ labor_budget: "Planned labor costs"+ material_budget: "Planned unit costs"+ models:+ budget: "Budget"+ material_budget_item: "Unit"+ attributes:+ budget: "Planned costs"+ budget: "Budget"++ button_add_budget_item: "Add planned costs"+ button_add_budget: "Add budget"+ button_add_cost_type: "Add cost type"+ button_cancel_edit_budget: "Cancel editing budget"+ button_cancel_edit_costs: "Cancel editing costs"++ caption_labor: "Labor"+ caption_labor_costs: "Actual labor costs"+ caption_material_costs: "Actual unit costs"+ budgets_title: "Budgets"++ events:+ budget: "Budget edited"++ help_click_to_edit: "Click here to edit."+ help_currency_format: "Format of displayed currency values. %n is replaced with the currency value, %u ist replaced with the currency unit."+ help_override_rate: "Enter a value here to override the default rate."++ label_budget: "Budget"+ label_budget_new: "New budget"+ label_budget_plural: "Budgets"+ label_cost_type_specific: "Budget #%{id}: %{name}"+ label_deliverable: "Budget"+ label_view_all_budgets: "View all budgets"+ label_yes: "Yes"++ notice_budget_conflict: "WorkPackages must be of the same project."+ notice_no_budgets_available: "No budgets available."++ permission_edit_budgets: "Edit budgets"+ permission_view_budgets: "View budgets"+ project_module_budgets: "Budgets"diff --git a/modules/costs/lib/open_project/costs/hooks.rb b/modules/budgets/config/locales/js-en.ymlsimilarity index 94%rename from modules/costs/lib/open_project/costs/hooks.rbrename to modules/budgets/config/locales/js-en.ymlindex 48b54c4e318..f1b214c4dd4 100644--- a/modules/costs/lib/open_project/costs/hooks.rb+++ b/modules/budgets/config/locales/js-en.yml@@ -26,5 +26,8 @@# See docs/COPYRIGHT.rdoc for more details.#++-module OpenProject::Costs::Hooks-end+en:+ js:+ work_packages:+ properties:+ costObject: "Budget"diff --git a/modules/reporting/spec/routing/costlog_routing_spec.rb b/modules/budgets/config/routes.rbsimilarity index 74%rename from modules/reporting/spec/routing/costlog_routing_spec.rbrename to modules/budgets/config/routes.rbindex 2ab499f32f1..cee33fc3114 100644--- a/modules/reporting/spec/routing/costlog_routing_spec.rb+++ b/modules/budgets/config/routes.rb@@ -1,3 +1,5 @@+#-- encoding: UTF-8+#-- copyright# OpenProject is an open source project management software.# Copyright (C) 2012-2020 the OpenProject GmbH@@ -26,14 +28,15 @@# See docs/COPYRIGHT.rdoc for more details.#++-require 'spec_helper'+OpenProject::Application.routes.draw do+ scope 'projects/:project_id', as: 'projects' do+ resources :budgets, only: %i[new create index] do+ match :update_labor_budget_item, on: :collection, via: %i[get post]+ match :update_material_budget_item, on: :collection, via: %i[get post]+ end+ end-describe CostlogController, type: :routing do- describe 'routing' do- it {- expect(get('/work_packages/5/cost_entries')).to route_to(controller: 'work_package_costlog',- action: 'index',- work_package_id: '5')- }+ resources :budgets, only: %i[show update destroy edit] do+ get :copy, on: :memberendenddiff --git a/modules/costs/lib/open_project/costs/patches/specific_work_package_schema_patch.rb b/modules/budgets/db/migrate/20200807083950_keep_enabled_module.rbsimilarity index 72%rename from modules/costs/lib/open_project/costs/patches/specific_work_package_schema_patch.rbrename to modules/budgets/db/migrate/20200807083950_keep_enabled_module.rbindex f17abfc3ee7..fe34756c610 100644--- a/modules/costs/lib/open_project/costs/patches/specific_work_package_schema_patch.rb+++ b/modules/budgets/db/migrate/20200807083950_keep_enabled_module.rb@@ -1,3 +1,5 @@+#-- encoding: UTF-8+#-- copyright# OpenProject is an open source project management software.# Copyright (C) 2012-2020 the OpenProject GmbH@@ -26,26 +28,22 @@# See docs/COPYRIGHT.rdoc for more details.#++-require_dependency 'api/v3/work_packages/schema/specific_work_package_schema'+require Rails.root.to_s + '/db/migrate/migration_utils/module_renamer'-module OpenProject::Costs::Patches::SpecificWorkPackageSchemaPatch- def self.included(base)- base.class_eval do- prepend InstanceMethods- extend ClassMethods- end+class KeepEnabledModule < ActiveRecord::Migration[6.0]+ def up+ module_renamer.add_to_enabled('budgets', %w[costs_module])+ module_renamer.add_to_default('budgets', %w[costs_module])end- module ClassMethods+ def down+ module_renamer.remove_from_enabled('budgets')+ module_renamer.remove_from_default('budgets')end- module InstanceMethods- def assignable_values(property, _context)- if property == :cost_object- return project.try(:cost_objects)- end+ private- super- end+ def module_renamer+ Migration::MigrationUtils::ModuleRenamerendenddiff --git a/modules/budgets/db/migrate/20200810152654_rename_cost_object_to_budget.rb b/modules/budgets/db/migrate/20200810152654_rename_cost_object_to_budget.rbnew file mode 100644index 00000000000..4a7df9e8e7e--- /dev/null+++ b/modules/budgets/db/migrate/20200810152654_rename_cost_object_to_budget.rb@@ -0,0 +1,150 @@+class RenameCostObjectToBudget < ActiveRecord::Migration[6.0]+ def up+ remove_column :cost_objects, :type+ rename_table :cost_objects, :budgets++ execute <<~SQL+ UPDATE types+ SET attribute_groups = REGEXP_REPLACE(attribute_groups, ' cost_object', ' budget')+ WHERE attribute_groups LIKE '%cost_object%'+ SQL++ execute <<~SQL+ UPDATE role_permissions+ SET permission = 'view_budgets'+ WHERE permission = 'view_cost_objects'+ SQL++ execute <<~SQL+ UPDATE role_permissions+ SET permission = 'edit_budgets'+ WHERE permission = 'edit_cost_objects'+ SQL++ execute <<~SQL+ UPDATE journals+ SET activity_type = 'budgets'+ WHERE activity_type = 'cost_objects'+ SQL++ execute <<~SQL+ UPDATE attachments+ SET container_type = 'Budget'+ WHERE container_type = 'CostObject'+ SQL++ rename_in_queries('cost_object', 'budget')+ rename_in_cost_queries('CostObject', 'Budget')++ rename_column :budgets, :created_on, :created_at+ rename_column :budgets, :updated_on, :updated_at++ rename_table :cost_object_journals, :budget_journals+ remove_column :budget_journals, :created_on++ rename_column :work_packages, :cost_object_id, :budget_id+ rename_column :work_package_journals, :cost_object_id, :budget_id+ rename_column :labor_budget_items, :cost_object_id, :budget_id+ rename_column :labor_budget_items, :budget, :amount+ rename_column :material_budget_items, :cost_object_id, :budget_id+ rename_column :material_budget_items, :budget, :amount+ end++ def down+ rename_column :material_budget_items, :amount, :budget+ rename_column :material_budget_items, :budget_id, :cost_object_id+ rename_column :labor_budget_items, :amount, :budget+ rename_column :labor_budget_items, :budget_id, :cost_object_id+ rename_column :work_packages, :budget_id, :cost_object_id+ rename_column :work_package_journals, :budget_id, :cost_object_id++ add_column :budget_journals, :created_on, :timestamp+ rename_table :budget_journals, :cost_object_journals++ rename_column :budgets, :created_at, :created_on+ rename_column :budgets, :updated_at, :updated_on++ rename_in_queries('budget', 'cost_object')+ rename_in_cost_queries('Budget', 'CostObject')++ execute <<~SQL+ UPDATE attachments+ SET container_type = 'CostObject'+ WHERE container_type = 'Budget'+ SQL++ execute <<~SQL+ UPDATE journals+ SET activity_type = 'cost_objects'+ WHERE activity_type = 'budgets'+ SQL++ execute <<~SQL+ UPDATE role_permissions+ SET permission = 'view_cost_objects'+ WHERE permission = 'view_budgets'+ SQL++ execute <<~SQL+ UPDATE role_permissions+ SET permission = 'edit_cost_objects'+ WHERE permission = 'edit_budgets'+ SQL++ execute <<~SQL+ UPDATE types+ SET attribute_groups = REGEXP_REPLACE(attribute_groups, ' budget', ' cost_object')+ WHERE attribute_groups LIKE '%budget%'+ SQL++ add_column :budgets, :type, :string++ execute <<~SQL+ UPDATE budgets SET type = 'VariableCostObject'+ SQL++ change_column :budgets, :type, :string, null: false++ rename_table :budgets, :cost_objects+ end++ def rename_in_queries(old, new)+ execute <<~SQL+ UPDATE queries+ SET filters = REGEXP_REPLACE(filters, '#{old}_id:', '#{new}_id:')+ WHERE filters LIKE '%#{old}_id%'+ SQL++ execute <<~SQL+ UPDATE queries+ SET sort_criteria = REGEXP_REPLACE(sort_criteria, '#{old}', '#{new}')+ WHERE sort_criteria LIKE '%#{old}%'+ SQL++ execute <<~SQL+ UPDATE queries+ SET column_names = REGEXP_REPLACE(column_names, '#{old}', '#{new}')+ WHERE column_names LIKE '%#{old}%'+ SQL++ execute <<~SQL+ UPDATE queries+ SET group_by = REGEXP_REPLACE(group_by, '#{old}', '#{new}')+ WHERE group_by LIKE '%#{old}%'+ SQL++ execute <<~SQL+ UPDATE queries+ SET timeline_labels = REGEXP_REPLACE(timeline_labels, '#{old.camelize(:lower)}', '#{new.camelize(:lower)}')+ WHERE timeline_labels LIKE '%#{old.camelize(:lower)}%'+ SQL+ end++ def rename_in_cost_queries(old, new)+ execute <<~SQL+ UPDATE cost_queries+ SET serialized = REGEXP_REPLACE(serialized, '#{old}', '#{new}')+ WHERE serialized LIKE '%#{old}%'+ SQL+ end+enddiff --git a/modules/budgets/frontend/module/augment/cost-budget-subform.augment.service.ts b/modules/budgets/frontend/module/augment/cost-budget-subform.augment.service.tsnew file mode 100644index 00000000000..9935951dfc9--- /dev/null+++ b/modules/budgets/frontend/module/augment/cost-budget-subform.augment.service.ts@@ -0,0 +1,122 @@+// -- copyright+// OpenProject is an open source project management software.+// Copyright (C) 2012-2020 the OpenProject GmbH+//+// This program is free software; you can redistribute it and/or+// modify it under the terms of the GNU General Public License version 3.+//+// OpenProject is a fork of ChiliProject, which is a fork of Redmine. The copyright follows:+// Copyright (C) 2006-2013 Jean-Philippe Lang+// Copyright (C) 2010-2013 the ChiliProject Team+//+// This program is free software; you can redistribute it and/or+// modify it under the terms of the GNU General Public License+// as published by the Free Software Foundation; either version 2+// of the License, or (at your option) any later version.+//+// This program is distributed in the hope that it will be useful,+// but WITHOUT ANY WARRANTY; without even the implied warranty of+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the+// GNU General Public License for more details.+//+// You should have received a copy of the GNU General Public License+// along with this program; if not, write to the Free Software+// Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.+//+// See docs/COPYRIGHT.rdoc for more details.+// ++++import {Injectable} from "@angular/core";+import {HttpClient} from '@angular/common/http';+import {HalResourceNotificationService} from "core-app/modules/hal/services/hal-resource-notification.service";++@Injectable()+export class CostBudgetSubformAugmentService {++ constructor(private halNotification:HalResourceNotificationService,+ private http:HttpClient) {+ }++ listen() {+ jQuery('costs-budget-subform').each((i, match) => {+ let el = jQuery(match);++ const container = el.find('.budget-item-container');+ const templateEl = el.find('.budget-row-template');+ templateEl.detach();+ const template = templateEl[0].outerHTML;+ let rowIndex = parseInt(el.attr('item-count') as string);++ // Refresh row on changes+ el.on('change', '.budget-item-value', (evt) => {+ let row = jQuery(evt.target).closest('.cost_entry');+ this.refreshRow(el, row.attr('id') as string);+ });++ el.on('click', '.delete-budget-item', (evt) => {+ evt.preventDefault();+ jQuery(evt.target).closest('.cost_entry').remove();+ return false;+ });++ // Add new row handler+ el.find('.budget-add-row').click((evt) => {+ evt.preventDefault();+ let row = jQuery(template.replace(/INDEX/g, rowIndex.toString()));+ row.show();+ row.removeClass('budget-row-template');+ container.append(row);+ rowIndex += 1;+ return false;+ });+ });+ }++ /**+ * Refreshes the given row after updating values+ */+ public refreshRow(el:JQuery, row_identifier:string) {+ let row = el.find('#' + row_identifier);+ let request = this.buildRefreshRequest(row, row_identifier);++ this.http+ .post(+ el.attr('update-url')!,+ request,+ {+ headers: { 'Accept': 'application/json' },+ withCredentials: true+ })+ .subscribe(+ (data:any) => {+ _.each(data, (val:string, selector:string) => {+ let element = document.getElementById(selector) as HTMLElement|HTMLInputElement|undefined;+ if (element instanceof HTMLInputElement) {+ element.value = val;+ } else if (element) {+ element.textContent = val;+ }+ });+ },+ (error:any) => this.halNotification.handleRawError(error)+ );+ }++ /**+ * Returns the params for the update request+ */+ private buildRefreshRequest(row:JQuery, row_identifier:string) {+ let request:any = {+ element_id: row_identifier,+ fixed_date: jQuery('#budget_fixed_date').val()+ };++ // Augment common values with specific values for this type+ row.find('.budget-item-value').each((_i:number, el:any) => {+ let field = jQuery(el);+ request[field.data('requestKey')] = field.val() || '0';+ });++ return request;+ }+}diff --git a/modules/budgets/frontend/module/augment/cost-subform.augment.service.ts b/modules/budgets/frontend/module/augment/cost-subform.augment.service.tsnew file mode 100644index 00000000000..71564a76512--- /dev/null+++ b/modules/budgets/frontend/module/augment/cost-subform.augment.service.ts@@ -0,0 +1,67 @@+// -- copyright+// OpenProject is an open source project management software.+// Copyright (C) 2012-2020 the OpenProject GmbH+//+// This program is free software; you can redistribute it and/or+// modify it under the terms of the GNU General Public License version 3.+//+// OpenProject is a fork of ChiliProject, which is a fork of Redmine. The copyright follows:+// Copyright (C) 2006-2013 Jean-Philippe Lang+// Copyright (C) 2010-2013 the ChiliProject Team+//+// This program is free software; you can redistribute it and/or+// modify it under the terms of the GNU General Public License+// as published by the Free Software Foundation; either version 2+// of the License, or (at your option) any later version.+//+// This program is distributed in the hope that it will be useful,+// but WITHOUT ANY WARRANTY; without even the implied warranty of+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the+// GNU General Public License for more details.+//+// You should have received a copy of the GNU General Public License+// along with this program; if not, write to the Free Software+// Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.+//+// See docs/COPYRIGHT.rdoc for more details.+// ++++import {Injectable} from "@angular/core";++@Injectable()+export class CostSubformAugmentService {++ constructor() {+ jQuery('costs-subform').each((i, match) => {+ let el = jQuery(match);++ const container = el.find('.subform-container');++ const templateEl = el.find('.subform-row-template');+ templateEl.detach();+ const template = templateEl[0].outerHTML;+ let rowIndex = parseInt(el.attr('item-count')!);++ el.on('click', '.delete-row-button,.delete-budget-item', (evt:any) => {+ jQuery(evt.target).closest('.subform-row').remove();+ return false;+ });++ // Add new row handler+ el.find('.add-row-button,.wp-inline-create--add-link').click((evt:any) => {+ evt.preventDefault();+ let row = jQuery(template.replace(/INDEX/g, rowIndex.toString()));+ row.show();+ row.removeClass('subform-row-template');+ container.append(row);+ rowIndex += 1;++ container.find('.subform-row:last-child input:first').focus();++ return false;+ });+ });+ }+}++diff --git a/modules/budgets/frontend/module/augment/planned-costs-form.ts b/modules/budgets/frontend/module/augment/planned-costs-form.tsnew file mode 100644index 00000000000..8d0fdfde3cc--- /dev/null+++ b/modules/budgets/frontend/module/augment/planned-costs-form.ts@@ -0,0 +1,101 @@+// -- copyright+// OpenProject is an open source project management software.+// Copyright (C) 2012-2020 the OpenProject GmbH+//+// This program is free software; you can redistribute it and/or+// modify it under the terms of the GNU General Public License version 3.+//+// OpenProject is a fork of ChiliProject, which is a fork of Redmine. The copyright follows:+// Copyright (C) 2006-2013 Jean-Philippe Lang+// Copyright (C) 2010-2013 the ChiliProject Team+//+// This program is free software; you can redistribute it and/or+// modify it under the terms of the GNU General Public License+// as published by the Free Software Foundation; either version 2+// of the License, or (at your option) any later version.+//+// This program is distributed in the hope that it will be useful,+// but WITHOUT ANY WARRANTY; without even the implied warranty of+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the+// GNU General Public License for more details.+//+// You should have received a copy of the GNU General Public License+// along with this program; if not, write to the Free Software+// Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.+//+// See docs/COPYRIGHT.rdoc for more details.+// ++++export class PlannedCostsFormAugment {++ public obj:JQuery;+ public objId:string;+ public objName:string;++ static listen() {+ jQuery(document).on('click', '.costs--edit-planned-costs-btn', (evt) => {+ const form = jQuery(evt.target as any).closest('cost-unit-subform') as JQuery;+ new PlannedCostsFormAugment(form);+ });+ }++ constructor(public $element:JQuery) {+ this.objId = this.$element.attr('obj-id')!;+ this.objName = this.$element.attr('obj-name')!;+ this.obj = jQuery(`#${this.objId}_costs`) as any;++ this.makeEditable();+ }++ public makeEditable() {+ this.edit_and_focus();+ }++ private edit_and_focus() {+ this.edit();++ jQuery('#' + this.objId + '_costs_edit').trigger('focus');+ jQuery('#' + this.objId + '_costs_edit').trigger('select');+ }++ private getCurrency() {+ return jQuery('#' + this.objId + '_currency').val();+ }++ private getValue() {+ return jQuery('#' + this.objId + '_cost_value').val();+ }++ private edit() {+ this.obj.hide();++ let id = this.obj[0].id;+ let currency = this.getCurrency();+ let value = this.getValue();+ let name = this.objName;++ let template = `+ <section class="form--section" id="${id}_section">+ <div class="form--field">+ <div class="form--field-container">+ <div id="${id}_cancel" class="form--field-affix -transparent icon icon-close"></div>+ <div id="${id}_editor" class="form--text-field-container">+ <input id="${id}_edit" class="form--text-field" name="${name}" value="${value}" class="currency" type="text" />+ </div>+ <div class="form--field-affix" id="${id}_affix">${currency}</div>+ </div>+ </div>+ </section>+ `;++ jQuery(template).insertAfter(this.obj);++ let that = this;+ jQuery('#' + id + '_cancel').on('click', function () {+ jQuery('#' + id + '_section').remove();+ that.obj.show();+ return false;+ });+ }+}+diff --git a/modules/costs/frontend/module/hal/resources/budget-resource.ts b/modules/budgets/frontend/module/hal/resources/budget-resource.tssimilarity index 100%rename from modules/costs/frontend/module/hal/resources/budget-resource.tsrename to modules/budgets/frontend/module/hal/resources/budget-resource.tsdiff --git a/modules/budgets/frontend/module/main.ts b/modules/budgets/frontend/module/main.tsnew file mode 100644index 00000000000..ea3e083b6a0--- /dev/null+++ b/modules/budgets/frontend/module/main.ts@@ -0,0 +1,70 @@+// -- copyright+// OpenProject is an open source project management software.+// Copyright (C) 2012-2020 the OpenProject GmbH+//+// This program is free software; you can redistribute it and/or+// modify it under the terms of the GNU General Public License version 3.+//+// OpenProject is a fork of ChiliProject, which is a fork of Redmine. The copyright follows:+// Copyright (C) 2006-2013 Jean-Philippe Lang+// Copyright (C) 2010-2013 the ChiliProject Team+//+// This program is free software; you can redistribute it and/or+// modify it under the terms of the GNU General Public License+// as published by the Free Software Foundation; either version 2+// of the License, or (at your option) any later version.+//+// This program is distributed in the hope that it will be useful,+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the+// GNU General Public License for more details.+//+// You should have received a copy of the GNU General Public License+// along with this program; if not, write to the Free Software+// Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.+//+// See docs/COPYRIGHT.rdoc for more details.++import {Injector, NgModule} from '@angular/core';+import {OpenProjectPluginContext} from 'core-app/modules/plugins/plugin-context';+import {BudgetResource} from './hal/resources/budget-resource';+import {multiInput} from 'reactivestates';+import {CostSubformAugmentService} from "./augment/cost-subform.augment.service";+import {PlannedCostsFormAugment} from "core-app/modules/plugins/linked/budgets/augment/planned-costs-form";+import {CostBudgetSubformAugmentService} from "core-app/modules/plugins/linked/budgets/augment/cost-budget-subform.augment.service";++export function initializeCostsPlugin(injector:Injector) {+ window.OpenProject.getPluginContext().then((pluginContext:OpenProjectPluginContext) => {+ pluginContext.services.editField.extendFieldType('select', ['Budget']);++ let displayFieldService = pluginContext.services.displayField;+ displayFieldService.extendFieldType('resource', ['Budget']);++ let halResourceService = pluginContext.services.halResource;+ halResourceService.registerResource('Budget', {cls: BudgetResource});++ let states = pluginContext.services.states;+ states.add('budgets', multiInput<BudgetResource>());++ // Augment previous cost-subforms+ new CostSubformAugmentService();+ PlannedCostsFormAugment.listen();++ const budgetSubform = injector.get(CostBudgetSubformAugmentService);+ budgetSubform.listen();+ });+}+++@NgModule({+ providers: [+ CostBudgetSubformAugmentService,+ ],+})+export class PluginModule {+ constructor(injector:Injector) {+ initializeCostsPlugin(injector);+ }+}+++diff --git a/modules/costs/lib/api/v3/attachments/attachments_by_budget_api.rb b/modules/budgets/lib/api/v3/attachments/attachments_by_budget_api.rbsimilarity index 100%rename from modules/costs/lib/api/v3/attachments/attachments_by_budget_api.rbrename to modules/budgets/lib/api/v3/attachments/attachments_by_budget_api.rbdiff --git a/modules/costs/lib/api/v3/budgets/budget_collection_representer.rb b/modules/budgets/lib/api/v3/budgets/budget_collection_representer.rbsimilarity index 99%rename from modules/costs/lib/api/v3/budgets/budget_collection_representer.rbrename to modules/budgets/lib/api/v3/budgets/budget_collection_representer.rbindex a11ea1ceda3..1ba947d8581 100644--- a/modules/costs/lib/api/v3/budgets/budget_collection_representer.rb+++ b/modules/budgets/lib/api/v3/budgets/budget_collection_representer.rb@@ -1,4 +1,5 @@#-- encoding: UTF-8+#-- copyright# OpenProject is an open source project management software.# Copyright (C) 2012-2020 the OpenProject GmbHdiff --git a/modules/costs/lib/api/v3/budgets/budget_representer.rb b/modules/budgets/lib/api/v3/budgets/budget_representer.rbsimilarity index 97%rename from modules/costs/lib/api/v3/budgets/budget_representer.rbrename to modules/budgets/lib/api/v3/budgets/budget_representer.rbindex 7db3d81e353..3fe9df76932 100644--- a/modules/costs/lib/api/v3/budgets/budget_representer.rb+++ b/modules/budgets/lib/api/v3/budgets/budget_representer.rb@@ -39,8 +39,9 @@ module APIlink :staticPath donext if represented.new_record?+{- href: cost_object_path(represented.id)+ href: budget_path(represented.id)}enddiff --git a/modules/costs/lib/api/v3/budgets/budgets_api.rb b/modules/budgets/lib/api/v3/budgets/budgets_api.rbsimilarity index 92%rename from modules/costs/lib/api/v3/budgets/budgets_api.rbrename to modules/budgets/lib/api/v3/budgets/budgets_api.rbindex 72fa163d445..c6e9d765e24 100644--- a/modules/costs/lib/api/v3/budgets/budgets_api.rb+++ b/modules/budgets/lib/api/v3/budgets/budgets_api.rb@@ -1,4 +1,5 @@#-- encoding: UTF-8+#-- copyright# OpenProject is an open source project management software.# Copyright (C) 2012-2020 the OpenProject GmbH@@ -34,9 +35,9 @@ module APIresources :budgets doroute_param :id, type: Integer, desc: 'Budget ID' doafter_validation do- @budget = CostObject.find(params[:id])+ @budget = Budget.find(params[:id])- authorize_any([:view_work_packages, :view_budgets], projects: @budget.project)+ authorize_any(%i[view_work_packages view_budgets], projects: @budget.project)endget dodiff --git a/modules/costs/lib/api/v3/budgets/budgets_by_project_api.rb b/modules/budgets/lib/api/v3/budgets/budgets_by_project_api.rbsimilarity index 93%rename from modules/costs/lib/api/v3/budgets/budgets_by_project_api.rbrename to modules/budgets/lib/api/v3/budgets/budgets_by_project_api.rbindex 39b2edabaf4..933631cbf0d 100644--- a/modules/costs/lib/api/v3/budgets/budgets_by_project_api.rb+++ b/modules/budgets/lib/api/v3/budgets/budgets_by_project_api.rb@@ -1,4 +1,5 @@#-- encoding: UTF-8+#-- copyright# OpenProject is an open source project management software.# Copyright (C) 2012-2020 the OpenProject GmbH@@ -33,8 +34,8 @@ module APIclass BudgetsByProjectAPI < ::API::OpenProjectAPIresources :budgets doafter_validation do- authorize_any([:view_work_packages, :view_budgets], projects: @project)- @budgets = @project.cost_objects+ authorize_any(%i[view_work_packages view_budgets], projects: @project)+ @budgets = @project.budgetsendget dodiff --git a/modules/costs/lib/api/v3/queries/schemas/cost_object_filter_dependency_representer.rb b/modules/budgets/lib/api/v3/queries/schemas/budget_filter_dependency_representer.rbsimilarity index 96%rename from modules/costs/lib/api/v3/queries/schemas/cost_object_filter_dependency_representer.rbrename to modules/budgets/lib/api/v3/queries/schemas/budget_filter_dependency_representer.rbindex dd09c5536d1..e1b1ccd066d 100644--- a/modules/costs/lib/api/v3/queries/schemas/cost_object_filter_dependency_representer.rb+++ b/modules/budgets/lib/api/v3/queries/schemas/budget_filter_dependency_representer.rb@@ -30,9 +30,8 @@ module APImodule V3module Queriesmodule Schemas- class CostObjectFilterDependencyRepresenter <+ class BudgetFilterDependencyRepresenter <FilterDependencyRepresenter-def href_callbackapi_v3_paths.budgets_by_project filter.project.idenddiff --git a/modules/budgets/lib/budgets.rb b/modules/budgets/lib/budgets.rbnew file mode 100644index 00000000000..75ba9bbd1ad--- /dev/null+++ b/modules/budgets/lib/budgets.rb@@ -0,0 +1,4 @@+require "budgets/engine"++module Budgets+enddiff --git a/modules/budgets/lib/budgets/engine.rb b/modules/budgets/lib/budgets/engine.rbnew file mode 100644index 00000000000..29716bd3a63--- /dev/null+++ b/modules/budgets/lib/budgets/engine.rb@@ -0,0 +1,67 @@+module Budgets+ class Engine < ::Rails::Engine+ include OpenProject::Plugins::ActsAsOpEngine++ register 'budgets',+ author_url: 'https://www.openproject.com',+ bundled: true,+ name: 'Budgets' do+ project_module :budgets do+ permission :view_budgets, { budgets: %i[index show] }+ permission :edit_budgets, { budgets: %i[index show edit update destroy new create copy] }+ end++ menu :project_menu,+ :budgets,+ { controller: '/budgets', action: 'index' },+ param: :project_id,+ if: ->(project) { project.module_enabled?(:budgets) },+ after: :costs,+ caption: :budgets_title,+ icon: 'icon2 icon-budget'+ end++ activity_provider :budgets, class_name: 'Activities::BudgetActivityProvider', default: false++ add_api_path :budget do |id|+ "#{root}/budgets/#{id}"+ end++ add_api_path :budgets_by_project do |project_id|+ "#{project(project_id)}/budgets"+ end++ add_api_path :attachments_by_budget do |id|+ "#{budget(id)}/attachments"+ end++ add_api_endpoint 'API::V3::Root' do+ mount ::API::V3::Budgets::BudgetsAPI+ end++ add_api_endpoint 'API::V3::Projects::ProjectsAPI', :id do+ mount ::API::V3::Budgets::BudgetsByProjectAPI+ end++ initializer 'budgets.register_latest_project_activity' do+ Project.register_latest_project_activity on: 'Budget',+ attribute: :updated_at+ end++ initializer 'budgets.register_hooks' do+ # TODO: avoid hooks as this is part of the core now+ require 'budgets/hooks/work_package_hook'+ end++ config.to_prepare do+ # Add to the budget to the costs group+ ::Type.add_default_mapping(:costs, :budget)++ ::Type.add_constraint :budget, ->(_type, project: nil) {+ project.nil? || project.module_enabled?(:budgets)+ }++ Queries::Register.filter Query, Queries::WorkPackages::Filter::BudgetFilter+ end+ end+enddiff --git a/modules/costs/lib/open_project/costs/hooks/work_package_hook.rb b/modules/budgets/lib/budgets/hooks/work_package_hook.rbsimilarity index 51%rename from modules/costs/lib/open_project/costs/hooks/work_package_hook.rbrename to modules/budgets/lib/budgets/hooks/work_package_hook.rbindex bf5a336f781..fe091147bcd 100644--- a/modules/costs/lib/open_project/costs/hooks/work_package_hook.rb+++ b/modules/budgets/lib/budgets/hooks/work_package_hook.rb@@ -26,16 +26,7 @@# See docs/COPYRIGHT.rdoc for more details.#++-# Hooks to attach to the Redmine WorkPackages.-class OpenProject::Costs::Hooks::WorkPackageHook < Redmine::Hook::ViewListener- # Renders the Cost Object subject and basic costs information- # render_on :view_work_packages_show_details_bottom, :partial => 'hooks/costs/view_work_packages_show_details_bottom'-- # Renders a select tag with all the Cost Objects for the bulk edit page- render_on :view_work_packages_bulk_edit_details_bottom, partial: 'hooks/costs/view_work_packages_bulk_edit_details_bottom'-- render_on :view_work_packages_move_bottom, partial: 'hooks/costs/view_work_packages_move_bottom'-+class Budgets::Hooks::WorkPackageHook < Redmine::Hook::ViewListener# Updates the cost object after a move## Context:@@ -46,16 +37,16 @@ class OpenProject::Costs::Hooks::WorkPackageHook < Redmine::Hook::ViewListenerdef controller_work_packages_move_before_save(context = {})# FIXME: In case of copy==true, this will break stuff if the original work_package is saved- cost_object_id = context[:params] && context[:params][:cost_object_id]- case cost_object_id+ budget_id = context[:params] && context[:params][:budget_id]+ case budget_idwhen '' # a.k.a "(No change)"# cost objects HAVE to be changed if move is performed across project boundaries# as the are project specific- context[:work_package].cost_object_id = nil unless (context[:work_package].project == context[:target_project])+ context[:work_package].budget_id = nil unless context[:work_package].project == context[:target_project]when 'none'- context[:work_package].cost_object_id = nil+ context[:work_package].budget_id = nilelse- context[:work_package].cost_object_id = cost_object_id+ context[:work_package].budget_id = budget_idendend@@ -68,37 +59,15 @@ class OpenProject::Costs::Hooks::WorkPackageHook < Redmine::Hook::ViewListenerdef controller_work_packages_bulk_edit_before_save(context = {})case true- when context[:params][:cost_object_id].blank?+ when context[:params][:budget_id].blank?# Do nothing- when context[:params][:cost_object_id] == 'none'- # Unassign cost_object- context[:work_package].cost_object = nil+ when context[:params][:budget_id] == 'none'+ # Unassign budget+ context[:work_package].budget = nilelse- context[:work_package].cost_object = CostObject.find(context[:params][:cost_object_id])+ context[:work_package].budget = Budget.find(context[:params][:budget_id])end''end-- # Cost Object changes for the journal use the Cost Object subject- # instead of the id- #- # Context:- # * :detail => Detail about the journal change- #- def helper_work_packages_show_detail_after_setting(context = {})- # FIXME: Overwritting the caller is bad juju- if (context[:detail].prop_key == 'cost_object_id')- if context[:detail].value.to_i.to_s == context[:detail].value.to_s- d = CostObject.find_by_id(context[:detail].value)- context[:detail].value = d.subject unless d.nil? || d.subject.nil?- end-- if context[:detail].old_value.to_i.to_s == context[:detail].old_value.to_s- d = CostObject.find_by_id(context[:detail].old_value)- context[:detail].old_value = d.subject unless d.nil? || d.subject.nil?- end- end- ''- endenddiff --git a/modules/costs/spec/factories/cost_object_factory.rb b/modules/budgets/spec/factories/budget_factory.rbsimilarity index 84%rename from modules/costs/spec/factories/cost_object_factory.rbrename to modules/budgets/spec/factories/budget_factory.rbindex 3e8223dccad..bce635e2b61 100644--- a/modules/costs/spec/factories/cost_object_factory.rb+++ b/modules/budgets/spec/factories/budget_factory.rb@@ -27,13 +27,13 @@#++FactoryBot.define do- factory :cost_object do- subject { 'Some Cost Object' }- description { 'Some costs' }- kind { 'VariableCostObject' }+ factory :budget do+ sequence(:subject) { |n| "Budget No. #{n}" }+ sequence(:description) { |n| "I am Budget No. #{n}" }project+ association :author, factory: :userfixed_date { Date.today }- created_on { 3.days.ago }- updated_on { 3.days.ago }+ created_at { 3.days.ago }+ updated_at { 3.days.ago }endenddiff --git a/modules/costs/spec/factories/labor_budget_item_factory.rb b/modules/budgets/spec/factories/labor_budget_item_factory.rbsimilarity index 95%rename from modules/costs/spec/factories/labor_budget_item_factory.rbrename to modules/budgets/spec/factories/labor_budget_item_factory.rbindex 62723c639ea..f7c1c077492 100644--- a/modules/costs/spec/factories/labor_budget_item_factory.rb+++ b/modules/budgets/spec/factories/labor_budget_item_factory.rb@@ -29,7 +29,7 @@FactoryBot.define dofactory :labor_budget_item doassociation :user, factory: :user- association :cost_object, factory: :variable_cost_object+ association :budget, factory: :budgethours { 0.0 }endenddiff --git a/modules/costs/spec/factories/material_budget_item_factory.rb b/modules/budgets/spec/factories/material_budget_item_factory.rbsimilarity index 95%rename from modules/costs/spec/factories/material_budget_item_factory.rbrename to modules/budgets/spec/factories/material_budget_item_factory.rbindex df8d398a62b..b7baafa7a01 100644--- a/modules/costs/spec/factories/material_budget_item_factory.rb+++ b/modules/budgets/spec/factories/material_budget_item_factory.rb@@ -29,7 +29,7 @@FactoryBot.define dofactory :material_budget_item doassociation :cost_type, factory: :cost_type- association :cost_object, factory: :variable_cost_object+ association :budget, factory: :budgetunits { 0.0 }endenddiff --git a/modules/costs/spec/features/budgets/add_budget_spec.rb b/modules/budgets/spec/features/budgets/add_budget_spec.rbsimilarity index 93%rename from modules/costs/spec/features/budgets/add_budget_spec.rbrename to modules/budgets/spec/features/budgets/add_budget_spec.rbindex fae19ad7552..8a8a35c09f9 100644--- a/modules/costs/spec/features/budgets/add_budget_spec.rb+++ b/modules/budgets/spec/features/budgets/add_budget_spec.rb@@ -37,7 +37,7 @@ describe 'adding a new budget', type: :feature, js: true doendit 'shows link to create a new budget' do- visit projects_cost_objects_path(project)+ visit projects_budgets_path(project)click_on("Add budget")@@ -57,16 +57,16 @@ describe 'adding a new budget', type: :feature, js: true doit 'can switch between them' do- visit projects_cost_objects_path(project)+ visit projects_budgets_path(project)click_on("Add budget")expect(page).to have_content "New budget"fill_in 'Subject', with: 'My subject'- fill_in 'cost_object_new_material_budget_item_attributes_0_units', with: 15+ fill_in 'budget_new_material_budget_item_attributes_0_units', with: 15# change cost type- select 'Foobar', from: 'cost_object_new_material_budget_item_attributes_0_cost_type_id'+ select 'Foobar', from: 'budget_new_material_budget_item_attributes_0_cost_type_id'click_on "Create"@@ -79,7 +79,7 @@ describe 'adding a new budget', type: :feature, js: true doendit 'create the budget' do- visit new_projects_cost_object_path(project)+ visit new_projects_budget_path(project)fill_in("Subject", with: 'My subject')diff --git a/modules/costs/spec/features/budgets/attachment_upload_spec.rb b/modules/budgets/spec/features/budgets/attachment_upload_spec.rbsimilarity index 93%rename from modules/costs/spec/features/budgets/attachment_upload_spec.rbrename to modules/budgets/spec/features/budgets/attachment_upload_spec.rbindex 3962bd33058..b465a2ea894 100644--- a/modules/costs/spec/features/budgets/attachment_upload_spec.rb+++ b/modules/budgets/spec/features/budgets/attachment_upload_spec.rb@@ -35,8 +35,8 @@ describe 'Upload attachment to budget', js: true dolet(:user) doFactoryBot.create :user,member_in_project: project,- member_with_permissions: %i[view_cost_objects- edit_cost_objects]+ member_with_permissions: %i[view_budgets+ edit_budgets]endlet(:project) { FactoryBot.create(:project) }let(:attachments) { ::Components::Attachments.new }@@ -48,7 +48,7 @@ describe 'Upload attachment to budget', js: true doendit 'can upload an image to new and existing budgets via drag & drop' do- visit projects_cost_objects_path(project)+ visit projects_budgets_path(project)within '.toolbar-items' doclick_on "Budget"diff --git a/modules/costs/spec/features/budgets/update_budget_spec.rb b/modules/budgets/spec/features/budgets/update_budget_spec.rbsimilarity index 83%rename from modules/costs/spec/features/budgets/update_budget_spec.rbrename to modules/budgets/spec/features/budgets/update_budget_spec.rbindex a09057e1a52..2e5ad15d075 100644--- a/modules/costs/spec/features/budgets/update_budget_spec.rb+++ b/modules/budgets/spec/features/budgets/update_budget_spec.rb@@ -29,9 +29,9 @@require File.expand_path(File.dirname(__FILE__) + '/../../spec_helper.rb')describe 'updating a budget', type: :feature, js: true do- let(:project) { FactoryBot.create :project_with_types, enabled_module_names: %i[costs_module] }+ let(:project) { FactoryBot.create :project_with_types, enabled_module_names: %i[budgets costs] }let(:user) { FactoryBot.create :admin }- let(:budget) { FactoryBot.create :cost_object, author: user, project: project }+ let(:budget) { FactoryBot.create :budget, author: user, project: project }before dologin_as(user)@@ -81,14 +81,14 @@ describe 'updating a budget', type: :feature, js: true doFactoryBot.create :material_budget_item,units: 3,cost_type: cost_type,- cost_object: budget+ budget: budgetendlet(:labor_budget_item) doFactoryBot.create :labor_budget_item,hours: 5,user: user,- cost_object: budget+ budget: budgetendlet(:budget_page) { Pages::EditBudget.new budget.id }@@ -111,9 +111,11 @@ describe 'updating a budget', type: :feature, js: true dobudget_page.expect_planned_costs! type: :material, row: 1, expected: '150.00 EUR'budget_page.expect_planned_costs! type: :labor, row: 1, expected: '125.00 EUR'- budget_page.edit_unit_costs! material_budget_item.id, units: 5,+ budget_page.edit_unit_costs! material_budget_item.id,+ units: 5,comment: 'updated num stimpaks'- budget_page.edit_labor_costs! labor_budget_item.id, hours: 3,+ budget_page.edit_labor_costs! labor_budget_item.id,+ hours: 3,user_name: user.name,comment: 'updated treatment duration'@@ -145,8 +147,8 @@ describe 'updating a budget', type: :feature, js: true doFactoryBot.create :material_budget_item,units: 3,cost_type: cost_type2,- cost_object: budget,- budget: 1000.0+ budget: budget,+ amount: 1000.0endit 'retains the overridden budget when opening, but not editing (Regression #32822)' do@@ -160,7 +162,7 @@ describe 'updating a budget', type: :feature, js: true do# Open first itembudget_page.open_edit_planned_costs! material_budget_item.id, type: :material- expect(page).to have_field("cost_object_existing_material_budget_item_attributes_#{material_budget_item.id}_costs_edit")+ expect(page).to have_field("budget_existing_material_budget_item_attributes_#{material_budget_item.id}_costs_edit")click_on 'OK'expect(budget_page).to have_content("Erfolgreich aktualisiert.")@@ -173,9 +175,10 @@ describe 'updating a budget', type: :feature, js: true docontext 'with two material budget items' dolet!(:material_budget_item_2) do- FactoryBot.create :material_budget_item, units: 5,+ FactoryBot.create :material_budget_item,+ units: 5,cost_type: cost_type,- cost_object: budget+ budget: budgetendit 'keeps previous planned material costs (Regression test #27692)' do@@ -200,19 +203,19 @@ describe 'updating a budget', type: :feature, js: true domaterial_budget_item_2.reload# Expect budget == costs- expect(material_budget_item.budget).to eq(123.0)- expect(material_budget_item.overridden_budget?).to be_truthy+ expect(material_budget_item.amount).to eq(123.0)+ expect(material_budget_item.overridden_costs?).to be_truthyexpect(material_budget_item.costs).to eq(123.0)- expect(material_budget_item_2.budget).to eq(543.0)- expect(material_budget_item_2.overridden_budget?).to be_truthy+ expect(material_budget_item_2.amount).to eq(543.0)+ expect(material_budget_item_2.overridden_costs?).to be_truthyexpect(material_budget_item_2.costs).to eq(543.0)endcontext 'with a reversed currency format' dobefore doallow(Setting)- .to receive(:plugin_openproject_costs)- .and_return({costs_currency_format: '%u %n', costs_currency: 'USD'}.with_indifferent_access)+ .to receive(:plugin_costs)+ .and_return({ costs_currency_format: '%u %n', costs_currency: 'USD' }.with_indifferent_access)endit 'can still update budgets (Regression test #32664)' do@@ -237,11 +240,11 @@ describe 'updating a budget', type: :feature, js: true domaterial_budget_item_2.reload# Expect budget == costs- expect(material_budget_item.budget).to eq(123.0)- expect(material_budget_item.overridden_budget?).to be_truthy+ expect(material_budget_item.amount).to eq(123.0)+ expect(material_budget_item.overridden_costs?).to be_truthyexpect(material_budget_item.costs).to eq(123.0)- expect(material_budget_item_2.budget).to eq(543.0)- expect(material_budget_item_2.overridden_budget?).to be_truthy+ expect(material_budget_item_2.amount).to eq(543.0)+ expect(material_budget_item_2.overridden_costs?).to be_truthyexpect(material_budget_item_2.costs).to eq(543.0)endend@@ -249,9 +252,10 @@ describe 'updating a budget', type: :feature, js: true docontext 'with two labor budget items' dolet!(:labor_budget_item_2) do- FactoryBot.create :labor_budget_item, hours: 5,+ FactoryBot.create :labor_budget_item,+ hours: 5,user: user,- cost_object: budget+ budget: budgetendit 'keeps previous planned labor costs (Regression test #27692)' do@@ -276,20 +280,19 @@ describe 'updating a budget', type: :feature, js: true dolabor_budget_item_2.reload# Expect budget == costs- expect(labor_budget_item.budget).to eq(456.0)- expect(labor_budget_item.overridden_budget?).to be_truthy+ expect(labor_budget_item.amount).to eq(456.0)+ expect(labor_budget_item.overridden_costs?).to be_truthyexpect(labor_budget_item.costs).to eq(456.0)- expect(labor_budget_item_2.budget).to eq(987.0)- expect(labor_budget_item_2.overridden_budget?).to be_truthy+ expect(labor_budget_item_2.amount).to eq(987.0)+ expect(labor_budget_item_2.overridden_costs?).to be_truthyexpect(labor_budget_item_2.costs).to eq(987.0)endcontext 'with a reversed currency format' do-before doallow(Setting)- .to receive(:plugin_openproject_costs)- .and_return({costs_currency_format: '%u %n', costs_currency: 'USD'}.with_indifferent_access)+ .to receive(:plugin_costs)+ .and_return({ costs_currency_format: '%u %n', costs_currency: 'USD' }.with_indifferent_access)endit 'can still update budgets (Regression test #32664)' do@@ -314,11 +317,11 @@ describe 'updating a budget', type: :feature, js: true dolabor_budget_item_2.reload# Expect budget == costs- expect(labor_budget_item.budget).to eq(456.0)- expect(labor_budget_item.overridden_budget?).to be_truthy+ expect(labor_budget_item.amount).to eq(456.0)+ expect(labor_budget_item.overridden_costs?).to be_truthyexpect(labor_budget_item.costs).to eq(456.0)- expect(labor_budget_item_2.budget).to eq(987.0)- expect(labor_budget_item_2.overridden_budget?).to be_truthy+ expect(labor_budget_item_2.amount).to eq(987.0)+ expect(labor_budget_item_2.overridden_costs?).to be_truthyexpect(labor_budget_item_2.costs).to eq(987.0)endend@@ -329,7 +332,7 @@ describe 'updating a budget', type: :feature, js: true doclick_on 'Update'- page.find("#cost_object_existing_labor_budget_item_attributes_#{labor_budget_item.id} a.delete-budget-item").click+ page.find("#budget_existing_labor_budget_item_attributes_#{labor_budget_item.id} a.delete-budget-item").clickclick_on 'Submit'expect(budget_page.labor_costs_at(1)).not_to have_content '125.00 EUR'diff --git a/modules/costs/spec/features/costs_edit_fields_spec.rb b/modules/budgets/spec/features/costs_edit_fields_spec.rbsimilarity index 84%rename from modules/costs/spec/features/costs_edit_fields_spec.rbrename to modules/budgets/spec/features/costs_edit_fields_spec.rbindex a65d68157a7..3a537ced9e0 100644--- a/modules/costs/spec/features/costs_edit_fields_spec.rb+++ b/modules/budgets/spec/features/costs_edit_fields_spec.rb@@ -28,13 +28,13 @@require File.expand_path(File.dirname(__FILE__) + '/../spec_helper.rb')-describe 'Work Package cost fields', type: :feature, js: true do+describe 'Work Package budget fields', type: :feature, js: true dolet(:type_task) { FactoryBot.create(:type_task) }let!(:status) { FactoryBot.create(:status, is_default: true) }let!(:priority) { FactoryBot.create(:priority, is_default: true) }let!(:project) { FactoryBot.create(:project, types: [type_task]) }let(:user) { FactoryBot.create :admin }- let!(:budget) { FactoryBot.create :cost_object, author: user, project: project }+ let!(:budget) { FactoryBot.create :budget, author: user, project: project }let(:create_page) { ::Pages::FullWorkPackageCreate.new(project: project) }let(:view_page) { ::Pages::FullWorkPackage.new(project: project) }@@ -43,15 +43,15 @@ describe 'Work Package cost fields', type: :feature, js: true dologin_as(user)end- it 'does not show read-only fields and allows setting the cost object' do+ it 'does not show read-only fields and allows setting the budget' docreate_page.visit!- expect(page).to have_selector('.inline-edit--container.costObject')+ expect(page).to have_selector('.inline-edit--container.budget')expect(page).to have_no_selector('.inline-edit--container.laborCosts')expect(page).to have_no_selector('.inline-edit--container.materialCosts')expect(page).to have_no_selector('.inline-edit--container.overallCosts')- field = create_page.edit_field(:costObject)+ field = create_page.edit_field(:budget)field.set_value budget.namepage.find('.ng-dropdown-panel .ng-option', text: budget.name).click@@ -62,6 +62,6 @@ describe 'Work Package cost fields', type: :feature, js: true doview_page.expect_notification(message: "Successful creation.")- view_page.edit_field(:costObject).expect_display_value budget.name+ view_page.edit_field(:budget).expect_display_value budget.nameendenddiff --git a/modules/costs/spec/features/work_package_filter_spec.rb b/modules/budgets/spec/features/work_package_filter_spec.rbsimilarity index 84%rename from modules/costs/spec/features/work_package_filter_spec.rbrename to modules/budgets/spec/features/work_package_filter_spec.rbindex 05cc5b499fd..efda0a441be 100644--- a/modules/costs/spec/features/work_package_filter_spec.rb+++ b/modules/budgets/spec/features/work_package_filter_spec.rb@@ -37,27 +37,27 @@ describe 'Filter by budget', js: true dolet(:member) doFactoryBot.create(:member,- user: user,- project: project,- roles: [FactoryBot.create(:role)])+ user: user,+ project: project,+ roles: [FactoryBot.create(:role)])endlet(:status) doFactoryBot.create(:status)endlet(:budget) do- FactoryBot.create(:cost_object, project: project)+ FactoryBot.create(:budget, project: project)endlet(:work_package_with_budget) doFactoryBot.create(:work_package,- project: project,- cost_object: budget)+ project: project,+ budget: budget)endlet(:work_package_without_budget) doFactoryBot.create(:work_package,- project: project)+ project: project)endbefore do@@ -75,7 +75,7 @@ describe 'Filter by budget', js: true dofilters.expect_filter_count 1filters.open- filters.add_filter_by('Budget', 'is', budget.name, 'costObject')+ filters.add_filter_by('Budget', 'is', budget.name)wp_table.expect_work_package_listed work_package_with_budgetwp_table.ensure_work_package_not_listed! work_package_without_budget@@ -84,7 +84,7 @@ describe 'Filter by budget', js: true dowp_table.expect_and_dismiss_notification message: 'Successful creation.'- filters.remove_filter 'costObject'+ filters.remove_filter 'budget'wp_table.expect_work_package_listed work_package_with_budget, work_package_without_budget@@ -97,6 +97,6 @@ describe 'Filter by budget', js: true dofilters.open- filters.expect_filter_by('Budget', 'is', budget.name, 'costObject')+ filters.expect_filter_by('Budget', 'is', budget.name)endenddiff --git a/modules/budgets/spec/helpers/budgets_helper_spec.rb b/modules/budgets/spec/helpers/budgets_helper_spec.rbnew file mode 100644index 00000000000..0a351fce6b6--- /dev/null+++ b/modules/budgets/spec/helpers/budgets_helper_spec.rb@@ -0,0 +1,74 @@+#-- copyright+# OpenProject is an open source project management software.+# Copyright (C) 2012-2020 the OpenProject GmbH+#+# This program is free software; you can redistribute it and/or+# modify it under the terms of the GNU General Public License version 3.+#+# OpenProject is a fork of ChiliProject, which is a fork of Redmine. The copyright follows:+# Copyright (C) 2006-2017 Jean-Philippe Lang+# Copyright (C) 2010-2013 the ChiliProject Team+#+# This program is free software; you can redistribute it and/or+# modify it under the terms of the GNU General Public License+# as published by the Free Software Foundation; either version 2+# of the License, or (at your option) any later version.+#+# This program is distributed in the hope that it will be useful,+# but WITHOUT ANY WARRANTY; without even the implied warranty of+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the+# GNU General Public License for more details.+#+# You should have received a copy of the GNU General Public License+# along with this program; if not, write to the Free Software+# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.+#+# See docs/COPYRIGHT.rdoc for more details.+#++++require File.dirname(__FILE__) + '/../spec_helper'++describe BudgetsHelper, type: :helper do+ let(:project) { FactoryBot.build(:project) }+ let(:budget) { FactoryBot.build(:budget, project: project) }++ describe '#budgets_to_csv' do+ describe 'WITH a list of one cost object' do+ it 'should output the cost objects attributes' do+ expected = [+ budget.id,+ budget.project.name,+ budget.subject,+ budget.author.name,+ helper.format_date(budget.fixed_date),+ helper.number_to_currency(budget.material_budget),+ helper.number_to_currency(budget.labor_budget),+ helper.number_to_currency(budget.spent),+ helper.format_time(budget.created_at),+ helper.format_time(budget.updated_at),+ budget.description+ ].join(I18n.t(:general_csv_separator))++ expect(budgets_to_csv([budget]).include?(expected)).to be_truthy+ end++ it 'should start with a header explaining the fields' do+ expected = [+ '#',+ Project.model_name.human,+ Budget.human_attribute_name(:subject),+ Budget.human_attribute_name(:author),+ Budget.human_attribute_name(:fixed_date),+ Budget.human_attribute_name(:material_budget),+ Budget.human_attribute_name(:labor_budget),+ Budget.human_attribute_name(:spent),+ Budget.human_attribute_name(:created_at),+ Budget.human_attribute_name(:updated_at),+ Budget.human_attribute_name(:description)+ ].join(I18n.t(:general_csv_separator))++ expect(budgets_to_csv([budget]).start_with?(expected)).to be_truthy+ end+ end+ end+enddiff --git a/modules/costs/spec/lib/api/v3/budgets/budget_representer_spec.rb b/modules/budgets/spec/lib/api/v3/budgets/budget_representer_spec.rbsimilarity index 94%rename from modules/costs/spec/lib/api/v3/budgets/budget_representer_spec.rbrename to modules/budgets/spec/lib/api/v3/budgets/budget_representer_spec.rbindex f58b90b361f..13439b55d9c 100644--- a/modules/costs/spec/lib/api/v3/budgets/budget_representer_spec.rb+++ b/modules/budgets/spec/lib/api/v3/budgets/budget_representer_spec.rb@@ -39,11 +39,11 @@ describe ::API::V3::Budgets::BudgetRepresenter doupdated_on: Date.today)endlet(:budget) do- FactoryBot.create(:cost_object,+ FactoryBot.create(:budget,author: user,project: project,- created_on: 1.day.ago,- updated_on: Date.today)+ created_at: 1.day.ago,+ updated_at: Date.today)endlet(:representer) { described_class.new(budget, current_user: user) }@@ -68,7 +68,7 @@ describe ::API::V3::Budgets::BudgetRepresenter dolet(:link) { :addAttachment }let(:href) { api_v3_paths.attachments_by_budget budget.id }let(:method) { :post }- let(:permission) { :edit_cost_objects }+ let(:permission) { :edit_budgets }endit 'indicates its type' dodiff --git a/modules/costs/spec/lib/api/v3/work_packages/specific_work_package_schema_spec.rb b/modules/budgets/spec/lib/api/v3/path_helper_spec.rbsimilarity index 65%rename from modules/costs/spec/lib/api/v3/work_packages/specific_work_package_schema_spec.rbrename to modules/budgets/spec/lib/api/v3/path_helper_spec.rbindex 511f9139f7f..03a4ccdb7f0 100644--- a/modules/costs/spec/lib/api/v3/work_packages/specific_work_package_schema_spec.rb+++ b/modules/budgets/spec/lib/api/v3/path_helper_spec.rb@@ -28,22 +28,30 @@require 'spec_helper'-describe ::API::V3::WorkPackages::Schema::SpecificWorkPackageSchema do- let(:project) {- FactoryBot.build(:project)- }- let(:type) { FactoryBot.build(:type) }- let(:work_package) { FactoryBot.build(:work_package, project: project, type: type) }-- describe '#assignable_cost_objects' do- subject { described_class.new(work_package: work_package) }-- before do- allow(project).to receive(:budgets).and_return(double('CostObjects'))- end-- it 'returns project.cost_objects' do- expect(subject.assignable_values(:cost_object, nil)).to eql(project.cost_objects)- end+describe ::API::V3::Utilities::PathHelper do+ let(:helper) { Class.new.tap { |c| c.extend(described_class) }.api_v3_paths }++ describe '#budget' do+ subject { helper.budget 42 }++ it { is_expected.to eql('/api/v3/budgets/42') }+ end++ describe '#budget' do+ subject { helper.budget 42 }++ it { is_expected.to eql('/api/v3/budgets/42') }+ end++ describe '#budgets_by_project' do+ subject { helper.budgets_by_project 42 }++ it { is_expected.to eql('/api/v3/projects/42/budgets') }+ end++ describe '#attachments_by_budget' do+ subject { helper.attachments_by_budget 42 }++ it { is_expected.to eql('/api/v3/budgets/42/attachments') }endenddiff --git a/modules/costs/spec/lib/api/v3/queries/schemas/cost_object_dependency_representer_spec.rb b/modules/budgets/spec/lib/api/v3/queries/schemas/cost_object_dependency_representer_spec.rbsimilarity index 94%rename from modules/costs/spec/lib/api/v3/queries/schemas/cost_object_dependency_representer_spec.rbrename to modules/budgets/spec/lib/api/v3/queries/schemas/cost_object_dependency_representer_spec.rbindex 1051e21d117..a197788ab84 100644--- a/modules/costs/spec/lib/api/v3/queries/schemas/cost_object_dependency_representer_spec.rb+++ b/modules/budgets/spec/lib/api/v3/queries/schemas/cost_object_dependency_representer_spec.rb@@ -28,11 +28,11 @@require 'spec_helper'-describe ::API::V3::Queries::Schemas::CostObjectFilterDependencyRepresenter, clear_cache: true do+describe ::API::V3::Queries::Schemas::BudgetFilterDependencyRepresenter, clear_cache: true doinclude ::API::V3::Utilities::PathHelperlet(:project) { FactoryBot.build_stubbed(:project) }- let(:filter) { OpenProject::Costs::WorkPackageFilter.create!(context: project) }+ let(:filter) { Queries::WorkPackages::Filter::BudgetFilter.create!(context: project) }let(:form_embedded) { false }let(:instance) dodiff --git a/modules/costs/spec/models/variable_cost_object_spec.rb b/modules/budgets/spec/models/budget_spec.rbsimilarity index 77%rename from modules/costs/spec/models/variable_cost_object_spec.rbrename to modules/budgets/spec/models/budget_spec.rbindex 4c34501f792..e6eb80bba66 100644--- a/modules/costs/spec/models/variable_cost_object_spec.rb+++ b/modules/budgets/spec/models/budget_spec.rb@@ -28,35 +28,35 @@require File.dirname(__FILE__) + '/../spec_helper'-describe VariableCostObject, type: :model do- let(:cost_object) { FactoryBot.build(:variable_cost_object, project: project) }+describe Budget, type: :model do+ let(:budget) { FactoryBot.build(:budget, project: project) }let(:type) { FactoryBot.create(:type_feature) }let(:project) { FactoryBot.create(:project_with_types) }let(:user) { FactoryBot.create(:user) }describe 'initialization' do- let(:cost_object) { VariableCostObject.new }+ let(:budget) { Budget.new }before doallow(User).to receive(:current).and_return(user)end- it { expect(cost_object.author).to eq(user) }+ it { expect(budget.author).to eq(user) }enddescribe 'destroy' dolet(:work_package) { FactoryBot.create(:work_package, project: project) }before do- cost_object.author = user- cost_object.work_packages = [work_package]- cost_object.save!+ budget.author = user+ budget.work_packages = [work_package]+ budget.save!- cost_object.destroy+ budget.destroyend- it { expect(VariableCostObject.find_by_id(cost_object.id)).to be_nil }+ it { expect(Budget.find_by_id(budget.id)).to be_nil }it { expect(WorkPackage.find_by_id(work_package.id)).to eq(work_package) }- it { expect(work_package.reload.cost_object).to be_nil }+ it { expect(work_package.reload.budget).to be_nil }endenddiff --git a/modules/costs/spec/models/labor_budget_item_spec.rb b/modules/budgets/spec/models/labor_budget_item_spec.rbsimilarity index 87%rename from modules/costs/spec/models/labor_budget_item_spec.rbrename to modules/budgets/spec/models/labor_budget_item_spec.rbindex 3beb38644b7..45e1c12dc68 100644--- a/modules/costs/spec/models/labor_budget_item_spec.rb+++ b/modules/budgets/spec/models/labor_budget_item_spec.rb@@ -29,20 +29,26 @@require File.dirname(__FILE__) + '/../spec_helper'describe LaborBudgetItem, type: :model do- include Cost::PluginSpecHelper- let(:item) { FactoryBot.build(:labor_budget_item, cost_object: cost_object, user: user) }- let(:cost_object) { FactoryBot.build(:variable_cost_object, project: project) }+ let(:item) { FactoryBot.build(:labor_budget_item, budget: budget, user: user) }+ let(:budget) { FactoryBot.build(:budget, project: project) }let(:user) { FactoryBot.create(:user) }let(:user2) { FactoryBot.create(:user) }- let(:rate) {+ let(:rate) doFactoryBot.create(:hourly_rate, user: user,- valid_from: Date.today - 4.days,- rate: 400.0,- project: project)- }+ valid_from: Date.today - 4.days,+ rate: 400.0,+ project: project)+ endlet(:project) { FactoryBot.create(:valid_project) }let(:project2) { FactoryBot.create(:valid_project) }+ def is_member(project, user, permissions)+ FactoryBot.create(:member,+ project: project,+ user: user,+ roles: [FactoryBot.create(:role, permissions: permissions)])+ end+describe '#calculated_costs' dolet(:default_costs) { '0.0'.to_f }@@ -130,7 +136,7 @@ describe LaborBudgetItem, type: :model doenddescribe '#valid?' do- describe 'WHEN hours, cost_object and user are provided' do+ describe 'WHEN hours, budget and user are provided' doit 'should be valid' doexpect(item).to be_validend@@ -158,14 +164,14 @@ describe LaborBudgetItem, type: :model doendend- describe 'WHEN no cost_object is provided' do+ describe 'WHEN no budget is provided' dobefore do- item.cost_object = nil+ item.budget = nilendit 'should not be valid' doexpect(item).not_to be_valid- expect(item.errors[:cost_object]).to eq([I18n.t('activerecord.errors.messages.blank')])+ expect(item.errors[:budget]).to eq([I18n.t('activerecord.errors.messages.blank')])endend@@ -183,7 +189,7 @@ describe LaborBudgetItem, type: :model dodescribe '#costs_visible_by?' dobefore do- project.enabled_module_names = project.enabled_module_names << 'costs_module'+ project.enabled_module_names = project.enabled_module_names << 'costs'enddescribe "WHEN the item is assigned to the userdiff --git a/modules/budgets/spec/models/permitted_params_spec.rb b/modules/budgets/spec/models/permitted_params_spec.rbnew file mode 100644index 00000000000..c91798ca12c--- /dev/null+++ b/modules/budgets/spec/models/permitted_params_spec.rb@@ -0,0 +1,141 @@+#-- copyright+# OpenProject is an open source project management software.+# Copyright (C) 2012-2020 the OpenProject GmbH+#+# This program is free software; you can redistribute it and/or+# modify it under the terms of the GNU General Public License version 3.+#+# OpenProject is a fork of ChiliProject, which is a fork of Redmine. The copyright follows:+# Copyright (C) 2006-2017 Jean-Philippe Lang+# Copyright (C) 2010-2013 the ChiliProject Team+#+# This program is free software; you can redistribute it and/or+# modify it under the terms of the GNU General Public License+# as published by the Free Software Foundation; either version 2+# of the License, or (at your option) any later version.+#+# This program is distributed in the hope that it will be useful,+# but WITHOUT ANY WARRANTY; without even the implied warranty of+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the+# GNU General Public License for more details.+#+# You should have received a copy of the GNU General Public License+# along with this program; if not, write to the Free Software+# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.+#+# See docs/COPYRIGHT.rdoc for more details.+#++++require 'spec_helper'++describe PermittedParams, type: :model do+ let(:user) { FactoryBot.build(:user) }++ shared_examples_for 'allows params' do+ let(:params_key) { defined?(hash_key) ? hash_key : attribute }+ let(:params) do+ nested_params = if defined?(nested_key)+ { nested_key => hash }+ else+ hash+ end++ ac_params = if defined?(flat) && flat+ nested_params+ else+ { params_key => nested_params }+ end++ ActionController::Parameters.new(ac_params)+ end++ subject { PermittedParams.new(params, user).send(attribute).to_h }++ it do+ expected = defined?(allowed_params) ? allowed_params : hash+ expect(subject).to eq(expected)+ end+ end++ describe '#budget' do+ let(:attribute) { :budget }++ context 'subject' do+ let(:hash) { { 'subject' => 'subject_test' } }++ it_behaves_like 'allows params'+ end++ context 'description' do+ let(:hash) { { 'description' => 'description_test' } }++ it_behaves_like 'allows params'+ end++ context 'fixed_date' do+ let(:hash) { { 'fixed_date' => '2017-03-01' } }++ it_behaves_like 'allows params'+ end++ context 'project_id' do+ let(:hash) { { 'project_id' => 42 } }++ it_behaves_like 'allows params' do+ let(:allowed_params) { {} }+ end+ end++ context 'existing material budget item' do+ let(:hash) do+ { 'existing_material_budget_item_attributes' => { '1' => {+ 'units' => '100.0',+ 'cost_type_id' => '1',+ 'comments' => 'First package',+ 'amount' => '5,000.00'+ } } }+ end++ it_behaves_like 'allows params'+ end++ context 'new material budget item' do+ let(:hash) do+ { 'new_material_budget_item_attributes' => { '1' => {+ 'units' => '20',+ 'cost_type_id' => '2',+ 'comments' => 'Macbooks',+ 'amount' => '52,000.00'+ } } }+ end++ it_behaves_like 'allows params'+ end++ context 'existing labor budget item' do+ let(:hash) do+ { 'existing_labor_budget_item_attributes' => { '1' => {+ 'hours' => '20.0',+ 'user_id' => '1',+ 'comments' => 'App Setup',+ 'amount' => '2000.00'+ } } }+ end++ it_behaves_like 'allows params'+ end++ context 'new labor budget item' do+ let(:hash) do+ { 'new_labor_budget_item_attributes' => { '1' => {+ 'hours' => '5.0',+ 'user_id' => '2',+ 'comments' => 'Overhead',+ 'amount' => '400'+ } } }+ end++ it_behaves_like 'allows params'+ end+ end+enddiff --git a/modules/costs/spec/requests/api/budgets/budget_resource_spec.rb b/modules/budgets/spec/requests/api/v3/budgets/budget_resource_spec.rbsimilarity index 91%rename from modules/costs/spec/requests/api/budgets/budget_resource_spec.rbrename to modules/budgets/spec/requests/api/v3/budgets/budget_resource_spec.rbindex b6e08fb9187..ffe1e6748b3 100644--- a/modules/costs/spec/requests/api/budgets/budget_resource_spec.rb+++ b/modules/budgets/spec/requests/api/v3/budgets/budget_resource_spec.rb@@ -33,16 +33,15 @@ describe 'API v3 Budget resource' doinclude Rack::Test::Methodsinclude API::V3::Utilities::PathHelper- let(:role) { FactoryBot.create(:role, permissions: [:view_work_packages]) }let(:project) { FactoryBot.create(:project, public: false) }let(:current_user) doFactoryBot.create(:user,- member_in_project: project,- member_through_role: role)+ member_in_project: project,+ member_with_permissions: [:view_work_packages])endsubject(:response) { last_response }- let!(:budget) { FactoryBot.create(:cost_object, project: project) }+ let!(:budget) { FactoryBot.create(:budget, project: project) }describe 'budgets/:id' dolet(:get_path) { api_v3_paths.budget budget.id }diff --git a/spec/models/time_entry_spec.rb b/modules/budgets/spec/spec_helper.rbsimilarity index 90%rename from spec/models/time_entry_spec.rbrename to modules/budgets/spec/spec_helper.rbindex f76803ebfc0..4a4e90beea1 100644--- a/spec/models/time_entry_spec.rb+++ b/modules/budgets/spec/spec_helper.rb@@ -1,5 +1,3 @@-#-- encoding: UTF-8-#-- copyright# OpenProject is an open source project management software.# Copyright (C) 2012-2020 the OpenProject GmbH@@ -28,7 +26,7 @@# See docs/COPYRIGHT.rdoc for more details.#+++# -- load spec_helper from OpenProject corerequire 'spec_helper'-describe TimeEntry, type: :model do-end+Dir[File.join(File.dirname(__FILE__), 'support/**/*.rb')].sort.each { |f| require f }diff --git a/modules/costs/spec/support/pages/budget_form.rb b/modules/budgets/spec/support/pages/budget_form.rbsimilarity index 86%rename from modules/costs/spec/support/pages/budget_form.rbrename to modules/budgets/spec/support/pages/budget_form.rbindex c62eb43a405..688b2d5c038 100644--- a/modules/costs/spec/support/pages/budget_form.rb+++ b/modules/budgets/spec/support/pages/budget_form.rb@@ -42,8 +42,11 @@ module Pages### Adds planned labor costs with the default cost type.def add_labor_costs!(num_hours, user_name:, comment: nil)- edit_labor_costs!(- labor_rows, hours: num_hours, user_name: user_name, comment: comment, type: 'new')+ edit_labor_costs!(labor_rows,+ hours: num_hours,+ user_name: user_name,+ comment: comment,+ type: 'new')add_labor_costs_row!end@@ -51,7 +54,7 @@ module Pages# Adds planned unit costs with the default cost type.## @param type [String] Either 'existing' (default) or 'new'- def edit_unit_costs!(id, units:nil, comment: nil, type: :existing)+ def edit_unit_costs!(id, units: nil, comment: nil, type: :existing)prefix = "#{unit_cost_attr_id(type)}_#{id}"fill_in "#{prefix}_units", with: units if units.present?@@ -59,18 +62,18 @@ module Pagesenddef open_edit_planned_costs!(id, type:)- row_id = "#cost_object_existing_#{type}_budget_item_attributes_#{id}"+ row_id = "#budget_existing_#{type}_budget_item_attributes_#{id}"page.within row_id dofind('.costs--edit-planned-costs-btn').clickendend- def edit_planned_costs!(id, costs:, type: )+ def edit_planned_costs!(id, costs:, type:)open_edit_planned_costs!(id, type: type)- row_id = "#cost_object_existing_#{type}_budget_item_attributes_#{id}"- editor_name = "cost_object_existing_#{type}_budget_item_attributes_#{id}_costs_edit"+ row_id = "#budget_existing_#{type}_budget_item_attributes_#{id}"+ editor_name = "budget_existing_#{type}_budget_item_attributes_#{id}_costs_edit"page.within row_id dofill_in editor_name, with: costs@@ -88,7 +91,7 @@ module Pages# Adds planned labor costs with the default cost type.## @param type [String] Either 'existing' (default) or 'new'- def edit_labor_costs!(id, hours:nil, user_name:nil, comment: nil, type: 'existing')+ def edit_labor_costs!(id, hours: nil, user_name: nil, comment: nil, type: 'existing')prefix = "#{labor_cost_attr_id(type)}_#{id}"fill_in "#{prefix}_hours", with: hours if hours.present?@@ -157,13 +160,13 @@ module Pages### @param type [String] Either 'new' or 'existing'def unit_cost_attr_id(type)- "cost_object_#{type}_material_budget_item_attributes"+ "budget_#{type}_material_budget_item_attributes"end### @param type [String] Either 'new' or 'existing'def labor_cost_attr_id(type)- "cost_object_#{type}_labor_budget_item_attributes"+ "budget_#{type}_labor_budget_item_attributes"enddef unit_rowsdiff --git a/modules/costs/spec/support/pages/edit_budget.rb b/modules/budgets/spec/support/pages/edit_budget.rbsimilarity index 89%rename from modules/costs/spec/support/pages/edit_budget.rbrename to modules/budgets/spec/support/pages/edit_budget.rbindex 8898ca0d27c..458dfc2a59a 100644--- a/modules/costs/spec/support/pages/edit_budget.rb+++ b/modules/budgets/spec/support/pages/edit_budget.rb@@ -33,14 +33,14 @@ module Pagesclass EditBudget < Pageinclude ::Pages::BudgetForm- attr_reader :cost_object_id # cost_object == budget+ attr_reader :budget_id # budget == budget- def initialize(cost_object_id)- @cost_object_id = cost_object_id+ def initialize(budget_id)+ @budget_id = budget_idenddef path- "/cost_objects/#{cost_object_id}"+ "/budgets/#{budget_id}"endendenddiff --git a/modules/costs/spec/support/pages/new_budget.rb b/modules/budgets/spec/support/pages/new_budget.rbsimilarity index 96%rename from modules/costs/spec/support/pages/new_budget.rbrename to modules/budgets/spec/support/pages/new_budget.rbindex 1853b9ab6e1..67873b35c3c 100644--- a/modules/costs/spec/support/pages/new_budget.rb+++ b/modules/budgets/spec/support/pages/new_budget.rb@@ -40,7 +40,7 @@ module Pagesenddef path- "/projects/#{project_identifier}/cost_objects/new"+ "/projects/#{project_identifier}/budgets/new"endendenddiff --git a/modules/costs/.gitignore b/modules/costs/.gitignoredeleted file mode 100644index 944c2834307..00000000000--- a/modules/costs/.gitignore+++ /dev/null@@ -1,2 +0,0 @@-node_modules-.idea/diff --git a/app/contracts/time_entries/base_contract.rb b/modules/costs/app/contracts/time_entries/base_contract.rbsimilarity index 100%rename from app/contracts/time_entries/base_contract.rbrename to modules/costs/app/contracts/time_entries/base_contract.rbdiff --git a/app/contracts/time_entries/create_contract.rb b/modules/costs/app/contracts/time_entries/create_contract.rbsimilarity index 100%rename from app/contracts/time_entries/create_contract.rbrename to modules/costs/app/contracts/time_entries/create_contract.rbdiff --git a/app/contracts/time_entries/delete_contract.rb b/modules/costs/app/contracts/time_entries/delete_contract.rbsimilarity index 100%rename from app/contracts/time_entries/delete_contract.rbrename to modules/costs/app/contracts/time_entries/delete_contract.rbdiff --git a/app/contracts/time_entries/update_contract.rb b/modules/costs/app/contracts/time_entries/update_contract.rbsimilarity index 100%rename from app/contracts/time_entries/update_contract.rbrename to modules/costs/app/contracts/time_entries/update_contract.rbdiff --git a/modules/costs/app/controllers/cost_objects_controller.rb b/modules/costs/app/controllers/cost_objects_controller.rbdeleted file mode 100644index 9287b1478c6..00000000000--- a/modules/costs/app/controllers/cost_objects_controller.rb+++ /dev/null@@ -1,293 +0,0 @@-#-- copyright-# OpenProject is an open source project management software.-# Copyright (C) 2012-2020 the OpenProject GmbH-#-# This program is free software; you can redistribute it and/or-# modify it under the terms of the GNU General Public License version 3.-#-# OpenProject is a fork of ChiliProject, which is a fork of Redmine. The copyright follows:-# Copyright (C) 2006-2017 Jean-Philippe Lang-# Copyright (C) 2010-2013 the ChiliProject Team-#-# This program is free software; you can redistribute it and/or-# modify it under the terms of the GNU General Public License-# as published by the Free Software Foundation; either version 2-# of the License, or (at your option) any later version.-#-# This program is distributed in the hope that it will be useful,-# but WITHOUT ANY WARRANTY; without even the implied warranty of-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the-# GNU General Public License for more details.-#-# You should have received a copy of the GNU General Public License-# along with this program; if not, write to the Free Software-# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.-#-# See docs/COPYRIGHT.rdoc for more details.-#++--class CostObjectsController < ApplicationController- before_action :find_cost_object, only: [:show, :edit, :update, :copy]- before_action :find_cost_objects, only: :destroy- before_action :find_project, only: [- :new, :create,- :update_material_budget_item, :update_labor_budget_item- ]- before_action :find_optional_project, only: :index-- before_action :authorize_global, only: :index- before_action :authorize, except: [- # unrestricted actions- :index,- :update_material_budget_item, :update_labor_budget_item- ]-- helper :sort- include SortHelper- helper :projects- include ProjectsHelper- helper :attachments- include AttachmentsHelper- helper :costlog- include CostlogHelper- helper :cost_objects- include CostObjectsHelper- include PaginationHelper-- def index- respond_to do |format|- format.html do- end- format.csv { limit = Setting.work_packages_export_limit.to_i }- end-- sort_columns = { 'id' => "#{CostObject.table_name}.id",- 'subject' => "#{CostObject.table_name}.subject",- 'fixed_date' => "#{CostObject.table_name}.fixed_date"- }-- sort_init 'id', 'desc'- sort_update sort_columns-- @cost_objects = CostObject- .visible(current_user)- .order(sort_clause)- .includes(:author)- .where(project_id: @project.id)- .page(page_param)- .per_page(per_page_param)-- respond_to do |format|- format.html do- render action: 'index', layout: !request.xhr?- end- format.csv { send_data(cost_objects_to_csv(@cost_objects), type: 'text/csv; header=present', filename: 'export.csv') }- end- end-- def show- @edit_allowed = User.current.allowed_to?(:edit_cost_objects, @project)- respond_to do |format|- format.html { render action: 'show', layout: !request.xhr? }- end- end-- def new- # FIXME: I forcibly create a VariableCostObject for now. Following Ticket #5360- @cost_object ||= VariableCostObject.new- @cost_object.project_id = @project.id- @cost_object.fixed_date ||= Date.today-- render layout: !request.xhr?- end-- def copy- source = CostObject.find(params[:id].to_i)- if source- @cost_object = create_cost_object(source.kind)- @cost_object.copy_from(source)- end-- # FIXME: I forcibly create a VariableCostObject for now. Following Ticket #5360- @cost_object ||= VariableCostObject.new- @cost_object.fixed_date ||= Date.today-- render action: :new, layout: !request.xhr?- end-- def create- if params[:cost_object]- @cost_object = create_cost_object(params[:cost_object].delete(:kind))- end-- # FIXME: I forcibly create a VariableCostObject for now. Following Ticket #5360- @cost_object ||= VariableCostObject.new-- @cost_object.project_id = @project.id-- # fixed_date must be set before material_budget_items and labor_budget_items- @cost_object.fixed_date = if params[:cost_object] && params[:cost_object][:fixed_date]- params[:cost_object].delete(:fixed_date)- else- Date.today- end-- @cost_object.attributes = permitted_params.cost_object- @cost_object.attach_files(permitted_params.attachments.to_h)-- if @cost_object.save- flash[:notice] = t(:notice_successful_create)- redirect_to(params[:continue] ? { action: 'new' } :- { action: 'show', id: @cost_object })- else- render action: 'new', layout: !request.xhr?- end- end-- def edit- # TODO: This method used to be responsible for both edit and update- # Please remove code where necessary- # check whether this method is needed at all- @cost_object.attributes = permitted_params.cost_object if params[:cost_object]- end-- def update- # TODO: This was simply copied over from edit in order to have- # something as a starting point for separating the two- # Please go ahead and start removing code where necessary-- # TODO: use better way to prevent mass assignment errors- params[:cost_object].delete(:kind)- @cost_object.attributes = permitted_params.cost_object if params[:cost_object]- if params[:cost_object][:existing_material_budget_item_attributes].nil?- @cost_object.existing_material_budget_item_attributes = ({})- end- if params[:cost_object][:existing_labor_budget_item_attributes].nil?- @cost_object.existing_labor_budget_item_attributes = ({})- end-- @cost_object.attach_files(permitted_params.attachments.to_h)-- if @cost_object.save- flash[:notice] = t(:notice_successful_update)- redirect_to(params[:back_to] || { action: 'show', id: @cost_object })- else- render action: 'edit'- end- rescue ActiveRecord::StaleObjectError- # Optimistic locking exception- flash.now[:error] = t(:notice_locking_conflict)- end-- def destroy- @cost_objects.each(&:destroy)- flash[:notice] = t(:notice_successful_delete)- redirect_to action: 'index', project_id: @project- end-- def update_material_budget_item- @element_id = params[:element_id]-- cost_type = CostType.where(id: params[:cost_type_id]).first-- if cost_type && params[:units].present?- volume = Rate.parse_number_string_to_number(params[:units])- @costs = (volume * cost_type.rate_at(params[:fixed_date]).rate rescue 0.0)- @unit = volume == 1.0 ? cost_type.unit : cost_type.unit_plural- else- @costs = 0.0- @unit = cost_type.try(:unit_plural) || ''- end-- response = {- "#{@element_id}_unit_name" => h(@unit),- "#{@element_id}_currency" => Setting.plugin_openproject_costs['costs_currency']- }- if current_user.allowed_to?(:view_cost_rates, @project)- response["#{@element_id}_costs"] = number_to_currency(@costs)- response["#{@element_id}_cost_value"] = @costs- end-- respond_to do |format|- format.json do- render json: response- end- end- end-- def update_labor_budget_item- @element_id = params[:element_id]- user = User.where(id: params[:user_id]).first-- if user && params[:hours]- hours = params[:hours].to_s.to_hours- @costs = hours * user.rate_at(params[:fixed_date], @project).rate rescue 0.0- else- @costs = 0.0- end-- response = {- "#{@element_id}_unit_name" => h(@unit),- "#{@element_id}_currency" => Setting.plugin_openproject_costs['costs_currency']- }- if current_user.allowed_to?(:view_hourly_rates, @project)- response["#{@element_id}_costs"] = number_to_currency(@costs)- response["#{@element_id}_cost_value"] = @costs- end-- respond_to do |format|- format.json do- render json: response- end- end- end-- private-- def create_cost_object(kind)- case kind- when FixedCostObject.name- FixedCostObject.new- when VariableCostObject.name- VariableCostObject.new- else- CostObject.new- end- end-- def find_cost_object- # This function comes directly from issues_controller.rb (Redmine 0.8.4)- @cost_object = CostObject.includes(:project, :author).find_by(id: params[:id])- @project = @cost_object.project if @cost_object- rescue ActiveRecord::RecordNotFound- render_404- end-- def find_cost_objects- # This function comes directly from issues_controller.rb (Redmine 0.8.4)-- @cost_objects = CostObject.where(id: params[:id] || params[:ids])- raise ActiveRecord::RecordNotFound if @cost_objects.empty?- projects = @cost_objects.map(&:project).compact.uniq- if projects.size == 1- @project = projects.first- else- # TODO: let users bulk edit/move/destroy cost_objects from different projects- render_error 'Can not bulk edit/move/destroy cost objects from different projects' and return false- end- rescue ActiveRecord::RecordNotFound- render_404- end-- def find_project- @project = Project.find(params[:project_id])- rescue ActiveRecord::RecordNotFound- render_404- end-- def find_optional_project- @project = Project.find(params[:project_id]) unless params[:project_id].blank?- rescue ActiveRecord::RecordNotFound- render_404- end-enddiff --git a/modules/costs/app/controllers/costlog_controller.rb b/modules/costs/app/controllers/costlog_controller.rbindex 607dbd39728..f05f329c30b 100644--- a/modules/costs/app/controllers/costlog_controller.rb+++ b/modules/costs/app/controllers/costlog_controller.rb@@ -92,14 +92,6 @@ class CostlogController < ApplicationControllerendend- def get_cost_type_unit_plural- @cost_type = CostType.find(params[:cost_type_id]) unless params[:cost_type_id].empty?-- if request.xhr?- render partial: 'cost_type_unit_plural', layout: false- end- end-privatedef find_project@@ -158,7 +150,7 @@ class CostlogController < ApplicationControllerdef new_default_cost_entry@cost_entry = CostEntry.new.tap do |ce|- ce.project = @project+ ce.project = @projectce.work_package = @work_packagece.user = User.currentce.spent_on = Date.todaydiff --git a/modules/costs/app/controllers/hourly_rates_controller.rb b/modules/costs/app/controllers/hourly_rates_controller.rbindex a5e9f2db0c6..47a4c0ff79b 100644--- a/modules/costs/app/controllers/hourly_rates_controller.rb+++ b/modules/costs/app/controllers/hourly_rates_controller.rb@@ -79,7 +79,7 @@ class HourlyRatesController < ApplicationControllerendcurrent_menu_item :edit do- :cost_objects+ :budgetsenddef updatediff --git a/app/controllers/projects/time_entry_activities_controller.rb b/modules/costs/app/controllers/projects/time_entry_activities_controller.rbsimilarity index 100%rename from app/controllers/projects/time_entry_activities_controller.rbrename to modules/costs/app/controllers/projects/time_entry_activities_controller.rbdiff --git a/modules/costs/app/helpers/costlog_helper.rb b/modules/costs/app/helpers/costlog_helper.rbindex 49f63f9f278..a03cd9268e6 100644--- a/modules/costs/app/helpers/costlog_helper.rb+++ b/modules/costs/app/helpers/costlog_helper.rb@@ -27,8 +27,6 @@#++module CostlogHelper- include TimelogHelper-def cost_types_collection_for_select_options(selected_type = nil)cost_types = CostType.active.sortdiff --git a/app/models/activities/time_entry_activity_provider.rb b/modules/costs/app/models/activities/time_entry_activity_provider.rbsimilarity index 81%rename from app/models/activities/time_entry_activity_provider.rbrename to modules/costs/app/models/activities/time_entry_activity_provider.rbindex 95d9ed5e535..74871878ef8 100644--- a/app/models/activities/time_entry_activity_provider.rb+++ b/modules/costs/app/models/activities/time_entry_activity_provider.rb@@ -76,19 +76,11 @@ class Activities::TimeEntryActivityProvider < Activities::BaseActivityProviderenddef event_path(event)- if event['work_package_id'].present?- url_helpers.project_time_entries_path(event['project_id'])- else- url_helpers.work_package_time_entries_path(event['work_package_id'])- end+ event_location(event)enddef event_url(event)- if event['work_package_id'].present?- url_helpers.project_time_entries_url(event['project_id'])- else- url_helpers.work_package_time_entries_url(event['work_package_id'])- end+ event_location(event, only_path: false)enddef types_table@@ -102,4 +94,22 @@ class Activities::TimeEntryActivityProvider < Activities::BaseActivityProviderdef work_packages_table@work_packages_table ||= WorkPackage.arel_tableend++ def event_location(event, only_path: true)+ filter_params = if event['work_package_id'].present?+ work_package_id_filter(event['work_package_id'])+ else+ project_id_filter(event['project_id'])+ end++ url_helpers.cost_reports_url(event['project_id'], only_path: only_path, **filter_params)+ end++ def project_id_filter(project_id)+ { 'fields[]': 'ProjectId', 'operators[ProjectId]': '=', 'values[ProjectId]': project_id, set_filter: 1 }+ end++ def work_package_id_filter(work_package_id)+ { 'fields[]': 'WorkPackageId', 'operators[WorkPackageId]': '=', 'values[WorkPackageId]': work_package_id, set_filter: 1 }+ endenddiff --git a/modules/costs/app/models/cost_entry.rb b/modules/costs/app/models/cost_entry.rbindex 11f80f2da27..e5139321d2a 100644--- a/modules/costs/app/models/cost_entry.rb+++ b/modules/costs/app/models/cost_entry.rb@@ -30,9 +30,9 @@ class CostEntry < ApplicationRecordbelongs_to :projectbelongs_to :work_packagebelongs_to :user- include ::OpenProject::Costs::DeletedUserFallback+ include ::Costs::DeletedUserFallbackbelongs_to :cost_type- belongs_to :cost_object+ belongs_to :budgetbelongs_to :rate, class_name: 'CostRate'include ActiveModel::ForbiddenAttributesProtection@@ -49,6 +49,8 @@ class CostEntry < ApplicationRecordscope :on_work_packages, ->(work_packages) { where(work_package_id: work_packages) }extend CostEntryScopes+ include Entry::Costs+ include Entry::SplashedDatesdef after_initializeif new_record? && cost_type.nil?@@ -63,7 +65,7 @@ class CostEntry < ApplicationRecordenddef validate- errors.add :units, :invalid if units && (units < 0)+ errors.add :units, :invalid if units&.negative?errors.add :project_id, :invalid if project.nil?errors.add :work_package_id, :invalid if work_package.nil? || (project != work_package.project)errors.add :cost_type_id, :invalid if cost_type.present? && cost_type.deleted_at.present?@@ -71,7 +73,7 @@ class CostEntry < ApplicationRecordbeginspent_on.to_date- rescue Exception+ rescue StandardErrorerrors.add :spent_on, :invalidendend@@ -89,44 +91,6 @@ class CostEntry < ApplicationRecordwrite_attribute(:units, CostRate.parse_number_string(units))end- # tyear, tmonth, tweek assigned where setting spent_on attributes- # these attributes make time aggregations easier- def spent_on=(date)- super- self.tyear = spent_on ? spent_on.year : nil- self.tmonth = spent_on ? spent_on.month : nil- self.tweek = spent_on ? Date.civil(spent_on.year, spent_on.month, spent_on.day).cweek : nil- end-- def real_costs- # This methods returns the actual assigned costs of the entry- overridden_costs || costs || calculated_costs- end-- def calculated_costs(rate_attr = nil)- rate_attr ||= current_rate- units * rate_attr.rate- rescue- 0.0- end-- def update_costs(rate_attr = nil)- rate_attr ||= current_rate- if rate_attr.nil?- self.costs = 0.0- self.rate = nil- return- end-- self.costs = calculated_costs(rate_attr)- self.rate = rate_attr- end-- def update_costs!(rate_attr = nil)- update_costs(rate_attr)- self.save!- end-def current_ratecost_type.rate_at(self.spent_on)end@@ -146,4 +110,10 @@ class CostEntry < ApplicationRecordusr.allowed_to?(:view_cost_rates, project) ||(usr.id == user_id && !overridden_costs.nil?)end++ private++ def cost_attribute+ units+ endenddiff --git a/modules/costs/app/models/cost_object.rb b/modules/costs/app/models/cost_object.rbdeleted file mode 100644index f7f2e076872..00000000000--- a/modules/costs/app/models/cost_object.rb+++ /dev/null@@ -1,159 +0,0 @@-#-- copyright-# OpenProject is an open source project management software.-# Copyright (C) 2012-2020 the OpenProject GmbH-#-# This program is free software; you can redistribute it and/or-# modify it under the terms of the GNU General Public License version 3.-#-# OpenProject is a fork of ChiliProject, which is a fork of Redmine. The copyright follows:-# Copyright (C) 2006-2017 Jean-Philippe Lang-# Copyright (C) 2010-2013 the ChiliProject Team-#-# This program is free software; you can redistribute it and/or-# modify it under the terms of the GNU General Public License-# as published by the Free Software Foundation; either version 2-# of the License, or (at your option) any later version.-#-# This program is distributed in the hope that it will be useful,-# but WITHOUT ANY WARRANTY; without even the implied warranty of-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the-# GNU General Public License for more details.-#-# You should have received a copy of the GNU General Public License-# along with this program; if not, write to the Free Software-# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.-#-# See docs/COPYRIGHT.rdoc for more details.-#++--# A CostObject is an item that is created as part of the project. These items-# contain a collection of work packages.-class CostObject < ApplicationRecord- belongs_to :author, class_name: 'User', foreign_key: 'author_id'- belongs_to :project- has_many :work_packages, dependent: :nullify-- has_many :cost_entries, through: :work_packages- has_many :time_entries, through: :work_packages-- include ActiveModel::ForbiddenAttributesProtection-- acts_as_attachable- acts_as_journalized-- acts_as_event type: 'cost-objects',- title: Proc.new { |o| "#{I18n.t(:label_cost_object)} ##{o.id}: #{o.subject}" },- url: Proc.new { |o| { controller: 'cost_objects', action: 'show', id: o.id } }-- validates_presence_of :subject, :project, :author, :kind, :fixed_date- validates_length_of :subject, maximum: 255- validates_length_of :subject, minimum: 1-- User.before_destroy do |user|- CostObject.replace_author_with_deleted_user user- end-- def self.visible(user)- includes(:project)- .references(:projects)- .merge(Project.allowed_to(user, :view_cost_objects))- end-- def initialize(attributes = nil)- super- self.author = User.current if self.new_record?- end-- def copy_from(arg)- if !arg.is_a?(Hash)- # turn args into an attributes hash if it is not already (which is the case when called from VariableCostObject)- arg = (arg.is_a?(CostObject) ? arg : self.class.find(arg)).attributes.dup- end- arg.delete('id')- self.type = arg.delete('type')- self.attributes = arg- end-- # Wrap type column to make it usable in views (especially in a select tag)- def kind- self[:type]- end-- def kind=(type)- self[:type] = type- end-- # Assign all the work_packages with +version_id+ to this Cost Object- def assign_work_packages_by_version(version_id)- version = Version.find_by_id(version_id)- return 0 if version.nil? || version.fixed_work_packages.blank?-- version.fixed_work_packages.each do |work_package|- work_package.update_attribute(:cost_object_id, id)- end-- version.fixed_work_packages.size- end-- # Change the Cost Object type to another type. Valid types are- #- # * FixedCostObject- # * VariableCostObject- def change_type(to)- if [FixedCostObject.name, VariableCostObject.name].include?(to)- self.type = to- self.save!- CostObject.find(id)- else- self- end- end-- # Amount spent. Virtual accessor that is overriden by subclasses.- def spent- 0- end-- # Budget of labor. Virtual accessor that is overriden by subclasses.- def labor_budget- 0.0- end-- # Budget of material, i.e. all costs besides labor costs. Virtual accessor that is overriden by subclasses.- def material_budget- 0.0- end-- def budget- material_budget + labor_budget- end-- # Label of the current type for display in GUI. Virtual accessor that is overriden by subclasses.- def type_label- I18n.t(:label_cost_object)- end-- # Amount of the budget spent. Expressed as as a percentage whole number- def budget_ratio- return 0.0 if budget.nil? || budget == 0.0- ((spent / budget) * 100).round- end-- def css_classes- 'cost_object'- end-- def self.replace_author_with_deleted_user(user)- substitute = DeletedUser.first-- where(author_id: user.id).update_all(author_id: substitute.id)- end-- def to_s- subject- end-- def name- subject- end-enddiff --git a/modules/costs/app/models/cost_scopes.rb b/modules/costs/app/models/cost_scopes.rbindex e309ed8bea0..43041a24374 100644--- a/modules/costs/app/models/cost_scopes.rb+++ b/modules/costs/app/models/cost_scopes.rb@@ -3,7 +3,6 @@ module CostScopesbase_module.class_eval dodef self.extended(base_class)base_class.class_eval do-def self.visible(*args)user = args.first || User.currentwith_visible_entries_on self, user: user, project: args[1]@@ -36,7 +35,7 @@ module CostScopesenddef with_visible_entries_on(scope, user: User.current, project: nil)- table = self.arel_table+ table = arel_tableview_allowed = Project.allowed_to(user, view_allowed_entries_permission).select(:id)view_own_allowed = Project.allowed_to(user, view_allowed_own_entries_permission).select(:id)@@ -59,7 +58,7 @@ module CostScopesenddef with_visible_rates_on(scope, user: User.current)- table = self.arel_table+ table = arel_tableview_allowed = Project.allowed_to(user, view_rates_permissions).select(:id)scope.where(table[:project_id].in(view_allowed.arel))diff --git a/modules/costs/app/models/entry/costs.rb b/modules/costs/app/models/entry/costs.rbnew file mode 100644index 00000000000..9a0ff955034--- /dev/null+++ b/modules/costs/app/models/entry/costs.rb@@ -0,0 +1,69 @@+#-- encoding: UTF-8++#-- copyright+# OpenProject is an open source project management software.+# Copyright (C) 2012-2020 the OpenProject GmbH+#+# This program is free software; you can redistribute it and/or+# modify it under the terms of the GNU General Public License version 3.+#+# OpenProject is a fork of ChiliProject, which is a fork of Redmine. The copyright follows:+# Copyright (C) 2006-2017 Jean-Philippe Lang+# Copyright (C) 2010-2013 the ChiliProject Team+#+# This program is free software; you can redistribute it and/or+# modify it under the terms of the GNU General Public License+# as published by the Free Software Foundation; either version 2+# of the License, or (at your option) any later version.+#+# This program is distributed in the hope that it will be useful,+# but WITHOUT ANY WARRANTY; without even the implied warranty of+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the+# GNU General Public License for more details.+#+# You should have received a copy of the GNU General Public License+# along with this program; if not, write to the Free Software+# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.+#+# See docs/COPYRIGHT.rdoc for more details.+#++++module Entry::Costs+ extend ActiveSupport::Concern++ included do+ def real_costs+ # This methods returns the actual assigned costs of the entry+ overridden_costs || costs || calculated_costs+ end++ def calculated_costs(rate_attr = nil)+ rate_attr ||= current_rate+ cost_attribute * rate_attr.rate+ rescue StandardError+ 0.0+ end++ def update_costs(rate_attr = nil)+ rate_attr ||= current_rate+ if rate_attr.nil?+ self.costs = 0.0+ self.rate = nil+ return+ end++ self.costs = calculated_costs(rate_attr)+ self.rate = rate_attr+ end++ def update_costs!(rate_attr = nil)+ update_costs(rate_attr)++ save!+ end++ def cost_attribute+ raise NotImplementedError+ end+ end+enddiff --git a/modules/costs/lib/open_project/costs/patches/base_contract_patch.rb b/modules/costs/app/models/entry/splashed_dates.rbsimilarity index 66%rename from modules/costs/lib/open_project/costs/patches/base_contract_patch.rbrename to modules/costs/app/models/entry/splashed_dates.rbindex f1040223462..643291f3ca6 100644--- a/modules/costs/lib/open_project/costs/patches/base_contract_patch.rb+++ b/modules/costs/app/models/entry/splashed_dates.rb@@ -1,3 +1,5 @@+#-- encoding: UTF-8+#-- copyright# OpenProject is an open source project management software.# Copyright (C) 2012-2020 the OpenProject GmbH@@ -26,10 +28,34 @@# See docs/COPYRIGHT.rdoc for more details.#++-module OpenProject::Costs::Patches::BaseContractPatch+module Entry::SplashedDatesextend ActiveSupport::Concernincluded do- attribute :cost_object+ # tyear, tmonth, tweek assigned where setting spent_on attributes+ # these attributes make time aggregations easier+ def spent_on=(date)+ super+ if spent_on.is_a?(Time)+ self.spent_on = spent_on.to_date+ end+ set_tyear+ set_tmonth+ set_tweek+ end++ private++ def set_tyear+ self.tyear = spent_on ? spent_on.year : nil+ end++ def set_tmonth+ self.tmonth = spent_on ? spent_on.month : nil+ end++ def set_tweek+ self.tweek = spent_on ? Date.civil(spent_on.year, spent_on.month, spent_on.day).cweek : nil+ endendenddiff --git a/modules/costs/app/models/fixed_cost_object.rb b/modules/costs/app/models/fixed_cost_object.rbdeleted file mode 100644index 238e05c7b3e..00000000000--- a/modules/costs/app/models/fixed_cost_object.rb+++ /dev/null@@ -1,34 +0,0 @@-#-- copyright-# OpenProject is an open source project management software.-# Copyright (C) 2012-2020 the OpenProject GmbH-#-# This program is free software; you can redistribute it and/or-# modify it under the terms of the GNU General Public License version 3.-#-# OpenProject is a fork of ChiliProject, which is a fork of Redmine. The copyright follows:-# Copyright (C) 2006-2017 Jean-Philippe Lang-# Copyright (C) 2010-2013 the ChiliProject Team-#-# This program is free software; you can redistribute it and/or-# modify it under the terms of the GNU General Public License-# as published by the Free Software Foundation; either version 2-# of the License, or (at your option) any later version.-#-# This program is distributed in the hope that it will be useful,-# but WITHOUT ANY WARRANTY; without even the implied warranty of-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the-# GNU General Public License for more details.-#-# You should have received a copy of the GNU General Public License-# along with this program; if not, write to the Free Software-# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.-#-# See docs/COPYRIGHT.rdoc for more details.-#++--class FixedCostObject < CostObject- # Label of the current type for display in GUI.- def type_label- I18n.t(:label_fixed_cost_object)- end-enddiff --git a/modules/costs/app/models/hourly_rate.rb b/modules/costs/app/models/hourly_rate.rbindex 961588856d0..1d140ddd734 100644--- a/modules/costs/app/models/hourly_rate.rb+++ b/modules/costs/app/models/hourly_rate.rb@@ -45,12 +45,12 @@ class HourlyRate < Rateenddef self.history_for_user(usr)- projects_with_costs_module = Project.has_module(:costs_module)+ projects_with_costs = Project.has_module(:costs).active.visible.order(:name)- permitted_projects = Project.has_module(:costs_module)+ permitted_projects = Project.has_module(:costs).active.allowed_to(User.current, :view_hourly_rates)@@ -61,7 +61,7 @@ class HourlyRate < Raterates = {}- projects_with_costs_module.each do |project|+ projects_with_costs.each do |project|rates[project] = rates_by_project.fetch(project, [])enddiff --git a/modules/costs/app/models/journal/cost_object_journal.rb b/modules/costs/app/models/journal/cost_object_journal.rbdeleted file mode 100644index ecba9070fa2..00000000000--- a/modules/costs/app/models/journal/cost_object_journal.rb+++ /dev/null@@ -1,31 +0,0 @@-#-- copyright-# OpenProject is an open source project management software.-# Copyright (C) 2012-2020 the OpenProject GmbH-#-# This program is free software; you can redistribute it and/or-# modify it under the terms of the GNU General Public License version 3.-#-# OpenProject is a fork of ChiliProject, which is a fork of Redmine. The copyright follows:-# Copyright (C) 2006-2017 Jean-Philippe Lang-# Copyright (C) 2010-2013 the ChiliProject Team-#-# This program is free software; you can redistribute it and/or-# modify it under the terms of the GNU General Public License-# as published by the Free Software Foundation; either version 2-# of the License, or (at your option) any later version.-#-# This program is distributed in the hope that it will be useful,-# but WITHOUT ANY WARRANTY; without even the implied warranty of-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the-# GNU General Public License for more details.-#-# You should have received a copy of the GNU General Public License-# along with this program; if not, write to the Free Software-# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.-#-# See docs/COPYRIGHT.rdoc for more details.-#++--class Journal::CostObjectJournal < Journal::BaseJournal- self.table_name = 'cost_object_journals'-enddiff --git a/app/models/journal/time_entry_journal.rb b/modules/costs/app/models/journal/time_entry_journal.rbsimilarity index 99%rename from app/models/journal/time_entry_journal.rbrename to modules/costs/app/models/journal/time_entry_journal.rbindex 4799f35c0ac..4ee77096c65 100644--- a/app/models/journal/time_entry_journal.rb+++ b/modules/costs/app/models/journal/time_entry_journal.rb@@ -1,4 +1,5 @@#-- encoding: UTF-8+#-- copyright# OpenProject is an open source project management software.# Copyright (C) 2012-2020 the OpenProject GmbHdiff --git a/app/models/queries/time_entries.rb b/modules/costs/app/models/queries/time_entries.rbsimilarity index 100%rename from app/models/queries/time_entries.rbrename to modules/costs/app/models/queries/time_entries.rbdiff --git a/app/models/queries/time_entries/filters/activity_filter.rb b/modules/costs/app/models/queries/time_entries/filters/activity_filter.rbsimilarity index 100%rename from app/models/queries/time_entries/filters/activity_filter.rbrename to modules/costs/app/models/queries/time_entries/filters/activity_filter.rbdiff --git a/app/models/queries/time_entries/filters/created_on_filter.rb b/modules/costs/app/models/queries/time_entries/filters/created_on_filter.rbsimilarity index 100%rename from app/models/queries/time_entries/filters/created_on_filter.rbrename to modules/costs/app/models/queries/time_entries/filters/created_on_filter.rbdiff --git a/app/models/queries/time_entries/filters/project_filter.rb b/modules/costs/app/models/queries/time_entries/filters/project_filter.rbsimilarity index 100%rename from app/models/queries/time_entries/filters/project_filter.rbrename to modules/costs/app/models/queries/time_entries/filters/project_filter.rbdiff --git a/app/models/queries/time_entries/filters/spent_on_filter.rb b/modules/costs/app/models/queries/time_entries/filters/spent_on_filter.rbsimilarity index 100%rename from app/models/queries/time_entries/filters/spent_on_filter.rbrename to modules/costs/app/models/queries/time_entries/filters/spent_on_filter.rbdiff --git a/app/models/queries/time_entries/filters/time_entry_filter.rb b/modules/costs/app/models/queries/time_entries/filters/time_entry_filter.rbsimilarity index 100%rename from app/models/queries/time_entries/filters/time_entry_filter.rbrename to modules/costs/app/models/queries/time_entries/filters/time_entry_filter.rbdiff --git a/app/models/queries/time_entries/filters/user_filter.rb b/modules/costs/app/models/queries/time_entries/filters/user_filter.rbsimilarity index 100%rename from app/models/queries/time_entries/filters/user_filter.rbrename to modules/costs/app/models/queries/time_entries/filters/user_filter.rbdiff --git a/app/models/queries/time_entries/filters/work_package_filter.rb b/modules/costs/app/models/queries/time_entries/filters/work_package_filter.rbsimilarity index 100%rename from app/models/queries/time_entries/filters/work_package_filter.rbrename to modules/costs/app/models/queries/time_entries/filters/work_package_filter.rbdiff --git a/app/models/queries/time_entries/orders/default_order.rb b/modules/costs/app/models/queries/time_entries/orders/default_order.rbsimilarity index 100%rename from app/models/queries/time_entries/orders/default_order.rbrename to modules/costs/app/models/queries/time_entries/orders/default_order.rbdiff --git a/app/models/queries/time_entries/time_entry_query.rb b/modules/costs/app/models/queries/time_entries/time_entry_query.rbsimilarity index 100%rename from app/models/queries/time_entries/time_entry_query.rbrename to modules/costs/app/models/queries/time_entries/time_entry_query.rbdiff --git a/modules/costs/app/models/rate.rb b/modules/costs/app/models/rate.rbindex 9cda3b1b34f..ecd720a6fd0 100644--- a/modules/costs/app/models/rate.rb+++ b/modules/costs/app/models/rate.rb@@ -37,7 +37,7 @@ class Rate < ApplicationRecordafter_create :rate_createdbelongs_to :user- include ::OpenProject::Costs::DeletedUserFallback+ include ::Costs::DeletedUserFallbackbelongs_to :projectinclude ActiveModel::ForbiddenAttributesProtectiondiff --git a/app/models/time_entry.rb b/modules/costs/app/models/time_entry.rbsimilarity index 54%rename from app/models/time_entry.rbrename to modules/costs/app/models/time_entry.rbindex c3096f36e41..4bbe4ae5331 100644--- a/app/models/time_entry.rb+++ b/modules/costs/app/models/time_entry.rb@@ -1,4 +1,5 @@#-- encoding: UTF-8+#-- copyright# OpenProject is an open source project management software.# Copyright (C) 2012-2020 the OpenProject GmbH@@ -34,47 +35,46 @@ class TimeEntry < ApplicationRecordbelongs_to :work_packagebelongs_to :userbelongs_to :activity, class_name: 'TimeEntryActivity', foreign_key: 'activity_id'+ belongs_to :rate, -> { where(type: %w[HourlyRate DefaultHourlyRate]) }, class_name: 'Rate'acts_as_customizableacts_as_journalized- acts_as_event title: Proc.new { |o| "#{l_hours(o.hours)} (#{o.project.event_title})" },- url: Proc.new { |o| { controller: '/timelog', action: 'index', project_id: o.project, work_package_id: o.work_package } },- datetime: :created_on,- author: :user,- description: :comments-validates_presence_of :user_id, :activity_id, :project_id, :hours, :spent_onvalidates_numericality_of :hours, allow_nil: true, message: :invalidvalidates_length_of :comments, maximum: 255, allow_nil: truescope :on_work_packages, ->(work_packages) { where(work_package_id: work_packages) }- def self.visible(*args)- # TODO: check whether the visibility should also be influenced by the work- # package the time entry is assigned to. Currently a work package can- # switch projects. But as the time entry is still part of it's original- # project, it is unclear, whether the time entry is actually visible if the- # user lacks the view_work_packages permission in the moved to project.- joins(:project)- .merge(Project.allowed_to(args.first || User.current, :view_time_entries))- end+ include ::Scopes::Scoped+ extend ::TimeEntry::TimeEntryScopes+ include Entry::Costs+ include Entry::SplashedDates- def hours=(h)- write_attribute :hours, (h.is_a?(String) ? (h.to_hours || h) : h)- end+ scope_classes TimeEntry::Scopes::OfUserAndDay,+ TimeEntry::Scopes::Visible++ # TODO: move into service+ before_save :update_costs- # tyear, tmonth, tweek assigned where setting spent_on attributes- # these attributes make time aggregations easier- def spent_on=(date)- super- if spent_on.is_a?(Time)- self.spent_on = spent_on.to_date+ def self.update_all(updates, conditions = nil, options = {})+ # instead of a update_all, perform an individual update during work_package#move+ # to trigger the update of the costs based on new rates+ if conditions.respond_to?(:keys) && conditions.keys == [:work_package_id] && updates =~ /^project_id = ([\d]+)$/+ project_id = $1+ time_entries = TimeEntry.where(conditions)+ time_entries.each do |entry|+ entry.project_id = project_id+ entry.save!+ end+ else+ superend- self.tyear = spent_on ? spent_on.year : nil- self.tmonth = spent_on ? spent_on.month : nil- self.tweek = spent_on ? Date.civil(spent_on.year, spent_on.month, spent_on.day).cweek : nil+ end++ def hours=(value)+ write_attribute :hours, (value.is_a?(String) ? (value.to_hours || value) : value)end# Returns true if the time entry can be edited by usr, otherwise false@@ -82,15 +82,23 @@ class TimeEntry < ApplicationRecord(usr == user && usr.allowed_to?(:edit_own_time_entries, project)) || usr.allowed_to?(:edit_time_entries, project)end- def self.earliest_date_for_project(project = nil)- scope = TimeEntry.visible(User.current)- scope = scope.where(project_id: project.hierarchy.map(&:id)) if project- scope.includes(:project).minimum(:spent_on)+ def current_rate+ user.rate_at(spent_on, project_id)+ end++ def visible_by?(usr)+ usr.allowed_to?(:view_time_entries, project) ||+ (user_id == usr.id && usr.allowed_to?(:view_own_time_entries, project))end- def self.latest_date_for_project(project = nil)- scope = TimeEntry.visible(User.current)- scope = scope.where(project_id: project.hierarchy.map(&:id)) if project- scope.includes(:project).maximum(:spent_on)+ def costs_visible_by?(usr)+ usr.allowed_to?(:view_hourly_rates, project) ||+ (user_id == usr.id && usr.allowed_to?(:view_own_hourly_rate, project))+ end++ private++ def cost_attribute+ hoursendenddiff --git a/app/models/time_entry/scopes/of_user_and_day.rb b/modules/costs/app/models/time_entry/scopes/of_user_and_day.rbsimilarity index 100%rename from app/models/time_entry/scopes/of_user_and_day.rbrename to modules/costs/app/models/time_entry/scopes/of_user_and_day.rbdiff --git a/modules/costs/app/models/time_entry/scopes/visible.rb b/modules/costs/app/models/time_entry/scopes/visible.rbnew file mode 100644index 00000000000..26b8f0850ec--- /dev/null+++ b/modules/costs/app/models/time_entry/scopes/visible.rb@@ -0,0 +1,44 @@+#-- encoding: UTF-8++#-- copyright+# OpenProject is a project management system.+# Copyright (C) 2012-2018 the OpenProject Foundation (OPF)+#+# This program is free software; you can redistribute it and/or+# modify it under the terms of the GNU General Public License version 3.+#+# OpenProject is a fork of ChiliProject, which is a fork of Redmine. The copyright follows:+# Copyright (C) 2006-2017 Jean-Philippe Lang+# Copyright (C) 2010-2013 the ChiliProject Team+#+# This program is free software; you can redistribute it and/or+# modify it under the terms of the GNU General Public License+# as published by the Free Software Foundation; either version 2+# of the License, or (at your option) any later version.+#+# This program is distributed in the hope that it will be useful,+# but WITHOUT ANY WARRANTY; without even the implied warranty of+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the+# GNU General Public License for more details.+#+# You should have received a copy of the GNU General Public License+# along with this program; if not, write to the Free Software+# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.+#+# See docs/COPYRIGHT.rdoc for more details.+#++++module TimeEntry::Scopes+ class Visible+ def self.fetch(user = User.current)+ all_scope = TimeEntry+ .where(project_id: Project.allowed_to(user, :view_time_entries))++ own_scope = TimeEntry+ .where(project_id: Project.allowed_to(user, :view_own_time_entries))+ .where(user_id: user)++ all_scope.or(own_scope)+ end+ end+enddiff --git a/modules/costs/app/models/time_entry/time_entry_scopes.rb b/modules/costs/app/models/time_entry/time_entry_scopes.rbindex e720178113d..bca77a7ca14 100644--- a/modules/costs/app/models/time_entry/time_entry_scopes.rb+++ b/modules/costs/app/models/time_entry/time_entry_scopes.rb@@ -11,7 +11,7 @@ class TimeEntryenddef with_visible_rates_on(scope, user: User.current)- table = self.arel_table+ table = arel_tableview_allowed = Project.allowed_to(user, :view_hourly_rates).select(:id)view_own_allowed = Project.allowed_to(user, :view_own_hourly_rate).select(:id)diff --git a/app/models/time_entry_activities_project.rb b/modules/costs/app/models/time_entry_activities_project.rbsimilarity index 100%rename from app/models/time_entry_activities_project.rbrename to modules/costs/app/models/time_entry_activities_project.rbdiff --git a/app/models/time_entry_activity.rb b/modules/costs/app/models/time_entry_activity.rbsimilarity index 100%rename from app/models/time_entry_activity.rbrename to modules/costs/app/models/time_entry_activity.rbdiff --git a/app/models/time_entry_activity/scopes/active_in_project.rb b/modules/costs/app/models/time_entry_activity/scopes/active_in_project.rbsimilarity index 100%rename from app/models/time_entry_activity/scopes/active_in_project.rbrename to modules/costs/app/models/time_entry_activity/scopes/active_in_project.rbdiff --git a/app/models/time_entry_activity_custom_field.rb b/modules/costs/app/models/time_entry_activity_custom_field.rbsimilarity index 99%rename from app/models/time_entry_activity_custom_field.rbrename to modules/costs/app/models/time_entry_activity_custom_field.rbindex 5780ff541fa..d2c726168cb 100644--- a/app/models/time_entry_activity_custom_field.rb+++ b/modules/costs/app/models/time_entry_activity_custom_field.rb@@ -1,4 +1,5 @@#-- encoding: UTF-8+#-- copyright# OpenProject is an open source project management software.# Copyright (C) 2012-2020 the OpenProject GmbHdiff --git a/app/models/time_entry_custom_field.rb b/modules/costs/app/models/time_entry_custom_field.rbsimilarity index 99%rename from app/models/time_entry_custom_field.rbrename to modules/costs/app/models/time_entry_custom_field.rbindex de85724bda9..666eeb52b67 100644--- a/app/models/time_entry_custom_field.rb+++ b/modules/costs/app/models/time_entry_custom_field.rb@@ -1,4 +1,5 @@#-- encoding: UTF-8+#-- copyright# OpenProject is an open source project management software.# Copyright (C) 2012-2020 the OpenProject GmbHdiff --git a/modules/costs/app/seeders/basic_data/costs/type_seeder.rb b/modules/costs/app/seeders/basic_data/costs/type_seeder.rbindex 628ac44ea3f..21a0205b17c 100644--- a/modules/costs/app/seeders/basic_data/costs/type_seeder.rb+++ b/modules/costs/app/seeders/basic_data/costs/type_seeder.rb@@ -1,6 +1,7 @@module BasicDatamodule Costsmodule TypeSeeder+ # TODO: split up between costs and budgetsdef coded_visibility_tablesuper.merge costs_visibility_tableend@@ -15,7 +16,7 @@ module BasicDataoverall_costs: [1, 1, 1, 1, 1, 1, 1],material_costs: [1, 1, 1, 1, 1, 1, 1], # unit costslabor_costs: [1, 1, 1, 1, 1, 1, 1],- cost_object: [1, 1, 1, 1, 1, 1, 1] # budget+ budget: [1, 1, 1, 1, 1, 1, 1] # budget}endenddiff --git a/app/services/time_entries/create_service.rb b/modules/costs/app/services/time_entries/create_service.rbsimilarity index 100%rename from app/services/time_entries/create_service.rbrename to modules/costs/app/services/time_entries/create_service.rbdiff --git a/app/services/time_entries/delete_service.rb b/modules/costs/app/services/time_entries/delete_service.rbsimilarity index 100%rename from app/services/time_entries/delete_service.rbrename to modules/costs/app/services/time_entries/delete_service.rbdiff --git a/app/services/time_entries/set_attributes_service.rb b/modules/costs/app/services/time_entries/set_attributes_service.rbsimilarity index 100%rename from app/services/time_entries/set_attributes_service.rbrename to modules/costs/app/services/time_entries/set_attributes_service.rbdiff --git a/app/services/time_entries/update_service.rb b/modules/costs/app/services/time_entries/update_service.rbsimilarity index 100%rename from app/services/time_entries/update_service.rbrename to modules/costs/app/services/time_entries/update_service.rbdiff --git a/modules/costs/app/views/cost_types/_list.html.erb b/modules/costs/app/views/cost_types/_list.html.erbindex 636ad573746..af4eb9ff141 100644--- a/modules/costs/app/views/cost_types/_list.html.erb+++ b/modules/costs/app/views/cost_types/_list.html.erb@@ -91,7 +91,7 @@ See docs/COPYRIGHT.rdoc for more details.<label class="hidden-for-sighted" for="<%= "rate_field_#{cost_type.id}" %>"><%= t(:caption_set_rate) %></label><%= content_tag :input, '', :value => "", :name => :rate, :size => 7, :id => "rate_field_#{cost_type.id}" %><span class="form-label">- <%= Setting.plugin_openproject_costs['costs_currency'] %>+ <%= Setting.plugin_costs['costs_currency'] %></span><button type="submit"class="button submit_cost_type">diff --git a/modules/costs/app/views/cost_types/_rate.html.erb b/modules/costs/app/views/cost_types/_rate.html.erbindex f621fea39b0..5a1fd6e2730 100644--- a/modules/costs/app/views/cost_types/_rate.html.erb+++ b/modules/costs/app/views/cost_types/_rate.html.erb@@ -64,7 +64,7 @@ See docs/COPYRIGHT.rdoc for more details.value: rate.rate ? rate.rate.round(2) : "",required: true %><span class="form-label">- <%= Setting.plugin_openproject_costs['costs_currency'] %>+ <%= Setting.plugin_costs['costs_currency'] %></span></span></td>diff --git a/modules/costs/app/views/costlog/_cost_type_unit_plural.html.erb b/modules/costs/app/views/costlog/_cost_type_unit_plural.html.erbdeleted file mode 100644index 3c4ecbfff34..00000000000--- a/modules/costs/app/views/costlog/_cost_type_unit_plural.html.erb+++ /dev/null@@ -1,30 +0,0 @@-<%#-- copyright-OpenProject is an open source project management software.-Copyright (C) 2012-2020 the OpenProject GmbH--This program is free software; you can redistribute it and/or-modify it under the terms of the GNU General Public License version 3.--OpenProject is a fork of ChiliProject, which is a fork of Redmine. The copyright follows:-Copyright (C) 2006-2017 Jean-Philippe Lang-Copyright (C) 2010-2013 the ChiliProject Team--This program is free software; you can redistribute it and/or-modify it under the terms of the GNU General Public License-as published by the Free Software Foundation; either version 2-of the License, or (at your option) any later version.--This program is distributed in the hope that it will be useful,-but WITHOUT ANY WARRANTY; without even the implied warranty of-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the-GNU General Public License for more details.--You should have received a copy of the GNU General Public License-along with this program; if not, write to the Free Software-Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.--See docs/COPYRIGHT.rdoc for more details.--++#%>--<%= h(@cost_type.unit_plural) if @cost_type %>diff --git a/modules/costs/app/views/costlog/edit.html.erb b/modules/costs/app/views/costlog/edit.html.erbindex dd8e18bd09f..19aa82069d9 100644--- a/modules/costs/app/views/costlog/edit.html.erb+++ b/modules/costs/app/views/costlog/edit.html.erb@@ -38,7 +38,7 @@ See docs/COPYRIGHT.rdoc for more details.:post ::put %>-<remote-field-updater data-url="<%= url_for(controller: :cost_objects, action: :update_material_budget_item, project_id: @cost_entry.project) %>"+<remote-field-updater data-url="<%= url_for(controller: :budgets, action: :update_material_budget_item, project_id: @cost_entry.project) %>"data-mode="json"></remote-field-updater><%= labelled_tabular_form_for @cost_entry, url: url, html: { method: method } do |f| %>@@ -119,7 +119,7 @@ See docs/COPYRIGHT.rdoc for more details.</a><% else %><span id="cost_entry_costs_editor" class="form--text-field-container">- <input class="currency form--text-field" value="<%= number_to_currency(@cost_entry.overridden_costs, unit: "").strip if @cost_entry.overridden_costs %>" size="7" name="cost_entry[overridden_costs]" id="cost_entry_costs_edit"/> <%= Setting.plugin_openproject_costs['costs_currency'] %>+ <input class="currency form--text-field" value="<%= number_to_currency(@cost_entry.overridden_costs, unit: "").strip if @cost_entry.overridden_costs %>" size="7" name="cost_entry[overridden_costs]" id="cost_entry_costs_edit"/> <%= Setting.plugin_costs['costs_currency'] %></span><br /><em><%= t(:help_override_rate) %></em><% end %>diff --git a/modules/costs/app/views/hooks/costs/_view_work_package_show_action_menu.html.erb b/modules/costs/app/views/hooks/costs/_view_work_package_show_action_menu.html.erbdeleted file mode 100644index e92efd5e67c..00000000000--- a/modules/costs/app/views/hooks/costs/_view_work_package_show_action_menu.html.erb+++ /dev/null@@ -1,33 +0,0 @@-<%#-- copyright-OpenProject is an open source project management software.-Copyright (C) 2012-2020 the OpenProject GmbH--This program is free software; you can redistribute it and/or-modify it under the terms of the GNU General Public License version 3.--OpenProject is a fork of ChiliProject, which is a fork of Redmine. The copyright follows:-Copyright (C) 2006-2017 Jean-Philippe Lang-Copyright (C) 2010-2013 the ChiliProject Team--This program is free software; you can redistribute it and/or-modify it under the terms of the GNU General Public License-as published by the Free Software Foundation; either version 2-of the License, or (at your option) any later version.--This program is distributed in the hope that it will be useful,-but WITHOUT ANY WARRANTY; without even the implied warranty of-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the-GNU General Public License for more details.--You should have received a copy of the GNU General Public License-along with this program; if not, write to the Free Software-Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.--See docs/COPYRIGHT.rdoc for more details.--++#%>--<% if @project && @project.module_enabled?(:costs_module) %>- <hr />- <%= li_unless_nil(link_to_if_authorized t(:button_log_costs), {:controller => '/costlog', :action => 'new', :work_package_id => work_package}, :class => 'icon-context icon-projects') %>-<% end %>diff --git a/modules/costs/app/views/hooks/costs/_view_work_packages_bulk_edit_details_bottom.html.erb b/modules/costs/app/views/hooks/costs/_view_work_packages_bulk_edit_details_bottom.html.erbdeleted file mode 100644index 0485d675af2..00000000000--- a/modules/costs/app/views/hooks/costs/_view_work_packages_bulk_edit_details_bottom.html.erb+++ /dev/null@@ -1,41 +0,0 @@-<%#-- copyright-OpenProject is an open source project management software.-Copyright (C) 2012-2020 the OpenProject GmbH--This program is free software; you can redistribute it and/or-modify it under the terms of the GNU General Public License version 3.--OpenProject is a fork of ChiliProject, which is a fork of Redmine. The copyright follows:-Copyright (C) 2006-2017 Jean-Philippe Lang-Copyright (C) 2010-2013 the ChiliProject Team--This program is free software; you can redistribute it and/or-modify it under the terms of the GNU General Public License-as published by the Free Software Foundation; either version 2-of the License, or (at your option) any later version.--This program is distributed in the hope that it will be useful,-but WITHOUT ANY WARRANTY; without even the implied warranty of-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the-GNU General Public License for more details.--You should have received a copy of the GNU General Public License-along with this program; if not, write to the Free Software-Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.--See docs/COPYRIGHT.rdoc for more details.--++#%>--<% if @project && @project.module_enabled?(:costs_module) %>- <div class="form--field">- <label class="form--label" for='cost_object_id'><%= CostObject.model_name.human %></label>- <div class="form--field-container">- <%= styled_select_tag('cost_object_id',- content_tag('option', t(:label_no_change_option), :value => '') +- content_tag('option', t(:label_none), :value => 'none') +- options_from_collection_for_select(CostObject.where(project_id: @project.id).order(Arel.sql('subject ASC')), :id, :subject))- %>- </div>- </div>-<% end %>diff --git a/modules/costs/app/views/hooks/costs/_view_work_packages_move_bottom.html.erb b/modules/costs/app/views/hooks/costs/_view_work_packages_move_bottom.html.erbdeleted file mode 100644index 6b50c42acaf..00000000000--- a/modules/costs/app/views/hooks/costs/_view_work_packages_move_bottom.html.erb+++ /dev/null@@ -1,37 +0,0 @@-<%#-- copyright-OpenProject is an open source project management software.-Copyright (C) 2012-2020 the OpenProject GmbH--This program is free software; you can redistribute it and/or-modify it under the terms of the GNU General Public License version 3.--OpenProject is a fork of ChiliProject, which is a fork of Redmine. The copyright follows:-Copyright (C) 2006-2017 Jean-Philippe Lang-Copyright (C) 2010-2013 the ChiliProject Team--This program is free software; you can redistribute it and/or-modify it under the terms of the GNU General Public License-as published by the Free Software Foundation; either version 2-of the License, or (at your option) any later version.--This program is distributed in the hope that it will be useful,-but WITHOUT ANY WARRANTY; without even the implied warranty of-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the-GNU General Public License for more details.--You should have received a copy of the GNU General Public License-along with this program; if not, write to the Free Software-Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.--See docs/COPYRIGHT.rdoc for more details.--++#%>--<% if @project && @project.module_enabled?(:costs_module) %>- <div class="form--field">- <%= styled_label_tag :cost_object_id, CostObject.model_name.human %>- <%= styled_select_tag('cost_object_id', (@target_project == @project ? content_tag('option', t(:label_no_change_option), :value => '') : "") +- content_tag('option', t(:label_none), :value => 'none') +- options_from_collection_for_select(@target_project.cost_objects, :id, :subject)) %>- </div>-<% end %>diff --git a/modules/costs/app/views/hourly_rates/_rate.html.erb b/modules/costs/app/views/hourly_rates/_rate.html.erbindex 31a7d5ee8cf..202fc037dc0 100644--- a/modules/costs/app/views/hourly_rates/_rate.html.erb+++ b/modules/costs/app/views/hourly_rates/_rate.html.erb@@ -56,7 +56,7 @@ See docs/COPYRIGHT.rdoc for more details.value: rate.rate ? rate.rate.round(2) : "",required: true %><span class="form-label">- <%= Setting.plugin_openproject_costs['costs_currency'] %>+ <%= Setting.plugin_costs['costs_currency'] %></span></span></td>diff --git a/modules/costs/app/views/settings/_openproject_costs.html.erb b/modules/costs/app/views/settings/_costs.html.erbsimilarity index 96%rename from modules/costs/app/views/settings/_openproject_costs.html.erbrename to modules/costs/app/views/settings/_costs.html.erbindex 74863026acb..6f323993b99 100644--- a/modules/costs/app/views/settings/_openproject_costs.html.erb+++ b/modules/costs/app/views/settings/_costs.html.erb@@ -26,7 +26,7 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.See docs/COPYRIGHT.rdoc for more details.++#%>-<% html_title l(:label_administration), 'Openproject Costs' %>+<% html_title l(:label_administration), t(:project_module_costs) %><div class="form--field"><%= styled_label_tag :label_currency, t(:label_currency) %><div class="form--field-container">diff --git a/modules/costs/config/locales/crowdin/ar.yml b/modules/costs/config/locales/crowdin/ar.ymlindex 03c3125b435..3ca7d7e73bf 100644--- a/modules/costs/config/locales/crowdin/ar.yml+++ b/modules/costs/config/locales/crowdin/ar.yml@@ -27,7 +27,7 @@ ar:overridden_costs: "تكاليف متجاوزة"spent: "أنفق"spent_on: "التاريخ"- cost_object:+ budget:author: "المؤلف"available: "متاح"budget: "مُخَطَّط"@@ -45,7 +45,7 @@ ar:unit_plural: "اسم الوحدة متعددة الأقطاب"work_package:costs_by_type: "الوحدات المستهلكة"- cost_object_subject: "عنوان الميزانية"+ budget_subject: "عنوان الميزانية"labor_costs: "تكاليف العمل"material_costs: "تكاليف الوحدة"overall_costs: "التكاليف الإجمالية"@@ -55,11 +55,11 @@ ar:rate: "المعدل"user:default_rates: "المعدلات المفترضة"- variable_cost_object:+ budget:labor_budget: "تكاليف العمل المخطط لها"material_budget: "تكاليف الوحدة المخطط لها"models:- cost_object: "الميزانية"+ budget: "الميزانية"cost_type:zero: "أنواع التكلفة"one: "أنواع التكلفة"@@ -77,7 +77,7 @@ ar:attributes:budget: "التكاليف المخطط لها"comment: "تعليق"- cost_object: "الميزانية"+ budget: "الميزانية"cost_type: "أنواع التكلفة"costs: "التكاليف"current_rate: "المعدل الحالي"@@ -85,7 +85,7 @@ ar:units: "الوحدات"valid_from: "صالح من"button_add_budget_item: "أضِف التكاليف المخطط لها"- button_add_cost_object: "أضِف الميزانية"+ button_add_budget: "أضِف الميزانية"button_add_cost_type: "أضِف نوع التكلفة"button_add_rate: "أضِف المعدل"button_cancel_edit_budget: "قُم بإلغاء تعديل الميزانية"@@ -106,10 +106,10 @@ ar:caption_save_rate: "معدل التوفير"caption_set_rate: "ضبط المعدل الحالي"caption_show_locked: "إظهار الأنواع المغلقة"- cost_objects_title: "الميزانيات"+ budgets_title: "الميزانيات"description_date_for_new_rate: "تاريخ المعدل الجديد"events:- cost_object: "تم تعديل الميزانية"+ budget: "تم تعديل الميزانية"group_by_others: "ليس في أي مجموعة"help_click_to_edit: "اضغط هنا للتعديل."help_currency_format: "شكل قِيَم العملة المعروضة. %n تم إبداله بقيمة العملة، %u تم إبداله بوحدة العملة."@@ -117,10 +117,10 @@ ar:label_between: "بين"label_cost_filter_add: "أضِف عامل تصفية لإدخال التكلفة"label_costlog: "تكاليف الوحدة المسجلة"- label_cost_object: "الميزانية"- label_cost_object_id: "الميزانية #%{id}"- label_cost_object_new: "الميزانية الجديدة"- label_cost_object_plural: "الميزانيات"+ label_budget: "الميزانية"+ label_budget_id: "الميزانية #%{id}"+ label_budget_new: "الميزانية الجديدة"+ label_budget_plural: "الميزانيات"label_cost_plural: "التكاليف"label_cost_report: "تقرير التكلفة"label_cost_type_specific: "الميزانية #%{id}:\n%{name}"@@ -137,7 +137,7 @@ ar:label_display_time_entries: "عرض الساعات المبلّغ عنها"label_display_types: "أنواع العرض"label_edit: "تعديل"- label_fixed_cost_object: "الميزانية الثابتة"+ label_fixed_budget: "الميزانية الثابتة"label_fixed_date: "تاريخ ثابت"label_generic_user: "المستخدم العام"label_greater_or_equal: "=<"@@ -159,17 +159,17 @@ ar:label_user: "المستخدم"label_until: "حتى"label_valid_from: "صالح من"- label_variable_cost_object: "الميزانية على أساس معدل متغير"- label_view_all_cost_objects: "عرض جميع الميزانيات"+ label_budget: "الميزانية على أساس معدل متغير"+ label_view_all_budgets: "عرض جميع الميزانيات"label_yes: "نعم"- notice_cost_object_conflict: "مجموعات العمل يجب أن تكون لنفس المشروع."- notice_no_cost_objects_available: "لا يوجد ميزانيات متاحة."+ notice_budget_conflict: "مجموعات العمل يجب أن تكون لنفس المشروع."+ notice_no_budgets_available: "لا يوجد ميزانيات متاحة."notice_something_wrong: "حصل خطأ ما. من فضلك حاول مرة أخرى."notice_successful_restore: "استعادة ناجحة."notice_successful_lock: "أغلِقت بنجاح."notice_cost_logged_successfully: 'تمّ تسجيل تكلفة الوحدة بنجاح.'permission_edit_cost_entries: "تحرير تكاليف الوحدة المحجوزة"- permission_edit_cost_objects: "تحرير الميزانية"+ permission_edit_budgets: "تحرير الميزانية"permission_edit_own_cost_entries: "تحرير تكاليف الوحدة المحجوزة الخاصة"permission_edit_hourly_rates: "تحرير الأجور الساعيّة"permission_edit_own_hourly_rate: "تعديل الأجور الساعيّة الخاصة"@@ -177,15 +177,15 @@ ar:permission_log_costs: "حجز تكاليف الوحدة"permission_log_own_costs: "حجز تكاليف الوحدة لنفسه"permission_view_cost_entries: "عرض تكاليف الحجز"- permission_view_cost_objects: "عرض الميزانيات"+ permission_view_budgets: "عرض الميزانيات"permission_view_cost_rates: "عرض معدلات التكلفة"permission_view_hourly_rates: "عرض جميع الأجور الساعيّة"permission_view_own_cost_entries: "عرض تكاليف الحجز الخاصة"permission_view_own_hourly_rate: "عرض الأجور الساعيّة الخاصة"permission_view_own_time_entries: "عرض الوقت الخاص الذي تم قضاؤه"- project_module_costs_module: "الميزانيات"+ project_module_costs: "الميزانيات"text_assign_time_and_cost_entries_to_project: "تعيين الساعات والتكاليف التي تمّ الإبلاغ عنها للمشروع"- text_cost_object_change_type_confirmation: "هل أنت متأكد؟ هذه العملية ستدمر معلومات نوع الميزانية المحددة."+ text_budget_change_type_confirmation: "هل أنت متأكد؟ هذه العملية ستدمر معلومات نوع الميزانية المحددة."text_destroy_cost_entries_question: "%{cost_entries} تم الإبلاغ عنها في مجموعات العمل التي توشك أن تلغيها. ماذا تريد أن تفعل؟"text_destroy_time_and_cost_entries: "إلغاء الساعات والتكاليف التي تم الإبلاغ عنها"text_destroy_time_and_cost_entries_question: "%{hours} ساعات، %{cost_entries} تم الإبلاغ عنها في مجموعات العمل التي توشك على إلغائها. ماذا تريد أن تفعل؟"diff --git a/modules/costs/config/locales/crowdin/bg.yml b/modules/costs/config/locales/crowdin/bg.ymlindex bdc9f1ae99c..8561345963f 100644--- a/modules/costs/config/locales/crowdin/bg.yml+++ b/modules/costs/config/locales/crowdin/bg.yml@@ -27,7 +27,7 @@ bg:overridden_costs: "Отменени разходи"spent: "Отменено"spent_on: "Дата"- cost_object:+ budget:author: "Автор"available: "Достъпно"budget: "Планирано"@@ -45,7 +45,7 @@ bg:unit_plural: "Плурализирано име на единица"work_package:costs_by_type: "Изразходвани единици"- cost_object_subject: "Заглавие на бюджета"+ budget_subject: "Заглавие на бюджета"labor_costs: "Разходи за труд"material_costs: "Единични разходи"overall_costs: "Общи разходи"@@ -55,11 +55,11 @@ bg:rate: "Ставка"user:default_rates: "Ставка по подразбиране"- variable_cost_object:+ budget:labor_budget: "Планирани разходи за труд"material_budget: "Планирани единични разходи"models:- cost_object: "Бюджет"+ budget: "Бюджет"cost_type:one: "Cost type"other: "Cost types"@@ -73,7 +73,7 @@ bg:attributes:budget: "Планирани разходи"comment: "Коментар"- cost_object: "Бюджет"+ budget: "Бюджет"cost_type: "Тип разходи"costs: "Разходи"current_rate: "Текуща ставка"@@ -81,7 +81,7 @@ bg:units: "Units"valid_from: "Валиден от"button_add_budget_item: "Добавете планираните разходи"- button_add_cost_object: "Добавете бюджет"+ button_add_budget: "Добавете бюджет"button_add_cost_type: "Добавете тип разходи"button_add_rate: "Добавете курс"button_cancel_edit_budget: "Анулиране редактирането на бюджета"@@ -102,10 +102,10 @@ bg:caption_save_rate: "Съхраняване на ставката"caption_set_rate: "Задайте текуща ставка"caption_show_locked: "Показване на заключените типове"- cost_objects_title: "Бюджети"+ budgets_title: "Бюджети"description_date_for_new_rate: "Date for new rate"events:- cost_object: "Budget edited"+ budget: "Budget edited"group_by_others: "not in any group"help_click_to_edit: "Click here to edit."help_currency_format: "Format of displayed currency values. %n is replaced with the currency value, %u ist replaced with the currency unit."@@ -113,10 +113,10 @@ bg:label_between: "между"label_cost_filter_add: "Add cost entry filter"label_costlog: "Logged unit costs"- label_cost_object: "Бюджет"- label_cost_object_id: "Budget #%{id}"- label_cost_object_new: "New budget"- label_cost_object_plural: "Бюджети"+ label_budget: "Бюджет"+ label_budget_id: "Budget #%{id}"+ label_budget_new: "New budget"+ label_budget_plural: "Бюджети"label_cost_plural: "Разходи"label_cost_report: "Cost report"label_cost_type_specific: "Budget #%{id}: %{name}"@@ -133,7 +133,7 @@ bg:label_display_time_entries: "Display reported hours"label_display_types: "Display types"label_edit: "Редактиране"- label_fixed_cost_object: "Fixed budget"+ label_fixed_budget: "Fixed budget"label_fixed_date: "Фиксирана дата"label_generic_user: "Generic user"label_greater_or_equal: ">="@@ -155,17 +155,17 @@ bg:label_user: "Потребител"label_until: "until"label_valid_from: "Валиден от"- label_variable_cost_object: "Variable rate based budget"- label_view_all_cost_objects: "View all budgets"+ label_budget: "Variable rate based budget"+ label_view_all_budgets: "View all budgets"label_yes: "Да"- notice_cost_object_conflict: "WorkPackages must be of the same project."- notice_no_cost_objects_available: "No budgets available."+ notice_budget_conflict: "WorkPackages must be of the same project."+ notice_no_budgets_available: "No budgets available."notice_something_wrong: "Something went wrong. Please try again."notice_successful_restore: "Successful restore."notice_successful_lock: "Locked successfully."notice_cost_logged_successfully: 'Unit cost logged successfully.'permission_edit_cost_entries: "Edit booked unit costs"- permission_edit_cost_objects: "Edit budgets"+ permission_edit_budgets: "Edit budgets"permission_edit_own_cost_entries: "Edit own booked unit costs"permission_edit_hourly_rates: "Edit hourly rates"permission_edit_own_hourly_rate: "Edit own hourly rates"@@ -173,15 +173,15 @@ bg:permission_log_costs: "Book unit costs"permission_log_own_costs: "Book unit costs for oneself"permission_view_cost_entries: "View booked costs"- permission_view_cost_objects: "View budgets"+ permission_view_budgets: "View budgets"permission_view_cost_rates: "View cost rates"permission_view_hourly_rates: "Вижте всички почасови тарифи"permission_view_own_cost_entries: "Вижте собствените резервирани разходи"permission_view_own_hourly_rate: "Вижте собствената почасова ставка"permission_view_own_time_entries: "Вижте собственото си отработено време"- project_module_costs_module: "Бюджети"+ project_module_costs: "Бюджети"text_assign_time_and_cost_entries_to_project: "Присвойте отчетени часове и разходи на проекта"- text_cost_object_change_type_confirmation: "Сигурен ли си? Тази операция ще унищожи информация за конкретния тип бюджет."+ text_budget_change_type_confirmation: "Сигурен ли си? Тази операция ще унищожи информация за конкретния тип бюджет."text_destroy_cost_entries_question: "%{cost_entries} бяха отчетени в работните пакети, които ще изтриете. Какво искаш да правиш?"text_destroy_time_and_cost_entries: "Изтрийте отчетените часове и разходи"text_destroy_time_and_cost_entries_question: "%{hours} часа, %{cost_entries} бяха отчетени в работните пакети, които предстои да изтриете. Какво искаш да правиш?"diff --git a/modules/costs/config/locales/crowdin/ca.yml b/modules/costs/config/locales/crowdin/ca.ymlindex 7f5c573f4f1..fcdfb0604c3 100644--- a/modules/costs/config/locales/crowdin/ca.yml+++ b/modules/costs/config/locales/crowdin/ca.yml@@ -27,7 +27,7 @@ ca:overridden_costs: "Overridden costs"spent: "Spent"spent_on: "Data"- cost_object:+ budget:author: "Autor/a"available: "Available"budget: "Planned"@@ -45,7 +45,7 @@ ca:unit_plural: "Pluralized unit name"work_package:costs_by_type: "Spent units"- cost_object_subject: "Budget title"+ budget_subject: "Budget title"labor_costs: "Labor costs"material_costs: "Unit costs"overall_costs: "Overall costs"@@ -55,11 +55,11 @@ ca:rate: "Rate"user:default_rates: "Default rates"- variable_cost_object:+ budget:labor_budget: "Planned labor costs"material_budget: "Planned unit costs"models:- cost_object: "Budget"+ budget: "Budget"cost_type:one: "Cost type"other: "Cost types"@@ -73,7 +73,7 @@ ca:attributes:budget: "Planned costs"comment: "Comentari"- cost_object: "Budget"+ budget: "Budget"cost_type: "Cost type"costs: "Costs"current_rate: "Current rate"@@ -81,7 +81,7 @@ ca:units: "Unitats"valid_from: "Valid from"button_add_budget_item: "Add planned costs"- button_add_cost_object: "Add budget"+ button_add_budget: "Add budget"button_add_cost_type: "Add cost type"button_add_rate: "Add rate"button_cancel_edit_budget: "Cancel editing budget"@@ -102,10 +102,10 @@ ca:caption_save_rate: "Save rate"caption_set_rate: "Set current rate"caption_show_locked: "Show locked types"- cost_objects_title: "Budgets"+ budgets_title: "Budgets"description_date_for_new_rate: "Date for new rate"events:- cost_object: "Budget edited"+ budget: "Budget edited"group_by_others: "not in any group"help_click_to_edit: "Click here to edit."help_currency_format: "Format of displayed currency values. %n is replaced with the currency value, %u ist replaced with the currency unit."@@ -113,10 +113,10 @@ ca:label_between: "between"label_cost_filter_add: "Add cost entry filter"label_costlog: "Logged unit costs"- label_cost_object: "Budget"- label_cost_object_id: "Budget #%{id}"- label_cost_object_new: "New budget"- label_cost_object_plural: "Budgets"+ label_budget: "Budget"+ label_budget_id: "Budget #%{id}"+ label_budget_new: "New budget"+ label_budget_plural: "Budgets"label_cost_plural: "Costs"label_cost_report: "Cost report"label_cost_type_specific: "Budget #%{id}: %{name}"@@ -133,7 +133,7 @@ ca:label_display_time_entries: "Display reported hours"label_display_types: "Display types"label_edit: "Editar"- label_fixed_cost_object: "Fixed budget"+ label_fixed_budget: "Fixed budget"label_fixed_date: "Fixed date"label_generic_user: "Generic user"label_greater_or_equal: ">="@@ -155,17 +155,17 @@ ca:label_user: "Usuari"label_until: "until"label_valid_from: "Valid from"- label_variable_cost_object: "Variable rate based budget"- label_view_all_cost_objects: "View all budgets"+ label_budget: "Variable rate based budget"+ label_view_all_budgets: "View all budgets"label_yes: "Sí"- notice_cost_object_conflict: "WorkPackages must be of the same project."- notice_no_cost_objects_available: "No budgets available."+ notice_budget_conflict: "WorkPackages must be of the same project."+ notice_no_budgets_available: "No budgets available."notice_something_wrong: "Something went wrong. Please try again."notice_successful_restore: "Successful restore."notice_successful_lock: "Locked successfully."notice_cost_logged_successfully: 'Unit cost logged successfully.'permission_edit_cost_entries: "Edit booked unit costs"- permission_edit_cost_objects: "Edit budgets"+ permission_edit_budgets: "Edit budgets"permission_edit_own_cost_entries: "Edit own booked unit costs"permission_edit_hourly_rates: "Edit hourly rates"permission_edit_own_hourly_rate: "Edit own hourly rates"@@ -173,15 +173,15 @@ ca:permission_log_costs: "Book unit costs"permission_log_own_costs: "Book unit costs for oneself"permission_view_cost_entries: "View booked costs"- permission_view_cost_objects: "View budgets"+ permission_view_budgets: "View budgets"permission_view_cost_rates: "View cost rates"permission_view_hourly_rates: "View all hourly rates"permission_view_own_cost_entries: "View own booked costs"permission_view_own_hourly_rate: "View own hourly rate"permission_view_own_time_entries: "View own spent time"- project_module_costs_module: "Budgets"+ project_module_costs: "Budgets"text_assign_time_and_cost_entries_to_project: "Assign reported hours and costs to the project"- text_cost_object_change_type_confirmation: "Are you sure? This operation will destroy information of the specific budget type."+ text_budget_change_type_confirmation: "Are you sure? This operation will destroy information of the specific budget type."text_destroy_cost_entries_question: "%{cost_entries} were reported on the work packages you are about to delete. What do you want to do ?"text_destroy_time_and_cost_entries: "Delete reported hours and costs"text_destroy_time_and_cost_entries_question: "%{hours} hours, %{cost_entries} were reported on the work packages you are about to delete. What do you want to do ?"diff --git a/modules/costs/config/locales/crowdin/cs.yml b/modules/costs/config/locales/crowdin/cs.ymlindex be89c871baf..048505540f1 100644--- a/modules/costs/config/locales/crowdin/cs.yml+++ b/modules/costs/config/locales/crowdin/cs.yml@@ -27,7 +27,7 @@ cs:overridden_costs: "Přepsané náklady"spent: "Strávený čas"spent_on: "Datum"- cost_object:+ budget:author: "Autor"available: "Dostupné"budget: "Rozpočet"@@ -45,7 +45,7 @@ cs:unit_plural: "Jméno jednotek (mn.č.)"work_package:costs_by_type: "Strávené jednotky"- cost_object_subject: "Název rozpočtu"+ budget_subject: "Název rozpočtu"labor_costs: "Náklady práce"material_costs: "Ceny jednotky"overall_costs: "Celkové náklady"@@ -55,11 +55,11 @@ cs:rate: "Kurz"user:default_rates: "Výchozí sazby"- variable_cost_object:+ budget:labor_budget: "Plánované mzdové náklady"material_budget: "Plánované jednotkové náklady"models:- cost_object: "Rozpočet"+ budget: "Rozpočet"cost_type:one: "Druh nákladů"few: "Typy nákladů"@@ -75,7 +75,7 @@ cs:attributes:budget: "Plánované náklady"comment: "Komentář"- cost_object: "Rozpočet"+ budget: "Rozpočet"cost_type: "Typ nákladu"costs: "Náklady"current_rate: "Aktuální sazba"@@ -83,7 +83,7 @@ cs:units: "Jednotky"valid_from: "Platné od"button_add_budget_item: "Přidat plánované náklady"- button_add_cost_object: "Přidat rozpočet"+ button_add_budget: "Přidat rozpočet"button_add_cost_type: "Přidat typ nákladů"button_add_rate: "Přidat kurz"button_cancel_edit_budget: "Zrušit úpravu rozpočtu"@@ -104,10 +104,10 @@ cs:caption_save_rate: "Uložit kurz"caption_set_rate: "Nastavit aktuální sazbu."caption_show_locked: "Zobrazit uzamčené typy"- cost_objects_title: "Rozpočty"+ budgets_title: "Rozpočty"description_date_for_new_rate: "Datum pro nový kurz"events:- cost_object: "Rozpočet editován"+ budget: "Rozpočet editován"group_by_others: "není v žádné skupině"help_click_to_edit: "Klikněte zde pro úpravu."help_currency_format: "Formát zobrazených hodnot měn. %n je nahrazen hodnotou měny, %u je nahrazen jednotkou měny."@@ -115,10 +115,10 @@ cs:label_between: "mezi"label_cost_filter_add: "Přidat filtr nákladového vstupu"label_costlog: "Logované jednotkové náklady"- label_cost_object: "Rozpočet"- label_cost_object_id: "Rozpočet č.%{id}"- label_cost_object_new: "Nový rozpočet"- label_cost_object_plural: "Rozpočty"+ label_budget: "Rozpočet"+ label_budget_id: "Rozpočet č.%{id}"+ label_budget_new: "Nový rozpočet"+ label_budget_plural: "Rozpočty"label_cost_plural: "Náklady"label_cost_report: "Výkaz nákladů"label_cost_type_specific: "Rozpočet č.%{id}: %{name}"@@ -135,7 +135,7 @@ cs:label_display_time_entries: "Zobrazit nahlášené hodiny"label_display_types: "Typy zobrazení"label_edit: "Upravit"- label_fixed_cost_object: "Pevný rozpočet"+ label_fixed_budget: "Pevný rozpočet"label_fixed_date: "Pevné datum"label_generic_user: "Obecný uživatel"label_greater_or_equal: ">="@@ -157,17 +157,17 @@ cs:label_user: "Uživatel"label_until: "do"label_valid_from: "Platné od"- label_variable_cost_object: "Rozpočet založený na proměnlivé sazbě"- label_view_all_cost_objects: "Zobrazit všechny rozpočty"+ label_budget: "Rozpočet založený na proměnlivé sazbě"+ label_view_all_budgets: "Zobrazit všechny rozpočty"label_yes: "Ano"- notice_cost_object_conflict: "Pracovní balíčky musí být ze stejného projektu."- notice_no_cost_objects_available: "Žádné rozpočty nejsou k dispozici."+ notice_budget_conflict: "Pracovní balíčky musí být ze stejného projektu."+ notice_no_budgets_available: "Žádné rozpočty nejsou k dispozici."notice_something_wrong: "Něco se pokazilo. Zkuste to prosím znovu."notice_successful_restore: "Úspěšně obnoveno."notice_successful_lock: "Úspěšně uzamčeno."notice_cost_logged_successfully: 'Jednotková cena byla úspěšně zaznamenána.'permission_edit_cost_entries: "Upravit rezervované jednotkové náklady"- permission_edit_cost_objects: "Upravit rozpočty"+ permission_edit_budgets: "Upravit rozpočty"permission_edit_own_cost_entries: "Upravit vlastní rezervované jednotkové náklady"permission_edit_hourly_rates: "Upravit hodinové sazby"permission_edit_own_hourly_rate: "Upravit vlastní hodinové sazby"@@ -175,15 +175,15 @@ cs:permission_log_costs: "Jednotkové náklady na knihu"permission_log_own_costs: "Knihovní jednotkové náklady"permission_view_cost_entries: "Zobrazit rezervované náklady"- permission_view_cost_objects: "Zobrazit rozpočty"+ permission_view_budgets: "Zobrazit rozpočty"permission_view_cost_rates: "Zobrazit nákladové sazby"permission_view_hourly_rates: "Zobrazit všechny hodinové sazby"permission_view_own_cost_entries: "Zobrazit vlastní rezervované náklady"permission_view_own_hourly_rate: "Zobrazit vlastní hodinovou sazbu"permission_view_own_time_entries: "Zobrazit vlastní strávený čas"- project_module_costs_module: "Rozpočty"+ project_module_costs: "Rozpočty"text_assign_time_and_cost_entries_to_project: "Přiřadit nahlášené hodiny a náklady projektu"- text_cost_object_change_type_confirmation: "Jste si jisti? Tato operace zničí informace o konkrétním typu rozpočtu."+ text_budget_change_type_confirmation: "Jste si jisti? Tato operace zničí informace o konkrétním typu rozpočtu."text_destroy_cost_entries_question: "%{cost_entries} byl nahlášen k pracovním balíčkům, které se chystáte odstranit. Co chcete udělat?"text_destroy_time_and_cost_entries: "Odstranit nahlášené hodiny a náklady"text_destroy_time_and_cost_entries_question: "%{hours} hodin, %{cost_entries} byly nahlášeny v pracovních balíčcích, které se chystáte odstranit. Co chcete udělat?"diff --git a/modules/costs/config/locales/crowdin/da.yml b/modules/costs/config/locales/crowdin/da.ymlindex b974f2a7501..a004c4d1689 100644--- a/modules/costs/config/locales/crowdin/da.yml+++ b/modules/costs/config/locales/crowdin/da.yml@@ -27,7 +27,7 @@ da:overridden_costs: "Tilsidesatte omkostninger"spent: "Forbrugt"spent_on: "Dato"- cost_object:+ budget:author: "Forfatter"available: "Tillrådighed"budget: "Planlagte"@@ -45,7 +45,7 @@ da:unit_plural: "Pluralistisk enhedsnavn"work_package:costs_by_type: "Forbrugte enheder"- cost_object_subject: "Budgettitel"+ budget_subject: "Budgettitel"labor_costs: "Lønomkostninger"material_costs: "Enhedsomkostninger"overall_costs: "Samlede omkostninger"@@ -55,11 +55,11 @@ da:rate: "Sats"user:default_rates: "Standardsatser"- variable_cost_object:+ budget:labor_budget: "Planlagte lønomkostninger"material_budget: "Planlagte enhedsomkostninger"models:- cost_object: "Budget"+ budget: "Budget"cost_type:one: "Omkostningstype"other: "Omkostningstyper"@@ -73,7 +73,7 @@ da:attributes:budget: "Planlagte omkostninger"comment: "Kommentér"- cost_object: "Budget"+ budget: "Budget"cost_type: "Omkostningstype"costs: "Omkostninger"current_rate: "Nuværende sats"@@ -81,7 +81,7 @@ da:units: "Enheder"valid_from: "Gældende fra"button_add_budget_item: "Tilføj planlagte omkostninger"- button_add_cost_object: "Tilføj budget"+ button_add_budget: "Tilføj budget"button_add_cost_type: "Tilføj omkostningstype"button_add_rate: "Tilføj sats"button_cancel_edit_budget: "Annullér budgetredigering"@@ -102,10 +102,10 @@ da:caption_save_rate: "Gem sats"caption_set_rate: "Indstil nuværende sats"caption_show_locked: "Vis låste typer"- cost_objects_title: "Budgetter"+ budgets_title: "Budgetter"description_date_for_new_rate: "Dato for ny sats"events:- cost_object: "Budget redigeret"+ budget: "Budget redigeret"group_by_others: "ikke i nogen gruppe"help_click_to_edit: "Klik her for at redigere."help_currency_format: "Format for viste valutaværdier. %n erstattes med valutaværdien, %u erstattes med valutaenheden."@@ -113,10 +113,10 @@ da:label_between: "mellem"label_cost_filter_add: "Tilføj omkostningangivelsesfilter"label_costlog: "Registrerede enhedsomkostninger"- label_cost_object: "Budget"- label_cost_object_id: "Budget #%{id}"- label_cost_object_new: "Nyt budget"- label_cost_object_plural: "Budgetter"+ label_budget: "Budget"+ label_budget_id: "Budget #%{id}"+ label_budget_new: "Nyt budget"+ label_budget_plural: "Budgetter"label_cost_plural: "Omkostninger"label_cost_report: "Omkostningsrapport"label_cost_type_specific: "Budget #%{id}: %{name}"@@ -133,7 +133,7 @@ da:label_display_time_entries: "Vis indberettede timer"label_display_types: "Vis typer"label_edit: "Rediger"- label_fixed_cost_object: "Fast budget"+ label_fixed_budget: "Fast budget"label_fixed_date: "Fast dato"label_generic_user: "Generisk bruger"label_greater_or_equal: ">="@@ -155,17 +155,17 @@ da:label_user: "Bruger"label_until: "indtil"label_valid_from: "Gældende fra"- label_variable_cost_object: "Variabel sats baseret budget"- label_view_all_cost_objects: "Se alle budgetter"+ label_budget: "Variabel sats baseret budget"+ label_view_all_budgets: "Se alle budgetter"label_yes: "Ja"- notice_cost_object_conflict: "Arbejdspakker skal være fra samme projekt."- notice_no_cost_objects_available: "Ingen tilgængelige budgetter."+ notice_budget_conflict: "Arbejdspakker skal være fra samme projekt."+ notice_no_budgets_available: "Ingen tilgængelige budgetter."notice_something_wrong: "Noget gik galt. Forsøg venligst igen."notice_successful_restore: "Gendannet."notice_successful_lock: "Locked successfully."notice_cost_logged_successfully: 'Unit cost logged successfully.'permission_edit_cost_entries: "Redigér reserverede enhedsomkostninger"- permission_edit_cost_objects: "Redigér budgetter"+ permission_edit_budgets: "Redigér budgetter"permission_edit_own_cost_entries: "Redigér egne reserverede enhedsomkostninger"permission_edit_hourly_rates: "Redigér timesatser"permission_edit_own_hourly_rate: "Redigér egne timesatser"@@ -173,15 +173,15 @@ da:permission_log_costs: "Reservationsenhedsomkostninger"permission_log_own_costs: "Reservationsenhedsomkostninger for sig selv"permission_view_cost_entries: "Se reservationsomkostninger"- permission_view_cost_objects: "Se budgetter"+ permission_view_budgets: "Se budgetter"permission_view_cost_rates: "Se omostningssatser"permission_view_hourly_rates: "Se alle timesatser"permission_view_own_cost_entries: "Se egen reservationsomkostninger"permission_view_own_hourly_rate: "Se egen timestaser"permission_view_own_time_entries: "Se eget tidsforbrug"- project_module_costs_module: "Budgetter"+ project_module_costs: "Budgetter"text_assign_time_and_cost_entries_to_project: "Tildel indberettede timer og omkostninger til projektet"- text_cost_object_change_type_confirmation: "Sikker? Denne handling vil ødelægge data for den specifikke budgettype."+ text_budget_change_type_confirmation: "Sikker? Denne handling vil ødelægge data for den specifikke budgettype."text_destroy_cost_entries_question: "%{cost_entries} blev indberettet for de arbejdspakker, som du er ved at slette. Hvad ønsker du at gøre?"text_destroy_time_and_cost_entries: "Slet indberettede timer og omkostninger"text_destroy_time_and_cost_entries_question: "%{hours} timer, %{cost_entries} blev indberettet på de arbejdspakker, som du er ved at slette. Hvad ønsker du at gøre?"diff --git a/modules/costs/config/locales/crowdin/de.yml b/modules/costs/config/locales/crowdin/de.ymlindex 8238fd9e109..fea051d4ab1 100644--- a/modules/costs/config/locales/crowdin/de.yml+++ b/modules/costs/config/locales/crowdin/de.yml@@ -27,7 +27,7 @@ de:overridden_costs: "Überschriebene Kosten"spent: "Verbraucht"spent_on: "Datum"- cost_object:+ budget:author: "Autor"available: "Verfügbar"budget: "Geplant"@@ -45,7 +45,7 @@ de:unit_plural: "Einheit plural"work_package:costs_by_type: "Gebuchte Einheiten"- cost_object_subject: "Budgettitel"+ budget_subject: "Budgettitel"labor_costs: "Personaleinzelkosten"material_costs: "Stückkosten"overall_costs: "Gesamtkosten"@@ -55,11 +55,11 @@ de:rate: "Satz"user:default_rates: "Standardsätze"- variable_cost_object:+ budget:labor_budget: "Geplante Personaleinzelkosten"material_budget: "Geplante Stückkosten"models:- cost_object: "Budget"+ budget: "Budget"cost_type:one: "Kostentyp"other: "Kostentypen"@@ -73,7 +73,7 @@ de:attributes:budget: "Geplante Kosten"comment: "Kommentar"- cost_object: "Budget"+ budget: "Budget"cost_type: "Kostentyp"costs: "Kosten"current_rate: "Aktueller Satz"@@ -81,7 +81,7 @@ de:units: "Einheiten"valid_from: "Gültig ab"button_add_budget_item: "Budgetposition hinzufügen"- button_add_cost_object: "Neues Budget anlegen"+ button_add_budget: "Neues Budget anlegen"button_add_cost_type: "Kostentyp anlegen"button_add_rate: "Satz hinzufügen"button_cancel_edit_budget: "Budget bearbeiten abbrechen"@@ -102,10 +102,10 @@ de:caption_save_rate: "Satz speichern"caption_set_rate: "Aktuellen Satz festlegen"caption_show_locked: "Gesperrte Typen anzeigen"- cost_objects_title: "Budgets"+ budgets_title: "Budgets"description_date_for_new_rate: "Datum für neuen Satz"events:- cost_object: "Budget bearbeitet"+ budget: "Budget bearbeitet"group_by_others: "In keiner der Gruppen"help_click_to_edit: "Hier Klicken zum bearbeiten."help_currency_format: "Format der angezeigten Währungswerte. %n wird mit dem Zahlenwert ersetzt, %u mit der Währung."@@ -113,10 +113,10 @@ de:label_between: "zwischen"label_cost_filter_add: "Kostenfilter hinzufügen"label_costlog: "Gebuchte Stückkosten"- label_cost_object: "Budget"- label_cost_object_id: "Budget #%{id}"- label_cost_object_new: "Neues Budget"- label_cost_object_plural: "Budgets"+ label_budget: "Budget"+ label_budget_id: "Budget #%{id}"+ label_budget_new: "Neues Budget"+ label_budget_plural: "Budgets"label_cost_plural: "Kosten"label_cost_report: "Report"label_cost_type_specific: "Kostentyp #%{id}: %{name}"@@ -133,7 +133,7 @@ de:label_display_time_entries: "Personaleinzelkosten anzeigen"label_display_types: "Angezeigte Eintragsarten"label_edit: "Bearbeiten"- label_fixed_cost_object: "Festes Budget"+ label_fixed_budget: "Festes Budget"label_fixed_date: "Referenzdatum"label_generic_user: "Generischer Benutzer"label_greater_or_equal: ">="@@ -155,17 +155,17 @@ de:label_user: "Benutzer"label_until: "bis"label_valid_from: "Gültig ab"- label_variable_cost_object: "Variables Budget"- label_view_all_cost_objects: "Alle Budgets anzeigen"+ label_budget: "Variables Budget"+ label_view_all_budgets: "Alle Budgets anzeigen"label_yes: "Ja"- notice_cost_object_conflict: "Tickets müssen im gleichen Projekt sein."- notice_no_cost_objects_available: "Kein Budget verfügbar."+ notice_budget_conflict: "Tickets müssen im gleichen Projekt sein."+ notice_no_budgets_available: "Kein Budget verfügbar."notice_something_wrong: "Ein Fehler ist aufgetreten. Bitte versuchen Sie es erneut."notice_successful_restore: "Erfolgreich wiederhergestellt."notice_successful_lock: "Erfolgreich gesperrt."notice_cost_logged_successfully: 'Stückkosten erfolgreich gebucht.'permission_edit_cost_entries: "Bearbeiten gebuchter Stückkosten"- permission_edit_cost_objects: "Budgets bearbeiten"+ permission_edit_budgets: "Budgets bearbeiten"permission_edit_own_cost_entries: "Bearbeiten eigener gebuchter Stückkosten"permission_edit_hourly_rates: "Stundensätze bearbeiten"permission_edit_own_hourly_rate: "Eigene Stundensätze bearbeiten"@@ -173,15 +173,15 @@ de:permission_log_costs: "Stückkosten buchen"permission_log_own_costs: "Eigene Stückkosten buchen"permission_view_cost_entries: "Gebuchte Kosten ansehen"- permission_view_cost_objects: "Budgets ansehen"+ permission_view_budgets: "Budgets ansehen"permission_view_cost_rates: "Anzeigen von Stückpreisen"permission_view_hourly_rates: "Alle Stundensätze ansehen"permission_view_own_cost_entries: "Eigene gebuchte Kosten ansehen"permission_view_own_hourly_rate: "Eigene Stundensätze ansehen"permission_view_own_time_entries: "Eigene gebuchte Aufwände ansehen"- project_module_costs_module: "Budgets"+ project_module_costs: "Budgets"text_assign_time_and_cost_entries_to_project: "Gebuchte Aufwände dem Projekt zuweisen"- text_cost_object_change_type_confirmation: "Sind Sie sicher? Diese Operation wird einige Informationen des aktuellen Budgets löschen."+ text_budget_change_type_confirmation: "Sind Sie sicher? Diese Operation wird einige Informationen des aktuellen Budgets löschen."text_destroy_cost_entries_question: "Es wurden bereits %{cost_entries} auf dieses Ticket gebucht. Was soll mit den Aufwänden geschehen?"text_destroy_time_and_cost_entries: "Gebuchte Aufwände löschen"text_destroy_time_and_cost_entries_question: "Es wurden bereits %{hours} Stunden sowie %{cost_entries} auf dieses Ticket gebucht. Was soll mit den Aufwänden geschehen?"diff --git a/modules/costs/config/locales/crowdin/el.yml b/modules/costs/config/locales/crowdin/el.ymlindex f66e5b1cd88..5b237aa3fdc 100644--- a/modules/costs/config/locales/crowdin/el.yml+++ b/modules/costs/config/locales/crowdin/el.yml@@ -27,7 +27,7 @@ el:overridden_costs: "Παράκαμπψη κόστους"spent: "Δαπανήθηκε"spent_on: "Ημερομηνία"- cost_object:+ budget:author: "Συγγραφέας"available: "Διαθέσιμο"budget: "Προγραμματισμένο"@@ -45,7 +45,7 @@ el:unit_plural: "Πληθυντικός ονόματος μονάδας"work_package:costs_by_type: "Δαπανημένες μονάδες"- cost_object_subject: "Τίτλος προϋπολογισμού"+ budget_subject: "Τίτλος προϋπολογισμού"labor_costs: "Κόστος εργασίας"material_costs: "Κόστος μονάδας"overall_costs: "Συνολικό κόστος"@@ -55,11 +55,11 @@ el:rate: "Αμοιβή"user:default_rates: "Προεπιλεγμένη αμοιβή"- variable_cost_object:+ budget:labor_budget: "Σχεδιασμένο κόστος εργασίας"material_budget: "Σχεδιασμένο κόστος μονάδας"models:- cost_object: "Προϋπολογισμός"+ budget: "Προϋπολογισμός"cost_type:one: "Τύπος κόστους"other: "Τύποι κόστους"@@ -73,7 +73,7 @@ el:attributes:budget: "Σχεδιασμένο κόστος"comment: "Σχόλιο"- cost_object: "Προϋπολογισμός"+ budget: "Προϋπολογισμός"cost_type: "Τύπος κόστους"costs: "Κόστος"current_rate: "Τρέχουσα αμοιβή"@@ -81,7 +81,7 @@ el:units: "Μονάδες"valid_from: "Έγκυρο από"button_add_budget_item: "Προσθήκη σχεδιασμένου κόστους"- button_add_cost_object: "Προσθήκη προϋπολογισμού"+ button_add_budget: "Προσθήκη προϋπολογισμού"button_add_cost_type: "Προσθέστε τύπο κόστους"button_add_rate: "Προσθήκη αμοιβής"button_cancel_edit_budget: "Ακύρωση επεξεργασίας προϋπολογισμού"@@ -102,10 +102,10 @@ el:caption_save_rate: "Αποθηκεύση αμοιβής"caption_set_rate: "Ορίστε την τρέχουσα αμοιβή"caption_show_locked: "Εμφάνιση κλειδωμένων τύπων"- cost_objects_title: "Προϋπολογισμοί"+ budgets_title: "Προϋπολογισμοί"description_date_for_new_rate: "Ημερομηνία για νέα αμοιβή"events:- cost_object: "Ο προϋπολογισμός επεξεργάστηκε"+ budget: "Ο προϋπολογισμός επεξεργάστηκε"group_by_others: "δεν είναι σε καμία ομάδα"help_click_to_edit: "Κάντε κλικ εδώ για επεξεργασία."help_currency_format: "Μορφοποίηση των νομισματικών τιμών που εμφανίζονται. %n αντικαθίσταται με την τρέχουσα τιμή, %u αντικαθίσταται με την τρέχουσα μονάδα."@@ -113,10 +113,10 @@ el:label_between: "μεταξύ"label_cost_filter_add: "Προσθήκη φίλτρου καταχώρησης κόστους"label_costlog: "Καταγεγραμμένο κόστος μονάδας"- label_cost_object: "Προϋπολογισμός"- label_cost_object_id: "Προϋπολογισμός #%{id}"- label_cost_object_new: "Νέος προϋπολογισμός"- label_cost_object_plural: "Προϋπολογισμοί"+ label_budget: "Προϋπολογισμός"+ label_budget_id: "Προϋπολογισμός #%{id}"+ label_budget_new: "Νέος προϋπολογισμός"+ label_budget_plural: "Προϋπολογισμοί"label_cost_plural: "Κόστος"label_cost_report: "Αναφορά κόστους"label_cost_type_specific: "Προϋπολογισμός#%{id}: %{name}"@@ -133,7 +133,7 @@ el:label_display_time_entries: "Εμφάνιση αναφερόμενων ωρών"label_display_types: "Εμφάνιση τύπων"label_edit: "Επεξεργασία"- label_fixed_cost_object: "Σταθερός προϋπολογισμός"+ label_fixed_budget: "Σταθερός προϋπολογισμός"label_fixed_date: "Καθορισμένη ημερομηνία"label_generic_user: "Γενικός χρήστης"label_greater_or_equal: ">="@@ -155,17 +155,17 @@ el:label_user: "Χρήστης"label_until: "μέχρι"label_valid_from: "Έγκυρο από"- label_variable_cost_object: "Προϋπολογισμός με βάση μεταβαλλόμενη αμοιβή"- label_view_all_cost_objects: "Εμφάνιση όλων των προϋπολογισμών"+ label_budget: "Προϋπολογισμός με βάση μεταβαλλόμενη αμοιβή"+ label_view_all_budgets: "Εμφάνιση όλων των προϋπολογισμών"label_yes: "Ναι"- notice_cost_object_conflict: "Τα Πακέτα Εργασίας πρέπει να είναι από το ίδιο έργο."- notice_no_cost_objects_available: "Δεν υπάρχουν διαθέσιμοι προϋπολογισμοί."+ notice_budget_conflict: "Τα Πακέτα Εργασίας πρέπει να είναι από το ίδιο έργο."+ notice_no_budgets_available: "Δεν υπάρχουν διαθέσιμοι προϋπολογισμοί."notice_something_wrong: "Κάτι πήγε στραβά. Παρακαλούμε προσπαθήστε ξανά."notice_successful_restore: "Επιτυχής επαναφορά."notice_successful_lock: "Κλειδώθηκε επιτυχώς."notice_cost_logged_successfully: 'Η μονάδα κόστους καταγράφηκε επιτυχώς.'permission_edit_cost_entries: "Επεξεργασία κλεισμένου κόστους μονάδας"- permission_edit_cost_objects: "Επεξεργασία προϋπολογισμών"+ permission_edit_budgets: "Επεξεργασία προϋπολογισμών"permission_edit_own_cost_entries: "Επεξεργασία δικού μου κλεισμένου κόστους μονάδας"permission_edit_hourly_rates: "Επεξεργασία ωριαίων αμοιβών"permission_edit_own_hourly_rate: "Επεξεργασία των δικών μου ωριαίων αμοιβών"@@ -173,15 +173,15 @@ el:permission_log_costs: "Κράτηση κόστους μονάδας"permission_log_own_costs: "Κράτηση κόστους μονάδα για τον εαυτό του"permission_view_cost_entries: "Εμφάνιση κλεισμένου κόστους"- permission_view_cost_objects: "Εμφάνιση προϋπολογισμών"+ permission_view_budgets: "Εμφάνιση προϋπολογισμών"permission_view_cost_rates: "Εμφάνιση κόστους αμοιβών"permission_view_hourly_rates: "Εμφάνιση όλων των ωριαίων αμοιβών"permission_view_own_cost_entries: "Εμφάνιση του δικού μου κλεισμένου κόστους"permission_view_own_hourly_rate: "Εμφάνιση των δικών μου ωριαίων αμοιβών"permission_view_own_time_entries: "Προβολή του δικού μου χρόνου που δαπανήθηκε"- project_module_costs_module: "Προϋπολογισμοί"+ project_module_costs: "Προϋπολογισμοί"text_assign_time_and_cost_entries_to_project: "Ανάθεση αναφερόμενων ωρών και κόστους στο έργο"- text_cost_object_change_type_confirmation: "Είστε βέβαιοι; Αυτή η διαδικασία θα καταστρέψει πληροφορίες για το συγκεκριμένο τύπο προϋπολογισμού."+ text_budget_change_type_confirmation: "Είστε βέβαιοι; Αυτή η διαδικασία θα καταστρέψει πληροφορίες για το συγκεκριμένο τύπο προϋπολογισμού."text_destroy_cost_entries_question: "%{cost_entries} αναφέρθηκαν στα πακέτα εργασίας που πρόκειται να διαγράψετε. Τι θέλετε να κάνετε;"text_destroy_time_and_cost_entries: "Διαγραφή αναφερόμενων ωρών και κόστους"text_destroy_time_and_cost_entries_question: "%{hours} ώρες, %{cost_entries} αναφέρθηκαν στα πακέτα εργασίας που πρόκειται να διαγράψετε. Τι θέλετε να κάνετε;"diff --git a/modules/costs/config/locales/crowdin/es.yml b/modules/costs/config/locales/crowdin/es.ymlindex 5a6d57f5205..d1e5f72938a 100644--- a/modules/costs/config/locales/crowdin/es.yml+++ b/modules/costs/config/locales/crowdin/es.yml@@ -27,7 +27,7 @@ es:overridden_costs: "Reemplazado los costos"spent: "Pasado"spent_on: "Fecha"- cost_object:+ budget:author: "Autor"available: "Disponible"budget: "Planeado"@@ -45,7 +45,7 @@ es:unit_plural: "Nombre de la unidad pluralizado"work_package:costs_by_type: "Unidades usadas"- cost_object_subject: "Título de presupuesto"+ budget_subject: "Título de presupuesto"labor_costs: "Costos de mano de obra"material_costs: "Costos unitarios"overall_costs: "Costos totales"@@ -55,11 +55,11 @@ es:rate: "Tasa"user:default_rates: "tasa de morosidad"- variable_cost_object:+ budget:labor_budget: "Costos laborales previstos"material_budget: "Costos unitarios previstos"models:- cost_object: "Presupuesto"+ budget: "Presupuesto"cost_type:one: "Tipo de costo"other: "Tipos de costos"@@ -73,7 +73,7 @@ es:attributes:budget: "Costos previstos"comment: "Comentario"- cost_object: "Presupuesto"+ budget: "Presupuesto"cost_type: "Tipo de costo"costs: "Costos"current_rate: "Tasa actual"@@ -81,7 +81,7 @@ es:units: "Unidades"valid_from: "Válida desde"button_add_budget_item: "Añadir los costos previstos"- button_add_cost_object: "Añadir presupuesto"+ button_add_budget: "Añadir presupuesto"button_add_cost_type: "Agregar tipo de costo"button_add_rate: "Añadir tasa"button_cancel_edit_budget: "Cancelar edicion de presupuesto"@@ -102,10 +102,10 @@ es:caption_save_rate: "Guardar tasa"caption_set_rate: "Ajustar tasa actual"caption_show_locked: "Mostrar tipos de bloqueados"- cost_objects_title: "Presupuestos"+ budgets_title: "Presupuestos"description_date_for_new_rate: "Fecha para la nueva tarifa"events:- cost_object: "Presupuesto editado"+ budget: "Presupuesto editado"group_by_others: "no en cualquier grupo"help_click_to_edit: "Haga clic aquí para editar."help_currency_format: "Formato de muestra de valores de divisas. %n se sustituye por el valor de la moneda, %u es reemplazada por la unidad monetaria."@@ -113,10 +113,10 @@ es:label_between: "entre"label_cost_filter_add: "Agregar filtro para entrada de costo"label_costlog: "Costos unitarios registrados"- label_cost_object: "Presupuesto"- label_cost_object_id: "Presupuesto #%{id}"- label_cost_object_new: "Nuevo presupuesto"- label_cost_object_plural: "Presupuestos"+ label_budget: "Presupuesto"+ label_budget_id: "Presupuesto #%{id}"+ label_budget_new: "Nuevo presupuesto"+ label_budget_plural: "Presupuestos"label_cost_plural: "Costos"label_cost_report: "Informe costo"label_cost_type_specific: "Presupuesto %{id}:%{name}"@@ -133,7 +133,7 @@ es:label_display_time_entries: "Mostrar horas reportadas"label_display_types: "Mostrar tipos"label_edit: "Editar"- label_fixed_cost_object: "Presupuesto fijo"+ label_fixed_budget: "Presupuesto fijo"label_fixed_date: "Fecha fija"label_generic_user: "Usuario genérico"label_greater_or_equal: ">="@@ -155,17 +155,17 @@ es:label_user: "Usuario"label_until: "hasta"label_valid_from: "Válida desde"- label_variable_cost_object: "Presupuesto de tasa variable"- label_view_all_cost_objects: "Ver todos los presupuestos"+ label_budget: "Presupuesto de tasa variable"+ label_view_all_budgets: "Ver todos los presupuestos"label_yes: "Sí"- notice_cost_object_conflict: "Paquetes de trabajo deben de estar en un mismo proyecto."- notice_no_cost_objects_available: "No hay presupuestos disponibles."+ notice_budget_conflict: "Paquetes de trabajo deben de estar en un mismo proyecto."+ notice_no_budgets_available: "No hay presupuestos disponibles."notice_something_wrong: "Algo salió mal. Por favor intentelo nuevamente."notice_successful_restore: "Restauración exitosa."notice_successful_lock: "Bloqueado correctamente."notice_cost_logged_successfully: 'Costo unitario registrado correctamente.'permission_edit_cost_entries: "Editar los costos unitarios reservados"- permission_edit_cost_objects: "Editar presupuestos"+ permission_edit_budgets: "Editar presupuestos"permission_edit_own_cost_entries: "Editar los costos unitarios propios reservados"permission_edit_hourly_rates: "Editar las tasas por hora"permission_edit_own_hourly_rate: "Editar propias tarifas por hora"@@ -173,15 +173,15 @@ es:permission_log_costs: "Reservar los costos unitarios"permission_log_own_costs: "Reservar los costos unitarios para uno mismo"permission_view_cost_entries: "Ver los costos reservados"- permission_view_cost_objects: "Ver los presupuestos"+ permission_view_budgets: "Ver los presupuestos"permission_view_cost_rates: "Ver tasas de costos"permission_view_hourly_rates: "Ver todas las tarifas por hora"permission_view_own_cost_entries: "Ver los gastos reservados propios"permission_view_own_hourly_rate: "Ver tarifa por hora propia"permission_view_own_time_entries: "Ver tiempo propio utilizado"- project_module_costs_module: "Presupuestos"+ project_module_costs: "Presupuestos"text_assign_time_and_cost_entries_to_project: "Asignar horas reportadas y los costos al proyecto"- text_cost_object_change_type_confirmation: "¿Estás seguro? Esta operación va a destruir la información del presupuesto especificado."+ text_budget_change_type_confirmation: "¿Estás seguro? Esta operación va a destruir la información del presupuesto especificado."text_destroy_cost_entries_question: "%{cost_entries} fueron reportados en los paquetes de trabajo que van a eliminar. ¿Qué quieres hacer?"text_destroy_time_and_cost_entries: "Eliminar horas reportadas y costos"text_destroy_time_and_cost_entries_question: "%{hours} horas, %{cost_entries} fueron reportados en el paquete de trabajo que va a eliminar.¿Qué quieres hacer?"diff --git a/modules/costs/config/locales/crowdin/fi.yml b/modules/costs/config/locales/crowdin/fi.ymlindex adde2a0edfb..f1bf289cf60 100644--- a/modules/costs/config/locales/crowdin/fi.yml+++ b/modules/costs/config/locales/crowdin/fi.yml@@ -27,7 +27,7 @@ fi:overridden_costs: "Ohitetut kustannukset"spent: "Käytetty"spent_on: "Päivämäärä"- cost_object:+ budget:author: "Tekijä"available: "Saatavilla"budget: "Suunniteltu"@@ -45,7 +45,7 @@ fi:unit_plural: "Yksikön nimi monikossa"work_package:costs_by_type: "Käytetyt yksiköt"- cost_object_subject: "Budjetin otsikko"+ budget_subject: "Budjetin otsikko"labor_costs: "Työvoimakustannukset"material_costs: "Yksikkökustannukset"overall_costs: "Kokonaiskustannukset"@@ -55,11 +55,11 @@ fi:rate: "Tuntihinta"user:default_rates: "Yleinen tuntihinta"- variable_cost_object:+ budget:labor_budget: "Suunnitellut työvoimakustannukset"material_budget: "Suunnitellut yksikkökustannukset"models:- cost_object: "Budjetti"+ budget: "Budjetti"cost_type:one: "Kustannustyyppi"other: "Kustannusten tyypit"@@ -73,7 +73,7 @@ fi:attributes:budget: "Suunnitellut kustannukset"comment: "Kommentti"- cost_object: "Budjetti"+ budget: "Budjetti"cost_type: "Kustannustyyppi"costs: "Kustannukset"current_rate: "Nykyinen tuntihinta"@@ -81,7 +81,7 @@ fi:units: "Yksiköt"valid_from: "Voimassa"button_add_budget_item: "Lisää suunniteltuja kustannuksia"- button_add_cost_object: "Lisää budjetti"+ button_add_budget: "Lisää budjetti"button_add_cost_type: "Lisää kustannustyyppi"button_add_rate: "Lisää tuntihinta"button_cancel_edit_budget: "Peruuta budjetin muokkaus"@@ -102,10 +102,10 @@ fi:caption_save_rate: "Tallenna tuntihinta"caption_set_rate: "Aseta nykyinen tuntihinta"caption_show_locked: "Näytä lukitut tyypit"- cost_objects_title: "Budjetit"+ budgets_title: "Budjetit"description_date_for_new_rate: "Uuden tuntinnan päivämäärä"events:- cost_object: "Budjettia muokattu"+ budget: "Budjettia muokattu"group_by_others: "ei missä missään ryhmässä"help_click_to_edit: "Muokkaa napsauttamalla tätä."help_currency_format: "Käytetty valuuttamuoto. %n korvataan arvolla, %u korvataan valuuttayksiköllä."@@ -113,10 +113,10 @@ fi:label_between: "between"label_cost_filter_add: "Lisää suodatin kustannuskirjauksille"label_costlog: "Kirjatut kustannukset"- label_cost_object: "Budjetti"- label_cost_object_id: "Budjetti #%{id}"- label_cost_object_new: "Uusi budjetti"- label_cost_object_plural: "Budjetit"+ label_budget: "Budjetti"+ label_budget_id: "Budjetti #%{id}"+ label_budget_new: "Uusi budjetti"+ label_budget_plural: "Budjetit"label_cost_plural: "Kustannukset"label_cost_report: "Kustannusraportti"label_cost_type_specific: "Budjetti #%{id}: %{name}"@@ -133,7 +133,7 @@ fi:label_display_time_entries: "Näytä tuntikirjaukset"label_display_types: "Näytä tyypit"label_edit: "Muokkaa"- label_fixed_cost_object: "Kiinteä budjetti"+ label_fixed_budget: "Kiinteä budjetti"label_fixed_date: "Kiinteä päivämäärä"label_generic_user: "Yleinen käyttäjä"label_greater_or_equal: ">="@@ -155,17 +155,17 @@ fi:label_user: "Käyttäjä"label_until: "saakka"label_valid_from: "Voimassa"- label_variable_cost_object: "Muuttuvaan tuntihintaan perustuva"- label_view_all_cost_objects: "Näytä kaikki budjetit"+ label_budget: "Muuttuvaan tuntihintaan perustuva"+ label_view_all_budgets: "Näytä kaikki budjetit"label_yes: "Kyllä"- notice_cost_object_conflict: "Tehtävien tulee olla samasta projektista."- notice_no_cost_objects_available: "Budjetteja ei ole saatavilla."+ notice_budget_conflict: "Tehtävien tulee olla samasta projektista."+ notice_no_budgets_available: "Budjetteja ei ole saatavilla."notice_something_wrong: "Jotain meni pieleen. Yritä uudelleen."notice_successful_restore: "Palautus onnistui."notice_successful_lock: "Lukittu onnistuneesti."notice_cost_logged_successfully: 'Kustannus kirjattu onnistuneesti.'permission_edit_cost_entries: "Kirjattujen yksikkökustannusten muokkaus"- permission_edit_cost_objects: "Budjettien muokkaus"+ permission_edit_budgets: "Budjettien muokkaus"permission_edit_own_cost_entries: "Omien yksikkökustannuskirjausten muokkaus"permission_edit_hourly_rates: "Tuntihintojen muokkaus"permission_edit_own_hourly_rate: "Omien tuntihintojen muokkaus"@@ -173,15 +173,15 @@ fi:permission_log_costs: "Kirjaa kustannuksia"permission_log_own_costs: "Kirjaa kustannuksia itselle"permission_view_cost_entries: "Kirjattujen kustannusten tarkisteleminen"- permission_view_cost_objects: "Budjettien tarkasteleminen"+ permission_view_budgets: "Budjettien tarkasteleminen"permission_view_cost_rates: "Hintojen tarkisteleminen"permission_view_hourly_rates: "Kaikkien tuntihintojen tarkiseleminen"permission_view_own_cost_entries: "Omien kustannuskirjausten tarkasteleminen"permission_view_own_hourly_rate: "Oman tuntinnan tarkasteleminen"permission_view_own_time_entries: "Oman aikakirjauksen tarkistelu"- project_module_costs_module: "Budjetit"+ project_module_costs: "Budjetit"text_assign_time_and_cost_entries_to_project: "Raportoitujen tunti- ja kustannuskirjausten liittäminen projektiin"- text_cost_object_change_type_confirmation: "Oletko varma? Tämä toiminto tuhoaa tämän budjettityypin tiedot."+ text_budget_change_type_confirmation: "Oletko varma? Tämä toiminto tuhoaa tämän budjettityypin tiedot."text_destroy_cost_entries_question: "%{cost_entries} on raportoitu projektille, jota olet poistamassa. Mitä haluat tehdä?"text_destroy_time_and_cost_entries: "Poista raportoidut tunnit ja kustannukset"text_destroy_time_and_cost_entries_question: "%{hours} tuntia, %{cost_entries} on raportoitu tehtäville, joita olet poistamassa. Haluatko?"diff --git a/modules/costs/config/locales/crowdin/fil.yml b/modules/costs/config/locales/crowdin/fil.ymlindex e3628671a4a..86436f98567 100644--- a/modules/costs/config/locales/crowdin/fil.yml+++ b/modules/costs/config/locales/crowdin/fil.yml@@ -27,7 +27,7 @@ fil:overridden_costs: "Overridden costs"spent: "Nagasta"spent_on: "Petsa"- cost_object:+ budget:author: "May-akda"available: "Libre"budget: "Nakaplano"@@ -45,7 +45,7 @@ fil:unit_plural: "Pinaraming pangalan ng yunit"work_package:costs_by_type: "Ginugol na yunit"- cost_object_subject: "Titulo ng badyet"+ budget_subject: "Titulo ng badyet"labor_costs: "Gastos sa Paggawa"material_costs: "Gastos kada yunit"overall_costs: "Kabuuang gastos"@@ -55,11 +55,11 @@ fil:rate: "Rate"user:default_rates: "Default rates"- variable_cost_object:+ budget:labor_budget: "Planned labor costs"material_budget: "Planned unit costs"models:- cost_object: "Budget"+ budget: "Budget"cost_type:one: "Cost type"other: "Cost types"@@ -73,7 +73,7 @@ fil:attributes:budget: "Planned costs"comment: "Komento"- cost_object: "Budget"+ budget: "Budget"cost_type: "Uri ng Gastos"costs: "Costs"current_rate: "Current rate"@@ -81,7 +81,7 @@ fil:units: "Units"valid_from: "Valid from"button_add_budget_item: "Add planned costs"- button_add_cost_object: "Add budget"+ button_add_budget: "Add budget"button_add_cost_type: "Add cost type"button_add_rate: "Add rate"button_cancel_edit_budget: "Cancel editing budget"@@ -102,10 +102,10 @@ fil:caption_save_rate: "Save rate"caption_set_rate: "Set current rate"caption_show_locked: "Show locked types"- cost_objects_title: "Budgets"+ budgets_title: "Budgets"description_date_for_new_rate: "Date for new rate"events:- cost_object: "Budget edited"+ budget: "Budget edited"group_by_others: "not in any group"help_click_to_edit: "Click here to edit."help_currency_format: "Format of displayed currency values. %n is replaced with the currency value, %u ist replaced with the currency unit."@@ -113,10 +113,10 @@ fil:label_between: "sa pagitan ng"label_cost_filter_add: "Add cost entry filter"label_costlog: "Logged unit costs"- label_cost_object: "Budget"- label_cost_object_id: "Budget #%{id}"- label_cost_object_new: "New budget"- label_cost_object_plural: "Budgets"+ label_budget: "Budget"+ label_budget_id: "Budget #%{id}"+ label_budget_new: "New budget"+ label_budget_plural: "Budgets"label_cost_plural: "Costs"label_cost_report: "Cost report"label_cost_type_specific: "Budget #%{id}: %{name}"@@ -133,7 +133,7 @@ fil:label_display_time_entries: "Display reported hours"label_display_types: "Display types"label_edit: "I-edit"- label_fixed_cost_object: "Fixed budget"+ label_fixed_budget: "Fixed budget"label_fixed_date: "Iksaktong Petsa"label_generic_user: "Generic user"label_greater_or_equal: ">=="@@ -155,17 +155,17 @@ fil:label_user: "Gumagamit"label_until: "until"label_valid_from: "Valid from"- label_variable_cost_object: "Variable rate based budget"- label_view_all_cost_objects: "View all budgets"+ label_budget: "Variable rate based budget"+ label_view_all_budgets: "View all budgets"label_yes: "Oo"- notice_cost_object_conflict: "WorkPackages must be of the same project."- notice_no_cost_objects_available: "No budgets available."+ notice_budget_conflict: "WorkPackages must be of the same project."+ notice_no_budgets_available: "No budgets available."notice_something_wrong: "Something went wrong. Please try again."notice_successful_restore: "Successful restore."notice_successful_lock: "Locked successfully."notice_cost_logged_successfully: 'Unit cost logged successfully.'permission_edit_cost_entries: "Edit booked unit costs"- permission_edit_cost_objects: "Edit budgets"+ permission_edit_budgets: "Edit budgets"permission_edit_own_cost_entries: "Edit own booked unit costs"permission_edit_hourly_rates: "Edit hourly rates"permission_edit_own_hourly_rate: "Edit own hourly rates"@@ -173,15 +173,15 @@ fil:permission_log_costs: "Book unit costs"permission_log_own_costs: "Book unit costs for oneself"permission_view_cost_entries: "View booked costs"- permission_view_cost_objects: "View budgets"+ permission_view_budgets: "View budgets"permission_view_cost_rates: "View cost rates"permission_view_hourly_rates: "View all hourly rates"permission_view_own_cost_entries: "View own booked costs"permission_view_own_hourly_rate: "View own hourly rate"permission_view_own_time_entries: "View own spent time"- project_module_costs_module: "Budgets"+ project_module_costs: "Budgets"text_assign_time_and_cost_entries_to_project: "Assign reported hours and costs to the project"- text_cost_object_change_type_confirmation: "Are you sure? This operation will destroy information of the specific budget type."+ text_budget_change_type_confirmation: "Are you sure? This operation will destroy information of the specific budget type."text_destroy_cost_entries_question: "%{cost_entries} were reported on the work packages you are about to delete. What do you want to do ?"text_destroy_time_and_cost_entries: "Delete reported hours and costs"text_destroy_time_and_cost_entries_question: "%{hours} hours, %{cost_entries} were reported on the work packages you are about to delete. What do you want to do ?"diff --git a/modules/costs/config/locales/crowdin/fr.yml b/modules/costs/config/locales/crowdin/fr.ymlindex a5715a214ba..4abc55c83e4 100644--- a/modules/costs/config/locales/crowdin/fr.yml+++ b/modules/costs/config/locales/crowdin/fr.yml@@ -27,7 +27,7 @@ fr:overridden_costs: "Coûts outrepassés"spent: "Consommé"spent_on: "date"- cost_object:+ budget:author: "Auteur"available: "Disponible"budget: "Planifié"@@ -45,7 +45,7 @@ fr:unit_plural: "Nom pluriel de l'unité"work_package:costs_by_type: "Unités consommées"- cost_object_subject: "Titre du budget"+ budget_subject: "Titre du budget"labor_costs: "Coûts de main d'œuvre"material_costs: "Coûts unitaires"overall_costs: "Coûts globaux"@@ -55,11 +55,11 @@ fr:rate: "Tarif"user:default_rates: "Tarifs par défaut"- variable_cost_object:+ budget:labor_budget: "Coûts de main d'œuvre planifiés"material_budget: "Coûts unitaires estimés"models:- cost_object: "Budget"+ budget: "Budget"cost_type:one: "Types de coût"other: "Types de coûts"@@ -73,7 +73,7 @@ fr:attributes:budget: "Coûts estimés"comment: "Commentaire"- cost_object: "Budget"+ budget: "Budget"cost_type: "Types de coût"costs: "Coûts"current_rate: "Tarif actuel"@@ -81,7 +81,7 @@ fr:units: "Unités"valid_from: "Valable à partir du"button_add_budget_item: "Ajouter des coûts planifiés"- button_add_cost_object: "Ajouter budget"+ button_add_budget: "Ajouter budget"button_add_cost_type: "Ajouter type de coût"button_add_rate: "Ajouter tarif"button_cancel_edit_budget: "Annuler l'édition du budget"@@ -102,10 +102,10 @@ fr:caption_save_rate: "Enregistrer tarif"caption_set_rate: "Définir le tarif actuel"caption_show_locked: "Afficher les types verrouillés"- cost_objects_title: "Budgets"+ budgets_title: "Budgets"description_date_for_new_rate: "Date pour le nouveau tarif"events:- cost_object: "Budget modifié"+ budget: "Budget modifié"group_by_others: "dans aucun groupe"help_click_to_edit: "Cliquez ici pour modifier."help_currency_format: "Format des valeurs monétaires affichées. %n est remplacé par le montant, %u est remplacé par l'unité monétaire."@@ -113,10 +113,10 @@ fr:label_between: "entre"label_cost_filter_add: "Ajouter filtre d'entrée de coût"label_costlog: "Coûts unitaires consignés"- label_cost_object: "Budget"- label_cost_object_id: "Budget #%{id}"- label_cost_object_new: "Nouveau budget"- label_cost_object_plural: "Budgets"+ label_budget: "Budget"+ label_budget_id: "Budget #%{id}"+ label_budget_new: "Nouveau budget"+ label_budget_plural: "Budgets"label_cost_plural: "Coûts"label_cost_report: "Rapport de coût"label_cost_type_specific: "Budget #%{id}: %{name}"@@ -133,7 +133,7 @@ fr:label_display_time_entries: "Afficher les heures consignées"label_display_types: "Afficher les types"label_edit: "Éditer"- label_fixed_cost_object: "Budget fixe"+ label_fixed_budget: "Budget fixe"label_fixed_date: "Date fixe"label_generic_user: "Utilisateur générique"label_greater_or_equal: ">="@@ -155,17 +155,17 @@ fr:label_user: "Utilisateur"label_until: "jusque"label_valid_from: "Valable à partir du"- label_variable_cost_object: "Budget basé sur un tarif variable"- label_view_all_cost_objects: "Afficher tous les budgets"+ label_budget: "Budget basé sur un tarif variable"+ label_view_all_budgets: "Afficher tous les budgets"label_yes: "Oui"- notice_cost_object_conflict: "Les lots de travaux doivent appartenir au même projet."- notice_no_cost_objects_available: "Aucun budget disponible."+ notice_budget_conflict: "Les lots de travaux doivent appartenir au même projet."+ notice_no_budgets_available: "Aucun budget disponible."notice_something_wrong: "Quelque chose s'est mal passé. Veuillez réessayer."notice_successful_restore: "Restauration réussie."notice_successful_lock: "Bloqué avec succès."notice_cost_logged_successfully: 'Coût unitaire enregistré avec succès.'permission_edit_cost_entries: "Éditer coûts unitaires réservés"- permission_edit_cost_objects: "Éditer les budgets"+ permission_edit_budgets: "Éditer les budgets"permission_edit_own_cost_entries: "Éditer coûts unitaires propres réservés"permission_edit_hourly_rates: "Éditer les tarifs horaires"permission_edit_own_hourly_rate: "Éditer ses propres tarifs horaires"@@ -173,15 +173,15 @@ fr:permission_log_costs: "Réserver coûts unitaires"permission_log_own_costs: "Réserver coûts unitaires propres"permission_view_cost_entries: "Afficher coûts réservés"- permission_view_cost_objects: "Voir les budgets"+ permission_view_budgets: "Voir les budgets"permission_view_cost_rates: "Voir les tarifs de coût"permission_view_hourly_rates: "Voir tous les tarifs horaires"permission_view_own_cost_entries: "Afficher coûts propres réservés"permission_view_own_hourly_rate: "Voir son propre tarif horaire"permission_view_own_time_entries: "Voir son propre temps passé"- project_module_costs_module: "Budgets"+ project_module_costs: "Budgets"text_assign_time_and_cost_entries_to_project: "Assigner les heures et coûts consignés au projet"- text_cost_object_change_type_confirmation: "Êtes-vous sûr ? Cette opération détruira les informations spécifiques au type de budget."+ text_budget_change_type_confirmation: "Êtes-vous sûr ? Cette opération détruira les informations spécifiques au type de budget."text_destroy_cost_entries_question: "%{cost_entries} ont été consignés sur les lots de travaux que vous êtes sur le point de supprimer. Que voulez-vous faire ?"text_destroy_time_and_cost_entries: "Supprimer les heures et coûts consignés"text_destroy_time_and_cost_entries_question: "%{hours} heures, %{cost_entries} ont été consignés sur les lots de travaux que vous êtes sur le point de supprimer. Que voulez-vous faire ?"diff --git a/modules/costs/config/locales/crowdin/hr.yml b/modules/costs/config/locales/crowdin/hr.ymlindex e23efecaf82..0538b96a5c8 100644--- a/modules/costs/config/locales/crowdin/hr.yml+++ b/modules/costs/config/locales/crowdin/hr.yml@@ -27,7 +27,7 @@ hr:overridden_costs: "Prekoračeni troškovi"spent: "Potrošeno"spent_on: "Datum"- cost_object:+ budget:author: "Autor"available: "Dostupno"budget: "Planirano"@@ -45,7 +45,7 @@ hr:unit_plural: "Višestruki nazivi jedinica"work_package:costs_by_type: "Potrošene jedinice"- cost_object_subject: "Naziv proračuna"+ budget_subject: "Naziv proračuna"labor_costs: "Troškovi rada"material_costs: "Jedinice troškova"overall_costs: "Ukupni troškovi"@@ -55,11 +55,11 @@ hr:rate: "Stopa"user:default_rates: "Zadane satnice"- variable_cost_object:+ budget:labor_budget: "Planirani troškovi rada"material_budget: "Planirani troškovi jedinica"models:- cost_object: "Budžet"+ budget: "Budžet"cost_type:one: "Vrsta troška"few: "Vrsta troška"@@ -74,7 +74,7 @@ hr:attributes:budget: "Planirani troškovi"comment: "Komentar"- cost_object: "Budžet"+ budget: "Budžet"cost_type: "Vrsta troška"costs: "Troškovi"current_rate: "Trenutna stopa"@@ -82,7 +82,7 @@ hr:units: "Jedinice"valid_from: "Vrijedi od"button_add_budget_item: "Dodaj planirane troškove"- button_add_cost_object: "Dodaj proračun"+ button_add_budget: "Dodaj proračun"button_add_cost_type: "Dodavanje vrste troška"button_add_rate: "Dodaj satnicu"button_cancel_edit_budget: "Otkaži uređivanje proračuna"@@ -103,10 +103,10 @@ hr:caption_save_rate: "Spremi stopu"caption_set_rate: "Postavite trenutnu stopu"caption_show_locked: "Pokaži zaključane tipove"- cost_objects_title: "Proračuni"+ budgets_title: "Proračuni"description_date_for_new_rate: "Datum za nove satnice"events:- cost_object: "Proračun uređen"+ budget: "Proračun uređen"group_by_others: "nije u niti jednoj grupi"help_click_to_edit: "Kliknite ovdje za uređivanje."help_currency_format: "Format prikazanih novčanih valuta. %n je zamijenjen s novčanom valum, %u je zmijenjen s jedinicom vlute."@@ -114,10 +114,10 @@ hr:label_between: "između"label_cost_filter_add: "Dodajte filer ulaznih troškova"label_costlog: "Zabilježeni jedinični troškovi"- label_cost_object: "Budžet"- label_cost_object_id: "Proračun #%{id}"- label_cost_object_new: "Novi proračun"- label_cost_object_plural: "Proračuni"+ label_budget: "Budžet"+ label_budget_id: "Proračun #%{id}"+ label_budget_new: "Novi proračun"+ label_budget_plural: "Proračuni"label_cost_plural: "Troškovi"label_cost_report: "Izvješće troška"label_cost_type_specific: "Proračun #%{id}: %{name}"@@ -134,7 +134,7 @@ hr:label_display_time_entries: "Prikaži prijavljene sate"label_display_types: "Prikazati tipove"label_edit: "Uredi"- label_fixed_cost_object: "Fiksni proračun"+ label_fixed_budget: "Fiksni proračun"label_fixed_date: "Utvrđeni datum"label_generic_user: "Opći korisnik"label_greater_or_equal: ">="@@ -156,17 +156,17 @@ hr:label_user: "Korisnik"label_until: "do"label_valid_from: "Vrijedi od"- label_variable_cost_object: "Varijabla satnice temeljene na proračunu"- label_view_all_cost_objects: "Pogledaj sve proračune"+ label_budget: "Varijabla satnice temeljene na proračunu"+ label_view_all_budgets: "Pogledaj sve proračune"label_yes: "Da"- notice_cost_object_conflict: "Radni paketi moraju biti na istom projektu."- notice_no_cost_objects_available: "Trenutno nema dostupnih proračuna."+ notice_budget_conflict: "Radni paketi moraju biti na istom projektu."+ notice_no_budgets_available: "Trenutno nema dostupnih proračuna."notice_something_wrong: "Nešto je pošlo po zlu. Molimo pokušajte ponovno."notice_successful_restore: "Uspješno vraćanje."notice_successful_lock: "Locked successfully."notice_cost_logged_successfully: 'Jedinični trošak uspješno zabilježen.'permission_edit_cost_entries: "Uredite zabilježene jedinične troškove"- permission_edit_cost_objects: "Uredi proračune"+ permission_edit_budgets: "Uredi proračune"permission_edit_own_cost_entries: "Uredite vlastite zabilježene jedinične troškove"permission_edit_hourly_rates: "Uredite satnice"permission_edit_own_hourly_rate: "Uredi vlastitu cijenu po satu"@@ -174,15 +174,15 @@ hr:permission_log_costs: "Zabilježite jedinice troškova"permission_log_own_costs: "Zabilježite jedinice troškova za sebe"permission_view_cost_entries: "Pogledajte zabilježene troškove"- permission_view_cost_objects: "Pogledaj proračune"+ permission_view_budgets: "Pogledaj proračune"permission_view_cost_rates: "Pogledaj troškove satnica"permission_view_hourly_rates: "Pogledaj sve cijene po satu"permission_view_own_cost_entries: "Pogledaj vlastite zabilježene troškove"permission_view_own_hourly_rate: "Prikaži vlastite satnice"permission_view_own_time_entries: "Pogledaj vlastito utrošeno vrijeme"- project_module_costs_module: "Proračuni"+ project_module_costs: "Proračuni"text_assign_time_and_cost_entries_to_project: "Dodijeli prijavljene satnice i troškove na projektu"- text_cost_object_change_type_confirmation: "Da li ste sigurni? Ova operacija će uništiti informacije o specifičnim tipovima proračuna."+ text_budget_change_type_confirmation: "Da li ste sigurni? Ova operacija će uništiti informacije o specifičnim tipovima proračuna."text_destroy_cost_entries_question: "%{cost_entries} su prikazani na radnim paketima koje želite izbrisati. Što zapravo želite napraviti?"text_destroy_time_and_cost_entries: "Izbriši prijavljene sate i troškove"text_destroy_time_and_cost_entries_question: "%{hours} sati, %{cost_entries} su prikazani na radnim paketima koje želite izbrisati. Što zapravo želite napraviti?"diff --git a/modules/costs/config/locales/crowdin/hu.yml b/modules/costs/config/locales/crowdin/hu.ymlindex 937577e8586..2900f04f906 100644--- a/modules/costs/config/locales/crowdin/hu.yml+++ b/modules/costs/config/locales/crowdin/hu.yml@@ -27,7 +27,7 @@ hu:overridden_costs: "Felülbírált költségek"spent: "Elköltve"spent_on: "dátum"- cost_object:+ budget:author: "Szerző"available: "Elérhető"budget: "Tervezet"@@ -45,7 +45,7 @@ hu:unit_plural: "Többes számú egység neve"work_package:costs_by_type: "Elköltött egység"- cost_object_subject: "Költségvetési cím"+ budget_subject: "Költségvetési cím"labor_costs: "Munkaerő költségek"material_costs: "Egység költségek"overall_costs: "Összes költség"@@ -55,11 +55,11 @@ hu:rate: "Díj"user:default_rates: "Alapértelmezett díj"- variable_cost_object:+ budget:labor_budget: "Tervezett munkaerő-költségek"material_budget: "Tervezett egység költség"models:- cost_object: "Költségvetés"+ budget: "Költségvetés"cost_type:one: "Költségtípus"other: "Költségtípusok"@@ -73,7 +73,7 @@ hu:attributes:budget: "Tervezett költségek"comment: "Vélemény"- cost_object: "Költségvetés"+ budget: "Költségvetés"cost_type: "Költségtípus"costs: "Költségek"current_rate: "Jelenlegi állapot"@@ -81,7 +81,7 @@ hu:units: "Egységek"valid_from: "Innentől érvényes"button_add_budget_item: "Új tervezett költség"- button_add_cost_object: "Új költségvetés"+ button_add_budget: "Új költségvetés"button_add_cost_type: "Új költségtípus"button_add_rate: "Új díj"button_cancel_edit_budget: "Költségvetés szerkeztésének visszavonása"@@ -102,10 +102,10 @@ hu:caption_save_rate: "Díj mentése"caption_set_rate: "Aktuális díj beállítása"caption_show_locked: "Zárolt nemek mutatása"- cost_objects_title: "Költségvetések"+ budgets_title: "Költségvetések"description_date_for_new_rate: "Új díj dátuma"events:- cost_object: "Szerkesztett költségvetés"+ budget: "Szerkesztett költségvetés"group_by_others: "nincs egy csoportban sem"help_click_to_edit: "Szerkesztéshez kattintson ide."help_currency_format: "Megjelenített pénznem-értékek megjelenítési formátuma. %n helyébe a pénznem értéke, %u helyébe a neve kerül."@@ -113,10 +113,10 @@ hu:label_between: "között"label_cost_filter_add: "Költség tétel szűrő hozzáadása"label_costlog: "Naplózott fajlagos költségek"- label_cost_object: "Költségvetés"- label_cost_object_id: "Költségvetés #%{id}"- label_cost_object_new: "Új költségvetés"- label_cost_object_plural: "Költségvetések"+ label_budget: "Költségvetés"+ label_budget_id: "Költségvetés #%{id}"+ label_budget_new: "Új költségvetés"+ label_budget_plural: "Költségvetések"label_cost_plural: "Költségek"label_cost_report: "Költség jelentés"label_cost_type_specific: "Költségvetés #%{id}: %{name}"@@ -133,7 +133,7 @@ hu:label_display_time_entries: "Jelentett órák megjelenítése"label_display_types: "Nemek megjelenítése"label_edit: "Szerkesztés"- label_fixed_cost_object: "Rögzített költségvetés"+ label_fixed_budget: "Rögzített költségvetés"label_fixed_date: "Fix dátum"label_generic_user: "Általános felhasználó"label_greater_or_equal: ">="@@ -155,17 +155,17 @@ hu:label_user: "Felhasználó"label_until: "-ig"label_valid_from: "Innentől érvényes"- label_variable_cost_object: "Variálható díj alapú költségvetés"- label_view_all_cost_objects: "Minden költség megtekintése"+ label_budget: "Variálható díj alapú költségvetés"+ label_view_all_budgets: "Minden költség megtekintése"label_yes: "Igen"- notice_cost_object_conflict: "Munkacsomagok ugyanabból a projektből kell származzanak."- notice_no_cost_objects_available: "Nincs költségvetés."+ notice_budget_conflict: "Munkacsomagok ugyanabból a projektből kell származzanak."+ notice_no_budgets_available: "Nincs költségvetés."notice_something_wrong: "Valami hiba történt. Kérlek próbáld újra."notice_successful_restore: "Sikeres visszaállítás."notice_successful_lock: "Sikeresen zárolt."notice_cost_logged_successfully: 'Egységköltség sikeresen naplózva.'permission_edit_cost_entries: "Könyvelt egységköltségek szerkesztése"- permission_edit_cost_objects: "Költségvetés szerkesztése"+ permission_edit_budgets: "Költségvetés szerkesztése"permission_edit_own_cost_entries: "Saját könyvelt egységköltségek szerkesztése"permission_edit_hourly_rates: "Órabérek szerkesztése"permission_edit_own_hourly_rate: "Saját óradíj szerkeztése"@@ -173,15 +173,15 @@ hu:permission_log_costs: "Egységre könyvelt költségek"permission_log_own_costs: "Egységköltség könyvelése magadnak"permission_view_cost_entries: "Könyvelt költségek"- permission_view_cost_objects: "Költségvetések megtekintése"+ permission_view_budgets: "Költségvetések megtekintése"permission_view_cost_rates: "Költség díjak megtekintése"permission_view_hourly_rates: "Minden óradíj megtekintése"permission_view_own_cost_entries: "Saját részre könyvelt költségek"permission_view_own_hourly_rate: "Saját óradíj megtekintése"permission_view_own_time_entries: "Az eltöltött idő megtekintése"- project_module_costs_module: "Költségvetések"+ project_module_costs: "Költségvetések"text_assign_time_and_cost_entries_to_project: "Idők és költségek projekthez rendelése"- text_cost_object_change_type_confirmation: "Biztos vagy benne? Ez a művelet törölni fogja a büdzsé típushoz rendelt információkat."+ text_budget_change_type_confirmation: "Biztos vagy benne? Ez a művelet törölni fogja a büdzsé típushoz rendelt információkat."text_destroy_cost_entries_question: "A work package-hez rögzített %{cost_entries} törlése. Mit szeretnél tenni?"text_destroy_time_and_cost_entries: "Idők és költségek törlése"text_destroy_time_and_cost_entries_question: "A work package-hez rögzített %{hours} óra és %{cost_entries} törlése. Mit szeretnél tenni?"diff --git a/modules/costs/config/locales/crowdin/id.yml b/modules/costs/config/locales/crowdin/id.ymlindex 7be9ca2455a..c883029b6fd 100644--- a/modules/costs/config/locales/crowdin/id.yml+++ b/modules/costs/config/locales/crowdin/id.yml@@ -27,7 +27,7 @@ id:overridden_costs: "Overridden costs"spent: "Dihabiskan"spent_on: "Tanggal"- cost_object:+ budget:author: "Penulis"available: "Tersedia"budget: "Terencana"@@ -45,7 +45,7 @@ id:unit_plural: "Nama plural unit"work_package:costs_by_type: "Unit terpakai"- cost_object_subject: "Judul anggaran"+ budget_subject: "Judul anggaran"labor_costs: "Biaya tenaga"material_costs: "Biaya unit"overall_costs: "Biaya keseluruhan"@@ -55,11 +55,11 @@ id:rate: "Rate"user:default_rates: "Rate standart"- variable_cost_object:+ budget:labor_budget: "Rencana biaya tenaga"material_budget: "Rencana biaya unit"models:- cost_object: "Bugdet"+ budget: "Bugdet"cost_type:other: "Jenis biaya"material_budget_item: "Unit"@@ -72,7 +72,7 @@ id:attributes:budget: "Rencana biaya"comment: "Komentar"- cost_object: "Bugdet"+ budget: "Bugdet"cost_type: "Jenis biaya"costs: "Biaya"current_rate: "Rate saat ini"@@ -80,7 +80,7 @@ id:units: "Unit"valid_from: "Berlaku dari"button_add_budget_item: "Tambahkan biaya terencana"- button_add_cost_object: "Tambahkan budget"+ button_add_budget: "Tambahkan budget"button_add_cost_type: "Tambahkan jenis biaya"button_add_rate: "Tambahkan rate"button_cancel_edit_budget: "Batalkan edit budget"@@ -101,10 +101,10 @@ id:caption_save_rate: "Simpan rate"caption_set_rate: "Set rate saat ini"caption_show_locked: "Tampilkan tipe yang terkunci"- cost_objects_title: "Budget"+ budgets_title: "Budget"description_date_for_new_rate: "Tanggal berlaku rate"events:- cost_object: "Buget telah di-edit"+ budget: "Buget telah di-edit"group_by_others: "tidak dalam grup manapun"help_click_to_edit: "Klik untuk edit."help_currency_format: "Format of displayed currency values. %n is replaced with the currency value, %u ist replaced with the currency unit."@@ -112,10 +112,10 @@ id:label_between: "antara"label_cost_filter_add: "Tambahkan filter entri biaya"label_costlog: "Catatan biaya unit"- label_cost_object: "Bugdet"- label_cost_object_id: "Budget #%{id}"- label_cost_object_new: "Tambah budget"- label_cost_object_plural: "Budget"+ label_budget: "Bugdet"+ label_budget_id: "Budget #%{id}"+ label_budget_new: "Tambah budget"+ label_budget_plural: "Budget"label_cost_plural: "Biaya"label_cost_report: "Laporan biaya"label_cost_type_specific: "Budget #%{id}: %{name}"@@ -132,7 +132,7 @@ id:label_display_time_entries: "Tampilkan jumlah jam"label_display_types: "Tampilkan tipe"label_edit: "Edit"- label_fixed_cost_object: "Fixed budget"+ label_fixed_budget: "Fixed budget"label_fixed_date: "Tanggal fix"label_generic_user: "User generik"label_greater_or_equal: ">="@@ -154,17 +154,17 @@ id:label_user: "User"label_until: "hingga"label_valid_from: "Berlaku dari"- label_variable_cost_object: "Variabel rate berdasarkan anggaran"- label_view_all_cost_objects: "Lihat semua budget"+ label_budget: "Variabel rate berdasarkan anggaran"+ label_view_all_budgets: "Lihat semua budget"label_yes: "Yes"- notice_cost_object_conflict: "Pilihan WorksPackage harus dari proyek yang sama."- notice_no_cost_objects_available: "Pilihan budget tidak tersedia."+ notice_budget_conflict: "Pilihan WorksPackage harus dari proyek yang sama."+ notice_no_budgets_available: "Pilihan budget tidak tersedia."notice_something_wrong: "Terjadi suatu kesalahan. Silahkan coba lagi."notice_successful_restore: "Restore berhasil."notice_successful_lock: "Locked successfully."notice_cost_logged_successfully: 'Unit cost logged successfully.'permission_edit_cost_entries: "Ubah booked biaya unit"- permission_edit_cost_objects: "Edit budget"+ permission_edit_budgets: "Edit budget"permission_edit_own_cost_entries: "Edit booked biaya unit sendiri"permission_edit_hourly_rates: "Edit rate per jam"permission_edit_own_hourly_rate: "Edit rate per-jam milik sendiri"@@ -172,15 +172,15 @@ id:permission_log_costs: "Biaya unit pada buku"permission_log_own_costs: "Biaya unit buku untuk dirinya sendiri"permission_view_cost_entries: "Tampilkan booked biaya"- permission_view_cost_objects: "Tampilkan seluruh budget"+ permission_view_budgets: "Tampilkan seluruh budget"permission_view_cost_rates: "Tampilkan rate biaya"permission_view_hourly_rates: "Tampilkan semua rate per-jam"permission_view_own_cost_entries: "Tampilkan booked biaya sendiri"permission_view_own_hourly_rate: "Tampilkan rate per-jam diri sendiri"permission_view_own_time_entries: "Tampilan jumlah waktu diri sendiri"- project_module_costs_module: "Budget"+ project_module_costs: "Budget"text_assign_time_and_cost_entries_to_project: "Masukkan laporan per-jam dan laporan biaya ke proyek"- text_cost_object_change_type_confirmation: "Operasi ini akan menghapus informasi pada tipe budget tertentu. Anda yakin?"+ text_budget_change_type_confirmation: "Operasi ini akan menghapus informasi pada tipe budget tertentu. Anda yakin?"text_destroy_cost_entries_question: "%{cost_entries} digunakan pada work package yang akan dihapus. Keputusan anda?"text_destroy_time_and_cost_entries: "Hapus jumlah jam dan biaya yang terlapor"text_destroy_time_and_cost_entries_question: "%{hours} jam, %{cost_entries} digunakan pada works package yang akan anda hapus. Keputusan anda?"diff --git a/modules/costs/config/locales/crowdin/it.yml b/modules/costs/config/locales/crowdin/it.ymlindex 0ee9f0b82a8..9d97cfa5223 100644--- a/modules/costs/config/locales/crowdin/it.yml+++ b/modules/costs/config/locales/crowdin/it.yml@@ -27,7 +27,7 @@ it:overridden_costs: "Costi eccedenti"spent: "Trascorso"spent_on: "Data"- cost_object:+ budget:author: "Autore"available: "Disponibile"budget: "Pianificato"@@ -45,7 +45,7 @@ it:unit_plural: "Nome unità pluralizzato"work_package:costs_by_type: "Unita consumate"- cost_object_subject: "Titolo del bilancio"+ budget_subject: "Titolo del bilancio"labor_costs: "Costi della manodopera"material_costs: "Costi unitari"overall_costs: "Costi complessivi"@@ -55,11 +55,11 @@ it:rate: "Tariffa"user:default_rates: "Tariffe di default"- variable_cost_object:+ budget:labor_budget: "Costo del lavoro pianificato"material_budget: "Costi pianificati per unità"models:- cost_object: "Bilancio"+ budget: "Bilancio"cost_type:one: "Tipo di costo"other: "Tipo di costo"@@ -73,7 +73,7 @@ it:attributes:budget: "Costi pianificati"comment: "Commento"- cost_object: "Bilancio"+ budget: "Bilancio"cost_type: "Tipo di costo"costs: "Costi"current_rate: "Tariffa attuale"@@ -81,7 +81,7 @@ it:units: "Unità di misura"valid_from: "Valido dal"button_add_budget_item: "Aggiungi costi pianificati"- button_add_cost_object: "Aggiungi bilancio"+ button_add_budget: "Aggiungi bilancio"button_add_cost_type: "Aggiungi tipo di costo"button_add_rate: "Aggiungi tariffa"button_cancel_edit_budget: "Annulla modifica budget"@@ -102,10 +102,10 @@ it:caption_save_rate: "Salva tariffa"caption_set_rate: "Impostata tariffa corrente"caption_show_locked: "Mostra tipi bloccati"- cost_objects_title: "Bilanci"+ budgets_title: "Bilanci"description_date_for_new_rate: "Data per la nuova tariffa"events:- cost_object: "Bilancio modificato"+ budget: "Bilancio modificato"group_by_others: "non in qualsiasi gruppo"help_click_to_edit: "Clicca qui per modificare."help_currency_format: "Formato di visualizzazione dei valori in valuta. %n viene sostituito con il valore della valuta, %u viene sostituito con l'unità di valuta."@@ -113,10 +113,10 @@ it:label_between: "tra"label_cost_filter_add: "Aggiungi filtro sulla voce di costo"label_costlog: "Costi unitari registrati"- label_cost_object: "Bilancio"- label_cost_object_id: "Budget #%{id}"- label_cost_object_new: "Nuovo budget"- label_cost_object_plural: "Bilanci"+ label_budget: "Bilancio"+ label_budget_id: "Budget #%{id}"+ label_budget_new: "Nuovo budget"+ label_budget_plural: "Bilanci"label_cost_plural: "Costi"label_cost_report: "Relazione sui costi"label_cost_type_specific: "Budget #%{id}: %{name}"@@ -133,7 +133,7 @@ it:label_display_time_entries: "Mostra le ore segnalate"label_display_types: "Mostra i tipi"label_edit: "Modifica"- label_fixed_cost_object: "Budget fisso"+ label_fixed_budget: "Budget fisso"label_fixed_date: "Data fissa"label_generic_user: "Utente generico"label_greater_or_equal: ">="@@ -155,17 +155,17 @@ it:label_user: "Utente"label_until: "finché"label_valid_from: "Valido dal"- label_variable_cost_object: "Budget in base a tariffe variabili"- label_view_all_cost_objects: "Mostra tutti i budget"+ label_budget: "Budget in base a tariffe variabili"+ label_view_all_budgets: "Mostra tutti i budget"label_yes: "Si"- notice_cost_object_conflict: "La macro-attività deve essere dello stesso progetto."- notice_no_cost_objects_available: "Nessun budget disponibile."+ notice_budget_conflict: "La macro-attività deve essere dello stesso progetto."+ notice_no_budgets_available: "Nessun budget disponibile."notice_something_wrong: "Qualcosa è andato storto. Si prega di riprovare."notice_successful_restore: "Ripristino eseguito con successo."notice_successful_lock: "Bloccato con successo."notice_cost_logged_successfully: 'Costo unitario registrato con successo.'permission_edit_cost_entries: "Modifica unità di costo riservate"- permission_edit_cost_objects: "Modifica budget"+ permission_edit_budgets: "Modifica budget"permission_edit_own_cost_entries: "Modifica le proprie unità di costo riservate"permission_edit_hourly_rates: "Modifica tariffe orarie"permission_edit_own_hourly_rate: "Modifica le proprie tariffe orarie"@@ -173,15 +173,15 @@ it:permission_log_costs: "Riserva costi unitari"permission_log_own_costs: "Riserva costi unitari per se stessi"permission_view_cost_entries: "Visualizza costi riservati"- permission_view_cost_objects: "Visualizza budget"+ permission_view_budgets: "Visualizza budget"permission_view_cost_rates: "Visualizza tariffe di costo"permission_view_hourly_rates: "Mostra tutte le tariffe orarie"permission_view_own_cost_entries: "Visualizza i propri costi prenotati"permission_view_own_hourly_rate: "Visualizza propria tariffa oraria"permission_view_own_time_entries: "Visualizzare il proprio tempo trascorso"- project_module_costs_module: "Bilanci"+ project_module_costs: "Bilanci"text_assign_time_and_cost_entries_to_project: "Assegna orari e costi segnalati al progetto"- text_cost_object_change_type_confirmation: "Sei sicuro? Questa operazione distruggerà le informazioni del tipo budget specificato."+ text_budget_change_type_confirmation: "Sei sicuro? Questa operazione distruggerà le informazioni del tipo budget specificato."text_destroy_cost_entries_question: "%{cost_entries} sono stati segnalati per la macro-attività (work package) che si sta per eliminare. Che cosa vuoi fare?"text_destroy_time_and_cost_entries: "Elimina orari e costi riportati"text_destroy_time_and_cost_entries_question: "%{hours} ore, %{cost_entries} sono stati segnalati per le macro-attività (work packages) che si stanno per eliminare. Che cosa vuoi fare?"diff --git a/modules/costs/config/locales/crowdin/ja.yml b/modules/costs/config/locales/crowdin/ja.ymlindex 5b96589d949..0fde1f5a814 100644--- a/modules/costs/config/locales/crowdin/ja.yml+++ b/modules/costs/config/locales/crowdin/ja.yml@@ -27,7 +27,7 @@ ja:overridden_costs: "オーバーライドされたコスト"spent: "使用済"spent_on: "日付"- cost_object:+ budget:author: "作成者"available: "利用可能"budget: "計画"@@ -45,7 +45,7 @@ ja:unit_plural: "単位名"work_package:costs_by_type: "使用済単価"- cost_object_subject: "予算のタイトル"+ budget_subject: "予算のタイトル"labor_costs: "作業員コスト"material_costs: "単価"overall_costs: "集計コスト"@@ -55,11 +55,11 @@ ja:rate: "原価率"user:default_rates: "デフォルト原価率"- variable_cost_object:+ budget:labor_budget: "計画作業員コスト"material_budget: "計画単価"models:- cost_object: "予算"+ budget: "予算"cost_type:other: "コスト種類"material_budget_item: "ユニット"@@ -72,7 +72,7 @@ ja:attributes:budget: "計画コスト"comment: "コメント"- cost_object: "予算"+ budget: "予算"cost_type: "コスト種類"costs: "コスト"current_rate: "現状原価率"@@ -80,7 +80,7 @@ ja:units: "単位"valid_from: "から有効"button_add_budget_item: "計画コストを追加"- button_add_cost_object: "予算を追加"+ button_add_budget: "予算を追加"button_add_cost_type: "コストの種類を追加"button_add_rate: "原価率を追加"button_cancel_edit_budget: "予算の編集を取り消し"@@ -101,10 +101,10 @@ ja:caption_save_rate: "進捗の保存"caption_set_rate: "現在の進捗を設定する"caption_show_locked: "ロックの種類を表示します。"- cost_objects_title: "予算"+ budgets_title: "予算"description_date_for_new_rate: "新しいレートの日付"events:- cost_object: "予算の編集"+ budget: "予算の編集"group_by_others: "どのグループにもない"help_click_to_edit: "編集するにはここをクリックしてください。"help_currency_format: "表示される通貨値の形式です。 %n は通貨の値に置き換えられ、%u は通貨の単位に置き換えられます。"@@ -112,10 +112,10 @@ ja:label_between: "次の範囲内"label_cost_filter_add: "コストフィルタの追加"label_costlog: "単価を記録"- label_cost_object: "予算"- label_cost_object_id: "予算 #%{id}"- label_cost_object_new: "新しい予算"- label_cost_object_plural: "予算"+ label_budget: "予算"+ label_budget_id: "予算 #%{id}"+ label_budget_new: "新しい予算"+ label_budget_plural: "予算"label_cost_plural: "コスト"label_cost_report: "コストレポート"label_cost_type_specific: "予算 #%{id}: %{name}"@@ -132,7 +132,7 @@ ja:label_display_time_entries: "報告された時間を表示する"label_display_types: "表示タイプ"label_edit: "編集"- label_fixed_cost_object: "固定予算"+ label_fixed_budget: "固定予算"label_fixed_date: "固定日付"label_generic_user: "一般ユーザー"label_greater_or_equal: ">="@@ -154,17 +154,17 @@ ja:label_user: "ユーザ"label_until: "まで"label_valid_from: "から有効"- label_variable_cost_object: "可変率を基づいた予算"- label_view_all_cost_objects: "全ての予算を表示"+ label_budget: "可変率を基づいた予算"+ label_view_all_budgets: "全ての予算を表示"label_yes: "はい"- notice_cost_object_conflict: "作業項目は同一プロジェクトである必要があります。"- notice_no_cost_objects_available: "予算がありません。"+ notice_budget_conflict: "作業項目は同一プロジェクトである必要があります。"+ notice_no_budgets_available: "予算がありません。"notice_something_wrong: "エラーが発生しました。再試行してください。"notice_successful_restore: "復元処理が成功します。"notice_successful_lock: "ロックに成功しました。"notice_cost_logged_successfully: '単価が正常に記録されました。'permission_edit_cost_entries: "予約単価の編集"- permission_edit_cost_objects: "予算の編集"+ permission_edit_budgets: "予算の編集"permission_edit_own_cost_entries: "自分が予約した単価の編集"permission_edit_hourly_rates: "時給の編集"permission_edit_own_hourly_rate: "自分の時給の編集"@@ -172,15 +172,15 @@ ja:permission_log_costs: "単価の予約"permission_log_own_costs: "自分の単価の予約"permission_view_cost_entries: "予約したコストの表示"- permission_view_cost_objects: "予算の表示"+ permission_view_budgets: "予算の表示"permission_view_cost_rates: "コスト率の表示"permission_view_hourly_rates: "全ての時給の表示"permission_view_own_cost_entries: "自分が予約したコストの表示"permission_view_own_hourly_rate: "自分の時給の表示"permission_view_own_time_entries: "自分の使用済み時間の表示"- project_module_costs_module: "予算"+ project_module_costs: "予算"text_assign_time_and_cost_entries_to_project: "報告された時間とコストをプロジェクトに割り当てる"- text_cost_object_change_type_confirmation: "本当に良いですか?この操作により、特定の予算タイプの情報が破棄されます。"+ text_budget_change_type_confirmation: "本当に良いですか?この操作により、特定の予算タイプの情報が破棄されます。"text_destroy_cost_entries_question: "削除しようとしている作業項目が%{cost_entries} 件報告されました。どうしますか?"text_destroy_time_and_cost_entries: "報告された時間とコストを削除する"text_destroy_time_and_cost_entries_question: "%{hours} 時間分、削除しようとしている作業項目が%{cost_entries} 件報告されました。どうしますか?"diff --git a/modules/costs/config/locales/crowdin/ko.yml b/modules/costs/config/locales/crowdin/ko.ymlindex 7f913260bac..e80d257535d 100644--- a/modules/costs/config/locales/crowdin/ko.yml+++ b/modules/costs/config/locales/crowdin/ko.yml@@ -27,7 +27,7 @@ ko:overridden_costs: "재정의된 비용"spent: "소비"spent_on: "날짜"- cost_object:+ budget:author: "작성자"available: "사용 가능"budget: "계획됨"@@ -45,7 +45,7 @@ ko:unit_plural: "복수형 단위 이름"work_package:costs_by_type: "소비 단위"- cost_object_subject: "예산 제목"+ budget_subject: "예산 제목"labor_costs: "노동 비용"material_costs: "단위 비용"overall_costs: "전체 비용"@@ -55,11 +55,11 @@ ko:rate: "요금"user:default_rates: "기본 요금"- variable_cost_object:+ budget:labor_budget: "계획된 노동 비용"material_budget: "계획된 단위 비용"models:- cost_object: "예산"+ budget: "예산"cost_type:other: "비용 유형"material_budget_item: "단위"@@ -72,7 +72,7 @@ ko:attributes:budget: "계획된 비용"comment: "코멘트"- cost_object: "예산"+ budget: "예산"cost_type: "비용 유형"costs: "비용"current_rate: "현재 요금"@@ -80,7 +80,7 @@ ko:units: "단위"valid_from: "다음부터 유효함"button_add_budget_item: "계획된 비용 추가"- button_add_cost_object: "예산 추가"+ button_add_budget: "예산 추가"button_add_cost_type: "비용 유형 추가"button_add_rate: "요금 추가"button_cancel_edit_budget: "예산 편집 취소"@@ -101,10 +101,10 @@ ko:caption_save_rate: "요금 저장"caption_set_rate: "현재 요금 설정"caption_show_locked: "잠긴 유형 표시"- cost_objects_title: "예산"+ budgets_title: "예산"description_date_for_new_rate: "새로운 요금의 날짜"events:- cost_object: "예산 편집됨"+ budget: "예산 편집됨"group_by_others: "어떤 그룹에도 없음"help_click_to_edit: "편집하려면 여기를 클릭하세요."help_currency_format: "표시된 통화 값의 형식입니다. %n은(는) 통화 값으로 바뀌고, %u은(는) 통화 단위로 바뀝니다."@@ -112,10 +112,10 @@ ko:label_between: "사이에"label_cost_filter_add: "비용 항목 필터 추가"label_costlog: "기록된 단위 비용"- label_cost_object: "예산"- label_cost_object_id: "예산 #%{id}"- label_cost_object_new: "새 예산"- label_cost_object_plural: "예산"+ label_budget: "예산"+ label_budget_id: "예산 #%{id}"+ label_budget_new: "새 예산"+ label_budget_plural: "예산"label_cost_plural: "비용"label_cost_report: "비용 보고서"label_cost_type_specific: "예산 #%{id}: %{name}"@@ -132,7 +132,7 @@ ko:label_display_time_entries: "보고된 시간 표시"label_display_types: "유형 표시"label_edit: "편집"- label_fixed_cost_object: "고정 예산"+ label_fixed_budget: "고정 예산"label_fixed_date: "고정 날짜"label_generic_user: "일반 사용자"label_greater_or_equal: ">="@@ -154,17 +154,17 @@ ko:label_user: "사용자"label_until: "다음까지:"label_valid_from: "다음부터 유효함"- label_variable_cost_object: "예산 기반 변동 요금"- label_view_all_cost_objects: "모든 예산 보기"+ label_budget: "예산 기반 변동 요금"+ label_view_all_budgets: "모든 예산 보기"label_yes: "예"- notice_cost_object_conflict: "작업 패키지는 동일한 프로젝트에 속해야 합니다."- notice_no_cost_objects_available: "사용 가능한 예산이 없습니다."+ notice_budget_conflict: "작업 패키지는 동일한 프로젝트에 속해야 합니다."+ notice_no_budgets_available: "사용 가능한 예산이 없습니다."notice_something_wrong: "문제가 발생했습니다. 다시 시도해 주세요."notice_successful_restore: "성공적으로 복원되었습니다."notice_successful_lock: "잠겼습니다."notice_cost_logged_successfully: '단위 비용이 기록되었습니다.'permission_edit_cost_entries: "예약된 단위 비용 편집"- permission_edit_cost_objects: "예산 편집"+ permission_edit_budgets: "예산 편집"permission_edit_own_cost_entries: "고유한 예약된 단위 비용 편집"permission_edit_hourly_rates: "시간당 요금 편집"permission_edit_own_hourly_rate: "고유한 시간당 요금 편집"@@ -172,15 +172,15 @@ ko:permission_log_costs: "단위 비용 예약"permission_log_own_costs: "자신에 대한 단위 비용 예약"permission_view_cost_entries: "예약된 비용 보기"- permission_view_cost_objects: "예산 보기"+ permission_view_budgets: "예산 보기"permission_view_cost_rates: "비용 요금 보기"permission_view_hourly_rates: "모든 시간당 요금 보기"permission_view_own_cost_entries: "고유한 예약된 비용 보기"permission_view_own_hourly_rate: "고유한 시간당 요금 보기"permission_view_own_time_entries: "고유한 소비 시간 보기"- project_module_costs_module: "예산"+ project_module_costs: "예산"text_assign_time_and_cost_entries_to_project: "보고된 시간 및 비용을 프로젝트에 할당"- text_cost_object_change_type_confirmation: "계속하시겠습니까? 이 작업은 특정 예산 유형의 정보를 손상시킵니다."+ text_budget_change_type_confirmation: "계속하시겠습니까? 이 작업은 특정 예산 유형의 정보를 손상시킵니다."text_destroy_cost_entries_question: "%{cost_entries}은(는) 삭제하려는 작업 패키지에서 보고되었습니다. 어떻게 하시겠습니까?"text_destroy_time_and_cost_entries: "보고된 시간 및 비용 삭제"text_destroy_time_and_cost_entries_question: "%{hours}시간, %{cost_entries}은(는) 삭제하려는 작업 패키지에서 보고되었습니다. 어떻게 하시겠습니까?"diff --git a/modules/costs/config/locales/crowdin/lt.yml b/modules/costs/config/locales/crowdin/lt.ymlindex 961725e3777..f0c4441c31c 100644--- a/modules/costs/config/locales/crowdin/lt.yml+++ b/modules/costs/config/locales/crowdin/lt.yml@@ -27,7 +27,7 @@ lt:overridden_costs: "Perrašytos išlaidos"spent: "Praleista"spent_on: "Data"- cost_object:+ budget:author: "Autorius"available: "Laisvas"budget: "Suplanuotas"@@ -45,7 +45,7 @@ lt:unit_plural: "Daugiaskaitinis vienetų pavadinimas"work_package:costs_by_type: "Panaudota vienetų"- cost_object_subject: "Biudžeto pavadinimas"+ budget_subject: "Biudžeto pavadinimas"labor_costs: "Darbų kaštai"material_costs: "Vienetų kaštai"overall_costs: "Bendri kaštai"@@ -55,11 +55,11 @@ lt:rate: "Koeficientas"user:default_rates: "Numatytasis koeficientas"- variable_cost_object:+ budget:labor_budget: "Suplanuoti darbo kaštai"material_budget: "Suplanuoti vienetų kaštai"models:- cost_object: "Biudžetas"+ budget: "Biudžetas"cost_type:one: "Kaštų tipas"few: "Kaštų tipai"@@ -75,7 +75,7 @@ lt:attributes:budget: "Planuojami kaštai"comment: "Komentaras"- cost_object: "Biudžetas"+ budget: "Biudžetas"cost_type: "Kaštų tipas"costs: "Kaštai"current_rate: "Dabartinis koeficientas"@@ -83,7 +83,7 @@ lt:units: "Vienetai"valid_from: "Galioja nuo"button_add_budget_item: "Pridėti suplanuotus kaštus"- button_add_cost_object: "Pridėti biudžetą"+ button_add_budget: "Pridėti biudžetą"button_add_cost_type: "Pridėti kaštų tipą"button_add_rate: "Pridėti koeficientą"button_cancel_edit_budget: "Atšaukti biudžeto redagavimą"@@ -104,10 +104,10 @@ lt:caption_save_rate: "Išsaugoti koeficientą"caption_set_rate: "Nustatyti esamą koeficientą"caption_show_locked: "Rodyti užrakintus tipus"- cost_objects_title: "Biudžetai"+ budgets_title: "Biudžetai"description_date_for_new_rate: "Naujo koeficiento data"events:- cost_object: "Biudžetas redaguotas"+ budget: "Biudžetas redaguotas"group_by_others: "nėra jokioje grupėje"help_click_to_edit: "Spauskite čia norėdami redaguoti."help_currency_format: "Rodomos valiutos formatas. %n yra pakeičiamas valiutos reikšme, %u yra pakeičiamas valiutos vienetu."@@ -115,10 +115,10 @@ lt:label_between: "tarp"label_cost_filter_add: "Pridėti kaštų įrašo filtrą"label_costlog: "Į žurnalą surinkti vieneto kaštai"- label_cost_object: "Biudžetas"- label_cost_object_id: "Biudžetas #%{id}"- label_cost_object_new: "Naujas biudžetas"- label_cost_object_plural: "Biudžetai"+ label_budget: "Biudžetas"+ label_budget_id: "Biudžetas #%{id}"+ label_budget_new: "Naujas biudžetas"+ label_budget_plural: "Biudžetai"label_cost_plural: "Kaštai"label_cost_report: "Kaštų ataskaita"label_cost_type_specific: "Biudžetas Ę%{id}: %{name}"@@ -135,7 +135,7 @@ lt:label_display_time_entries: "Rodyti atsiskaitytas valandas"label_display_types: "Rodyti tipus"label_edit: "Redaguoti"- label_fixed_cost_object: "Ilgalaikis biudžetas"+ label_fixed_budget: "Ilgalaikis biudžetas"label_fixed_date: "Fiksuota data"label_generic_user: "Bendras vartotojas"label_greater_or_equal: ">="@@ -157,17 +157,17 @@ lt:label_user: "Vartotojas"label_until: "iki"label_valid_from: "Galioja nuo"- label_variable_cost_object: "Kintamu koeficientu pagrįstas biudžetas"- label_view_all_cost_objects: "Peržiūrėti visus biudžetus"+ label_budget: "Kintamu koeficientu pagrįstas biudžetas"+ label_view_all_budgets: "Peržiūrėti visus biudžetus"label_yes: "Taip"- notice_cost_object_conflict: "Darbų paketai turi būti tame pačiame projekte."- notice_no_cost_objects_available: "Nėra biudžetų."+ notice_budget_conflict: "Darbų paketai turi būti tame pačiame projekte."+ notice_no_budgets_available: "Nėra biudžetų."notice_something_wrong: "Įvyko klaida. Bandykite dar kartą."notice_successful_restore: "Sėkmingas atkūrimas."notice_successful_lock: "Sėkmingai užrakinta."notice_cost_logged_successfully: 'Vieneto kaštai į žurnalą įrašyti sėkmingai.'permission_edit_cost_entries: "Redaguoti įrašytų vienetų kaštus"- permission_edit_cost_objects: "Redaguoti biudžetus"+ permission_edit_budgets: "Redaguoti biudžetus"permission_edit_own_cost_entries: "Redaguoti paties įrašytų vienetų kaštus"permission_edit_hourly_rates: "Redaguoti valandinius koeficientus"permission_edit_own_hourly_rate: "Redaguoti savo valandinius koeficientus"@@ -175,15 +175,15 @@ lt:permission_log_costs: "Įrašyti vieneto kaštus"permission_log_own_costs: "Įrašyti vieneto kaštus už save"permission_view_cost_entries: "Peržiūrėti įrašytus kaštus"- permission_view_cost_objects: "Peržiūrėti biudžetus"+ permission_view_budgets: "Peržiūrėti biudžetus"permission_view_cost_rates: "Peržiūrėti išlaidų koeficientus"permission_view_hourly_rates: "Peržiūrėti visus valandinius koeficientus"permission_view_own_cost_entries: "Peržiūrėti savo įrašytus kaštus"permission_view_own_hourly_rate: "Peržiūrėti savo valandinį koeficientą"permission_view_own_time_entries: "Peržiūrėti savo sugaištą laiką"- project_module_costs_module: "Biudžetai"+ project_module_costs: "Biudžetai"text_assign_time_and_cost_entries_to_project: "Priskirti praleistas valandas ir kaštus projektui"- text_cost_object_change_type_confirmation: "Ar Jūs tikrai to norite? Ši operacija sunaikins visą informaciją, susijusią su specifiniu biudžeto tipu."+ text_budget_change_type_confirmation: "Ar Jūs tikrai to norite? Ši operacija sunaikins visą informaciją, susijusią su specifiniu biudžeto tipu."text_destroy_cost_entries_question: "%{cost_entries} buvo pranešta Jūsų ketinamiems ištrinti darbų paketams. Ką Jūs norite daryti?"text_destroy_time_and_cost_entries: "Ištrinti praneštas valandas ir kaštus"text_destroy_time_and_cost_entries_question: "%{hours} valandos, %{cost_entries} buvo pranešti Jūsų ketinamiems ištrinti darbų paketams. Ką Jūs norite daryti?"diff --git a/modules/costs/config/locales/crowdin/nl.yml b/modules/costs/config/locales/crowdin/nl.ymlindex 5928c2223d0..7ffdfff1af2 100644--- a/modules/costs/config/locales/crowdin/nl.yml+++ b/modules/costs/config/locales/crowdin/nl.yml@@ -27,7 +27,7 @@ nl:overridden_costs: "Overridden costs"spent: "Spent"spent_on: "Datum"- cost_object:+ budget:author: "Auteur"available: "Available"budget: "Planned"@@ -45,7 +45,7 @@ nl:unit_plural: "Pluralized unit name"work_package:costs_by_type: "Spent units"- cost_object_subject: "Titel van de begroting"+ budget_subject: "Titel van de begroting"labor_costs: "Arbeidskosten"material_costs: "Kosten per eenheid"overall_costs: "Totale kosten"@@ -55,11 +55,11 @@ nl:rate: "Rate"user:default_rates: "Default rates"- variable_cost_object:+ budget:labor_budget: "Planned labor costs"material_budget: "Planned unit costs"models:- cost_object: "Budget"+ budget: "Budget"cost_type:one: "Cost type"other: "Cost types"@@ -73,7 +73,7 @@ nl:attributes:budget: "Planned costs"comment: "Commentaar"- cost_object: "Budget"+ budget: "Budget"cost_type: "Cost type"costs: "Costs"current_rate: "Current rate"@@ -81,7 +81,7 @@ nl:units: "Eenheden"valid_from: "Valid from"button_add_budget_item: "Add planned costs"- button_add_cost_object: "Add budget"+ button_add_budget: "Add budget"button_add_cost_type: "Add cost type"button_add_rate: "Add rate"button_cancel_edit_budget: "Cancel editing budget"@@ -102,10 +102,10 @@ nl:caption_save_rate: "Save rate"caption_set_rate: "Set current rate"caption_show_locked: "Show locked types"- cost_objects_title: "Budgets"+ budgets_title: "Budgets"description_date_for_new_rate: "Date for new rate"events:- cost_object: "Budget edited"+ budget: "Budget edited"group_by_others: "not in any group"help_click_to_edit: "Click here to edit."help_currency_format: "Format of displayed currency values. %n is replaced with the currency value, %u ist replaced with the currency unit."@@ -113,10 +113,10 @@ nl:label_between: "tussen"label_cost_filter_add: "Add cost entry filter"label_costlog: "Geregistreerde kosten per eenheid"- label_cost_object: "Budget"- label_cost_object_id: "Budget #%{id}"- label_cost_object_new: "New budget"- label_cost_object_plural: "Budgets"+ label_budget: "Budget"+ label_budget_id: "Budget #%{id}"+ label_budget_new: "New budget"+ label_budget_plural: "Budgets"label_cost_plural: "Costs"label_cost_report: "Kostenrapport"label_cost_type_specific: "Budget #%{id}: %{name}"@@ -133,7 +133,7 @@ nl:label_display_time_entries: "Display reported hours"label_display_types: "Display types"label_edit: "Wijzig"- label_fixed_cost_object: "Fixed budget"+ label_fixed_budget: "Fixed budget"label_fixed_date: "Fixed date"label_generic_user: "Generic user"label_greater_or_equal: ">="@@ -155,17 +155,17 @@ nl:label_user: "Gebruiker"label_until: "until"label_valid_from: "Valid from"- label_variable_cost_object: "Variable rate based budget"- label_view_all_cost_objects: "View all budgets"+ label_budget: "Variable rate based budget"+ label_view_all_budgets: "View all budgets"label_yes: "Ja"- notice_cost_object_conflict: "WorkPackages must be of the same project."- notice_no_cost_objects_available: "No budgets available."+ notice_budget_conflict: "WorkPackages must be of the same project."+ notice_no_budgets_available: "No budgets available."notice_something_wrong: "Something went wrong. Please try again."notice_successful_restore: "Successful restore."notice_successful_lock: "Vergrendeld met succes."notice_cost_logged_successfully: 'Unit cost logged successfully.'permission_edit_cost_entries: "Geboekte kosten per eenheid bewerken"- permission_edit_cost_objects: "Edit budgets"+ permission_edit_budgets: "Edit budgets"permission_edit_own_cost_entries: "Eigen geboekte kosten per eenheid bewerken"permission_edit_hourly_rates: "Edit hourly rates"permission_edit_own_hourly_rate: "Edit own hourly rates"@@ -173,15 +173,15 @@ nl:permission_log_costs: "Book unit costs"permission_log_own_costs: "Book unit costs for oneself"permission_view_cost_entries: "Geboekte kosten bekijken"- permission_view_cost_objects: "View budgets"+ permission_view_budgets: "View budgets"permission_view_cost_rates: "View cost rates"permission_view_hourly_rates: "View all hourly rates"permission_view_own_cost_entries: "Eigen geboekte kosten bekijken"permission_view_own_hourly_rate: "View own hourly rate"permission_view_own_time_entries: "View own spent time"- project_module_costs_module: "Budgets"+ project_module_costs: "Budgets"text_assign_time_and_cost_entries_to_project: "Assign reported hours and costs to the project"- text_cost_object_change_type_confirmation: "Are you sure? This operation will destroy information of the specific budget type."+ text_budget_change_type_confirmation: "Are you sure? This operation will destroy information of the specific budget type."text_destroy_cost_entries_question: "%{cost_entries} were reported on the work packages you are about to delete. What do you want to do ?"text_destroy_time_and_cost_entries: "Delete reported hours and costs"text_destroy_time_and_cost_entries_question: "%{hours} hours, %{cost_entries} were reported on the work packages you are about to delete. What do you want to do ?"diff --git a/modules/costs/config/locales/crowdin/no.yml b/modules/costs/config/locales/crowdin/no.ymlindex f41a2406589..b49a7d805ed 100644--- a/modules/costs/config/locales/crowdin/no.yml+++ b/modules/costs/config/locales/crowdin/no.yml@@ -27,7 +27,7 @@overridden_costs: "Overridden costs"spent: "Spent"spent_on: "Dato"- cost_object:+ budget:author: "Forfatter"available: "Available"budget: "Planned"@@ -45,7 +45,7 @@unit_plural: "Pluralized unit name"work_package:costs_by_type: "Spent units"- cost_object_subject: "Budget title"+ budget_subject: "Budget title"labor_costs: "Labor costs"material_costs: "Unit costs"overall_costs: "Overall costs"@@ -55,11 +55,11 @@rate: "Rate"user:default_rates: "Default rates"- variable_cost_object:+ budget:labor_budget: "Planned labor costs"material_budget: "Planned unit costs"models:- cost_object: "Budget"+ budget: "Budget"cost_type:one: "Cost type"other: "Cost types"@@ -73,7 +73,7 @@attributes:budget: "Planned costs"comment: "Kommentar"- cost_object: "Budget"+ budget: "Budget"cost_type: "Cost type"costs: "Costs"current_rate: "Current rate"@@ -81,7 +81,7 @@units: "Enheter"valid_from: "Valid from"button_add_budget_item: "Add planned costs"- button_add_cost_object: "Add budget"+ button_add_budget: "Add budget"button_add_cost_type: "Add cost type"button_add_rate: "Add rate"button_cancel_edit_budget: "Cancel editing budget"@@ -102,10 +102,10 @@caption_save_rate: "Save rate"caption_set_rate: "Set current rate"caption_show_locked: "Show locked types"- cost_objects_title: "Budgets"+ budgets_title: "Budgets"description_date_for_new_rate: "Date for new rate"events:- cost_object: "Budget edited"+ budget: "Budget edited"group_by_others: "not in any group"help_click_to_edit: "Click here to edit."help_currency_format: "Format of displayed currency values. %n is replaced with the currency value, %u ist replaced with the currency unit."@@ -113,10 +113,10 @@label_between: "mellom"label_cost_filter_add: "Add cost entry filter"label_costlog: "Logged unit costs"- label_cost_object: "Budget"- label_cost_object_id: "Budget #%{id}"- label_cost_object_new: "New budget"- label_cost_object_plural: "Budgets"+ label_budget: "Budget"+ label_budget_id: "Budget #%{id}"+ label_budget_new: "New budget"+ label_budget_plural: "Budgets"label_cost_plural: "Costs"label_cost_report: "Cost report"label_cost_type_specific: "Budget #%{id}: %{name}"@@ -133,7 +133,7 @@label_display_time_entries: "Display reported hours"label_display_types: "Display types"label_edit: "Rediger"- label_fixed_cost_object: "Fixed budget"+ label_fixed_budget: "Fixed budget"label_fixed_date: "Fixed date"label_generic_user: "Generic user"label_greater_or_equal: ">="@@ -155,17 +155,17 @@label_user: "Bruker"label_until: "until"label_valid_from: "Valid from"- label_variable_cost_object: "Variable rate based budget"- label_view_all_cost_objects: "View all budgets"+ label_budget: "Variable rate based budget"+ label_view_all_budgets: "View all budgets"label_yes: "Ja"- notice_cost_object_conflict: "WorkPackages must be of the same project."- notice_no_cost_objects_available: "No budgets available."+ notice_budget_conflict: "WorkPackages must be of the same project."+ notice_no_budgets_available: "No budgets available."notice_something_wrong: "Something went wrong. Please try again."notice_successful_restore: "Successful restore."notice_successful_lock: "Locked successfully."notice_cost_logged_successfully: 'Unit cost logged successfully.'permission_edit_cost_entries: "Edit booked unit costs"- permission_edit_cost_objects: "Edit budgets"+ permission_edit_budgets: "Edit budgets"permission_edit_own_cost_entries: "Edit own booked unit costs"permission_edit_hourly_rates: "Edit hourly rates"permission_edit_own_hourly_rate: "Edit own hourly rates"@@ -173,15 +173,15 @@permission_log_costs: "Book unit costs"permission_log_own_costs: "Book unit costs for oneself"permission_view_cost_entries: "View booked costs"- permission_view_cost_objects: "View budgets"+ permission_view_budgets: "View budgets"permission_view_cost_rates: "View cost rates"permission_view_hourly_rates: "View all hourly rates"permission_view_own_cost_entries: "View own booked costs"permission_view_own_hourly_rate: "View own hourly rate"permission_view_own_time_entries: "View own spent time"- project_module_costs_module: "Budgets"+ project_module_costs: "Budgets"text_assign_time_and_cost_entries_to_project: "Assign reported hours and costs to the project"- text_cost_object_change_type_confirmation: "Are you sure? This operation will destroy information of the specific budget type."+ text_budget_change_type_confirmation: "Are you sure? This operation will destroy information of the specific budget type."text_destroy_cost_entries_question: "%{cost_entries} were reported on the work packages you are about to delete. What do you want to do ?"text_destroy_time_and_cost_entries: "Delete reported hours and costs"text_destroy_time_and_cost_entries_question: "%{hours} hours, %{cost_entries} were reported on the work packages you are about to delete. What do you want to do ?"diff --git a/modules/costs/config/locales/crowdin/pl.yml b/modules/costs/config/locales/crowdin/pl.ymlindex f144abb34bc..812ac1266e2 100644--- a/modules/costs/config/locales/crowdin/pl.yml+++ b/modules/costs/config/locales/crowdin/pl.yml@@ -27,7 +27,7 @@ pl:overridden_costs: "Koszty zastąpione"spent: "Wydatki"spent_on: "Data"- cost_object:+ budget:author: "Autor"available: "Dostępne"budget: "Zaplanowany"@@ -45,7 +45,7 @@ pl:unit_plural: "Liczba mnoga jednostki"work_package:costs_by_type: "Zużyte jednostki"- cost_object_subject: "Tytuł budżetu"+ budget_subject: "Tytuł budżetu"labor_costs: "Koszty pracy"material_costs: "Koszt jednostki"overall_costs: "Koszt całkowity"@@ -55,11 +55,11 @@ pl:rate: "Stawka"user:default_rates: "Domyślna stawka"- variable_cost_object:+ budget:labor_budget: "Planowane koszty pracy"material_budget: "Planowane koszty jednostkowe"models:- cost_object: "Budżet"+ budget: "Budżet"cost_type:one: "Jednostki"few: "Rodzaje kosztów"@@ -75,7 +75,7 @@ pl:attributes:budget: "Planowane koszty"comment: "Komentarz"- cost_object: "Budżet"+ budget: "Budżet"cost_type: "Jednostki"costs: "Koszty"current_rate: "Aktualna stawka"@@ -83,7 +83,7 @@ pl:units: "Jednostki"valid_from: "Ważny od"button_add_budget_item: "Dodaj planowane koszty"- button_add_cost_object: "Dodaj budżet"+ button_add_budget: "Dodaj budżet"button_add_cost_type: "Dodaj typ kosztu"button_add_rate: "Dodaj stawkę"button_cancel_edit_budget: "Anuluj edycję budżetu"@@ -104,10 +104,10 @@ pl:caption_save_rate: "Zapisz stawkę"caption_set_rate: "Ustaw domyślną stawkę"caption_show_locked: "Pokaż zamknięte typy kosztów"- cost_objects_title: "Budżetowanie"+ budgets_title: "Budżetowanie"description_date_for_new_rate: "Data nowej stawki"events:- cost_object: "Budżet edytowany"+ budget: "Budżet edytowany"group_by_others: "nie w każdej grupie"help_click_to_edit: "Kliknij tutaj aby edytować."help_currency_format: "Format wyświetlanej waluty %n jest zastąpiony przez wartość waluty, %u którą jest zastąpiony jednostką walutową."@@ -115,10 +115,10 @@ pl:label_between: "pomiędzy"label_cost_filter_add: "Dodaj filtr kosztów"label_costlog: "Zarejestrowane koszty jednostkowe"- label_cost_object: "Budżet"- label_cost_object_id: "Budżet #%{id}"- label_cost_object_new: "Nowy budżet"- label_cost_object_plural: "Budżetowanie"+ label_budget: "Budżet"+ label_budget_id: "Budżet #%{id}"+ label_budget_new: "Nowy budżet"+ label_budget_plural: "Budżetowanie"label_cost_plural: "Koszty"label_cost_report: "Raport kosztów"label_cost_type_specific: "Budżet #%{id}: %{name}"@@ -135,7 +135,7 @@ pl:label_display_time_entries: "Wyświetl zgłoszone godziny"label_display_types: "Wyświetl typy"label_edit: "Edycja"- label_fixed_cost_object: "Poprawiony budżet"+ label_fixed_budget: "Poprawiony budżet"label_fixed_date: "Przypisana data"label_generic_user: "Ogólne informacje"label_greater_or_equal: "≥"@@ -157,17 +157,17 @@ pl:label_user: "Użytkownik"label_until: "do"label_valid_from: "Ważny od"- label_variable_cost_object: "Zmienna wysokość budżetu"- label_view_all_cost_objects: "Zobacz wszystkie budżety"+ label_budget: "Zmienna wysokość budżetu"+ label_view_all_budgets: "Zobacz wszystkie budżety"label_yes: "Tak"- notice_cost_object_conflict: "Zestaw zadań musi być z tego samego projektu."- notice_no_cost_objects_available: "Nie ma dostępnych budżetów."+ notice_budget_conflict: "Zestaw zadań musi być z tego samego projektu."+ notice_no_budgets_available: "Nie ma dostępnych budżetów."notice_something_wrong: "Coś poszło nie tak. Proszę spróbuj ponownie."notice_successful_restore: "Przywracanie się powiodło."notice_successful_lock: "Zablokowano."notice_cost_logged_successfully: 'Koszt jednostkowy zarejestrowano pomyślnie.'permission_edit_cost_entries: "Edytuj zapisane koszty jednostkowe"- permission_edit_cost_objects: "Edytuj budżety"+ permission_edit_budgets: "Edytuj budżety"permission_edit_own_cost_entries: "Edytuj zarejestrowane własne koszty jednostkowe"permission_edit_hourly_rates: "Edycja stawek godzinowych"permission_edit_own_hourly_rate: "Edycja własnych stawek godzinowych"@@ -175,15 +175,15 @@ pl:permission_log_costs: "Zarejestruj koszty jednostkowe"permission_log_own_costs: "Zarejestruj koszty jednostkowe dla siebie"permission_view_cost_entries: "Zobacz zarejestrowane koszty"- permission_view_cost_objects: "Zobacz budżety"+ permission_view_budgets: "Zobacz budżety"permission_view_cost_rates: "Zobacz koszty stawek"permission_view_hourly_rates: "Zobacz wszystkie stawki godzinowe"permission_view_own_cost_entries: "Zobacz samodzielnie zarejestrowane koszty"permission_view_own_hourly_rate: "Zobacz własne stawki godzinowe"permission_view_own_time_entries: "Zobacz swój poświęcony czas"- project_module_costs_module: "Budżetowanie"+ project_module_costs: "Budżetowanie"text_assign_time_and_cost_entries_to_project: "Przypisz zgłoszone godziny i koszty do projektu"- text_cost_object_change_type_confirmation: "Jesteś pewny? Ta operacja zniszczy informacje o określonym typie budżetu."+ text_budget_change_type_confirmation: "Jesteś pewny? Ta operacja zniszczy informacje o określonym typie budżetu."text_destroy_cost_entries_question: "%{cost_entries} zostały zgłoszone do Zestawu zadań, który chcesz usunąć. Co chcesz zrobić?"text_destroy_time_and_cost_entries: "Usuń zgłoszone godziny i koszty"text_destroy_time_and_cost_entries_question: "%{hours} godzin, %{cost_entries} zostały zgłoszone do Zestawu zadań, który chcesz usunąć. Co chcesz zrobić?"diff --git a/modules/costs/config/locales/crowdin/pt.yml b/modules/costs/config/locales/crowdin/pt.ymlindex 1e9a5da5f36..4c80950972a 100644--- a/modules/costs/config/locales/crowdin/pt.yml+++ b/modules/costs/config/locales/crowdin/pt.yml@@ -27,7 +27,7 @@ pt:overridden_costs: "Substitui custos"spent: "Gasto"spent_on: "Data"- cost_object:+ budget:author: "Autor"available: "Disponível"budget: "Planejado"@@ -45,7 +45,7 @@ pt:unit_plural: "Plural do nome da unidade"work_package:costs_by_type: "Unidades gastas"- cost_object_subject: "Título do orçamento"+ budget_subject: "Título do orçamento"labor_costs: "Custos de trabalho"material_costs: "Custos unitários"overall_costs: "Custos totais"@@ -55,11 +55,11 @@ pt:rate: "Taxa"user:default_rates: "Taxas padrão"- variable_cost_object:+ budget:labor_budget: "Custos planejados de trabalho"material_budget: "Custos unitários planejados"models:- cost_object: "Orçamento"+ budget: "Orçamento"cost_type:one: "Tipo de custo"other: "Tipos de custo"@@ -73,7 +73,7 @@ pt:attributes:budget: "Custos planejados"comment: "Comentário"- cost_object: "Orçamento"+ budget: "Orçamento"cost_type: "Tipo de custo"costs: "Custos"current_rate: "Taxa atual"@@ -81,7 +81,7 @@ pt:units: "Unidades"valid_from: "Válido a partir de"button_add_budget_item: "Adicionar custos planejados"- button_add_cost_object: "Adicionar orçamento"+ button_add_budget: "Adicionar orçamento"button_add_cost_type: "Adicionar o tipo de custo"button_add_rate: "Adicionar taxa"button_cancel_edit_budget: "Cancelar a edição de orçamento"@@ -102,10 +102,10 @@ pt:caption_save_rate: "Salvar taxa"caption_set_rate: "Fixar taxa atual"caption_show_locked: "Mostrar tipos bloqueados"- cost_objects_title: "Orçamentos"+ budgets_title: "Orçamentos"description_date_for_new_rate: "Data para nova taxa"events:- cost_object: "Orçamento editado"+ budget: "Orçamento editado"group_by_others: "Não em qualquer grupo"help_click_to_edit: "Clique aqui para editar."help_currency_format: "Formato exibidos de valores de moeda. %n é substituído com o valor da moeda, %u é substituído com a unidade da moeda."@@ -113,10 +113,10 @@ pt:label_between: "entre"label_cost_filter_add: "Adicionar filtro de entrada de custo"label_costlog: "Custos unitários registrados"- label_cost_object: "Orçamento"- label_cost_object_id: "Orçamento #%{id}"- label_cost_object_new: "Novo orçamento"- label_cost_object_plural: "Orçamentos"+ label_budget: "Orçamento"+ label_budget_id: "Orçamento #%{id}"+ label_budget_new: "Novo orçamento"+ label_budget_plural: "Orçamentos"label_cost_plural: "Custos"label_cost_report: "Relatório de custos"label_cost_type_specific: "Orçamento #%{id}: %{name}"@@ -133,7 +133,7 @@ pt:label_display_time_entries: "Exibir horas informadas"label_display_types: "Exibir tipos"label_edit: "Editar"- label_fixed_cost_object: "Orçamento fixo"+ label_fixed_budget: "Orçamento fixo"label_fixed_date: "Data fixa"label_generic_user: "Usuário genérico"label_greater_or_equal: ">="@@ -155,17 +155,17 @@ pt:label_user: "Usuário"label_until: "até"label_valid_from: "Válido a partir de"- label_variable_cost_object: "Orçamento baseado em taxa variável"- label_view_all_cost_objects: "Ver os todos os orçamentos"+ label_budget: "Orçamento baseado em taxa variável"+ label_view_all_budgets: "Ver os todos os orçamentos"label_yes: "Sim"- notice_cost_object_conflict: "Pacotes de trabalho devem ser do mesmo projeto."- notice_no_cost_objects_available: "Não há orçamentos disponíveis."+ notice_budget_conflict: "Pacotes de trabalho devem ser do mesmo projeto."+ notice_no_budgets_available: "Não há orçamentos disponíveis."notice_something_wrong: "Algo deu errado. Por favor, tente novamente."notice_successful_restore: "Restauração bem-sucedida."notice_successful_lock: "Bloqueado com sucesso."notice_cost_logged_successfully: 'Custo unitário registrado com sucesso.'permission_edit_cost_entries: "Editar custos unitários reservados"- permission_edit_cost_objects: "Editar os orçamentos"+ permission_edit_budgets: "Editar os orçamentos"permission_edit_own_cost_entries: "Editar custos unitários próprios reservados"permission_edit_hourly_rates: "Editar taxas horárias"permission_edit_own_hourly_rate: "Editar as próprias taxas horárias"@@ -173,15 +173,15 @@ pt:permission_log_costs: "Reservar custos unitários"permission_log_own_costs: "Reservar custos unitários próprios"permission_view_cost_entries: "Ver custos reservados"- permission_view_cost_objects: "Ver orçamentos"+ permission_view_budgets: "Ver orçamentos"permission_view_cost_rates: "Ver taxas de custo"permission_view_hourly_rates: "Ver todas as taxas de horárias"permission_view_own_cost_entries: "Ver custos reservados próprios"permission_view_own_hourly_rate: "Ver sua própria taxa horária"permission_view_own_time_entries: "Ver o próprio tempo gasto"- project_module_costs_module: "Orçamentos"+ project_module_costs: "Orçamentos"text_assign_time_and_cost_entries_to_project: "Atribuir horas relatadas e custos ao projeto"- text_cost_object_change_type_confirmation: "Tem certeza? Esta operação irá destruir informações do tipo específico de orçamento."+ text_budget_change_type_confirmation: "Tem certeza? Esta operação irá destruir informações do tipo específico de orçamento."text_destroy_cost_entries_question: "%{cost_entries} foram informados sobre os pacotes de trabalho que você está prestes a excluir. O que você quer fazer?"text_destroy_time_and_cost_entries: "Excluir horas e custos informados"text_destroy_time_and_cost_entries_question: "%{hours} horas, %{cost_entries} foram relatados sobre os pacotes de trabalho que você está prestes a excluir. O que você quer fazer?"diff --git a/modules/costs/config/locales/crowdin/ro.yml b/modules/costs/config/locales/crowdin/ro.ymlindex ba948b35545..96dd055ccac 100644--- a/modules/costs/config/locales/crowdin/ro.yml+++ b/modules/costs/config/locales/crowdin/ro.yml@@ -27,7 +27,7 @@ ro:overridden_costs: "Overridden costs"spent: "Spent"spent_on: "Dată"- cost_object:+ budget:author: "Autor"available: "Available"budget: "Planned"@@ -45,7 +45,7 @@ ro:unit_plural: "Pluralized unit name"work_package:costs_by_type: "Spent units"- cost_object_subject: "Budget title"+ budget_subject: "Budget title"labor_costs: "Labor costs"material_costs: "Unit costs"overall_costs: "Overall costs"@@ -55,11 +55,11 @@ ro:rate: "Rate"user:default_rates: "Default rates"- variable_cost_object:+ budget:labor_budget: "Planned labor costs"material_budget: "Planned unit costs"models:- cost_object: "Budget"+ budget: "Budget"cost_type:one: "Cost type"few: "Cost types"@@ -74,7 +74,7 @@ ro:attributes:budget: "Planned costs"comment: "Comentariu"- cost_object: "Budget"+ budget: "Budget"cost_type: "Cost type"costs: "Costs"current_rate: "Current rate"@@ -82,7 +82,7 @@ ro:units: "Unități"valid_from: "Valid from"button_add_budget_item: "Add planned costs"- button_add_cost_object: "Add budget"+ button_add_budget: "Add budget"button_add_cost_type: "Add cost type"button_add_rate: "Add rate"button_cancel_edit_budget: "Cancel editing budget"@@ -103,10 +103,10 @@ ro:caption_save_rate: "Save rate"caption_set_rate: "Set current rate"caption_show_locked: "Show locked types"- cost_objects_title: "Budgets"+ budgets_title: "Budgets"description_date_for_new_rate: "Date for new rate"events:- cost_object: "Budget edited"+ budget: "Budget edited"group_by_others: "not in any group"help_click_to_edit: "Click here to edit."help_currency_format: "Format of displayed currency values. %n is replaced with the currency value, %u ist replaced with the currency unit."@@ -114,10 +114,10 @@ ro:label_between: "between"label_cost_filter_add: "Add cost entry filter"label_costlog: "Logged unit costs"- label_cost_object: "Budget"- label_cost_object_id: "Budget #%{id}"- label_cost_object_new: "New budget"- label_cost_object_plural: "Budgets"+ label_budget: "Budget"+ label_budget_id: "Budget #%{id}"+ label_budget_new: "New budget"+ label_budget_plural: "Budgets"label_cost_plural: "Costs"label_cost_report: "Raport de cost"label_cost_type_specific: "Budget #%{id}: %{name}"@@ -134,7 +134,7 @@ ro:label_display_time_entries: "Display reported hours"label_display_types: "Display types"label_edit: "Editare"- label_fixed_cost_object: "Fixed budget"+ label_fixed_budget: "Fixed budget"label_fixed_date: "Fixed date"label_generic_user: "Generic user"label_greater_or_equal: ">="@@ -156,17 +156,17 @@ ro:label_user: "Utilizator"label_until: "until"label_valid_from: "Valid from"- label_variable_cost_object: "Variable rate based budget"- label_view_all_cost_objects: "View all budgets"+ label_budget: "Variable rate based budget"+ label_view_all_budgets: "View all budgets"label_yes: "Da"- notice_cost_object_conflict: "WorkPackages must be of the same project."- notice_no_cost_objects_available: "No budgets available."+ notice_budget_conflict: "WorkPackages must be of the same project."+ notice_no_budgets_available: "No budgets available."notice_something_wrong: "Something went wrong. Please try again."notice_successful_restore: "Successful restore."notice_successful_lock: "Locked successfully."notice_cost_logged_successfully: 'Unit cost logged successfully.'permission_edit_cost_entries: "Edit booked unit costs"- permission_edit_cost_objects: "Edit budgets"+ permission_edit_budgets: "Edit budgets"permission_edit_own_cost_entries: "Edit own booked unit costs"permission_edit_hourly_rates: "Edit hourly rates"permission_edit_own_hourly_rate: "Edit own hourly rates"@@ -174,15 +174,15 @@ ro:permission_log_costs: "Book unit costs"permission_log_own_costs: "Book unit costs for oneself"permission_view_cost_entries: "View booked costs"- permission_view_cost_objects: "View budgets"+ permission_view_budgets: "View budgets"permission_view_cost_rates: "View cost rates"permission_view_hourly_rates: "View all hourly rates"permission_view_own_cost_entries: "View own booked costs"permission_view_own_hourly_rate: "View own hourly rate"permission_view_own_time_entries: "View own spent time"- project_module_costs_module: "Budgets"+ project_module_costs: "Budgets"text_assign_time_and_cost_entries_to_project: "Assign reported hours and costs to the project"- text_cost_object_change_type_confirmation: "Are you sure? This operation will destroy information of the specific budget type."+ text_budget_change_type_confirmation: "Are you sure? This operation will destroy information of the specific budget type."text_destroy_cost_entries_question: "%{cost_entries} were reported on the work packages you are about to delete. What do you want to do ?"text_destroy_time_and_cost_entries: "Delete reported hours and costs"text_destroy_time_and_cost_entries_question: "%{hours} hours, %{cost_entries} were reported on the work packages you are about to delete. What do you want to do ?"diff --git a/modules/costs/config/locales/crowdin/ru.yml b/modules/costs/config/locales/crowdin/ru.ymlindex c9be4dbaf90..722fbd238e5 100644--- a/modules/costs/config/locales/crowdin/ru.yml+++ b/modules/costs/config/locales/crowdin/ru.yml@@ -27,7 +27,7 @@ ru:overridden_costs: "Переопределенные расходы"spent: "Потрачено"spent_on: "Дата"- cost_object:+ budget:author: "Автор"available: "Доступно"budget: "Запланированно"@@ -45,7 +45,7 @@ ru:unit_plural: "Множественное наименование количественного показателя"work_package:costs_by_type: "Затраченное количество"- cost_object_subject: "Название бюджета"+ budget_subject: "Название бюджета"labor_costs: "Трудовые расходы"material_costs: "Расходы на единицу"overall_costs: "Общие расходы"@@ -55,11 +55,11 @@ ru:rate: "Тариф"user:default_rates: "Тариф по умолчанию"- variable_cost_object:+ budget:labor_budget: "Запланированные трудозатраты"material_budget: "Запланированные затраты по количеству"models:- cost_object: "Бюджет"+ budget: "Бюджет"cost_type:one: "Тип затрат"few: "Типы затрат"@@ -75,7 +75,7 @@ ru:attributes:budget: "Запланированные расходы"comment: "Комментарий"- cost_object: "Бюджет"+ budget: "Бюджет"cost_type: "Тип затрат"costs: "Расходы"current_rate: "Текущий тариф"@@ -83,7 +83,7 @@ ru:units: "Модули"valid_from: "Действует с"button_add_budget_item: "Добавить запланированные расходы"- button_add_cost_object: "Добавить бюджет"+ button_add_budget: "Добавить бюджет"button_add_cost_type: "Добавить тип расходов"button_add_rate: "Добавить тариф"button_cancel_edit_budget: "Отменить правку бюджета"@@ -104,10 +104,10 @@ ru:caption_save_rate: "Сохранить тариф"caption_set_rate: "Установить текущий тариф"caption_show_locked: "Показывать Заблокированные типы"- cost_objects_title: "Бюджеты"+ budgets_title: "Бюджеты"description_date_for_new_rate: "Дата для нового тарифа"events:- cost_object: "Бюджет изменен"+ budget: "Бюджет изменен"group_by_others: "не в какой-либо группе"help_click_to_edit: "Нажмите здесь, чтобы править."help_currency_format: "Формат отображения денежных значений. %n заменяется значением валюты, %u заменяется денежной единицой."@@ -115,10 +115,10 @@ ru:label_between: "между"label_cost_filter_add: "Добавить фильтр расходов"label_costlog: "Журналированные затраты на единицу"- label_cost_object: "Бюджет"- label_cost_object_id: "Бюджет #%{id}"- label_cost_object_new: "Новый бюджет"- label_cost_object_plural: "Бюджеты"+ label_budget: "Бюджет"+ label_budget_id: "Бюджет #%{id}"+ label_budget_new: "Новый бюджет"+ label_budget_plural: "Бюджеты"label_cost_plural: "Расходы"label_cost_report: "Отчет по расходам"label_cost_type_specific: "Бюджет #%{id}: %{name}"@@ -135,7 +135,7 @@ ru:label_display_time_entries: "Отображать часы по отчету"label_display_types: "Отображение типов"label_edit: "Правка"- label_fixed_cost_object: "Фиксированный бюджет"+ label_fixed_budget: "Фиксированный бюджет"label_fixed_date: "Фиксированная Дата"label_generic_user: "Универсальный пользователь"label_greater_or_equal: ">="@@ -157,17 +157,17 @@ ru:label_user: "Пользователь"label_until: "До"label_valid_from: "Действует с"- label_variable_cost_object: "Бюджет на основе переменного тарифа"- label_view_all_cost_objects: "Отобразить все бюджеты"+ label_budget: "Бюджет на основе переменного тарифа"+ label_view_all_budgets: "Отобразить все бюджеты"label_yes: "да"- notice_cost_object_conflict: "Пакет работ должен быть из того же проекта."- notice_no_cost_objects_available: "Нет доступных бюджетов."+ notice_budget_conflict: "Пакет работ должен быть из того же проекта."+ notice_no_budgets_available: "Нет доступных бюджетов."notice_something_wrong: "Произошла ошибка. Пожалуйста, попробуйте снова."notice_successful_restore: "Успешное восстановление."notice_successful_lock: "Успешно заблокировано."notice_cost_logged_successfully: 'Стоимость единицы успешно зажурналировано 'permission_edit_cost_entries: "Править зарегестрированные количественные затраты"- permission_edit_cost_objects: "Править бюджеты"+ permission_edit_budgets: "Править бюджеты"permission_edit_own_cost_entries: "Править собственные зарегистрированные количественные затраты"permission_edit_hourly_rates: "Править почасовые тарифы"permission_edit_own_hourly_rate: "Править собственные почасовые тарифы"@@ -175,15 +175,15 @@ ru:permission_log_costs: "Регистрировать затраты по количеству"permission_log_own_costs: "Регистрировать затраты по количеству для себя"permission_view_cost_entries: "Просмотр зарегистрированных затрат"- permission_view_cost_objects: "Просмотр бюджетов"+ permission_view_budgets: "Просмотр бюджетов"permission_view_cost_rates: "Просмотр тарифов по стоимости"permission_view_hourly_rates: "Просмотр всех почасовых тарифов"permission_view_own_cost_entries: "Просмотр своих зарегистрированных расходов"permission_view_own_hourly_rate: "Просмотр своей почасовой ставки"permission_view_own_time_entries: "Просмотр своего отработанного времени"- project_module_costs_module: "Бюджеты"+ project_module_costs: "Бюджеты"text_assign_time_and_cost_entries_to_project: "Связать сообщенные часы и расходы с проектом"- text_cost_object_change_type_confirmation: "Уверены? Эта операция уничтожит информацию о типе бюджета."+ text_budget_change_type_confirmation: "Уверены? Эта операция уничтожит информацию о типе бюджета."text_destroy_cost_entries_question: "%{cost_entries} сообщили о рабочих пакетах, которые вы собираетесь удалить. Что вы собираетесь сделать?"text_destroy_time_and_cost_entries: "Удалить отчеты о часах и расходах"text_destroy_time_and_cost_entries_question: "%{hours} часов, %{cost_entries} сообщили о рабочих пакетах, котрый вы собираетесь удалить. Что вы хотите сделать?"diff --git a/modules/costs/config/locales/crowdin/sk.yml b/modules/costs/config/locales/crowdin/sk.ymlindex b451b71fa01..e5fb88d6941 100644--- a/modules/costs/config/locales/crowdin/sk.yml+++ b/modules/costs/config/locales/crowdin/sk.yml@@ -27,7 +27,7 @@ sk:overridden_costs: "Prekročené náklady"spent: "Minuté"spent_on: "Dátum"- cost_object:+ budget:author: "Autor"available: "Dostupný"budget: "Plánovaný"@@ -45,7 +45,7 @@ sk:unit_plural: "Názov jednotky v množnom čísle"work_package:costs_by_type: "Použité jednotky"- cost_object_subject: "Názov rozpočtu"+ budget_subject: "Názov rozpočtu"labor_costs: "Mzdové náklady"material_costs: "Jednotkové náklady"overall_costs: "Celkové náklady"@@ -55,11 +55,11 @@ sk:rate: "Sadzba"user:default_rates: "Základné sadzby"- variable_cost_object:+ budget:labor_budget: "Plánované mzdové náklady"material_budget: "Plánované jednotkové náklady"models:- cost_object: "Rozpočet"+ budget: "Rozpočet"cost_type:one: "Typ nákladu"few: "Typy nákladov"@@ -75,7 +75,7 @@ sk:attributes:budget: "Plánované náklady"comment: "Komentár"- cost_object: "Rozpočet"+ budget: "Rozpočet"cost_type: "Typ nákladu"costs: "Náklady"current_rate: "Aktuálna sadzba"@@ -83,7 +83,7 @@ sk:units: "Jednotky"valid_from: "Platný od"button_add_budget_item: "Pridať plánované náklady"- button_add_cost_object: "Pridať rozpočet"+ button_add_budget: "Pridať rozpočet"button_add_cost_type: "Pridať typ nákladov"button_add_rate: "Pridať sadzbu"button_cancel_edit_budget: "Zrušiť úpravu rozpočtu"@@ -104,10 +104,10 @@ sk:caption_save_rate: "Uložiť sadzbu"caption_set_rate: "Nastaviť aktuálnu sadzbu"caption_show_locked: "Zobraziť zablokované typy"- cost_objects_title: "Rozpočty"+ budgets_title: "Rozpočty"description_date_for_new_rate: "Dátum novej sadzby"events:- cost_object: "Rozpočet bol upravený"+ budget: "Rozpočet bol upravený"group_by_others: "v žiadnej zo skupín"help_click_to_edit: "Kliknite tu pre editáciu."help_currency_format: "Formát zobrazených hodnôt mien. %n sa nahradí hodnotou meny, %u sa nahradí jednotkou meny."@@ -115,10 +115,10 @@ sk:label_between: "medzi"label_cost_filter_add: "Pridať filter nákladov"label_costlog: "Zaúčtované jednotkové náklady"- label_cost_object: "Rozpočet"- label_cost_object_id: "Rozpočet #%{id}"- label_cost_object_new: "Nový rozpočet"- label_cost_object_plural: "Rozpočty"+ label_budget: "Rozpočet"+ label_budget_id: "Rozpočet #%{id}"+ label_budget_new: "Nový rozpočet"+ label_budget_plural: "Rozpočty"label_cost_plural: "Náklady"label_cost_report: "Výkaz nákladov"label_cost_type_specific: "Rozpočet #%{id}: %{name}"@@ -135,7 +135,7 @@ sk:label_display_time_entries: "Zobrazenie odhlásených hodín"label_display_types: "Zobrazené typy vstupov"label_edit: "Upraviť"- label_fixed_cost_object: "Pevný rozpočet"+ label_fixed_budget: "Pevný rozpočet"label_fixed_date: "Stanovený dátum"label_generic_user: "Generický používateľ"label_greater_or_equal: ">="@@ -157,17 +157,17 @@ sk:label_user: "Užívateľ(ka)"label_until: "do"label_valid_from: "Platný od"- label_variable_cost_object: "Rozpočet založený na variabilnej sadzbe"- label_view_all_cost_objects: "Zobraziť všetky rozpočty"+ label_budget: "Rozpočet založený na variabilnej sadzbe"+ label_view_all_budgets: "Zobraziť všetky rozpočty"label_yes: "Áno"- notice_cost_object_conflict: "Pracovné balíčky musia byť z rovnakého projektu."- notice_no_cost_objects_available: "Nie sú k dispozícii žiadne rozpočty."+ notice_budget_conflict: "Pracovné balíčky musia byť z rovnakého projektu."+ notice_no_budgets_available: "Nie sú k dispozícii žiadne rozpočty."notice_something_wrong: "Niečo sa pokazilo. Prosím skúste to znova."notice_successful_restore: "Úspešné obnovenie."notice_successful_lock: "Úspešne blokované."notice_cost_logged_successfully: 'Jednotkové náklady boli úspešne zaznamenané.'permission_edit_cost_entries: "Upraviť zaúčtované jednotkové náklady"- permission_edit_cost_objects: "Upraviť rozpočty"+ permission_edit_budgets: "Upraviť rozpočty"permission_edit_own_cost_entries: "Upraviť vlastné zaúčtované jednotkové náklady"permission_edit_hourly_rates: "Upraviť hodinové sadzby"permission_edit_own_hourly_rate: "Upraviť vlastné hodinové sadzby"@@ -175,15 +175,15 @@ sk:permission_log_costs: "Zaúčtovať jednotkové náklady"permission_log_own_costs: "Zaúčtovať vlastné jednotkové náklady"permission_view_cost_entries: "Zobraziť zaúčtované náklady"- permission_view_cost_objects: "Zobraziť rozpočty"+ permission_view_budgets: "Zobraziť rozpočty"permission_view_cost_rates: "Zobraziť nákladové sadzby"permission_view_hourly_rates: "Zobraziť všetky hodinové sadzby"permission_view_own_cost_entries: "Zobraziť zaúčtované vlastné náklady"permission_view_own_hourly_rate: "Zobraziť vlastnú hodinovú sadzbu"permission_view_own_time_entries: "Zobraziť vlastný strávený čas"- project_module_costs_module: "Rozpočty"+ project_module_costs: "Rozpočty"text_assign_time_and_cost_entries_to_project: "Priradiť výkaz hodín a náklady k projektu"- text_cost_object_change_type_confirmation: "Ste si istý? Táto operácia odstráni niektoré informácie o aktuálnom rozpočte."+ text_budget_change_type_confirmation: "Ste si istý? Táto operácia odstráni niektoré informácie o aktuálnom rozpočte."text_destroy_cost_entries_question: "%{cost_entries} boli hlásené na pracovných balíčkoch, ktoré chcete vymazať. Čo chcete robiť?"text_destroy_time_and_cost_entries: "Vymazať ohlásené hodiny a náklady"text_destroy_time_and_cost_entries_question: "%{hours} hodiny, %{cost_entries} boli hlásené na pracovných balíčkoch, ktoré chcete vymazať. Čo chcete robiť?"diff --git a/modules/costs/config/locales/crowdin/sl.yml b/modules/costs/config/locales/crowdin/sl.ymlindex f08895e32d3..1491211e2ad 100644--- a/modules/costs/config/locales/crowdin/sl.yml+++ b/modules/costs/config/locales/crowdin/sl.yml@@ -27,7 +27,7 @@ sl:overridden_costs: "Vsiljeni stroški "spent: "Porabljeno"spent_on: "Datum"- cost_object:+ budget:author: "Avtor"available: "Na voljo"budget: "Načrtovano"@@ -45,7 +45,7 @@ sl:unit_plural: "Pluralizirano ime enote"work_package:costs_by_type: "Porabljene enote"- cost_object_subject: "Naslov proračuna"+ budget_subject: "Naslov proračuna"labor_costs: "Stroški dela"material_costs: "Strošek enote"overall_costs: "Celotni stroški"@@ -55,11 +55,11 @@ sl:rate: "Stopnja"user:default_rates: "Privzeti tečaj"- variable_cost_object:+ budget:labor_budget: "Načrtovani stroški dela"material_budget: "Načrtovani stroški enote"models:- cost_object: "Proračun"+ budget: "Proračun"cost_type:one: "Vrsta stroška"two: "Vrsta stroška"@@ -75,7 +75,7 @@ sl:attributes:budget: "Planirani stroški"comment: "Komentar"- cost_object: "Proračun"+ budget: "Proračun"cost_type: "Vrsta stroška"costs: "Stroški"current_rate: "Trenutni tečaj"@@ -83,7 +83,7 @@ sl:units: "Enote"valid_from: "Veljavno od"button_add_budget_item: "Vnesi planirane stroške"- button_add_cost_object: "Dodaj proračun"+ button_add_budget: "Dodaj proračun"button_add_cost_type: "Dodaj vrsto stroška"button_add_rate: "Vnesi tečaj"button_cancel_edit_budget: "Prekliči urejanje proračuna"@@ -104,10 +104,10 @@ sl:caption_save_rate: "Shrani tečaj"caption_set_rate: "Nastavite trenutni tečaj"caption_show_locked: "Pokaži zaklenjene enote"- cost_objects_title: "Proračun"+ budgets_title: "Proračun"description_date_for_new_rate: "Datum novega tečaja"events:- cost_object: "Proračun urejen"+ budget: "Proračun urejen"group_by_others: "ni v nobeni skupini"help_click_to_edit: "Kliknite tukaj, za urejanje"help_currency_format: "Oblika prikazanih vrednosti valut. %n se nadomesti z vrednostjo valute, %u je zamenjan z enoto valute."@@ -115,10 +115,10 @@ sl:label_between: "med"label_cost_filter_add: "Dodajte filter za vnos stroškov"label_costlog: "Stroški enote dnevnika"- label_cost_object: "Proračun"- label_cost_object_id: "Proračun #%{id}"- label_cost_object_new: "Nov proračun"- label_cost_object_plural: "Proračun"+ label_budget: "Proračun"+ label_budget_id: "Proračun #%{id}"+ label_budget_new: "Nov proračun"+ label_budget_plural: "Proračun"label_cost_plural: "Stroški"label_cost_report: "Poročilo o stroških"label_cost_type_specific: "Proračun #%{id}: %{name}"@@ -135,7 +135,7 @@ sl:label_display_time_entries: "Prikaz prijavljenih ur"label_display_types: "Prikazi vrste"label_edit: "Uredi"- label_fixed_cost_object: "Fiksni proračun"+ label_fixed_budget: "Fiksni proračun"label_fixed_date: "Fiksen datum"label_generic_user: "Generični uporabnik"label_greater_or_equal: ">="@@ -157,17 +157,17 @@ sl:label_user: "Uporabnik"label_until: "do"label_valid_from: "Veljavno od"- label_variable_cost_object: "Proračun na osnovi spremenljive stopnje"- label_view_all_cost_objects: "Oglejte si vse proračune"+ label_budget: "Proračun na osnovi spremenljive stopnje"+ label_view_all_budgets: "Oglejte si vse proračune"label_yes: "Da"- notice_cost_object_conflict: "Delovni paketi morajo biti pd istega projekta."- notice_no_cost_objects_available: "Proračuni niso na voljo."+ notice_budget_conflict: "Delovni paketi morajo biti pd istega projekta."+ notice_no_budgets_available: "Proračuni niso na voljo."notice_something_wrong: "nekaj je šlo narobe. Prosim poskusite ponovno."notice_successful_restore: "Uspešna obnovitev."notice_successful_lock: "Uspešno zaklenjeno."notice_cost_logged_successfully: 'Stroški na enoto so bili uspešno prijavljeni.'permission_edit_cost_entries: "Uredite rezervirane stroške na enoto"- permission_edit_cost_objects: "Uredi proračun"+ permission_edit_budgets: "Uredi proračun"permission_edit_own_cost_entries: "Uredite lastne rezervirane stroške na enoto"permission_edit_hourly_rates: "Urejanje urnih postavk"permission_edit_own_hourly_rate: "uredite lastne urne postavke"@@ -175,15 +175,15 @@ sl:permission_log_costs: "Stroški knjižne enote"permission_log_own_costs: "Stroški knjižne enote zase"permission_view_cost_entries: "Oglejte si rezervirane stroške"- permission_view_cost_objects: "Oglejte si proračune"+ permission_view_budgets: "Oglejte si proračune"permission_view_cost_rates: "Oglejte si stopnje stroškov"permission_view_hourly_rates: "Oglejte si vse urne postavke"permission_view_own_cost_entries: "Oglejte si lastne rezervirane stroške"permission_view_own_hourly_rate: "Oglejte si lastno urno postavko"permission_view_own_time_entries: "Oglejte si svoj porabljen čas"- project_module_costs_module: "Proračun"+ project_module_costs: "Proračun"text_assign_time_and_cost_entries_to_project: "Projektu dodelite prijavljene ure in stroške"- text_cost_object_change_type_confirmation: "Ali si prepričan? Ta operacija bo uničila podatke o določeni vrsti proračuna."+ text_budget_change_type_confirmation: "Ali si prepričan? Ta operacija bo uničila podatke o določeni vrsti proračuna."text_destroy_cost_entries_question: "%{cost_entries} so bili prijavljeni v delovnih paketih, ki jih boste izbrisali. Kaj želiš narediti ?"text_destroy_time_and_cost_entries: "Izbrišite prijavljene ure in stroške"text_destroy_time_and_cost_entries_question: "%{hours} ur , %{cost_entries} so bili prijavljeni v delovnih paketih, ki jih boste izbrisali. Kaj želiš narediti ?"diff --git a/modules/costs/config/locales/crowdin/sv.yml b/modules/costs/config/locales/crowdin/sv.ymlindex 5b549526f40..510b8f50a93 100644--- a/modules/costs/config/locales/crowdin/sv.yml+++ b/modules/costs/config/locales/crowdin/sv.yml@@ -27,7 +27,7 @@ sv:overridden_costs: "Åsidosatta kostnader"spent: "Spenderat"spent_on: "Datum"- cost_object:+ budget:author: "Upphovsman"available: "Tillgängliga"budget: "Planerade"@@ -45,7 +45,7 @@ sv:unit_plural: "Enhetsnamn plural"work_package:costs_by_type: "Bokade enheter"- cost_object_subject: "Budgettitel"+ budget_subject: "Budgettitel"labor_costs: "Personalkostnader"material_costs: "Enhetskostnader"overall_costs: "Totalkostnader"@@ -55,11 +55,11 @@ sv:rate: "Timpris"user:default_rates: "Standardtimpris"- variable_cost_object:+ budget:labor_budget: "Planerade arbetskostnader"material_budget: "Planerade enhetskostnader"models:- cost_object: "Budget"+ budget: "Budget"cost_type:one: "Kostnadstyp"other: "Kostnadstyper"@@ -73,7 +73,7 @@ sv:attributes:budget: "Planerade kostnader"comment: "Kommentar"- cost_object: "Budget"+ budget: "Budget"cost_type: "Kostnadstyp"costs: "Kostnader"current_rate: "Nuvarande timpris"@@ -81,7 +81,7 @@ sv:units: "Enheter"valid_from: "Gäller från"button_add_budget_item: "Lägg till planerade kostnader"- button_add_cost_object: "Lägg till budget"+ button_add_budget: "Lägg till budget"button_add_cost_type: "Lägg till kostnadstyp"button_add_rate: "Lägg till timpris"button_cancel_edit_budget: "Avbryt redigering av budget"@@ -102,10 +102,10 @@ sv:caption_save_rate: "Spara timpris"caption_set_rate: "Ange aktuellt timpris"caption_show_locked: "Visa låst typer"- cost_objects_title: "Budgetar"+ budgets_title: "Budgetar"description_date_for_new_rate: "Datum för nytt timpris"events:- cost_object: "Budget redigerad"+ budget: "Budget redigerad"group_by_others: "inte i någon grupp"help_click_to_edit: "Klicka här för att redigera."help_currency_format: "Format på visade valutavärden. %n ersätts med valutavärdet, %u ersätts med valutaenheten."@@ -113,10 +113,10 @@ sv:label_between: "mellan"label_cost_filter_add: "Lägg till filter för kostnadspost"label_costlog: "Loggade enhetskostnader"- label_cost_object: "Budget"- label_cost_object_id: "Budget #%{id}"- label_cost_object_new: "Ny budget"- label_cost_object_plural: "Budgetar"+ label_budget: "Budget"+ label_budget_id: "Budget #%{id}"+ label_budget_new: "Ny budget"+ label_budget_plural: "Budgetar"label_cost_plural: "Kostnader"label_cost_report: "Kostnadsrapport"label_cost_type_specific: "Budget #%{id}: %{name}"@@ -133,7 +133,7 @@ sv:label_display_time_entries: "Visa rapporterade timmar"label_display_types: "Visa typer"label_edit: "Redigera"- label_fixed_cost_object: "Fast budget"+ label_fixed_budget: "Fast budget"label_fixed_date: "Referensdatum"label_generic_user: "Generisk användare"label_greater_or_equal: ">="@@ -155,17 +155,17 @@ sv:label_user: "Användare"label_until: "fram till"label_valid_from: "Gäller från"- label_variable_cost_object: "Variabla timpriser baserade på budget"- label_view_all_cost_objects: "Visa alla budgetar"+ label_budget: "Variabla timpriser baserade på budget"+ label_view_all_budgets: "Visa alla budgetar"label_yes: "Ja"- notice_cost_object_conflict: "Arbetspaketen måste tillhöra samma projekt."- notice_no_cost_objects_available: "Inga budgetar tillgängliga."+ notice_budget_conflict: "Arbetspaketen måste tillhöra samma projekt."+ notice_no_budgets_available: "Inga budgetar tillgängliga."notice_something_wrong: "Ett fel inträffade. Försök igen."notice_successful_restore: "Lyckad återställning."notice_successful_lock: "Låst framgångsrikt."notice_cost_logged_successfully: 'Enhetskostnaden loggad framgångsrikt.'permission_edit_cost_entries: "Redigera bokade enhetskostnader"- permission_edit_cost_objects: "Redigera budgetar"+ permission_edit_budgets: "Redigera budgetar"permission_edit_own_cost_entries: "Redigera egna bokade enhetskostnader"permission_edit_hourly_rates: "Redigera timpriser"permission_edit_own_hourly_rate: "Redigera egna timpriser"@@ -173,15 +173,15 @@ sv:permission_log_costs: "Boka enhetskostnader"permission_log_own_costs: "Boka enhetskostnader för sig själv"permission_view_cost_entries: "Visa bokade kostnader"- permission_view_cost_objects: "Visa budgetar"+ permission_view_budgets: "Visa budgetar"permission_view_cost_rates: "Visa enhetspriser"permission_view_hourly_rates: "Visa alla timpriser"permission_view_own_cost_entries: "Visa egna bokade kostnader"permission_view_own_hourly_rate: "Visa egna timpriser"permission_view_own_time_entries: "Visa egen spenderad tid"- project_module_costs_module: "Budgetar"+ project_module_costs: "Budgetar"text_assign_time_and_cost_entries_to_project: "Tilldela rapporterade timmar och kostnader till projektet"- text_cost_object_change_type_confirmation: "Är du säker? Denna operation kommer att förstöra information av den specifika budgettypen."+ text_budget_change_type_confirmation: "Är du säker? Denna operation kommer att förstöra information av den specifika budgettypen."text_destroy_cost_entries_question: "%{cost_entries} rapporterades på de arbetspaket som du håller på och tar bort. Vad vill du göra?"text_destroy_time_and_cost_entries: "Ta bort rapporterade timmar och kostnader"text_destroy_time_and_cost_entries_question: "%{hours} timmar, %{cost_entries} rapporterades på de arbetspaket som du håller på att ta bort. Vad vill du göra?"diff --git a/modules/costs/config/locales/crowdin/tr.yml b/modules/costs/config/locales/crowdin/tr.ymlindex 1eaf5130f23..19e7c1062fd 100644--- a/modules/costs/config/locales/crowdin/tr.yml+++ b/modules/costs/config/locales/crowdin/tr.yml@@ -27,7 +27,7 @@ tr:overridden_costs: "Geçersiz kılınmış maliyetler"spent: "Harcanan"spent_on: "Tarih"- cost_object:+ budget:author: "Sahibi"available: "Uygun"budget: "Planlanmış"@@ -45,7 +45,7 @@ tr:unit_plural: "Birden fazla birim adı"work_package:costs_by_type: "Harcanan birimler"- cost_object_subject: "Bütçe adı"+ budget_subject: "Bütçe adı"labor_costs: "İşçilik maliyetleri"material_costs: "Birim maliyeti"overall_costs: "Tüm maliyetler"@@ -55,11 +55,11 @@ tr:rate: "Oran"user:default_rates: "Varsayılan oranlar"- variable_cost_object:+ budget:labor_budget: "Planlanan işçilik maliyetleri"material_budget: "Planlanan birim maliyetleri"models:- cost_object: "Bütçe"+ budget: "Bütçe"cost_type:one: "Maliyet türü"other: "Maliyet türü"@@ -73,7 +73,7 @@ tr:attributes:budget: "Planlanan maliyetler"comment: "Yorum"- cost_object: "Bütçe"+ budget: "Bütçe"cost_type: "Maliyet türü"costs: "Ücretler"current_rate: "Aktüel oran"@@ -81,7 +81,7 @@ tr:units: "Birimler"valid_from: "Geçerlilik"button_add_budget_item: "Planlanan maliyetlere ekle"- button_add_cost_object: "Bütçe ekle"+ button_add_budget: "Bütçe ekle"button_add_cost_type: "Maliyet türü ekle"button_add_rate: "Oran ekle"button_cancel_edit_budget: "Bütçeyi düzenleme iptal et"@@ -102,10 +102,10 @@ tr:caption_save_rate: "Oranı kaydet"caption_set_rate: "Güncel oranı ayarla"caption_show_locked: "Kilitli türleri göster"- cost_objects_title: "Bütçeler"+ budgets_title: "Bütçeler"description_date_for_new_rate: "Yeni oran için tarih"events:- cost_object: "Düzenlenmiş bütçe"+ budget: "Düzenlenmiş bütçe"group_by_others: "herhangi bir grupta değil"help_click_to_edit: "Düzenlemek için buraya tıklayın."help_currency_format: "Görüntülenen para birimi değerlerinin biçimi. % n, para birimi değeri ile değiştirilir,% u ist para birimi yerine geçer.%u%n"@@ -113,10 +113,10 @@ tr:label_between: "arasında"label_cost_filter_add: "Maliyet girişi filtresi ekle"label_costlog: "Günlüğe kaydedilen birim maliyetler"- label_cost_object: "Bütçe"- label_cost_object_id: "Bütçe #%{id}"- label_cost_object_new: "Yeni bütçe"- label_cost_object_plural: "Bütçeler"+ label_budget: "Bütçe"+ label_budget_id: "Bütçe #%{id}"+ label_budget_new: "Yeni bütçe"+ label_budget_plural: "Bütçeler"label_cost_plural: "Ücretler"label_cost_report: "Maliyet raporu"label_cost_type_specific: "Bütçe #% {id}:% {name}%{id}%{name}"@@ -133,7 +133,7 @@ tr:label_display_time_entries: "Raporlanan saatleri göster"label_display_types: "Ekran türleri"label_edit: "Düzenle"- label_fixed_cost_object: "Sabit bütçe"+ label_fixed_budget: "Sabit bütçe"label_fixed_date: "Düzenleme tarihi"label_generic_user: "Genel kullanıcı"label_greater_or_equal: ">="@@ -155,17 +155,17 @@ tr:label_user: "Kullanıcı"label_until: "kadar"label_valid_from: "Geçerlilik"- label_variable_cost_object: "Değişken faizli bütçe"- label_view_all_cost_objects: "Tüm bütçeleri görüntüle"+ label_budget: "Değişken faizli bütçe"+ label_view_all_budgets: "Tüm bütçeleri görüntüle"label_yes: "Evet"- notice_cost_object_conflict: "WorkPackages aynı projede olmalıdır."- notice_no_cost_objects_available: "Hiçbir bütçe yok."+ notice_budget_conflict: "WorkPackages aynı projede olmalıdır."+ notice_no_budgets_available: "Hiçbir bütçe yok."notice_something_wrong: "Bir şeyler yanlış gitti. Lütfen tekrar deneyin."notice_successful_restore: "Başarılı bir geri yükleme."notice_successful_lock: "Başarıyla kilitlendi."notice_cost_logged_successfully: 'Birim maliyet başarıyla kaydedildi.'permission_edit_cost_entries: "Rezervasyon birimi maliyetlerini düzenle"- permission_edit_cost_objects: "Bütçeleri düzenleme"+ permission_edit_budgets: "Bütçeleri düzenleme"permission_edit_own_cost_entries: "Kendi rezervasyonu birim maliyetlerini düzenleme"permission_edit_hourly_rates: "Saatlik oranları düzenleme"permission_edit_own_hourly_rate: "Kendi saatlik ücretleri düzenleme"@@ -173,15 +173,15 @@ tr:permission_log_costs: "Kitap birimi maliyetleri"permission_log_own_costs: "Kendiniz için kitap birimi masrafları"permission_view_cost_entries: "Rezervasyon maliyetlerini görüntüle"- permission_view_cost_objects: "Bütçeleri görüntüle"+ permission_view_budgets: "Bütçeleri görüntüle"permission_view_cost_rates: "Maliyet oranları görüntüleme"permission_view_hourly_rates: "Tüm saatlik oranları görüntüle"permission_view_own_cost_entries: "Kendi rezervasyonu maliyetleri görüntüleyin"permission_view_own_hourly_rate: "Kendi saatlik ücreti görüntüleyin"permission_view_own_time_entries: "Kendi harcanan zamanı görüntüleyin"- project_module_costs_module: "Bütçeler"+ project_module_costs: "Bütçeler"text_assign_time_and_cost_entries_to_project: "Raporlanan saatleri ve maliyetleri projeye tahsis edin"- text_cost_object_change_type_confirmation: "Emin misiniz? Bu işlem, belirli bütçe türünün bilgisini yok edecektir."+ text_budget_change_type_confirmation: "Emin misiniz? Bu işlem, belirli bütçe türünün bilgisini yok edecektir."text_destroy_cost_entries_question: "%{cost_entries} silmek üzere olduğunuz iş paketleri hakkında rapor edildi. Ne yapmak istiyorsun ?"text_destroy_time_and_cost_entries: "Raporlanan saat ve masrafları sil"text_destroy_time_and_cost_entries_question: "% {hours} saat,% {maliyet_entries}, silmek üzere olduğunuz iş paketlerinde bildirildi. Ne yapmak istiyorsun ? %{hours} %{cost_entries}"diff --git a/modules/costs/config/locales/crowdin/uk.yml b/modules/costs/config/locales/crowdin/uk.ymlindex 4bcebba1f46..8fbc441176d 100644--- a/modules/costs/config/locales/crowdin/uk.yml+++ b/modules/costs/config/locales/crowdin/uk.yml@@ -27,7 +27,7 @@ uk:overridden_costs: "Перевищення витрат"spent: "Витрачений"spent_on: "Дата"- cost_object:+ budget:author: "Автор"available: "Доступно"budget: "Планується"@@ -45,7 +45,7 @@ uk:unit_plural: "Назва плуралізованої одиниці"work_package:costs_by_type: "Витрачені одиниці"- cost_object_subject: "Назва бюджету"+ budget_subject: "Назва бюджету"labor_costs: "Витрати на оплату праці"material_costs: "Витрати на одиницю"overall_costs: "Загальні витрати"@@ -55,11 +55,11 @@ uk:rate: "Оцінити"user:default_rates: "Стандартні ставки"- variable_cost_object:+ budget:labor_budget: "Планові витрати праці"material_budget: "Планові витрати на одиницю продукції"models:- cost_object: "Бюджет"+ budget: "Бюджет"cost_type:one: "Тип вартості"few: "Види витрат"@@ -75,7 +75,7 @@ uk:attributes:budget: "Планові витрати"comment: "Коментар"- cost_object: "Бюджет"+ budget: "Бюджет"cost_type: "Тип вартості"costs: "Витрати"current_rate: "Поточний курс"@@ -83,7 +83,7 @@ uk:units: "Одиниці"valid_from: "Діє з"button_add_budget_item: "Додайте планові витрати"- button_add_cost_object: "Додайте бюджет"+ button_add_budget: "Додайте бюджет"button_add_cost_type: "Додати тип витрат"button_add_rate: "Додати ставку"button_cancel_edit_budget: "Скасувати редагування бюджету"@@ -104,10 +104,10 @@ uk:caption_save_rate: "Зберегти ставку"caption_set_rate: "Встановити поточну швидкість"caption_show_locked: "Показати заблоковані типи"- cost_objects_title: "Бюджети"+ budgets_title: "Бюджети"description_date_for_new_rate: "Дата нової ставки"events:- cost_object: "Бюджет відредаговано"+ budget: "Бюджет відредаговано"group_by_others: "ні в якій групі"help_click_to_edit: "Натисніть тут, щоб редагувати."help_currency_format: "Формат відображених валютних значень. %n замінюється на вартість валюти, %u це замінюється грошовою одиницею."@@ -115,10 +115,10 @@ uk:label_between: "між ними"label_cost_filter_add: "Додати фільтр введення витрат"label_costlog: "Записані витрати на одиницю продукції"- label_cost_object: "Бюджет"- label_cost_object_id: "Бюджет #%{id}"- label_cost_object_new: "Новий бюджет"- label_cost_object_plural: "Бюджети"+ label_budget: "Бюджет"+ label_budget_id: "Бюджет #%{id}"+ label_budget_new: "Новий бюджет"+ label_budget_plural: "Бюджети"label_cost_plural: "Витрати"label_cost_report: "Звіт про витрати"label_cost_type_specific: "Бюджет #%{id}: %{name}\n"@@ -135,7 +135,7 @@ uk:label_display_time_entries: "Відображати зареєстровані години"label_display_types: "Типи відображення"label_edit: "Редагувати"- label_fixed_cost_object: "Фіксований бюджет"+ label_fixed_budget: "Фіксований бюджет"label_fixed_date: "Фіксована дата"label_generic_user: "Загальний користувач"label_greater_or_equal: ">="@@ -157,17 +157,17 @@ uk:label_user: "Користувач"label_until: "до"label_valid_from: "Діє з"- label_variable_cost_object: "Бюджет із змінною ставкою"- label_view_all_cost_objects: "Переглянути всі бюджети"+ label_budget: "Бюджет із змінною ставкою"+ label_view_all_budgets: "Переглянути всі бюджети"label_yes: "Так"- notice_cost_object_conflict: "Робочі пакети повинні бути одного проекту."- notice_no_cost_objects_available: "Немає доступних бюджетів."+ notice_budget_conflict: "Робочі пакети повинні бути одного проекту."+ notice_no_budgets_available: "Немає доступних бюджетів."notice_something_wrong: "Щось пішло не так. Будь ласка спробуйте ще раз."notice_successful_restore: "Успішне відновлення."notice_successful_lock: "Успішно заблоковано."notice_cost_logged_successfully: 'Вартість одиниць успішно зареєстрована.'permission_edit_cost_entries: "Відредагувати витрати на одиницю"- permission_edit_cost_objects: "Редагувати бюджети"+ permission_edit_budgets: "Редагувати бюджети"permission_edit_own_cost_entries: "Редагування власних витрат на одиницю"permission_edit_hourly_rates: "Редагування погодинних ставок"permission_edit_own_hourly_rate: "Редагуйте власні погодинні тарифи"@@ -175,15 +175,15 @@ uk:permission_log_costs: "Книжкова одиниця витрат"permission_log_own_costs: "Книга одиничних витрат для себе"permission_view_cost_entries: "Переглянути замовлені витрати"- permission_view_cost_objects: "Переглянути бюджети"+ permission_view_budgets: "Переглянути бюджети"permission_view_cost_rates: "Переглянути тарифи на витрати"permission_view_hourly_rates: "Переглянути всі погодинні тарифи"permission_view_own_cost_entries: "Перегляд власних замовлених витрат"permission_view_own_hourly_rate: "Переглянути власну погодинну ставку"permission_view_own_time_entries: "Переглянути власний витрачений час"- project_module_costs_module: "Бюджети"+ project_module_costs: "Бюджети"text_assign_time_and_cost_entries_to_project: "Призначення повідомлених годин і витрат проекту"- text_cost_object_change_type_confirmation: "Ти впевнений? Ця операція знищить інформацію конкретного типу бюджету."+ text_budget_change_type_confirmation: "Ти впевнений? Ця операція знищить інформацію конкретного типу бюджету."text_destroy_cost_entries_question: "%{cost_entries} повідомлялися про робочі пакети, які ви збираєтеся видалити. Що ти хочеш робити ?"text_destroy_time_and_cost_entries: "Видаліть звітні години та витрати"text_destroy_time_and_cost_entries_question: "%{hours} години, %{cost_entries} повідомлялися про робочі пакети, які ви збираєтеся видалити. Що ти хочеш робити ?"diff --git a/modules/costs/config/locales/crowdin/vi.yml b/modules/costs/config/locales/crowdin/vi.ymlindex 5d06b03b9e7..d4e0d53f370 100644--- a/modules/costs/config/locales/crowdin/vi.yml+++ b/modules/costs/config/locales/crowdin/vi.yml@@ -27,7 +27,7 @@ vi:overridden_costs: "Overridden costs"spent: "Spent"spent_on: "Ngày"- cost_object:+ budget:author: "Tác giả"available: "Available"budget: "Planned"@@ -45,7 +45,7 @@ vi:unit_plural: "Pluralized unit name"work_package:costs_by_type: "Spent units"- cost_object_subject: "Budget title"+ budget_subject: "Budget title"labor_costs: "Labor costs"material_costs: "Unit costs"overall_costs: "Overall costs"@@ -55,11 +55,11 @@ vi:rate: "Rate"user:default_rates: "Default rates"- variable_cost_object:+ budget:labor_budget: "Planned labor costs"material_budget: "Planned unit costs"models:- cost_object: "Budget"+ budget: "Budget"cost_type:other: "Cost types"material_budget_item: "Unit"@@ -72,7 +72,7 @@ vi:attributes:budget: "Planned costs"comment: "Nhận xét"- cost_object: "Budget"+ budget: "Budget"cost_type: "Cost type"costs: "Costs"current_rate: "Current rate"@@ -80,7 +80,7 @@ vi:units: "Units"valid_from: "Valid from"button_add_budget_item: "Add planned costs"- button_add_cost_object: "Add budget"+ button_add_budget: "Add budget"button_add_cost_type: "Add cost type"button_add_rate: "Add rate"button_cancel_edit_budget: "Cancel editing budget"@@ -101,10 +101,10 @@ vi:caption_save_rate: "Save rate"caption_set_rate: "Set current rate"caption_show_locked: "Show locked types"- cost_objects_title: "Budgets"+ budgets_title: "Budgets"description_date_for_new_rate: "Date for new rate"events:- cost_object: "Budget edited"+ budget: "Budget edited"group_by_others: "not in any group"help_click_to_edit: "Click here to edit."help_currency_format: "Format of displayed currency values. %n is replaced with the currency value, %u ist replaced with the currency unit."@@ -112,10 +112,10 @@ vi:label_between: "between"label_cost_filter_add: "Add cost entry filter"label_costlog: "Logged unit costs"- label_cost_object: "Budget"- label_cost_object_id: "Budget #%{id}"- label_cost_object_new: "New budget"- label_cost_object_plural: "Budgets"+ label_budget: "Budget"+ label_budget_id: "Budget #%{id}"+ label_budget_new: "New budget"+ label_budget_plural: "Budgets"label_cost_plural: "Costs"label_cost_report: "Cost report"label_cost_type_specific: "Budget #%{id}: %{name}"@@ -132,7 +132,7 @@ vi:label_display_time_entries: "Display reported hours"label_display_types: "Display types"label_edit: "Chỉnh sửa"- label_fixed_cost_object: "Fixed budget"+ label_fixed_budget: "Fixed budget"label_fixed_date: "Fixed date"label_generic_user: "Generic user"label_greater_or_equal: ">="@@ -154,17 +154,17 @@ vi:label_user: "Người dùng"label_until: "until"label_valid_from: "Valid from"- label_variable_cost_object: "Variable rate based budget"- label_view_all_cost_objects: "View all budgets"+ label_budget: "Variable rate based budget"+ label_view_all_budgets: "View all budgets"label_yes: "Có"- notice_cost_object_conflict: "WorkPackages must be of the same project."- notice_no_cost_objects_available: "No budgets available."+ notice_budget_conflict: "WorkPackages must be of the same project."+ notice_no_budgets_available: "No budgets available."notice_something_wrong: "Something went wrong. Please try again."notice_successful_restore: "Successful restore."notice_successful_lock: "Locked successfully."notice_cost_logged_successfully: 'Unit cost logged successfully.'permission_edit_cost_entries: "Edit booked unit costs"- permission_edit_cost_objects: "Edit budgets"+ permission_edit_budgets: "Edit budgets"permission_edit_own_cost_entries: "Edit own booked unit costs"permission_edit_hourly_rates: "Edit hourly rates"permission_edit_own_hourly_rate: "Edit own hourly rates"@@ -172,15 +172,15 @@ vi:permission_log_costs: "Book unit costs"permission_log_own_costs: "Book unit costs for oneself"permission_view_cost_entries: "View booked costs"- permission_view_cost_objects: "View budgets"+ permission_view_budgets: "View budgets"permission_view_cost_rates: "View cost rates"permission_view_hourly_rates: "View all hourly rates"permission_view_own_cost_entries: "View own booked costs"permission_view_own_hourly_rate: "View own hourly rate"permission_view_own_time_entries: "View own spent time"- project_module_costs_module: "Budgets"+ project_module_costs: "Budgets"text_assign_time_and_cost_entries_to_project: "Assign reported hours and costs to the project"- text_cost_object_change_type_confirmation: "Are you sure? This operation will destroy information of the specific budget type."+ text_budget_change_type_confirmation: "Are you sure? This operation will destroy information of the specific budget type."text_destroy_cost_entries_question: "%{cost_entries} were reported on the work packages you are about to delete. What do you want to do ?"text_destroy_time_and_cost_entries: "Delete reported hours and costs"text_destroy_time_and_cost_entries_question: "%{hours} hours, %{cost_entries} were reported on the work packages you are about to delete. What do you want to do ?"diff --git a/modules/costs/config/locales/crowdin/zh-CN.yml b/modules/costs/config/locales/crowdin/zh-CN.ymlindex 24cb9302f0f..b3cef993827 100644--- a/modules/costs/config/locales/crowdin/zh-CN.yml+++ b/modules/costs/config/locales/crowdin/zh-CN.yml@@ -27,7 +27,7 @@ zh-CN:overridden_costs: "覆盖的成本"spent: "已支出"spent_on: "日期"- cost_object:+ budget:author: "作者"available: "可用"budget: "已计划"@@ -45,7 +45,7 @@ zh-CN:unit_plural: "多元化单位名称"work_package:costs_by_type: "已支出单位成本"- cost_object_subject: "预算标题"+ budget_subject: "预算标题"labor_costs: "劳动力成本"material_costs: "单位成本"overall_costs: "总成本"@@ -55,11 +55,11 @@ zh-CN:rate: "费率"user:default_rates: "基本费率"- variable_cost_object:+ budget:labor_budget: "计划劳动力成本"material_budget: "计划单位成本"models:- cost_object: "预算"+ budget: "预算"cost_type:other: "成本类型"material_budget_item: "单位"@@ -72,7 +72,7 @@ zh-CN:attributes:budget: "计划成本"comment: "评论"- cost_object: "预算"+ budget: "预算"cost_type: "成本类型"costs: "成本"current_rate: "当前利率"@@ -80,7 +80,7 @@ zh-CN:units: "单位"valid_from: "有效起始日期"button_add_budget_item: "添加计划成本"- button_add_cost_object: "添加预算"+ button_add_budget: "添加预算"button_add_cost_type: "添加成本类型"button_add_rate: "添加费率"button_cancel_edit_budget: "取消编辑预算"@@ -101,10 +101,10 @@ zh-CN:caption_save_rate: "保存费率"caption_set_rate: "设置当前费率"caption_show_locked: "显示锁定类型"- cost_objects_title: "预算"+ budgets_title: "预算"description_date_for_new_rate: "新费率的日期"events:- cost_object: "预算已编辑"+ budget: "预算已编辑"group_by_others: "不在任何组中"help_click_to_edit: "单击此处进行编辑。"help_currency_format: "已显示的货币值的格式。%n 替换为货币值,%u 替换为货币单位。"@@ -112,10 +112,10 @@ zh-CN:label_between: "介于"label_cost_filter_add: "添加成本条目筛选器"label_costlog: "已记录的单位成本"- label_cost_object: "预算"- label_cost_object_id: "预算 #%{id}"- label_cost_object_new: "新增预算"- label_cost_object_plural: "预算"+ label_budget: "预算"+ label_budget_id: "预算 #%{id}"+ label_budget_new: "新增预算"+ label_budget_plural: "预算"label_cost_plural: "成本"label_cost_report: "成本报告"label_cost_type_specific: "预算 #%{id}:%{name}"@@ -132,7 +132,7 @@ zh-CN:label_display_time_entries: "显示上报的小时数"label_display_types: "显示类型"label_edit: "编辑"- label_fixed_cost_object: "固定预算"+ label_fixed_budget: "固定预算"label_fixed_date: "固定日期"label_generic_user: "一般用户"label_greater_or_equal: ">="@@ -154,17 +154,17 @@ zh-CN:label_user: "用户"label_until: "到"label_valid_from: "有效起始日期"- label_variable_cost_object: "基于预算的可变费率"- label_view_all_cost_objects: "查看所有预算"+ label_budget: "基于预算的可变费率"+ label_view_all_budgets: "查看所有预算"label_yes: "是"- notice_cost_object_conflict: "工作包必须具有相同的项目。"- notice_no_cost_objects_available: "无可用预算。"+ notice_budget_conflict: "工作包必须具有相同的项目。"+ notice_no_budgets_available: "无可用预算。"notice_something_wrong: "出现错误。请重试。"notice_successful_restore: "成功恢复。"notice_successful_lock: "锁定成功。"notice_cost_logged_successfully: '单位成本记录成功。'permission_edit_cost_entries: "编辑记录的单位成本"- permission_edit_cost_objects: "编辑预算"+ permission_edit_budgets: "编辑预算"permission_edit_own_cost_entries: "编辑自己记录的单位成本"permission_edit_hourly_rates: "编辑小时费率"permission_edit_own_hourly_rate: "编辑自己的小时费率"@@ -172,15 +172,15 @@ zh-CN:permission_log_costs: "记录单位成本"permission_log_own_costs: "为自己记录单位成本"permission_view_cost_entries: "查看记录的成本"- permission_view_cost_objects: "查看预算"+ permission_view_budgets: "查看预算"permission_view_cost_rates: "查看成本率"permission_view_hourly_rates: "查看所有小时费率"permission_view_own_cost_entries: "查看自己记录的成本"permission_view_own_hourly_rate: "查看自己的小时费率"permission_view_own_time_entries: "查看自己的耗时"- project_module_costs_module: "预算"+ project_module_costs: "预算"text_assign_time_and_cost_entries_to_project: "将已上报的小时数和成本提交到项目中"- text_cost_object_change_type_confirmation: "是否确定?此操作将破坏具体预算类型的信息。"+ text_budget_change_type_confirmation: "是否确定?此操作将破坏具体预算类型的信息。"text_destroy_cost_entries_question: "您要删除的工作包已经上报了 %{cost_entries}。您想进行哪种操作?"text_destroy_time_and_cost_entries: "删除上报的小时数和成本"text_destroy_time_and_cost_entries_question: "您要删除的工作包已经上报了 %{hours} 小时的工作量、%{cost_entries} 的成本。您想进行哪种操作?"diff --git a/modules/costs/config/locales/crowdin/zh-TW.yml b/modules/costs/config/locales/crowdin/zh-TW.ymlindex c4f2ecde457..e60a32638e9 100644--- a/modules/costs/config/locales/crowdin/zh-TW.yml+++ b/modules/costs/config/locales/crowdin/zh-TW.yml@@ -27,7 +27,7 @@ zh-TW:overridden_costs: "覆蓋成本"spent: "花費"spent_on: "日期"- cost_object:+ budget:author: "作者"available: "Available"budget: "Planned"@@ -45,7 +45,7 @@ zh-TW:unit_plural: "Pluralized unit name"work_package:costs_by_type: "Spent units"- cost_object_subject: "Budget title"+ budget_subject: "Budget title"labor_costs: "Labor costs"material_costs: "Unit costs"overall_costs: "Overall costs"@@ -55,11 +55,11 @@ zh-TW:rate: "Rate"user:default_rates: "Default rates"- variable_cost_object:+ budget:labor_budget: "Planned labor costs"material_budget: "Planned unit costs"models:- cost_object: "Budget"+ budget: "Budget"cost_type:other: "Cost types"material_budget_item: "Unit"@@ -72,7 +72,7 @@ zh-TW:attributes:budget: "預計花費"comment: "評論"- cost_object: "Budget"+ budget: "Budget"cost_type: "Cost type"costs: "Costs"current_rate: "Current rate"@@ -80,7 +80,7 @@ zh-TW:units: "單位"valid_from: "Valid from"button_add_budget_item: "Add planned costs"- button_add_cost_object: "新增預算"+ button_add_budget: "新增預算"button_add_cost_type: "Add cost type"button_add_rate: "Add rate"button_cancel_edit_budget: "取消編輯預算"@@ -101,10 +101,10 @@ zh-TW:caption_save_rate: "Save rate"caption_set_rate: "Set current rate"caption_show_locked: "Show locked types"- cost_objects_title: "預算"+ budgets_title: "預算"description_date_for_new_rate: "Date for new rate"events:- cost_object: "Budget edited"+ budget: "Budget edited"group_by_others: "not in any group"help_click_to_edit: "點擊這裡編輯"help_currency_format: "Format of displayed currency values. %n is replaced with the currency value, %u ist replaced with the currency unit."@@ -112,10 +112,10 @@ zh-TW:label_between: "介於"label_cost_filter_add: "Add cost entry filter"label_costlog: "Logged unit costs"- label_cost_object: "Budget"- label_cost_object_id: "預算 #%{id}"- label_cost_object_new: "新增預算"- label_cost_object_plural: "預算"+ label_budget: "Budget"+ label_budget_id: "預算 #%{id}"+ label_budget_new: "新增預算"+ label_budget_plural: "預算"label_cost_plural: "Costs"label_cost_report: "成本報告"label_cost_type_specific: "預算 #%{id}:%{name}"@@ -132,7 +132,7 @@ zh-TW:label_display_time_entries: "Display reported hours"label_display_types: "Display types"label_edit: "編輯"- label_fixed_cost_object: "固定預算"+ label_fixed_budget: "固定預算"label_fixed_date: "Fixed date"label_generic_user: "一般使用者"label_greater_or_equal: ">="@@ -154,17 +154,17 @@ zh-TW:label_user: "使用者"label_until: "until"label_valid_from: "Valid from"- label_variable_cost_object: "Variable rate based budget"- label_view_all_cost_objects: "View all budgets"+ label_budget: "Variable rate based budget"+ label_view_all_budgets: "View all budgets"label_yes: "是"- notice_cost_object_conflict: "WorkPackages must be of the same project."- notice_no_cost_objects_available: "No budgets available."+ notice_budget_conflict: "WorkPackages must be of the same project."+ notice_no_budgets_available: "No budgets available."notice_something_wrong: "Something went wrong. Please try again."notice_successful_restore: "Successful restore."notice_successful_lock: "鎖定成功。"notice_cost_logged_successfully: 'Unit cost logged successfully.'permission_edit_cost_entries: "Edit booked unit costs"- permission_edit_cost_objects: "Edit budgets"+ permission_edit_budgets: "Edit budgets"permission_edit_own_cost_entries: "Edit own booked unit costs"permission_edit_hourly_rates: "Edit hourly rates"permission_edit_own_hourly_rate: "Edit own hourly rates"@@ -172,15 +172,15 @@ zh-TW:permission_log_costs: "Book unit costs"permission_log_own_costs: "Book unit costs for oneself"permission_view_cost_entries: "View booked costs"- permission_view_cost_objects: "檢視預算"+ permission_view_budgets: "檢視預算"permission_view_cost_rates: "View cost rates"permission_view_hourly_rates: "View all hourly rates"permission_view_own_cost_entries: "View own booked costs"permission_view_own_hourly_rate: "View own hourly rate"permission_view_own_time_entries: "View own spent time"- project_module_costs_module: "預算"+ project_module_costs: "預算"text_assign_time_and_cost_entries_to_project: "Assign reported hours and costs to the project"- text_cost_object_change_type_confirmation: "Are you sure? This operation will destroy information of the specific budget type."+ text_budget_change_type_confirmation: "Are you sure? This operation will destroy information of the specific budget type."text_destroy_cost_entries_question: "%{cost_entries} were reported on the work packages you are about to delete. What do you want to do ?"text_destroy_time_and_cost_entries: "Delete reported hours and costs"text_destroy_time_and_cost_entries_question: "%{hours} hours, %{cost_entries} were reported on the work packages you are about to delete. What do you want to do ?"diff --git a/modules/costs/config/locales/en.yml b/modules/costs/config/locales/en.ymlindex 0f4edf04dae..27237bdd877 100644--- a/modules/costs/config/locales/en.yml+++ b/modules/costs/config/locales/en.yml@@ -35,25 +35,11 @@ en:overridden_costs: "Overridden costs"spent: "Spent"spent_on: "Date"- cost_object:- author: "Author"- available: "Available"- budget: "Planned"- budget_ratio: "Spent (ratio)"- created_on: "Created on"- description: "Description"- fixed_date: "Fixed date"- spent: "Spent"- status: "Status"- subject: "Subject"- type: "Cost type"- updated_on: "Updated on"cost_type:unit: "Unit name"unit_plural: "Pluralized unit name"work_package:costs_by_type: "Spent units"- cost_object_subject: "Budget title"labor_costs: "Labor costs"material_costs: "Unit costs"overall_costs: "Overall costs"@@ -63,15 +49,10 @@ en:rate: "Rate"user:default_rates: "Default rates"- variable_cost_object:- labor_budget: "Planned labor costs"- material_budget: "Planned unit costs"models:- cost_object: "Budget"cost_type:one: "Cost type"other: "Cost types"- material_budget_item: "Unit"rate: "Rate"errors:models:@@ -79,9 +60,7 @@ en:is_not_a_valid_target_for_cost_entries: "Work package #%{id} is not a valid target for reassigning the cost entries."nullify_is_not_valid_for_cost_entries: "Cost entries can not be assigned to a project."attributes:- budget: "Planned costs"comment: "Comment"- cost_object: "Budget"cost_type: "Cost type"costs: "Costs"current_rate: "Current rate"@@ -89,22 +68,13 @@ en:units: "Units"valid_from: "Valid from"- button_add_budget_item: "Add planned costs"- button_add_cost_object: "Add budget"- button_add_cost_type: "Add cost type"button_add_rate: "Add rate"- button_cancel_edit_budget: "Cancel editing budget"- button_cancel_edit_costs: "Cancel editing costs"button_log_costs: "Log unit costs"- button_log_time: "Log time"caption_booked_on_project: "Booked on project"caption_default: "Default"caption_default_rate_history_for: "Default rate history for %{user}"- caption_labor: "Labor"- caption_labor_costs: "Actual labor costs"caption_locked_on: "Locked on"- caption_material_costs: "Actual unit costs"caption_materials: "Units"caption_rate_history: "Rate history"caption_rate_history_for: "Rate history for %{user}"@@ -112,29 +82,15 @@ en:caption_save_rate: "Save rate"caption_set_rate: "Set current rate"caption_show_locked: "Show locked types"- cost_objects_title: "Budgets"description_date_for_new_rate: "Date for new rate"- events:- cost_object: "Budget edited"-group_by_others: "not in any group"- help_click_to_edit: "Click here to edit."- help_currency_format: "Format of displayed currency values. %n is replaced with the currency value, %u ist replaced with the currency unit."- help_override_rate: "Enter a value here to override the default rate."-label_between: "between"label_cost_filter_add: "Add cost entry filter"label_costlog: "Logged unit costs"- label_cost_object: "Budget"- label_cost_object_id: "Budget #%{id}"- label_cost_object_new: "New budget"- label_cost_object_plural: "Budgets"label_cost_plural: "Costs"- label_cost_report: "Cost report"- label_cost_type_specific: "Budget #%{id}: %{name}"label_cost_type_plural: "Cost types"label_costs_per_page: "Costs per page"label_currency: "Currency"@@ -143,12 +99,10 @@ en:label_date_on: "on"label_deleted_cost_types: "Deleted cost types"label_locked_cost_types: "Locked cost types"- label_deliverable: "Budget"label_display_cost_entries: "Display unit costs"label_display_time_entries: "Display reported hours"label_display_types: "Display types"label_edit: "Edit"- label_fixed_cost_object: "Fixed budget"label_fixed_date: "Fixed date"label_generic_user: "Generic user"label_greater_or_equal: ">="@@ -170,19 +124,14 @@ en:label_user: "User"label_until: "until"label_valid_from: "Valid from"- label_variable_cost_object: "Variable rate based budget"- label_view_all_cost_objects: "View all budgets"label_yes: "Yes"- notice_cost_object_conflict: "WorkPackages must be of the same project."- notice_no_cost_objects_available: "No budgets available."notice_something_wrong: "Something went wrong. Please try again."notice_successful_restore: "Successful restore."notice_successful_lock: "Locked successfully."notice_cost_logged_successfully: 'Unit cost logged successfully.'permission_edit_cost_entries: "Edit booked unit costs"- permission_edit_cost_objects: "Edit budgets"permission_edit_own_cost_entries: "Edit own booked unit costs"permission_edit_hourly_rates: "Edit hourly rates"permission_edit_own_hourly_rate: "Edit own hourly rates"@@ -190,16 +139,15 @@ en:permission_log_costs: "Book unit costs"permission_log_own_costs: "Book unit costs for oneself"permission_view_cost_entries: "View booked costs"- permission_view_cost_objects: "View budgets"permission_view_cost_rates: "View cost rates"permission_view_hourly_rates: "View all hourly rates"permission_view_own_cost_entries: "View own booked costs"permission_view_own_hourly_rate: "View own hourly rate"permission_view_own_time_entries: "View own spent time"- project_module_costs_module: "Budgets"++ project_module_costs: "Time and costs"text_assign_time_and_cost_entries_to_project: "Assign reported hours and costs to the project"- text_cost_object_change_type_confirmation: "Are you sure? This operation will destroy information of the specific budget type."text_destroy_cost_entries_question: "%{cost_entries} were reported on the work packages you are about to delete. What do you want to do ?"text_destroy_time_and_cost_entries: "Delete reported hours and costs"text_destroy_time_and_cost_entries_question: "%{hours} hours, %{cost_entries} were reported on the work packages you are about to delete. What do you want to do ?"diff --git a/modules/costs/config/locales/js-en.yml b/modules/costs/config/locales/js-en.ymlindex ac64c32b60f..f528c50ce1c 100644--- a/modules/costs/config/locales/js-en.yml+++ b/modules/costs/config/locales/js-en.yml@@ -32,7 +32,6 @@ en:property_groups:costs: "Costs"properties:- costObject: "Budget"overallCosts: "Overall costs"spentUnits: "Spent units"button_log_costs: "Log unit costs"diff --git a/modules/costs/config/routes.rb b/modules/costs/config/routes.rbindex 07db631b5f5..bfc21988867 100644--- a/modules/costs/config/routes.rb+++ b/modules/costs/config/routes.rb@@ -30,11 +30,6 @@ OpenProject::Application.routes.draw doscope 'projects/:project_id', as: 'projects' doresources :cost_entries, controller: 'costlog', only: [:new, :create]- resources :cost_objects, only: [:new, :create, :index] do- match :update_labor_budget_item, on: :collection, via: %i[get post]- match :update_material_budget_item, on: :collection, via: %i[get post]- end-resources :hourly_rates, only: [:show, :edit, :update] dopost :set_rate, on: :memberend@@ -46,10 +41,6 @@ OpenProject::Application.routes.draw doresources :cost_entries, controller: 'costlog', only: [:edit, :update, :destroy]- resources :cost_objects, only: [:show, :update, :destroy, :edit] do- get :copy, on: :member- end-resources :cost_types, only: [:index, :new, :edit, :update, :create, :destroy] domember do# TODO: check if this can be replaced with update methoddiff --git a/modules/costs/openproject-costs.gemspec b/modules/costs/costs.gemspecsimilarity index 80%rename from modules/costs/openproject-costs.gemspecrename to modules/costs/costs.gemspecindex 80875a804b5..eeb5ebf9587 100644--- a/modules/costs/openproject-costs.gemspec+++ b/modules/costs/costs.gemspec@@ -1,6 +1,6 @@# Describe your gem and declare its dependencies:Gem::Specification.new do |s|- s.name = 'openproject-costs'+ s.name = 'costs's.version = '1.0.0's.authors = 'OpenProject GmbH's.email = '[email protected]'@@ -10,6 +10,4 @@ Gem::Specification.new do |s|s.files = Dir['{app,config,db,lib,doc}/**/*', 'README.md']s.test_files = Dir['spec/**/*']-- s.add_development_dependency 'factory_girl_rails', '~> 4.0'enddiff --git a/modules/costs/db/migrate/20200807083952_rename_time_and_cost_module.rb b/modules/costs/db/migrate/20200807083952_rename_time_and_cost_module.rbnew file mode 100644index 00000000000..cca945cee60--- /dev/null+++ b/modules/costs/db/migrate/20200807083952_rename_time_and_cost_module.rb@@ -0,0 +1,60 @@+#-- encoding: UTF-8++#-- copyright+# OpenProject is an open source project management software.+# Copyright (C) 2012-2020 the OpenProject GmbH+#+# This program is free software; you can redistribute it and/or+# modify it under the terms of the GNU General Public License version 3.+#+# OpenProject is a fork of ChiliProject, which is a fork of Redmine. The copyright follows:+# Copyright (C) 2006-2017 Jean-Philippe Lang+# Copyright (C) 2010-2013 the ChiliProject Team+#+# This program is free software; you can redistribute it and/or+# modify it under the terms of the GNU General Public License+# as published by the Free Software Foundation; either version 2+# of the License, or (at your option) any later version.+#+# This program is distributed in the hope that it will be useful,+# but WITHOUT ANY WARRANTY; without even the implied warranty of+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the+# GNU General Public License for more details.+#+# You should have received a copy of the GNU General Public License+# along with this program; if not, write to the Free Software+# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.+#+# See docs/COPYRIGHT.rdoc for more details.+#++++require Rails.root.to_s + '/db/migrate/migration_utils/module_renamer'+require Rails.root.to_s + '/db/migrate/migration_utils/setting_renamer'++class RenameTimeAndCostModule < ActiveRecord::Migration[6.0]+ def up+ module_renamer.add_to_enabled('costs', %w[time_tracking costs_module reporting_module])+ module_renamer.remove_from_enabled(%w[time_tracking costs_module reporting_module])+ module_renamer.add_to_default('costs', %w[time_tracking costs_module reporting_module])+ setting_renamer.rename('plugin_costs', 'plugin_costs')+ end++ def down+ # We do not know if all three where actually enabled but having them enabled will keep the functionality+ module_renamer.add_to_enabled('time_tracking', 'costs')+ module_renamer.add_to_enabled('costs_module', 'costs')+ module_renamer.add_to_enabled('reporting_module', 'costs')++ module_renamer.remove_from_enabled('costs')+ module_renamer.add_to_default(%w[costs_module time_tracking reporting_module], 'costs')+ setting_renamer.rename('plugin_costs', 'plugin_costs')+ end++ def module_renamer+ Migration::MigrationUtils::ModuleRenamer+ end++ def setting_renamer+ Migration::MigrationUtils::SettingRenamer+ end+enddiff --git a/modules/costs/doc/CHANGELOG.md b/modules/costs/doc/CHANGELOG.mddeleted file mode 100644index 074e3e552df..00000000000--- a/modules/costs/doc/CHANGELOG.md+++ /dev/null@@ -1,135 +0,0 @@-<!---- copyright-OpenProject Costs Plugin--Copyright (C) 2009 - 2014 the OpenProject Foundation (OPF)--This program is free software; you can redistribute it and/or-modify it under the terms of the GNU General Public License-version 3.--This program is distributed in the hope that it will be useful,-but WITHOUT ANY WARRANTY; without even the implied warranty of-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the-GNU General Public License for more details.--You should have received a copy of the GNU General Public License-along with this program; if not, write to the Free Software-Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.--++-->--# Changelog--## 3.0.8 (new versions scheme)--* `#8230` Missing Translation when deleting Cost Type-* `#8233` Changing the default rate with invalid values-* `#10232` Work package filter introduced by plugins not displayed--## 5.0.4--* `#4024` Fix: Subpages have no unique page titles-* `#5357` Adapt released plugins to base on plugins functionality-* Fix: Edit accesskey for budget-* Adapted setting registration to changes in plugins plugin--## 5.0.3--* `#3440` New workpackage form layout-* `#4024` Subpages have no unique page titles-* `#4123` Add missing translation of save rate button-* `#4112` Layouttabellen: Zwei Layouttabellen erschweren das Verständnis-* `#4797` Fix: [Subdirectory] Broken Links-* Updated to use cost formatter in openproject-xls_export 1.0.0.pre5--## 5.0.2--* Adapted to renaming of core method-* use icons from icon font--## 5.0.1--* `#2259` [Accessibility] linearisation of issue show form (2)-* `#2465` [Costs] Wrong link in ticket overview for budget-* `#3065` [Work package tracking] Internal error when selecting costs in columns and displaying sums-* `#3077` Public Release Costs plugin-* `#3787` [Accessibility] Required fields MUST be displayed as required - new cost type-* `#3862` Deleting fixed date results in internal error--## 5.0.1.pre11--* `#2250` [Accessibility] activity icon labels-* `#2256` [Accessibility] no alt-texts in cost-types index view-* `#2258` [Accessibility] linearisation of issue show form-* removed not needed require of core css files-* firxed cuke--## 5.0.1.pre10--* Adaptations for new icon font-* `#1020` fix XSS when displaying costs-* `#2591` Fix: Costs prevents work package context menu-* `#2759` Fix: [Performance] Activity View very slow-* `#3329` Refactor Duplicated Code Journals-* added icon for new project menu--## 5.0.1.pre9--* Added missing translations--## 5.0.1.pre8--* `#2402` Squash old migrations-* `#2545` Migrated old plugin settings-* `#2570` Work package deletion no longer handles cost entries--## 5.0.1.pre7--* `#2376` Fix incorrect asset location.--## 5.0.1.pre6--* `#2070` Adaptions after changing core asset locations--## 5.0.1.pre5--* `#2050` Migrate to new data model.--## 5.0.1.pre4 - 2013-07-11--* Allows for assigning budgets to work_packages-* Allows for assigning cost entries to work_packages--## 5.0.1.pre3 - 2013-06-21--* Removes csv and atom export for costlog (where non working)-* Add missing translations-* Adapt to OpenProject core changes--## 5.0.1.pre2 - 2013-06-21--* Use final plugin name schema-* Removed reporting related code-* Permission fix--## 5.0.1.pre1 - 2013-05-24--* fixed failing migrations when TimeEntry(s) exists-* removed a lot of reporting-plugin patches-* Translations fixes-* added dependency to OpenProject core >= 3.0.0beta1--## 5.0.1.beta - 2013-05-24--* Fixed API requests for issues#destory-* Added budget icon for activity view-* Fixed budget overview table layout-* Fixed costobject view-* Removed signoff-* Translations fixes-* Enable enter key for the hourly rate forms--## 5.0.0.rc1 - 2013-05-24--* RC1 of the Rails 3 version-* This version is no longer compatible with the Rails 2 corediff --git a/modules/costs/doc/COPYRIGHT.md b/modules/costs/doc/COPYRIGHT.mddeleted file mode 100644index 430fec61e9f..00000000000--- a/modules/costs/doc/COPYRIGHT.md+++ /dev/null@@ -1,18 +0,0 @@-OpenProject Costs Plugin--This Plugin adds features for planning and tracking costs of projects.--Copyright (C) 2009 - 2014 the OpenProject Foundation (OPF)--This program is free software; you can redistribute it and/or-modify it under the terms of the GNU General Public License-version 3.--This program is distributed in the hope that it will be useful,-but WITHOUT ANY WARRANTY; without even the implied warranty of-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the-GNU General Public License for more details.--You should have received a copy of the GNU General Public License-along with this program; if not, write to the Free Software-Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.diff --git a/modules/costs/doc/COPYRIGHT_short.md b/modules/costs/doc/COPYRIGHT_short.mddeleted file mode 100644index 46e8d4808f6..00000000000--- a/modules/costs/doc/COPYRIGHT_short.md+++ /dev/null@@ -1,16 +0,0 @@-OpenProject Costs Plugin--Copyright (C) 2009 - 2014 the OpenProject Foundation (OPF)--This program is free software; you can redistribute it and/or-modify it under the terms of the GNU General Public License-version 3.--This program is distributed in the hope that it will be useful,-but WITHOUT ANY WARRANTY; without even the implied warranty of-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the-GNU General Public License for more details.--You should have received a copy of the GNU General Public License-along with this program; if not, write to the Free Software-Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.diff --git a/modules/costs/doc/GPL.txt b/modules/costs/doc/GPL.txtdeleted file mode 100644index 94a9ed024d3..00000000000--- a/modules/costs/doc/GPL.txt+++ /dev/null@@ -1,674 +0,0 @@- GNU GENERAL PUBLIC LICENSE- Version 3, 29 June 2007-- Copyright (C) 2007 Free Software Foundation, Inc. <http://fsf.org/>- Everyone is permitted to copy and distribute verbatim copies- of this license document, but changing it is not allowed.-- Preamble-- The GNU General Public License is a free, copyleft license for-software and other kinds of works.-- The licenses for most software and other practical works are designed-to take away your freedom to share and change the works. By contrast,-the GNU General Public License is intended to guarantee your freedom to-share and change all versions of a program--to make sure it remains free-software for all its users. We, the Free Software Foundation, use the-GNU General Public License for most of our software; it applies also to-any other work released this way by its authors. You can apply it to-your programs, too.-- When we speak of free software, we are referring to freedom, not-price. Our General Public Licenses are designed to make sure that you-have the freedom to distribute copies of free software (and charge for-them if you wish), that you receive source code or can get it if you-want it, that you can change the software or use pieces of it in new-free programs, and that you know you can do these things.-- To protect your rights, we need to prevent others from denying you-these rights or asking you to surrender the rights. Therefore, you have-certain responsibilities if you distribute copies of the software, or if-you modify it: responsibilities to respect the freedom of others.-- For example, if you distribute copies of such a program, whether-gratis or for a fee, you must pass on to the recipients the same-freedoms that you received. You must make sure that they, too, receive-or can get the source code. And you must show them these terms so they-know their rights.-- Developers that use the GNU GPL protect your rights with two steps:-(1) assert copyright on the software, and (2) offer you this License-giving you legal permission to copy, distribute and/or modify it.-- For the developers' and authors' protection, the GPL clearly explains-that there is no warranty for this free software. For both users' and-authors' sake, the GPL requires that modified versions be marked as-changed, so that their problems will not be attributed erroneously to-authors of previous versions.-- Some devices are designed to deny users access to install or run-modified versions of the software inside them, although the manufacturer-can do so. This is fundamentally incompatible with the aim of-protecting users' freedom to change the software. The systematic-pattern of such abuse occurs in the area of products for individuals to-use, which is precisely where it is most unacceptable. Therefore, we-have designed this version of the GPL to prohibit the practice for those-products. If such problems arise substantially in other domains, we-stand ready to extend this provision to those domains in future versions-of the GPL, as needed to protect the freedom of users.-- Finally, every program is threatened constantly by software patents.-States should not allow patents to restrict development and use of-software on general-purpose computers, but in those that do, we wish to-avoid the special danger that patents applied to a free program could-make it effectively proprietary. To prevent this, the GPL assures that-patents cannot be used to render the program non-free.-- The precise terms and conditions for copying, distribution and-modification follow.-- TERMS AND CONDITIONS-- 0. Definitions.-- "This License" refers to version 3 of the GNU General Public License.-- "Copyright" also means copyright-like laws that apply to other kinds of-works, such as semiconductor masks.-- "The Program" refers to any copyrightable work licensed under this-License. Each licensee is addressed as "you". "Licensees" and-"recipients" may be individuals or organizations.-- To "modify" a work means to copy from or adapt all or part of the work-in a fashion requiring copyright permission, other than the making of an-exact copy. The resulting work is called a "modified version" of the-earlier work or a work "based on" the earlier work.-- A "covered work" means either the unmodified Program or a work based-on the Program.-- To "propagate" a work means to do anything with it that, without-permission, would make you directly or secondarily liable for-infringement under applicable copyright law, except executing it on a-computer or modifying a private copy. Propagation includes copying,-distribution (with or without modification), making available to the-public, and in some countries other activities as well.-- To "convey" a work means any kind of propagation that enables other-parties to make or receive copies. Mere interaction with a user through-a computer network, with no transfer of a copy, is not conveying.-- An interactive user interface displays "Appropriate Legal Notices"-to the extent that it includes a convenient and prominently visible-feature that (1) displays an appropriate copyright notice, and (2)-tells the user that there is no warranty for the work (except to the-extent that warranties are provided), that licensees may convey the-work under this License, and how to view a copy of this License. If-the interface presents a list of user commands or options, such as a-menu, a prominent item in the list meets this criterion.-- 1. Source Code.-- The "source code" for a work means the preferred form of the work-for making modifications to it. "Object code" means any non-source-form of a work.-- A "Standard Interface" means an interface that either is an official-standard defined by a recognized standards body, or, in the case of-interfaces specified for a particular programming language, one that-is widely used among developers working in that language.-- The "System Libraries" of an executable work include anything, other-than the work as a whole, that (a) is included in the normal form of-packaging a Major Component, but which is not part of that Major-Component, and (b) serves only to enable use of the work with that-Major Component, or to implement a Standard Interface for which an-implementation is available to the public in source code form. A-"Major Component", in this context, means a major essential component-(kernel, window system, and so on) of the specific operating system-(if any) on which the executable work runs, or a compiler used to-produce the work, or an object code interpreter used to run it.-- The "Corresponding Source" for a work in object code form means all-the source code needed to generate, install, and (for an executable-work) run the object code and to modify the work, including scripts to-control those activities. However, it does not include the work's-System Libraries, or general-purpose tools or generally available free-programs which are used unmodified in performing those activities but-which are not part of the work. For example, Corresponding Source-includes interface definition files associated with source files for-the work, and the source code for shared libraries and dynamically-linked subprograms that the work is specifically designed to require,-such as by intimate data communication or control flow between those-subprograms and other parts of the work.-- The Corresponding Source need not include anything that users-can regenerate automatically from other parts of the Corresponding-Source.-- The Corresponding Source for a work in source code form is that-same work.-- 2. Basic Permissions.-- All rights granted under this License are granted for the term of-copyright on the Program, and are irrevocable provided the stated-conditions are met. This License explicitly affirms your unlimited-permission to run the unmodified Program. The output from running a-covered work is covered by this License only if the output, given its-content, constitutes a covered work. This License acknowledges your-rights of fair use or other equivalent, as provided by copyright law.-- You may make, run and propagate covered works that you do not-convey, without conditions so long as your license otherwise remains-in force. You may convey covered works to others for the sole purpose-of having them make modifications exclusively for you, or provide you-with facilities for running those works, provided that you comply with-the terms of this License in conveying all material for which you do-not control copyright. Those thus making or running the covered works-for you must do so exclusively on your behalf, under your direction-and control, on terms that prohibit them from making any copies of-your copyrighted material outside their relationship with you.-- Conveying under any other circumstances is permitted solely under-the conditions stated below. Sublicensing is not allowed; section 10-makes it unnecessary.-- 3. Protecting Users' Legal Rights From Anti-Circumvention Law.-- No covered work shall be deemed part of an effective technological-measure under any applicable law fulfilling obligations under article-11 of the WIPO copyright treaty adopted on 20 December 1996, or-similar laws prohibiting or restricting circumvention of such-measures.-- When you convey a covered work, you waive any legal power to forbid-circumvention of technological measures to the extent such circumvention-is effected by exercising rights under this License with respect to-the covered work, and you disclaim any intention to limit operation or-modification of the work as a means of enforcing, against the work's-users, your or third parties' legal rights to forbid circumvention of-technological measures.-- 4. Conveying Verbatim Copies.-- You may convey verbatim copies of the Program's source code as you-receive it, in any medium, provided that you conspicuously and-appropriately publish on each copy an appropriate copyright notice;-keep intact all notices stating that this License and any-non-permissive terms added in accord with section 7 apply to the code;-keep intact all notices of the absence of any warranty; and give all-recipients a copy of this License along with the Program.-- You may charge any price or no price for each copy that you convey,-and you may offer support or warranty protection for a fee.-- 5. Conveying Modified Source Versions.-- You may convey a work based on the Program, or the modifications to-produce it from the Program, in the form of source code under the-terms of section 4, provided that you also meet all of these conditions:-- a) The work must carry prominent notices stating that you modified- it, and giving a relevant date.-- b) The work must carry prominent notices stating that it is- released under this License and any conditions added under section- 7. This requirement modifies the requirement in section 4 to- "keep intact all notices".-- c) You must license the entire work, as a whole, under this- License to anyone who comes into possession of a copy. This- License will therefore apply, along with any applicable section 7- additional terms, to the whole of the work, and all its parts,- regardless of how they are packaged. This License gives no- permission to license the work in any other way, but it does not- invalidate such permission if you have separately received it.-- d) If the work has interactive user interfaces, each must display- Appropriate Legal Notices; however, if the Program has interactive- interfaces that do not display Appropriate Legal Notices, your- work need not make them do so.-- A compilation of a covered work with other separate and independent-works, which are not by their nature extensions of the covered work,-and which are not combined with it such as to form a larger program,-in or on a volume of a storage or distribution medium, is called an-"aggregate" if the compilation and its resulting copyright are not-used to limit the access or legal rights of the compilation's users-beyond what the individual works permit. Inclusion of a covered work-in an aggregate does not cause this License to apply to the other-parts of the aggregate.-- 6. Conveying Non-Source Forms.-- You may convey a covered work in object code form under the terms-of sections 4 and 5, provided that you also convey the-machine-readable Corresponding Source under the terms of this License,-in one of these ways:-- a) Convey the object code in, or embodied in, a physical product- (including a physical distribution medium), accompanied by the- Corresponding Source fixed on a durable physical medium- customarily used for software interchange.-- b) Convey the object code in, or embodied in, a physical product- (including a physical distribution medium), accompanied by a- written offer, valid for at least three years and valid for as- long as you offer spare parts or customer support for that product- model, to give anyone who possesses the object code either (1) a- copy of the Corresponding Source for all the software in the- product that is covered by this License, on a durable physical- medium customarily used for software interchange, for a price no- more than your reasonable cost of physically performing this- conveying of source, or (2) access to copy the- Corresponding Source from a network server at no charge.-- c) Convey individual copies of the object code with a copy of the- written offer to provide the Corresponding Source. This- alternative is allowed only occasionally and noncommercially, and- only if you received the object code with such an offer, in accord- with subsection 6b.-- d) Convey the object code by offering access from a designated- place (gratis or for a charge), and offer equivalent access to the- Corresponding Source in the same way through the same place at no- further charge. You need not require recipients to copy the- Corresponding Source along with the object code. If the place to- copy the object code is a network server, the Corresponding Source- may be on a different server (operated by you or a third party)- that supports equivalent copying facilities, provided you maintain- clear directions next to the object code saying where to find the- Corresponding Source. Regardless of what server hosts the- Corresponding Source, you remain obligated to ensure that it is- available for as long as needed to satisfy these requirements.-- e) Convey the object code using peer-to-peer transmission, provided- you inform other peers where the object code and Corresponding- Source of the work are being offered to the general public at no- charge under subsection 6d.-- A separable portion of the object code, whose source code is excluded-from the Corresponding Source as a System Library, need not be-included in conveying the object code work.-- A "User Product" is either (1) a "consumer product", which means any-tangible personal property which is normally used for personal, family,-or household purposes, or (2) anything designed or sold for incorporation-into a dwelling. In determining whether a product is a consumer product,-doubtful cases shall be resolved in favor of coverage. For a particular-product received by a particular user, "normally used" refers to a-typical or common use of that class of product, regardless of the status-of the particular user or of the way in which the particular user-actually uses, or expects or is expected to use, the product. A product-is a consumer product regardless of whether the product has substantial-commercial, industrial or non-consumer uses, unless such uses represent-the only significant mode of use of the product.-- "Installation Information" for a User Product means any methods,-procedures, authorization keys, or other information required to install-and execute modified versions of a covered work in that User Product from-a modified version of its Corresponding Source. The information must-suffice to ensure that the continued functioning of the modified object-code is in no case prevented or interfered with solely because-modification has been made.-- If you convey an object code work under this section in, or with, or-specifically for use in, a User Product, and the conveying occurs as-part of a transaction in which the right of possession and use of the-User Product is transferred to the recipient in perpetuity or for a-fixed term (regardless of how the transaction is characterized), the-Corresponding Source conveyed under this section must be accompanied-by the Installation Information. But this requirement does not apply-if neither you nor any third party retains the ability to install-modified object code on the User Product (for example, the work has-been installed in ROM).-- The requirement to provide Installation Information does not include a-requirement to continue to provide support service, warranty, or updates-for a work that has been modified or installed by the recipient, or for-the User Product in which it has been modified or installed. Access to a-network may be denied when the modification itself materially and-adversely affects the operation of the network or violates the rules and-protocols for communication across the network.-- Corresponding Source conveyed, and Installation Information provided,-in accord with this section must be in a format that is publicly-documented (and with an implementation available to the public in-source code form), and must require no special password or key for-unpacking, reading or copying.-- 7. Additional Terms.-- "Additional permissions" are terms that supplement the terms of this-License by making exceptions from one or more of its conditions.-Additional permissions that are applicable to the entire Program shall-be treated as though they were included in this License, to the extent-that they are valid under applicable law. If additional permissions-apply only to part of the Program, that part may be used separately-under those permissions, but the entire Program remains governed by-this License without regard to the additional permissions.-- When you convey a copy of a covered work, you may at your option-remove any additional permissions from that copy, or from any part of-it. (Additional permissions may be written to require their own-removal in certain cases when you modify the work.) You may place-additional permissions on material, added by you to a covered work,-for which you have or can give appropriate copyright permission.-- Notwithstanding any other provision of this License, for material you-add to a covered work, you may (if authorized by the copyright holders of-that material) supplement the terms of this License with terms:-- a) Disclaiming warranty or limiting liability differently from the- terms of sections 15 and 16 of this License; or-- b) Requiring preservation of specified reasonable legal notices or- author attributions in that material or in the Appropriate Legal- Notices displayed by works containing it; or-- c) Prohibiting misrepresentation of the origin of that material, or- requiring that modified versions of such material be marked in- reasonable ways as different from the original version; or-- d) Limiting the use for publicity purposes of names of licensors or- authors of the material; or-- e) Declining to grant rights under trademark law for use of some- trade names, trademarks, or service marks; or-- f) Requiring indemnification of licensors and authors of that- material by anyone who conveys the material (or modified versions of- it) with contractual assumptions of liability to the recipient, for- any liability that these contractual assumptions directly impose on- those licensors and authors.-- All other non-permissive additional terms are considered "further-restrictions" within the meaning of section 10. If the Program as you-received it, or any part of it, contains a notice stating that it is-governed by this License along with a term that is a further-restriction, you may remove that term. If a license document contains-a further restriction but permits relicensing or conveying under this-License, you may add to a covered work material governed by the terms-of that license document, provided that the further restriction does-not survive such relicensing or conveying.-- If you add terms to a covered work in accord with this section, you-must place, in the relevant source files, a statement of the-additional terms that apply to those files, or a notice indicating-where to find the applicable terms.-- Additional terms, permissive or non-permissive, may be stated in the-form of a separately written license, or stated as exceptions;-the above requirements apply either way.-- 8. Termination.-- You may not propagate or modify a covered work except as expressly-provided under this License. Any attempt otherwise to propagate or-modify it is void, and will automatically terminate your rights under-this License (including any patent licenses granted under the third-paragraph of section 11).-- However, if you cease all violation of this License, then your-license from a particular copyright holder is reinstated (a)-provisionally, unless and until the copyright holder explicitly and-finally terminates your license, and (b) permanently, if the copyright-holder fails to notify you of the violation by some reasonable means-prior to 60 days after the cessation.-- Moreover, your license from a particular copyright holder is-reinstated permanently if the copyright holder notifies you of the-violation by some reasonable means, this is the first time you have-received notice of violation of this License (for any work) from that-copyright holder, and you cure the violation prior to 30 days after-your receipt of the notice.-- Termination of your rights under this section does not terminate the-licenses of parties who have received copies or rights from you under-this License. If your rights have been terminated and not permanently-reinstated, you do not qualify to receive new licenses for the same-material under section 10.-- 9. Acceptance Not Required for Having Copies.-- You are not required to accept this License in order to receive or-run a copy of the Program. Ancillary propagation of a covered work-occurring solely as a consequence of using peer-to-peer transmission-to receive a copy likewise does not require acceptance. However,-nothing other than this License grants you permission to propagate or-modify any covered work. These actions infringe copyright if you do-not accept this License. Therefore, by modifying or propagating a-covered work, you indicate your acceptance of this License to do so.-- 10. Automatic Licensing of Downstream Recipients.-- Each time you convey a covered work, the recipient automatically-receives a license from the original licensors, to run, modify and-propagate that work, subject to this License. You are not responsible-for enforcing compliance by third parties with this License.-- An "entity transaction" is a transaction transferring control of an-organization, or substantially all assets of one, or subdividing an-organization, or merging organizations. If propagation of a covered-work results from an entity transaction, each party to that-transaction who receives a copy of the work also receives whatever-licenses to the work the party's predecessor in interest had or could-give under the previous paragraph, plus a right to possession of the-Corresponding Source of the work from the predecessor in interest, if-the predecessor has it or can get it with reasonable efforts.-- You may not impose any further restrictions on the exercise of the-rights granted or affirmed under this License. For example, you may-not impose a license fee, royalty, or other charge for exercise of-rights granted under this License, and you may not initiate litigation-(including a cross-claim or counterclaim in a lawsuit) alleging that-any patent claim is infringed by making, using, selling, offering for-sale, or importing the Program or any portion of it.-- 11. Patents.-- A "contributor" is a copyright holder who authorizes use under this-License of the Program or a work on which the Program is based. The-work thus licensed is called the contributor's "contributor version".-- A contributor's "essential patent claims" are all patent claims-owned or controlled by the contributor, whether already acquired or-hereafter acquired, that would be infringed by some manner, permitted-by this License, of making, using, or selling its contributor version,-but do not include claims that would be infringed only as a-consequence of further modification of the contributor version. For-purposes of this definition, "control" includes the right to grant-patent sublicenses in a manner consistent with the requirements of-this License.-- Each contributor grants you a non-exclusive, worldwide, royalty-free-patent license under the contributor's essential patent claims, to-make, use, sell, offer for sale, import and otherwise run, modify and-propagate the contents of its contributor version.-- In the following three paragraphs, a "patent license" is any express-agreement or commitment, however denominated, not to enforce a patent-(such as an express permission to practice a patent or covenant not to-sue for patent infringement). To "grant" such a patent license to a-party means to make such an agreement or commitment not to enforce a-patent against the party.-- If you convey a covered work, knowingly relying on a patent license,-and the Corresponding Source of the work is not available for anyone-to copy, free of charge and under the terms of this License, through a-publicly available network server or other readily accessible means,-then you must either (1) cause the Corresponding Source to be so-available, or (2) arrange to deprive yourself of the benefit of the-patent license for this particular work, or (3) arrange, in a manner-consistent with the requirements of this License, to extend the patent-license to downstream recipients. "Knowingly relying" means you have-actual knowledge that, but for the patent license, your conveying the-covered work in a country, or your recipient's use of the covered work-in a country, would infringe one or more identifiable patents in that-country that you have reason to believe are valid.-- If, pursuant to or in connection with a single transaction or-arrangement, you convey, or propagate by procuring conveyance of, a-covered work, and grant a patent license to some of the parties-receiving the covered work authorizing them to use, propagate, modify-or convey a specific copy of the covered work, then the patent license-you grant is automatically extended to all recipients of the covered-work and works based on it.-- A patent license is "discriminatory" if it does not include within-the scope of its coverage, prohibits the exercise of, or is-conditioned on the non-exercise of one or more of the rights that are-specifically granted under this License. You may not convey a covered-work if you are a party to an arrangement with a third party that is-in the business of distributing software, under which you make payment-to the third party based on the extent of your activity of conveying-the work, and under which the third party grants, to any of the-parties who would receive the covered work from you, a discriminatory-patent license (a) in connection with copies of the covered work-conveyed by you (or copies made from those copies), or (b) primarily-for and in connection with specific products or compilations that-contain the covered work, unless you entered into that arrangement,-or that patent license was granted, prior to 28 March 2007.-- Nothing in this License shall be construed as excluding or limiting-any implied license or other defenses to infringement that may-otherwise be available to you under applicable patent law.-- 12. No Surrender of Others' Freedom.-- If conditions are imposed on you (whether by court order, agreement or-otherwise) that contradict the conditions of this License, they do not-excuse you from the conditions of this License. If you cannot convey a-covered work so as to satisfy simultaneously your obligations under this-License and any other pertinent obligations, then as a consequence you may-not convey it at all. For example, if you agree to terms that obligate you-to collect a royalty for further conveying from those to whom you convey-the Program, the only way you could satisfy both those terms and this-License would be to refrain entirely from conveying the Program.-- 13. Use with the GNU Affero General Public License.-- Notwithstanding any other provision of this License, you have-permission to link or combine any covered work with a work licensed-under version 3 of the GNU Affero General Public License into a single-combined work, and to convey the resulting work. The terms of this-License will continue to apply to the part which is the covered work,-but the special requirements of the GNU Affero General Public License,-section 13, concerning interaction through a network will apply to the-combination as such.-- 14. Revised Versions of this License.-- The Free Software Foundation may publish revised and/or new versions of-the GNU General Public License from time to time. Such new versions will-be similar in spirit to the present version, but may differ in detail to-address new problems or concerns.-- Each version is given a distinguishing version number. If the-Program specifies that a certain numbered version of the GNU General-Public License "or any later version" applies to it, you have the-option of following the terms and conditions either of that numbered-version or of any later version published by the Free Software-Foundation. If the Program does not specify a version number of the-GNU General Public License, you may choose any version ever published-by the Free Software Foundation.-- If the Program specifies that a proxy can decide which future-versions of the GNU General Public License can be used, that proxy's-public statement of acceptance of a version permanently authorizes you-to choose that version for the Program.-- Later license versions may give you additional or different-permissions. However, no additional obligations are imposed on any-author or copyright holder as a result of your choosing to follow a-later version.-- 15. Disclaimer of Warranty.-- THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY-APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT-HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY-OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO,-THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR-PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM-IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF-ALL NECESSARY SERVICING, REPAIR OR CORRECTION.-- 16. Limitation of Liability.-- IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING-WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS-THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY-GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE-USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF-DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD-PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS),-EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF-SUCH DAMAGES.-- 17. Interpretation of Sections 15 and 16.-- If the disclaimer of warranty and limitation of liability provided-above cannot be given local legal effect according to their terms,-reviewing courts shall apply local law that most closely approximates-an absolute waiver of all civil liability in connection with the-Program, unless a warranty or assumption of liability accompanies a-copy of the Program in return for a fee.-- END OF TERMS AND CONDITIONS-- How to Apply These Terms to Your New Programs-- If you develop a new program, and you want it to be of the greatest-possible use to the public, the best way to achieve this is to make it-free software which everyone can redistribute and change under these terms.-- To do so, attach the following notices to the program. It is safest-to attach them to the start of each source file to most effectively-state the exclusion of warranty; and each file should have at least-the "copyright" line and a pointer to where the full notice is found.-- <one line to give the program's name and a brief idea of what it does.>- Copyright (C) <year> <name of author>-- This program is free software: you can redistribute it and/or modify- it under the terms of the GNU General Public License as published by- the Free Software Foundation, either version 3 of the License, or- (at your option) any later version.-- This program is distributed in the hope that it will be useful,- but WITHOUT ANY WARRANTY; without even the implied warranty of- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the- GNU General Public License for more details.-- You should have received a copy of the GNU General Public License- along with this program. If not, see <http://www.gnu.org/licenses/>.--Also add information on how to contact you by electronic and paper mail.-- If the program does terminal interaction, make it output a short-notice like this when it starts in an interactive mode:-- <program> Copyright (C) <year> <name of author>- This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'.- This is free software, and you are welcome to redistribute it- under certain conditions; type `show c' for details.--The hypothetical commands `show w' and `show c' should show the appropriate-parts of the General Public License. Of course, your program's commands-might be different; for a GUI interface, you would use an "about box".-- You should also get your employer (if you work as a programmer) or school,-if any, to sign a "copyright disclaimer" for the program, if necessary.-For more information on this, and how to apply and follow the GNU GPL, see-<http://www.gnu.org/licenses/>.-- The GNU General Public License does not permit incorporating your program-into proprietary programs. If your program is a subroutine library, you-may consider it more useful to permit linking proprietary applications with-the library. If this is what you want to do, use the GNU Lesser General-Public License instead of this License. But first, please read-<http://www.gnu.org/philosophy/why-not-lgpl.html>.diff --git a/modules/costs/doc/apiv3.apib b/modules/costs/doc/apiv3.apibindex a44237c207d..c779bbf70fa 100644--- a/modules/costs/doc/apiv3.apib+++ b/modules/costs/doc/apiv3.apib@@ -8,152 +8,6 @@ introduce to the core OpenProject API.Unless otherwise stated it will only add endpoints and properties, but not remove anything that isalready present in the core API.-# Group Budgets--## Linked Properties:-| Link | Description | Type | Constraints | Supported operations |-|:---------:|-------------------------------------------- | ------------- | --------------------- | -------------------- |-| self | This budget | Budget | not null | READ |--## Properties-| Property | Description | Type | Constraints | Supported operations | Condition |-| :---------: | ------------------------------------------- | ----------- | ----------- | -------------------- | --------------------------- |-| id | Budget id | Integer | x > 0 | READ | |-| subject | Budget name | String | not empty | READ | |--*Note: Further properties of budgets might be added at a future date, however they will require the view budget permission to be displayed.*--## Budget [/api/v3/budgets/{id}]--+ Model- + Body-- {- "_type" : "Budget",- "_links" : {- "self" : {- "href" : "/api/v3/budgets/1",- "title" : "Q3 2015"- }- },- "id" : 1,- "subject" : "Q3 2015"- }---## view Budget [GET]--+ Parameters- + id (required, integer, `1`) ... Budget id--+ Response 200 (application/hal+json)-- [Budget][]--+ Response 403 (application/hal+json)-- Returned if the client does not have sufficient permissions.-- **Required permission:** view work packages **or** view budgets (on the budgets project)-- + Body-- {- "_type": "Error",- "errorIdentifier": "urn:openproject-org:api:v3:errors:MissingPermission",- "message": "You are not allowed to see this budget."- }--## Budgets by Project [/api/v3/projects/{id}/budgets]--+ Model- + Body-- {- "_links" : {- "self" : {- "href" : "/api/v3/projects/1/budgets"- }- },- "_type" : "Collection",- "total" : 2,- "count" : 2,- "_embedded" : {- "elements" : [- {- "_type" : "Budget",- "_links" : {- "self" : {- "href" : "/api/v3/budgets/1",- "title" : "Q3 2015"- }- },- "id" : 1,- "subject" : "Q3 2015"- },- {- "_type" : "Budget",- "_links" : {- "self" : {- "href" : "/api/v3/budgets/2",- "title" : "Q4 2015"- }- },- "id" : 2,- "subject" : "Q4 2015"- }- ]- }- }---## view Budgets of a Project [GET]--+ Parameters- + id (required, integer, `1`) ... Project id--+ Response 200 (application/hal+json)-- [Budgets by Project][]--+ Response 403 (application/hal+json)-- Returned if the client does not have sufficient permissions to see the budgets of the given- project.-- **Required permission:** view work packages **or** view budgets-- *Note that you will only receive this error, if you are at least allowed to see the corresponding project.*-- + Body-- {- "_type": "Error",- "errorIdentifier": "urn:openproject-org:api:v3:errors:MissingPermission",- "message": "You are not allowed to see the budgets of this project."- }--+ Response 404 (application/hal+json)-- Returned if either:-- * the project does not exist- * the client does not have sufficient permissions to see the project- * the costs module is not enabled on the given project-- **Required permission:** view project-- *Note: A client without sufficient permissions shall not be able to test for the existence of a project.- That's why a 404 is returned here, even if a 403 might be more appropriate.*-- + Body-- {- "_type": "Error",- "errorIdentifier": "urn:openproject-org:api:v3:errors:NotFound",- "message": "The specified project does not exist."- }-# Group Cost Entries## Linked Properties:@@ -471,7 +325,6 @@ If the costs module is not available on a given work package, there will be no a## Linked Properties:| Link | Description | Type | Constraints | Supported operations ||:-----------:|-------------------------------------------- | --------------------------------- | --------------------- | -------------------- |-| costObject | The budget associated to this work package | Budget | | READ / WRITE || costsByType | List of accumulated costs per cost type | Collection of AggregatedCostEntry | | READ / WRITE |## Properties:diff --git a/modules/costs/frontend/module/augment/cost-budget-subform.augment.service.ts b/modules/costs/frontend/module/augment/cost-budget-subform.augment.service.tsindex 895fc35a8ab..9935951dfc9 100644--- a/modules/costs/frontend/module/augment/cost-budget-subform.augment.service.ts+++ b/modules/costs/frontend/module/augment/cost-budget-subform.augment.service.ts@@ -108,7 +108,7 @@ export class CostBudgetSubformAugmentService {private buildRefreshRequest(row:JQuery, row_identifier:string) {let request:any = {element_id: row_identifier,- fixed_date: jQuery('#cost_object_fixed_date').val()+ fixed_date: jQuery('#budget_fixed_date').val()};// Augment common values with specific values for this typediff --git a/modules/costs/frontend/module/main.ts b/modules/costs/frontend/module/main.tsindex 129686c73d5..862d7155419 100644--- a/modules/costs/frontend/module/main.ts+++ b/modules/costs/frontend/module/main.ts@@ -28,30 +28,19 @@ import {Injector, NgModule} from '@angular/core';import {OpenProjectPluginContext} from 'core-app/modules/plugins/plugin-context';import {CostsByTypeDisplayField} from './wp-display/costs-by-type-display-field.module';import {CurrencyDisplayField} from './wp-display/currency-display-field.module';-import {BudgetResource} from './hal/resources/budget-resource';-import {multiInput} from 'reactivestates';-import {CostSubformAugmentService} from "./augment/cost-subform.augment.service";-import {PlannedCostsFormAugment} from "core-app/modules/plugins/linked/openproject-costs/augment/planned-costs-form";-import {CostBudgetSubformAugmentService} from "core-app/modules/plugins/linked/openproject-costs/augment/cost-budget-subform.augment.service";export function initializeCostsPlugin(injector:Injector) {window.OpenProject.getPluginContext().then((pluginContext:OpenProjectPluginContext) => {- pluginContext.services.editField.extendFieldType('select', ['Budget']);-let displayFieldService = pluginContext.services.displayField;- displayFieldService.extendFieldType('resource', ['Budget']);displayFieldService.addFieldType(CostsByTypeDisplayField, 'costs', ['costsByType']);displayFieldService.addFieldType(CurrencyDisplayField, 'currency', ['laborCosts', 'materialCosts', 'overallCosts']);- let halResourceService = pluginContext.services.halResource;- halResourceService.registerResource('Budget', {cls: BudgetResource});-pluginContext.hooks.workPackageSingleContextMenu(function (params:any) {return {key: 'log_costs',icon: 'icon-projects',indexBy: function (actions:any) {- var index = _.findIndex(actions, {key: 'log_time'});+ let index = _.findIndex(actions, {key: 'log_time'});return index !== -1 ? index + 1 : actions.length;},resource: 'workPackage',@@ -65,29 +54,18 @@ export function initializeCostsPlugin(injector:Injector) {icon: 'icon-projects',link: 'logCosts',indexBy: function (actions:any) {- var index = _.findIndex(actions, {link: 'logTime'});+ let index = _.findIndex(actions, {link: 'logTime'});return index !== -1 ? index + 1 : actions.length;},text: I18n.t('js.button_log_costs'),};});-- let states = pluginContext.services.states;- states.add('budgets', multiInput<BudgetResource>());-- // Augment previous cost-subforms- new CostSubformAugmentService();- PlannedCostsFormAugment.listen();-- const budgetSubform = injector.get(CostBudgetSubformAugmentService);- budgetSubform.listen();});}@NgModule({providers: [- CostBudgetSubformAugmentService,],})export class PluginModule {diff --git a/modules/costs/frontend/module/wp-display/costs-by-type-display-field.module.ts b/modules/costs/frontend/module/wp-display/costs-by-type-display-field.module.tsindex 135b152803a..289207b4f5e 100644--- a/modules/costs/frontend/module/wp-display/costs-by-type-display-field.module.ts+++ b/modules/costs/frontend/module/wp-display/costs-by-type-display-field.module.ts@@ -36,6 +36,7 @@ interface ICostsByType {costObjectId:string;costType:{name:string;+ id:string;};staticPath:{href:string;@@ -100,7 +101,7 @@ export class CostsByTypeDisplayField extends DisplayField {const showCosts = this.resource.showCosts;const link = document.createElement('a') as HTMLAnchorElement;- link.href = showCosts.href + '?cost_type_id=' + val.costObjectId;+ link.href = showCosts.href + '&unit=' + val.costType.id;link.setAttribute('target', '_blank');link.textContent = val.spentUnits + ' ' + val.costType.name;element.appendChild(link);@@ -114,7 +115,7 @@ export class CostsByTypeDisplayField extends DisplayField {private renderCostAsText(val:ICostsByType, element:HTMLElement, i:number) {const span = document.createElement('span');span.textContent = val.spentUnits + ' ' + val.costType.name;-+ element.appendChild(span);this.addSeparator(element, i);}diff --git a/modules/costs/lib/api/v3/cost_entries/aggregated_cost_entry_representer.rb b/modules/costs/lib/api/v3/cost_entries/aggregated_cost_entry_representer.rbindex f0a5fb2c4b2..2a53920795f 100644--- a/modules/costs/lib/api/v3/cost_entries/aggregated_cost_entry_representer.rb+++ b/modules/costs/lib/api/v3/cost_entries/aggregated_cost_entry_representer.rb@@ -53,7 +53,7 @@ module API},setter: ->(*) {}- property :cost_object_id,+ property :budget_id,exec_context: :decorator,getter: ->(*) {@cost_type.id@@ -65,7 +65,7 @@ module APIlink :staticPath do{- href: cost_object_path(@cost_type.id)+ href: budget_path(@cost_type.id)}enddiff --git a/modules/costs/lib/api/v3/cost_entries/cost_entries_by_work_package_api.rb b/modules/costs/lib/api/v3/cost_entries/cost_entries_by_work_package_api.rbindex 3998b75b946..042f6299183 100644--- a/modules/costs/lib/api/v3/cost_entries/cost_entries_by_work_package_api.rb+++ b/modules/costs/lib/api/v3/cost_entries/cost_entries_by_work_package_api.rb@@ -36,7 +36,7 @@ module APIafter_validation doauthorize_any([:view_cost_entries, :view_own_cost_entries],projects: @work_package.project)- @cost_helper = ::OpenProject::Costs::AttributesHelper.new(@work_package, current_user)+ @cost_helper = ::Costs::AttributesHelper.new(@work_package, current_user)endresources :cost_entries dodiff --git a/modules/costs/lib/api/v3/cost_entries/work_package_costs_by_type_representer.rb b/modules/costs/lib/api/v3/cost_entries/work_package_costs_by_type_representer.rbindex 8af134fd437..0bf769843b0 100644--- a/modules/costs/lib/api/v3/cost_entries/work_package_costs_by_type_representer.rb+++ b/modules/costs/lib/api/v3/cost_entries/work_package_costs_by_type_representer.rb@@ -58,7 +58,7 @@ module APIembedded: truedef cost_helper- @cost_helper ||= ::OpenProject::Costs::AttributesHelper.new(represented, current_user)+ @cost_helper ||= ::Costs::AttributesHelper.new(represented, current_user)enddef _typediff --git a/modules/costs/lib/api/v3/costs_api_user_permission_check.rb b/modules/costs/lib/api/v3/costs_api_user_permission_check.rbindex f1377a1192c..a39e42816cc 100644--- a/modules/costs/lib/api/v3/costs_api_user_permission_check.rb+++ b/modules/costs/lib/api/v3/costs_api_user_permission_check.rb@@ -1,11 +1,11 @@module API::V3::CostsApiUserPermissionCheckdef overall_costs_visible?- (user_has_time_entry_permissions? && user_has_hourly_rate_permissions?) ||+ (view_time_entries_allowed? && user_has_hourly_rate_permissions?) ||(user_has_cost_entry_permissions? && user_has_cost_rates_permission?)enddef labor_costs_visible?- user_has_time_entry_permissions? && user_has_hourly_rate_permissions?+ view_time_entries_allowed? && user_has_hourly_rate_permissions?enddef material_costs_visible?@@ -17,25 +17,11 @@ module API::V3::CostsApiUserPermissionCheckenddef spent_time_visible?- user_has_time_entry_permissions?- end-- def cost_object_visible?- user_has_cost_object_permissions?- end-- # overriding core's method to also factor in :view_own_time_entries- def view_time_entries_allowed?- user_has_time_entry_permissions?+ view_time_entries_allowed?endprivate- def user_has_time_entry_permissions?- current_user_allowed_to(:view_time_entries, context: represented.project) ||- current_user_allowed_to(:view_own_time_entries, context: represented.project)- end-def user_has_hourly_rate_permissions?current_user_allowed_to(:view_hourly_rates, context: represented.project) ||current_user_allowed_to(:view_own_hourly_rate, context: represented.project)@@ -49,8 +35,4 @@ module API::V3::CostsApiUserPermissionCheckcurrent_user_allowed_to(:view_own_cost_entries, context: represented.project) ||current_user_allowed_to(:view_cost_entries, context: represented.project)end-- def user_has_cost_object_permissions?- current_user_allowed_to(:view_cost_objects, context: represented.project)- endenddiff --git a/lib/api/v3/time_entries/available_projects_api.rb b/modules/costs/lib/api/v3/time_entries/available_projects_api.rbsimilarity index 100%rename from lib/api/v3/time_entries/available_projects_api.rbrename to modules/costs/lib/api/v3/time_entries/available_projects_api.rbdiff --git a/lib/api/v3/time_entries/available_work_packages_helper.rb b/modules/costs/lib/api/v3/time_entries/available_work_packages_helper.rbsimilarity index 100%rename from lib/api/v3/time_entries/available_work_packages_helper.rbrename to modules/costs/lib/api/v3/time_entries/available_work_packages_helper.rbdiff --git a/lib/api/v3/time_entries/available_work_packages_on_create_api.rb b/modules/costs/lib/api/v3/time_entries/available_work_packages_on_create_api.rbsimilarity index 100%rename from lib/api/v3/time_entries/available_work_packages_on_create_api.rbrename to modules/costs/lib/api/v3/time_entries/available_work_packages_on_create_api.rbdiff --git a/lib/api/v3/time_entries/available_work_packages_on_edit_api.rb b/modules/costs/lib/api/v3/time_entries/available_work_packages_on_edit_api.rbsimilarity index 100%rename from lib/api/v3/time_entries/available_work_packages_on_edit_api.rbrename to modules/costs/lib/api/v3/time_entries/available_work_packages_on_edit_api.rbdiff --git a/lib/api/v3/time_entries/create_form_api.rb b/modules/costs/lib/api/v3/time_entries/create_form_api.rbsimilarity index 100%rename from lib/api/v3/time_entries/create_form_api.rbrename to modules/costs/lib/api/v3/time_entries/create_form_api.rbdiff --git a/lib/api/v3/time_entries/create_form_representer.rb b/modules/costs/lib/api/v3/time_entries/create_form_representer.rbsimilarity index 100%rename from lib/api/v3/time_entries/create_form_representer.rbrename to modules/costs/lib/api/v3/time_entries/create_form_representer.rbdiff --git a/lib/api/v3/time_entries/form_representer.rb b/modules/costs/lib/api/v3/time_entries/form_representer.rbsimilarity index 100%rename from lib/api/v3/time_entries/form_representer.rbrename to modules/costs/lib/api/v3/time_entries/form_representer.rbdiff --git a/lib/api/v3/time_entries/schemas/time_entry_schema_api.rb b/modules/costs/lib/api/v3/time_entries/schemas/time_entry_schema_api.rbsimilarity index 100%rename from lib/api/v3/time_entries/schemas/time_entry_schema_api.rbrename to modules/costs/lib/api/v3/time_entries/schemas/time_entry_schema_api.rbdiff --git a/lib/api/v3/time_entries/schemas/time_entry_schema_representer.rb b/modules/costs/lib/api/v3/time_entries/schemas/time_entry_schema_representer.rbsimilarity index 100%rename from lib/api/v3/time_entries/schemas/time_entry_schema_representer.rbrename to modules/costs/lib/api/v3/time_entries/schemas/time_entry_schema_representer.rbdiff --git a/lib/api/v3/time_entries/time_entries_activity_api.rb b/modules/costs/lib/api/v3/time_entries/time_entries_activity_api.rbsimilarity index 99%rename from lib/api/v3/time_entries/time_entries_activity_api.rbrename to modules/costs/lib/api/v3/time_entries/time_entries_activity_api.rbindex 77b380dabb6..66d2fdce5d0 100644--- a/lib/api/v3/time_entries/time_entries_activity_api.rb+++ b/modules/costs/lib/api/v3/time_entries/time_entries_activity_api.rb@@ -31,7 +31,6 @@ module APImodule TimeEntriesclass TimeEntriesActivityAPI < ::API::OpenProjectAPIresources :activities do-route_param :id, type: Integer, desc: 'Time entry activity ID' doafter_validation doauthorize_any(%i(log_timediff --git a/lib/api/v3/time_entries/time_entries_activity_representer.rb b/modules/costs/lib/api/v3/time_entries/time_entries_activity_representer.rbsimilarity index 100%rename from lib/api/v3/time_entries/time_entries_activity_representer.rbrename to modules/costs/lib/api/v3/time_entries/time_entries_activity_representer.rbdiff --git a/lib/api/v3/time_entries/time_entries_api.rb b/modules/costs/lib/api/v3/time_entries/time_entries_api.rbsimilarity index 100%rename from lib/api/v3/time_entries/time_entries_api.rbrename to modules/costs/lib/api/v3/time_entries/time_entries_api.rbdiff --git a/lib/api/v3/time_entries/time_entry_collection_representer.rb b/modules/costs/lib/api/v3/time_entries/time_entry_collection_representer.rbsimilarity index 100%rename from lib/api/v3/time_entries/time_entry_collection_representer.rbrename to modules/costs/lib/api/v3/time_entries/time_entry_collection_representer.rbdiff --git a/lib/api/v3/time_entries/time_entry_payload_representer.rb b/modules/costs/lib/api/v3/time_entries/time_entry_payload_representer.rbsimilarity index 100%rename from lib/api/v3/time_entries/time_entry_payload_representer.rbrename to modules/costs/lib/api/v3/time_entries/time_entry_payload_representer.rbdiff --git a/lib/api/v3/time_entries/time_entry_representer.rb b/modules/costs/lib/api/v3/time_entries/time_entry_representer.rbsimilarity index 96%rename from lib/api/v3/time_entries/time_entry_representer.rbrename to modules/costs/lib/api/v3/time_entries/time_entry_representer.rbindex 968001e94f4..86b537a2d5f 100644--- a/lib/api/v3/time_entries/time_entry_representer.rb+++ b/modules/costs/lib/api/v3/time_entries/time_entry_representer.rb@@ -120,7 +120,8 @@ module APIdef update_allowed?current_user_allowed_to(:edit_time_entries, context: represented.project) ||- represented.user_id == current_user.id && current_user_allowed_to(:edit_own_time_entries, context: represented.project)+ represented.user_id == current_user.id &&+ current_user_allowed_to(:edit_own_time_entries, context: represented.project)enddef current_user_allowed_to(permission, context:)diff --git a/lib/api/v3/time_entries/update_form_api.rb b/modules/costs/lib/api/v3/time_entries/update_form_api.rbsimilarity index 100%rename from lib/api/v3/time_entries/update_form_api.rbrename to modules/costs/lib/api/v3/time_entries/update_form_api.rbdiff --git a/lib/api/v3/time_entries/update_form_representer.rb b/modules/costs/lib/api/v3/time_entries/update_form_representer.rbsimilarity index 100%rename from lib/api/v3/time_entries/update_form_representer.rbrename to modules/costs/lib/api/v3/time_entries/update_form_representer.rbdiff --git a/modules/costs/lib/openproject-costs.rb b/modules/costs/lib/costs.rbsimilarity index 97%rename from modules/costs/lib/openproject-costs.rbrename to modules/costs/lib/costs.rbindex b2f1ff72a71..abb0dd4d0d6 100644--- a/modules/costs/lib/openproject-costs.rb+++ b/modules/costs/lib/costs.rb@@ -26,4 +26,4 @@# See docs/COPYRIGHT.rdoc for more details.#++-require 'open_project/costs'+require 'costs/engine'diff --git a/modules/costs/lib/open_project/costs/attributes_helper.rb b/modules/costs/lib/costs/attributes_helper.rbsimilarity index 99%rename from modules/costs/lib/open_project/costs/attributes_helper.rbrename to modules/costs/lib/costs/attributes_helper.rbindex d94f46d7698..8dfa8a07236 100644--- a/modules/costs/lib/open_project/costs/attributes_helper.rb+++ b/modules/costs/lib/costs/attributes_helper.rb@@ -26,7 +26,7 @@# See docs/COPYRIGHT.rdoc for more details.#++-module OpenProject::Costs+module Costsclass AttributesHelperdef initialize(work_package, user = User.current)@work_package = work_packagediff --git a/modules/costs/lib/costs/default_data.rb b/modules/costs/lib/costs/default_data.rbnew file mode 100644index 00000000000..63c8f99b436--- /dev/null+++ b/modules/costs/lib/costs/default_data.rb@@ -0,0 +1,30 @@+module Costs+ module DefaultData+ module_function++ def load!+ add_member_permissions!+ end++ def add_member_permissions!+ role = member_role or raise 'Member role not found'++ role.add_permission! *member_permissions+ end++ def member_role+ Role.find_by name: I18n.t(:default_role_member)+ end++ def member_permissions+ %i[+ view_own_hourly_rate+ view_cost_rates+ log_own_costs+ edit_own_cost_entries+ view_budgets+ view_own_cost_entries+ ]+ end+ end+enddiff --git a/modules/costs/lib/open_project/costs/deleted_user_fallback.rb b/modules/costs/lib/costs/deleted_user_fallback.rbsimilarity index 98%rename from modules/costs/lib/open_project/costs/deleted_user_fallback.rbrename to modules/costs/lib/costs/deleted_user_fallback.rbindex 33e84753058..60b21fabb67 100644--- a/modules/costs/lib/open_project/costs/deleted_user_fallback.rb+++ b/modules/costs/lib/costs/deleted_user_fallback.rb@@ -26,7 +26,7 @@# See docs/COPYRIGHT.rdoc for more details.#++-module OpenProject::Costs+module Costsmodule DeletedUserFallbackdef self.included(base)base.prepend InstanceMethodsdiff --git a/modules/costs/lib/open_project/costs/engine.rb b/modules/costs/lib/costs/engine.rbsimilarity index 65%rename from modules/costs/lib/open_project/costs/engine.rbrename to modules/costs/lib/costs/engine.rbindex fe8d899ce5b..352c7d70192 100644--- a/modules/costs/lib/open_project/costs/engine.rb+++ b/modules/costs/lib/costs/engine.rb@@ -28,22 +28,40 @@require 'open_project/plugins'-module OpenProject::Costs+module Costsclass Engine < ::Rails::Engine- engine_name :openproject_costs+ engine_name :costsinclude OpenProject::Plugins::ActsAsOpEngine- register 'openproject-costs',+ register 'costs',author_url: 'https://www.openproject.com',bundled: true,settings: {- default: { 'costs_currency' => 'EUR','costs_currency_format' => '%n %u' },- partial: 'settings/openproject_costs',+ default: { 'costs_currency' => 'EUR', 'costs_currency_format' => '%n %u' },+ partial: 'settings/costs',menu_item: :costs_setting},- name: 'OpenProject Costs' do- project_module :costs_module do+ name: :project_module_costs do+ project_module :costs do+ permission :view_time_entries, {}+ permission :view_own_time_entries, {}++ permission :log_time,+ {},+ require: :loggedin++ permission :edit_time_entries,+ {},+ require: :member++ permission :edit_own_time_entries,+ {},+ require: :loggedin++ permission :manage_project_activities,+ { 'projects/time_entry_activities': %i[update] },+ require: :memberpermission :view_own_hourly_rate, {}permission :view_hourly_rates, {}@@ -63,12 +81,8 @@ module OpenProject::Costspermission :edit_cost_entries, { costlog: %i[edit update destroy] },require: :member- permission :view_cost_objects, { cost_objects: %i[index show] }-- permission :view_cost_entries, { cost_objects: %i[index show], costlog: [:index] }- permission :view_own_cost_entries, { cost_objects: %i[index show], costlog: [:index] }-- permission :edit_cost_objects, { cost_objects: %i[index show edit update destroy new create copy] }+ permission :view_cost_entries, { budgets: %i[index show], costlog: [:index] }+ permission :view_own_cost_entries, { budgets: %i[index show], costlog: [:index] }end# Menu extensions@@ -77,21 +91,11 @@ module OpenProject::Costs{ controller: '/cost_types', action: 'index' },parent: :admin_costs,caption: :label_cost_type_plural-- menu :project_menu,- :cost_objects,- { controller: '/cost_objects', action: 'index' },- param: :project_id,- before: :settings,- caption: :cost_objects_title,- icon: 'icon2 icon-budget'end- activity_provider :cost_objects, class_name: 'Activities::CostObjectActivityProvider', default: false+ activity_provider :time_entries, class_name: 'Activities::TimeEntryActivityProvider', default: false- patches %i[Project User TimeEntry PermittedParams ProjectsController ApplicationHelper]- patch_with_namespace :WorkPackages, :BaseContract- patch_with_namespace :API, :V3, :WorkPackages, :Schema, :SpecificWorkPackageSchema+ patches %i[Project User PermittedParams ProjectsController]patch_with_namespace :BasicData, :RoleSeederpatch_with_namespace :BasicData, :SettingSeederpatch_with_namespace :ActiveSupport, :NumberHelper, :NumberToCurrencyConverter@@ -102,8 +106,6 @@ module OpenProject::Costspath: ->(params) { tab_edit_user_path(params[:user], tab: :rates) },label: :caption_rate_history- add_api_attribute on: :work_package, ar_name: :cost_object_id-add_api_path :cost_entry do |id|"#{root}/cost_entries/#{id}"end@@ -120,30 +122,10 @@ module OpenProject::Costs"#{root}/cost_types/#{id}"end- add_api_path :budget do |id|- "#{root}/budgets/#{id}"- end-- add_api_path :variable_cost_object do |id|- "#{root}/budgets/#{id}"- end-- add_api_path :budgets_by_project do |project_id|- "#{project(project_id)}/budgets"- end-- add_api_path :attachments_by_budget do |id|- "#{budget(id)}/attachments"- end-add_api_endpoint 'API::V3::Root' do- mount ::API::V3::Budgets::BudgetsAPImount ::API::V3::CostEntries::CostEntriesAPImount ::API::V3::CostTypes::CostTypesAPI- end-- add_api_endpoint 'API::V3::Projects::ProjectsAPI', :id do- mount ::API::V3::Budgets::BudgetsByProjectAPI+ mount ::API::V3::TimeEntries::TimeEntriesAPIendadd_api_endpoint 'API::V3::WorkPackages::WorkPackagesAPI', :id do@@ -174,21 +156,19 @@ module OpenProject::Costscurrent_user_allowed_to(:view_cost_entries, context: represented.project) ||current_user_allowed_to(:view_own_cost_entries, context: represented.project)} do- next unless represented.cost_reporting_enabled? && represented.persisted?+ next unless represented.persisted? && represented.project.costs_enabled?{- href: work_packages_cost_entries_path(represented),- type: 'text/html',- title: "Show cost entries"+ href: cost_reports_path(represented.project_id,+ 'fields[]': 'WorkPackageId',+ 'operators[WorkPackageId]': '=',+ 'values[WorkPackageId]': represented.id,+ set_filter: 1),+ type: 'text/html',+ title: "Show cost entries"}end- associated_resource :cost_object,- v3_path: :budget,- link_title_attribute: :subject,- representer: ::API::V3::Budgets::BudgetRepresenter,- skip_render: ->(*) { !cost_object_visible? }-property :labor_costs,exec_context: :decorator,if: ->(*) { labor_costs_visible? },@@ -235,23 +215,6 @@ module OpenProject::Costssend(:define_method, :material_costs) donumber_to_currency(represented.material_costs)end-- send(:define_method, :cost_object) do- represented.cost_object- end- end-- # This should not be necessary as the payload representer inherits- # from the work package representer. The patching probably happens after- # the payload representer is already evaluated.- extend_api_response(:v3, :work_packages, :work_package_payload) do- prepend API::V3::CostsApiUserPermissionCheck-- associated_resource :cost_object,- v3_path: :budget,- link_title_attribute: :subject,- representer: ::API::V3::Budgets::BudgetRepresenter,- skip_render: ->(*) { !cost_object_visible? }endextend_api_response(:v3, :work_packages, :schema, :work_package_schema) do@@ -281,20 +244,6 @@ module OpenProject::Costsrequired: false,show_if: ->(*) { represented.project && represented.project.costs_enabled? },writable: false-- schema_with_allowed_collection :cost_object,- type: 'Budget',- required: false,- value_representer: ::API::V3::Budgets::BudgetRepresenter,- link_factory: ->(budget) {- {- href: api_v3_paths.budget(budget.id),- title: budget.subject- }- },- show_if: ->(*) {- represented.project && represented.project.costs_enabled?- }endextend_api_response(:v3, :work_packages, :schema, :work_package_sums_schema) do@@ -352,36 +301,17 @@ module OpenProject::Costs}end- initializer 'costs.register_hooks' do- require 'open_project/costs/hooks'- require 'open_project/costs/hooks/work_package_hook'- require 'open_project/costs/hooks/work_package_action_menu'- require 'open_project/costs/hooks/work_packages_show_attributes'- end-initializer 'costs.register_latest_project_activity' do- Project.register_latest_project_activity on: 'CostObject',+ Project.register_latest_project_activity on: 'TimeEntry',attribute: :updated_onendconfig.to_prepare do- OpenProject::Costs::Patches::MembersPatch.mixin!- OpenProject::Costs::Patches::WorkPackagePatch.mixin!-- # loading the class so that acts_as_journalized gets registered- VariableCostObject-- # TODO: this recreates the original behaviour- # however, it might not be desirable to allow assigning of cost_object regardless of the permissions- PermittedParams.permit(:new_work_package, :cost_object_id)-- require 'api/v3/work_packages/work_package_representer'-- API::V3::WorkPackages::WorkPackageRepresenter.to_eager_load += [:cost_object]+ Costs::Patches::MembersPatch.mixin!### Add a new group- cost_attributes = %i(cost_object costs_by_type labor_costs material_costs overall_costs)+ cost_attributes = %i(costs_by_type labor_costs material_costs overall_costs)::Type.add_default_group(:costs, :label_cost_plural)::Type.add_default_mapping(:costs, *cost_attributes)@@ -393,8 +323,7 @@ module OpenProject::Costs::Type.add_constraint attribute, constraintend- Queries::Register.filter Query, OpenProject::Costs::WorkPackageFilter- Queries::Register.column Query, OpenProject::Costs::QueryCurrencyColumn+ Queries::Register.column Query, Costs::QueryCurrencyColumnendendenddiff --git a/modules/costs/lib/open_project/costs/patches.rb b/modules/costs/lib/costs/patches.rbsimilarity index 97%rename from modules/costs/lib/open_project/costs/patches.rbrename to modules/costs/lib/costs/patches.rbindex 1eece40921f..eaf0df6655e 100644--- a/modules/costs/lib/open_project/costs/patches.rb+++ b/modules/costs/lib/costs/patches.rb@@ -26,5 +26,5 @@# See docs/COPYRIGHT.rdoc for more details.#++-module OpenProject::Costs::Patches+module Costs::Patchesenddiff --git a/modules/costs/lib/open_project/costs/patches/members_patch.rb b/modules/costs/lib/costs/patches/members_patch.rbsimilarity index 98%rename from modules/costs/lib/open_project/costs/patches/members_patch.rbrename to modules/costs/lib/costs/patches/members_patch.rbindex fdca82ad694..dea4f4fd986 100644--- a/modules/costs/lib/open_project/costs/patches/members_patch.rb+++ b/modules/costs/lib/costs/patches/members_patch.rb@@ -26,7 +26,7 @@# See docs/COPYRIGHT.rdoc for more details.#++-module OpenProject::Costs+module Costsmodule Patches::MembersPatchdef self.mixin!::Members::TableCell.add_column :current_rate@@ -133,7 +133,7 @@ module OpenProject::Costsdef costs_enabled?if @costs_enabled.nil?- @costs_enabled = project.present? && project.module_enabled?(:costs_module)+ @costs_enabled = project.present? && project.module_enabled?(:costs)end@costs_enabled@@ -187,7 +187,7 @@ module OpenProject::Costsenddef costs_enabled?- project.present? && project.module_enabled?(:costs_module)+ project.present? && project.module_enabled?(:costs)enddef allow_view?diff --git a/modules/costs/lib/open_project/costs/patches/number_to_currency_converter_patch.rb b/modules/costs/lib/costs/patches/number_to_currency_converter_patch.rbsimilarity index 83%rename from modules/costs/lib/open_project/costs/patches/number_to_currency_converter_patch.rbrename to modules/costs/lib/costs/patches/number_to_currency_converter_patch.rbindex 0a38c204922..e3e50794cbc 100644--- a/modules/costs/lib/open_project/costs/patches/number_to_currency_converter_patch.rb+++ b/modules/costs/lib/costs/patches/number_to_currency_converter_patch.rb@@ -26,15 +26,15 @@# See docs/COPYRIGHT.rdoc for more details.#++-module OpenProject::Costs::Patches::NumberToCurrencyConverterPatch+module Costs::Patches::NumberToCurrencyConverterPatchdef self.included(base) # :nodoc:base.prepend InstanceMethodsendmodule InstanceMethodsdef i18n_opts- super.merge(unit: ERB::Util.h(Setting.plugin_openproject_costs['costs_currency']),- format: ERB::Util.h(Setting.plugin_openproject_costs['costs_currency_format']))+ super.merge(unit: ERB::Util.h(Setting.plugin_costs['costs_currency']),+ format: ERB::Util.h(Setting.plugin_costs['costs_currency_format']))endend-end\ No newline at end of file+enddiff --git a/modules/costs/lib/open_project/costs/patches/permitted_params_patch.rb b/modules/costs/lib/costs/patches/permitted_params_patch.rbsimilarity index 65%rename from modules/costs/lib/open_project/costs/patches/permitted_params_patch.rbrename to modules/costs/lib/costs/patches/permitted_params_patch.rbindex 627b4917dda..bb6c178155e 100644--- a/modules/costs/lib/open_project/costs/patches/permitted_params_patch.rb+++ b/modules/costs/lib/costs/patches/permitted_params_patch.rb@@ -26,7 +26,7 @@# See docs/COPYRIGHT.rdoc for more details.#++-module OpenProject::Costs::Patches::PermittedParamsPatch+module Costs::Patches::PermittedParamsPatchdef self.included(base) # :nodoc:base.send(:include, InstanceMethods)end@@ -39,14 +39,14 @@ module OpenProject::Costs::Patches::PermittedParamsPatch:spent_on)end- def cost_object- params.require(:cost_object).permit(:subject,- :description,- :fixed_date,- { new_material_budget_item_attributes: [:units, :cost_type_id, :comments, :budget] },- { new_labor_budget_item_attributes: [:hours, :user_id, :comments, :budget] },- { existing_material_budget_item_attributes: [:units, :cost_type_id, :comments, :budget] },- existing_labor_budget_item_attributes: [:hours, :user_id, :comments, :budget])+ def budget+ params.require(:budget).permit(:subject,+ :description,+ :fixed_date,+ { new_material_budget_item_attributes: %i[units cost_type_id comments amount] },+ { new_labor_budget_item_attributes: %i[hours user_id comments amount] },+ { existing_material_budget_item_attributes: %i[units cost_type_id comments amount] },+ existing_labor_budget_item_attributes: %i[hours user_id comments amount])enddef cost_type@@ -54,13 +54,13 @@ module OpenProject::Costs::Patches::PermittedParamsPatch:unit,:unit_plural,:default,- { new_rate_attributes: [:valid_from, :rate] },- existing_rate_attributes: [:valid_from, :rate])+ { new_rate_attributes: %i[valid_from rate] },+ existing_rate_attributes: %i[valid_from rate])enddef user_rates- params.require(:user).permit(new_rate_attributes: [:valid_from, :rate],- existing_rate_attributes: [:valid_from, :rate])+ params.require(:user).permit(new_rate_attributes: %i[valid_from rate],+ existing_rate_attributes: %i[valid_from rate])endendenddiff --git a/modules/costs/lib/open_project/costs/patches/project_patch.rb b/modules/costs/lib/costs/patches/project_patch.rbsimilarity index 87%rename from modules/costs/lib/open_project/costs/patches/project_patch.rbrename to modules/costs/lib/costs/patches/project_patch.rbindex f3c87b5e69f..45227105756 100644--- a/modules/costs/lib/open_project/costs/patches/project_patch.rb+++ b/modules/costs/lib/costs/patches/project_patch.rb@@ -26,13 +26,12 @@# See docs/COPYRIGHT.rdoc for more details.#++-module OpenProject::Costs::Patches::ProjectPatch+module Costs::Patches::ProjectPatchdef self.included(base) # :nodoc:base.extend(ClassMethods)base.include(InstanceMethods)base.class_eval do- has_many :cost_objects, dependent: :destroyhas_many :rates, class_name: 'HourlyRate'has_many :member_groups, -> {@@ -48,11 +47,7 @@ module OpenProject::Costs::Patches::ProjectPatchmodule InstanceMethodsdef costs_enabled?- module_enabled?(:costs_module)- end-- def cost_reporting_enabled?- costs_enabled? && module_enabled?(:reporting_module)+ module_enabled?(:costs)endendenddiff --git a/modules/costs/lib/open_project/costs/patches/projects_controller_patch.rb b/modules/costs/lib/costs/patches/projects_controller_patch.rbsimilarity index 96%rename from modules/costs/lib/open_project/costs/patches/projects_controller_patch.rbrename to modules/costs/lib/costs/patches/projects_controller_patch.rbindex 3bbf1337ca5..b23f8c9645d 100644--- a/modules/costs/lib/open_project/costs/patches/projects_controller_patch.rb+++ b/modules/costs/lib/costs/patches/projects_controller_patch.rb@@ -26,7 +26,7 @@# See docs/COPYRIGHT.rdoc for more details.#++-module OpenProject::Costs::Patches::ProjectsControllerPatch+module Costs::Patches::ProjectsControllerPatchdef self.included(base) # :nodoc:base.send(:include, InstanceMethods)diff --git a/modules/costs/lib/open_project/costs/patches/role_seeder_patch.rb b/modules/costs/lib/costs/patches/role_seeder_patch.rbsimilarity index 93%rename from modules/costs/lib/open_project/costs/patches/role_seeder_patch.rbrename to modules/costs/lib/costs/patches/role_seeder_patch.rbindex e2af58b8320..5d195853b8c 100644--- a/modules/costs/lib/open_project/costs/patches/role_seeder_patch.rb+++ b/modules/costs/lib/costs/patches/role_seeder_patch.rb@@ -26,7 +26,7 @@# See docs/COPYRIGHT.rdoc for more details.#++-module OpenProject::Costs::Patches::RoleSeederPatch+module Costs::Patches::RoleSeederPatchdef self.included(base) # :nodoc:base.prepend InstanceMethodsend@@ -34,7 +34,7 @@ module OpenProject::Costs::Patches::RoleSeederPatchmodule InstanceMethodsdef seed_data!super.tap do |_|- OpenProject::Costs::DefaultData.load!+ Costs::DefaultData.load!endendenddiff --git a/modules/costs/lib/open_project/costs/patches/setting_seeder_patch.rb b/modules/costs/lib/costs/patches/setting_seeder_patch.rbsimilarity index 91%rename from modules/costs/lib/open_project/costs/patches/setting_seeder_patch.rbrename to modules/costs/lib/costs/patches/setting_seeder_patch.rbindex 403cfc9f00f..72c240c8778 100644--- a/modules/costs/lib/open_project/costs/patches/setting_seeder_patch.rb+++ b/modules/costs/lib/costs/patches/setting_seeder_patch.rb@@ -26,7 +26,7 @@# See docs/COPYRIGHT.rdoc for more details.#++-module OpenProject::Costs::Patches::SettingSeederPatch+module Costs::Patches::SettingSeederPatchdef self.included(base) # :nodoc:base.prepend InstanceMethodsend@@ -35,8 +35,8 @@ module OpenProject::Costs::Patches::SettingSeederPatchdef dataoriginal_data = super- unless original_data['default_projects_modules'].include? 'costs_module'- original_data['default_projects_modules'] << 'costs_module'+ unless original_data['default_projects_modules'].include? 'costs'+ original_data['default_projects_modules'] << 'costs'endoriginal_datadiff --git a/modules/costs/lib/open_project/costs/patches/user_patch.rb b/modules/costs/lib/costs/patches/user_patch.rbsimilarity index 96%rename from modules/costs/lib/open_project/costs/patches/user_patch.rbrename to modules/costs/lib/costs/patches/user_patch.rbindex ba6e6252771..56e033547bb 100644--- a/modules/costs/lib/open_project/costs/patches/user_patch.rb+++ b/modules/costs/lib/costs/patches/user_patch.rb@@ -26,7 +26,7 @@# See docs/COPYRIGHT.rdoc for more details.#++-module OpenProject::Costs::Patches::UserPatch+module Costs::Patches::UserPatchdef self.included(base) # :nodoc:base.send(:include, InstanceMethods)@@ -45,9 +45,7 @@ module OpenProject::Costs::Patches::UserPatchids = scope.pluck(:id)- ids.empty? ?- '1=0' :- "(#{Project.table_name}.id in (#{ids.join(', ')}))"+ ids.empty? ? '1=0' : "(#{Project.table_name}.id in (#{ids.join(', ')}))"enddef current_rate(project = nil, include_default = true)diff --git a/modules/costs/lib/open_project/costs/query_currency_column.rb b/modules/costs/lib/costs/query_currency_column.rbsimilarity index 98%rename from modules/costs/lib/open_project/costs/query_currency_column.rbrename to modules/costs/lib/costs/query_currency_column.rbindex 7d4d2501266..b81da7fb759 100644--- a/modules/costs/lib/open_project/costs/query_currency_column.rb+++ b/modules/costs/lib/costs/query_currency_column.rb@@ -26,7 +26,7 @@# See docs/COPYRIGHT.rdoc for more details.#++-module OpenProject::Costs+module Costsclass QueryCurrencyColumn < Queries::WorkPackages::Columns::WorkPackageColumninclude ActionView::Helpers::NumberHelperalias :super_value :value@@ -61,7 +61,7 @@ module OpenProject::Costsclass_attribute :currency_columnsself.currency_columns = {- cost_object: {},+ budget: {},material_costs: {summable: ->(work_packages) {WorkPackage::MaterialCostsdiff --git a/modules/costs/lib/open_project/costs/default_data.rb b/modules/costs/lib/open_project/costs/default_data.rbdeleted file mode 100644index d43d6f9ec3e..00000000000--- a/modules/costs/lib/open_project/costs/default_data.rb+++ /dev/null@@ -1,32 +0,0 @@-module OpenProject- module Costs- module DefaultData- module_function-- def load!- add_member_permissions!- end-- def add_member_permissions!- role = member_role or raise 'Member role not found'-- role.add_permission! *member_permissions- end-- def member_role- Role.find_by name: I18n.t(:default_role_member)- end-- def member_permissions- [- :view_own_hourly_rate,- :view_cost_rates,- :log_own_costs,- :edit_own_cost_entries,- :view_cost_objects,- :view_own_cost_entries- ]- end- end- end-enddiff --git a/modules/costs/lib/open_project/costs/hooks/work_package_action_menu.rb b/modules/costs/lib/open_project/costs/hooks/work_package_action_menu.rbdeleted file mode 100644index cf93cab9fc2..00000000000--- a/modules/costs/lib/open_project/costs/hooks/work_package_action_menu.rb+++ /dev/null@@ -1,32 +0,0 @@-#-- copyright-# OpenProject is an open source project management software.-# Copyright (C) 2012-2020 the OpenProject GmbH-#-# This program is free software; you can redistribute it and/or-# modify it under the terms of the GNU General Public License version 3.-#-# OpenProject is a fork of ChiliProject, which is a fork of Redmine. The copyright follows:-# Copyright (C) 2006-2017 Jean-Philippe Lang-# Copyright (C) 2010-2013 the ChiliProject Team-#-# This program is free software; you can redistribute it and/or-# modify it under the terms of the GNU General Public License-# as published by the Free Software Foundation; either version 2-# of the License, or (at your option) any later version.-#-# This program is distributed in the hope that it will be useful,-# but WITHOUT ANY WARRANTY; without even the implied warranty of-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the-# GNU General Public License for more details.-#-# You should have received a copy of the GNU General Public License-# along with this program; if not, write to the Free Software-# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.-#-# See docs/COPYRIGHT.rdoc for more details.-#++--# Hooks to attach to the OpenProject action menu.-class OpenProject::Costs::Hooks::WorkPackageActionMenu < Redmine::Hook::ViewListener- render_on :view_work_package_show_action_menu, partial: 'hooks/costs/view_work_package_show_action_menu'-enddiff --git a/modules/costs/lib/open_project/costs/hooks/work_packages_show_attributes.rb b/modules/costs/lib/open_project/costs/hooks/work_packages_show_attributes.rbdeleted file mode 100644index 71b62246bae..00000000000--- a/modules/costs/lib/open_project/costs/hooks/work_packages_show_attributes.rb+++ /dev/null@@ -1,93 +0,0 @@-#-- copyright-# OpenProject is an open source project management software.-# Copyright (C) 2012-2020 the OpenProject GmbH-#-# This program is free software; you can redistribute it and/or-# modify it under the terms of the GNU General Public License version 3.-#-# OpenProject is a fork of ChiliProject, which is a fork of Redmine. The copyright follows:-# Copyright (C) 2006-2017 Jean-Philippe Lang-# Copyright (C) 2010-2013 the ChiliProject Team-#-# This program is free software; you can redistribute it and/or-# modify it under the terms of the GNU General Public License-# as published by the Free Software Foundation; either version 2-# of the License, or (at your option) any later version.-#-# This program is distributed in the hope that it will be useful,-# but WITHOUT ANY WARRANTY; without even the implied warranty of-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the-# GNU General Public License for more details.-#-# You should have received a copy of the GNU General Public License-# along with this program; if not, write to the Free Software-# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.-#-# See docs/COPYRIGHT.rdoc for more details.-#++--module OpenProject::Costs::Hooks- class WorkPackagesShowAttributes < Redmine::Hook::ViewListener- include ActionView::Context- include WorkPackagesHelper-- def work_packages_show_attributes(context = {})- @work_package = context[:work_package]- @project = context[:project]- attributes = context[:attributes]-- return unless @project.module_enabled? :costs_module-- attributes << cost_work_package_attributes- attributes.flatten!-- attributes- end-- private-- def cost_work_package_attributes- attributes = []-- attributes_helper = OpenProject::Costs::AttributesHelper.new(@work_package)-- attributes << work_package_show_table_row(:cost_object) {- @work_package.cost_object ?- link_to_cost_object(@work_package.cost_object) :- empty_element_tag- }-- attributes << work_package_show_table_row(:overall_costs) {- attributes_helper.overall_costs ?- number_to_currency(attributes_helper.overall_costs) :- empty_element_tag- }-- if attributes_helper.summarized_cost_entries- attributes << work_package_show_table_row(:spent_units) {- summarized_cost_entry_links(attributes_helper.summarized_cost_entries, @work_package)- }- end-- attributes- end-- def summarized_cost_entry_links(cost_entries, work_package, create_link = true)- str_array = []- cost_entries.each do |cost_type, units|- txt = pluralize(units, cost_type.unit, cost_type.unit_plural)- if create_link- # TODO why does this have project_id, work_package_id and cost_type_id params?- str_array << link_to(txt, { controller: '/cost_reports',- action: 'index',- project_id: work_package.project_id,- cost_type_id: cost_type },- title: cost_type.name)- else- str_array << "<span title=\"#{h(cost_type.name)}\">#{txt}</span>"- end- end- str_array.join(', ').html_safe- end- end-enddiff --git a/modules/costs/lib/open_project/costs/patches/application_helper_patch.rb b/modules/costs/lib/open_project/costs/patches/application_helper_patch.rbdeleted file mode 100644index ed6c721c2bb..00000000000--- a/modules/costs/lib/open_project/costs/patches/application_helper_patch.rb+++ /dev/null@@ -1,51 +0,0 @@-#-- copyright-# OpenProject is an open source project management software.-# Copyright (C) 2012-2020 the OpenProject GmbH-#-# This program is free software; you can redistribute it and/or-# modify it under the terms of the GNU General Public License version 3.-#-# OpenProject is a fork of ChiliProject, which is a fork of Redmine. The copyright follows:-# Copyright (C) 2006-2017 Jean-Philippe Lang-# Copyright (C) 2010-2013 the ChiliProject Team-#-# This program is free software; you can redistribute it and/or-# modify it under the terms of the GNU General Public License-# as published by the Free Software Foundation; either version 2-# of the License, or (at your option) any later version.-#-# This program is distributed in the hope that it will be useful,-# but WITHOUT ANY WARRANTY; without even the implied warranty of-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the-# GNU General Public License for more details.-#-# You should have received a copy of the GNU General Public License-# along with this program; if not, write to the Free Software-# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.-#-# See docs/COPYRIGHT.rdoc for more details.-#++--module OpenProject::Costs::Patches::ApplicationHelperPatch- def self.included(base) # :nodoc:- # Same as typing in the class- base.class_eval do- def link_to_cost_object(cost_object, options = {})- title = nil- subject = nil- if options[:subject] == false- subject = "#{t(:label_cost_object)} ##{cost_object.id}"- title = truncate(cost_object.subject, length: 60)- else- subject = cost_object.subject- if options[:truncate]- subject = truncate(subject, length: options[:truncate])- end- end- s = link_to subject, cost_object_path(cost_object), class: cost_object.css_classes, title: title- s = "#{h cost_object.project} - " + s if options[:project]- s- end- end- end-enddiff --git a/modules/costs/lib/open_project/costs/patches/time_entry_patch.rb b/modules/costs/lib/open_project/costs/patches/time_entry_patch.rbdeleted file mode 100644index a223a5bb3bf..00000000000--- a/modules/costs/lib/open_project/costs/patches/time_entry_patch.rb+++ /dev/null@@ -1,107 +0,0 @@-#-- copyright-# OpenProject is an open source project management software.-# Copyright (C) 2012-2020 the OpenProject GmbH-#-# This program is free software; you can redistribute it and/or-# modify it under the terms of the GNU General Public License version 3.-#-# OpenProject is a fork of ChiliProject, which is a fork of Redmine. The copyright follows:-# Copyright (C) 2006-2017 Jean-Philippe Lang-# Copyright (C) 2010-2013 the ChiliProject Team-#-# This program is free software; you can redistribute it and/or-# modify it under the terms of the GNU General Public License-# as published by the Free Software Foundation; either version 2-# of the License, or (at your option) any later version.-#-# This program is distributed in the hope that it will be useful,-# but WITHOUT ANY WARRANTY; without even the implied warranty of-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the-# GNU General Public License for more details.-#-# You should have received a copy of the GNU General Public License-# along with this program; if not, write to the Free Software-# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.-#-# See docs/COPYRIGHT.rdoc for more details.-#++--# Patches Redmine's Users dynamically.-module OpenProject::Costs::Patches::TimeEntryPatch- def self.included(base) # :nodoc:- base.extend(ClassMethods)-- base.send(:include, InstanceMethods)-- # Same as typing in the class- base.class_eval do- belongs_to :rate, -> { where(type: ['HourlyRate', 'DefaultHourlyRate']) }, class_name: 'Rate'-- before_save :update_costs-- extend ::TimeEntry::TimeEntryScopes- end- end-- module ClassMethods- def update_all(updates, conditions = nil, options = {})- # instead of a update_all, perform an individual update during work_package#move- # to trigger the update of the costs based on new rates- if conditions.respond_to?(:keys) && conditions.keys == [:work_package_id] && updates =~ /^project_id = ([\d]+)$/- project_id = $1- time_entries = TimeEntry.where(conditions)- time_entries.each do |entry|- entry.project_id = project_id- entry.save!- end- else- super- end- end- end-- module InstanceMethods- def real_costs- # This methods returns the actual assigned costs of the entry- overridden_costs || costs || calculated_costs- end-- def calculated_costs(rate_attr = nil)- rate_attr ||= current_rate- hours * rate_attr.rate- rescue- 0.0- end-- def update_costs(rate_attr = nil)- rate_attr ||= current_rate- if rate_attr.nil?- self.costs = 0.0- self.rate = nil- return- end-- self.costs = calculated_costs(rate_attr)- self.rate = rate_attr- end-- def update_costs!(rate_attr = nil)- update_costs(rate_attr)- self.save!- end-- def current_rate- user.rate_at(spent_on, project_id)- end-- def visible_by?(usr)- usr.allowed_to?(:view_time_entries, project) ||- (user_id == usr.id && usr.allowed_to?(:view_own_time_entries, project))- end-- def costs_visible_by?(usr)- usr.allowed_to?(:view_hourly_rates, project) ||- (user_id == usr.id && usr.allowed_to?(:view_own_hourly_rate, project))- end- end-enddiff --git a/modules/costs/lib/open_project/costs/patches/work_package_patch.rb b/modules/costs/lib/open_project/costs/patches/work_package_patch.rbdeleted file mode 100644index e52c9e78767..00000000000--- a/modules/costs/lib/open_project/costs/patches/work_package_patch.rb+++ /dev/null@@ -1,169 +0,0 @@-#-- copyright-# OpenProject is an open source project management software.-# Copyright (C) 2012-2020 the OpenProject GmbH-#-# This program is free software; you can redistribute it and/or-# modify it under the terms of the GNU General Public License version 3.-#-# OpenProject is a fork of ChiliProject, which is a fork of Redmine. The copyright follows:-# Copyright (C) 2006-2017 Jean-Philippe Lang-# Copyright (C) 2010-2013 the ChiliProject Team-#-# This program is free software; you can redistribute it and/or-# modify it under the terms of the GNU General Public License-# as published by the Free Software Foundation; either version 2-# of the License, or (at your option) any later version.-#-# This program is distributed in the hope that it will be useful,-# but WITHOUT ANY WARRANTY; without even the implied warranty of-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the-# GNU General Public License for more details.-#-# You should have received a copy of the GNU General Public License-# along with this program; if not, write to the Free Software-# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.-#-# See docs/COPYRIGHT.rdoc for more details.-#++--require_dependency 'work_package'--module OpenProject::Costs::Patches- module WorkPackagePatch- def self.mixin!- ::WorkPackage.prepend InstanceMethods- ::WorkPackage.singleton_class.prepend ClassMethods-- ::WorkPackage.class_eval do- belongs_to :cost_object, inverse_of: :work_packages- has_many :cost_entries, dependent: :delete_all-- # disabled for now, implements part of ticket blocking- validate :validate_cost_object-- after_update :move_cost_entries-- register_journal_formatter(:cost_association) do |value, journable, field|- association = journable.class.reflect_on_association(field.to_sym)- if association- record = association.class_name.constantize.find_by_id(value.to_i)- record&.subject- end- end-- register_on_journal_formatter(:cost_association, 'cost_object_id')-- associated_to_ask_before_destruction CostEntry,- ->(work_packages) { CostEntry.on_work_packages(work_packages).count > 0 },- method(:cleanup_cost_entries_before_destruction_of)- end- end-- module ClassMethods- protected-- def cleanup_cost_entries_before_destruction_of(work_packages, user, to_do = { action: 'destroy' })- work_packages = Array(work_packages)-- return false unless to_do.present?-- case to_do[:action]- when 'destroy'- true- # nothing to do- when 'nullify'- work_packages.each do |wp|- wp.errors.add(:base, :nullify_is_not_valid_for_cost_entries)- end-- false- when 'reassign'- reassign_cost_entries_before_destruction(work_packages, user, to_do[:reassign_to_id])- else- false- end- end-- def reassign_cost_entries_before_destruction(work_packages, user, ids)- reassign_to = ::WorkPackage- .joins(:project)- .merge(Project.allowed_to(user, :edit_cost_entries))- .find_by_id(ids)-- if reassign_to.nil?- work_packages.each do |wp|- wp.errors.add(:base, :is_not_a_valid_target_for_cost_entries, id: ids)- end-- false- else- condition = "work_package_id = #{reassign_to.id}, project_id = #{reassign_to.project_id}"- ::WorkPackage.update_cost_entries(work_packages.map(&:id), condition)- end- end-- protected-- def update_cost_entries(work_packages, action)- CostEntry.where(work_package_id: work_packages).update_all(action)- end- end-- module InstanceMethods- def costs_enabled?- project&.costs_enabled?- end-- def cost_reporting_enabled?- project&.cost_reporting_enabled?- end-- def validate_cost_object- if cost_object_id_changed?- unless cost_object_id.blank? || project.cost_object_ids.include?(cost_object_id)- errors.add :cost_object, :inclusion- end- end- end-- def material_costs- if respond_to?(:cost_entries_sum) # column has been eager loaded into result set- cost_entries_sum.to_f- else- ::WorkPackage::MaterialCosts.new(user: User.current).costs_of work_packages: self_and_descendants- end- end-- def labor_costs- if respond_to?(:time_entries_sum) # column has been eager loaded into result set- time_entries_sum.to_f- else- ::WorkPackage::LaborCosts.new(user: User.current).costs_of work_packages: self_and_descendants- end- end-- def overall_costs- labor_costs + material_costs- end-- # Wraps the association to get the Cost Object subject. Needed for the- # Query and filtering- def cost_object_subject- cost_object&.subject- end-- def update_costs!- # This methods ist referenced from some migrations but does nothing- # anymore.- end-- def move_cost_entries- return unless saved_change_to_project_id?- # TODO: This only works with the global cost_rates- CostEntry- .where(work_package_id: id)- .update_all(project_id: project_id)- end- end- end-enddiff --git a/spec/contracts/time_entries/create_contract_spec.rb b/modules/costs/spec/contracts/time_entries/create_contract_spec.rbsimilarity index 100%rename from spec/contracts/time_entries/create_contract_spec.rbrename to modules/costs/spec/contracts/time_entries/create_contract_spec.rbdiff --git a/spec/contracts/time_entries/delete_contract_spec.rb b/modules/costs/spec/contracts/time_entries/delete_contract_spec.rbsimilarity index 99%rename from spec/contracts/time_entries/delete_contract_spec.rbrename to modules/costs/spec/contracts/time_entries/delete_contract_spec.rbindex e2efff47bd7..d776dc1ec33 100644--- a/spec/contracts/time_entries/delete_contract_spec.rb+++ b/modules/costs/spec/contracts/time_entries/delete_contract_spec.rb@@ -1,4 +1,5 @@#-- encoding: UTF-8+#-- copyright# OpenProject is an open source project management software.# Copyright (C) 2012-2020 the OpenProject GmbHdiff --git a/spec/contracts/time_entries/shared_contract_examples.rb b/modules/costs/spec/contracts/time_entries/shared_contract_examples.rbsimilarity index 99%rename from spec/contracts/time_entries/shared_contract_examples.rbrename to modules/costs/spec/contracts/time_entries/shared_contract_examples.rbindex e4c8c1de4ad..576ded9aa95 100644--- a/spec/contracts/time_entries/shared_contract_examples.rb+++ b/modules/costs/spec/contracts/time_entries/shared_contract_examples.rb@@ -58,7 +58,7 @@ shared_examples_for 'time entry contract' dolet(:activities_scope) doscope = double('activities')- if (time_entry_activity)+ if time_entry_activityallow(scope).to receive(:exists?).with(time_entry_activity.id)diff --git a/spec/contracts/time_entries/update_contract_spec.rb b/modules/costs/spec/contracts/time_entries/update_contract_spec.rbsimilarity index 100%rename from spec/contracts/time_entries/update_contract_spec.rbrename to modules/costs/spec/contracts/time_entries/update_contract_spec.rbdiff --git a/modules/costs/spec/controllers/work_packages_bulk_controller_spec.rb b/modules/costs/spec/controllers/work_packages_bulk_controller_spec.rbindex 8ec3deb0fc1..9c5e2b9cd63 100644--- a/modules/costs/spec/controllers/work_packages_bulk_controller_spec.rb+++ b/modules/costs/spec/controllers/work_packages_bulk_controller_spec.rb@@ -32,7 +32,7 @@ describe WorkPackages::BulkController, type: :controller dolet(:project) { FactoryBot.create(:project_with_types) }let(:controller_role) { FactoryBot.build(:role, permissions: [:view_work_packages, :edit_work_packages]) }let(:user) { FactoryBot.create :user, member_in_project: project, member_through_role: controller_role }- let(:cost_object) { FactoryBot.create :cost_object, project: project }+ let(:budget) { FactoryBot.create :budget, project: project }let(:work_package) { FactoryBot.create(:work_package, project: project) }before do@@ -43,12 +43,12 @@ describe WorkPackages::BulkController, type: :controller docontext 'when a cost report is assigned' dobefore doput :update, params: { ids: [work_package.id],- work_package: { cost_object_id: cost_object.id } }+ work_package: { budget_id: budget.id } }end- subject { work_package.reload.cost_object.try :id }+ subject { work_package.reload.budget.try :id }- it { is_expected.to eq(cost_object.id) }+ it { is_expected.to eq(budget.id) }endendenddiff --git a/spec/factories/time_entry_activity_factory.rb b/modules/costs/spec/factories/time_entry_activity_factory.rbsimilarity index 100%rename from spec/factories/time_entry_activity_factory.rbrename to modules/costs/spec/factories/time_entry_activity_factory.rbdiff --git a/spec/factories/time_entry_factory.rb b/modules/costs/spec/factories/time_entry_factory.rbsimilarity index 100%rename from spec/factories/time_entry_factory.rbrename to modules/costs/spec/factories/time_entry_factory.rbdiff --git a/modules/costs/spec/factories/variable_cost_object_factory.rb b/modules/costs/spec/factories/variable_cost_object_factory.rbdeleted file mode 100644index fbb52dc64e2..00000000000--- a/modules/costs/spec/factories/variable_cost_object_factory.rb+++ /dev/null@@ -1,37 +0,0 @@-#-- copyright-# OpenProject is an open source project management software.-# Copyright (C) 2012-2020 the OpenProject GmbH-#-# This program is free software; you can redistribute it and/or-# modify it under the terms of the GNU General Public License version 3.-#-# OpenProject is a fork of ChiliProject, which is a fork of Redmine. The copyright follows:-# Copyright (C) 2006-2017 Jean-Philippe Lang-# Copyright (C) 2010-2013 the ChiliProject Team-#-# This program is free software; you can redistribute it and/or-# modify it under the terms of the GNU General Public License-# as published by the Free Software Foundation; either version 2-# of the License, or (at your option) any later version.-#-# This program is distributed in the hope that it will be useful,-# but WITHOUT ANY WARRANTY; without even the implied warranty of-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the-# GNU General Public License for more details.-#-# You should have received a copy of the GNU General Public License-# along with this program; if not, write to the Free Software-# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.-#-# See docs/COPYRIGHT.rdoc for more details.-#++--FactoryBot.define do- factory :variable_cost_object do- association :project, factory: :project- sequence(:subject) do |n| "Cost Object No. #{n}" end- sequence(:description) do |n| "I am a Cost Object No. #{n}" end- association :author, factory: :user- fixed_date { Time.now }- end-enddiff --git a/modules/costs/spec/features/destroy_work_package_with_cost_entries_spec.rb b/modules/costs/spec/features/destroy_work_package_with_cost_entries_spec.rbindex 325f7ed4701..acf2a908eca 100644--- a/modules/costs/spec/features/destroy_work_package_with_cost_entries_spec.rb+++ b/modules/costs/spec/features/destroy_work_package_with_cost_entries_spec.rb@@ -30,30 +30,39 @@ require File.expand_path(File.dirname(__FILE__) + '/../spec_helper.rb')describe 'Only see your own rates', type: :feature, js: true dolet(:project) { work_package.project }- let(:user) { FactoryBot.create :user,- member_in_project: project,- member_through_role: role }- let(:role) { FactoryBot.create :role, permissions: [:view_work_packages,- :delete_work_packages,- :edit_cost_entries,- :view_cost_entries] }- let(:work_package) {FactoryBot.create :work_package }+ let(:user) do+ FactoryBot.create :user,+ member_in_project: project,+ member_through_role: role+ end+ let(:role) do+ FactoryBot.create :role,+ permissions: [:view_work_packages,+ :delete_work_packages,+ :edit_cost_entries,+ :view_cost_entries]+ end+ let(:work_package) { FactoryBot.create :work_package }let(:destroy_modal) { Components::WorkPackages::DestroyModal.new }- let(:cost_type) {+ let(:cost_type) dotype = FactoryBot.create :cost_type, name: 'Translations'- FactoryBot.create :cost_rate, cost_type: type,- rate: 7.00+ FactoryBot.create :cost_rate,+ cost_type: type,+ rate: 7.00type- }+ endlet(:budget) do- FactoryBot.create(:cost_object, project: project)+ FactoryBot.create(:budget, project: project)+ end+ let(:other_work_package) { FactoryBot.create :work_package, project: project, budget: budget }+ let(:cost_entry) do+ FactoryBot.create :cost_entry,+ work_package: work_package,+ project: project,+ units: 2.00,+ cost_type: cost_type,+ user: userend- let(:other_work_package) {FactoryBot.create :work_package, project: project, cost_object: budget }- let(:cost_entry) { FactoryBot.create :cost_entry, work_package: work_package,- project: project,- units: 2.00,- cost_type: cost_type,- user: user }it 'allows to move the time entry to a different work package' doallow(User).to receive(:current).and_return(user)@@ -65,7 +74,7 @@ describe 'Only see your own rates', type: :feature, js: true dowp_page = Pages::FullWorkPackage.new(work_package)wp_page.visit!- find('#action-show-more-dropdown-menu').click();+ find('#action-show-more-dropdown-menu').clickclick_link(I18n.t('js.button_delete'))@@ -74,7 +83,7 @@ describe 'Only see your own rates', type: :feature, js: true dochoose 'to_do_action_reassign'sleep 1- fill_in 'to_do_reassign_to_id', :with => other_work_package.id+ fill_in 'to_do_reassign_to_id', with: other_work_package.idclick_button(I18n.t('button_delete'))diff --git a/spec/features/time_entry/activity_spec.rb b/modules/costs/spec/features/time_entry/activity_spec.rbsimilarity index 100%rename from spec/features/time_entry/activity_spec.rbrename to modules/costs/spec/features/time_entry/activity_spec.rbdiff --git a/modules/costs/spec/helpers/cost_objects_helper_spec.rb b/modules/costs/spec/helpers/cost_objects_helper_spec.rbdeleted file mode 100644index 995205f2396..00000000000--- a/modules/costs/spec/helpers/cost_objects_helper_spec.rb+++ /dev/null@@ -1,72 +0,0 @@-#-- copyright-# OpenProject is an open source project management software.-# Copyright (C) 2012-2020 the OpenProject GmbH-#-# This program is free software; you can redistribute it and/or-# modify it under the terms of the GNU General Public License version 3.-#-# OpenProject is a fork of ChiliProject, which is a fork of Redmine. The copyright follows:-# Copyright (C) 2006-2017 Jean-Philippe Lang-# Copyright (C) 2010-2013 the ChiliProject Team-#-# This program is free software; you can redistribute it and/or-# modify it under the terms of the GNU General Public License-# as published by the Free Software Foundation; either version 2-# of the License, or (at your option) any later version.-#-# This program is distributed in the hope that it will be useful,-# but WITHOUT ANY WARRANTY; without even the implied warranty of-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the-# GNU General Public License for more details.-#-# You should have received a copy of the GNU General Public License-# along with this program; if not, write to the Free Software-# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.-#-# See docs/COPYRIGHT.rdoc for more details.-#++--require File.dirname(__FILE__) + '/../spec_helper'--describe CostObjectsHelper, type: :helper do- let(:project) { FactoryBot.build(:project) }- let(:cost_object) { FactoryBot.build(:cost_object, project: project) }-- describe '#cost_objects_to_csv' do- describe 'WITH a list of one cost object' do- it 'should output the cost objects attributes' do- expected = [cost_object.id,- cost_object.project.name,- cost_object.subject,- cost_object.author.name,- helper.format_date(cost_object.fixed_date),- helper.number_to_currency(cost_object.material_budget),- helper.number_to_currency(cost_object.labor_budget),- helper.number_to_currency(cost_object.spent),- helper.format_time(cost_object.created_on),- helper.format_time(cost_object.updated_on),- cost_object.description- ].join(I18n.t(:general_csv_separator))-- expect(cost_objects_to_csv([cost_object]).include?(expected)).to be_truthy- end-- it 'should start with a header explaining the fields' do- expected = ['#',- Project.model_name.human,- CostObject.human_attribute_name(:subject),- CostObject.human_attribute_name(:author),- CostObject.human_attribute_name(:fixed_date),- VariableCostObject.human_attribute_name(:material_budget),- VariableCostObject.human_attribute_name(:labor_budget),- CostObject.human_attribute_name(:spent),- CostObject.human_attribute_name(:created_on),- CostObject.human_attribute_name(:updated_on),- CostObject.human_attribute_name(:description)- ].join(I18n.t(:general_csv_separator))-- expect(cost_objects_to_csv([cost_object]).start_with?(expected)).to be_truthy- end- end- end-enddiff --git a/modules/costs/spec/lib/api/v3/costs_api_user_permission_check_spec.rb b/modules/costs/spec/lib/api/v3/costs_api_user_permission_check_spec.rbindex 75dfc959e06..aba86399e2c 100644--- a/modules/costs/spec/lib/api/v3/costs_api_user_permission_check_spec.rb+++ b/modules/costs/spec/lib/api/v3/costs_api_user_permission_check_spec.rb@@ -26,10 +26,16 @@# See docs/COPYRIGHT.rdoc for more details.#++-require File.expand_path('../../../../spec_helper', __FILE__)+require 'spec_helper'describe API::V3::CostsApiUserPermissionCheck doclass CostsApiUserPermissionCheckTestClass+ # mimick representer+ def view_time_entries_allowed?+ current_user_allowed_to(:view_time_entries, context: represented.project) ||+ current_user_allowed_to(:view_own_time_entries, context: represented.project)+ end+include API::V3::CostsApiUserPermissionCheckend@@ -55,18 +61,17 @@ describe API::V3::CostsApiUserPermissionCheck dolet(:view_cost_rates) { false }let(:view_own_cost_entries) { false }let(:view_cost_entries) { false }- let(:view_cost_objects) { false }+ let(:view_budgets) { false }before do- [:view_time_entries,- :view_own_time_entries,- :view_hourly_rates,- :view_own_hourly_rate,- :view_cost_rates,- :view_own_cost_entries,- :view_cost_entries,- :view_cost_objects].each do |permission|-+ %i[view_time_entries+ view_own_time_entries+ view_hourly_rates+ view_own_hourly_rate+ view_cost_rates+ view_own_cost_entries+ view_cost_entries+ view_budgets].each do |permission|allow(subject).to receive(:current_user_allowed_to).with(permission, context: work_package.project)@@ -75,7 +80,6 @@ describe API::V3::CostsApiUserPermissionCheck doenddescribe '#overall_costs_visible?' do-describe :overall_costs_visible? doshared_examples_for 'not visible' doit 'is not visible' do@@ -259,29 +263,5 @@ describe API::V3::CostsApiUserPermissionCheck doit_behaves_like 'is visible'endend-- context :cost_object_visible? do- shared_examples_for 'not visible' do- it 'is not visible' do- is_expected.to_not be_cost_object_visible- end- end-- shared_examples_for 'is visible' do- it 'is not visible' do- is_expected.to be_cost_object_visible- end- end-- context 'lacks permissions' do- it_behaves_like 'not visible'- end-- context 'has view_costs_entries' do- let(:view_cost_objects) { true }-- it_behaves_like 'is visible'- end- endendenddiff --git a/modules/costs/spec/lib/api/v3/path_helper_spec.rb b/modules/costs/spec/lib/api/v3/path_helper_spec.rbindex 647f4a164b7..bcdc5c935ae 100644--- a/modules/costs/spec/lib/api/v3/path_helper_spec.rb+++ b/modules/costs/spec/lib/api/v3/path_helper_spec.rb@@ -54,28 +54,4 @@ describe ::API::V3::Utilities::PathHelper doit { is_expected.to eql('/api/v3/cost_types/42') }end-- describe '#budget' do- subject { helper.budget 42 }-- it { is_expected.to eql('/api/v3/budgets/42') }- end-- describe '#variable_cost_object' do- subject { helper.variable_cost_object 42 }-- it { is_expected.to eql('/api/v3/budgets/42') }- end-- describe '#budgets_by_project' do- subject { helper.budgets_by_project 42 }-- it { is_expected.to eql('/api/v3/projects/42/budgets') }- end-- describe '#attachments_by_budget' do- subject { helper.attachments_by_budget 42 }-- it { is_expected.to eql('/api/v3/budgets/42/attachments') }- endenddiff --git a/modules/costs/spec/lib/api/v3/work_packages/work_package_payload_representer_rendering_spec.rb b/modules/costs/spec/lib/api/v3/work_packages/work_package_payload_representer_rendering_spec.rbdeleted file mode 100644index ce6d94176ba..00000000000--- a/modules/costs/spec/lib/api/v3/work_packages/work_package_payload_representer_rendering_spec.rb+++ /dev/null@@ -1,90 +0,0 @@-#-- copyright-# OpenProject is an open source project management software.-# Copyright (C) 2012-2020 the OpenProject GmbH-#-# This program is free software; you can redistribute it and/or-# modify it under the terms of the GNU General Public License version 3.-#-# OpenProject is a fork of ChiliProject, which is a fork of Redmine. The copyright follows:-# Copyright (C) 2006-2017 Jean-Philippe Lang-# Copyright (C) 2010-2013 the ChiliProject Team-#-# This program is free software; you can redistribute it and/or-# modify it under the terms of the GNU General Public License-# as published by the Free Software Foundation; either version 2-# of the License, or (at your option) any later version.-#-# This program is distributed in the hope that it will be useful,-# but WITHOUT ANY WARRANTY; without even the implied warranty of-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the-# GNU General Public License for more details.-#-# You should have received a copy of the GNU General Public License-# along with this program; if not, write to the Free Software-# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.-#-# See docs/COPYRIGHT.rdoc for more details.-#++--require 'spec_helper'--describe ::API::V3::WorkPackages::WorkPackagePayloadRepresenter, 'rendering' do- include API::V3::Utilities::PathHelper-- let(:work_package) do- FactoryBot.build_stubbed(:stubbed_work_package,- start_date: Date.today.to_datetime,- due_date: Date.today.to_datetime,- created_at: DateTime.now,- updated_at: DateTime.now,- cost_object: cost_object,- type: FactoryBot.build_stubbed(:type)) do |wp|- end- end-- let(:cost_object) { FactoryBot.build_stubbed(:cost_object) }-- let(:permissions) { %i(view_cost_objects edit_work_packages) }-- let(:project) { work_package.project }-- include_context 'user with stubbed permissions'-- let(:representer) do- ::API::V3::WorkPackages::WorkPackagePayloadRepresenter- .create(work_package, current_user: user)- end-- subject(:generated) { representer.to_json }-- describe '_links' do- describe 'costObject' do- context 'without a cost object assigned' do- let(:cost_object) { nil }-- it 'has an empty href' do- expect(subject)- .to be_json_eql(nil.to_json)- .at_path '_links/costObject/href'- end- end-- context 'with a cost object assigned' do- it 'has an href to the cost object' do- expect(subject)- .to be_json_eql(api_v3_paths.budget(cost_object.id).to_json)- .at_path '_links/costObject/href'- end- end-- context 'without necessary permissions' do- let(:permissions) { %i(edit_work_packages) }-- it 'has no href' do- expect(subject)- .not_to have_json_path('_links/costObject')- end- end- end- end-enddiff --git a/modules/costs/spec/lib/api/v3/work_packages/work_package_representer_spec.rb b/modules/costs/spec/lib/api/v3/work_packages/work_package_representer_spec.rbindex 9dc0a458f57..3eb5488dbad 100644--- a/modules/costs/spec/lib/api/v3/work_packages/work_package_representer_spec.rb+++ b/modules/costs/spec/lib/api/v3/work_packages/work_package_representer_spec.rb@@ -34,9 +34,9 @@ describe ::API::V3::WorkPackages::WorkPackageRepresenter dolet(:project) { FactoryBot.create(:project) }let(:role) doFactoryBot.create(:role, permissions: [:view_time_entries,- :view_cost_entries,- :view_cost_rates,- :view_work_packages])+ :view_cost_entries,+ :view_cost_rates,+ :view_work_packages])endlet(:user) doFactoryBot.create(:user,@@ -44,7 +44,6 @@ describe ::API::V3::WorkPackages::WorkPackageRepresenter domember_through_role: role)end- let(:cost_object) { FactoryBot.create(:cost_object, project: project) }let(:cost_entry_1) doFactoryBot.create(:cost_entry,work_package: work_package,@@ -66,8 +65,7 @@ describe ::API::V3::WorkPackages::WorkPackageRepresenter dolet(:work_package) doFactoryBot.create(:work_package,- project_id: project.id,- cost_object: cost_object)+ project_id: project.id)endlet(:representer) dodescribed_class.new(work_package,@@ -95,25 +93,6 @@ describe ::API::V3::WorkPackages::WorkPackageRepresenter doit { is_expected.to have_json_path('overallCosts') }- describe 'budget' do- before do- allow(representer)- .to receive(:cost_object_visible?)- .and_return(true)- end-- it_behaves_like 'has a titled link' do- let(:link) { 'costObject' }- let(:href) { "/api/v3/budgets/#{cost_object.id}" }- let(:title) { cost_object.subject }- end-- it 'has the budget embedded' do- is_expected.to be_json_eql(cost_object.subject.to_json)- .at_path('_embedded/costObject/subject')- end- end-it_behaves_like 'has an untitled link' dolet(:link) { 'costsByType' }let(:href) { api_v3_paths.summarized_work_package_costs_by_type work_package.id }@@ -161,7 +140,7 @@ describe ::API::V3::WorkPackages::WorkPackageRepresenter docontext 'only view_own_time_entries permission' dolet(:own_time_entries_role) doFactoryBot.create(:role, permissions: [:view_own_time_entries,- :view_work_packages])+ :view_work_packages])endlet(:user2) do@@ -229,12 +208,12 @@ describe ::API::V3::WorkPackages::WorkPackageRepresenter dobefore doallow(user).to receive(:allowed_to?)- .with(:view_own_time_entries, cost_object.project)+ .with(:view_own_time_entries, work_package.project).and_return trueallow(user).to receive(:allowed_to?)- .with(:view_own_hourly_rate, cost_object.project)+ .with(:view_own_hourly_rate, work_package.project).and_return trueend@@ -281,7 +260,7 @@ describe ::API::V3::WorkPackages::WorkPackageRepresenter dobefore doallow(user).to receive(:allowed_to?)- .with(:view_cost_entries, cost_object.project)+ .with(:view_cost_entries, work_package.project).and_return trueallow(user)@@ -333,12 +312,12 @@ describe ::API::V3::WorkPackages::WorkPackageRepresenter dobefore doallow(user).to receive(:allowed_to?)- .with(:view_own_time_entries, cost_object.project)+ .with(:view_own_time_entries, work_package.project).and_return trueallow(user).to receive(:allowed_to?)- .with(:view_own_hourly_rate, cost_object.project)+ .with(:view_own_hourly_rate, work_package.project).and_return trueend@@ -369,7 +348,7 @@ describe ::API::V3::WorkPackages::WorkPackageRepresenter dobefore doallow(user).to receive(:allowed_to?)- .with(:view_cost_entries, cost_object.project)+ .with(:view_cost_entries, work_package.project).and_return trueallow(user)@@ -404,7 +383,7 @@ describe ::API::V3::WorkPackages::WorkPackageRepresenter doit 'exists if user has view_time_entries permission' doallow(user).to receive(:allowed_to?).and_return falseallow(user).to receive(:allowed_to?).with(:view_time_entries,- cost_object.project)+ work_package.project).and_return trueis_expected.to have_json_path('_links/timeEntries/href')@@ -413,7 +392,7 @@ describe ::API::V3::WorkPackages::WorkPackageRepresenter doit 'has spentTime link when user only has view_own_time_entries permission' doallow(user).to receive(:allowed_to?).and_return falseallow(user).to receive(:allowed_to?).with(:view_own_time_entries,- cost_object.project)+ work_package.project).and_return trueis_expected.to have_json_path('_links/timeEntries/href')@@ -432,8 +411,6 @@ describe ::API::V3::WorkPackages::WorkPackageRepresenter doit { is_expected.not_to have_json_path('spentHours') }describe 'embedded' do- it { is_expected.not_to have_json_path('_embedded/costObject') }-it { is_expected.not_to have_json_path('_embedded/summarizedCostEntries') }endend@@ -442,12 +419,4 @@ describe ::API::V3::WorkPackages::WorkPackageRepresenter doit { is_expected.not_to have_json_path('_links/log_costs') }endend-- describe '.to_eager_load' do- it 'includes the cost objects' do- expect(described_class.to_eager_load.any? do |el|- el == :cost_object- end).to be_truthy- end- endenddiff --git a/modules/costs/spec/lib/api/v3/work_packages/work_package_schema_representer_spec.rb b/modules/costs/spec/lib/api/v3/work_packages/work_package_schema_representer_spec.rbindex 3937a0541d6..f1ce33fd1d2 100644--- a/modules/costs/spec/lib/api/v3/work_packages/work_package_schema_representer_spec.rb+++ b/modules/costs/spec/lib/api/v3/work_packages/work_package_schema_representer_spec.rb@@ -60,48 +60,6 @@ describe ::API::V3::WorkPackages::Schema::WorkPackageSchemaRepresenter dologin_as(current_user)end- shared_examples_for 'has a collection of allowed values' do- let(:embedded) { true }-- before do- allow(schema).to receive(:assignable_values).and_return(nil)- end-- context 'when no values are allowed' do- before do- allow(schema).to receive(:assignable_values).with(factory, anything).and_return([])- end-- it_behaves_like 'links to and embeds allowed values directly' do- let(:path) { json_path }- let(:hrefs) { [] }- end- end-- context 'when values are allowed' do- let(:values) { FactoryBot.build_stubbed_list(factory, 3) }-- before do- allow(schema).to receive(:assignable_values).with(factory, anything).and_return(values)- end-- it_behaves_like 'links to and embeds allowed values directly' do- let(:path) { json_path }- let(:hrefs) { values.map { |value| "/api/v3/#{href_path}/#{value.id}" } }- end- end-- context 'when not embedded' do- before do- allow(schema).to receive(:assignable_values).with(factory, anything).and_return(nil)- end-- it_behaves_like 'does not link to allowed values' do- let(:path) { json_path }- end- end- end-describe 'overallCosts' docontext 'has the permissions' dobefore do@@ -213,30 +171,4 @@ describe ::API::V3::WorkPackages::Schema::WorkPackageSchemaRepresenter doit { is_expected.not_to have_json_path('costsByType') }endend-- describe 'budget' do- it_behaves_like 'has basic schema properties' do- let(:path) { 'costObject' }- let(:type) { 'Budget' }- let(:name) { I18n.t('attributes.cost_object') }- let(:required) { false }- let(:writable) { true }- end-- it_behaves_like 'has a collection of allowed values' do- let(:json_path) { 'costObject' }- let(:href_path) { 'budgets' }- let(:factory) { :cost_object }- end-- context 'costs disabled' do- before do- allow(schema.project).to receive(:costs_enabled?).and_return(false)- end-- it 'has no schema for budget' do- is_expected.not_to have_json_path('costObject')- end- end- endenddiff --git a/modules/costs/spec/lib/api/v3/work_packages/work_package_sums_representer_spec.rb b/modules/costs/spec/lib/api/v3/work_packages/work_package_sums_representer_spec.rbindex 9cbc930f4c3..6450649eb41 100644--- a/modules/costs/spec/lib/api/v3/work_packages/work_package_sums_representer_spec.rb+++ b/modules/costs/spec/lib/api/v3/work_packages/work_package_sums_representer_spec.rb@@ -32,9 +32,9 @@ describe ::API::V3::WorkPackages::WorkPackageSumsRepresenter dolet(:sums) { double 'sums', material_costs: 5, labor_costs: 10, overall_costs: 15 }let(:schema) { double 'schema', available_custom_fields: [] }let(:user) { FactoryBot.build_stubbed(:user) }- let(:representer) {+ let(:representer) dodescribed_class.create_class(schema, user).new(sums)- }+ endlet(:summable_columns) { [] }before dodiff --git a/modules/costs/spec/lib/open_project/costs/default_data_spec.rb b/modules/costs/spec/lib/open_project/costs/default_data_spec.rbindex 5fb77f26567..ce52300ca3d 100644--- a/modules/costs/spec/lib/open_project/costs/default_data_spec.rb+++ b/modules/costs/spec/lib/open_project/costs/default_data_spec.rb@@ -28,10 +28,10 @@require 'spec_helper'-describe OpenProject::Costs::DefaultData do+describe Costs::DefaultData dolet(:seeder) { BasicData::RoleSeeder.new }- let(:member) { OpenProject::Costs::DefaultData.member_role }- let(:permissions) { OpenProject::Costs::DefaultData.member_permissions }+ let(:member) { Costs::DefaultData.member_role }+ let(:permissions) { Costs::DefaultData.member_permissions }before doallow(seeder).to receive(:builtin_roles).and_return([])diff --git a/modules/costs/spec/models/permitted_params_spec.rb b/modules/costs/spec/models/permitted_params_spec.rbindex a316a50b069..9d9ef78969d 100644--- a/modules/costs/spec/models/permitted_params_spec.rb+++ b/modules/costs/spec/models/permitted_params_spec.rb@@ -93,88 +93,6 @@ describe PermittedParams, type: :model doendend- describe '#cost_object' do- let(:attribute) { :cost_object }-- context 'subject' do- let(:hash) { { 'subject' => 'subject_test' } }-- it_behaves_like 'allows params'- end-- context 'description' do- let(:hash) { { 'description' => 'description_test' } }-- it_behaves_like 'allows params'- end-- context 'fixed_date' do- let(:hash) { { 'fixed_date' => '2017-03-01' } }-- it_behaves_like 'allows params'- end-- context 'project_id' do- let(:hash) { { 'project_id' => 42 } }-- it_behaves_like 'allows params' do- let(:allowed_params) { {} }- end- end-- context 'existing material budget item' do- let(:hash) do- { 'existing_material_budget_item_attributes' => { '1' => {- 'units' => '100.0',- 'cost_type_id' => '1',- 'comments' => 'First package',- 'budget' => '5,000.00'- } } }- end-- it_behaves_like 'allows params'- end-- context 'new material budget item' do- let(:hash) do- { 'new_material_budget_item_attributes' => { '1' => {- 'units' => '20',- 'cost_type_id' => '2',- 'comments' => 'Macbooks',- 'budget' => '52,000.00'- } } }- end-- it_behaves_like 'allows params'- end-- context 'existing labor budget item' do- let(:hash) do- { 'existing_labor_budget_item_attributes' => { '1' => {- 'hours' => '20.0',- 'user_id' => '1',- 'comments' => 'App Setup',- 'budget' => '2000.00'- } } }- end-- it_behaves_like 'allows params'- end-- context 'new labor budget item' do- let(:hash) do- { 'new_labor_budget_item_attributes' => { '1' => {- 'hours' => '5.0',- 'user_id' => '2',- 'comments' => 'Overhead',- 'budget' => '400'- } } }- end-- it_behaves_like 'allows params'- end- end-describe '#cost_type' dolet(:attribute) { :cost_type }@@ -249,15 +167,4 @@ describe PermittedParams, type: :model doit_behaves_like 'allows params'endend-- describe '#update_work_package' do- let(:attribute) { :update_work_package }- let(:hash_key) { :work_package }-- context 'cost_object_id' do- let(:hash) { { 'cost_object_id' => '1' } }-- it_behaves_like 'allows params'- end- endenddiff --git a/modules/costs/spec/models/project/activity_spec.rb b/modules/costs/spec/models/project/activity_spec.rbindex f7068ed9d15..4cff987376f 100644--- a/modules/costs/spec/models/project/activity_spec.rb+++ b/modules/costs/spec/models/project/activity_spec.rb@@ -35,13 +35,13 @@ describe Projects::Activity, type: :model dolet(:initial_time) { Time.now }- let(:cost_object) do- FactoryBot.create(:cost_object,+ let(:budget) do+ FactoryBot.create(:budget,project: project)end- let(:cost_object2) do- FactoryBot.create(:cost_object,+ let(:budget2) do+ FactoryBot.create(:budget,project: project)end@@ -55,35 +55,35 @@ describe Projects::Activity, type: :model doenddescribe '.with_latest_activity' do- it 'is the latest cost_object update' do- cost_object.update_attribute(:updated_on, initial_time - 10.seconds)- cost_object2.update_attribute(:updated_on, initial_time - 20.seconds)- cost_object.reload- cost_object2.reload+ it 'is the latest budget update' do+ budget.update_attribute(:updated_at, initial_time - 10.seconds)+ budget2.update_attribute(:updated_at, initial_time - 20.seconds)+ budget.reload+ budget2.reload- expect(latest_activity).to eql cost_object.updated_on+ expect(latest_activity).to eql budget.updated_atendit 'takes the time stamp of the latest activity across models' dowork_package.update_attribute(:updated_at, initial_time - 10.seconds)- cost_object.update_attribute(:updated_on, initial_time - 20.seconds)+ budget.update_attribute(:updated_at, initial_time - 20.seconds)work_package.reload- cost_object.reload+ budget.reload# Order:# work_package- # cost_object+ # budgetexpect(latest_activity).to eql work_package.updated_at- work_package.update_attribute(:updated_at, cost_object.updated_on - 10.seconds)+ work_package.update_attribute(:updated_at, budget.updated_at - 10.seconds)# Order:- # cost_object+ # budget# work_package- expect(latest_activity).to eql cost_object.updated_on+ expect(latest_activity).to eql budget.updated_atendendenddiff --git a/spec/models/queries/time_entries/filters/activity_filter_spec.rb b/modules/costs/spec/models/queries/time_entries/filters/activity_filter_spec.rbsimilarity index 100%rename from spec/models/queries/time_entries/filters/activity_filter_spec.rbrename to modules/costs/spec/models/queries/time_entries/filters/activity_filter_spec.rbdiff --git a/spec/models/queries/time_entries/filters/created_on_filter_spec.rb b/modules/costs/spec/models/queries/time_entries/filters/created_on_filter_spec.rbsimilarity index 100%rename from spec/models/queries/time_entries/filters/created_on_filter_spec.rbrename to modules/costs/spec/models/queries/time_entries/filters/created_on_filter_spec.rbdiff --git a/spec/models/queries/time_entries/filters/project_filter_spec.rb b/modules/costs/spec/models/queries/time_entries/filters/project_filter_spec.rbsimilarity index 100%rename from spec/models/queries/time_entries/filters/project_filter_spec.rbrename to modules/costs/spec/models/queries/time_entries/filters/project_filter_spec.rbdiff --git a/spec/models/queries/time_entries/filters/spent_on_filter_spec.rb b/modules/costs/spec/models/queries/time_entries/filters/spent_on_filter_spec.rbsimilarity index 100%rename from spec/models/queries/time_entries/filters/spent_on_filter_spec.rbrename to modules/costs/spec/models/queries/time_entries/filters/spent_on_filter_spec.rbdiff --git a/spec/models/queries/time_entries/filters/user_filter_spec.rb b/modules/costs/spec/models/queries/time_entries/filters/user_filter_spec.rbsimilarity index 100%rename from spec/models/queries/time_entries/filters/user_filter_spec.rbrename to modules/costs/spec/models/queries/time_entries/filters/user_filter_spec.rbdiff --git a/spec/models/queries/time_entries/filters/work_package_filter_spec.rb b/modules/costs/spec/models/queries/time_entries/filters/work_package_filter_spec.rbsimilarity index 100%rename from spec/models/queries/time_entries/filters/work_package_filter_spec.rbrename to modules/costs/spec/models/queries/time_entries/filters/work_package_filter_spec.rbdiff --git a/spec/models/queries/time_entries/time_entry_query_spec.rb b/modules/costs/spec/models/queries/time_entries/time_entry_query_spec.rbsimilarity index 100%rename from spec/models/queries/time_entries/time_entry_query_spec.rbrename to modules/costs/spec/models/queries/time_entries/time_entry_query_spec.rbdiff --git a/spec/models/time_entry/scopes/of_user_and_day_spec.rb b/modules/costs/spec/models/time_entry/scopes/of_user_and_day_spec.rbsimilarity index 100%rename from spec/models/time_entry/scopes/of_user_and_day_spec.rbrename to modules/costs/spec/models/time_entry/scopes/of_user_and_day_spec.rbdiff --git a/modules/costs/spec/models/time_entry/scopes/visible_spec.rb b/modules/costs/spec/models/time_entry/scopes/visible_spec.rbnew file mode 100644index 00000000000..aa304dc280f--- /dev/null+++ b/modules/costs/spec/models/time_entry/scopes/visible_spec.rb@@ -0,0 +1,89 @@+#-- encoding: UTF-8++#-- copyright+# OpenProject is a project management system.+# Copyright (C) 2012-2018 the OpenProject Foundation (OPF)+#+# This program is free software; you can redistribute it and/or+# modify it under the terms of the GNU General Public License version 3.+#+# OpenProject is a fork of ChiliProject, which is a fork of Redmine. The copyright follows:+# Copyright (C) 2006-2017 Jean-Philippe Lang+# Copyright (C) 2010-2013 the ChiliProject Team+#+# This program is free software; you can redistribute it and/or+# modify it under the terms of the GNU General Public License+# as published by the Free Software Foundation; either version 2+# of the License, or (at your option) any later version.+#+# This program is distributed in the hope that it will be useful,+# but WITHOUT ANY WARRANTY; without even the implied warranty of+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the+# GNU General Public License for more details.+#+# You should have received a copy of the GNU General Public License+# along with this program; if not, write to the Free Software+# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.+#+# See docs/COPYRIGHT.rdoc for more details.+#++++require 'spec_helper'++describe TimeEntry::Scopes::Visible, type: :model do+ let(:project) { FactoryBot.create(:project) }+ let(:user) do+ FactoryBot.create(:user,+ member_in_project: project,+ member_with_permissions: permissions)+ end+ let(:permissions) { [:view_time_entries] }++ let(:work_package) do+ FactoryBot.create(:work_package,+ project: project,+ author: user2)+ end+ let(:user2) do+ FactoryBot.create(:user)+ end+ let!(:own_project_time_entry) do+ FactoryBot.create(:time_entry,+ project: project,+ work_package: work_package,+ hours: 2,+ user: user)+ end+ let!(:project_time_entry) do+ FactoryBot.create(:time_entry,+ project: project,+ work_package: work_package,+ hours: 2,+ user: user2)+ end+ let!(:own_other_project_time_entry) do+ FactoryBot.create(:time_entry,+ project: FactoryBot.create(:project),+ user: user)+ end++ describe '.fetch' do+ subject { described_class.fetch(user) }++ context 'for a user having the view_time_entries permission' do+ it 'retrieves all the time entries of projects the user has the permissions in' do+ expect(subject)+ .to match_array([own_project_time_entry, project_time_entry])+ end+ end++ context 'for a user having the view_own_time_entries permission' do+ let(:permissions) { [:view_own_time_entries] }++ it 'retrieves all the time entries of the user in projects the user has the permissions in' do+ expect(subject)+ .to match_array([own_project_time_entry])+ end+ end+ end+enddiff --git a/spec/models/time_entry_activity/scopes/active_in_project_spec.rb b/modules/costs/spec/models/time_entry_activity/scopes/active_in_project_spec.rbsimilarity index 100%rename from spec/models/time_entry_activity/scopes/active_in_project_spec.rbrename to modules/costs/spec/models/time_entry_activity/scopes/active_in_project_spec.rbdiff --git a/modules/costs/spec/models/time_entry_spec.rb b/modules/costs/spec/models/time_entry_spec.rbindex a3a464efe89..62485b1f03c 100644--- a/modules/costs/spec/models/time_entry_spec.rb+++ b/modules/costs/spec/models/time_entry_spec.rb@@ -1,3 +1,5 @@+#-- encoding: UTF-8+#-- copyright# OpenProject is an open source project management software.# Copyright (C) 2012-2020 the OpenProject GmbH@@ -26,22 +28,21 @@# See docs/COPYRIGHT.rdoc for more details.#++-require File.expand_path(File.dirname(__FILE__) + '/../spec_helper')+require 'spec_helper'describe TimeEntry, type: :model do- include Cost::PluginSpecHelperlet(:project) { FactoryBot.create(:project_with_types, public: false) }let(:project2) { FactoryBot.create(:project_with_types, public: false) }- let(:work_package) {+ let(:work_package) doFactoryBot.create(:work_package, project: project,- type: project.types.first,- author: user)- }- let(:work_package2) {+ type: project.types.first,+ author: user)+ end+ let(:work_package2) doFactoryBot.create(:work_package, project: project2,- type: project2.types.first,- author: user2)- }+ type: project2.types.first,+ author: user2)+ endlet(:user) { FactoryBot.create(:user) }let(:user2) { FactoryBot.create(:user) }let(:date) { Date.today }@@ -54,23 +55,59 @@ describe TimeEntry, type: :model dolet!(:default_hourly_five) { FactoryBot.create(:default_hourly_rate, valid_from: 6.days.ago, project: project, user: user2) }let(:hours) { 5.0 }let(:time_entry) do- FactoryBot.create(:time_entry, project: project,- work_package: work_package,- spent_on: date,- hours: hours,- user: user,- rate: hourly_one,- comments: 'lorem')+ FactoryBot.create(:time_entry,+ project: project,+ work_package: work_package,+ spent_on: date,+ hours: hours,+ user: user,+ rate: hourly_one,+ comments: 'lorem')endlet(:time_entry2) do- FactoryBot.create(:time_entry, project: project,- work_package: work_package,- spent_on: date,- hours: hours,- user: user,- rate: hourly_one,- comments: 'lorem')+ FactoryBot.create(:time_entry,+ project: project,+ work_package: work_package,+ spent_on: date,+ hours: hours,+ user: user,+ rate: hourly_one,+ comments: 'lorem')+ end++ def is_member(project, user, permissions)+ FactoryBot.create(:member,+ project: project,+ user: user,+ roles: [FactoryBot.create(:role, permissions: permissions)])+ end++ describe '#hours' do+ formats = { '2' => 2.0,+ '21.1' => 21.1,+ '2,1' => 2.1,+ '1,5h' => 1.5,+ '7:12' => 7.2,+ '10h' => 10.0,+ '10 h' => 10.0,+ '45m' => 0.75,+ '45 m' => 0.75,+ '3h15' => 3.25,+ '3h 15' => 3.25,+ '3 h 15' => 3.25,+ '3 h 15m' => 3.25,+ '3 h 15 m' => 3.25,+ '3 hours' => 3.0,+ '12min' => 0.2 }++ formats.each do |from, to|+ it "formats '#{from}'" do+ t = TimeEntry.new(hours: from)+ expect(t.hours)+ .to eql to+ end+ endendit 'should always prefer overridden_costs' do@@ -255,7 +292,7 @@ describe TimeEntry, type: :model dodescribe '#costs_visible_by?' dobefore do- project.enabled_module_names = project.enabled_module_names << 'costs_module'+ project.enabled_module_names = project.enabled_module_names << 'costs'enddescribe "WHEN the time_entry is assigned to the user@@ -326,7 +363,7 @@ describe TimeEntry, type: :model doendcontext 'when having the view_own_time_entries permission ' +- 'and being the owner of the time entry' do+ 'and being the owner of the time entry' dobefore dois_member(project, user, [:view_own_time_entries])@@ -339,7 +376,7 @@ describe TimeEntry, type: :model doendcontext 'when having the view_own_time_entries permission ' +- 'and not being the owner of the time entry' do+ 'and not being the owner of the time entry' dobefore dois_member(project, user, [:view_own_time_entries])@@ -351,128 +388,4 @@ describe TimeEntry, type: :model doendendend-- describe 'class' do- describe '#visible' do- describe "WHEN having the view_time_entries permission- WHEN querying for a project- WHEN a time entry from another user is defined" do- before do- is_member(project, user2, [:view_time_entries])-- time_entry.save!- end-- it { expect(TimeEntry.visible(user2, project)).to match_array([time_entry]) }- end-- describe "WHEN not having the view_time_entries permission- WHEN querying for a project- WHEN a time entry from another user is defined" do- before do- is_member(project, user2, [])-- time_entry.save!- end-- it { expect(TimeEntry.visible(user2, project)).to match_array([]) }- end-- describe "WHEN having the view_own_time_entries permission- WHEN querying for a project- WHEN a time entry from another user is defined" do- before do- is_member(project, user2, [:view_own_time_entries])- # don't understand why memberships get loaded on the user- time_entry2.user.memberships.reload-- time_entry.save!- end-- it { expect(TimeEntry.visible(user2, project)).to match_array([]) }- end-- describe "WHEN having the view_own_time_entries permission- WHEN querying for a project- WHEN a time entry from the user is defined" do- before do- is_member(project, time_entry2.user, [:view_own_time_entries])- # don't understand why memberships get loaded on the user- time_entry2.user.memberships.reload-- time_entry2.save!- end-- it { expect(TimeEntry.visible(time_entry2.user, project)).to match_array([time_entry2]) }- end- end-- context 'calculate dates' do- let(:my_role) { FactoryBot.create(:role, permissions: [:view_own_time_entries]) }- let(:user3) do- FactoryBot.create(:user, member_in_project: project, member_through_role: my_role)- end-- let(:late_time_entry) do- FactoryBot.create(:time_entry,- project: project,- work_package: work_package,- spent_on: 2.days.ago,- hours: hours,- user: user3,- rate: hourly_one,- comments: 'ipsum')- end- let(:early_time_entry) do- FactoryBot.create(:time_entry,- project: project,- work_package: work_package,- spent_on: 4.days.ago,- hours: hours,- user: user3,- rate: hourly_one,- comments: 'dolor')- end- let(:other_time_entry) do- FactoryBot.create(:time_entry,- project: project,- work_package: work_package,- spent_on: 6.days.ago,- hours: hours,- user: user2,- rate: hourly_one,- comments: 'dolor')- end- let(:another_time_entry) do- FactoryBot.create(:time_entry,- project: project,- work_package: work_package,- spent_on: 1.days.ago,- hours: hours,- user: user2,- rate: hourly_one,- comments: 'dolor')- end-- before do- early_time_entry.save!- late_time_entry.save!- other_time_entry.save!- another_time_entry.save!-- allow(User).to receive(:current).and_return(user3)- end- describe '#earliest_date_for_project' do- it 'returns the earliest date' do- expect(TimeEntry.earliest_date_for_project(project)).to eq(early_time_entry.spent_on)- end- end-- describe '#latest_date_for_project' do- it 'returns the latest date' do- expect(TimeEntry.latest_date_for_project(project)).to eq(late_time_entry.spent_on)- end- end- end- endenddiff --git a/modules/costs/spec/models/user_deletion_spec.rb b/modules/costs/spec/models/user_deletion_spec.rbindex f08788f8d3a..f9f3377181a 100644--- a/modules/costs/spec/models/user_deletion_spec.rb+++ b/modules/costs/spec/models/user_deletion_spec.rb@@ -124,16 +124,16 @@ describe User, '#destroy', type: :model dodescribe 'WHEN the user updated a cost object' dolet(:associations) { [:author] }- let(:associated_instance) { FactoryBot.build(:variable_cost_object) }- let(:associated_class) { CostObject }+ let(:associated_instance) { FactoryBot.build(:budget) }+ let(:associated_class) { Budget }it_should_behave_like 'costs updated journalized associated object'enddescribe 'WHEN the user created a cost object' dolet(:associations) { [:author] }- let(:associated_instance) { FactoryBot.build(:variable_cost_object) }- let(:associated_class) { CostObject }+ let(:associated_instance) { FactoryBot.build(:budget) }+ let(:associated_class) { Budget }it_should_behave_like 'costs created journalized associated object'enddiff --git a/modules/costs/spec/models/work_package_spec.rb b/modules/costs/spec/models/work_package_spec.rbindex ce3669b6fa8..2c82de5ffe4 100644--- a/modules/costs/spec/models/work_package_spec.rb+++ b/modules/costs/spec/models/work_package_spec.rb@@ -44,7 +44,7 @@ describe WorkPackage, type: :model doauthor: user)}let!(:cost_entry) { FactoryBot.create(:cost_entry, work_package: work_package, project: project, units: 3, spent_on: Date.today, user: user, comments: 'test entry') }- let!(:cost_object) { FactoryBot.create(:cost_object, project: project) }+ let!(:budget) { FactoryBot.create(:budget, project: project) }def move_to_project(work_package, project)service = WorkPackages::MoveService.new(work_package, user)@@ -58,13 +58,13 @@ describe WorkPackage, type: :model doexpect(cost_entry.reload.project_id).to eql project2.idend- it 'should allow to set cost_object to nil' do- work_package.cost_object = cost_object+ it 'should allow to set budget to nil' do+ work_package.budget = budgetwork_package.save!- expect(work_package.cost_object).to eql cost_object+ expect(work_package.budget).to eql budgetwork_package.reload- work_package.cost_object = nil+ work_package.budget = nilexpect { work_package.save! }.not_to raise_errorendenddiff --git a/modules/costs/spec/requests/api/attachments/attachments_by_budget_resource_spec.rb b/modules/costs/spec/requests/api/attachments/attachments_by_budget_resource_spec.rbindex 17ab36122c1..911c3958c98 100644--- a/modules/costs/spec/requests/api/attachments/attachments_by_budget_resource_spec.rb+++ b/modules/costs/spec/requests/api/attachments/attachments_by_budget_resource_spec.rb@@ -40,8 +40,8 @@ describe 'API v3 Attachments by budget resource', type: :request domember_with_permissions: permissions)endlet(:project) { FactoryBot.create(:project) }- let(:permissions) { [:view_cost_objects] }- let(:budget) { FactoryBot.create(:cost_object, project: project) }+ let(:permissions) { [:view_budgets] }+ let(:budget) { FactoryBot.create(:budget, project: project) }subject(:response) { last_response }@@ -65,7 +65,7 @@ describe 'API v3 Attachments by budget resource', type: :request doenddescribe '#post' do- let(:permissions) { %i[view_cost_objects edit_cost_objects] }+ let(:permissions) { %i[view_budgets edit_budgets] }let(:request_path) { api_v3_paths.attachments_by_budget budget.id }let(:request_parts) { { metadata: metadata, file: file } }diff --git a/spec/requests/api/v3/time_entries/available_projects_resource_spec.rb b/modules/costs/spec/requests/api/time_entries/available_projects_resource_spec.rbsimilarity index 100%rename from spec/requests/api/v3/time_entries/available_projects_resource_spec.rbrename to modules/costs/spec/requests/api/time_entries/available_projects_resource_spec.rbdiff --git a/spec/requests/api/v3/time_entries/create_form_resource_spec.rb b/modules/costs/spec/requests/api/time_entries/create_form_resource_spec.rbsimilarity index 100%rename from spec/requests/api/v3/time_entries/create_form_resource_spec.rbrename to modules/costs/spec/requests/api/time_entries/create_form_resource_spec.rbdiff --git a/spec/requests/api/v3/time_entries/schemas/time_entry_schema_resource_spec.rb b/modules/costs/spec/requests/api/time_entries/schemas/time_entry_schema_resource_spec.rbsimilarity index 100%rename from spec/requests/api/v3/time_entries/schemas/time_entry_schema_resource_spec.rbrename to modules/costs/spec/requests/api/time_entries/schemas/time_entry_schema_resource_spec.rbdiff --git a/spec/requests/api/v3/time_entries/update_form_resource_spec.rb b/modules/costs/spec/requests/api/time_entries/update_form_resource_spec.rbsimilarity index 100%rename from spec/requests/api/v3/time_entries/update_form_resource_spec.rbrename to modules/costs/spec/requests/api/time_entries/update_form_resource_spec.rbdiff --git a/spec/requests/api/v3/time_entry_activity_resource_spec.rb b/modules/costs/spec/requests/api/time_entry_activity_resource_spec.rbsimilarity index 100%rename from spec/requests/api/v3/time_entry_activity_resource_spec.rbrename to modules/costs/spec/requests/api/time_entry_activity_resource_spec.rbdiff --git a/spec/requests/api/v3/time_entry_resource_spec.rb b/modules/costs/spec/requests/api/time_entry_resource_spec.rbsimilarity index 99%rename from spec/requests/api/v3/time_entry_resource_spec.rbrename to modules/costs/spec/requests/api/time_entry_resource_spec.rbindex 9e42f5fb982..9029ffd2a70 100644--- a/spec/requests/api/v3/time_entry_resource_spec.rb+++ b/modules/costs/spec/requests/api/time_entry_resource_spec.rb@@ -649,7 +649,7 @@ describe 'API v3 time_entry resource', type: :request docontext 'with permission to delete own time entries' doit_behaves_like 'does not delete the time_entry', 403- end+ endendendenddiff --git a/modules/costs/spec/requests/api/work_packages/work_package_form_resource_spec.rb b/modules/costs/spec/requests/api/work_packages/work_package_form_resource_spec.rbdeleted file mode 100644index 91f799420fb..00000000000--- a/modules/costs/spec/requests/api/work_packages/work_package_form_resource_spec.rb+++ /dev/null@@ -1,154 +0,0 @@-#-- copyright-# OpenProject is an open source project management software.-# Copyright (C) 2012-2020 the OpenProject GmbH-#-# This program is free software; you can redistribute it and/or-# modify it under the terms of the GNU General Public License version 3.-#-# OpenProject is a fork of ChiliProject, which is a fork of Redmine. The copyright follows:-# Copyright (C) 2006-2017 Jean-Philippe Lang-# Copyright (C) 2010-2013 the ChiliProject Team-#-# This program is free software; you can redistribute it and/or-# modify it under the terms of the GNU General Public License-# as published by the Free Software Foundation; either version 2-# of the License, or (at your option) any later version.-#-# This program is distributed in the hope that it will be useful,-# but WITHOUT ANY WARRANTY; without even the implied warranty of-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the-# GNU General Public License for more details.-#-# You should have received a copy of the GNU General Public License-# along with this program; if not, write to the Free Software-# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.-#-# See docs/COPYRIGHT.rdoc for more details.-#++--require 'spec_helper'-require 'rack/test'--describe 'API v3 Work package form resource', type: :request do- include Rack::Test::Methods- include Capybara::RSpecMatchers- include API::V3::Utilities::PathHelper-- let(:project) { FactoryBot.create(:project, public: false) }- let(:work_package) { FactoryBot.create(:work_package, project: project) }- let(:role) { FactoryBot.create(:role, permissions: permissions) }- let(:authorized_user) do- FactoryBot.create(:user,- member_in_project: project,- member_through_role: role)- end-- let(:permissions) { [:view_work_packages, :edit_work_packages, :view_cost_objects] }-- describe '#post' do- let(:post_path) { api_v3_paths.work_package_form work_package.id }- let(:valid_params) do- {- _type: 'WorkPackage',- lockVersion: work_package.lock_version- }- end-- subject(:response) { last_response }-- shared_context 'post request' do- before(:each) do- allow(User).to receive(:current).and_return current_user- post post_path, (params ? params.to_json : nil), 'CONTENT_TYPE' => 'application/json'- end- end-- context 'user with needed permissions' do- let(:params) {}- let(:current_user) { authorized_user }-- context 'existing work package' do- shared_examples_for 'having no errors' do- it {- expect(subject.body).to be_json_eql({}.to_json)- .at_path('_embedded/validationErrors')- }- end-- shared_examples_for 'having an error' do |property|- it { expect(subject.body).to have_json_path("_embedded/validationErrors/#{property}") }-- describe 'error body' do- let(:error_id) { 'urn:openproject-org:api:v3:errors:PropertyConstraintViolation' }-- let(:error_body) {- parse_json(subject.body)['_embedded']['validationErrors'][property]- }-- it { expect(error_body['errorIdentifier']).to eq(error_id) }- end- end-- describe 'body' do- context 'filled' do- let(:valid_params) do- {- _type: 'WorkPackage',- lockVersion: work_package.lock_version- }- end-- describe 'budget' do- let(:path) { '_embedded/payload/_links/costObject/href' }- let(:links_path) { '_embedded/schema/costObject/_links' }- let(:target_budget) { FactoryBot.create(:cost_object, project: project) }- let(:other_budget) { FactoryBot.create(:cost_object, project: project) }- let(:budget_link) { api_v3_paths.budget target_budget.id }- let(:budget_parameter) { { _links: { costObject: { href: budget_link } } } }- let(:params) { valid_params.merge(budget_parameter) }-- describe 'allowed values' do- before do- other_budget- end-- include_context 'post request'-- it 'should list the budgets' do- budgets = project.cost_objects-- budgets.each_with_index do |budget, index|- expect(subject.body).to be_json_eql(api_v3_paths.budget(budget.id).to_json)- .at_path("#{links_path}/allowedValues/#{index}/href")- end- end- end-- context 'valid budget' do- include_context 'post request'-- it_behaves_like 'having no errors'-- it 'should respond with updated work package budget' do- expect(subject.body).to be_json_eql(budget_link.to_json).at_path(path)- end- end-- context 'invalid budget' do- let(:target_budget) { FactoryBot.create(:cost_object) }-- include_context 'post request'-- it_behaves_like 'having an error', 'costObject'-- it 'should respond with updated work package budget' do- expect(subject.body).to be_json_eql(budget_link.to_json).at_path(path)- end- end- end- end- end- end- end- end-enddiff --git a/modules/costs/spec/requests/api/work_packages/work_package_resource_spec.rb b/modules/costs/spec/requests/api/work_packages/work_package_resource_spec.rbdeleted file mode 100644index bc8f699be33..00000000000--- a/modules/costs/spec/requests/api/work_packages/work_package_resource_spec.rb+++ /dev/null@@ -1,101 +0,0 @@-#-- copyright-# OpenProject is an open source project management software.-# Copyright (C) 2012-2020 the OpenProject GmbH-#-# This program is free software; you can redistribute it and/or-# modify it under the terms of the GNU General Public License version 3.-#-# OpenProject is a fork of ChiliProject, which is a fork of Redmine. The copyright follows:-# Copyright (C) 2006-2017 Jean-Philippe Lang-# Copyright (C) 2010-2013 the ChiliProject Team-#-# This program is free software; you can redistribute it and/or-# modify it under the terms of the GNU General Public License-# as published by the Free Software Foundation; either version 2-# of the License, or (at your option) any later version.-#-# This program is distributed in the hope that it will be useful,-# but WITHOUT ANY WARRANTY; without even the implied warranty of-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the-# GNU General Public License for more details.-#-# You should have received a copy of the GNU General Public License-# along with this program; if not, write to the Free Software-# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.-#-# See docs/COPYRIGHT.rdoc for more details.-#++--require 'spec_helper'-require 'rack/test'--describe 'API v3 Work package resource', type: :request do- include Rack::Test::Methods- include Capybara::RSpecMatchers- include API::V3::Utilities::PathHelper-- let(:work_package) {- FactoryBot.create(:work_package, project: project)- }-- let(:project) do- FactoryBot.create(:project, identifier: 'test_project', public: false)- end- let(:role) do- FactoryBot.create(:role, permissions: [:view_work_packages, :edit_work_packages, :view_cost_objects])- end- let(:current_user) do- FactoryBot.create(:user, member_in_project: project, member_through_role: role)- end-- describe '#patch' do- let(:patch_path) { api_v3_paths.work_package work_package.id }- let(:valid_params) do- {- _type: 'WorkPackage',- lockVersion: work_package.lock_version- }- end-- subject(:response) { last_response }-- shared_context 'patch request' do- before(:each) do- allow(User).to receive(:current).and_return current_user- patch patch_path, params.to_json, 'CONTENT_TYPE' => 'application/json'- end- end-- context 'user with needed permissions' do- context 'budget' do- let(:target_budget) { FactoryBot.create(:cost_object, project: project) }- let(:budget_link) { api_v3_paths.budget target_budget.id }- let(:budget_parameter) { { _links: { costObject: { href: budget_link } } } }- let(:params) { valid_params.merge(budget_parameter) }-- before do allow(User).to receive(:current).and_return current_user end-- context 'valid' do- include_context 'patch request'-- it { expect(response.status).to eq(200) }-- it 'should respond with the work package and its new budget' do- expect(subject.body).to be_json_eql(target_budget.subject.to_json)- .at_path('_embedded/costObject/subject')- end- end-- context 'not valid' do- let(:target_budget) { FactoryBot.create(:cost_object) }-- include_context 'patch request'-- it_behaves_like 'constraint violation' do- let(:message) { I18n.t('activerecord.errors.messages.inclusion') }- end- end- end- end- end-enddiff --git a/modules/costs/spec/routing/cost_objects_routing_spec.rb b/modules/costs/spec/routing/cost_objects_routing_spec.rbindex eb3d2328bb6..8093f34c970 100644--- a/modules/costs/spec/routing/cost_objects_routing_spec.rb+++ b/modules/costs/spec/routing/cost_objects_routing_spec.rb@@ -28,52 +28,52 @@require 'spec_helper'-describe CostObjectsController, type: :routing do+describe BudgetsController, type: :routing dodescribe 'routing' doit {- expect(get('/projects/blubs/cost_objects/new')).to route_to(controller: 'cost_objects',- action: 'new',- project_id: 'blubs')+ expect(get('/projects/blubs/budgets/new')).to route_to(controller: 'budgets',+ action: 'new',+ project_id: 'blubs')}it {- expect(post('/projects/blubs/cost_objects')).to route_to(controller: 'cost_objects',- action: 'create',- project_id: 'blubs')+ expect(post('/projects/blubs/budgets')).to route_to(controller: 'budgets',+ action: 'create',+ project_id: 'blubs')}it {- expect(get('/projects/blubs/cost_objects')).to route_to(controller: 'cost_objects',- action: 'index',- project_id: 'blubs')+ expect(get('/projects/blubs/budgets')).to route_to(controller: 'budgets',+ action: 'index',+ project_id: 'blubs')}it {- expect(get('/cost_objects/5')).to route_to(controller: 'cost_objects',- action: 'show',- id: '5')+ expect(get('/budgets/5')).to route_to(controller: 'budgets',+ action: 'show',+ id: '5')}it {- expect(put('/cost_objects/5')).to route_to(controller: 'cost_objects',- action: 'update',- id: '5')+ expect(put('/budgets/5')).to route_to(controller: 'budgets',+ action: 'update',+ id: '5')}it {- expect(delete('/cost_objects/5')).to route_to(controller: 'cost_objects',- action: 'destroy',- id: '5')+ expect(delete('/budgets/5')).to route_to(controller: 'budgets',+ action: 'destroy',+ id: '5')}it {- expect(post('/projects/42/cost_objects/update_material_budget_item')).to route_to(controller: 'cost_objects',- action: 'update_material_budget_item',- project_id: '42')+ expect(post('/projects/42/budgets/update_material_budget_item')).to route_to(controller: 'budgets',+ action: 'update_material_budget_item',+ project_id: '42')}it {- expect(post('/projects/42/cost_objects/update_labor_budget_item')).to route_to(controller: 'cost_objects',- action: 'update_labor_budget_item',- project_id: '42')+ expect(post('/projects/42/budgets/update_labor_budget_item')).to route_to(controller: 'budgets',+ action: 'update_labor_budget_item',+ project_id: '42')}it {- expect(get('/cost_objects/5/copy')).to route_to(controller: 'cost_objects',- action: 'copy',- id: '5')+ expect(get('/budgets/5/copy')).to route_to(controller: 'budgets',+ action: 'copy',+ id: '5')}endenddiff --git a/spec/services/time_entries/set_attributes_service_spec.rb b/modules/costs/spec/services/time_entries/set_attributes_service_spec.rbsimilarity index 100%rename from spec/services/time_entries/set_attributes_service_spec.rbrename to modules/costs/spec/services/time_entries/set_attributes_service_spec.rbdiff --git a/modules/costs/spec/spec_helper.rb b/modules/costs/spec/spec_helper.rbindex 60cdac31ffa..ee1973b1716 100644--- a/modules/costs/spec/spec_helper.rb+++ b/modules/costs/spec/spec_helper.rb@@ -31,4 +31,4 @@ require 'spec_helper'require File.join(File.dirname(__FILE__), 'plugin_spec_helper')-Dir[File.join(File.dirname(__FILE__), 'support/**/*.rb')].each { |f| require f }+Dir[File.join(File.dirname(__FILE__), 'support/**/*.rb')].sort.each { |f| require f }diff --git a/modules/global_roles/spec/plugin_spec_helper.rb b/modules/global_roles/spec/plugin_spec_helper.rbindex 2cced21babc..8cc209eb997 100644--- a/modules/global_roles/spec/plugin_spec_helper.rb+++ b/modules/global_roles/spec/plugin_spec_helper.rb@@ -30,7 +30,7 @@ module OpenProjectmodule GlobalRolesmodule PluginSpecHelperdef costs_plugin_loaded?- plugin_loaded?('openproject_costs')+ plugin_loaded?('costs')enddef plugin_loaded?(name)diff --git a/modules/reporting/app/controllers/cost_reports_controller.rb b/modules/reporting/app/controllers/cost_reports_controller.rbindex 63fe54f6eb4..778731e9ac6 100644--- a/modules/reporting/app/controllers/cost_reports_controller.rb+++ b/modules/reporting/app/controllers/cost_reports_controller.rb@@ -203,7 +203,7 @@ class CostReportsController < ApplicationController@unit_id = if set_unit?params[:unit].to_ielsif @query.present?- cost_type_filter = @query.filters.detect { |f| f.is_a?(CostQuery::Filter::CostTypeId) }+ cost_type_filter = @query.filters.detect { |f| f.is_a?(CostQuery::Filter::CostTypeId) }cost_type_filter.values.first.to_i if cost_type_filterenddiff --git a/modules/reporting/app/controllers/work_package_costlog_controller.rb b/modules/reporting/app/controllers/work_package_costlog_controller.rbindex 7b6c8fa25ad..33b63824251 100644--- a/modules/reporting/app/controllers/work_package_costlog_controller.rb+++ b/modules/reporting/app/controllers/work_package_costlog_controller.rb@@ -34,7 +34,6 @@ class WorkPackageCostlogController < ApplicationControllerbefore_action :authorizebefore_action :redirect_when_outside_project-def indexfilters = { operators: {}, values: {} }diff --git a/modules/reporting/app/helpers/reporting_helper.rb b/modules/reporting/app/helpers/reporting_helper.rbindex fa9a2ef4cf3..797ca56edfb 100644--- a/modules/reporting/app/helpers/reporting_helper.rb+++ b/modules/reporting/app/helpers/reporting_helper.rb@@ -86,10 +86,13 @@ module ReportingHelper@raw_row[key][value] ||= field_sort_map(key, value)end- def cost_object_link(cost_object_id)- co = CostObject.find(cost_object_id)- if User.current.allowed_to?(:view_cost_objects, co.project)- link_to_cost_object(co)+ def budget_link(budget_id)+ co = Budget.find(budget_id)+ if User.current.allowed_to?(:view_budgets, co.project)+ link_to budget.subject,+ budget_path(budget),+ class: budget.css_classes,+ title: budget.subjectelseco.subjectend@@ -107,7 +110,7 @@ module ReportingHelperwhen :tmonth then month_name(value.to_i)when :category_id then h(Category.find(value.to_i).name)when :cost_type_id then mapped value, CostType, l(:caption_labor)- when :cost_object_id then cost_object_link value+ when :budget_id then budget_link valuewhen :work_package_id then link_to_work_package(WorkPackage.find(value.to_i))when :spent_on then format_date(value.to_date)when :type_id then h(Type.find(value.to_i).name)diff --git a/modules/reporting/app/models/cost_query/filter.rb b/modules/reporting/app/models/cost_query/filter.rbindex 13245c04ff7..60b0fecfd59 100644--- a/modules/reporting/app/models/cost_query/filter.rb+++ b/modules/reporting/app/models/cost_query/filter.rb@@ -32,25 +32,26 @@ class CostQuery::Filter < Report::Filterdef self.all@all ||= super + Set[CostQuery::Filter::ActivityId,- CostQuery::Filter::AssignedToId,- CostQuery::Filter::AuthorId,- CostQuery::Filter::CategoryId,- CostQuery::Filter::CostTypeId,- CostQuery::Filter::CreatedOn,- CostQuery::Filter::DueDate,- CostQuery::Filter::VersionId,- CostQuery::Filter::WorkPackageId,- CostQuery::Filter::OverriddenCosts,- CostQuery::Filter::PriorityId,- CostQuery::Filter::ProjectId,- CostQuery::Filter::SpentOn,- CostQuery::Filter::StartDate,- CostQuery::Filter::StatusId,- CostQuery::Filter::Subject,- CostQuery::Filter::TypeId,- CostQuery::Filter::UpdatedOn,- CostQuery::Filter::UserId,- CostQuery::Filter::PermissionFilter,+ CostQuery::Filter::AssignedToId,+ CostQuery::Filter::AuthorId,+ CostQuery::Filter::BudgetId,+ CostQuery::Filter::CategoryId,+ CostQuery::Filter::CostTypeId,+ CostQuery::Filter::CreatedOn,+ CostQuery::Filter::DueDate,+ CostQuery::Filter::VersionId,+ CostQuery::Filter::WorkPackageId,+ CostQuery::Filter::OverriddenCosts,+ CostQuery::Filter::PriorityId,+ CostQuery::Filter::ProjectId,+ CostQuery::Filter::SpentOn,+ CostQuery::Filter::StartDate,+ CostQuery::Filter::StatusId,+ CostQuery::Filter::Subject,+ CostQuery::Filter::TypeId,+ CostQuery::Filter::UpdatedOn,+ CostQuery::Filter::UserId,+ CostQuery::Filter::PermissionFilter,*CostQuery::Filter::CustomFieldEntries.all]enddiff --git a/modules/reporting/app/models/cost_query/filter/cost_object_id.rb b/modules/reporting/app/models/cost_query/filter/budget_id.rbsimilarity index 80%rename from modules/reporting/app/models/cost_query/filter/cost_object_id.rbrename to modules/reporting/app/models/cost_query/filter/budget_id.rbindex e878aa6cd9e..f4390383f08 100644--- a/modules/reporting/app/models/cost_query/filter/cost_object_id.rb+++ b/modules/reporting/app/models/cost_query/filter/budget_id.rb@@ -26,15 +26,20 @@# See docs/COPYRIGHT.rdoc for more details.#++-class CostQuery::Filter::CostObjectId < Report::Filter::Base- join_table Project+class CostQuery::Filter::BudgetId < Report::Filter::Base+ join_table WorkPackageapplies_for :label_work_package_attributesdef self.label- CostObject.model_name.human+ Budget.model_name.humanenddef self.available_values(*)- [[l(:caption_labor), -1]] + CostObject.order(Arel.sql('name')).pluck(:name, :id)+ Budget+ .visible(User.current)+ .includes(:project)+ .pluck(:'projects.name', :subject, :id)+ .map { |a| ["#{a[0]} - #{a[1]} ", a[2]] }+ .sort_by { |a| a.first.downcase }endenddiff --git a/modules/reporting/app/models/cost_query/filter/category_id.rb b/modules/reporting/app/models/cost_query/filter/category_id.rbindex 2a594c07285..473ba54bd05 100644--- a/modules/reporting/app/models/cost_query/filter/category_id.rb+++ b/modules/reporting/app/models/cost_query/filter/category_id.rb@@ -36,7 +36,9 @@ class CostQuery::Filter::CategoryId < Report::Filter::Baseenddef self.available_values(*)- categories = Category.where(project_id: Project.visible.map(&:id))- categories.map { |c| ["#{c.project.name} - #{c.name} ", c.id] }.sort_by { |a| a.first.to_s + a.second.to_s }+ Category+ .where(project_id: Project.visible.map(&:id))+ .map { |c| ["#{c.project.name} - #{c.name} ", c.id] }+ .sort_by { |a| a.first.to_s + a.second.to_s }endenddiff --git a/modules/reporting/app/models/cost_query/filter/work_package_id.rb b/modules/reporting/app/models/cost_query/filter/work_package_id.rbindex 44aa5ee14bb..4e212d47bc0 100644--- a/modules/reporting/app/models/cost_query/filter/work_package_id.rb+++ b/modules/reporting/app/models/cost_query/filter/work_package_id.rb@@ -32,10 +32,11 @@ class CostQuery::Filter::WorkPackageId < Report::Filter::Baseenddef self.available_values(*)- work_packages = WorkPackage.where(project_id: Project.allowed_to(User.current, :view_work_packages))- .order(:id)- .pluck(:id, :subject)- work_packages.map { |id, subject| [text_for_tuple(id, subject), id] }+ WorkPackage+ .where(project_id: Project.allowed_to(User.current, :view_work_packages))+ .order(:id)+ .pluck(:id, :subject)+ .map { |id, subject| [text_for_tuple(id, subject), id] }enddef self.available_operators@@ -47,6 +48,7 @@ class CostQuery::Filter::WorkPackageId < Report::Filter::Base# to achieve a more performant implementationdef self.label_for_value(value)return nil unless value.to_i.to_s == value.to_s # we expect an work_package-id+work_package = WorkPackage.find(value.to_i)[text_for_work_package(work_package), work_package.id] if work_package and work_package.visible?(User.current)enddiff --git a/modules/reporting/app/models/cost_query/group_by.rb b/modules/reporting/app/models/cost_query/group_by.rbindex f5fa2d0258f..cf34fd1f0b5 100644--- a/modules/reporting/app/models/cost_query/group_by.rb+++ b/modules/reporting/app/models/cost_query/group_by.rb@@ -32,7 +32,7 @@ class CostQuery::GroupBy < Report::GroupBydef self.all@all ||= super + Set[CostQuery::GroupBy::ActivityId,- CostQuery::GroupBy::CostObjectId,+ CostQuery::GroupBy::BudgetId,CostQuery::GroupBy::CostTypeId,CostQuery::GroupBy::VersionId,CostQuery::GroupBy::WorkPackageId,diff --git a/modules/reporting/app/models/cost_query/group_by/cost_object_id.rb b/modules/reporting/app/models/cost_query/group_by/budget_id.rbsimilarity index 93%rename from modules/reporting/app/models/cost_query/group_by/cost_object_id.rbrename to modules/reporting/app/models/cost_query/group_by/budget_id.rbindex 06dff654591..2213cca3dff 100644--- a/modules/reporting/app/models/cost_query/group_by/cost_object_id.rb+++ b/modules/reporting/app/models/cost_query/group_by/budget_id.rb@@ -26,11 +26,11 @@# See docs/COPYRIGHT.rdoc for more details.#++-class CostQuery::GroupBy::CostObjectId < Report::GroupBy::Base+class CostQuery::GroupBy::BudgetId < Report::GroupBy::Basejoin_table WorkPackageapplies_for :label_work_package_attributesdef self.label- CostObject.model_name.human+ Budget.model_name.humanendenddiff --git a/modules/reporting/config/routes.rb b/modules/reporting/config/routes.rbindex 0ef5a04e00f..647f9829e4c 100644--- a/modules/reporting/config/routes.rb+++ b/modules/reporting/config/routes.rb@@ -40,10 +40,6 @@ OpenProject::Application.routes.draw doendend- scope 'work_packages/:work_package_id', as: 'work_packages' do- resources :cost_entries, controller: 'work_package_costlog', only: %[index]- end-resources :cost_reports, except: :create docollection domatch :index, via: [:get, :post]diff --git a/modules/reporting/lib/open_project/reporting/engine.rb b/modules/reporting/lib/open_project/reporting/engine.rbindex 12afa7b38ad..8d854009c68 100644--- a/modules/reporting/lib/open_project/reporting/engine.rb+++ b/modules/reporting/lib/open_project/reporting/engine.rb@@ -40,7 +40,7 @@ module OpenProject::Reportingedit_actions = [:create, :update, :rename, :destroy]#register reporting_module including permissions- project_module :reporting_module do+ project_module :costs dopermission :save_cost_reports, { cost_reports: edit_actions }permission :save_private_cost_reports, { cost_reports: edit_actions }end@@ -53,12 +53,6 @@ module OpenProject::ReportingOpenProject::AccessControl.permission(:view_own_cost_entries).actions << "cost_reports/#{action}"end- # register additional permissions for the work package costlog controller- OpenProject::AccessControl.permission(:view_time_entries).actions << "work_package_costlog/index"- OpenProject::AccessControl.permission(:view_own_time_entries).actions << "work_package_costlog/index"- OpenProject::AccessControl.permission(:view_cost_entries).actions << "work_package_costlog/index"- OpenProject::AccessControl.permission(:view_own_cost_entries).actions << "work_package_costlog/index"-#menu extensionsmenu :top_menu,:cost_reports_global,@@ -75,21 +69,13 @@ module OpenProject::Reporting}menu :project_menu,- :cost_reports,+ :costs,{ controller: '/cost_reports', action: 'index' },param: :project_id,- after: :time_entries,+ after: :news,caption: :cost_reports_title,- if: Proc.new { |project| project.module_enabled?(:reporting_module) },+ if: Proc.new { |project| project.module_enabled?(:costs) },icon: 'icon2 icon-cost-reports'-- # Cost reports should remove the default time entries menu item- hide_menu_item :project_menu,- :time_entries,- hide_if: -> (project) { project.module_enabled?(:reporting_module) }-- hide_menu_item :top_menu,- :time_sheetendinitializer "reporting.register_hooks" do@@ -105,7 +91,7 @@ module OpenProject::Reportingrequire_dependency 'cost_query/group_by'end- patches %i[TimelogController CustomFieldsController OpenProject::Configuration]+ patches %i[CustomFieldsController OpenProject::Configuration]patch_with_namespace :BasicData, :RoleSeederpatch_with_namespace :BasicData, :SettingSeederenddiff --git a/modules/reporting/lib/open_project/reporting/patches/timelog_controller_patch.rb b/modules/reporting/lib/open_project/reporting/patches/timelog_controller_patch.rbdeleted file mode 100644index 5b5cf087a11..00000000000--- a/modules/reporting/lib/open_project/reporting/patches/timelog_controller_patch.rb+++ /dev/null@@ -1,94 +0,0 @@-#-- copyright-# OpenProject is an open source project management software.-# Copyright (C) 2012-2020 the OpenProject GmbH-#-# This program is free software; you can redistribute it and/or-# modify it under the terms of the GNU General Public License version 3.-#-# OpenProject is a fork of ChiliProject, which is a fork of Redmine. The copyright follows:-# Copyright (C) 2006-2017 Jean-Philippe Lang-# Copyright (C) 2010-2013 the ChiliProject Team-#-# This program is free software; you can redistribute it and/or-# modify it under the terms of the GNU General Public License-# as published by the Free Software Foundation; either version 2-# of the License, or (at your option) any later version.-#-# This program is distributed in the hope that it will be useful,-# but WITHOUT ANY WARRANTY; without even the implied warranty of-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the-# GNU General Public License for more details.-#-# You should have received a copy of the GNU General Public License-# along with this program; if not, write to the Free Software-# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.-#-# See docs/COPYRIGHT.rdoc for more details.-#++--require_dependency 'timelog_controller'--module OpenProject::Reporting::Patches- module TimelogControllerPatch- def self.included(base) # :nodoc:- base.prepend InstanceMethods- end-- module InstanceMethods- ##- # @Override- # This is for cost reporting- def redirect_to(*args, &block)- if args.first == :back and args.size == 1 and request.referer =~ /cost_reports/- super(controller: '/cost_reports', action: :index)- else- super(*args, &block)- end- end-- def index- # we handle single project reporting currently- if @project.nil? || [email protected]_enabled?(:reporting_module)- return super- end- filters = {operators: {}, values: {}}-- if @issue- if @issue.respond_to?("lft")- work_package_ids = @issue.self_and_descendants.pluck(:id)- else- work_package_ids = [@issue.id.to_s]- end-- filters[:operators][:work_package_id] = "="- filters[:values][:work_package_id] = [work_package_ids]- end-- filters[:operators][:project_id] = "="- filters[:values][:project_id] = [@project.id.to_s]-- respond_to do |format|- format.html {- session[::CostQuery.name.underscore.to_sym] = { filters: filters, groups: {rows: [], columns: []} }-- redirect_to controller: "/cost_reports", action: "index", project_id: @project, unit: -1- }- format.all {- super- }- end- end-- def find_optional_project- if !params[:work_package_id].blank?- @issue = WorkPackage.find(params[:work_package_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) ||- User.current.allowed_to?(:view_own_time_entries, @project, global: true)- end- end- end-enddiff --git a/modules/reporting/openproject-reporting.gemspec b/modules/reporting/openproject-reporting.gemspecindex fd33c95b606..1d4ff030b69 100644--- a/modules/reporting/openproject-reporting.gemspec+++ b/modules/reporting/openproject-reporting.gemspec@@ -12,8 +12,6 @@ Gem::Specification.new do |s|s.files = Dir["{app,config,db,lib,doc}/**/*", "README.md"]s.test_files = Dir["spec/**/*"]+ s.add_dependency "costs"s.add_dependency "reporting_engine"- s.add_dependency "openproject-costs"-- s.add_development_dependency "factory_girl_rails", "~> 4.0"enddiff --git a/modules/reporting/spec/features/work_package_costlog_spec.rb b/modules/reporting/spec/features/work_package_costlog_spec.rbindex f1f781faaae..6305d756be8 100644--- a/modules/reporting/spec/features/work_package_costlog_spec.rb+++ b/modules/reporting/spec/features/work_package_costlog_spec.rb@@ -9,10 +9,10 @@ describe 'Cost report showing my own times', type: :feature, js: true dolet(:permissions) { %i[view_work_packages view_own_cost_entries] }let(:budget) do- FactoryBot.create(:cost_object, project: project)+ FactoryBot.create(:budget, project: project)endlet(:cost_type) { FactoryBot.create(:cost_type, name: 'Foobar', unit: 'Foobar', unit_plural: 'Foobars') }- let(:work_package) { FactoryBot.create :work_package, project: project, cost_object: budget }+ let(:work_package) { FactoryBot.create :work_package, project: project, budget: budget }let(:wp_page) { Pages::FullWorkPackage.new work_package, project }let(:cost_entry) do@@ -26,7 +26,6 @@ describe 'Cost report showing my own times', type: :feature, js: true docomments: 'foobar')end-before dologin_as usercost_entry.save!diff --git a/modules/reporting/spec/models/cost_query/chaining_spec.rb b/modules/reporting/spec/models/cost_query/chaining_spec.rbindex b18fa8613d7..30989023636 100644--- a/modules/reporting/spec/models/cost_query/chaining_spec.rb+++ b/modules/reporting/spec/models/cost_query/chaining_spec.rb@@ -146,7 +146,7 @@ describe CostQuery, type: :model, reporting_query_helper: true do@query.filter :cost_type_id, value: CostQuery::Filter::CostTypeId.available_values.first@query.filter :category_id, value: CostQuery::Filter::CategoryId.available_values.first@query.group_by :activity_id- @query.group_by :cost_object_id+ @query.group_by :budget_id@query.group_by :cost_type_id@new_query = CostQuery.deserialize(@query.serialize)enddiff --git a/modules/reporting/spec/models/cost_query/group_by_spec.rb b/modules/reporting/spec/models/cost_query/group_by_spec.rbindex c39d15312fc..7e0e0946854 100644--- a/modules/reporting/spec/models/cost_query/group_by_spec.rb+++ b/modules/reporting/spec/models/cost_query/group_by_spec.rb@@ -39,7 +39,7 @@ describe CostQuery, type: :model, reporting_query_helper: true dotime_entry2.save!time_entry2end- let!(:cost_object1) { FactoryBot.create(:cost_object, project: project1) }+ let!(:budget1) { FactoryBot.create(:budget, project: project1) }let!(:cost_entry1) { FactoryBot.create(:cost_entry, work_package: work_package1, project: project1, spent_on: Date.new(2013, 2, 3)) }let!(:cost_entry2) docost_entry2 = cost_entry1.dup@@ -55,7 +55,7 @@ describe CostQuery, type: :model, reporting_query_helper: true dotime_entry4.save!time_entry4end- let!(:cost_object2) { FactoryBot.create(:cost_object, project: project2) }+ let!(:budget2) { FactoryBot.create(:budget, project: project2) }let!(:cost_entry3) { FactoryBot.create(:cost_entry, work_package: work_package2, project: project2, spent_on: Date.new(2012, 1, 1)) }let!(:cost_entry4) docost_entry4 = cost_entry3.dup@@ -127,8 +127,8 @@ describe CostQuery, type: :model, reporting_query_helper: true doexpect(@query.result.size).to eq(1)end- it "should compute group_by CostObject" do- @query.group_by :cost_object_id+ it "should compute group_by Budget" do+ @query.group_by :budget_idexpect(@query.result.size).to eq(1)enddiff --git a/modules/reporting_engine/lib/report/controller.rb b/modules/reporting_engine/lib/report/controller.rbindex c750554217d..fb0eb6789cd 100644--- a/modules/reporting_engine/lib/report/controller.rb+++ b/modules/reporting_engine/lib/report/controller.rb@@ -320,14 +320,17 @@ module Report::Controller# renders option tags for each available value for a single filterdef available_values- if name = params[:filter_name]- f_cls = report_engine::Filter.const_get(name.to_s.camelcase)- filter = f_cls.new.tap do |f|- f.values = JSON.parse(params[:values].gsub("'", '"')) if params[:values].present? and params[:values]- end- render_widget Widget::Filters::Option, filter, to: canvas = ''- render plain: canvas, layout: !request.xhr?+ name = params[:filter_name]++ return unless name++ f_cls = report_engine::Filter.const_get(name.to_s.camelcase)+ filter = f_cls.new.tap do |f|+ f.values = JSON.parse(params[:values].gsub("'", '"')) if params[:values].present? && params[:values]end+ render_widget Widget::Filters::Option, filter, to: canvas = ''++ render plain: canvas, layout: !request.xhr?end##diff --git a/modules/reporting_engine/lib/report/filter/base.rb b/modules/reporting_engine/lib/report/filter/base.rbindex 13f4e8c0e3a..89ade24bb7c 100644--- a/modules/reporting_engine/lib/report/filter/base.rb+++ b/modules/reporting_engine/lib/report/filter/base.rb@@ -48,7 +48,7 @@ class Report::Filterend##- # A Filter is 'heavy' if it possibly returns a _hughe_ number of available_values.+ # A Filter is 'heavy' if it possibly returns a _hugh_ number of available_values.# In that case the UI-guys should think twice about displaying all the values.def self.heavy?false@@ -99,6 +99,7 @@ class Report::Filterdef self.new(*args, &block) # :nodoc:# this class is abstract. instances are only allowed from child classesraise "#{name} is an abstract class" if base?+superend@@ -183,11 +184,11 @@ class Report::Filterdef sql_statementsuper.tap do |query|- arity = operator.arity- query_values = [*transformed_values].compact+ arity = operator.arity+ query_values = [*transformed_values].compact# if there is just the nil it might be actually intendet to be therequery_values.unshift nil if Array(self.values).size == 1 && Array(self.values).first.nil?- query_values = query_values[0, arity] if query_values and arity >= 0 and arity != query_values.size+ query_values = query_values[0, arity] if query_values and arity >= 0 and arity != query_values.sizeoperator.modify(query, field, *query_values) unless field.empty?endenddiff --git a/modules/reporting_engine/lib/widget/group_bys.rb b/modules/reporting_engine/lib/widget/group_bys.rbindex cbc254c3f61..e530cce2d18 100644--- a/modules/reporting_engine/lib/widget/group_bys.rb+++ b/modules/reporting_engine/lib/widget/group_bys.rb@@ -42,13 +42,12 @@ class Widget::GroupBys < Widget::Baseendcontent_tag :fieldset do-legend = content_tag :legend, I18n.t("reporting.group_by.selected_#{type}"), class: 'hidden-for-sighted'container = content_tag :div,- id: "group-by--#{type}",- class: 'group-by--container grid-block',- :'data-initially-selected' => initially_selected.to_json.gsub('"', "'") do+ id: "group-by--#{type}",+ class: 'group-by--container grid-block',+ :'data-initially-selected' => initially_selected.to_json.gsub('"', "'") doout = content_tag :span, class: 'group-by--caption grid-content shrink' docontent_tag :span dol(:"label_#{type}")@@ -60,9 +59,9 @@ class Widget::GroupBys < Widget::Baseout += content_tag :span,class: 'group-by--control grid-content shrink' dolabel = label_tag "group-by--add-#{type}",- l(:"label_group_by_add") + ' ' +- I18n.t('js.filter.description.text_open_filter'),- class: 'hidden-for-sighted'+ l(:"label_group_by_add") + ' ' ++ I18n.t('js.filter.description.text_open_filter'),+ class: 'hidden-for-sighted'label += content_tag :select, id: "group-by--add-#{type}", class: 'advanced-filters--select' docontent = content_tag :option, l(:label_group_by_add), value: ''diff --git a/modules/two_factor_authentication/db/migrate/20120214103300_aggregated_mobile_otp_migrations.rb b/modules/two_factor_authentication/db/migrate/20120214103300_aggregated_mobile_otp_migrations.rbindex 1d656651df4..72836b1ccc1 100644--- a/modules/two_factor_authentication/db/migrate/20120214103300_aggregated_mobile_otp_migrations.rb+++ b/modules/two_factor_authentication/db/migrate/20120214103300_aggregated_mobile_otp_migrations.rb@@ -1,9 +1,9 @@-require Rails.root.join("db","migrate","migration_utils","migration_squasher").to_s-require Rails.root.join("db","migrate","migration_utils","setting_renamer").to_s+require Rails.root.to_s + '/db/migrate/migration_utils/migration_squasher'+require Rails.root.to_s + '/db/migrate/migration_utils/setting_renamer'require 'open_project/plugins/migration_mapping'+# This migration aggregates the migrations detailed in MIGRATION_FILESclass AggregatedMobileOtpMigrations < ActiveRecord::Migration[5.0]-MIGRATION_FILES = <<-MIGRATIONS001_add_user_phone.rb002_create_extended_tokens.rb@@ -20,7 +20,7 @@ class AggregatedMobileOtpMigrations < ActiveRecord::Migration[5.0]add_column :users, :unverified_phone, :stringUser.reset_column_informationend- Migration::SettingRenamer.rename("plugin_redmine_two_factor_authentication_authentication","plugin_openproject_two_factor_authentication")+ Migration::MigrationUtils::SettingRenamer.rename("plugin_redmine_two_factor_authentication_authentication","plugin_openproject_two_factor_authentication")enddef downdiff --git a/modules/xls_export/lib/open_project/xls_export/formatters.rb b/modules/xls_export/lib/open_project/xls_export/formatters.rbindex ea084b53028..f86efcc4c08 100644--- a/modules/xls_export/lib/open_project/xls_export/formatters.rb+++ b/modules/xls_export/lib/open_project/xls_export/formatters.rb@@ -67,8 +67,8 @@ module OpenProject::XlsExportdef number_format_string# [$CUR] makes sure we have an actually working currency format with arbitrary currencies- curr = "[$CUR]".gsub "CUR", ERB::Util.h(Setting.plugin_openproject_costs['costs_currency'])- format = ERB::Util.h Setting.plugin_openproject_costs['costs_currency_format']+ curr = "[$CUR]".gsub "CUR", ERB::Util.h(Setting.plugin_costs['costs_currency'])+ format = ERB::Util.h Setting.plugin_costs['costs_currency_format']number = '#,##0.00'format.gsub("%n", number).gsub("%u", curr)diff --git a/modules/xls_export/lib/open_project/xls_export/spreadsheet_builder.rb b/modules/xls_export/lib/open_project/xls_export/spreadsheet_builder.rbindex e852c320b78..3ac97180995 100644--- a/modules/xls_export/lib/open_project/xls_export/spreadsheet_builder.rb+++ b/modules/xls_export/lib/open_project/xls_export/spreadsheet_builder.rb@@ -215,7 +215,7 @@ module OpenProject::XlsExportenddef currency_sign- Setting.plugin_openproject_costs['costs_currency']+ Setting.plugin_costs['costs_currency']enddef escaped_worksheet_name(name)diff --git a/modules/xls_export/lib/open_project/xls_export/xls_views.rb b/modules/xls_export/lib/open_project/xls_export/xls_views.rbindex bdad4272341..abacbd84a2a 100644--- a/modules/xls_export/lib/open_project/xls_export/xls_views.rb+++ b/modules/xls_export/lib/open_project/xls_export/xls_views.rb@@ -32,7 +32,7 @@ class OpenProject::XlsExport::XlsViewsdef cost_type_unit_label(cost_type_id, cost_type_inst = nil, plural = true)case cost_type_idwhen -1 then l_hours(2).split[1..-1].join(" ") # get the plural for hours- when 0 then Setting.plugin_openproject_costs['costs_currency']+ when 0 then Setting.plugin_costs['costs_currency']else cost_type_label(cost_type_id, cost_type_inst, plural)endend@@ -61,7 +61,7 @@ class OpenProject::XlsExport::XlsViewsenddef currency_format- "#,##0.00 [$#{Setting.plugin_openproject_costs['costs_currency']}]"+ "#,##0.00 [$#{Setting.plugin_costs['costs_currency']}]"enddef number_formatdiff --git a/modules/xls_export/spec/models/xls_export/work_package/exporter/xls_integration_spec.rb b/modules/xls_export/spec/models/xls_export/work_package/exporter/xls_integration_spec.rbindex a61c10433f6..f160bd9ceb2 100644--- a/modules/xls_export/spec/models/xls_export/work_package/exporter/xls_integration_spec.rb+++ b/modules/xls_export/spec/models/xls_export/work_package/exporter/xls_integration_spec.rb@@ -227,7 +227,7 @@ describe XlsExport::WorkPackage::Exporter::XLS doendallow(Setting)- .to receive(:plugin_openproject_costs)+ .to receive(:plugin_costs).and_return('costs_currency' => 'EUR', 'costs_currency_format' => '%n %u')enddiff --git a/spec/controllers/timelog_controller_spec.rb b/spec/controllers/timelog_controller_spec.rbdeleted file mode 100644index f19f6e27bec..00000000000--- a/spec/controllers/timelog_controller_spec.rb+++ /dev/null@@ -1,175 +0,0 @@-#-- copyright-# OpenProject is an open source project management software.-# Copyright (C) 2012-2020 the OpenProject GmbH-#-# This program is free software; you can redistribute it and/or-# modify it under the terms of the GNU General Public License version 3.-#-# OpenProject is a fork of ChiliProject, which is a fork of Redmine. The copyright follows:-# Copyright (C) 2006-2017 Jean-Philippe Lang-# Copyright (C) 2010-2013 the ChiliProject Team-#-# This program is free software; you can redistribute it and/or-# modify it under the terms of the GNU General Public License-# as published by the Free Software Foundation; either version 2-# of the License, or (at your option) any later version.-#-# This program is distributed in the hope that it will be useful,-# but WITHOUT ANY WARRANTY; without even the implied warranty of-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the-# GNU General Public License for more details.-#-# You should have received a copy of the GNU General Public License-# along with this program; if not, write to the Free Software-# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.-#-# See docs/COPYRIGHT.rdoc for more details.-#++--require 'spec_helper'--describe TimelogController, type: :controller do- let!(:activity) { FactoryBot.create(:default_activity) }- let(:project) { FactoryBot.create(:project) }- let(:user) do- FactoryBot.create(:admin,- member_in_project: project)- end- let(:params) do- { 'time_entry' => { 'work_package_id' => work_package_id,- 'spent_on' => Date.today.strftime('%Y-%m-%d'),- 'hours' => '5',- 'comments' => '',- 'custom_field_values' => { custom_field.id.to_s => 'wurst' },- 'activity_id' => activity.id.to_s },- 'project_id' => project_id.to_s }- end- let(:project_id) { project.id }- let(:work_package_id) { '' }-- before do- login_as(user)- end-- describe '#create' do- shared_examples_for 'successful timelog creation' do- it { expect(response).to redirect_to(project_time_entries_path(project)) }- end-- let(:custom_field) do- FactoryBot.build_stubbed :time_entry_custom_field,- name: 'supplies',- is_required: true- end-- let!(:service) do- service = double('create_service')-- allow(TimeEntries::CreateService)- .to receive(:new)- .with(user: user)- .and_return(service)-- allow(service)- .to receive(:call)- .with(params['time_entry'].merge(project: project))- .and_return(service_result)-- service- end-- let(:time_entry) { double("created time entry", project: project) }-- let(:service_result) do- ServiceResult.new(success: true, errors: [], result: time_entry)- end-- describe '#valid' do- before do- expect(service)- .to receive(:call)- .with(params['time_entry'].merge(project: project))- .and_return(service_result)-- post :create, params: params- end-- it_behaves_like 'successful timelog creation'- end-- describe '#with failures on creation' do- let(:service_result) do- ServiceResult.new(success: false, errors: [], result: time_entry)- end-- before do- post :create, params: params- end-- it { expect(response).to render_template(:edit) }- end-- context 'with invalid project' do- describe '#invalid' do- let(:project_id) { -1 }-- before do- post :create, params: params- end-- it { expect(response.status).to eq(404) }- end- end- end-- describe '#destroy' do- let(:time_entry) do- FactoryBot.build_stubbed(:time_entry).tap do |entry|- allow(TimeEntry)- .to receive(:find)- .with(entry.id.to_s)- .and_return(entry)- end- end-- let(:expected_destroy_response) { true }-- before do- expect(time_entry)- .to receive(:destroy)- .and_return(expected_destroy_response)-- allow(time_entry)- .to receive(:destroyed?)- .and_return(expected_destroy_response)-- delete :destroy, params: { id: time_entry.id }- end-- context 'successful' do- it 'redirects to index' do- expect(response)- .to redirect_to project_time_entries_path(time_entry.project)- end-- it 'returns with a success flash' do- expect(flash[:notice])- .to eql I18n.t(:notice_successful_delete)- end- end-- context 'failure' do- let(:expected_destroy_response) { false }-- it 'redirects to index' do- expect(response)- .to redirect_to project_time_entries_path(time_entry.project)- end-- it 'returns with a success flash' do- expect(flash[:error])- .to eql I18n.t(:notice_unable_delete_time_entry)- end- end- end-enddiff --git a/spec/controllers/work_packages/bulk_controller_spec.rb b/spec/controllers/work_packages/bulk_controller_spec.rbindex 1eaaea69cd6..d99dde62e2d 100644--- a/spec/controllers/work_packages/bulk_controller_spec.rb+++ b/spec/controllers/work_packages/bulk_controller_spec.rb@@ -171,7 +171,7 @@ describe WorkPackages::BulkController, type: :controller dosubject { response }describe '#parent' do- it { assert_select 'input', {attributes: { name: 'work_package[parent_id]' }}, false }+ it { assert_select 'input', { attributes: { name: 'work_package[parent_id]' } }, false }endcontext 'custom_field' do@@ -180,7 +180,7 @@ describe WorkPackages::BulkController, type: :controller doenddescribe '#project' do- it { assert_select 'select', {attributes: { name: "work_package[custom_field_values][#{custom_field_2.id}]" }}, false }+ it { assert_select 'select', { attributes: { name: "work_package[custom_field_values][#{custom_field_2.id}]" } }, false }endendenddiff --git a/spec/features/menu_items/top_menu_item_spec.rb b/spec/features/menu_items/top_menu_item_spec.rbindex 5f33503d241..c5bb27ef5a1 100644--- a/spec/features/menu_items/top_menu_item_spec.rb+++ b/spec/features/menu_items/top_menu_item_spec.rb@@ -72,10 +72,9 @@ feature 'Top menu items', js: true, selenium: true dolet(:news_item) { I18n.t('label_news_plural') }let(:project_item) { I18n.t('label_projects_menu') }- let(:time_entries_item) { I18n.t('label_time_sheet_menu') }let(:reporting_item) { I18n.t('cost_reports_title') }- let(:all_items) { [news_item, time_entries_item, project_item] }+ let(:all_items) { [news_item, project_item, reporting_item] }context 'as an admin' dolet(:user) { FactoryBot.create :admin }diff --git a/spec/features/time_entry/csv_export_spec.rb b/spec/features/time_entry/csv_export_spec.rbdeleted file mode 100644index 7ac98f4f44d..00000000000--- a/spec/features/time_entry/csv_export_spec.rb+++ /dev/null@@ -1,126 +0,0 @@-#-- copyright-# OpenProject is an open source project management software.-# Copyright (C) 2012-2020 the OpenProject GmbH-#-# This program is free software; you can redistribute it and/or-# modify it under the terms of the GNU General Public License version 3.-#-# OpenProject is a fork of ChiliProject, which is a fork of Redmine. The copyright follows:-# Copyright (C) 2006-2017 Jean-Philippe Lang-# Copyright (C) 2010-2013 the ChiliProject Team-#-# This program is free software; you can redistribute it and/or-# modify it under the terms of the GNU General Public License-# as published by the Free Software Foundation; either version 2-# of the License, or (at your option) any later version.-#-# This program is distributed in the hope that it will be useful,-# but WITHOUT ANY WARRANTY; without even the implied warranty of-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the-# GNU General Public License for more details.-#-# You should have received a copy of the GNU General Public License-# along with this program; if not, write to the Free Software-# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.-#-# See docs/COPYRIGHT.rdoc for more details.-#++--require 'spec_helper'--describe 'time entry csv export', type: :feature do- # Force project to have only the required module activated- # This may otherwise break for non-core configurations- let(:project) { FactoryBot.create(:project, enabled_module_names: %w(time_tracking)) }- let(:role) { FactoryBot.create(:role, permissions: [:view_time_entries]) }- let(:work_package) { FactoryBot.create(:work_package, project: project) }- let(:project_time_entry) {- FactoryBot.build(:time_entry,- project: project,- work_package: work_package,- comments: 'la le lu')- }- let(:project2) { FactoryBot.create(:project) }- let(:work_package2) { FactoryBot.create(:work_package, project: project2) }- let(:project_time_entry2) {- FactoryBot.build(:time_entry,- project: project2,- work_package: work_package2,- comments: 'la le lu la le lu')- }- let(:current_user) {- FactoryBot.create(:user,- member_in_projects: [project, project2],- member_through_role: role)- }-- include Redmine::I18n-- shared_examples_for 'csv export for time entries' do- it 'returns a csv file with the entries' do- expect(page.response_headers['Content-Type']).to include('text/csv')- expect(page.response_headers['Content-Type']).to include('charset=utf-8')-- expected_header = ["#{TimeEntry.human_attribute_name(:spent_on)}," +- "#{TimeEntry.human_attribute_name(:user)}," +- "#{TimeEntry.human_attribute_name(:activity)}," +- "#{TimeEntry.human_attribute_name(:project)}," +- "#{TimeEntry.human_attribute_name(:issue)}," +- "#{TimeEntry.human_attribute_name(:type)}," +- "#{TimeEntry.human_attribute_name(:subject)}," +- "#{TimeEntry.human_attribute_name(:hours)}," +- "#{TimeEntry.human_attribute_name(:comments)}\n"]-- expected_lines = expected_header + expected_values-- page.body.each_line do |line|- expect(expected_lines).to include(line)- end- end- end-- before do- allow(User).to receive(:current).and_return current_user- project_time_entry.save- project_time_entry2.save- end-- context 'for a single project' do- before do- visit project_time_entries_path(project.identifier)- click_link('CSV')- end-- it_behaves_like 'csv export for time entries' do- let(:expected_values) {- ["#{format_date(project_time_entry.spent_on)},#{project_time_entry.user}," +- "#{project_time_entry.activity},#{project_time_entry.project}," +- "#{project_time_entry.work_package_id},#{project_time_entry.work_package.type}" +- ",#{project_time_entry.work_package.subject},#{project_time_entry.hours}" +- ",#{project_time_entry.comments}\n"]- }- end- end-- context 'for all projects' do- before do- visit time_entries_path- click_link('CSV')- end-- it_behaves_like 'csv export for time entries' do- let(:expected_values) {- ["#{format_date(project_time_entry.spent_on)},#{project_time_entry.user}," +- "#{project_time_entry.activity},#{project_time_entry.project}," +- "#{project_time_entry.work_package_id},#{project_time_entry.work_package.type}" +- ",#{project_time_entry.work_package.subject},#{project_time_entry.hours}" +- ",#{project_time_entry.comments}\n",- "#{format_date(project_time_entry2.spent_on)},#{project_time_entry2.user}," +- "#{project_time_entry2.activity},#{project_time_entry2.project}," +- "#{project_time_entry2.work_package_id},#{project_time_entry2.work_package.type}" +- ",#{project_time_entry2.work_package.subject},#{project_time_entry2.hours}" +- ",#{project_time_entry2.comments}\n"]- }- end- end-enddiff --git a/spec/features/time_entry/time_entry_report_spec.rb b/spec/features/time_entry/time_entry_report_spec.rbdeleted file mode 100644index 36fdc3264c3..00000000000--- a/spec/features/time_entry/time_entry_report_spec.rb+++ /dev/null@@ -1,100 +0,0 @@-#-- copyright-# OpenProject is an open source project management software.-# Copyright (C) 2012-2020 the OpenProject GmbH-#-# This program is free software; you can redistribute it and/or-# modify it under the terms of the GNU General Public License version 3.-#-# OpenProject is a fork of ChiliProject, which is a fork of Redmine. The copyright follows:-# Copyright (C) 2006-2017 Jean-Philippe Lang-# Copyright (C) 2010-2013 the ChiliProject Team-#-# This program is free software; you can redistribute it and/or-# modify it under the terms of the GNU General Public License-# as published by the Free Software Foundation; either version 2-# of the License, or (at your option) any later version.-#-# This program is distributed in the hope that it will be useful,-# but WITHOUT ANY WARRANTY; without even the implied warranty of-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the-# GNU General Public License for more details.-#-# You should have received a copy of the GNU General Public License-# along with this program; if not, write to the Free Software-# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.-#-# See docs/COPYRIGHT.rdoc for more details.-#++--require 'spec_helper'--describe 'time entry report', type: :feature, js: true do- let(:project) { FactoryBot.create(:project, enabled_module_names: %w(time_tracking)) }- let(:role) { FactoryBot.create(:role, permissions: [:view_time_entries]) }- let(:work_package) { FactoryBot.create(:work_package, project: project) }- let!(:project_time_entry) {- FactoryBot.create_list(:time_entry,- 2,- project: project,- work_package: work_package,- hours: 2.5)- }- let(:project2) { FactoryBot.create(:project) }- let(:work_package2) { FactoryBot.create(:work_package, project: project2) }- let!(:project_time_entry2) {- FactoryBot.create(:time_entry,- project: project2,- spent_on: 1.year.ago,- work_package: work_package2,- hours: 5.0)- }- let(:user) { FactoryBot.create(:admin) }-- before do- login_as(user)- end-- describe 'reports' do- before do- visit time_entries_report_path- end-- it 'should add columns' do- select 'Project', from: 'criterias'- select 'Month', from: 'columns'- find('.timelog-report-selection').click_button('Apply')-- expect(page).to have_selector('.total-hours', text: 'Total: 10.00 hours')- expect(page).to have_selector('tr.total .hours', text: '5.00')- select 'Year', from: 'columns'-- find('.timelog-report-selection').click_button('Apply')- expect(page).to have_selector('.total-hours', text: 'Total: 10.00 hours')- end- end-- describe 'with more precise values' do- let!(:project_time_entry) {- FactoryBot.create_list(:time_entry,- 2,- project: project,- work_package: work_package,- hours: 2.249999999)- }-- it 'rounds them to two decimals precision (Regression #30743)' do- visit time_entries_report_path-- select 'Project', from: 'criterias'- select 'Month', from: 'columns'- find('.timelog-report-selection').click_button('Apply')-- expect(page).to have_selector('.total-hours', text: 'Total: 9.50 hours')- expect(page).to have_selector('tr.total .hours', text: '4.50')- select 'Year', from: 'columns'-- find('.timelog-report-selection').click_button('Apply')- expect(page).to have_selector('.total-hours', text: 'Total: 9.50 hours')- end- end-enddiff --git a/spec/lib/api/v3/work_packages/schema/specific_work_package_schema_spec.rb b/spec/lib/api/v3/work_packages/schema/specific_work_package_schema_spec.rbindex 9163f8f1684..f5f2bc011e3 100644--- a/spec/lib/api/v3/work_packages/schema/specific_work_package_schema_spec.rb+++ b/spec/lib/api/v3/work_packages/schema/specific_work_package_schema_spec.rb@@ -160,6 +160,18 @@ describe ::API::V3::WorkPackages::Schema::SpecificWorkPackageSchema doendend+ describe '#assignable_budgets' do+ subject { described_class.new(work_package: work_package) }++ before do+ allow(project).to receive(:budgets).and_return(double('Budgets'))+ end++ it 'returns project.budgets' do+ expect(subject.assignable_values(:budget, nil)).to eql(project.budgets)+ end+ end+describe '#writable?' docontext 'percentage done' doit 'is not writable when inferred by status' dodiff --git a/spec/lib/api/v3/work_packages/schema/work_package_schema_representer_spec.rb b/spec/lib/api/v3/work_packages/schema/work_package_schema_representer_spec.rbindex 9927d207408..e78789de51d 100644--- a/spec/lib/api/v3/work_packages/schema/work_package_schema_representer_spec.rb+++ b/spec/lib/api/v3/work_packages/schema/work_package_schema_representer_spec.rb@@ -90,6 +90,10 @@ describe ::API::V3::WorkPackages::Schema::WorkPackageSchemaRepresenter dobefore dologin_as(current_user)+ allow(schema.project)+ .to receive(:module_enabled?)+ .and_return(true)+allow(schema).to receive(:writable?).and_call_originalend@@ -544,7 +548,7 @@ describe ::API::V3::WorkPackages::Schema::WorkPackageSchemaRepresenter doenddescribe 'spentTime' do- context 'with \'time_tracking\' enabled' do+ context 'with \'costs\' enabled' dobefore doallow(project).to receive(:module_enabled?)@@ -560,11 +564,11 @@ describe ::API::V3::WorkPackages::Schema::WorkPackageSchemaRepresenter doendend- context 'with \'time_tracking\' disabled' do+ context 'with \'costs\' disabled' dobefore doallow(project).to receive(:module_enabled?) do |name|- name != 'time_tracking'+ name != 'costs'endend@@ -910,6 +914,35 @@ describe ::API::V3::WorkPackages::Schema::WorkPackageSchemaRepresenter doendend+ describe 'budget' do+ it_behaves_like 'has basic schema properties' do+ let(:path) { 'budget' }+ let(:type) { 'Budget' }+ let(:name) { I18n.t('attributes.budget') }+ let(:required) { false }+ let(:writable) { true }+ end++ it_behaves_like 'has a collection of allowed values' do+ let(:json_path) { 'budget' }+ let(:href_path) { 'budgets' }+ let(:factory) { :budget }+ end++ context 'budgets disabled' do+ before do+ allow(schema.project)+ .to receive(:module_enabled?)+ .with(:budgets)+ .and_return(false)+ end++ it 'has no schema for budget' do+ is_expected.not_to have_json_path('budget')+ end+ end+ end+describe 'custom fields' dolet(:available_custom_fields) { [FactoryBot.build_stubbed(:int_wp_custom_field)] }it 'uses a CustomFieldInjector' dodiff --git a/spec/lib/api/v3/work_packages/work_package_payload_representer_spec.rb b/spec/lib/api/v3/work_packages/work_package_payload_representer_spec.rbindex 08e89a748f0..2f0cfa22bf1 100644--- a/spec/lib/api/v3/work_packages/work_package_payload_representer_spec.rb+++ b/spec/lib/api/v3/work_packages/work_package_payload_representer_spec.rb@@ -37,6 +37,7 @@ describe ::API::V3::WorkPackages::WorkPackagePayloadRepresenter dodue_date: Date.today.to_datetime,created_at: DateTime.now,updated_at: DateTime.now,+ budget: budget,type: FactoryBot.build_stubbed(:type)) do |wp|allow(wp).to receive(:available_custom_fields)@@ -44,13 +45,7 @@ describe ::API::V3::WorkPackages::WorkPackagePayloadRepresenter doendend- let(:user) do- FactoryBot.build_stubbed(:user) do |u|- allow(u)- .to receive(:allowed_to?)- .and_return(true)- end- end+ let(:budget) { FactoryBot.build_stubbed(:budget) }let(:representer) do::API::V3::WorkPackages::WorkPackagePayloadRepresenter@@ -65,6 +60,18 @@ describe ::API::V3::WorkPackages::WorkPackagePayloadRepresenter do.and_return(1)end+ #include_context 'user with stubbed permissions'+ #let(:project) { work_package.project }+ let(:user) do+ FactoryBot.build_stubbed(:user) do |u|+ allow(u)+ .to receive(:allowed_to?)+ .and_return(true)+ end+ end+ #let(:project) { work_package.project }+ #let(:permissions) { %i[view_budgets view_work_packages edit_work_packages assign_versions] }+context 'generation' dosubject(:generated) { representer.to_json }@@ -408,6 +415,38 @@ describe ::API::V3::WorkPackages::WorkPackagePayloadRepresenter doendendend++ describe 'budgets' do+ context 'without a cost object assigned' do+ let(:budget) { nil }++ it_behaves_like 'linked property' do+ let(:property) { :budget }+ let(:link) { nil }+ end+ end++ context 'with a cost object assigned' do+ it_behaves_like 'linked property' do+ let(:property) { :budget }+ let(:link) { api_v3_paths.budget(budget.id) }+ end+ end++ context 'without necessary permissions' do+ before do+ allow(user)+ .to receive(:allowed_to?)+ .with(:view_budgets, work_package.project)+ .and_return(false)+ end++ it 'has no href' do+ expect(subject)+ .not_to have_json_path('_links/budget')+ end+ end+ endenddescribe 'custom fields' dodiff --git a/spec/lib/api/v3/work_packages/work_package_representer_spec.rb b/spec/lib/api/v3/work_packages/work_package_representer_spec.rbindex 6e10ffff4e3..7a3a73c98dc 100644--- a/spec/lib/api/v3/work_packages/work_package_representer_spec.rb+++ b/spec/lib/api/v3/work_packages/work_package_representer_spec.rb@@ -50,6 +50,7 @@ describe ::API::V3::WorkPackages::WorkPackageRepresenter dolet(:spent_hours) { 0 }let(:derived_start_date) { Date.today - 4.days }let(:derived_due_date) { Date.today - 5.days }+ let(:budget) { FactoryBot.build_stubbed(:budget, project: project) }let(:work_package) doFactoryBot.build_stubbed(:stubbed_work_package,schedule_manually: schedule_manually,@@ -64,6 +65,7 @@ describe ::API::V3::WorkPackages::WorkPackageRepresenter doresponsible: responsible,estimated_hours: estimated_hours,derived_estimated_hours: derived_estimated_hours,+ budget: budget,status: status) do |wp|allow(wp).to receive(:available_custom_fields)@@ -588,6 +590,36 @@ describe ::API::V3::WorkPackages::WorkPackageRepresenter doendend+ describe 'budget' do+ context 'with the user having the view_budgets permission' do+ let(:permissions) { [:view_budgets] }++ it_behaves_like 'has a titled link' do+ let(:link) { 'budget' }+ let(:href) { "/api/v3/budgets/#{budget.id}" }+ let(:title) { budget.subject }+ end++ it 'has the budget embedded' do+ is_expected+ .to be_json_eql(budget.subject.to_json)+ .at_path('_embedded/budget/subject')+ end+ end++ context 'with the user lacking the view_budgets permission' do+ it 'has no link to the budget' do+ is_expected+ .not_to have_json_path('_links/budget')+ end++ it 'has no budget embedded' do+ is_expected+ .not_to have_json_path('_embedded/budget')+ end+ end+ end+describe 'schema' doit_behaves_like 'has an untitled link' dolet(:link) { 'schema' }@@ -764,17 +796,23 @@ describe ::API::V3::WorkPackages::WorkPackageRepresenter doendend- context 'when the user has the permission to view time entries' do- it 'should have a link to add child' do- expect(subject).to have_json_path('_links/timeEntries/href')+ context 'timeEntries' do+ context 'when the user has the permission to view time entries' do+ it_behaves_like 'has a titled link' do+ let(:link) { 'timeEntries' }+ let(:href) do+ api_v3_paths.path_for(:time_entries, filters: [{ work_package_id: { operator: "=", values: [work_package.id.to_s] } }])+ end+ let(:title) { 'Time entries' }+ endend- end- context 'when the user does not have the permission to view time entries' do- let(:permissions) { all_permissions - [:view_time_entries] }+ context 'when the user does not have the permission to view time entries' do+ let(:permissions) { all_permissions - [:view_time_entries] }- it 'should not have a link to timeEntries' do- expect(subject).not_to have_json_path('_links/timeEntries/href')+ it 'should not have a link to timeEntries' do+ expect(subject).not_to have_json_path('_links/timeEntries/href')+ endendend@@ -899,6 +937,7 @@ describe ::API::V3::WorkPackages::WorkPackageRepresenter doit_behaves_like 'action link' dolet(:action) { 'logTime' }let(:permission) { :log_time }+ let(:href) { api_v3_paths.time_entries }endenddiff --git a/spec/models/changeset_spec.rb b/spec/models/changeset_spec.rbindex bd7a4c0942e..47cec4f3522 100644--- a/spec/models/changeset_spec.rb+++ b/spec/models/changeset_spec.rb@@ -213,7 +213,7 @@ describe Changeset, type: :model dodescribe 'with timelogs' dolet!(:activity) { FactoryBot.create :activity, is_default: true }before do- repository.project.enabled_module_names += ['time_tracking']+ repository.project.enabled_module_names += ['costs']repository.project.save!enddiff --git a/spec/models/permitted_params_spec.rb b/spec/models/permitted_params_spec.rbindex 9f8e6328301..67871cfddbf 100644--- a/spec/models/permitted_params_spec.rb+++ b/spec/models/permitted_params_spec.rb@@ -106,31 +106,6 @@ describe PermittedParams, type: :model doit_behaves_like 'allows params'end- describe '#time_entry' do- let(:attribute) { :time_entry }-- context 'whitelisted params' do- let(:hash) do- acceptable_params = %w(hours comments work_package_id- activity_id spent_on)-- acceptable_params_with_data = HashWithIndifferentAccess[acceptable_params.map { |x| [x, 'value'] }]-- acceptable_params_with_data['custom_field_values'] = { '1' => 'foo', '2' => 'bar', '3' => 'baz' }-- acceptable_params_with_data- end-- it_behaves_like 'allows params'- end-- context 'empty' do- let(:hash) { {} }-- it_behaves_like 'allows params'- end- end-describe '#news' dolet(:attribute) { :news }let(:hash) do@@ -446,6 +421,12 @@ describe PermittedParams, type: :model doit_behaves_like 'allows params'end+ context 'budget_id' do+ let(:hash) { { 'budget_id' => '1' } }++ it_behaves_like 'allows params'+ end+context 'notes' dolet(:hash) { { 'journal_notes' => 'blubs' } }@@ -486,35 +467,6 @@ describe PermittedParams, type: :model doendend- context 'time_entry' do- include_context 'prepare params comparison'-- let(:hash) { { 'time_entry' => { 'hours' => '5', 'activity_id' => '1', 'comments' => 'lorem' } } }- let(:project) { double('project') }-- before do- allow(user).to receive(:allowed_to?).with(:log_time, project).and_return(allowed_to)- end-- subject { PermittedParams.new(params, user).update_work_package(project: project).to_h }-- context 'user has the log_time permission' do- let(:allowed_to) { true }-- it do- expect(subject).to eq(hash)- end- end-- context 'user lacks the log_time permission' do- let(:allowed_to) { false }-- it do- expect(subject).to eq({})- end- end- end-context 'custom field values' dolet(:hash) { { 'custom_field_values' => { '1' => '5' } } }diff --git a/spec/requests/api/v3/work_package_resource_spec.rb b/spec/requests/api/v3/work_package_resource_spec.rbindex 5985f45dd37..a7a46de02ec 100644--- a/spec/requests/api/v3/work_package_resource_spec.rb+++ b/spec/requests/api/v3/work_package_resource_spec.rb@@ -950,6 +950,37 @@ describe 'API v3 Work package resource',endend+ context 'budget' do+ let(:target_budget) { FactoryBot.create(:budget, project: project) }+ let(:budget_link) { api_v3_paths.budget target_budget.id }+ let(:budget_parameter) { { _links: { budget: { href: budget_link } } } }+ let(:params) { valid_params.merge(budget_parameter) }+ let(:permissions) { %i[view_work_packages edit_work_packages view_budgets] }++ before { login_as(current_user) }++ context 'valid' do+ include_context 'patch request'++ it { expect(response.status).to eq(200) }++ it 'should respond with the work package and its new budget' do+ expect(subject.body).to be_json_eql(target_budget.subject.to_json)+ .at_path('_embedded/budget/subject')+ end+ end++ context 'not valid' do+ let(:target_budget) { FactoryBot.create(:budget) }++ include_context 'patch request'++ it_behaves_like 'constraint violation' do+ let(:message) { I18n.t('activerecord.errors.messages.inclusion') }+ end+ end+ end+context 'list custom field' dolet(:custom_field) doFactoryBot.create(:list_wp_custom_field)diff --git a/spec/requests/api/v3/work_packages/form/work_package_form_resource_spec.rb b/spec/requests/api/v3/work_packages/form/work_package_form_resource_spec.rbindex d5585400003..a9719eacc10 100644--- a/spec/requests/api/v3/work_packages/form/work_package_form_resource_spec.rb+++ b/spec/requests/api/v3/work_packages/form/work_package_form_resource_spec.rb@@ -34,7 +34,7 @@ describe 'API v3 Work package form resource', type: :request, with_mail: false dinclude Capybara::RSpecMatchersinclude API::V3::Utilities::PathHelper- shared_let(:all_allowed_permissions) { %i[view_work_packages edit_work_packages assign_versions] }+ shared_let(:all_allowed_permissions) { %i[view_work_packages edit_work_packages assign_versions view_budgets] }shared_let(:assign_permissions) { %i[view_work_packages assign_versions] }shared_let(:project) { FactoryBot.create(:project, public: false) }shared_let(:work_package) do@@ -668,6 +668,55 @@ describe 'API v3 Work package form resource', type: :request, with_mail: false dendend+ describe 'budget' do+ let(:path) { '_embedded/payload/_links/budget/href' }+ let(:links_path) { '_embedded/schema/budget/_links' }+ let(:target_budget) { FactoryBot.create(:budget, project: project) }+ let(:other_budget) { FactoryBot.create(:budget, project: project) }+ let(:budget_link) { api_v3_paths.budget target_budget.id }+ let(:budget_parameter) { { _links: { budget: { href: budget_link } } } }+ let(:params) { valid_params.merge(budget_parameter) }++ describe 'allowed values' do+ before do+ other_budget+ end++ include_context 'post request'++ it 'should list the budgets' do+ budgets = project.budgets++ budgets.each_with_index do |budget, index|+ expect(subject.body).to be_json_eql(api_v3_paths.budget(budget.id).to_json)+ .at_path("#{links_path}/allowedValues/#{index}/href")+ end+ end+ end++ context 'valid budget' do+ include_context 'post request'++ it_behaves_like 'having no errors'++ it 'should respond with updated work package budget' do+ expect(subject.body).to be_json_eql(budget_link.to_json).at_path(path)+ end+ end++ context 'invalid budget' do+ let(:target_budget) { FactoryBot.create(:budget) }++ include_context 'post request'++ it_behaves_like 'having an error', 'budget'++ it 'should respond with updated work package budget' do+ expect(subject.body).to be_json_eql(budget_link.to_json).at_path(path)+ end+ end+ end+describe 'multiple errors' dolet(:user_link) { api_v3_paths.user 4200 }let(:status_link) { api_v3_paths.status -1 }diff --git a/spec/routing/timelog_spec.rb b/spec/routing/timelog_spec.rbdeleted file mode 100644index 9e9d4790cf3..00000000000--- a/spec/routing/timelog_spec.rb+++ /dev/null@@ -1,161 +0,0 @@-#-- copyright-# OpenProject is an open source project management software.-# Copyright (C) 2012-2020 the OpenProject GmbH-#-# This program is free software; you can redistribute it and/or-# modify it under the terms of the GNU General Public License version 3.-#-# OpenProject is a fork of ChiliProject, which is a fork of Redmine. The copyright follows:-# Copyright (C) 2006-2017 Jean-Philippe Lang-# Copyright (C) 2010-2013 the ChiliProject Team-#-# This program is free software; you can redistribute it and/or-# modify it under the terms of the GNU General Public License-# as published by the Free Software Foundation; either version 2-# of the License, or (at your option) any later version.-#-# This program is distributed in the hope that it will be useful,-# but WITHOUT ANY WARRANTY; without even the implied warranty of-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the-# GNU General Public License for more details.-#-# You should have received a copy of the GNU General Public License-# along with this program; if not, write to the Free Software-# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.-#-# See docs/COPYRIGHT.rdoc for more details.-#++--require 'spec_helper'--describe TimelogController, type: :routing do- it 'connects GET /time_entries to timelog#index' do- expect(get('/time_entries')).to route_to(controller: 'timelog',- action: 'index')- end-- it {- expect(get('/time_entries.csv')).to route_to(controller: 'timelog',- action: 'index',- format: 'csv')- }-- it {- expect(get('/time_entries.atom')).to route_to(controller: 'timelog',- action: 'index',- format: 'atom')- }-- it {- is_expected.to route(:get, '/time_entries/new').to(controller: 'timelog',- action: 'new')- }-- it {- is_expected.to route(:get, '/time_entries/22/edit').to(controller: 'timelog',- action: 'edit',- id: '22')- }-- it {- is_expected.to route(:post, '/time_entries').to(controller: 'timelog',- action: 'create')- }-- it {- is_expected.to route(:put, '/time_entries/22').to(controller: 'timelog',- action: 'update',- id: '22')- }-- it {- is_expected.to route(:delete, '/time_entries/55').to(controller: 'timelog',- action: 'destroy',- id: '55')- }-- context 'reports' do- it {- is_expected.to route(:get, '/time_entries/report').to(controller: 'time_entries/reports',- action: 'show')- }- end-- context 'work package scoped' do- it 'should connect GET /work_packages/:work_package_id/time_entries/new to timelog#new' do- expect(get('/work_packages/1/time_entries/new')).to route_to(controller: 'timelog',- action: 'new',- work_package_id: '1')- end- end-- context 'project scoped' do- it 'connects GET /projects/:id/time_entries to timelog#index' do- expect(get('/projects/1/time_entries')).to route_to(controller: 'timelog',- action: 'index',- project_id: '1')- end-- it {- expect(get('/projects/567/time_entries.csv')).to route_to(controller: 'timelog',- action: 'index',- project_id: '567',- format: 'csv')- }-- it {- expect(get('/projects/567/time_entries.atom')).to route_to(controller: 'timelog',- action: 'index',- project_id: '567',- format: 'atom')- }-- it {- is_expected.to route(:get, '/projects/567/time_entries/new').to(controller: 'timelog',- action: 'new',- project_id: '567')- }-- it {- is_expected.to route(:get, '/projects/567/time_entries/22/edit').to(controller: 'timelog',- action: 'edit',- id: '22',- project_id: '567')- }-- it {- is_expected.to route(:post, '/projects/567/time_entries').to(controller: 'timelog',- action: 'create',- project_id: '567')- }-- it {- is_expected.to route(:put, '/projects/567/time_entries/22').to(controller: 'timelog',- action: 'update',- id: '22',- project_id: '567')- }-- it {- is_expected.to route(:delete, '/projects/567/time_entries/55').to(controller: 'timelog',- action: 'destroy',- id: '55',- project_id: '567')- }-- context 'reports' do- it {- is_expected.to route(:get, '/projects/567/time_entries/report').to(controller: 'time_entries/reports',- action: 'show',- project_id: '567')- }-- it {- expect(get('/projects/567/time_entries/report.csv')).to route_to(controller: 'time_entries/reports',- action: 'show',- project_id: '567',- format: 'csv')- }- end- end-enddiff --git a/spec_legacy/fixtures/enabled_modules.yml b/spec_legacy/fixtures/enabled_modules.ymlindex 544f398c8c1..fa7a4f5b3ff 100644--- a/spec_legacy/fixtures/enabled_modules.yml+++ b/spec_legacy/fixtures/enabled_modules.yml@@ -32,7 +32,7 @@ enabled_modules_001:project_id: 1id: 1enabled_modules_002:- name: time_tracking+ name: costsproject_id: 1id: 2enabled_modules_003:@@ -64,7 +64,7 @@ enabled_modules_011:project_id: 2id: 11enabled_modules_012:- name: time_tracking+ name: costsproject_id: 3id: 12enabled_modules_013:diff --git a/spec_legacy/functional/time_entries/reports_controller_spec.rb b/spec_legacy/functional/time_entries/reports_controller_spec.rbdeleted file mode 100644index 2ceb7914a17..00000000000--- a/spec_legacy/functional/time_entries/reports_controller_spec.rb+++ /dev/null@@ -1,188 +0,0 @@-#-- encoding: UTF-8--#-- copyright-# OpenProject is an open source project management software.-# Copyright (C) 2012-2020 the OpenProject GmbH-#-# This program is free software; you can redistribute it and/or-# modify it under the terms of the GNU General Public License version 3.-#-# OpenProject is a fork of ChiliProject, which is a fork of Redmine. The copyright follows:-# Copyright (C) 2006-2017 Jean-Philippe Lang-# Copyright (C) 2010-2013 the ChiliProject Team-#-# This program is free software; you can redistribute it and/or-# modify it under the terms of the GNU General Public License-# as published by the Free Software Foundation; either version 2-# of the License, or (at your option) any later version.-#-# This program is distributed in the hope that it will be useful,-# but WITHOUT ANY WARRANTY; without even the implied warranty of-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the-# GNU General Public License for more details.-#-# You should have received a copy of the GNU General Public License-# along with this program; if not, write to the Free Software-# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.-#-# See docs/COPYRIGHT.rdoc for more details.-#++--require_relative '../../legacy_spec_helper'--describe TimeEntries::ReportsController, type: :controller do- render_views-- fixtures :all-- it 'should report at project level' do- get :show, params: { project_id: 'ecookbook' }- assert_response :success- assert_template 'time_entries/reports/show'- assert_select 'form',- attributes: { action: '/projects/ecookbook/time_entries/report', id: 'query_form' }- end-- it 'should report all projects' do- get :show- assert_response :success- assert_template 'time_entries/reports/show'- assert_select 'form',- attributes: { action: '/time_entries/report', id: 'query_form' }- end-- it 'should report all projects denied' do- r = Role.anonymous- r.remove_permission!(:view_time_entries)- r.save!- get :show- assert_redirected_to '/login?back_url=http%3A%2F%2Ftest.host%2Ftime_entries%2Freport'- end-- it 'should report all projects one criteria' do- get :show, params: { columns: 'week', from: '2007-04-01', to: '2007-04-30', criterias: ['project'] }- assert_response :success- assert_template 'time_entries/reports/show'- refute_nil assigns(:total_hours)- assert_equal '8.65', '%.2f' % assigns(:total_hours)- end-- it 'should report all time' do- get :show, params: { project_id: 1, criterias: ['project', 'issue'] }- assert_response :success- assert_template 'time_entries/reports/show'- refute_nil assigns(:total_hours)- assert_equal '162.90', '%.2f' % assigns(:total_hours)- end-- it 'should report all time by day' do- get :show, params: { project_id: 1, criterias: ['project', 'issue'], columns: 'day' }- assert_response :success- assert_template 'time_entries/reports/show'- refute_nil assigns(:total_hours)- assert_equal '162.90', '%.2f' % assigns(:total_hours)- assert_select 'th', descendant: { content: /\s*2007-03-12\s*/ }- end-- it 'should report one criteria' do- get :show, params: { project_id: 1, columns: 'week', from: '2007-04-01', to: '2007-04-30', criterias: ['project'] }- assert_response :success- assert_template 'time_entries/reports/show'- refute_nil assigns(:total_hours)- assert_equal '8.65', '%.2f' % assigns(:total_hours)- end-- it 'should report two criterias' do- get :show, params: { project_id: 1,- columns: 'month',- from: '2007-01-01',- to: '2007-12-31',- criterias: ['member', 'activity'] }- assert_response :success- assert_template 'time_entries/reports/show'- refute_nil assigns(:total_hours)- assert_equal '162.90', '%.2f' % assigns(:total_hours)- end-- it 'should report one day' do- get :show, params: { project_id: 1, columns: 'day', from: '2007-03-23', to: '2007-03-23', criterias: ['member', 'activity'] }- assert_response :success- assert_template 'time_entries/reports/show'- refute_nil assigns(:total_hours)- assert_equal '4.25', '%.2f' % assigns(:total_hours)- end-- it 'should report at issue level' do- get :show, params: { project_id: 1,- work_package_id: 1,- columns: 'month',- from: '2007-01-01',- to: '2007-12-31',- criterias: ['member', 'activity'] }- assert_response :success- assert_template 'time_entries/reports/show'- refute_nil assigns(:total_hours)- assert_equal '154.25', '%.2f' % assigns(:total_hours)- assert_select 'form',- attributes: { action: work_package_time_entries_report_path(1), id: 'query_form' }- end-- it 'should report custom field criteria' do- get :show, params: { project_id: 1, criterias: ['project', 'cf_1', 'cf_7'] }- assert_response :success- assert_template 'time_entries/reports/show'- refute_nil assigns(:total_hours)- refute_nil assigns(:criterias)- assert_equal 3, assigns(:criterias).size- assert_equal '162.90', '%.2f' % assigns(:total_hours)- # Custom field column- assert_select 'th', descendant: { content: /\s*Database\s*/ }- # Custom field row- assert_select 'td',- content: 'MySQL',- sibling: { tag: 'td', attributes: { class: 'hours' },- child: { tag: 'span', attributes: { class: 'hours hours-int' },- content: '1' } }- # Second custom field column- assert_select 'th', descendant: { content: /\s*Billable\s*/ }- end-- it 'should report one criteria no result' do- get :show, params: { project_id: 1, columns: 'week', from: '1998-04-01', to: '1998-04-30', criterias: ['project'] }- assert_response :success- assert_template 'time_entries/reports/show'- refute_nil assigns(:total_hours)- assert_equal '0.00', '%.2f' % assigns(:total_hours)- end-- it 'should report all projects csv export' do- get :show, params: { columns: 'month',- from: '2007-01-01',- to: '2007-06-30',- criterias: ['project', 'member', 'activity'],- format: 'csv' }- assert_response :success- assert_match(/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-- it 'should report csv export' do- get :show, params: { project_id: 1,- columns: 'month',- from: '2007-01-01',- to: '2007-06-30',- criterias: ['project', 'member', 'activity'],- format: 'csv' }- assert_response :success- assert_match(/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-enddiff --git a/spec_legacy/functional/timelog_controller_spec.rb b/spec_legacy/functional/timelog_controller_spec.rbdeleted file mode 100644index 80dbf8f111e..00000000000--- a/spec_legacy/functional/timelog_controller_spec.rb+++ /dev/null@@ -1,95 +0,0 @@-#-- encoding: UTF-8-#-- copyright-# OpenProject is an open source project management software.-# Copyright (C) 2012-2020 the OpenProject GmbH-#-# This program is free software; you can redistribute it and/or-# modify it under the terms of the GNU General Public License version 3.-#-# OpenProject is a fork of ChiliProject, which is a fork of Redmine. The copyright follows:-# Copyright (C) 2006-2017 Jean-Philippe Lang-# Copyright (C) 2010-2013 the ChiliProject Team-#-# This program is free software; you can redistribute it and/or-# modify it under the terms of the GNU General Public License-# as published by the Free Software Foundation; either version 2-# of the License, or (at your option) any later version.-#-# This program is distributed in the hope that it will be useful,-# but WITHOUT ANY WARRANTY; without even the implied warranty of-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the-# GNU General Public License for more details.-#-# You should have received a copy of the GNU General Public License-# along with this program; if not, write to the Free Software-# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.-#-# See docs/COPYRIGHT.rdoc for more details.-#++--require_relative '../legacy_spec_helper'-require 'timelog_controller'--describe TimelogController, type: :controller do- render_views-- fixtures :all-- it 'should get new' do- session[:user_id] = 3- get :new, params: { project_id: 1 }- assert_response :success- assert_template 'edit'- # Default activity selected- assert_select 'option',- attributes: { selected: 'selected' },- content: 'Development'- end-- it 'should get new should only show active time entry activities' do- session[:user_id] = 3- get :new, params: { project_id: 1 }- assert_response :success- assert_template 'edit'- assert_select('option', { content: 'Inactive Activity' }, false)- end-- it 'should get edit existing time' do- session[:user_id] = 2- get :edit, params: { id: 2, project_id: nil }- assert_response :success- assert_template 'edit'- # Default activity selected- assert_select 'form', attributes: { action: '/projects/ecookbook/time_entries/2' }- end-- it 'should get edit with an existing time entry with inactive activity' do- te = TimeEntry.find(1)- te.activity = TimeEntryActivity.find_by(name: 'Inactive Activity')- te.save!-- session[:user_id] = 1- get :edit, params: { project_id: 1, id: 1 }- assert_response :success- assert_template 'edit'- # Blank option since nothing is pre-selected- assert_select 'option', content: '--- Please select ---'- end-- it 'should update' do- entry = TimeEntry.find(1)- assert_equal 1, entry.work_package_id- assert_equal 2, entry.user_id-- session[:user_id] = 1- put :update, params: { id: 1,- time_entry: { work_package_id: '2',- hours: '8' } }- assert_redirected_to action: 'index', project_id: 'ecookbook'- entry.reload-- assert_equal 8, entry.hours- assert_equal 2, entry.work_package_id- assert_equal 2, entry.user_id- end-enddiff --git a/spec_legacy/unit/lib/redmine_spec.rb b/spec_legacy/unit/lib/redmine_spec.rbindex 799df1bab54..12ca85c0de5 100644--- a/spec_legacy/unit/lib/redmine_spec.rb+++ b/spec_legacy/unit/lib/redmine_spec.rb@@ -1,4 +1,5 @@#-- encoding: UTF-8+#-- copyright# OpenProject is an open source project management software.# Copyright (C) 2012-2020 the OpenProject GmbH@@ -26,7 +27,7 @@## See docs/COPYRIGHT.rdoc for more details.#++-require 'legacy_spec_helper'+require_relative '../../legacy_spec_helper'module RedmineMenuTestHelper# Assertions@@ -48,10 +49,9 @@ describe Redmine doinclude RedmineMenuTestHelperit 'should top_menu' do- assert_number_of_items_in_menu :top_menu, 5+ assert_number_of_items_in_menu :top_menu, 4assert_menu_contains_item_named :top_menu, :work_packagesassert_menu_contains_item_named :top_menu, :news- assert_menu_contains_item_named :top_menu, :time_sheet# do not test :projects here. it does not appear in the top_menu data structure, but will be generated by the TopMenuHelperassert_menu_contains_item_named :top_menu, :helpenddiff --git a/spec_legacy/unit/time_entry_spec.rb b/spec_legacy/unit/time_entry_spec.rbdeleted file mode 100644index 69d0f9c21ea..00000000000--- a/spec_legacy/unit/time_entry_spec.rb+++ /dev/null@@ -1,145 +0,0 @@-#-- encoding: UTF-8-#-- copyright-# OpenProject is an open source project management software.-# Copyright (C) 2012-2020 the OpenProject GmbH-#-# This program is free software; you can redistribute it and/or-# modify it under the terms of the GNU General Public License version 3.-#-# OpenProject is a fork of ChiliProject, which is a fork of Redmine. The copyright follows:-# Copyright (C) 2006-2017 Jean-Philippe Lang-# Copyright (C) 2010-2013 the ChiliProject Team-#-# This program is free software; you can redistribute it and/or-# modify it under the terms of the GNU General Public License-# as published by the Free Software Foundation; either version 2-# of the License, or (at your option) any later version.-#-# This program is distributed in the hope that it will be useful,-# but WITHOUT ANY WARRANTY; without even the implied warranty of-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the-# GNU General Public License for more details.-#-# You should have received a copy of the GNU General Public License-# along with this program; if not, write to the Free Software-# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.-#-# See docs/COPYRIGHT.rdoc for more details.-#++-require_relative '../legacy_spec_helper'--describe TimeEntry, type: :model do- fixtures :all-- it 'should hours format' do- assertions = { '2' => 2.0,- '21.1' => 21.1,- '2,1' => 2.1,- '1,5h' => 1.5,- '7:12' => 7.2,- '10h' => 10.0,- '10 h' => 10.0,- '45m' => 0.75,- '45 m' => 0.75,- '3h15' => 3.25,- '3h 15' => 3.25,- '3 h 15' => 3.25,- '3 h 15m' => 3.25,- '3 h 15 m' => 3.25,- '3 hours' => 3.0,- '12min' => 0.2,- }-- assertions.each do |k, v|- t = TimeEntry.new(hours: k)- assert_equal v, t.hours, "Converting #{k} failed:"- end- end-- it 'should hours should default to nil' do- assert_nil TimeEntry.new.hours- end-- it 'should spent on with blank' do- c = TimeEntry.new- c.spent_on = ''- assert_nil c.spent_on- end-- it 'should spent on with nil' do- c = TimeEntry.new- c.spent_on = nil- assert_nil c.spent_on- end-- it 'should spent on with string' do- c = TimeEntry.new- c.spent_on = '2011-01-14'- assert_equal Date.parse('2011-01-14'), c.spent_on- end-- it 'should spent on with invalid string' do- c = TimeEntry.new- c.spent_on = 'foo'- assert_nil c.spent_on- end-- it 'should spent on with date' do- c = TimeEntry.new- c.spent_on = Date.today- assert_equal Date.today, c.spent_on- end-- it 'should spent on with time' do- c = TimeEntry.new- c.spent_on = Time.now- assert_equal Date.today, c.spent_on- end-- context '#earliest_date_for_project' do- before do- User.current = nil- @public_project = FactoryBot.create(:project, public: true)- @issue = FactoryBot.create(:work_package, project: @public_project)- FactoryBot.create(:time_entry, spent_on: '2010-01-01',- work_package: @issue,- project: @public_project)- end-- context 'without a project' do- it 'should return the lowest spent_on value that is visible to the current user' do- assert_equal '2007-03-12', TimeEntry.earliest_date_for_project.to_s- end- end-- context 'with a project' do- it "should return the lowest spent_on value that is visible to the current user for that project and it's subprojects only" do- assert_equal '2010-01-01', TimeEntry.earliest_date_for_project(@public_project).to_s- end- end- end-- context '#latest_date_for_project' do- before do- User.current = nil- @public_project = FactoryBot.create(:project, public: true)- @issue = FactoryBot.create(:work_package, project: @public_project)- FactoryBot.create(:time_entry, spent_on: '2010-01-01',- work_package: @issue,- project: @public_project)- end-- context 'without a project' do- it 'should return the highest spent_on value that is visible to the current user' do- assert_equal '2010-01-01', TimeEntry.latest_date_for_project.to_s- end- end-- context 'with a project' do- it "should return the highest spent_on value that is visible to the current user for that project and it's subprojects only" do- project = Project.find(1)- assert_equal '2007-04-22', TimeEntry.latest_date_for_project(project).to_s- end- end- end-end