🤖 Auto commit for release 'develop' on 2026-02-04

This commit is contained in:
JC5
2026-02-04 07:50:20 +01:00
parent 89d96ddc17
commit 3032118788
52 changed files with 629 additions and 581 deletions

View File

@@ -61,7 +61,7 @@ class MassController extends Controller
parent::__construct();
$this->middleware(function ($request, $next) {
app('view')->share('title', (string)trans('firefly.transactions'));
app('view')->share('title', (string) trans('firefly.transactions'));
app('view')->share('mainTitleIcon', 'fa-exchange');
$this->repository = app(JournalRepositoryInterface::class);
@@ -74,7 +74,7 @@ class MassController extends Controller
*/
public function delete(array $journals): IlluminateView
{
$subTitle = (string)trans('firefly.mass_delete_journals');
$subTitle = (string) trans('firefly.mass_delete_journals');
// put previous url in session
$this->rememberPreviousUrl('transactions.mass-delete.url');
@@ -87,7 +87,7 @@ class MassController extends Controller
*
* @return Application|Redirector|RedirectResponse
*/
public function destroy(MassDeleteJournalRequest $request): Redirector | RedirectResponse
public function destroy(MassDeleteJournalRequest $request): Redirector|RedirectResponse
{
Log::debug(sprintf('Now in %s', __METHOD__));
$ids = $request->get('confirm_mass_delete');
@@ -100,8 +100,8 @@ class MassController extends Controller
Log::debug(sprintf('Searching for ID #%d', $journalId));
/** @var null|TransactionJournal $journal */
$journal = $this->repository->find((int)$journalId);
if (null !== $journal && (int)$journalId === $journal->id) {
$journal = $this->repository->find((int) $journalId);
if (null !== $journal && (int) $journalId === $journal->id) {
$this->repository->destroyJournal($journal);
++$count;
Log::debug(sprintf('Deleted transaction journal #%d', $journalId));
@@ -123,22 +123,22 @@ class MassController extends Controller
*/
public function edit(array $journals): IlluminateView
{
$subTitle = (string)trans('firefly.mass_edit_journals');
$subTitle = (string) trans('firefly.mass_edit_journals');
/** @var AccountRepositoryInterface $accountRepository */
$accountRepository = app(AccountRepositoryInterface::class);
$accountRepository = app(AccountRepositoryInterface::class);
// valid withdrawal sources:
$array = array_keys(config(sprintf('firefly.source_dests.%s', TransactionTypeEnum::WITHDRAWAL->value)));
$withdrawalSources = $accountRepository->getAccountsByType($array);
$array = array_keys(config(sprintf('firefly.source_dests.%s', TransactionTypeEnum::WITHDRAWAL->value)));
$withdrawalSources = $accountRepository->getAccountsByType($array);
// valid deposit destinations:
$array = config(sprintf('firefly.source_dests.%s.%s', TransactionTypeEnum::DEPOSIT->value, AccountTypeEnum::REVENUE->value));
$depositDestinations = $accountRepository->getAccountsByType($array);
/** @var BudgetRepositoryInterface $budgetRepository */
$budgetRepository = app(BudgetRepositoryInterface::class);
$budgets = $budgetRepository->getBudgets();
$budgetRepository = app(BudgetRepositoryInterface::class);
$budgets = $budgetRepository->getBudgets();
// reverse amounts
foreach ($journals as $index => $journal) {
@@ -162,18 +162,18 @@ class MassController extends Controller
*
* @throws FireflyException
*/
public function update(MassEditJournalRequest $request): Redirector | RedirectResponse
public function update(MassEditJournalRequest $request): Redirector|RedirectResponse
{
$journalIds = $request->get('journals');
if (!is_array($journalIds)) {
// TODO this is a weird error, should be caught.
throw new FireflyException('This is not an array.');
}
$count = 0;
$count = 0;
/** @var string $journalId */
foreach ($journalIds as $journalId) {
$integer = (int)$journalId;
$integer = (int) $journalId;
try {
$this->updateJournal($integer, $request);
@@ -195,15 +195,15 @@ class MassController extends Controller
*/
private function updateJournal(int $journalId, MassEditJournalRequest $request): void
{
$journal = $this->repository->find($journalId);
$journal = $this->repository->find($journalId);
if (!$journal instanceof TransactionJournal) {
throw new FireflyException(sprintf('Trying to edit non-existent or deleted journal #%d', $journalId));
}
$service = app(JournalUpdateService::class);
$service = app(JournalUpdateService::class);
// for each field, call the update service.
$service->setTransactionJournal($journal);
$data = [
$data = [
'date' => $this->getDateFromRequest($request, $journal->id, 'date'),
'description' => $this->getStringFromRequest($request, $journal->id, 'description'),
'source_id' => $this->getIntFromRequest($request, $journal->id, 'source_id'),
@@ -259,7 +259,7 @@ class MassController extends Controller
return null;
}
return (string)$value[$journalId];
return (string) $value[$journalId];
}
private function getIntFromRequest(MassEditJournalRequest $request, int $journalId, string $string): ?int
@@ -272,6 +272,6 @@ class MassController extends Controller
return null;
}
return (int)$value[$journalId];
return (int) $value[$journalId];
}
}