mirror of
https://github.com/firefly-iii/firefly-iii.git
synced 2026-07-23 16:04:46 -07:00
🤖 Auto commit for release 'develop' on 2026-03-09
This commit is contained in:
@@ -25,7 +25,6 @@ declare(strict_types=1);
|
||||
namespace FireflyIII\Api\V1\Controllers\Models\BudgetLimit;
|
||||
|
||||
use FireflyIII\Api\V1\Controllers\Controller;
|
||||
use FireflyIII\Api\V1\Requests\Data\SameDateRequest;
|
||||
use FireflyIII\Api\V1\Requests\DateRangeRequest;
|
||||
use FireflyIII\Exceptions\FireflyException;
|
||||
use FireflyIII\Models\Budget;
|
||||
@@ -124,9 +123,7 @@ final class ShowController extends Controller
|
||||
$manager = $this->getManager();
|
||||
$manager->parseIncludes('budget');
|
||||
$pageSize = $this->parameters->get('limit');
|
||||
$collection = $this->blRepository->getAllBudgetLimits(
|
||||
$request->attributes->get('start'),
|
||||
$request->attributes->get('end'));
|
||||
$collection = $this->blRepository->getAllBudgetLimits($request->attributes->get('start'), $request->attributes->get('end'));
|
||||
$count = $collection->count();
|
||||
$budgetLimits = $collection->slice(($this->parameters->get('page') - 1) * $pageSize, $pageSize);
|
||||
$paginator = new LengthAwarePaginator($budgetLimits, $count, $pageSize, $this->parameters->get('page'));
|
||||
|
||||
@@ -26,7 +26,6 @@ namespace FireflyIII\Api\V1\Controllers\Models\Recurrence;
|
||||
|
||||
use FireflyIII\Api\V1\Controllers\Controller;
|
||||
use FireflyIII\Api\V1\Requests\DateRequest;
|
||||
use FireflyIII\Api\V1\Requests\Generic\SingleDateRequest;
|
||||
use FireflyIII\Helpers\Collector\GroupCollectorInterface;
|
||||
use FireflyIII\Jobs\CreateRecurringTransactions;
|
||||
use FireflyIII\Models\Recurrence;
|
||||
|
||||
@@ -231,9 +231,10 @@ class CorrectsAccountTypes extends Command
|
||||
{
|
||||
/** @var null|Transaction $res */
|
||||
$res = $journal->transactions->firstWhere('amount', '>', 0);
|
||||
if(null === $res) {
|
||||
if (null === $res) {
|
||||
throw new FireflyException('Could not find transaction.');
|
||||
}
|
||||
|
||||
return $res;
|
||||
}
|
||||
|
||||
@@ -241,9 +242,10 @@ class CorrectsAccountTypes extends Command
|
||||
{
|
||||
/** @var null|Transaction $res */
|
||||
$res = $journal->transactions->firstWhere('amount', '<', 0);
|
||||
if(null === $res) {
|
||||
if (null === $res) {
|
||||
throw new FireflyException('Could not find transaction.');
|
||||
}
|
||||
|
||||
return $res;
|
||||
}
|
||||
|
||||
|
||||
@@ -93,7 +93,8 @@ class UpgradesToGroups extends Command
|
||||
|
||||
return $amount && $identifier;
|
||||
});
|
||||
/** @var Transaction|null */
|
||||
|
||||
/** @var null|Transaction */
|
||||
return $set->first();
|
||||
}
|
||||
|
||||
|
||||
@@ -34,7 +34,6 @@ use FireflyIII\Repositories\User\UserRepositoryInterface;
|
||||
use FireflyIII\Support\Facades\FireflyConfig;
|
||||
use FireflyIII\Support\Facades\Preferences;
|
||||
use FireflyIII\User;
|
||||
use Illuminate\Contracts\Foundation\Application;
|
||||
use Illuminate\Contracts\View\Factory;
|
||||
use Illuminate\Http\JsonResponse;
|
||||
use Illuminate\Http\RedirectResponse;
|
||||
|
||||
@@ -27,7 +27,6 @@ use Carbon\Carbon;
|
||||
use FireflyIII\Events\Security\System\UnknownUserTriedLogin;
|
||||
use FireflyIII\Events\Security\User\UserFailedLoginAttempt;
|
||||
use FireflyIII\Events\Security\User\UserSuccessfullyLoggedIn;
|
||||
use FireflyIII\Exceptions\FireflyException;
|
||||
use FireflyIII\Http\Controllers\Controller;
|
||||
use FireflyIII\Providers\RouteServiceProvider;
|
||||
use FireflyIII\Repositories\User\UserRepositoryInterface;
|
||||
@@ -48,8 +47,6 @@ use Illuminate\Support\Facades\Cookie;
|
||||
use Illuminate\Support\Facades\DB;
|
||||
use Illuminate\Support\Facades\Log;
|
||||
use Illuminate\Validation\ValidationException;
|
||||
use Psr\Container\ContainerExceptionInterface;
|
||||
use Psr\Container\NotFoundExceptionInterface;
|
||||
use Symfony\Component\HttpFoundation\Response as ResponseAlias;
|
||||
|
||||
/**
|
||||
|
||||
@@ -38,7 +38,6 @@ use Illuminate\Http\RedirectResponse;
|
||||
use Illuminate\Http\Request;
|
||||
use Illuminate\Routing\Redirector;
|
||||
use Illuminate\Support\Facades\Log;
|
||||
use Illuminate\Validation\ValidationException;
|
||||
use Illuminate\View\View;
|
||||
use Psr\Container\ContainerExceptionInterface;
|
||||
use Psr\Container\NotFoundExceptionInterface;
|
||||
|
||||
@@ -29,7 +29,6 @@ use FireflyIII\Http\Requests\ObjectGroupFormRequest;
|
||||
use FireflyIII\Models\ObjectGroup;
|
||||
use FireflyIII\Repositories\ObjectGroup\ObjectGroupRepositoryInterface;
|
||||
use FireflyIII\Support\Facades\Preferences;
|
||||
use Illuminate\Contracts\Foundation\Application;
|
||||
use Illuminate\Contracts\View\Factory;
|
||||
use Illuminate\Contracts\View\View;
|
||||
use Illuminate\Http\RedirectResponse;
|
||||
@@ -77,7 +76,6 @@ final class EditController extends Controller
|
||||
|
||||
/**
|
||||
* Update a piggy bank.
|
||||
*
|
||||
*/
|
||||
public function update(ObjectGroupFormRequest $request, ObjectGroup $objectGroup): Redirector|RedirectResponse
|
||||
{
|
||||
|
||||
@@ -38,7 +38,6 @@ use FireflyIII\Support\Http\Controllers\CreateStuff;
|
||||
use FireflyIII\User;
|
||||
use Illuminate\Auth\AuthenticationException;
|
||||
use Illuminate\Contracts\Auth\Guard;
|
||||
use Illuminate\Contracts\Foundation\Application;
|
||||
use Illuminate\Contracts\View\Factory;
|
||||
use Illuminate\Http\RedirectResponse;
|
||||
use Illuminate\Http\Request;
|
||||
@@ -342,7 +341,6 @@ final class ProfileController extends Controller
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @throws AuthenticationException
|
||||
*/
|
||||
public function postLogoutOtherSessions(Request $request): Redirector|RedirectResponse
|
||||
|
||||
@@ -24,7 +24,6 @@ declare(strict_types=1);
|
||||
|
||||
namespace FireflyIII\Http\Controllers\System;
|
||||
|
||||
use Illuminate\Contracts\Foundation\Application;
|
||||
use Illuminate\Contracts\Routing\ResponseFactory;
|
||||
use Illuminate\Http\Response;
|
||||
use Illuminate\Support\Facades\Log;
|
||||
|
||||
@@ -34,7 +34,6 @@ use FireflyIII\Models\TransactionJournal;
|
||||
use FireflyIII\Repositories\Budget\BudgetRepositoryInterface;
|
||||
use FireflyIII\Repositories\Journal\JournalRepositoryInterface;
|
||||
use FireflyIII\Support\Facades\Preferences;
|
||||
use Illuminate\Contracts\Foundation\Application;
|
||||
use Illuminate\Contracts\View\Factory;
|
||||
use Illuminate\Http\RedirectResponse;
|
||||
use Illuminate\Routing\Redirector;
|
||||
|
||||
@@ -42,7 +42,6 @@ use FireflyIII\Repositories\Journal\JournalRepositoryInterface;
|
||||
use FireflyIII\Services\Internal\Update\JournalUpdateService;
|
||||
use FireflyIII\Support\Facades\Preferences;
|
||||
use FireflyIII\Support\Facades\Steam;
|
||||
use Illuminate\Contracts\Foundation\Application;
|
||||
use Illuminate\Http\RedirectResponse;
|
||||
use Illuminate\Routing\Redirector;
|
||||
use Illuminate\Support\Facades\Log;
|
||||
@@ -64,7 +63,7 @@ final 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);
|
||||
|
||||
@@ -77,7 +76,7 @@ final 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');
|
||||
@@ -85,15 +84,14 @@ final class MassController extends Controller
|
||||
return view('transactions.mass.delete', ['journals' => $journals, 'subTitle' => $subTitle]);
|
||||
}
|
||||
|
||||
public function destroy(MassDeleteJournalRequest $request): Redirector | RedirectResponse
|
||||
public function destroy(MassDeleteJournalRequest $request): Redirector|RedirectResponse
|
||||
{
|
||||
Log::debug(sprintf('Now in %s', __METHOD__));
|
||||
$ids = $request->input('confirm_mass_delete');
|
||||
$count = 0;
|
||||
$ids = $request->input('confirm_mass_delete');
|
||||
$count = 0;
|
||||
|
||||
$objects = new TransactionGroupEventObjects();
|
||||
|
||||
|
||||
if (is_array($ids)) {
|
||||
Log::debug('Array of IDs', $ids);
|
||||
|
||||
@@ -102,8 +100,8 @@ final 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) {
|
||||
$objects->appendFromTransactionGroup($journal->transactionGroup);
|
||||
$this->repository->destroyJournal($journal);
|
||||
|
||||
@@ -119,7 +117,7 @@ final class MassController extends Controller
|
||||
session()->flash('success', trans_choice('firefly.mass_deleted_transactions_success', $count));
|
||||
|
||||
// trigger just after destruction
|
||||
$flags = new TransactionGroupEventFlags();
|
||||
$flags = new TransactionGroupEventFlags();
|
||||
event(new DestroyedSingleTransactionGroup($flags, $objects));
|
||||
event(new WebhookMessagesRequestSending());
|
||||
|
||||
@@ -132,22 +130,22 @@ final 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) {
|
||||
@@ -171,18 +169,18 @@ final 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);
|
||||
@@ -231,7 +229,7 @@ final class MassController extends Controller
|
||||
return null;
|
||||
}
|
||||
|
||||
return (int)$value[$journalId];
|
||||
return (int) $value[$journalId];
|
||||
}
|
||||
|
||||
private function getStringFromRequest(MassEditJournalRequest $request, int $journalId, string $string): ?string
|
||||
@@ -244,7 +242,7 @@ final class MassController extends Controller
|
||||
return null;
|
||||
}
|
||||
|
||||
return (string)$value[$journalId];
|
||||
return (string) $value[$journalId];
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -260,7 +258,7 @@ final class MassController extends Controller
|
||||
// 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'),
|
||||
|
||||
@@ -27,7 +27,6 @@ namespace FireflyIII\Http\Controllers\Webhooks;
|
||||
use FireflyIII\Http\Controllers\Controller;
|
||||
use FireflyIII\Models\Webhook;
|
||||
use FireflyIII\Support\Facades\FireflyConfig;
|
||||
use Illuminate\Contracts\Foundation\Application;
|
||||
use Illuminate\Contracts\View\Factory;
|
||||
use Illuminate\Contracts\View\View;
|
||||
use Illuminate\Support\Facades\Log;
|
||||
|
||||
@@ -27,7 +27,6 @@ namespace FireflyIII\Http\Controllers\Webhooks;
|
||||
use FireflyIII\Http\Controllers\Controller;
|
||||
use FireflyIII\Models\Webhook;
|
||||
use FireflyIII\Support\Facades\FireflyConfig;
|
||||
use Illuminate\Contracts\Foundation\Application;
|
||||
use Illuminate\Contracts\View\Factory;
|
||||
use Illuminate\Contracts\View\View;
|
||||
use Illuminate\Support\Facades\Log;
|
||||
@@ -54,6 +53,7 @@ final class EditController extends Controller
|
||||
return $next($request);
|
||||
});
|
||||
}
|
||||
|
||||
public function index(Webhook $webhook): Factory|View
|
||||
{
|
||||
if (false === FireflyConfig::get('allow_webhooks', config('firefly.allow_webhooks'))->data) {
|
||||
|
||||
@@ -27,7 +27,6 @@ namespace FireflyIII\Http\Controllers\Webhooks;
|
||||
use FireflyIII\Http\Controllers\Controller;
|
||||
use FireflyIII\Models\Webhook;
|
||||
use FireflyIII\Support\Facades\FireflyConfig;
|
||||
use Illuminate\Contracts\Foundation\Application;
|
||||
use Illuminate\Contracts\View\Factory;
|
||||
use Illuminate\Contracts\View\View;
|
||||
use Illuminate\Support\Facades\Log;
|
||||
|
||||
@@ -54,17 +54,17 @@ class AvailableBudgetRepository implements AvailableBudgetRepositoryInterface, U
|
||||
|
||||
/** @var AvailableBudget $availableBudget */
|
||||
foreach ($availableBudgets as $availableBudget) {
|
||||
$start = $availableBudget->start_date->format('Y-m-d');
|
||||
$end = $availableBudget->end_date->format('Y-m-d');
|
||||
$key = sprintf('%s-%s-%s', $availableBudget->transaction_currency_id, $start, $end);
|
||||
$start = $availableBudget->start_date->format('Y-m-d');
|
||||
$end = $availableBudget->end_date->format('Y-m-d');
|
||||
$key = sprintf('%s-%s-%s', $availableBudget->transaction_currency_id, $start, $end);
|
||||
if (array_key_exists($key, $exists)) {
|
||||
Log::debug(sprintf(
|
||||
'Found duplicate AB: %s %s, %s-%s. Has been deleted',
|
||||
$availableBudget->transaction_currency_id,
|
||||
$availableBudget->amount,
|
||||
$start,
|
||||
$end
|
||||
));
|
||||
'Found duplicate AB: %s %s, %s-%s. Has been deleted',
|
||||
$availableBudget->transaction_currency_id,
|
||||
$availableBudget->amount,
|
||||
$start,
|
||||
$end
|
||||
));
|
||||
$availableBudget->delete();
|
||||
}
|
||||
$exists[$key] = true;
|
||||
@@ -96,12 +96,13 @@ class AvailableBudgetRepository implements AvailableBudgetRepositoryInterface, U
|
||||
->where('transaction_currency_id', $currency->id)
|
||||
->where('start_date', $start->format('Y-m-d'))
|
||||
->where('end_date', $end->format('Y-m-d'))
|
||||
->first();
|
||||
->first()
|
||||
;
|
||||
}
|
||||
|
||||
public function findById(int $id): ?AvailableBudget
|
||||
{
|
||||
/** @var AvailableBudget|null */
|
||||
/** @var null|AvailableBudget */
|
||||
return $this->user->availableBudgets->find($id);
|
||||
}
|
||||
|
||||
@@ -117,7 +118,8 @@ class AvailableBudgetRepository implements AvailableBudgetRepositoryInterface, U
|
||||
$q1->whereBetween('start_date', [$start, $end]);
|
||||
$q1->orWhereBetween('end_date', [$start, $end]);
|
||||
})
|
||||
->get(['available_budgets.*']);
|
||||
->get(['available_budgets.*'])
|
||||
;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -125,7 +127,7 @@ class AvailableBudgetRepository implements AvailableBudgetRepositoryInterface, U
|
||||
*/
|
||||
public function get(?Carbon $start = null, ?Carbon $end = null): Collection
|
||||
{
|
||||
$query = $this->user->availableBudgets()->with(['transactionCurrency']);
|
||||
$query = $this->user->availableBudgets()->with(['transactionCurrency']);
|
||||
if ($start instanceof Carbon && $end instanceof Carbon) {
|
||||
$query->where(static function (Builder $q1) use ($start, $end): void {
|
||||
$q1->where('start_date', '=', $start->format('Y-m-d'));
|
||||
@@ -141,7 +143,7 @@ class AvailableBudgetRepository implements AvailableBudgetRepositoryInterface, U
|
||||
#[Deprecated]
|
||||
public function getAvailableBudget(TransactionCurrency $currency, Carbon $start, Carbon $end): string
|
||||
{
|
||||
$amount = '0';
|
||||
$amount = '0';
|
||||
|
||||
/** @var null|AvailableBudget $availableBudget */
|
||||
$availableBudget = $this->user
|
||||
@@ -149,7 +151,8 @@ class AvailableBudgetRepository implements AvailableBudgetRepositoryInterface, U
|
||||
->where('transaction_currency_id', $currency->id)
|
||||
->where('start_date', $start->format('Y-m-d'))
|
||||
->where('end_date', $end->format('Y-m-d'))
|
||||
->first();
|
||||
->first()
|
||||
;
|
||||
if (null !== $availableBudget) {
|
||||
return $availableBudget->amount;
|
||||
}
|
||||
@@ -165,7 +168,8 @@ class AvailableBudgetRepository implements AvailableBudgetRepositoryInterface, U
|
||||
return $this->user
|
||||
->availableBudgets()
|
||||
->where('transaction_currency_id', $currency->id)
|
||||
->get();
|
||||
->get()
|
||||
;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -194,7 +198,8 @@ class AvailableBudgetRepository implements AvailableBudgetRepositoryInterface, U
|
||||
->availableBudgets()
|
||||
->where('start_date', '=', $start->format('Y-m-d'))
|
||||
->where('end_date', '=', $end->format('Y-m-d'))
|
||||
->get();
|
||||
->get()
|
||||
;
|
||||
}
|
||||
|
||||
public function getAvailableBudgetWithCurrency(Carbon $start, Carbon $end): array
|
||||
@@ -205,7 +210,8 @@ class AvailableBudgetRepository implements AvailableBudgetRepositoryInterface, U
|
||||
->availableBudgets()
|
||||
->where('start_date', $start->format('Y-m-d'))
|
||||
->where('end_date', $end->format('Y-m-d'))
|
||||
->get();
|
||||
->get()
|
||||
;
|
||||
|
||||
Log::debug(sprintf('Found %d available budgets (already converted)', $availableBudgets->count()));
|
||||
|
||||
@@ -220,7 +226,7 @@ class AvailableBudgetRepository implements AvailableBudgetRepositoryInterface, U
|
||||
: $availableBudget->transaction_currency_id;
|
||||
$field = $convertToPrimary && $availableBudget->transaction_currency_id !== $primary->id ? 'native_amount' : 'amount';
|
||||
$return[$currencyId] ??= '0';
|
||||
$amount = '' === (string)$availableBudget->{$field} ? '0' : (string)$availableBudget->{$field};
|
||||
$amount = '' === (string) $availableBudget->{$field} ? '0' : (string) $availableBudget->{$field};
|
||||
$return[$currencyId] = bcadd($return[$currencyId], $amount);
|
||||
Log::debug(sprintf('Add #%d %s (%s) for a total of %s', $currencyId, $amount, $field, $return[$currencyId]));
|
||||
}
|
||||
@@ -236,25 +242,26 @@ class AvailableBudgetRepository implements AvailableBudgetRepositoryInterface, U
|
||||
->where('transaction_currency_id', $currency->id)
|
||||
->where('start_date', $start->format('Y-m-d'))
|
||||
->where('end_date', $end->format('Y-m-d'))
|
||||
->first();
|
||||
->first()
|
||||
;
|
||||
}
|
||||
|
||||
#[Override]
|
||||
public function recalculateAmount(AvailableBudget $availableBudget): void
|
||||
{
|
||||
Log::debug(sprintf('Now in recalculateAmount(#%d)', $availableBudget->id));
|
||||
$newAmount = '0';
|
||||
$period = Period::make($availableBudget->start_date, $availableBudget->end_date, Precision::DAY());
|
||||
$newAmount = '0';
|
||||
$period = Period::make($availableBudget->start_date, $availableBudget->end_date, Precision::DAY());
|
||||
Log::debug(sprintf(
|
||||
'Now recalculating available budget #%d, (%s to %s)',
|
||||
$availableBudget->id,
|
||||
$availableBudget->start_date->format('Y-m-d'),
|
||||
$availableBudget->end_date->format('Y-m-d')
|
||||
));
|
||||
'Now recalculating available budget #%d, (%s to %s)',
|
||||
$availableBudget->id,
|
||||
$availableBudget->start_date->format('Y-m-d'),
|
||||
$availableBudget->end_date->format('Y-m-d')
|
||||
));
|
||||
// have to recalculate everything just in case.
|
||||
$blRepository = app(BudgetLimitRepositoryInterface::class);
|
||||
$blRepository->setUser($this->user);
|
||||
$set = $blRepository->getAllBudgetLimitsByCurrency($availableBudget->transactionCurrency, $availableBudget->start_date, $availableBudget->end_date);
|
||||
$set = $blRepository->getAllBudgetLimitsByCurrency($availableBudget->transactionCurrency, $availableBudget->start_date, $availableBudget->end_date);
|
||||
Log::debug(sprintf('Found %d interesting budget limit(s).', $set->count()));
|
||||
|
||||
/** @var BudgetLimit $budgetLimit */
|
||||
@@ -275,14 +282,15 @@ class AvailableBudgetRepository implements AvailableBudgetRepositoryInterface, U
|
||||
public function setAvailableBudget(TransactionCurrency $currency, Carbon $start, Carbon $end, string $amount): AvailableBudget
|
||||
{
|
||||
/** @var null|AvailableBudget $availableBudget */
|
||||
$availableBudget = $this->user
|
||||
$availableBudget = $this->user
|
||||
->availableBudgets()
|
||||
->where('transaction_currency_id', $currency->id)
|
||||
->where('start_date', $start->format('Y-m-d'))
|
||||
->where('end_date', $end->format('Y-m-d'))
|
||||
->first();
|
||||
->first()
|
||||
;
|
||||
if (null === $availableBudget) {
|
||||
$availableBudget = new AvailableBudget();
|
||||
$availableBudget = new AvailableBudget();
|
||||
$availableBudget->user()->associate($this->user);
|
||||
$availableBudget->transactionCurrency()->associate($currency);
|
||||
$availableBudget->start_date = $start->startOfDay();
|
||||
@@ -302,21 +310,21 @@ class AvailableBudgetRepository implements AvailableBudgetRepositoryInterface, U
|
||||
if ($start instanceof Carbon) {
|
||||
$start = $data['start']->startOfDay();
|
||||
}
|
||||
$end = $data['end'];
|
||||
$end = $data['end'];
|
||||
if ($end instanceof Carbon) {
|
||||
$end = $data['end']->endOfDay();
|
||||
}
|
||||
|
||||
return AvailableBudget::create([
|
||||
'user_id' => $this->user->id,
|
||||
'user_group_id' => $this->user->user_group_id,
|
||||
'transaction_currency_id' => $data['currency_id'],
|
||||
'amount' => $data['amount'],
|
||||
'start_date' => $start,
|
||||
'start_date_tz' => $start->format('e'),
|
||||
'end_date' => $end,
|
||||
'end_date_tz' => $end->format('e'),
|
||||
]);
|
||||
'user_id' => $this->user->id,
|
||||
'user_group_id' => $this->user->user_group_id,
|
||||
'transaction_currency_id' => $data['currency_id'],
|
||||
'amount' => $data['amount'],
|
||||
'start_date' => $start,
|
||||
'start_date_tz' => $start->format('e'),
|
||||
'end_date' => $end,
|
||||
'end_date_tz' => $end->format('e'),
|
||||
]);
|
||||
}
|
||||
|
||||
public function update(AvailableBudget $availableBudget, array $data): AvailableBudget
|
||||
@@ -368,24 +376,24 @@ class AvailableBudgetRepository implements AvailableBudgetRepositoryInterface, U
|
||||
$blRepository->setUser($this->user);
|
||||
|
||||
Log::debug(sprintf(
|
||||
'Found interesting budget limit #%d (%s to %s)',
|
||||
$budgetLimit->id,
|
||||
$budgetLimit->start_date->format('Y-m-d'),
|
||||
$budgetLimit->end_date->format('Y-m-d')
|
||||
));
|
||||
'Found interesting budget limit #%d (%s to %s)',
|
||||
$budgetLimit->id,
|
||||
$budgetLimit->start_date->format('Y-m-d'),
|
||||
$budgetLimit->end_date->format('Y-m-d')
|
||||
));
|
||||
// overlap in days:
|
||||
$limitPeriod = Period::make($budgetLimit->start_date, $budgetLimit->end_date, precision: Precision::DAY(), boundaries: Boundaries::EXCLUDE_NONE());
|
||||
$limitPeriod = Period::make($budgetLimit->start_date, $budgetLimit->end_date, precision: Precision::DAY(), boundaries: Boundaries::EXCLUDE_NONE());
|
||||
// if both equal each other, amount from this BL must be added to the AB
|
||||
if ($limitPeriod->equals($availableBudgetPeriod)) {
|
||||
Log::debug('This budget limit is equal to the available budget period.');
|
||||
|
||||
return (string)$budgetLimit->amount;
|
||||
return (string) $budgetLimit->amount;
|
||||
}
|
||||
// if budget limit period is inside AB period, it can be added in full.
|
||||
if ($availableBudgetPeriod->contains($limitPeriod)) {
|
||||
Log::debug('This budget limit is smaller than the available budget period.');
|
||||
|
||||
return (string)$budgetLimit->amount;
|
||||
return (string) $budgetLimit->amount;
|
||||
}
|
||||
|
||||
if ($availableBudgetPeriod->overlapsWith($limitPeriod)) {
|
||||
@@ -394,7 +402,7 @@ class AvailableBudgetRepository implements AvailableBudgetRepositoryInterface, U
|
||||
if ($overlap instanceof Period) {
|
||||
$length = $overlap->length();
|
||||
|
||||
return bcmul($blRepository->getDailyAmount($budgetLimit), (string)$length);
|
||||
return bcmul($blRepository->getDailyAmount($budgetLimit), (string) $length);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -296,13 +296,15 @@ class CurrencyRepository implements CurrencyRepositoryInterface, UserGroupInterf
|
||||
->currencies()
|
||||
->orderBy('code', 'ASC')
|
||||
->withPivot(['group_default'])
|
||||
->get();
|
||||
->get()
|
||||
;
|
||||
$all->map(static function (TransactionCurrency $current): TransactionCurrency {
|
||||
$current->userGroupEnabled = true;
|
||||
$current->userGroupNative = 1 === (int) $current->pivot->group_default;
|
||||
|
||||
return $current;
|
||||
});
|
||||
|
||||
/** @var Collection */
|
||||
return $all;
|
||||
}
|
||||
|
||||
@@ -129,7 +129,7 @@ class JournalRepository implements JournalRepositoryInterface, UserGroupInterfac
|
||||
*/
|
||||
public function firstNull(): ?TransactionJournal
|
||||
{
|
||||
/** @var TransactionJournal|null */
|
||||
/** @var null|TransactionJournal */
|
||||
return $this->user
|
||||
->transactionJournals()
|
||||
->orderBy('date', 'ASC')
|
||||
@@ -150,11 +150,13 @@ class JournalRepository implements JournalRepositoryInterface, UserGroupInterfac
|
||||
if (null === $transaction) {
|
||||
throw new FireflyException(sprintf('Your administration is broken. Transaction journal #%d has no destination transaction.', $journal->id));
|
||||
}
|
||||
/** @var Account|null $res */
|
||||
$res = $transaction->account;
|
||||
if(null === $res) {
|
||||
|
||||
/** @var null|Account $res */
|
||||
$res = $transaction->account;
|
||||
if (null === $res) {
|
||||
throw new FireflyException('Account is unexpectedly NULL.');
|
||||
}
|
||||
|
||||
return $res;
|
||||
}
|
||||
|
||||
@@ -180,7 +182,7 @@ class JournalRepository implements JournalRepositoryInterface, UserGroupInterfac
|
||||
|
||||
public function getLast(): ?TransactionJournal
|
||||
{
|
||||
/** @var TransactionJournal|null */
|
||||
/** @var null|TransactionJournal */
|
||||
return $this->user
|
||||
->transactionJournals()
|
||||
->orderBy('date', 'DESC')
|
||||
@@ -227,11 +229,12 @@ class JournalRepository implements JournalRepositoryInterface, UserGroupInterfac
|
||||
throw new FireflyException(sprintf('Your administration is broken. Transaction journal #%d has no source transaction.', $journal->id));
|
||||
}
|
||||
|
||||
/** @var Account|null $res */
|
||||
$res = $transaction->account;
|
||||
if(null === $res) {
|
||||
/** @var null|Account $res */
|
||||
$res = $transaction->account;
|
||||
if (null === $res) {
|
||||
throw new FireflyException('Account is unexpectedly NULL.');
|
||||
}
|
||||
|
||||
return $res;
|
||||
}
|
||||
|
||||
|
||||
@@ -82,6 +82,7 @@ class BelongsUser implements ValidationRule
|
||||
$objects = $class::where('user_id', '=', auth()->user()->id)->get();
|
||||
}
|
||||
$count = 0;
|
||||
|
||||
/** @var Model $object */
|
||||
foreach ($objects as $object) {
|
||||
$objectValue = trim((string) $object->{$field});
|
||||
|
||||
@@ -95,6 +95,7 @@ class BelongsUserGroup implements ValidationRule
|
||||
$objects = $class::where('user_group_id', '=', $this->userGroup->id)->get();
|
||||
}
|
||||
$count = 0;
|
||||
|
||||
/** @var Model $object */
|
||||
foreach ($objects as $object) {
|
||||
$objectValue = trim((string) $object->{$field});
|
||||
|
||||
@@ -71,6 +71,7 @@ class IsAllowedGroupAction implements ValidationRule
|
||||
private function validateUserGroup(): void
|
||||
{
|
||||
Log::debug('This method is not yet in use', $this->acceptedRoles);
|
||||
|
||||
try {
|
||||
throw new FireflyException('Here we are');
|
||||
} catch (FireflyException $e) {
|
||||
|
||||
@@ -633,7 +633,7 @@ class JournalUpdateService
|
||||
*/
|
||||
private function updateField(string $fieldName): void
|
||||
{
|
||||
if(null === $this->transactionJournal) {
|
||||
if (null === $this->transactionJournal) {
|
||||
return;
|
||||
}
|
||||
if (array_key_exists($fieldName, $this->data) && '' !== (string) $this->data[$fieldName]) {
|
||||
@@ -668,7 +668,15 @@ class JournalUpdateService
|
||||
}
|
||||
$factory->updateOrCreate($set);
|
||||
}
|
||||
event(new TransactionGroupRequestsAuditLogEntry($this->transactionJournal->user, $this->transactionJournal, sprintf('update_%s', $fieldName), $this->transactionJournal->{$fieldName}, $value));
|
||||
event(
|
||||
new TransactionGroupRequestsAuditLogEntry(
|
||||
$this->transactionJournal->user,
|
||||
$this->transactionJournal,
|
||||
sprintf('update_%s', $fieldName),
|
||||
$this->transactionJournal->{$fieldName},
|
||||
$value
|
||||
)
|
||||
);
|
||||
|
||||
$this->transactionJournal->{$fieldName} = $value;
|
||||
Log::debug(sprintf('Updated %s', $fieldName));
|
||||
|
||||
@@ -62,7 +62,6 @@ use Illuminate\Support\Facades\Log;
|
||||
use League\Csv\AbstractCsv;
|
||||
use League\Csv\CannotInsertRecord;
|
||||
use League\Csv\Exception;
|
||||
use League\Csv\Writer;
|
||||
use Psr\Container\ContainerExceptionInterface;
|
||||
use Psr\Container\NotFoundExceptionInterface;
|
||||
|
||||
@@ -89,7 +88,8 @@ class ExportDataGenerator
|
||||
private bool $exportTransactions = false;
|
||||
private Carbon $start;
|
||||
private User $user;
|
||||
//private UserGroup $userGroup;
|
||||
|
||||
// private UserGroup $userGroup;
|
||||
|
||||
public function __construct()
|
||||
{
|
||||
@@ -284,7 +284,7 @@ class ExportDataGenerator
|
||||
}
|
||||
|
||||
// load the CSV document from a string
|
||||
$csv = AbstractCsv::fromString();
|
||||
$csv = AbstractCsv::fromString();
|
||||
|
||||
// insert the header
|
||||
try {
|
||||
@@ -353,7 +353,7 @@ class ExportDataGenerator
|
||||
}
|
||||
|
||||
// load the CSV document from a string
|
||||
$csv = AbstractCsv::fromString();
|
||||
$csv = AbstractCsv::fromString();
|
||||
|
||||
// insert the header
|
||||
try {
|
||||
@@ -412,7 +412,7 @@ class ExportDataGenerator
|
||||
}
|
||||
|
||||
// load the CSV document from a string
|
||||
$csv = AbstractCsv::fromString();
|
||||
$csv = AbstractCsv::fromString();
|
||||
|
||||
// insert the header
|
||||
try {
|
||||
@@ -457,7 +457,7 @@ class ExportDataGenerator
|
||||
}
|
||||
|
||||
// load the CSV document from a string
|
||||
$csv = AbstractCsv::fromString();
|
||||
$csv = AbstractCsv::fromString();
|
||||
|
||||
// insert the header
|
||||
try {
|
||||
@@ -537,7 +537,7 @@ class ExportDataGenerator
|
||||
}
|
||||
|
||||
// load the CSV document from a string
|
||||
$csv = AbstractCsv::fromString();
|
||||
$csv = AbstractCsv::fromString();
|
||||
|
||||
// insert the header
|
||||
try {
|
||||
@@ -704,7 +704,7 @@ class ExportDataGenerator
|
||||
}
|
||||
}
|
||||
// load the CSV document from a string
|
||||
$csv = AbstractCsv::fromString();
|
||||
$csv = AbstractCsv::fromString();
|
||||
|
||||
// insert the header
|
||||
try {
|
||||
@@ -851,7 +851,7 @@ class ExportDataGenerator
|
||||
}
|
||||
|
||||
// load the CSV document from a string
|
||||
$csv = AbstractCsv::fromString();
|
||||
$csv = AbstractCsv::fromString();
|
||||
|
||||
// insert the header
|
||||
try {
|
||||
@@ -907,7 +907,7 @@ class ExportDataGenerator
|
||||
}
|
||||
|
||||
// load the CSV document from a string
|
||||
$csv = AbstractCsv::fromString();
|
||||
$csv = AbstractCsv::fromString();
|
||||
|
||||
// insert the header
|
||||
try {
|
||||
@@ -1103,7 +1103,7 @@ class ExportDataGenerator
|
||||
}
|
||||
|
||||
// load the CSV document from a string
|
||||
$csv = AbstractCsv::fromString();
|
||||
$csv = AbstractCsv::fromString();
|
||||
|
||||
// insert the header
|
||||
try {
|
||||
|
||||
@@ -253,11 +253,12 @@ class ConvertToDeposit implements ActionInterface
|
||||
throw new FireflyException(sprintf('Cannot find destination transaction for journal #%d', $journal->id));
|
||||
}
|
||||
|
||||
/** @var Account|null $res */
|
||||
$res = $destTransaction->account;
|
||||
if(null === $res) {
|
||||
/** @var null|Account $res */
|
||||
$res = $destTransaction->account;
|
||||
if (null === $res) {
|
||||
throw new FireflyException('Account is unexpectedly NULL.');
|
||||
}
|
||||
|
||||
return $res;
|
||||
}
|
||||
|
||||
@@ -272,11 +273,12 @@ class ConvertToDeposit implements ActionInterface
|
||||
throw new FireflyException(sprintf('Cannot find source transaction for journal #%d', $journal->id));
|
||||
}
|
||||
|
||||
/** @var Account|null $res */
|
||||
$res = $sourceTransaction->account;
|
||||
if(null === $res) {
|
||||
/** @var null|Account $res */
|
||||
$res = $sourceTransaction->account;
|
||||
if (null === $res) {
|
||||
throw new FireflyException('Account is unexpectedly NULL.');
|
||||
}
|
||||
|
||||
return $res;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -305,11 +305,12 @@ class ConvertToTransfer implements ActionInterface
|
||||
throw new FireflyException(sprintf('Cannot find destination transaction for journal #%d', $journal->id));
|
||||
}
|
||||
|
||||
/** @var Account|null $res */
|
||||
$res = $destTransaction->account;
|
||||
if(null === $res) {
|
||||
/** @var null|Account $res */
|
||||
$res = $destTransaction->account;
|
||||
if (null === $res) {
|
||||
throw new FireflyException('Account is unexpectedly NULL.');
|
||||
}
|
||||
|
||||
return $res;
|
||||
}
|
||||
|
||||
@@ -337,11 +338,12 @@ class ConvertToTransfer implements ActionInterface
|
||||
throw new FireflyException(sprintf('Cannot find source transaction for journal #%d', $journal->id));
|
||||
}
|
||||
|
||||
/** @var Account|null $res */
|
||||
$res = $sourceTransaction->account;
|
||||
if(null === $res) {
|
||||
/** @var null|Account $res */
|
||||
$res = $sourceTransaction->account;
|
||||
if (null === $res) {
|
||||
throw new FireflyException('Account is unexpectedly NULL.');
|
||||
}
|
||||
|
||||
return $res;
|
||||
}
|
||||
|
||||
|
||||
@@ -244,11 +244,12 @@ class ConvertToWithdrawal implements ActionInterface
|
||||
throw new FireflyException(sprintf('Cannot find destination transaction for journal #%d', $journal->id));
|
||||
}
|
||||
|
||||
/** @var Account|null $res */
|
||||
$res = $destTransaction->account;
|
||||
if(null === $res) {
|
||||
/** @var null|Account $res */
|
||||
$res = $destTransaction->account;
|
||||
if (null === $res) {
|
||||
throw new FireflyException('Account is unexpectedly NULL.');
|
||||
}
|
||||
|
||||
return $res;
|
||||
}
|
||||
|
||||
@@ -263,11 +264,12 @@ class ConvertToWithdrawal implements ActionInterface
|
||||
throw new FireflyException(sprintf('Cannot find source transaction for journal #%d', $journal->id));
|
||||
}
|
||||
|
||||
/** @var Account|null $res */
|
||||
$res = $sourceTransaction->account;
|
||||
if(null === $res) {
|
||||
/** @var null|Account $res */
|
||||
$res = $sourceTransaction->account;
|
||||
if (null === $res) {
|
||||
throw new FireflyException('Account is unexpectedly NULL.');
|
||||
}
|
||||
|
||||
return $res;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -44,7 +44,6 @@ abstract class AbstractTransformer extends TransformerAbstract
|
||||
return $this->parameters;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @deprecated
|
||||
*/
|
||||
|
||||
@@ -182,7 +182,7 @@ class TransactionGroupTransformer extends AbstractTransformer
|
||||
*/
|
||||
private function getDestinationTransaction(TransactionJournal $journal): Transaction
|
||||
{
|
||||
/** @var Transaction|null $result */
|
||||
/** @var null|Transaction $result */
|
||||
$result = $journal->transactions->first(static fn (Transaction $transaction): bool => (float) $transaction->amount > 0);
|
||||
if (null === $result) {
|
||||
throw new FireflyException(sprintf('Journal #%d unexpectedly has no destination transaction.', $journal->id));
|
||||
@@ -225,7 +225,7 @@ class TransactionGroupTransformer extends AbstractTransformer
|
||||
*/
|
||||
private function getSourceTransaction(TransactionJournal $journal): Transaction
|
||||
{
|
||||
/** @var Transaction|null $result */
|
||||
/** @var null|Transaction $result */
|
||||
$result = $journal->transactions->first(static fn (Transaction $transaction): bool => (float) $transaction->amount < 0);
|
||||
if (null === $result) {
|
||||
throw new FireflyException(sprintf('Journal #%d unexpectedly has no source transaction.', $journal->id));
|
||||
|
||||
Generated
+9
-9
@@ -10545,16 +10545,16 @@
|
||||
},
|
||||
{
|
||||
"name": "fruitcake/laravel-debugbar",
|
||||
"version": "v4.0.10",
|
||||
"version": "v4.1.1",
|
||||
"source": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/fruitcake/laravel-debugbar.git",
|
||||
"reference": "96afd5efc93c2cb3140df356893381296259695b"
|
||||
"reference": "048876cf8ffdd8af2b82306289e2c0453fa0b059"
|
||||
},
|
||||
"dist": {
|
||||
"type": "zip",
|
||||
"url": "https://api.github.com/repos/fruitcake/laravel-debugbar/zipball/96afd5efc93c2cb3140df356893381296259695b",
|
||||
"reference": "96afd5efc93c2cb3140df356893381296259695b",
|
||||
"url": "https://api.github.com/repos/fruitcake/laravel-debugbar/zipball/048876cf8ffdd8af2b82306289e2c0453fa0b059",
|
||||
"reference": "048876cf8ffdd8af2b82306289e2c0453fa0b059",
|
||||
"shasum": ""
|
||||
},
|
||||
"require": {
|
||||
@@ -10562,7 +10562,7 @@
|
||||
"illuminate/session": "^11|^12|^13.0",
|
||||
"illuminate/support": "^11|^12|^13.0",
|
||||
"php": "^8.2",
|
||||
"php-debugbar/php-debugbar": "^3.3.1",
|
||||
"php-debugbar/php-debugbar": "^3.5",
|
||||
"php-debugbar/symfony-bridge": "^1.1"
|
||||
},
|
||||
"replace": {
|
||||
@@ -10576,7 +10576,7 @@
|
||||
"laravel/telescope": "^5.16",
|
||||
"livewire/livewire": "^3.7|^4",
|
||||
"mockery/mockery": "^1.3.3",
|
||||
"orchestra/testbench-dusk": "^9|^10",
|
||||
"orchestra/testbench-dusk": "^9|^10|^11",
|
||||
"php-debugbar/twig-bridge": "^2.0",
|
||||
"phpstan/phpstan-phpunit": "^2",
|
||||
"phpstan/phpstan-strict-rules": "^2.0",
|
||||
@@ -10594,7 +10594,7 @@
|
||||
]
|
||||
},
|
||||
"branch-alias": {
|
||||
"dev-master": "4.0-dev"
|
||||
"dev-master": "4.1-dev"
|
||||
}
|
||||
},
|
||||
"autoload": {
|
||||
@@ -10631,7 +10631,7 @@
|
||||
],
|
||||
"support": {
|
||||
"issues": "https://github.com/fruitcake/laravel-debugbar/issues",
|
||||
"source": "https://github.com/fruitcake/laravel-debugbar/tree/v4.0.10"
|
||||
"source": "https://github.com/fruitcake/laravel-debugbar/tree/v4.1.1"
|
||||
},
|
||||
"funding": [
|
||||
{
|
||||
@@ -10643,7 +10643,7 @@
|
||||
"type": "github"
|
||||
}
|
||||
],
|
||||
"time": "2026-02-26T11:45:48+00:00"
|
||||
"time": "2026-03-08T08:20:19+00:00"
|
||||
},
|
||||
{
|
||||
"name": "hamcrest/hamcrest-php",
|
||||
|
||||
+2
-2
@@ -78,8 +78,8 @@ return [
|
||||
'running_balance_column' => (bool)envDefaultWhenEmpty(env('USE_RUNNING_BALANCE'), true), // this is only the default value, is not used.
|
||||
// see cer.php for exchange rates feature flag.
|
||||
],
|
||||
'version' => 'develop/2026-03-07',
|
||||
'build_time' => 1772875424,
|
||||
'version' => 'develop/2026-03-09',
|
||||
'build_time' => 1773028179,
|
||||
'api_version' => '2.1.0', // field is no longer used.
|
||||
'db_version' => 28, // field is no longer used.
|
||||
|
||||
|
||||
Reference in New Issue
Block a user