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
Fix user decimals for comma decimal separators
Oliver Güntherdff8d963f2b4
diff --git a/modules/costs/app/views/hourly_rates/_rate.html.erb b/modules/costs/app/views/hourly_rates/_rate.html.erbindex ec658b5763d..7c8b176b9fd 100644--- a/modules/costs/app/views/hourly_rates/_rate.html.erb+++ b/modules/costs/app/views/hourly_rates/_rate.html.erb@@ -53,7 +53,7 @@ See COPYRIGHT and LICENSE files for more details.<label class="hidden-for-sighted" for="<%= "#{id_prefix}_rate" %>"><%= Rate.model_name.human %></label><%= rate_form.text_field :rate,index: id_or_index,- value: rate.rate ? rate.rate.round(2) : "",+ value: rate.rate ? unitless_currency_number(rate.rate.round(2)) : "",required: true %><span class="form-label"><%= Setting.plugin_costs['costs_currency'] %>diff --git a/modules/costs/spec/features/users_hourly_rates_spec.rb b/modules/costs/spec/features/users_hourly_rates_spec.rbindex d3eeff2a9f6..28461b9b461 100644--- a/modules/costs/spec/features/users_hourly_rates_spec.rb+++ b/modules/costs/spec/features/users_hourly_rates_spec.rb@@ -26,7 +26,7 @@# See COPYRIGHT and LICENSE files for more details.#++-require File.expand_path(File.dirname(__FILE__) + '/../spec_helper.rb')+require_relative '../spec_helper'describe 'hourly rates on user edit', type: :feature, js: true dolet(:user) { create :admin }@@ -36,7 +36,7 @@ describe 'hourly rates on user edit', type: :feature, js: true doendbefore do- allow(User).to receive(:current).and_return user+ login_as userendcontext 'with no rates' do@@ -62,10 +62,10 @@ describe 'hourly rates on user edit', type: :feature, js: true dodescribe 'deleting all rates' dobefore do- click_link 'Update' # go to update view for rates+ click_link 'Update' # go to update view for ratesSeleniumHubWaiter.wait- find('.icon-delete').click # delete last existing rate- click_on 'Save' # save change+ find('.icon-delete').click # delete last existing rate+ click_on 'Save' # save changeend# regression test: clicking save used to result in a error@@ -77,4 +77,28 @@ describe 'hourly rates on user edit', type: :feature, js: true doendendend++ describe 'updating rates as German user', driver: :firefox_de do+ let(:user) { create :admin, language: 'de' }+ let!(:rate) { create(:default_hourly_rate, user: user, rate: 1.0) }++ it 'allows editing without reinterpreting the number (Regression #42219)' do+ visit edit_hourly_rate_path(user)++ # Expect the german locale output+ expect(page).to have_field("user[existing_rate_attributes][#{rate.id}][rate]", with: '1,00')++ click_link 'Satz hinzufügen'++ fill_in "user_new_rate_attributes_1_valid_from", with: (Time.zone.today + 1.day).iso8601+ fill_in "user_new_rate_attributes_1_rate", with: '5,12'++ click_button 'Speichern'++ view_rates++ expect(page).to have_selector('.currency', text: '1,00')+ expect(page).to have_selector('.currency', text: '5,12')+ end+ endend