mirror of
https://github.com/invoiceninja/invoiceninja.git
synced 2025-07-09 03:14:30 -04:00
Clean up of Apply Number class for payments
This commit is contained in:
parent
9e604e81f6
commit
897f170307
@ -98,11 +98,10 @@ class PaymentMigrationRepository extends BaseRepository
|
|||||||
}
|
}
|
||||||
|
|
||||||
$payment->deleted_at = $data['deleted_at'] ?: null;
|
$payment->deleted_at = $data['deleted_at'] ?: null;
|
||||||
$payment->save();
|
|
||||||
|
|
||||||
if ($payment->currency_id == 0) {
|
if ($payment->currency_id == 0) {
|
||||||
$payment->currency_id = $payment->company->settings->currency_id;
|
$payment->currency_id = $payment->company->settings->currency_id;
|
||||||
$payment->save();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/*Ensure payment number generated*/
|
/*Ensure payment number generated*/
|
||||||
@ -110,6 +109,8 @@ class PaymentMigrationRepository extends BaseRepository
|
|||||||
$payment->number = $payment->client->getNextPaymentNumber($payment->client, $payment);
|
$payment->number = $payment->client->getNextPaymentNumber($payment->client, $payment);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
$payment->save();
|
||||||
|
|
||||||
$invoice_totals = 0;
|
$invoice_totals = 0;
|
||||||
$credit_totals = 0;
|
$credit_totals = 0;
|
||||||
$invoices = false;
|
$invoices = false;
|
||||||
|
@ -20,15 +20,10 @@ class ApplyNumber extends AbstractService
|
|||||||
{
|
{
|
||||||
use GeneratesCounter;
|
use GeneratesCounter;
|
||||||
|
|
||||||
private $payment;
|
|
||||||
|
|
||||||
private bool $completed = true;
|
private bool $completed = true;
|
||||||
|
|
||||||
public function __construct(Payment $payment)
|
public function __construct(private Payment $payment)
|
||||||
{
|
{
|
||||||
$this->client = $payment->client;
|
|
||||||
|
|
||||||
$this->payment = $payment;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public function run()
|
public function run()
|
||||||
@ -38,7 +33,6 @@ class ApplyNumber extends AbstractService
|
|||||||
}
|
}
|
||||||
|
|
||||||
$this->trySaving();
|
$this->trySaving();
|
||||||
// $this->payment->number = $this->getNextPaymentNumber($this->client, $this->payment);
|
|
||||||
|
|
||||||
return $this->payment;
|
return $this->payment;
|
||||||
}
|
}
|
||||||
@ -49,7 +43,7 @@ class ApplyNumber extends AbstractService
|
|||||||
|
|
||||||
do {
|
do {
|
||||||
try {
|
try {
|
||||||
$this->payment->number = $this->getNextPaymentNumber($this->client, $this->payment);
|
$this->payment->number = $this->getNextPaymentNumber($this->payment->client, $this->payment);
|
||||||
$this->payment->saveQuietly();
|
$this->payment->saveQuietly();
|
||||||
|
|
||||||
$this->completed = false;
|
$this->completed = false;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user