close #664 Fixed: Not listing invoice/bill add payment if empty account's currency
This commit is contained in:
parent
5511ab9a48
commit
bc8a1305a5
@ -39,9 +39,7 @@ class BillPayments extends Controller
|
||||
|
||||
$currencies = Currency::enabled()->orderBy('name')->pluck('name', 'code')->toArray();
|
||||
|
||||
$account_currency_code = Account::where('id', setting('general.default_account'))->pluck('currency_code')->first();
|
||||
|
||||
$currency = Currency::where('code', $account_currency_code)->first();
|
||||
$currency = Currency::where('code', $bill->currency_code)->first();
|
||||
|
||||
$payment_methods = Modules::getPaymentMethods();
|
||||
|
||||
@ -60,7 +58,7 @@ class BillPayments extends Controller
|
||||
$bill->grand_total = $bill->total - $paid;
|
||||
}
|
||||
|
||||
$html = view('modals.bills.payment', compact('bill', 'accounts', 'account_currency_code', 'currencies', 'currency', 'payment_methods'))->render();
|
||||
$html = view('modals.bills.payment', compact('bill', 'accounts', 'currencies', 'currency', 'payment_methods'))->render();
|
||||
|
||||
return response()->json([
|
||||
'success' => true,
|
||||
|
@ -39,9 +39,7 @@ class InvoicePayments extends Controller
|
||||
|
||||
$currencies = Currency::enabled()->orderBy('name')->pluck('name', 'code')->toArray();
|
||||
|
||||
$account_currency_code = Account::where('id', setting('general.default_account'))->pluck('currency_code')->first();
|
||||
|
||||
$currency = Currency::where('code', $account_currency_code)->first();
|
||||
$currency = Currency::where('code', $invoice->currency_code)->first();
|
||||
|
||||
$payment_methods = Modules::getPaymentMethods();
|
||||
|
||||
@ -60,7 +58,7 @@ class InvoicePayments extends Controller
|
||||
$invoice->grand_total = $invoice->total - $paid;
|
||||
}
|
||||
|
||||
$html = view('modals.invoices.payment', compact('invoice', 'accounts', 'account_currency_code', 'currencies', 'currency', 'payment_methods'))->render();
|
||||
$html = view('modals.invoices.payment', compact('invoice', 'accounts', 'currencies', 'currency', 'payment_methods'))->render();
|
||||
|
||||
return response()->json([
|
||||
'success' => true,
|
||||
|
@ -20,8 +20,8 @@
|
||||
{!! Form::label('currency_code', trans_choice('general.currencies', 1), ['class' => 'control-label']) !!}
|
||||
<div class="input-group">
|
||||
<div class="input-group-addon"><i class="fa fa-exchange"></i></div>
|
||||
{!! Form::text('currency', $currencies[$account_currency_code], ['id' => 'currency', 'class' => 'form-control', 'required' => 'required', 'disabled' => 'disabled']) !!}
|
||||
{!! Form::hidden('currency_code', $account_currency_code, ['id' => 'currency_code', 'class' => 'form-control', 'required' => 'required']) !!}
|
||||
{!! Form::text('currency', $currencies[$bill->currency_code], ['id' => 'currency', 'class' => 'form-control', 'required' => 'required', 'disabled' => 'disabled']) !!}
|
||||
{!! Form::hidden('currency_code', $bill->currency_code, ['id' => 'currency_code', 'class' => 'form-control', 'required' => 'required']) !!}
|
||||
</div>
|
||||
</div>
|
||||
@stack('currency_code_input_end')
|
||||
|
@ -20,8 +20,8 @@
|
||||
{!! Form::label('currency_code', trans_choice('general.currencies', 1), ['class' => 'control-label']) !!}
|
||||
<div class="input-group">
|
||||
<div class="input-group-addon"><i class="fa fa-exchange"></i></div>
|
||||
{!! Form::text('currency', $currencies[$account_currency_code], ['id' => 'currency', 'class' => 'form-control', 'required' => 'required', 'disabled' => 'disabled']) !!}
|
||||
{!! Form::hidden('currency_code', $account_currency_code, ['id' => 'currency_code', 'class' => 'form-control', 'required' => 'required']) !!}
|
||||
{!! Form::text('currency', $currencies[$invoice->currency_code], ['id' => 'currency', 'class' => 'form-control', 'required' => 'required', 'disabled' => 'disabled']) !!}
|
||||
{!! Form::hidden('currency_code', $invoice->currency_code, ['id' => 'currency_code', 'class' => 'form-control', 'required' => 'required']) !!}
|
||||
</div>
|
||||
</div>
|
||||
@stack('currency_code_input_end')
|
||||
|
Loading…
x
Reference in New Issue
Block a user