diff --git a/app/controllers/costlog_controller.rb b/app/controllers/costlog_controller.rb index fc981ccc9c..ccba10e7d7 100644 --- a/app/controllers/costlog_controller.rb +++ b/app/controllers/costlog_controller.rb @@ -204,6 +204,7 @@ private end def clean_currency(value) + return nil if value == "" if value value = value.strip value.gsub!(l(:currency_delimiter), '') if value.include?(l(:currency_delimiter)) && value.include?(l(:currency_separator)) diff --git a/app/views/costlog/_list.rhtml b/app/views/costlog/_list.rhtml index 01ef853431..89ce8a78b4 100644 --- a/app/views/costlog/_list.rhtml +++ b/app/views/costlog/_list.rhtml @@ -26,7 +26,7 @@ <%=h entry.comments %> <%= pluralize(entry.units, entry.cost_type.unit, entry.cost_type.unit_plural) %> - <% if User.current.allowed_to?(:view_unit_price, entry.project) -%> + <% if User.current.allowed_to?(:view_unit_price, entry.project) || (entry.user == User.current && entry.overridden_costs ) -%> <%= number_to_currency entry.costs %> <%- else -%>-<% end -%> diff --git a/app/views/costlog/edit.rhtml b/app/views/costlog/edit.rhtml index 96096d970a..5d616a57fc 100644 --- a/app/views/costlog/edit.rhtml +++ b/app/views/costlog/edit.rhtml @@ -20,11 +20,18 @@

- <%= number_to_currency(@cost_entry.calculated_costs) %> - <%= update_page_tag do |page| - page << "makeEditable('cost_entry_costs', 'cost_entry[costs]');" - page << "edit($('cost_entry_costs'), 'cost_entry[overridden_costs]', '#{number_to_currency(@cost_entry.overridden_costs)}');" if @cost_entry.overridden_costs - end %> + <% if User.current.allowed_to? :view_unit_price, @cost_entry.project %> + <%= number_to_currency(@cost_entry.calculated_costs) %> + <%= update_page_tag do |page| + page << "makeEditable('cost_entry_costs', 'cost_entry[costs]');" + page << "edit($('cost_entry_costs'), 'cost_entry[overridden_costs]', '#{number_to_currency(@cost_entry.overridden_costs)}');" if @cost_entry.overridden_costs + end %> + <% else %> + + " size="7" name="cost_entry[overridden_costs]" id="cost_entry_costs_edit"/> <%= Setting.plugin_redmine_costs['costs_currency'] %> + +
<%= l(:help_override_rate) %> + <% end %>

<%= f.text_field :comments, :size => 100 %>

diff --git a/lang/en.yml b/lang/en.yml index 5857556f54..c825eacebc 100644 --- a/lang/en.yml +++ b/lang/en.yml @@ -21,6 +21,7 @@ permission_edit_deliverables: "Edit deliverables" label_currency: "Currency" label_currency_format: "Format of currency" 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_deliverable: "Deliverable" label_deliverable_plural: "Deliverables" label_deliverable_new: "New Deliverable"