This commit is contained in:
James Cole
2025-02-21 06:18:11 +01:00
parent 54990308f6
commit 9921c5a925
4 changed files with 19 additions and 15 deletions

View File

@@ -90,6 +90,7 @@ class StoreController extends Controller
$data['user'] = auth()->user(); $data['user'] = auth()->user();
$data['user_group'] = $this->userGroup; $data['user_group'] = $this->userGroup;
Log::channel('audit')->info('Store new transaction over API.', $data); Log::channel('audit')->info('Store new transaction over API.', $data);
try { try {

View File

@@ -73,6 +73,7 @@ class StoreController extends Controller
$userGroup = $request->getUserGroup(); $userGroup = $request->getUserGroup();
$data['user_group'] = $userGroup; $data['user_group'] = $userGroup;
// overrule user group and see where we end up. // overrule user group and see where we end up.
// what happens when we refer to a budget that is not in this user group? // what happens when we refer to a budget that is not in this user group?

View File

@@ -238,7 +238,8 @@ class UpgradesToGroups extends Command
return [ return [
'type' => strtolower($journal->transactionType->type), 'type' => strtolower($journal->transactionType->type),
'date' => $journal->date, 'date' => $journal->date,
'user' => $journal->user_id, 'user' => $journal->user,
'user_group' => $journal->user->userGroup,
'currency_id' => $transaction->transaction_currency_id, 'currency_id' => $transaction->transaction_currency_id,
'foreign_currency_id' => $transaction->foreign_currency_id, 'foreign_currency_id' => $transaction->foreign_currency_id,
'amount' => $transaction->amount, 'amount' => $transaction->amount,

View File

@@ -87,10 +87,10 @@ class ReconcileController extends Controller
return redirect(route('accounts.index', [config(sprintf('firefly.shortNamesByFullName.%s', $account->accountType->type))])); return redirect(route('accounts.index', [config(sprintf('firefly.shortNamesByFullName.%s', $account->accountType->type))]));
} }
$currency = $this->accountRepos->getAccountCurrency($account) ?? $this->defaultCurrency; $currency = $this->accountRepos->getAccountCurrency($account) ?? $this->defaultCurrency;
// no start or end: // no start or end:
$range = app('navigation')->getViewRange(false); $range = app('navigation')->getViewRange(false);
// get start and end // get start and end
@@ -99,7 +99,7 @@ class ReconcileController extends Controller
$start = clone session('start', app('navigation')->startOfPeriod(new Carbon(), $range)); $start = clone session('start', app('navigation')->startOfPeriod(new Carbon(), $range));
/** @var Carbon $end */ /** @var Carbon $end */
$end = clone session('end', app('navigation')->endOfPeriod(new Carbon(), $range)); $end = clone session('end', app('navigation')->endOfPeriod(new Carbon(), $range));
} }
if (null === $end) { if (null === $end) {
/** @var Carbon $end */ /** @var Carbon $end */
@@ -113,15 +113,15 @@ class ReconcileController extends Controller
$start->startOfDay(); $start->startOfDay();
$end->endOfDay(); $end->endOfDay();
$startDate = clone $start; $startDate = clone $start;
$startDate->subDay()->endOfDay(); // this is correct, subday endofday ends at 23:59:59 $startDate->subDay()->endOfDay(); // this is correct, subday endofday ends at 23:59:59
// both are validated and are correct. // both are validated and are correct.
Log::debug(sprintf('reconcile: Call finalAccountBalance with date/time "%s"', $startDate->toIso8601String())); Log::debug(sprintf('reconcile: Call finalAccountBalance with date/time "%s"', $startDate->toIso8601String()));
Log::debug(sprintf('reconcile2: Call finalAccountBalance with date/time "%s"', $end->toIso8601String())); Log::debug(sprintf('reconcile2: Call finalAccountBalance with date/time "%s"', $end->toIso8601String()));
$startBalance = Steam::bcround(Steam::finalAccountBalance($account, $startDate)['balance'], $currency->decimal_places); $startBalance = Steam::bcround(Steam::finalAccountBalance($account, $startDate)['balance'], $currency->decimal_places);
$endBalance = Steam::bcround(Steam::finalAccountBalance($account, $end)['balance'], $currency->decimal_places); $endBalance = Steam::bcround(Steam::finalAccountBalance($account, $end)['balance'], $currency->decimal_places);
$subTitleIcon = config(sprintf('firefly.subIconsByIdentifier.%s', $account->accountType->type)); $subTitleIcon = config(sprintf('firefly.subIconsByIdentifier.%s', $account->accountType->type));
$subTitle = (string) trans('firefly.reconcile_account', ['account' => $account->name]); $subTitle = (string) trans('firefly.reconcile_account', ['account' => $account->name]);
// various links // various links
$transactionsUrl = route('accounts.reconcile.transactions', [$account->id, '%start%', '%end%']); $transactionsUrl = route('accounts.reconcile.transactions', [$account->id, '%start%', '%end%']);
@@ -162,7 +162,7 @@ class ReconcileController extends Controller
} }
app('log')->debug('In ReconcileController::submit()'); app('log')->debug('In ReconcileController::submit()');
$data = $request->getAll(); $data = $request->getAll();
/** @var string $journalId */ /** @var string $journalId */
foreach ($data['journals'] as $journalId) { foreach ($data['journals'] as $journalId) {
@@ -217,19 +217,20 @@ class ReconcileController extends Controller
} }
// title: // title:
$description = trans( $description = trans(
'firefly.reconciliation_transaction_title', 'firefly.reconciliation_transaction_title',
[ [
'from' => $start->isoFormat($this->monthAndDayFormat), 'from' => $start->isoFormat($this->monthAndDayFormat),
'to' => $end->isoFormat($this->monthAndDayFormat), 'to' => $end->isoFormat($this->monthAndDayFormat),
] ]
); );
$submission = [ $submission = [
'user' => auth()->user()->id, 'user' => auth()->user()->id,
'group_title' => null, 'group_title' => null,
'transactions' => [ 'transactions' => [
[ [
'user' => auth()->user()->id, 'user' => auth()->user(),
'user_group' => auth()->user()->userGroup,
'type' => strtolower(TransactionTypeEnum::RECONCILIATION->value), 'type' => strtolower(TransactionTypeEnum::RECONCILIATION->value),
'date' => $end, 'date' => $end,
'order' => 0, 'order' => 0,
@@ -246,10 +247,10 @@ class ReconcileController extends Controller
]; ];
/** @var TransactionGroupFactory $factory */ /** @var TransactionGroupFactory $factory */
$factory = app(TransactionGroupFactory::class); $factory = app(TransactionGroupFactory::class);
/** @var User $user */ /** @var User $user */
$user = auth()->user(); $user = auth()->user();
$factory->setUser($user); $factory->setUser($user);
try { try {