Add financial_transaction_type to CSV (fixes #578)

This commit is contained in:
Patrick Gansterer 2018-12-18 15:13:57 +01:00
parent d67bbe447f
commit a2188cb6b8
3 changed files with 9 additions and 1 deletions

View File

@ -46,6 +46,8 @@ de:
financial_transaction:
amount: Betrag
created_on: Datum
financial_transaction_class: Finanztransaktionsklasse
financial_transaction_type: Finanztransaktionstyp
note: Notiz
ordergroup: Bestellgruppe
user: Eingetragen von

View File

@ -46,6 +46,8 @@ en:
financial_transaction:
amount: Amount
created_on: Date
financial_transaction_class: Financial transaction class
financial_transaction_type: Financial transaction type
note: Note
ordergroup: Ordergroup
user: Entered by

View File

@ -9,18 +9,22 @@ class FinancialTransactionsCsv < RenderCSV
FinancialTransaction.human_attribute_name(:ordergroup),
FinancialTransaction.human_attribute_name(:ordergroup),
FinancialTransaction.human_attribute_name(:user),
FinancialTransaction.human_attribute_name(:financial_transaction_class),
FinancialTransaction.human_attribute_name(:financial_transaction_type),
FinancialTransaction.human_attribute_name(:note),
FinancialTransaction.human_attribute_name(:amount)
]
end
def data
@object.includes(:user, :ordergroup).each do |t|
@object.includes(:user, :ordergroup, :financial_transaction_type).each do |t|
yield [
t.created_on,
t.ordergroup_id,
t.ordergroup.name,
show_user(t.user),
t.financial_transaction_type.financial_transaction_class.name,
t.financial_transaction_type.name,
t.note,
number_to_currency(t.amount)
]