mirror of
https://github.com/internetee/registry.git
synced 2025-05-28 07:02:04 +02:00
Invoice forwarding in admin #2566
This commit is contained in:
parent
bfd3e07981
commit
2e7f5a74c5
3 changed files with 32 additions and 1 deletions
|
@ -41,6 +41,21 @@ class Admin::InvoicesController < AdminController
|
|||
end
|
||||
end
|
||||
|
||||
def forward
|
||||
@invoice.billing_email = @invoice.buyer.billing_email
|
||||
|
||||
return unless request.post?
|
||||
|
||||
@invoice.billing_email = params[:invoice][:billing_email]
|
||||
|
||||
if @invoice.forward(render_to_string('registrar/invoices/pdf', layout: false))
|
||||
flash[:notice] = t(:invoice_forwared)
|
||||
redirect_to([:admin, @invoice])
|
||||
else
|
||||
flash.now[:alert] = t(:failed_to_forward_invoice)
|
||||
end
|
||||
end
|
||||
|
||||
def download_pdf
|
||||
pdf = @invoice.pdf(render_to_string('registrar/invoices/pdf', layout: false))
|
||||
send_data pdf, filename: @invoice.pdf_name
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue