mirror of
https://github.com/crater-invoice/crater.git
synced 2025-10-28 04:01:10 -04:00
Fix tax per item issue & check currency key
This commit is contained in:
@ -23,11 +23,13 @@ class UpdateCompanySettingsController extends Controller
|
||||
$companyCurrency = CompanySetting::getSetting('currency', $request->header('company'));
|
||||
$data = $request->settings;
|
||||
|
||||
if ($companyCurrency !== $data['currency'] && $company->hasTransactions()) {
|
||||
return response()->json([
|
||||
'success' => false,
|
||||
'message' => 'Cannot update company currency after transactions are created.'
|
||||
]);
|
||||
if (array_key_exists('currency', $data)) {
|
||||
if ($companyCurrency !== $data['currency'] && $company->hasTransactions()) {
|
||||
return response()->json([
|
||||
'success' => false,
|
||||
'message' => 'Cannot update company currency after transactions are created.'
|
||||
]);
|
||||
}
|
||||
}
|
||||
|
||||
CompanySetting::setSettings($data, $request->header('company'));
|
||||
|
||||
Reference in New Issue
Block a user