mirror of
https://github.com/invoiceninja/invoiceninja.git
synced 2025-05-24 02:14:21 -04:00
Fixes for expense currency not setting default
This commit is contained in:
parent
2c4aaa2131
commit
8b808c97fa
@ -58,8 +58,8 @@ class StoreExpenseRequest extends Request
|
||||
$input['category_id'] = $this->decodePrimaryKey($input['category_id']);
|
||||
}
|
||||
|
||||
if (! array_key_exists('currency_id', $input)) {
|
||||
$input['currency_id'] = auth()->user()->company()->settings->currency_id;
|
||||
if (! array_key_exists('currency_id', $input) || strlen($input['currency_id']) == 0) {
|
||||
$input['currency_id'] = (string)auth()->user()->company()->settings->currency_id;
|
||||
}
|
||||
|
||||
$this->replace($input);
|
||||
|
@ -33,6 +33,7 @@ class ExpenseRepository extends BaseRepository
|
||||
*/
|
||||
public function save(array $data, Expense $expense) : ?Expense
|
||||
{
|
||||
|
||||
$expense->fill($data);
|
||||
$expense->number = empty($expense->number) ? $this->getNextExpenseNumber($expense) : $expense->number;
|
||||
$expense->save();
|
||||
|
@ -59,7 +59,7 @@ class ExpenseTransformer extends EntityTransformer
|
||||
'bank_id' => (string) $expense->bank_id ?: '',
|
||||
'invoice_currency_id' => (string) $expense->invoice_currency_id ?: '',
|
||||
'expense_currency_id' => '', //todo remove redundant in 5.0.25
|
||||
'currency_id' => (string) $expense->expense_currency_id ?: '',
|
||||
'currency_id' => (string) $expense->currency_id ?: '',
|
||||
'category_id' => $this->encodePrimaryKey($expense->category_id),
|
||||
'payment_type_id' => (string) $expense->payment_type_id ?: '',
|
||||
'recurring_expense_id' => (string) $expense->recurring_expense_id ?: '',
|
||||
|
Loading…
x
Reference in New Issue
Block a user