mirror of
https://github.com/internetee/registry.git
synced 2025-05-17 17:59:47 +02:00
Show specific error on invoice generation in admin #2802
This commit is contained in:
parent
0f652aedc1
commit
9f42784d33
6 changed files with 6 additions and 5 deletions
|
@ -12,7 +12,7 @@ class Admin::InvoicesController < AdminController
|
|||
@deposit = Deposit.new(deposit_params.merge(registrar: r))
|
||||
@invoice = @deposit.issue_prepayment_invoice
|
||||
|
||||
if @invoice.persisted?
|
||||
if @invoice && @invoice.persisted?
|
||||
flash[:notice] = t(:record_created)
|
||||
redirect_to [:admin, @invoice]
|
||||
else
|
||||
|
|
|
@ -9,7 +9,7 @@ class Registrar::DepositsController < RegistrarController
|
|||
@deposit = Deposit.new(deposit_params.merge(registrar: current_user.registrar))
|
||||
@invoice = @deposit.issue_prepayment_invoice
|
||||
|
||||
if @invoice.persisted?
|
||||
if @invoice && @invoice.persisted?
|
||||
flash[:notice] = t(:please_pay_the_following_invoice)
|
||||
redirect_to [:registrar, @invoice]
|
||||
else
|
||||
|
|
|
@ -29,7 +29,7 @@ class Invoice < ActiveRecord::Base
|
|||
|
||||
return if number <= Setting.invoice_number_max.to_i
|
||||
|
||||
errors.add(:base, I18n.t('failed_to_generate_invoice'))
|
||||
errors.add(:base, I18n.t('failed_to_generate_invoice_invoice_number_limit_reached'))
|
||||
logger.error('INVOICE NUMBER LIMIT REACHED, COULD NOT GENERATE INVOICE')
|
||||
false
|
||||
end
|
||||
|
|
|
@ -1,7 +1,6 @@
|
|||
- content_for :actions do
|
||||
= link_to(t(:add), new_admin_invoice_path, class: 'btn btn-primary')
|
||||
= render 'shared/title', name: t(:invoices)
|
||||
|
||||
.row
|
||||
.col-md-12
|
||||
.table-responsive
|
||||
|
|
|
@ -4,7 +4,8 @@
|
|||
|
||||
= form_for([:admin, @deposit], url: admin_invoices_path, method: :post, html: { class: 'form-horizontal' }) do |f|
|
||||
= render 'shared/full_errors', object: @deposit
|
||||
|
||||
- if @invoice
|
||||
= render 'shared/full_errors', object: @invoice
|
||||
.row
|
||||
.col-md-8
|
||||
.form-group
|
||||
|
|
|
@ -893,3 +893,4 @@ en:
|
|||
results_per_page: 'Results per page'
|
||||
nameserver_hostname: 'Nameserver hostname'
|
||||
result_count: '%{count} results'
|
||||
failed_to_generate_invoice_invoice_number_limit_reached: 'Failed to generate invoice - invoice number limit reached'
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue