Merge pull request #9442 from jibees/8904-display-fees-name-instead-of-type-on-invoices

Display fees name instead of type on invoices
This commit is contained in:
Maikel
2022-10-10 13:15:01 +11:00
committed by GitHub
8 changed files with 24 additions and 45 deletions

View File

@@ -32,25 +32,9 @@ module CheckoutHelper
}
end
enterprise_fee_adjustments = adjustments.select { |a|
a.originator_type == 'EnterpriseFee' && a.adjustable_type != 'Spree::LineItem'
}
adjustments.reject! { |a|
a.originator_type == 'EnterpriseFee' && a.adjustable_type != 'Spree::LineItem'
}
unless exclude.include? :admin_and_handling
adjustments << Spree::Adjustment.new(
label: I18n.t(:orders_form_admin), amount: enterprise_fee_adjustments.sum(&:amount)
)
end
adjustments
end
def display_line_item_fees_total_for(order)
Spree::Money.new order.adjustments.enterprise_fee.sum(:amount), currency: order.currency
end
def checkout_line_item_fees(order)
order.line_item_adjustments.enterprise_fee
end

View File

@@ -30,15 +30,8 @@
%td.text-right
%span.order-total.item-total= display_checkout_subtotal(@order)
%td
-if display_line_item_fees_total_for(@order) != Spree::Money.new(0 , currency: @order.currency)
%tr
%td.text-right{colspan:"3"}
= t :orders_form_admin
%td.text-right
%span.order-total.distribution-total= display_line_item_fees_total_for(@order)
%td
- checkout_adjustments_for(@order, exclude: [:line_item, :admin_and_handling]).reject{ |a| a.amount == 0 }.reverse_each do |adjustment|
- checkout_adjustments_for(@order, exclude: [:line_item]).reject{ |a| a.amount == 0 }.reverse_each do |adjustment|
%tr.order-adjustment
%td.text-right{:colspan => "3"}
= adjustment.label