Add small improvements for BankTransactions

This commit is contained in:
Patrick Gansterer 2021-10-16 15:07:53 +02:00
parent 6d71bd2c2f
commit 093313f0f3
2 changed files with 2 additions and 2 deletions

View file

@ -36,7 +36,7 @@ class BankTransaction < ApplicationRecord
def assign_to_invoice def assign_to_invoice
return false unless supplier return false unless supplier
content = text content = text || ""
content += "\n" + reference if reference.present? content += "\n" + reference if reference.present?
invoices = supplier.invoices.unpaid.select { |i| content.include? i.number } invoices = supplier.invoices.unpaid.select { |i| content.include? i.number }
invoices_sum = invoices.map(&:amount).sum invoices_sum = invoices.map(&:amount).sum

View file

@ -19,7 +19,7 @@
%tr %tr
%td= h link_to format_date(t.date), finance_bank_transaction_path(t) %td= h link_to format_date(t.date), finance_bank_transaction_path(t)
%td= h(t.text).gsub("\n", "<br>").html_safe %td= h(t.text).gsub("\n", "<br>").html_safe
%td= h t.reference %td= h(t.reference).gsub("\n", "<br>").html_safe
%td.numeric{style: 'width:5em'}= format_currency t.amount %td.numeric{style: 'width:5em'}= format_currency t.amount
%td %td
- if t.financial_link - if t.financial_link