fixed permissions for overriding costs during creation and edit of cost_entries

git-svn-id: https://dev.finn.de/svn/cockpit/trunk@87 7926756e-e54e-46e6-9721-ed318f58905e
pull/6827/head
hjust 15 years ago
parent c8e38e6549
commit 921a272d4c
  1. 1
      app/controllers/costlog_controller.rb
  2. 2
      app/views/costlog/_list.rhtml
  3. 17
      app/views/costlog/edit.rhtml
  4. 1
      lang/en.yml

@ -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))

@ -26,7 +26,7 @@
<td class="comments"><%=h entry.comments %></td>
<td class="units"><%= pluralize(entry.units, entry.cost_type.unit, entry.cost_type.unit_plural) %></td>
<td class="currency">
<% 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 -%>
</td>

@ -20,11 +20,18 @@
</p>
<p>
<label><%= l(:field_costs) %></label>
<span id="cost_entry_costs"><%= number_to_currency(@cost_entry.calculated_costs) %></span>
<%= 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 %>
<span id="cost_entry_costs"><%= number_to_currency(@cost_entry.calculated_costs) %></span>
<%= 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 %>
<span id="cost_entry_costs_editor">
<input class="currency" 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_redmine_costs['costs_currency'] %>
</span>
<br /><em><%= l(:help_override_rate) %></em>
<% end %>
</p>
<p><%= f.text_field :comments, :size => 100 %></p>

@ -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"

Loading…
Cancel
Save