Minor fixes for currency in expenses

This commit is contained in:
David Bomba 2020-12-14 22:18:54 +11:00
parent 98130f2105
commit 141f45f402
3 changed files with 42 additions and 35 deletions

View File

@ -14,6 +14,7 @@ namespace App\Http\Controllers;
use App\Http\Controllers\Controller;
use App\Http\Requests\Import\PreImportRequest;
use App\Import\Definitions\Import\ImportMap;
use App\Import\Definitions\InvoiceMap;
use Illuminate\Http\Request;
use Illuminate\Support\Facades\Cache;
use Illuminate\Support\Str;

View File

@ -66,6 +66,10 @@ class UpdateExpenseRequest extends Request
$input['category_id'] = $this->decodePrimaryKey($input['category_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);
}
}

View File

@ -17,41 +17,43 @@ class InvoiceMap
public static function importable()
{
return [
0 => 'number',
1 => 'user_id',
2 => 'amount',
3 => 'balance',
4 => 'client_id',
5 => 'status_id',
6 => 'is_deleted',
7 => 'discount',
8 => 'po_number',
9 => 'date',
10 => 'due_date',
11 => 'terms',
12 => 'public_notes',
13 => 'private_notes',
14 => 'uses_inclusive_taxes',
15 => 'tax_name1',
16 => 'tax_rate1',
17 => 'tax_name2',
18 => 'tax_rate2',
19 => 'tax_name3',
20 => 'tax_rate3',
21 => 'is_amount_discount',
22 => 'footer',
23 => 'partial',
24 => 'partial_due_date',
25 => 'custom_value1',
26 => 'custom_value2',
27 => 'custom_value3',
28 => 'custom_value4',
29 => 'custom_surcharge1',
30 => 'custom_surcharge2',
31 => 'custom_surcharge3',
32 => 'custom_surcharge4',
33 => 'exchange_rate',
34 => 'line_items',
0 => 'invoice.number',
1 => 'invoice.user_id',
2 => 'invoice.amount',
3 => 'invoice.balance',
4 => 'invoice.client_id',
5 => 'invoice.status_id',
6 => 'invoice.is_deleted',
7 => 'invoice.discount',
8 => 'invoice.po_number',
9 => 'invoice.date',
10 => 'invoice.due_date',
11 => 'invoice.terms',
12 => 'invoice.public_notes',
13 => 'invoice.private_notes',
14 => 'invoice.uses_inclusive_taxes',
15 => 'invoice.tax_name1',
16 => 'invoice.tax_rate1',
17 => 'invoice.tax_name2',
18 => 'invoice.tax_rate2',
19 => 'invoice.tax_name3',
20 => 'invoice.tax_rate3',
21 => 'invoice.is_amount_discount',
22 => 'invoice.footer',
23 => 'invoice.partial',
24 => 'invoice.partial_due_date',
25 => 'invoice.custom_value1',
26 => 'invoice.custom_value2',
27 => 'invoice.custom_value3',
28 => 'invoice.custom_value4',
29 => 'invoice.custom_surcharge1',
30 => 'invoice.custom_surcharge2',
31 => 'invoice.custom_surcharge3',
32 => 'invoice.custom_surcharge4',
33 => 'invoice.exchange_rate',
34 => 'invoice.line_items',
35 => 'client.name',
36 => 'client.email',
];
}