mirror of
https://github.com/invoiceninja/invoiceninja.git
synced 2025-05-31 03:24:34 -04:00
refactor for workflow with invoice services
This commit is contained in:
parent
35f97d1b91
commit
83b99f296f
@ -52,11 +52,7 @@ class SetupController extends Controller
|
|||||||
if ($check['system_health'] == true && $check['simple_db_check'] && Schema::hasTable('accounts') && $account = Account::all()->first()) {
|
if ($check['system_health'] == true && $check['simple_db_check'] && Schema::hasTable('accounts') && $account = Account::all()->first()) {
|
||||||
return redirect('/');
|
return redirect('/');
|
||||||
}
|
}
|
||||||
|
|
||||||
// not sure if we really need this.
|
|
||||||
// if(File::exists(base_path('.env')))
|
|
||||||
// abort(400, '.env file already exists, delete file to start Setup again.');
|
|
||||||
|
|
||||||
return view('setup.index', ['check' => $check]);
|
return view('setup.index', ['check' => $check]);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -42,8 +42,6 @@ class InvoiceArchivedActivity implements ShouldQueue
|
|||||||
public function handle($event)
|
public function handle($event)
|
||||||
{
|
{
|
||||||
MultiDB::setDb($event->company->db);
|
MultiDB::setDb($event->company->db);
|
||||||
|
|
||||||
// $event->invoice->service()->deletePdf();
|
|
||||||
|
|
||||||
$fields = new stdClass;
|
$fields = new stdClass;
|
||||||
|
|
||||||
|
@ -11,6 +11,7 @@
|
|||||||
|
|
||||||
namespace App\Services\Invoice;
|
namespace App\Services\Invoice;
|
||||||
|
|
||||||
|
use App\Events\Invoice\InvoiceWasArchived;
|
||||||
use App\Jobs\Entity\CreateEntityPdf;
|
use App\Jobs\Entity\CreateEntityPdf;
|
||||||
use App\Jobs\Invoice\InvoiceWorkflowSettings;
|
use App\Jobs\Invoice\InvoiceWorkflowSettings;
|
||||||
use App\Jobs\Util\UnlinkFile;
|
use App\Jobs\Util\UnlinkFile;
|
||||||
@ -539,35 +540,16 @@ class InvoiceService
|
|||||||
if ($this->invoice->status_id == Invoice::STATUS_PAID && $this->invoice->client->getSetting('auto_archive_invoice')) {
|
if ($this->invoice->status_id == Invoice::STATUS_PAID && $this->invoice->client->getSetting('auto_archive_invoice')) {
|
||||||
/* Throws: Payment amount xxx does not match invoice totals. */
|
/* Throws: Payment amount xxx does not match invoice totals. */
|
||||||
|
|
||||||
$base_repository = new BaseRepository();
|
if ($this->invoice->trashed())
|
||||||
$base_repository->archive($this->invoice);
|
return;
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
/*
|
$this->invoice->delete();
|
||||||
//if paid invoice is attached to a recurring invoice - check if we need to unpause the recurring invoice
|
|
||||||
|
event(new InvoiceWasArchived($this->invoice, $this->invoice->company, Ninja::eventVars(auth()->user() ? auth()->user()->id : null)));
|
||||||
|
|
||||||
if ($this->invoice->status_id == Invoice::STATUS_PAID &&
|
|
||||||
$this->invoice->recurring_id &&
|
|
||||||
$this->invoice->company->pause_recurring_until_paid &&
|
|
||||||
($this->invoice->recurring_invoice->status_id != RecurringInvoice::STATUS_ACTIVE || $this->invoice->recurring_invoice->status_id != RecurringInvoice::STATUS_COMPLETED))
|
|
||||||
{
|
|
||||||
$recurring_invoice = $this->invoice->recurring_invoice;
|
|
||||||
|
|
||||||
// Check next_send_date if it is in the past - calculate
|
|
||||||
$next_send_date = Carbon::parse($recurring_invoice->next_send_date)->startOfDay();
|
|
||||||
|
|
||||||
if(next_send_date->lt(now())){
|
|
||||||
$recurring_invoice->next_send_date = $recurring_invoice->nextDateByFrequency(now()->format('Y-m-d'));
|
|
||||||
$recurring_invoice->save();
|
|
||||||
}
|
|
||||||
|
|
||||||
// Start the recurring invoice
|
|
||||||
$recurring_invoice->service()
|
|
||||||
->start();
|
|
||||||
|
|
||||||
}
|
}
|
||||||
*/
|
|
||||||
return $this;
|
return $this;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -71,6 +71,9 @@ class UpdateInvoicePayment
|
|||||||
->updatePaidToDate($paid_amount)
|
->updatePaidToDate($paid_amount)
|
||||||
->updateStatus()
|
->updateStatus()
|
||||||
->touchPdf()
|
->touchPdf()
|
||||||
|
->save();
|
||||||
|
|
||||||
|
$invoice->service()
|
||||||
->workFlow()
|
->workFlow()
|
||||||
->save();
|
->save();
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user