mirror of
https://github.com/invoiceninja/invoiceninja.git
synced 2025-07-09 03:14:30 -04:00
Code cleanup
This commit is contained in:
parent
ab7a28a091
commit
fc8420cf02
@ -11,25 +11,15 @@
|
||||
|
||||
namespace App\Services\Invoice;
|
||||
|
||||
use App\Jobs\Ninja\TransactionLog;
|
||||
use App\Models\Invoice;
|
||||
use App\Models\Payment;
|
||||
use App\Models\TransactionEvent;
|
||||
use App\Services\AbstractService;
|
||||
|
||||
class ApplyPayment extends AbstractService
|
||||
{
|
||||
private $invoice;
|
||||
|
||||
private $payment;
|
||||
|
||||
private $payment_amount;
|
||||
|
||||
public function __construct($invoice, $payment, $payment_amount)
|
||||
public function __construct(private Invoice $invoice, private Payment $payment, private float $payment_amount)
|
||||
{
|
||||
$this->invoice = $invoice;
|
||||
$this->payment = $payment;
|
||||
$this->payment_amount = $payment_amount;
|
||||
}
|
||||
|
||||
/* Apply payment to a single invoice */
|
||||
|
@ -23,11 +23,8 @@ class CreateInvitations extends AbstractService
|
||||
{
|
||||
use MakesHash;
|
||||
|
||||
private $invoice;
|
||||
|
||||
public function __construct(Invoice $invoice)
|
||||
public function __construct(private Invoice $invoice)
|
||||
{
|
||||
$this->invoice = $invoice;
|
||||
}
|
||||
|
||||
public function run()
|
||||
|
@ -28,27 +28,13 @@ class GenerateDeliveryNote
|
||||
{
|
||||
use MakesHash, PdfMaker;
|
||||
|
||||
/**
|
||||
* @var \App\Models\Invoice
|
||||
*/
|
||||
private $invoice;
|
||||
|
||||
/**
|
||||
* @var \App\Models\ClientContact
|
||||
*/
|
||||
private $contact;
|
||||
|
||||
/**
|
||||
* @var mixed
|
||||
*/
|
||||
private $disk;
|
||||
|
||||
public function __construct(Invoice $invoice, ClientContact $contact = null, $disk = null)
|
||||
public function __construct(private Invoice $invoice, private ?ClientContact $contact = null, $disk = null)
|
||||
{
|
||||
$this->invoice = $invoice;
|
||||
|
||||
$this->contact = $contact;
|
||||
|
||||
$this->disk = $disk ?? config('filesystems.default');
|
||||
}
|
||||
|
||||
|
@ -12,10 +12,7 @@
|
||||
namespace App\Services\Invoice;
|
||||
|
||||
use App\Events\Invoice\InvoiceWasCancelled;
|
||||
use App\Jobs\Ninja\TransactionLog;
|
||||
use App\Models\Client;
|
||||
use App\Models\Invoice;
|
||||
use App\Models\TransactionEvent;
|
||||
use App\Services\AbstractService;
|
||||
use App\Utils\Ninja;
|
||||
use App\Utils\Traits\GeneratesCounter;
|
||||
@ -25,9 +22,7 @@ class HandleCancellation extends AbstractService
|
||||
{
|
||||
use GeneratesCounter;
|
||||
|
||||
private $invoice;
|
||||
|
||||
public function __construct(Invoice $invoice)
|
||||
public function __construct(private Invoice $invoice)
|
||||
{
|
||||
$this->invoice = $invoice;
|
||||
}
|
||||
|
@ -23,17 +23,14 @@ class HandleRestore extends AbstractService
|
||||
{
|
||||
use GeneratesCounter;
|
||||
|
||||
private $invoice;
|
||||
|
||||
private $payment_total = 0;
|
||||
|
||||
private $total_payments = 0;
|
||||
|
||||
private $adjustment_amount = 0;
|
||||
|
||||
public function __construct(Invoice $invoice)
|
||||
public function __construct(private Invoice $invoice)
|
||||
{
|
||||
$this->invoice = $invoice;
|
||||
}
|
||||
|
||||
public function run()
|
||||
|
@ -23,11 +23,8 @@ class HandleReversal extends AbstractService
|
||||
{
|
||||
use GeneratesCounter;
|
||||
|
||||
private $invoice;
|
||||
|
||||
public function __construct(Invoice $invoice)
|
||||
public function __construct(private Invoice $invoice)
|
||||
{
|
||||
$this->invoice = $invoice;
|
||||
}
|
||||
|
||||
public function run()
|
||||
|
@ -21,17 +21,14 @@ class MarkInvoiceDeleted extends AbstractService
|
||||
{
|
||||
use GeneratesCounter;
|
||||
|
||||
public $invoice;
|
||||
|
||||
private $adjustment_amount = 0;
|
||||
|
||||
private $total_payments = 0;
|
||||
|
||||
private $balance_adjustment = 0;
|
||||
|
||||
public function __construct(Invoice $invoice)
|
||||
public function __construct(public Invoice $invoice)
|
||||
{
|
||||
$this->invoice = $invoice;
|
||||
}
|
||||
|
||||
public function run()
|
||||
|
@ -18,19 +18,8 @@ use App\Services\AbstractService;
|
||||
|
||||
class SendEmail extends AbstractService
|
||||
{
|
||||
protected $invoice;
|
||||
|
||||
protected $reminder_template;
|
||||
|
||||
protected $contact;
|
||||
|
||||
public function __construct(Invoice $invoice, $reminder_template = null, ClientContact $contact = null)
|
||||
public function __construct(protected Invoice $invoice, protected $reminder_template = null, protected ?ClientContact $contact = null)
|
||||
{
|
||||
$this->invoice = $invoice;
|
||||
|
||||
$this->reminder_template = $reminder_template;
|
||||
|
||||
$this->contact = $contact;
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -23,17 +23,10 @@ class TriggeredActions extends AbstractService
|
||||
{
|
||||
use GeneratesCounter;
|
||||
|
||||
private $request;
|
||||
|
||||
private $invoice;
|
||||
|
||||
private bool $updated = false;
|
||||
|
||||
public function __construct(Invoice $invoice, Request $request)
|
||||
public function __construct(private Invoice $invoice, private Request $request)
|
||||
{
|
||||
$this->request = $request;
|
||||
|
||||
$this->invoice = $invoice;
|
||||
}
|
||||
|
||||
public function run()
|
||||
|
@ -18,14 +18,9 @@ use Carbon\Carbon;
|
||||
|
||||
class UpdateReminder extends AbstractService
|
||||
{
|
||||
public $invoice;
|
||||
|
||||
public $settings;
|
||||
|
||||
public function __construct(Invoice $invoice, $settings = null)
|
||||
public function __construct(public Invoice $invoice, public mixed $settings = null)
|
||||
{
|
||||
$this->invoice = $invoice;
|
||||
$this->settings = $settings;
|
||||
}
|
||||
|
||||
/* We only support setting reminders based on the due date, not the partial due date */
|
||||
|
Loading…
x
Reference in New Issue
Block a user