Skip to content

Commit

Permalink
Merge pull request #333 from diegosteiner/develop
Browse files Browse the repository at this point in the history
Release 24.9.2
  • Loading branch information
diegosteiner authored Sep 28, 2024
2 parents 4bd926a + ff202fa commit c16fb91
Show file tree
Hide file tree
Showing 12 changed files with 28 additions and 27 deletions.
3 changes: 2 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,9 @@

## Version 24.9.2

Release 23.09.2024
Release 28.09.2024

- Fix: Fix broken qr debitor addresses
- Fix: Fix broken locale for empty tenants
- Fix: Fix paradox BookingDateTimeCondtions
- Fix: Show clone always as second
Expand Down
2 changes: 1 addition & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ RUN apk add --update build-base \

USER rails:rails

RUN gem install standardrb ruby-lsp
RUN gem install standardrb ruby-lsp debug

### === test === ###
FROM development AS test
Expand Down
2 changes: 1 addition & 1 deletion app/controllers/manage/booking_categories_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ class BookingCategoriesController < BaseController
load_and_authorize_resource :booking_category

def index
@booking_categories = @booking_categories.where(organisation: current_organisation)
@booking_categories = @booking_categories.where(organisation: current_organisation).ordered
respond_with :manage, @booking_categories
end

Expand Down
4 changes: 0 additions & 4 deletions app/models/booking.rb
Original file line number Diff line number Diff line change
Expand Up @@ -159,10 +159,6 @@ def update_occupancies
occupancies.each(&:update_from_booking)
end

def invoice_address_lines
@invoice_address_lines ||= invoice_address&.lines&.reject(&:blank?).presence || tenant&.full_address_lines
end

def email
super || tenant&.email
end
Expand Down
4 changes: 2 additions & 2 deletions app/models/invoice.rb
Original file line number Diff line number Diff line change
Expand Up @@ -173,8 +173,8 @@ def suggested_invoice_parts
::InvoicePart::Factory.new(self).call
end

def invoice_address_lines
@invoice_address_lines ||= InvoiceAddressService.new(booking).lines
def invoice_address
@invoice_address ||= InvoiceAddress.new(booking)
end

def to_attachable
Expand Down
4 changes: 2 additions & 2 deletions app/models/payment_infos/qr_bill.rb
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ class QrBill < ::PaymentInfo
].freeze
RF00 = [2, 7, 1, 5, 0, 0].freeze

delegate :amount, to: :invoice
delegate :amount, :invoice_address, to: :invoice

# rubocop:disable Metrics/AbcSize
# rubocop:disable Metrics/MethodLength
Expand Down Expand Up @@ -69,7 +69,7 @@ def creditor_address_lines
end

def debitor_address_lines
@debitor_address_lines ||= invoice.invoice_address_lines.filter { _1.is_a?(String) }.map(&:chomp) || []
@debitor_address_lines ||= [invoice_address.lines, invoice_address.represented_by].max_by(&:size)
end

def creditor_account
Expand Down
4 changes: 2 additions & 2 deletions app/params/manage/organisation_params.rb
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@
module Manage
class OrganisationParams < ApplicationParams
def self.permitted_keys
%i[name address logo location bcc cors_origins
iban mail_from locale default_payment_info_type creditor_address account_address
%i[name address logo location bcc cors_origins iban esr_ref_prefix
mail_from locale default_payment_info_type creditor_address account_address
representative_address contract_signature email notifications_enabled] +
[{ settings: settings_permitted_keys }]
end
Expand Down
9 changes: 4 additions & 5 deletions app/services/export/pdf/invoice_pdf.rb
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ class InvoicePdf < Base
}.freeze
attr_reader :invoice

delegate :booking, :organisation, :payment_info, to: :invoice
delegate :booking, :organisation, :payment_info, :invoice_address, to: :invoice

def initialize(invoice)
super()
Expand All @@ -31,10 +31,9 @@ def initialize(invoice)
end

to_render do
address = invoice.invoice_address_lines
represented_by = address.pop[:represented_by] if address.last.is_a?(Hash)

render Renderables::Address.new(address, represented_by:, column: :right, label: Tenant.model_name.human)
render Renderables::Address.new(invoice_address.lines,
represented_by: invoice_address.represented_by,
column: :right, label: Tenant.model_name.human)
end

to_render do
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# frozen_string_literal: true

class InvoiceAddressService
class InvoiceAddress
def initialize(booking)
@booking = booking
end
Expand All @@ -11,17 +11,19 @@ def lines
@lines ||= if tenant_organisation.blank? && booking_invoice_address_lines.blank?
tenant_address_lines
else
represented_by = booking_invoice_address_lines.present? ? @booking.tenant&.name : tenant_address_lines
[
[tenant_organisation, booking_invoice_address_lines&.shift].uniq,
booking_invoice_address_lines,
{ represented_by: }
].flatten
[tenant_organisation, booking_invoice_address_lines[0]].uniq,
booking_invoice_address_lines[1..]
].flatten.compact_blank
end
end

def represented_by
@represented_by ||= booking_invoice_address_lines.present? ? [@booking.tenant&.name] : tenant_address_lines
end

def booking_invoice_address_lines
@booking_invoice_address_lines ||= @booking.invoice_address&.lines&.map(&:chomp)&.compact_blank
@booking_invoice_address_lines ||= @booking.invoice_address&.lines&.map(&:chomp)&.compact_blank || []
end

def tenant_address_lines
Expand Down
1 change: 1 addition & 0 deletions app/views/manage/organisations/_form.html.slim
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@
.card-body
= f.select :default_payment_info_type, subtype_options_for_select(PaymentInfo.subtypes), include_blank: true
= f.text_field :iban
= f.text_field :esr_ref_prefix
div[v-pre]= f.text_area :creditor_address, rows: 4, help: t('optional')
div[v-pre]= f.text_area :account_address, rows: 4, help: t('optional')

Expand Down
2 changes: 1 addition & 1 deletion bin/check
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ bundle exec i18n-tasks normalize -p
bundle exec i18n-tasks health de || exit 1
bundle exec i18n-tasks health
bin/rspec ./spec --tag ~@type:feature || exit 1
yarn run check:style --fix
yarn run check:style
# yarn run check:types
bin/rspec ./spec --tag @type:feature --fail-fast || exit 1
bundle exec bundle-audit --update || exit 1
4 changes: 3 additions & 1 deletion config/locales/de.yml
Original file line number Diff line number Diff line change
Expand Up @@ -282,13 +282,15 @@ de:
account_address: Adresse des Kontos für QR-Rechnungen (falls abweichend)
address: Anschrift
bcc: BCC
booking_ref_tempate: Buchung Referenznummer Format
contract_signature: Vertragsunterschrift Bild
creditor_address: Anschrift auf Rechnungen
currency: Währung
default_payment_info_type: Standartzahlungsteil
esr_beneficiary_account: ESR Teilnehmernummer / PC-Konto
esr_ref_prefix: ESR Identifikationsnummer / Präfix
esr_ref_prefix: Referenznummer Präfix
iban: IBAN
invoice_ref_tempate: Rechnung Referenznummer Format
locale: Hauptsprache
locales: Sprachen
location: Vertragsunterschrift Ort
Expand Down

0 comments on commit c16fb91

Please sign in to comment.