Skip to content

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

apply currency_number transformation to hidden field

ulfertsd44525022b2a
diff --git a/modules/costs/app/views/cost_objects/items/_labor_budget_item.html.erb b/modules/costs/app/views/cost_objects/items/_labor_budget_item.html.erb
index d26369bee53..c879e548af2 100644
--- a/modules/costs/app/views/cost_objects/items/_labor_budget_item.html.erb
+++ b/modules/costs/app/views/cost_objects/items/_labor_budget_item.html.erb
@@ -78,7 +78,7 @@ See docs/COPYRIGHT.rdoc for more details.
<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: labor_budget_item.budget %>
+ <%= cost_form.hidden_field :budget, value: unitless_currency_number(labor_budget_item.budget) %>
<% end %>
<% cost_value = labor_budget_item.budget || labor_budget_item.calculated_costs(@cost_object.fixed_date, @cost_object.project_id) %>
diff --git a/modules/costs/app/views/cost_objects/items/_material_budget_item.html.erb b/modules/costs/app/views/cost_objects/items/_material_budget_item.html.erb
index ac0460132b1..bca54116462 100644
--- a/modules/costs/app/views/cost_objects/items/_material_budget_item.html.erb
+++ b/modules/costs/app/views/cost_objects/items/_material_budget_item.html.erb
@@ -80,11 +80,13 @@ See docs/COPYRIGHT.rdoc for more details.
<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: material_budget_item.budget %>
+ <%= cost_form.hidden_field :budget, value: unitless_currency_number(material_budget_item.budget) %>
<% 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_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]" %>">
<a id="<%= id_prefix %>_costs" class="costs--edit-planned-costs-btn icon-context icon-edit" role="button" title="<%= t(:help_click_to_edit) %>">