Compare commits
2 commits
219b5f2de8
...
bdeee02873
Author | SHA1 | Date | |
---|---|---|---|
bdeee02873 | |||
bcc647dabb |
4 changed files with 18 additions and 4 deletions
|
@ -63,8 +63,7 @@ class GroupOrderInvoicePdf < RenderPdf
|
||||||
end
|
end
|
||||||
|
|
||||||
move_down 20
|
move_down 20
|
||||||
text I18n.t('documents.group_order_invoice_pdf.payment_method', payment_method: FinancialTransactionType.find(@options[:payment_method]).name)
|
text I18n.t('documents.group_order_invoice_pdf.payment_method', payment_method: @options[:payment_method])
|
||||||
|
|
||||||
text I18n.t('documents.group_order_invoice_pdf.table_headline')
|
text I18n.t('documents.group_order_invoice_pdf.table_headline')
|
||||||
move_down 5
|
move_down 5
|
||||||
|
|
||||||
|
|
|
@ -41,7 +41,7 @@ class GroupOrderInvoice < ApplicationRecord
|
||||||
def init
|
def init
|
||||||
self.invoice_date = Time.now unless invoice_date
|
self.invoice_date = Time.now unless invoice_date
|
||||||
self.invoice_number = generate_invoice_number(1) unless self.invoice_number
|
self.invoice_number = generate_invoice_number(1) unless self.invoice_number
|
||||||
self.payment_method = FoodsoftConfig[:group_order_invoices]&.[](:payment_method) || I18n.t('activerecord.attributes.group_order_invoice.payment_method') unless self.payment_method
|
self.payment_method = group_order&.financial_transaction&.financial_transaction_type&.name || FoodsoftConfig[:group_order_invoices]&.[](:payment_method) || I18n.t('activerecord.attributes.group_order_invoice.payment_method') unless self.payment_method
|
||||||
end
|
end
|
||||||
|
|
||||||
def name
|
def name
|
||||||
|
|
|
@ -0,0 +1,15 @@
|
||||||
|
class ChangeGroupOrderInvoicePaymentMethod < ActiveRecord::Migration[7.0]
|
||||||
|
def change
|
||||||
|
GroupOrderInvoice.all.each do |group_order_invoice|
|
||||||
|
case group_order_invoice.payment_method
|
||||||
|
when 'Guthaben'
|
||||||
|
group_order_invoice.payment_method = 'Guthaben'
|
||||||
|
when /\A\d+\z/
|
||||||
|
group_order_invoice.payment_method = FinancialTransactionType.find_by(id: group_order_invoice.payment_method)&.name || 'Guthaben'
|
||||||
|
else
|
||||||
|
group_order_invoice.payment_method = group_order_invoice.payment_method || 'Guthaben'
|
||||||
|
end
|
||||||
|
group_order_invoice.save!
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
|
@ -10,7 +10,7 @@
|
||||||
#
|
#
|
||||||
# It's strongly recommended that you check this file into your version control system.
|
# It's strongly recommended that you check this file into your version control system.
|
||||||
|
|
||||||
ActiveRecord::Schema[7.0].define(version: 2023_11_28_133642) do
|
ActiveRecord::Schema[7.0].define(version: 2023_12_11_121430) do
|
||||||
create_table "action_text_rich_texts", charset: "utf8mb4", force: :cascade do |t|
|
create_table "action_text_rich_texts", charset: "utf8mb4", force: :cascade do |t|
|
||||||
t.string "name", null: false
|
t.string "name", null: false
|
||||||
t.text "body", size: :long
|
t.text "body", size: :long
|
||||||
|
|
Loading…
Reference in a new issue