1
0
mirror of https://github.com/invoiceninja/invoiceninja.git synced 2024-09-20 16:31:33 +02:00

Fix for whitelabel getter

This commit is contained in:
David Bomba 2020-10-20 13:23:48 +11:00
parent c1e080acd5
commit 90494547c5
4 changed files with 15 additions and 5 deletions

View File

@ -93,7 +93,7 @@ class UserEmailChanged extends BaseMailerJob implements ShouldQueue
'signature' => $this->company->owner()->signature,
'logo' => $this->company->present()->logo(),
'settings' => $this->settings,
'whitelabel' => $this->client->user->account->isPaid() ? true : false,
'whitelabel' => $this->company->account->isPaid() ? true : false,
];
}
}

View File

@ -524,7 +524,7 @@ class Client extends BaseModel implements HasLocalePreference
}
}
if($this->company->use_credits_payment == 'option' && $this->service()->getCreditBalance() > 0) {
if(($this->company->use_credits_payment == 'option' || $this->company->use_credits_payment == 'always') && $this->service()->getCreditBalance() > 0) {
$payment_urls[] = [
'label' => ctrans('texts.apply_credit'),
'company_gateway_id' => CompanyGateway::GATEWAY_CREDIT,

View File

@ -74,8 +74,15 @@ class ApplyPayment
}
$this->applyPaymentToCredit();
$this->credit->balance -= $this->amount_applied;
if((int)$this->credit->balance == 0)
$this->credit->status_id = Credit::STATUS_APPLIED;
else
$this->credit->status_id = Credit::STATUS_PARTIAL;
$this->credit->save();
$this->addPaymentToLedger();
return $this->credit;

View File

@ -126,7 +126,10 @@ class AutoBillInvoice extends AbstractService
{
$current_credit = Credit::find($credit['credit_id']);
$payment->credits()->attach($current_credit->id, ['amount' => $credit['amount']]);
$this->applyPaymentToCredit($current_credit, $credit['amount']);
$current_credit->balance -= $credit['amount'];
$current_credit->save();
// $this->applyPaymentToCredit($current_credit, $credit['amount']);
}
$payment->ledger()