diff --git a/app/domain/booking_states/payment_due.rb b/app/domain/booking_states/payment_due.rb index 532a3e90b..7dd58aae7 100644 --- a/app/domain/booking_states/payment_due.rb +++ b/app/domain/booking_states/payment_due.rb @@ -23,9 +23,9 @@ def self.to_sym invoice = booking.invoices.sent.kept.unsettled.ordered.last next if invoice.blank? - payable_until = invoice.payable_until + booking.organisation.settings.payment_overdue_deadline + payable_until = invoice.payable_until&.+(booking.organisation.settings.payment_overdue_deadline) postponable_for = booking.organisation.settings.deadline_postponable_for - booking.deadlines.create(at: payable_until, postponable_for:) unless booking.deadline + booking.deadlines.create(at: payable_until, postponable_for:) if payable_until.present? && !booking.deadline end infer_transition(to: :payment_overdue) do |booking| diff --git a/app/models/tarifs/price.rb b/app/models/tarifs/price.rb index 536962523..092b3b052 100644 --- a/app/models/tarifs/price.rb +++ b/app/models/tarifs/price.rb @@ -44,7 +44,7 @@ class Price < Tarif Tarif.register_subtype self def unit - organisation.currency + super || organisation.currency end def breakdown(usage) diff --git a/app/services/export/pdf/contract_pdf.rb b/app/services/export/pdf/contract_pdf.rb index d8adec426..8da444029 100644 --- a/app/services/export/pdf/contract_pdf.rb +++ b/app/services/export/pdf/contract_pdf.rb @@ -57,7 +57,8 @@ def tarif_table_data [[Tarif.model_name.human, Tarif.human_attribute_name(:unit), Tarif.human_attribute_name(:price_per_unit)]] + @contract.usages.map do |usage| tarif = usage.tarif - [tarif.label, tarif.unit, number_to_currency(usage.price_per_unit || 0, unit: @organisation.currency)] + price_per_unit = usage.price_per_unit || usage.price || 0 + [tarif.label, tarif.unit, number_to_currency(price_per_unit, unit: @organisation.currency)] end end end diff --git a/app/views/manage/invoices/index.html.slim b/app/views/manage/invoices/index.html.slim index 0433f253e..a332637aa 100644 --- a/app/views/manage/invoices/index.html.slim +++ b/app/views/manage/invoices/index.html.slim @@ -90,9 +90,8 @@ - unless invoice.is_a?(Invoices::LateNotice) = link_to new_manage_booking_invoice_path(invoice.booking, invoice: { type: Invoices::LateNotice, supersede_invoice_id: invoice.to_param }), class: 'btn btn-default' do = Invoices::LateNotice.model_name.human - - unless invoice.sent? - = link_to edit_manage_invoice_path(invoice), class: 'btn btn-default' do - span.fa.fa-edit + = link_to edit_manage_invoice_path(invoice), class: "btn btn-default #{invoice.sent? ? 'disabled text-muted' : ''} border-0 p-2" do + span.fa.fa-edit = link_to manage_invoice_path(invoice), data: { confirm: t(:confirm) }, method: :delete, class: 'btn btn-default' do span.fa.fa-trash diff --git a/app/views/manage/occupancies/index.html.slim b/app/views/manage/occupancies/index.html.slim index 3b563b497..ef641c709 100644 --- a/app/views/manage/occupancies/index.html.slim +++ b/app/views/manage/occupancies/index.html.slim @@ -42,7 +42,7 @@ h1.m-0= Occupancy.model_name.human(count: 2) = link_to manage_occupancy_path(occupancy), data: { confirm: t(:confirm) }, method: :delete, class: 'btn btn-default' , title: t(:destroy) do span.fa.fa-trash - else - button.btn.btn-default[disabled] + button.btn.btn-default.border-0.text-muted[disabled] span.fa.fa-trash br