mirror of
https://github.com/invoiceninja/invoiceninja.git
synced 2025-07-09 03:14:30 -04:00
Fixes for auto-archive invoices
This commit is contained in:
parent
659b955862
commit
d29f1798a2
@ -126,7 +126,7 @@ class ApplyPayment extends AbstractService
|
||||
|
||||
});
|
||||
|
||||
$this->invoice->service()->applyNumber()->save();
|
||||
$this->invoice->service()->applyNumber()->workFlow()->save();
|
||||
|
||||
return $this->invoice;
|
||||
}
|
||||
|
@ -20,6 +20,7 @@ use App\Models\Expense;
|
||||
use App\Models\Invoice;
|
||||
use App\Models\Payment;
|
||||
use App\Models\Task;
|
||||
use App\Repositories\BaseRepository;
|
||||
use App\Services\Client\ClientService;
|
||||
use App\Services\Invoice\UpdateReminder;
|
||||
use App\Utils\Ninja;
|
||||
@ -271,9 +272,8 @@ class InvoiceService
|
||||
{
|
||||
if ((int)$this->invoice->balance == 0) {
|
||||
|
||||
InvoiceWorkflowSettings::dispatchNow($this->invoice);
|
||||
|
||||
$this->setStatus(Invoice::STATUS_PAID);
|
||||
$this->setStatus(Invoice::STATUS_PAID)->workFlow();
|
||||
// InvoiceWorkflowSettings::dispatchNow($this->invoice);
|
||||
}
|
||||
|
||||
if ($this->invoice->balance > 0 && $this->invoice->balance < $this->invoice->amount) {
|
||||
@ -449,6 +449,18 @@ class InvoiceService
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function workFlow()
|
||||
{
|
||||
|
||||
if ($this->invoice->status_id == Invoice::STATUS_PAID && $this->invoice->client->getSetting('auto_archive_invoice')) {
|
||||
/* Throws: Payment amount xxx does not match invoice totals. */
|
||||
$base_repository = new BaseRepository();
|
||||
$base_repository->archive($this->invoice);
|
||||
}
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Saves the invoice.
|
||||
* @return Invoice object
|
||||
|
@ -95,7 +95,8 @@ class MarkPaid extends AbstractService
|
||||
->updatePaidToDate($payment->amount)
|
||||
->save();
|
||||
|
||||
InvoiceWorkflowSettings::dispatchNow($this->invoice);
|
||||
$this->invoice->service()->workFlow()->save();
|
||||
// InvoiceWorkflowSettings::dispatchNow($this->invoice);
|
||||
|
||||
return $this->invoice;
|
||||
}
|
||||
|
@ -85,8 +85,6 @@ class UpdateInvoicePayment
|
||||
->deletePdf()
|
||||
->save();
|
||||
|
||||
InvoiceWorkflowSettings::dispatchNow($invoice);
|
||||
|
||||
event(new InvoiceWasUpdated($invoice, $invoice->company, Ninja::eventVars(auth()->user() ? auth()->user()->id : null)));
|
||||
});
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user