mirror of
https://github.com/invoiceninja/invoiceninja.git
synced 2025-07-09 03:14:30 -04:00
Bug fixes
This commit is contained in:
parent
af5f659d24
commit
3b4220cede
@ -1,16 +1,18 @@
|
|||||||
<?php
|
<?php
|
||||||
|
|
||||||
use ninja\repositories\PaymentRepository;
|
use ninja\repositories\PaymentRepository;
|
||||||
|
use ninja\repositories\InvoiceRepository;
|
||||||
|
|
||||||
class PaymentController extends \BaseController
|
class PaymentController extends \BaseController
|
||||||
{
|
{
|
||||||
protected $creditRepo;
|
protected $creditRepo;
|
||||||
|
|
||||||
public function __construct(PaymentRepository $paymentRepo)
|
public function __construct(PaymentRepository $paymentRepo, InvoiceRepository $invoiceRepo)
|
||||||
{
|
{
|
||||||
parent::__construct();
|
parent::__construct();
|
||||||
|
|
||||||
$this->paymentRepo = $paymentRepo;
|
$this->paymentRepo = $paymentRepo;
|
||||||
|
$this->invoiceRepo = $invoiceRepo;
|
||||||
}
|
}
|
||||||
|
|
||||||
public function index()
|
public function index()
|
||||||
@ -327,11 +329,6 @@ class PaymentController extends \BaseController
|
|||||||
{
|
{
|
||||||
$payment = self::createPayment($invitation, $ref);
|
$payment = self::createPayment($invitation, $ref);
|
||||||
|
|
||||||
$invoice->invoice_status_id = INVOICE_STATUS_PAID;
|
|
||||||
$invoice->save();
|
|
||||||
|
|
||||||
Event::fire('invoice.paid', $payment);
|
|
||||||
|
|
||||||
Session::flash('message', trans('texts.applied_payment'));
|
Session::flash('message', trans('texts.applied_payment'));
|
||||||
return Redirect::to('view/' . $payment->invitation->invitation_key);
|
return Redirect::to('view/' . $payment->invitation->invitation_key);
|
||||||
}
|
}
|
||||||
@ -380,11 +377,6 @@ class PaymentController extends \BaseController
|
|||||||
{
|
{
|
||||||
$payment = self::createPayment($invitation, $response->response_message);
|
$payment = self::createPayment($invitation, $response->response_message);
|
||||||
|
|
||||||
$invoice->invoice_status_id = INVOICE_STATUS_PAID;
|
|
||||||
$invoice->save();
|
|
||||||
|
|
||||||
Event::fire('invoice.paid', $payment);
|
|
||||||
|
|
||||||
Session::flash('message', trans('texts.applied_payment'));
|
Session::flash('message', trans('texts.applied_payment'));
|
||||||
return Redirect::to('view/' . $payment->invitation->invitation_key);
|
return Redirect::to('view/' . $payment->invitation->invitation_key);
|
||||||
}
|
}
|
||||||
@ -419,7 +411,7 @@ class PaymentController extends \BaseController
|
|||||||
|
|
||||||
if ($invoice->is_quote)
|
if ($invoice->is_quote)
|
||||||
{
|
{
|
||||||
$invoice = $this->invoiceRepo->cloneInvoice($invoice, $invoice->id);
|
$invoice = $this->invoiceRepo->cloneInvoice($invoice, $invoice->id, $invitation);
|
||||||
}
|
}
|
||||||
|
|
||||||
$payment = Payment::createNew($invitation);
|
$payment = Payment::createNew($invitation);
|
||||||
@ -439,6 +431,11 @@ class PaymentController extends \BaseController
|
|||||||
|
|
||||||
$payment->save();
|
$payment->save();
|
||||||
|
|
||||||
|
$invoice->invoice_status_id = INVOICE_STATUS_PAID;
|
||||||
|
$invoice->save();
|
||||||
|
|
||||||
|
Event::fire('invoice.paid', $payment);
|
||||||
|
|
||||||
return $payment;
|
return $payment;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -463,11 +460,6 @@ class PaymentController extends \BaseController
|
|||||||
{
|
{
|
||||||
$payment = self::createPayment($invitation, $ref, $payerId);
|
$payment = self::createPayment($invitation, $ref, $payerId);
|
||||||
|
|
||||||
$invoice->invoice_status_id = INVOICE_STATUS_PAID;
|
|
||||||
$invoice->save();
|
|
||||||
|
|
||||||
Event::fire('invoice.paid', $payment);
|
|
||||||
|
|
||||||
Session::flash('message', trans('texts.applied_payment'));
|
Session::flash('message', trans('texts.applied_payment'));
|
||||||
return Redirect::to('view/' . $invitation->invitation_key);
|
return Redirect::to('view/' . $invitation->invitation_key);
|
||||||
}
|
}
|
||||||
|
@ -67,7 +67,7 @@ class ContactMailer extends Mailer {
|
|||||||
'clientName' => $payment->client->getDisplayName(),
|
'clientName' => $payment->client->getDisplayName(),
|
||||||
'emailFooter' => $payment->account->email_footer,
|
'emailFooter' => $payment->account->email_footer,
|
||||||
'paymentAmount' => Utils::formatMoney($payment->amount, $payment->client->currency_id),
|
'paymentAmount' => Utils::formatMoney($payment->amount, $payment->client->currency_id),
|
||||||
'showNinjaFooter' => !$invoice->account->isPro() || !Utils::isNinjaProd()
|
'showNinjaFooter' => !$payment->account->isPro() || !Utils::isNinjaProd()
|
||||||
];
|
];
|
||||||
|
|
||||||
$user = $payment->invitation->user;
|
$user = $payment->invitation->user;
|
||||||
|
@ -318,9 +318,11 @@ class InvoiceRepository
|
|||||||
return $invoice;
|
return $invoice;
|
||||||
}
|
}
|
||||||
|
|
||||||
public function cloneInvoice($invoice, $quotePublicId = null)
|
public function cloneInvoice($invoice, $quotePublicId = null, $invitation = null)
|
||||||
{
|
{
|
||||||
$clone = Invoice::createNew();
|
$invoice->load('invitations', 'invoice_items');
|
||||||
|
|
||||||
|
$clone = Invoice::createNew($invitation ? $invitation : $invoice);
|
||||||
$clone->balance = $invoice->amount;
|
$clone->balance = $invoice->amount;
|
||||||
$clone->invoice_number = $invoice->account->getNextInvoiceNumber();
|
$clone->invoice_number = $invoice->account->getNextInvoiceNumber();
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user