mirror of
https://github.com/invoiceninja/invoiceninja.git
synced 2025-05-31 16:34:35 -04:00
Fixes for credit creation after downgrading a subscription service
This commit is contained in:
parent
490c026a08
commit
5d459aaa2f
@ -83,9 +83,8 @@ class PaymentRepository extends BaseRepository {
|
|||||||
if ($data['amount'] == '') {
|
if ($data['amount'] == '') {
|
||||||
$data['amount'] = array_sum(array_column($data['invoices'], 'amount'));
|
$data['amount'] = array_sum(array_column($data['invoices'], 'amount'));
|
||||||
}
|
}
|
||||||
|
|
||||||
$client->service()->updatePaidToDate($data['amount'])->save();
|
$client->service()->updatePaidToDate($data['amount'])->save();
|
||||||
// $client->paid_to_date += $data['amount'];
|
|
||||||
$client->save();
|
$client->save();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -105,8 +105,8 @@ class ApplyPayment
|
|||||||
|
|
||||||
private function addPaymentToLedger()
|
private function addPaymentToLedger()
|
||||||
{
|
{
|
||||||
$this->payment->amount += $this->amount_applied;
|
// $this->payment->amount += $this->amount_applied;
|
||||||
$this->payment->applied += $this->amount_applied;
|
// $this->payment->applied += $this->amount_applied;
|
||||||
$this->payment->status_id = Payment::STATUS_COMPLETED;
|
$this->payment->status_id = Payment::STATUS_COMPLETED;
|
||||||
$this->payment->currency_id = $this->credit->client->getSetting('currency_id');
|
$this->payment->currency_id = $this->credit->client->getSetting('currency_id');
|
||||||
$this->payment->save();
|
$this->payment->save();
|
||||||
|
@ -416,7 +416,7 @@ else
|
|||||||
foreach($invoice->line_items as $item)
|
foreach($invoice->line_items as $item)
|
||||||
{
|
{
|
||||||
|
|
||||||
if($item->product_key != ctrans('texts.refund'))
|
if($item->product_key != ctrans('texts.refund') && ($item->type_id == "1" || $item->type_id == "2"))
|
||||||
{
|
{
|
||||||
|
|
||||||
$item->cost = ($item->cost*$ratio*$multiplier);
|
$item->cost = ($item->cost*$ratio*$multiplier);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user