mirror of
https://github.com/invoiceninja/invoiceninja.git
synced 2025-07-08 13:54:30 -04:00
Support editing credit balance
This commit is contained in:
parent
a6eb37151e
commit
0a2f2593f8
@ -96,18 +96,19 @@ class CreditRepository extends BaseRepository
|
||||
$publicId = isset($data['public_id']) ? $data['public_id'] : false;
|
||||
|
||||
if ($credit) {
|
||||
// do nothing
|
||||
$credit->balance = Utils::parseFloat($input['balance']);
|
||||
} elseif ($publicId) {
|
||||
$credit = Credit::scope($publicId)->firstOrFail();
|
||||
$credit->balance = Utils::parseFloat($input['balance']);
|
||||
\Log::warning('Entity not set in credit repo save');
|
||||
} else {
|
||||
$credit = Credit::createNew();
|
||||
$credit->balance = Utils::parseFloat($input['amount']);
|
||||
$credit->client_id = Client::getPrivateId($input['client']);
|
||||
}
|
||||
|
||||
$credit->credit_date = Utils::toSqlDate($input['credit_date']);
|
||||
$credit->amount = Utils::parseFloat($input['amount']);
|
||||
$credit->balance = Utils::parseFloat($input['amount']);
|
||||
$credit->private_notes = trim($input['private_notes']);
|
||||
$credit->save();
|
||||
|
||||
|
@ -28,6 +28,11 @@
|
||||
@endif
|
||||
|
||||
{!! Former::text('amount') !!}
|
||||
|
||||
@if ($credit)
|
||||
{!! Former::text('balance') !!}
|
||||
@endif
|
||||
|
||||
{!! Former::text('credit_date')
|
||||
->data_date_format(Session::get(SESSION_DATE_PICKER_FORMAT, DEFAULT_DATE_PICKER_FORMAT))
|
||||
->addGroupClass('credit_date')
|
||||
|
Loading…
x
Reference in New Issue
Block a user