mirror of
https://github.com/invoiceninja/invoiceninja.git
synced 2025-07-08 05:44:32 -04:00
Fixed issue with recurring invoices
This commit is contained in:
parent
3b6a4a6100
commit
e08c80f23c
@ -106,11 +106,13 @@ class ActivityListener
|
|||||||
|
|
||||||
public function deletedInvoice(InvoiceWasDeleted $event)
|
public function deletedInvoice(InvoiceWasDeleted $event)
|
||||||
{
|
{
|
||||||
|
$invoice = $event->invoice;
|
||||||
|
|
||||||
$this->activityRepo->create(
|
$this->activityRepo->create(
|
||||||
$event->invoice,
|
$invoice,
|
||||||
ACTIVITY_TYPE_DELETE_INVOICE,
|
ACTIVITY_TYPE_DELETE_INVOICE,
|
||||||
$event->invoice->balance * -1,
|
$invoice->affectsBalance() ? $invoice->balance * -1 : 0,
|
||||||
$event->invoice->getAmountPaid() * -1
|
$invoice->affectsBalance() ? $invoice->getAmountPaid() * -1 : 0
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -128,11 +130,13 @@ class ActivityListener
|
|||||||
|
|
||||||
public function restoredInvoice(InvoiceWasRestored $event)
|
public function restoredInvoice(InvoiceWasRestored $event)
|
||||||
{
|
{
|
||||||
|
$invoice = $event->invoice;
|
||||||
|
|
||||||
$this->activityRepo->create(
|
$this->activityRepo->create(
|
||||||
$event->invoice,
|
$invoice,
|
||||||
ACTIVITY_TYPE_RESTORE_INVOICE,
|
ACTIVITY_TYPE_RESTORE_INVOICE,
|
||||||
$event->fromDeleted ? $event->invoice->balance : 0,
|
$invoice->affectsBalance() && $event->fromDeleted ? $invoice->balance : 0,
|
||||||
$event->fromDeleted ? $event->invoice->getAmountPaid() : 0
|
$invoice->affectsBalance() && $event->fromDeleted ? $invoice->getAmountPaid() : 0
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -46,9 +46,14 @@ class Invoice extends EntityModel implements BalanceAffecting
|
|||||||
return $this->is_recurring ? trans('texts.recurring') : $this->invoice_number;
|
return $this->is_recurring ? trans('texts.recurring') : $this->invoice_number;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function affectsBalance()
|
||||||
|
{
|
||||||
|
return !$this->is_quote && !$this->is_recurring;
|
||||||
|
}
|
||||||
|
|
||||||
public function getAdjustment()
|
public function getAdjustment()
|
||||||
{
|
{
|
||||||
if ($this->is_quote || $this->is_recurring) {
|
if (!$this->affectsBalance()) {
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user