mirror of
https://github.com/invoiceninja/invoiceninja.git
synced 2025-07-08 08:04:40 -04:00
Fixes for deleting payments
This commit is contained in:
parent
93e1fc7185
commit
e9e8e259e8
@ -480,11 +480,11 @@ class CheckData extends Command
|
|||||||
LEFT JOIN paymentables
|
LEFT JOIN paymentables
|
||||||
ON
|
ON
|
||||||
payments.id = paymentables.payment_id
|
payments.id = paymentables.payment_id
|
||||||
WHERE paymentable_type = 'App\\Models\\Credit'
|
WHERE paymentable_type = ?
|
||||||
AND paymentables.deleted_at is NULL
|
AND paymentables.deleted_at is NULL
|
||||||
AND payments.is_deleted = 0
|
AND payments.is_deleted = 0
|
||||||
AND payments.client_id = ?;
|
AND payments.client_id = ?;
|
||||||
"), [$client->id] );
|
"), [App\Models\Credit::class, $client->id] );
|
||||||
|
|
||||||
return $results;
|
return $results;
|
||||||
}
|
}
|
||||||
@ -507,7 +507,7 @@ class CheckData extends Command
|
|||||||
|
|
||||||
$this->wrong_paid_to_dates++;
|
$this->wrong_paid_to_dates++;
|
||||||
|
|
||||||
$this->logMessage($client->present()->name.' id = # '.$client->id." - Paid to date does not match Client Paid To Date = {$client->paid_to_date} - Invoice Payments = {$total_paid_to_date}");
|
$this->logMessage($client->present()->name.' id = # '.$client->id." - Client Paid To Date = {$client->paid_to_date} != Invoice Payments = {$total_paid_to_date} - {$_client->payments_applied} + {$credits_used_for_payments[0]->credit_payment}");
|
||||||
|
|
||||||
$this->isValid = false;
|
$this->isValid = false;
|
||||||
|
|
||||||
|
@ -362,6 +362,7 @@ class Import implements ShouldQueue
|
|||||||
) {
|
) {
|
||||||
$data['settings']['invoice_design_id'] = 1;
|
$data['settings']['invoice_design_id'] = 1;
|
||||||
}
|
}
|
||||||
|
$data['settings']['email_sending_method'] = 'default';
|
||||||
|
|
||||||
$data = $this->transformCompanyData($data);
|
$data = $this->transformCompanyData($data);
|
||||||
|
|
||||||
@ -374,9 +375,6 @@ class Import implements ShouldQueue
|
|||||||
$data['subdomain'] = MultiDB::randomSubdomainGenerator();
|
$data['subdomain'] = MultiDB::randomSubdomainGenerator();
|
||||||
|
|
||||||
}
|
}
|
||||||
else {
|
|
||||||
$data['settings']['email_sending_method'] = 'default';
|
|
||||||
}
|
|
||||||
|
|
||||||
$rules = (new UpdateCompanyRequest())->rules();
|
$rules = (new UpdateCompanyRequest())->rules();
|
||||||
|
|
||||||
|
@ -99,6 +99,6 @@ class ClientService
|
|||||||
{
|
{
|
||||||
$this->client->save();
|
$this->client->save();
|
||||||
|
|
||||||
return $this->client;
|
return $this->client->fresh();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -145,10 +145,23 @@ class DeletePayment
|
|||||||
$multiplier = -1;
|
$multiplier = -1;
|
||||||
|
|
||||||
$paymentable_credit->service()
|
$paymentable_credit->service()
|
||||||
->updateBalance($paymentable_credit->pivot->amount*$multiplier)
|
->updateBalance($paymentable_credit->pivot->amount*$multiplier*-1)
|
||||||
->updatePaidToDate($paymentable_credit->pivot->amount*-1)
|
->updatePaidToDate($paymentable_credit->pivot->amount*$multiplier)
|
||||||
->setStatus(Credit::STATUS_SENT)
|
->setStatus(Credit::STATUS_SENT)
|
||||||
->save();
|
->save();
|
||||||
|
|
||||||
|
$this->payment
|
||||||
|
->client
|
||||||
|
->service()
|
||||||
|
->updatePaidToDate(($paymentable_credit->pivot->amount)*-1)
|
||||||
|
->save();
|
||||||
|
|
||||||
|
//01-03-2022
|
||||||
|
// $paymentable_credit->service()
|
||||||
|
// ->updateBalance($paymentable_credit->pivot->amount*$multiplier)
|
||||||
|
// ->updatePaidToDate($paymentable_credit->pivot->amount*-1)
|
||||||
|
// ->setStatus(Credit::STATUS_SENT)
|
||||||
|
// ->save();
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user