diff --git a/app/models/concerns/booking_state_concern.rb b/app/models/concerns/booking_state_concern.rb index eee54a926..3c69cb162 100644 --- a/app/models/concerns/booking_state_concern.rb +++ b/app/models/concerns/booking_state_concern.rb @@ -30,7 +30,6 @@ def apply_transitions(transitions = transition_to, metadata: nil, infer_transiti end def update_booking_state_cache! - Rails.logger.info("Booking<#{id}>@#{booking_state&.to_s}") return unless booking_state_cache != booking_state&.to_s update_columns(booking_state_cache: booking_state.to_s, updated_at: Time.zone.now) # rubocop:disable Rails/SkipsModelValidations diff --git a/app/models/invoice.rb b/app/models/invoice.rb index 3024a1ba8..f19578bc0 100644 --- a/app/models/invoice.rb +++ b/app/models/invoice.rb @@ -74,6 +74,7 @@ class Invoice < ApplicationRecord before_update :generate_pdf, if: :generate_pdf? after_save :recalculate! after_save :generate_journal_entries!, if: :generate_journal_entries? + after_save :update_payments after_discard :generate_journal_entries!, if: :generate_journal_entries? delegate :currency, to: :organisation @@ -94,6 +95,10 @@ def supersede! supersede_invoice.discard! end + def update_payments + payments.each { _1.update!(booking_id:) } + end + def sequence_number self[:sequence_number] ||= organisation.key_sequences.key(::Invoice.sti_name, year: sequence_year).lease! end diff --git a/app/views/manage/data_digest_templates/_form.html.slim b/app/views/manage/data_digest_templates/_form.html.slim index 58e2b3a0d..bce8c3a90 100644 --- a/app/views/manage/data_digest_templates/_form.html.slim +++ b/app/views/manage/data_digest_templates/_form.html.slim @@ -9,7 +9,7 @@ = f.fields_for :prefilter_params, @data_digest_template.prefilter do |ff| = render partial: @data_digest_template.filter_class.to_partial_path('filter_fields'), locals: { f: ff } - = render partial: @data_digest_template.to_partial_path('form_fields'), locals: { data_digest_template: @data_digest_template } + = render partial: 'renderables/data_digest_templates/tabular/form_fields', locals: { data_digest_template: @data_digest_template } = f.submit diff --git a/app/views/manage/data_digests/show.html.slim b/app/views/manage/data_digests/show.html.slim index 91a421d58..4204831eb 100644 --- a/app/views/manage/data_digests/show.html.slim +++ b/app/views/manage/data_digests/show.html.slim @@ -1,7 +1,7 @@ h1.mt-0= @data_digest.label p= @data_digest.localized_period -= render partial: @data_digest.data_digest_template.to_partial_path('show_data_digest'), locals: { data_digest: @data_digest } += render partial: 'renderables/data_digest_templates/tabular/show_data_digest', locals: { data_digest: @data_digest } br .btn-group diff --git a/app/views/renderables/data_digest_templates/booking/_form_fields.html.slim b/app/views/renderables/data_digest_templates/booking/_form_fields.html.slim deleted file mode 100644 index 004418319..000000000 --- a/app/views/renderables/data_digest_templates/booking/_form_fields.html.slim +++ /dev/null @@ -1 +0,0 @@ -= render partial: 'renderables/data_digest_templates/tabular/form_fields', locals: { data_digest_template: } diff --git a/app/views/renderables/data_digest_templates/booking/_show_data_digest.html.slim b/app/views/renderables/data_digest_templates/booking/_show_data_digest.html.slim deleted file mode 100644 index 12593818b..000000000 --- a/app/views/renderables/data_digest_templates/booking/_show_data_digest.html.slim +++ /dev/null @@ -1 +0,0 @@ -= render partial: 'renderables/data_digest_templates/tabular/show_data_digest', locals: { data_digest: } diff --git a/app/views/renderables/data_digest_templates/journal_entry/_form_fields.html.slim b/app/views/renderables/data_digest_templates/journal_entry/_form_fields.html.slim deleted file mode 100644 index 004418319..000000000 --- a/app/views/renderables/data_digest_templates/journal_entry/_form_fields.html.slim +++ /dev/null @@ -1 +0,0 @@ -= render partial: 'renderables/data_digest_templates/tabular/form_fields', locals: { data_digest_template: } diff --git a/app/views/renderables/data_digest_templates/journal_entry/_show_data_digest.html.slim b/app/views/renderables/data_digest_templates/journal_entry/_show_data_digest.html.slim deleted file mode 100644 index 12593818b..000000000 --- a/app/views/renderables/data_digest_templates/journal_entry/_show_data_digest.html.slim +++ /dev/null @@ -1 +0,0 @@ -= render partial: 'renderables/data_digest_templates/tabular/show_data_digest', locals: { data_digest: }