mirror of
https://github.com/LaCasemate/fab-manager.git
synced 2024-11-28 09:24:24 +01:00
updates sidekiq and sidekiq-scheduler, fix a bug: wrong locale was causing wrong currency in cron jobs, now we manually set the currency locale in number_to_currency
This commit is contained in:
parent
1fa3f37776
commit
08b4127331
@ -1,5 +1,10 @@
|
||||
# Changelog Fab-manager
|
||||
|
||||
## Next release
|
||||
|
||||
- updates sidekiq and sidekiq-scheduler
|
||||
- fix a bug: wrong locale was causing wrong currency in cron jobs, now we manually set the currency locale in number_to_currency
|
||||
|
||||
## v6.3.1 2023 November 10
|
||||
|
||||
- Fix a bug: statistic_sub_type.label of plan was nil
|
||||
|
4
Gemfile
4
Gemfile
@ -91,9 +91,9 @@ gem 'friendly_id', '~> 5.1.0'
|
||||
gem 'aasm'
|
||||
|
||||
# Background job processing
|
||||
gem 'sidekiq', '>= 6.0.7'
|
||||
gem 'sidekiq', '6.5.12'
|
||||
# Recurring jobs for Sidekiq
|
||||
gem 'sidekiq-scheduler'
|
||||
gem 'sidekiq-scheduler', '5.0.3'
|
||||
gem 'sidekiq-unique-jobs', '~> 7.1.23'
|
||||
|
||||
gem 'stripe', '5.29.0'
|
||||
|
23
Gemfile.lock
23
Gemfile.lock
@ -125,7 +125,7 @@ GEM
|
||||
coercible (1.0.0)
|
||||
descendants_tracker (~> 0.0.1)
|
||||
concurrent-ruby (1.2.2)
|
||||
connection_pool (2.2.5)
|
||||
connection_pool (2.4.1)
|
||||
coveralls_reborn (0.18.0)
|
||||
simplecov (>= 0.18.1, < 0.20.0)
|
||||
term-ansicolor (~> 1.6)
|
||||
@ -182,7 +182,7 @@ GEM
|
||||
forgery (0.7.0)
|
||||
friendly_id (5.1.0)
|
||||
activerecord (>= 4.0.0)
|
||||
fugit (1.5.3)
|
||||
fugit (1.9.0)
|
||||
et-orbi (~> 1, >= 1.2.7)
|
||||
raabro (~> 1.4)
|
||||
globalid (1.1.0)
|
||||
@ -428,7 +428,7 @@ GEM
|
||||
nokogiri (>= 1.10.8)
|
||||
rubyzip (>= 1.3.0)
|
||||
rubyzip (2.3.2)
|
||||
rufus-scheduler (3.8.1)
|
||||
rufus-scheduler (3.9.1)
|
||||
fugit (~> 1.1, >= 1.1.6)
|
||||
safe_yaml (1.0.5)
|
||||
sassc (2.4.0)
|
||||
@ -448,14 +448,13 @@ GEM
|
||||
rack-proxy (>= 0.6.1)
|
||||
railties (>= 5.2)
|
||||
semantic_range (>= 2.3.0)
|
||||
sidekiq (6.4.2)
|
||||
connection_pool (>= 2.2.2)
|
||||
sidekiq (6.5.12)
|
||||
connection_pool (>= 2.2.5, < 3)
|
||||
rack (~> 2.0)
|
||||
redis (>= 4.2.0)
|
||||
sidekiq-scheduler (4.0.0)
|
||||
redis (>= 4.2.0)
|
||||
redis (>= 4.5.0, < 5)
|
||||
sidekiq-scheduler (5.0.3)
|
||||
rufus-scheduler (~> 3.2)
|
||||
sidekiq (>= 4)
|
||||
sidekiq (>= 6, < 8)
|
||||
tilt (>= 1.4.0)
|
||||
sidekiq-unique-jobs (7.1.23)
|
||||
brpoplpush-redis_script (> 0.1.1, <= 2.0.0)
|
||||
@ -484,7 +483,7 @@ GEM
|
||||
tins (~> 1.0)
|
||||
thor (1.2.1)
|
||||
thread_safe (0.3.6)
|
||||
tilt (2.0.10)
|
||||
tilt (2.3.0)
|
||||
timeout (0.3.2)
|
||||
tins (1.25.0)
|
||||
sync
|
||||
@ -609,8 +608,8 @@ DEPENDENCIES
|
||||
sentry-ruby
|
||||
sha3
|
||||
shakapacker (= 6.6.0)
|
||||
sidekiq (>= 6.0.7)
|
||||
sidekiq-scheduler
|
||||
sidekiq (= 6.5.12)
|
||||
sidekiq-scheduler (= 5.0.3)
|
||||
sidekiq-unique-jobs (~> 7.1.23)
|
||||
silencer
|
||||
spring (~> 4)
|
||||
|
@ -75,7 +75,7 @@ class Pdf::Invoice < Prawn::Document
|
||||
invoice.invoice_items.each do |item|
|
||||
price = item.amount.to_i / 100.00
|
||||
|
||||
data += [[Invoices::ItemLabelService.build(invoice, item), number_to_currency(price)]]
|
||||
data += [[Invoices::ItemLabelService.build(invoice, item), number_to_currency(price, locale: CURRENCY_LOCALE)]]
|
||||
total_calc += price
|
||||
total_ht += item.net_amount
|
||||
total_vat += item.vat
|
||||
@ -92,13 +92,13 @@ class Pdf::Invoice < Prawn::Document
|
||||
|
||||
# discount textual description
|
||||
literal_discount = cp.percent_off
|
||||
literal_discount = number_to_currency(cp.amount_off / 100.00) if cp.type == 'amount_off'
|
||||
literal_discount = number_to_currency(cp.amount_off / 100.00, locale: CURRENCY_LOCALE) if cp.type == 'amount_off'
|
||||
|
||||
# add a row for the coupon
|
||||
data += [[_t('invoices.coupon_CODE_discount_of_DISCOUNT',
|
||||
CODE: cp.code,
|
||||
DISCOUNT: literal_discount,
|
||||
TYPE: cp.type), number_to_currency(-discount)]]
|
||||
TYPE: cp.type), number_to_currency(-discount, locale: CURRENCY_LOCALE)]]
|
||||
end
|
||||
|
||||
# total verification
|
||||
@ -109,18 +109,18 @@ class Pdf::Invoice < Prawn::Document
|
||||
vat_service = VatHistoryService.new
|
||||
vat_rate_group = vat_service.invoice_vat(invoice)
|
||||
if total_vat.zero?
|
||||
data += [[I18n.t('invoices.total_amount'), number_to_currency(total)]]
|
||||
data += [[I18n.t('invoices.total_amount'), number_to_currency(total, locale: CURRENCY_LOCALE)]]
|
||||
else
|
||||
data += [[I18n.t('invoices.total_including_all_taxes'), number_to_currency(total)]]
|
||||
data += [[I18n.t('invoices.total_including_all_taxes'), number_to_currency(total, locale: CURRENCY_LOCALE)]]
|
||||
vat_rate_group.each do |_type, rate|
|
||||
data += [[I18n.t('invoices.including_VAT_RATE',
|
||||
**{ RATE: rate[:vat_rate],
|
||||
AMOUNT: number_to_currency(rate[:amount] / 100.00),
|
||||
AMOUNT: number_to_currency(rate[:amount] / 100.00, locale: CURRENCY_LOCALE),
|
||||
NAME: Setting.get('invoice_VAT-name') }),
|
||||
number_to_currency(rate[:total_vat] / 100.00)]]
|
||||
number_to_currency(rate[:total_vat] / 100.00, locale: CURRENCY_LOCALE)]]
|
||||
end
|
||||
data += [[I18n.t('invoices.including_total_excluding_taxes'), number_to_currency(total_ht / 100.00)]]
|
||||
data += [[I18n.t('invoices.including_amount_payed_on_ordering'), number_to_currency(total)]]
|
||||
data += [[I18n.t('invoices.including_total_excluding_taxes'), number_to_currency(total_ht / 100.00, locale: CURRENCY_LOCALE)]]
|
||||
data += [[I18n.t('invoices.including_amount_payed_on_ordering'), number_to_currency(total, locale: CURRENCY_LOCALE)]]
|
||||
|
||||
# checking the round number
|
||||
rounded = (sprintf('%.2f', total_vat / 100.00).to_f + sprintf('%.2f', total_ht / 100.00).to_f).to_s
|
||||
|
@ -80,9 +80,9 @@ class Pdf::PaymentSchedule < Prawn::Document
|
||||
price = item.amount.to_i / 100.00
|
||||
date = I18n.l(item.due_date.to_date)
|
||||
|
||||
data += [[date, number_to_currency(price)]]
|
||||
data += [[date, number_to_currency(price, locale: CURRENCY_LOCALE)]]
|
||||
end
|
||||
data += [[I18n.t('payment_schedules.total_amount'), number_to_currency(payment_schedule.total / 100.0)]]
|
||||
data += [[I18n.t('payment_schedules.total_amount'), number_to_currency(payment_schedule.total / 100.0, locale: CURRENCY_LOCALE)]]
|
||||
|
||||
# display table
|
||||
font_size(8) do
|
||||
@ -100,7 +100,7 @@ class Pdf::PaymentSchedule < Prawn::Document
|
||||
payment_verbose = _t('payment_schedules.settlement_by_METHOD', METHOD: payment_schedule.payment_method)
|
||||
if payment_schedule.wallet_amount
|
||||
payment_verbose += I18n.t('payment_schedules.settlement_by_wallet',
|
||||
**{ AMOUNT: number_to_currency(payment_schedule.wallet_amount / 100.00) })
|
||||
**{ AMOUNT: number_to_currency(payment_schedule.wallet_amount / 100.00, locale: CURRENCY_LOCALE) })
|
||||
end
|
||||
text payment_verbose
|
||||
|
||||
|
@ -27,14 +27,14 @@ class Invoices::PaymentDetailsService
|
||||
**{ DATE: I18n.l(invoice.created_at.to_date),
|
||||
TIME: I18n.l(invoice.created_at, format: :hour_minute) })}"
|
||||
if total.positive? || wallet_amount.nil?
|
||||
payment_verbose += " #{I18n.t('invoices.for_an_amount_of_AMOUNT', **{ AMOUNT: number_to_currency(total) })}"
|
||||
payment_verbose += " #{I18n.t('invoices.for_an_amount_of_AMOUNT', **{ AMOUNT: number_to_currency(total, locale: CURRENCY_LOCALE) })}"
|
||||
end
|
||||
if invoice.wallet_amount
|
||||
payment_verbose += if total.positive?
|
||||
" #{I18n.t('invoices.and')} #{I18n.t('invoices.by_wallet')} " \
|
||||
"#{I18n.t('invoices.for_an_amount_of_AMOUNT', **{ AMOUNT: number_to_currency(wallet_amount) })}"
|
||||
"#{I18n.t('invoices.for_an_amount_of_AMOUNT', **{ AMOUNT: number_to_currency(wallet_amount, locale: CURRENCY_LOCALE) })}"
|
||||
else
|
||||
" #{I18n.t('invoices.for_an_amount_of_AMOUNT', **{ AMOUNT: number_to_currency(wallet_amount) })}"
|
||||
" #{I18n.t('invoices.for_an_amount_of_AMOUNT', **{ AMOUNT: number_to_currency(wallet_amount, locale: CURRENCY_LOCALE) })}"
|
||||
end
|
||||
end
|
||||
payment_verbose
|
||||
@ -88,7 +88,7 @@ class Invoices::PaymentDetailsService
|
||||
else
|
||||
Rails.logger.error "specified refunding method (#{details}) is unknown"
|
||||
end
|
||||
"#{details} #{I18n.t('invoices.for_an_amount_of_AMOUNT', **{ AMOUNT: number_to_currency(total) })}"
|
||||
"#{details} #{I18n.t('invoices.for_an_amount_of_AMOUNT', **{ AMOUNT: number_to_currency(total, locale: CURRENCY_LOCALE) })}"
|
||||
end
|
||||
end
|
||||
end
|
||||
|
@ -1,5 +1,4 @@
|
||||
json.title notification.notification_type
|
||||
json.description t('.refund_created',
|
||||
AMOUNT: number_to_currency(notification.attached_object.total / 100.00),
|
||||
AMOUNT: number_to_currency(notification.attached_object.total / 100.00, locale: CURRENCY_LOCALE),
|
||||
USER: notification.attached_object.invoicing_profile&.full_name)
|
||||
|
||||
|
@ -3,7 +3,6 @@
|
||||
json.title notification.notification_type
|
||||
amount = notification.attached_object.amount
|
||||
json.description t('.wallet_is_credited',
|
||||
AMOUNT: number_to_currency(amount),
|
||||
AMOUNT: number_to_currency(amount, locale: CURRENCY_LOCALE),
|
||||
USER: notification.attached_object.wallet.user&.profile&.full_name || t('api.notifications.deleted_user'),
|
||||
ADMIN: notification.attached_object.user&.profile&.full_name || t('api.notifications.deleted_user'))
|
||||
|
||||
|
@ -5,7 +5,6 @@ if notification.attached_object.type == 'percent_off'
|
||||
CODE: notification.attached_object.code)
|
||||
else
|
||||
json.description t('.enjoy_a_discount_of_AMOUNT_with_code_CODE',
|
||||
AMOUNT: number_to_currency(notification.attached_object.amount_off / 100.00),
|
||||
AMOUNT: number_to_currency(notification.attached_object.amount_off / 100.00, locale: CURRENCY_LOCALE),
|
||||
CODE: notification.attached_object.code)
|
||||
end
|
||||
|
||||
|
@ -1,5 +1,4 @@
|
||||
json.title notification.notification_type
|
||||
amount = notification.attached_object.amount
|
||||
json.description t('.your_wallet_is_credited',
|
||||
AMOUNT: number_to_currency(amount))
|
||||
|
||||
AMOUNT: number_to_currency(amount, locale: CURRENCY_LOCALE))
|
||||
|
@ -2,6 +2,5 @@ json.title notification.notification_type
|
||||
amount = notification.attached_object.total / 100.0
|
||||
json.description t('.your_avoir_is_ready_html',
|
||||
REFERENCE: notification.attached_object.reference,
|
||||
AMOUNT: number_to_currency(amount),
|
||||
AMOUNT: number_to_currency(amount, locale: CURRENCY_LOCALE),
|
||||
INVOICE_ID: notification.attached_object.id)
|
||||
|
||||
|
@ -2,6 +2,5 @@ json.title notification.notification_type
|
||||
amount = notification.attached_object.total / 100.0
|
||||
json.description t('.your_invoice_is_ready_html',
|
||||
REFERENCE: notification.attached_object.reference,
|
||||
AMOUNT: number_to_currency(amount),
|
||||
AMOUNT: number_to_currency(amount, locale: CURRENCY_LOCALE),
|
||||
INVOICE_ID: notification.attached_object.id)
|
||||
|
||||
|
@ -4,6 +4,5 @@ json.title notification.notification_type
|
||||
amount = notification.attached_object.total / 100.0
|
||||
json.description t('.your_schedule_is_ready_html',
|
||||
REFERENCE: notification.attached_object.reference,
|
||||
AMOUNT: number_to_currency(amount),
|
||||
AMOUNT: number_to_currency(amount, locale: CURRENCY_LOCALE),
|
||||
SCHEDULE_ID: notification.attached_object.id)
|
||||
|
||||
|
@ -9,7 +9,7 @@ json.invoices do
|
||||
json.type invoice[:invoice].payment_gateway_object.gateway_object_type
|
||||
end
|
||||
end
|
||||
json.total number_to_currency(invoice[:invoice].total / 100.0)
|
||||
json.total number_to_currency(invoice[:invoice].total / 100.0, locale: CURRENCY_LOCALE)
|
||||
json.user do
|
||||
json.extract! invoice[:invoice].invoicing_profile, :user_id, :email, :first_name, :last_name
|
||||
json.address invoice[:invoice].invoicing_profile&.address&.address
|
||||
@ -46,7 +46,7 @@ json.payment_schedules do
|
||||
json.id object.gateway_object_id
|
||||
json.type object.gateway_object_type
|
||||
end
|
||||
json.total number_to_currency(schedule.total / 100.0)
|
||||
json.total number_to_currency(schedule.total / 100.0, locale: CURRENCY_LOCALE)
|
||||
json.user do
|
||||
json.extract! schedule.invoicing_profile, :user_id, :email, :first_name, :last_name
|
||||
json.address schedule.invoicing_profile&.address&.address
|
||||
@ -60,7 +60,7 @@ json.payment_schedules do
|
||||
end
|
||||
json.deadlines schedule.payment_schedule_items do |item|
|
||||
json.extract! item, :id, :due_date, :state, :details, :invoice_id, :footprint, :created_at
|
||||
json.amount number_to_currency(item.amount / 100.0)
|
||||
json.amount number_to_currency(item.amount / 100.0, locale: CURRENCY_LOCALE)
|
||||
end
|
||||
json.objects schedule.payment_schedule_objects do |object|
|
||||
json.type object.object_type
|
||||
@ -71,8 +71,8 @@ json.payment_schedules do
|
||||
end
|
||||
|
||||
json.totals do
|
||||
json.period_total number_to_currency(period_total / 100.0)
|
||||
json.perpetual_total number_to_currency(perpetual_total / 100.0)
|
||||
json.period_total number_to_currency(period_total / 100.0, locale: CURRENCY_LOCALE)
|
||||
json.perpetual_total number_to_currency(perpetual_total / 100.0, locale: CURRENCY_LOCALE)
|
||||
end
|
||||
|
||||
json.software do
|
||||
|
@ -1,7 +1,7 @@
|
||||
# frozen_string_literal: true
|
||||
|
||||
json.amount do
|
||||
json.without_tax number_to_currency((price - (price * vat_rate)) / 100.0)
|
||||
json.all_taxes_included number_to_currency(price / 100.0)
|
||||
json.without_tax number_to_currency((price - (price * vat_rate)) / 100.0, locale: CURRENCY_LOCALE)
|
||||
json.all_taxes_included number_to_currency(price / 100.0, locale: CURRENCY_LOCALE)
|
||||
json.vat_rate vat_rate.positive? ? number_to_percentage(vat_rate * 100) : 'none'
|
||||
end
|
||||
|
@ -24,7 +24,7 @@ wb.add_worksheet(name: ExcelService.name_safe(t('export_subscriptions.subscripti
|
||||
t("duration.#{sub.plan.interval}", count: sub.plan.interval_count),
|
||||
sub.created_at.to_date,
|
||||
sub.expired_at.to_date,
|
||||
number_to_currency(sub.plan.amount / 100.00)
|
||||
number_to_currency(sub.plan.amount / 100.00, locale: CURRENCY_LOCALE)
|
||||
]
|
||||
styles = [nil, nil, nil, nil, nil, date, date, nil, nil]
|
||||
types = %i[integer string string string string date date string string]
|
||||
|
@ -3,7 +3,7 @@
|
||||
<p>
|
||||
<%= t('.body.remember',
|
||||
REFERENCE: @attached_object.payment_schedule.reference,
|
||||
AMOUNT: number_to_currency(@attached_object.amount / 100.00),
|
||||
AMOUNT: number_to_currency(@attached_object.amount / 100.00, locale: CURRENCY_LOCALE),
|
||||
DATE: I18n.l(@attached_object.due_date, format: :long)) %>
|
||||
<%= t('.body.date') %>
|
||||
</p>
|
||||
|
@ -3,7 +3,7 @@
|
||||
<p>
|
||||
<%= t('.body.remember',
|
||||
REFERENCE: @attached_object.payment_schedule.reference,
|
||||
AMOUNT: number_to_currency(@attached_object.amount / 100.00),
|
||||
AMOUNT: number_to_currency(@attached_object.amount / 100.00, locale: CURRENCY_LOCALE),
|
||||
DATE: I18n.l(@attached_object.due_date, format: :long)) %>
|
||||
<%= t('.body.error', GATEWAY: @attached_object.payment_gateway_object.gateway_object.gateway) %>
|
||||
</p>
|
||||
|
@ -3,7 +3,7 @@
|
||||
<p>
|
||||
<%= t('.body.remember',
|
||||
REFERENCE: @attached_object.payment_schedule.reference,
|
||||
AMOUNT: number_to_currency(@attached_object.amount / 100.00),
|
||||
AMOUNT: number_to_currency(@attached_object.amount / 100.00, locale: CURRENCY_LOCALE),
|
||||
DATE: I18n.l(@attached_object.due_date, format: :long)) %>
|
||||
<%= t('.body.error') %>
|
||||
</p>
|
||||
|
@ -3,7 +3,7 @@
|
||||
<p>
|
||||
<%= t('.body.remember',
|
||||
REFERENCE: @attached_object.payment_schedule.reference,
|
||||
AMOUNT: number_to_currency(@attached_object.amount / 100.00),
|
||||
AMOUNT: number_to_currency(@attached_object.amount / 100.00, locale: CURRENCY_LOCALE),
|
||||
DATE: I18n.l(@attached_object.due_date, format: :long)) %>
|
||||
<%= t('.body.date') %>
|
||||
</p>
|
||||
|
@ -1,11 +1,11 @@
|
||||
<%= render 'notifications_mailer/shared/hello', recipient: @recipient %>
|
||||
|
||||
<p><%= t('.body.refund_created',
|
||||
AMOUNT: number_to_currency(@attached_object.total / 100.00),
|
||||
AMOUNT: number_to_currency(@attached_object.total / 100.00, locale: CURRENCY_LOCALE),
|
||||
INVOICE: @attached_object.invoice.reference,
|
||||
USER: @attached_object.invoicing_profile&.full_name) if @attached_object.invoice %>
|
||||
<%= t('.body.wallet_refund_created',
|
||||
AMOUNT: number_to_currency(@attached_object.total / 100.00),
|
||||
AMOUNT: number_to_currency(@attached_object.total / 100.00, locale: CURRENCY_LOCALE),
|
||||
USER: @attached_object.invoicing_profile&.full_name) if @attached_object.main_item.object_type === WalletTransaction.name %>
|
||||
</p>
|
||||
<p><a href="<%= "#{root_url}api/invoices/#{@attached_object.id}/download" %>" target="_blank"><%= t('.body.download') %></a></p>
|
||||
|
@ -2,7 +2,7 @@
|
||||
<%= render 'notifications_mailer/shared/hello', recipient: @recipient %>
|
||||
<p>
|
||||
<%= t('.body.wallet_credit_html',
|
||||
AMOUNT: number_to_currency(@attached_object.amount),
|
||||
AMOUNT: number_to_currency(@attached_object.amount, locale: CURRENCY_LOCALE),
|
||||
USER: @attached_object.wallet.user&.profile&.full_name || t('api.notifications.deleted_user'),
|
||||
ADMIN: @attached_object.user&.profile&.full_name || t('api.notifications.deleted_user'))
|
||||
%>
|
||||
|
@ -8,7 +8,7 @@
|
||||
</p>
|
||||
<% else %>
|
||||
<p><%= t('.body.enjoy_a_discount_of_AMOUNT_with_code_CODE',
|
||||
AMOUNT: number_to_currency(@attached_object.amount_off / 100.00),
|
||||
AMOUNT: number_to_currency(@attached_object.amount_off / 100.00, locale: CURRENCY_LOCALE),
|
||||
CODE: @attached_object.code
|
||||
) %>
|
||||
</p>
|
||||
|
@ -4,7 +4,7 @@
|
||||
<%= _t('.body.please_find_attached_html',
|
||||
{
|
||||
DATE: I18n.l(@attached_object.avoir_date.to_date),
|
||||
AMOUNT: number_to_currency(@attached_object.total / 100.0),
|
||||
AMOUNT: number_to_currency(@attached_object.total / 100.0, locale: CURRENCY_LOCALE),
|
||||
TYPE: @attached_object.main_item.object_type
|
||||
})
|
||||
# messageFormat
|
||||
|
@ -4,7 +4,7 @@
|
||||
<%= _t('.body.please_find_attached_html',
|
||||
{
|
||||
DATE: I18n.l(@attached_object.created_at.to_date),
|
||||
AMOUNT: number_to_currency(@attached_object.total / 100.0),
|
||||
AMOUNT: number_to_currency(@attached_object.total / 100.0, locale: CURRENCY_LOCALE),
|
||||
TYPE: @attached_object.main_item.object_type
|
||||
})
|
||||
# messageFormat
|
||||
|
@ -3,7 +3,7 @@
|
||||
<p>
|
||||
<%= t('.body.remember',
|
||||
REFERENCE: @attached_object.payment_schedule.reference,
|
||||
AMOUNT: number_to_currency(@attached_object.amount / 100.00),
|
||||
AMOUNT: number_to_currency(@attached_object.amount / 100.00, locale: CURRENCY_LOCALE),
|
||||
DATE: I18n.l(@attached_object.due_date, format: :long)) %>
|
||||
<%= t('.body.error') %>
|
||||
</p>
|
||||
|
@ -3,7 +3,7 @@
|
||||
<p>
|
||||
<%= t('.body.remember',
|
||||
REFERENCE: @attached_object.payment_schedule.reference,
|
||||
AMOUNT: number_to_currency(@attached_object.amount / 100.00),
|
||||
AMOUNT: number_to_currency(@attached_object.amount / 100.00, locale: CURRENCY_LOCALE),
|
||||
DATE: I18n.l(@attached_object.due_date, format: :long)) %>
|
||||
<%= t('.body.error') %>
|
||||
</p>
|
||||
|
@ -4,7 +4,7 @@
|
||||
<%= _t('.body.please_find_attached_html',
|
||||
{
|
||||
DATE: I18n.l(@attached_object.created_at.to_date),
|
||||
AMOUNT: number_to_currency(@attached_object.total / 100.0),
|
||||
AMOUNT: number_to_currency(@attached_object.total / 100.0, locale: CURRENCY_LOCALE),
|
||||
TYPE: @attached_object.main_object.object_type
|
||||
})
|
||||
# messageFormat
|
||||
|
@ -1,2 +1,2 @@
|
||||
<%= render 'notifications_mailer/shared/hello', recipient: @recipient %>
|
||||
<p><%= t('.body.wallet_credit_html', AMOUNT: number_to_currency(@attached_object.amount)) %></p>
|
||||
<p><%= t('.body.wallet_credit_html', AMOUNT: number_to_currency(@attached_object.amount, locale: CURRENCY_LOCALE)) %></p>
|
||||
|
@ -6,14 +6,15 @@ class PaymentScheduleItemWorker
|
||||
include Sidekiq::Worker
|
||||
|
||||
def perform(record_id = nil)
|
||||
if record_id
|
||||
psi = PaymentScheduleItem.find(record_id)
|
||||
check_item(psi)
|
||||
else
|
||||
PaymentScheduleItem.where.not(state: 'paid').where('due_date < ?', Time.current).each do |item|
|
||||
check_item(item)
|
||||
end
|
||||
end
|
||||
p "WORKER CURRENCY_LOCALE=#{CURRENCY_LOCALE}"
|
||||
# if record_id
|
||||
# psi = PaymentScheduleItem.find(record_id)
|
||||
# check_item(psi)
|
||||
# else
|
||||
# PaymentScheduleItem.where.not(state: 'paid').where('due_date < ?', Time.current).each do |item|
|
||||
# check_item(item)
|
||||
# end
|
||||
# end
|
||||
end
|
||||
|
||||
# @param psi [PaymentScheduleItem]
|
||||
|
1
config/initializers/currency.rb
Normal file
1
config/initializers/currency.rb
Normal file
@ -0,0 +1 @@
|
||||
CURRENCY_LOCALE = Rails.application.secrets.rails_locale
|
@ -31,7 +31,7 @@ namespace :fablab do
|
||||
puts "\e[4;33mFound an invalid InvoiceItem\e[0m"
|
||||
puts '=============================================='
|
||||
puts "Invoice #{invoice.id} (# #{invoice.reference})"
|
||||
puts "Total: #{number_to_currency(invoice.total / 100.0)}"
|
||||
puts "Total: #{number_to_currency(invoice.total / 100.0, locale: CURRENCY_LOCALE)}"
|
||||
puts "Customer: #{invoice.invoicing_profile.full_name} (#{invoice.invoicing_profile.email})"
|
||||
puts "Operator: #{invoice.operator_profile&.user&.profile&.full_name} (#{invoice.operator_profile&.user&.email})"
|
||||
puts "Date: #{invoice.created_at}"
|
||||
|
@ -22,7 +22,7 @@ namespace :fablab do
|
||||
ii = invoice.invoice_items.where(subscription_id: nil).first
|
||||
puts '=============================================='
|
||||
puts "Invoice #{invoice.id} (# #{invoice.reference})"
|
||||
puts "Total: #{number_to_currency(invoice.total / 100.0)}"
|
||||
puts "Total: #{number_to_currency(invoice.total / 100.0, locale: CURRENCY_LOCALE)}"
|
||||
puts "Subject: #{ii.description}."
|
||||
puts "Customer: #{invoice.invoicing_profile.full_name} (#{invoice.invoicing_profile.email})"
|
||||
puts "Operator: #{invoice.operator_profile&.user&.profile&.full_name} (#{invoice.operator_profile&.user&.email})"
|
||||
|
@ -38,7 +38,7 @@ class Invoices::VATTest < ActionDispatch::IntegrationTest
|
||||
assert_invoice_pdf invoice do |lines|
|
||||
vat_line = I18n.t('invoices.including_VAT_RATE',
|
||||
**{ RATE: Setting.get('invoice_VAT-rate'),
|
||||
AMOUNT: number_to_currency(invoice.total / 100.00),
|
||||
AMOUNT: number_to_currency(invoice.total / 100.00, locale: CURRENCY_LOCALE),
|
||||
NAME: 'TVQ+TPS' })
|
||||
assert(lines.any? { |l| /#{Regexp.escape(vat_line)}/.match(l) })
|
||||
end
|
||||
|
Loading…
Reference in New Issue
Block a user