Add FinacialTransaction create_collection for ordergroup custom fields
Custom fields of an ordergroup can set financial_transaction_source to true, to act as an source for a new collection of FinacialTransaction. A typical usecase would be a variable membership fee, which will be stored in a custom field on the ordergroup. When a new membership period begins a collection with all membership fees can be created with one click.
This commit is contained in:
parent
d73c206e29
commit
a3defc5463
4 changed files with 32 additions and 6 deletions
|
|
@ -58,6 +58,14 @@ class Finance::FinancialTransactionsController < ApplicationController
|
|||
end
|
||||
|
||||
def new_collection
|
||||
@ordergroups = {}
|
||||
Ordergroup.undeleted.order(:name).map do |ordergroup|
|
||||
obj = { name: ordergroup.name }
|
||||
Ordergroup.custom_fields.each do |field|
|
||||
obj[field[:name]] = ordergroup.settings.custom_fields[field[:name]]
|
||||
end
|
||||
@ordergroups[ordergroup.id] = obj
|
||||
end
|
||||
end
|
||||
|
||||
def create_collection
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue