1
0
mirror of https://github.com/invoiceninja/invoiceninja.git synced 2024-11-10 21:22:58 +01:00

Always ensure the client has a currency set

This commit is contained in:
David Bomba 2021-01-06 19:50:13 +11:00
parent 47f42b804d
commit 65afd70b38
3 changed files with 7 additions and 2 deletions

View File

@ -108,7 +108,7 @@ class PaymentController extends Controller
$settings = auth()->user()->client->getMergedSettings();
//nlog($settings);
nlog($settings);
/* This loop checks for under / over payments and returns the user if a check fails */

View File

@ -90,6 +90,11 @@ class UpdateClientRequest extends Request
$input['group_settings_id'] = $this->decodePrimaryKey($input['group_settings_id']);
}
/* If the user removes the currency we must always set the default */
if (array_key_exists('settings', $input) && ! array_key_exists('currency_id', $input['settings'])) {
$input['settings']['currency_id'] = (string) auth()->user()->company()->settings->currency_id;
}
$input = $this->decodePrimaryKeys($input);
if (array_key_exists('settings', $input)) {

View File

@ -57,7 +57,7 @@ class UpdateCompanyRequest extends Request
protected function prepareForValidation()
{
$input = $this->all();
// nlog($input);
if (array_key_exists('settings', $input)) {
$input['settings'] = $this->filterSaveableSettings($input['settings']);
}