mirror of
https://github.com/firefly-iii/firefly-iii.git
synced 2025-10-03 03:00:14 +00:00
Code for new release.
This commit is contained in:
@@ -95,7 +95,7 @@ class CreateController extends Controller
|
||||
];
|
||||
|
||||
// interest calculation periods:
|
||||
$interestPeriods = [
|
||||
$interestPeriods = [
|
||||
'daily' => (string) trans('firefly.interest_calc_daily'),
|
||||
'monthly' => (string) trans('firefly.interest_calc_monthly'),
|
||||
'yearly' => (string) trans('firefly.interest_calc_yearly'),
|
||||
@@ -110,12 +110,11 @@ class CreateController extends Controller
|
||||
]
|
||||
);
|
||||
// issue #8321
|
||||
$showNetWorth = true;
|
||||
$showNetWorth = true;
|
||||
if ('liabilities' !== $objectType && 'asset' !== $objectType) {
|
||||
$showNetWorth = false;
|
||||
}
|
||||
|
||||
|
||||
// put previous url in session if not redirect from store (not "create another").
|
||||
if (true !== session('accounts.create.fromStore')) {
|
||||
$this->rememberPreviousUrl('accounts.create.url');
|
||||
@@ -138,8 +137,8 @@ class CreateController extends Controller
|
||||
*/
|
||||
public function store(AccountFormRequest $request)
|
||||
{
|
||||
$data = $request->getAccountData();
|
||||
$account = $this->repository->store($data);
|
||||
$data = $request->getAccountData();
|
||||
$account = $this->repository->store($data);
|
||||
$request->session()->flash('success', (string) trans('firefly.stored_new_account', ['name' => $account->name]));
|
||||
app('preferences')->mark();
|
||||
|
||||
@@ -157,7 +156,7 @@ class CreateController extends Controller
|
||||
|
||||
// store attachment(s):
|
||||
/** @var null|array $files */
|
||||
$files = $request->hasFile('attachments') ? $request->file('attachments') : null;
|
||||
$files = $request->hasFile('attachments') ? $request->file('attachments') : null;
|
||||
if (null !== $files && !auth()->user()->hasRole('demo')) {
|
||||
$this->attachments->saveAttachmentsForModel($account, $files);
|
||||
}
|
||||
@@ -171,7 +170,7 @@ class CreateController extends Controller
|
||||
}
|
||||
|
||||
// redirect to previous URL.
|
||||
$redirect = redirect($this->getPreviousUrl('accounts.create.url'));
|
||||
$redirect = redirect($this->getPreviousUrl('accounts.create.url'));
|
||||
if (1 === (int) $request->get('create_another')) {
|
||||
// set value so create routine will not overwrite URL:
|
||||
$request->session()->put('accounts.create.fromStore', true);
|
||||
|
@@ -80,17 +80,17 @@ class EditController extends Controller
|
||||
return $this->redirectAccountToAccount($account);
|
||||
}
|
||||
|
||||
$objectType = config('firefly.shortNamesByFullName')[$account->accountType->type];
|
||||
$subTitle = (string) trans(sprintf('firefly.edit_%s_account', $objectType), ['name' => $account->name]);
|
||||
$subTitleIcon = config(sprintf('firefly.subIconsByIdentifier.%s', $objectType));
|
||||
$roles = $this->getRoles();
|
||||
$liabilityTypes = $this->getLiabilityTypes();
|
||||
$location = $repository->getLocation($account);
|
||||
$latitude = null !== $location ? $location->latitude : config('firefly.default_location.latitude');
|
||||
$longitude = null !== $location ? $location->longitude : config('firefly.default_location.longitude');
|
||||
$zoomLevel = null !== $location ? $location->zoom_level : config('firefly.default_location.zoom_level');
|
||||
$hasLocation = null !== $location;
|
||||
$locations = [
|
||||
$objectType = config('firefly.shortNamesByFullName')[$account->accountType->type];
|
||||
$subTitle = (string) trans(sprintf('firefly.edit_%s_account', $objectType), ['name' => $account->name]);
|
||||
$subTitleIcon = config(sprintf('firefly.subIconsByIdentifier.%s', $objectType));
|
||||
$roles = $this->getRoles();
|
||||
$liabilityTypes = $this->getLiabilityTypes();
|
||||
$location = $repository->getLocation($account);
|
||||
$latitude = null !== $location ? $location->latitude : config('firefly.default_location.latitude');
|
||||
$longitude = null !== $location ? $location->longitude : config('firefly.default_location.longitude');
|
||||
$zoomLevel = null !== $location ? $location->zoom_level : config('firefly.default_location.zoom_level');
|
||||
$hasLocation = null !== $location;
|
||||
$locations = [
|
||||
'location' => [
|
||||
'latitude' => null !== old('location_latitude') ? old('location_latitude') : $latitude,
|
||||
'longitude' => null !== old('location_longitude') ? old('location_longitude') : $longitude,
|
||||
@@ -99,13 +99,13 @@ class EditController extends Controller
|
||||
],
|
||||
];
|
||||
|
||||
$liabilityDirections = [
|
||||
$liabilityDirections = [
|
||||
'debit' => trans('firefly.liability_direction_debit'),
|
||||
'credit' => trans('firefly.liability_direction_credit'),
|
||||
];
|
||||
|
||||
// interest calculation periods:
|
||||
$interestPeriods = [
|
||||
$interestPeriods = [
|
||||
'daily' => (string) trans('firefly.interest_calc_daily'),
|
||||
'monthly' => (string) trans('firefly.interest_calc_monthly'),
|
||||
'yearly' => (string) trans('firefly.interest_calc_yearly'),
|
||||
@@ -121,23 +121,23 @@ class EditController extends Controller
|
||||
if ('0' === $openingBalanceAmount) {
|
||||
$openingBalanceAmount = '';
|
||||
}
|
||||
$openingBalanceDate = $repository->getOpeningBalanceDate($account);
|
||||
$currency = $this->repository->getAccountCurrency($account) ?? app('amount')->getDefaultCurrency();
|
||||
$openingBalanceDate = $repository->getOpeningBalanceDate($account);
|
||||
$currency = $this->repository->getAccountCurrency($account) ?? app('amount')->getDefaultCurrency();
|
||||
|
||||
// include this account in net-worth charts?
|
||||
$includeNetWorth = $repository->getMetaValue($account, 'include_net_worth');
|
||||
$includeNetWorth = null === $includeNetWorth ? true : '1' === $includeNetWorth;
|
||||
$includeNetWorth = $repository->getMetaValue($account, 'include_net_worth');
|
||||
$includeNetWorth = null === $includeNetWorth ? true : '1' === $includeNetWorth;
|
||||
|
||||
// issue #8321
|
||||
$showNetWorth = true;
|
||||
$showNetWorth = true;
|
||||
if ('liabilities' !== $objectType && 'asset' !== $objectType) {
|
||||
$showNetWorth = false;
|
||||
}
|
||||
|
||||
// code to handle active-checkboxes
|
||||
$hasOldInput = null !== $request->old('_token');
|
||||
$virtualBalance = null === $account->virtual_balance ? '0' : $account->virtual_balance;
|
||||
$preFilled = [
|
||||
$hasOldInput = null !== $request->old('_token');
|
||||
$virtualBalance = null === $account->virtual_balance ? '0' : $account->virtual_balance;
|
||||
$preFilled = [
|
||||
'account_number' => $repository->getMetaValue($account, 'account_number'),
|
||||
'account_role' => $repository->getMetaValue($account, 'account_role'),
|
||||
'cc_type' => $repository->getMetaValue($account, 'cc_type'),
|
||||
@@ -175,14 +175,14 @@ class EditController extends Controller
|
||||
return $this->redirectAccountToAccount($account);
|
||||
}
|
||||
|
||||
$data = $request->getAccountData();
|
||||
$data = $request->getAccountData();
|
||||
$this->repository->update($account, $data);
|
||||
Log::channel('audit')->info(sprintf('Updated account #%d.', $account->id), $data);
|
||||
$request->session()->flash('success', (string) trans('firefly.updated_account', ['name' => $account->name]));
|
||||
|
||||
// store new attachment(s):
|
||||
/** @var null|array $files */
|
||||
$files = $request->hasFile('attachments') ? $request->file('attachments') : null;
|
||||
$files = $request->hasFile('attachments') ? $request->file('attachments') : null;
|
||||
if (null !== $files && !auth()->user()->hasRole('demo')) {
|
||||
$this->attachments->saveAttachmentsForModel($account, $files);
|
||||
}
|
||||
|
Reference in New Issue
Block a user