From 390d59eff32c1dd484998f17fbb36db32255d650 Mon Sep 17 00:00:00 2001 From: Diego Steiner Date: Mon, 2 Dec 2024 20:42:03 +0000 Subject: [PATCH 1/2] fix: error regression when creating invoices --- app/models/payment_infos/text_payment_info.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/models/payment_infos/text_payment_info.rb b/app/models/payment_infos/text_payment_info.rb index 228e33cd3..ce79a5edd 100644 --- a/app/models/payment_infos/text_payment_info.rb +++ b/app/models/payment_infos/text_payment_info.rb @@ -9,7 +9,7 @@ class TextPaymentInfo < ::PaymentInfo delegate :esr_beneficiary_account, to: :organisation def body - @body ||= rich_text_template&.interpolate(payment_info: self)&.body + @body ||= rich_text_template&.interpolate({ payment_info: self })&.body end def title From 0fd35a44a0051a50a5a92441d55d26a65aa8f34a Mon Sep 17 00:00:00 2001 From: Diego Steiner Date: Tue, 3 Dec 2024 09:21:33 +0000 Subject: [PATCH 2/2] fix: clear deadlines after transition --- app/controllers/manage/deadlines_controller.rb | 2 +- app/domain/booking_states/overdue.rb | 1 + app/domain/booking_states/payment_overdue.rb | 1 + app/models/booking.rb | 2 +- 4 files changed, 4 insertions(+), 2 deletions(-) diff --git a/app/controllers/manage/deadlines_controller.rb b/app/controllers/manage/deadlines_controller.rb index 1fd2a1ad5..e9811d52a 100644 --- a/app/controllers/manage/deadlines_controller.rb +++ b/app/controllers/manage/deadlines_controller.rb @@ -10,7 +10,7 @@ def edit end def update - @booking.set_deadline(deadline_params) + @booking.set_deadline(**deadline_params) respond_with :manage, @booking, location: manage_booking_path(@booking) end diff --git a/app/domain/booking_states/overdue.rb b/app/domain/booking_states/overdue.rb index 78ad5e7c5..a4a3e69c9 100644 --- a/app/domain/booking_states/overdue.rb +++ b/app/domain/booking_states/overdue.rb @@ -19,6 +19,7 @@ def self.to_sym end after_transition do |booking| + booking.deadline&.clear MailTemplate.use(:overdue_notification, booking, to: :tenant, &:autodeliver!) end diff --git a/app/domain/booking_states/payment_overdue.rb b/app/domain/booking_states/payment_overdue.rb index b5a582c77..cb67425ac 100644 --- a/app/domain/booking_states/payment_overdue.rb +++ b/app/domain/booking_states/payment_overdue.rb @@ -19,6 +19,7 @@ def invoice_type end after_transition do |booking| + booking.deadline&.clear MailTemplate.use(:payment_overdue_notification, booking, to: :tenant, &:autodeliver!) end diff --git a/app/models/booking.rb b/app/models/booking.rb index d5d22ddcf..049148e25 100644 --- a/app/models/booking.rb +++ b/app/models/booking.rb @@ -195,7 +195,7 @@ def editable? booking_state&.editable || false end - def set_deadline(params = {}) + def set_deadline(**params) build_deadline if deadline.blank? deadline.update(armed: true, postponable_for: nil, **params, booking: self) deadline