Skip to content

Firefly III: a personal finances manager

Fix #3790

James Cole7a80caf26bd9
diff --git a/app/Api/V1/Controllers/AvailableBudgetController.php b/app/Api/V1/Controllers/AvailableBudgetController.php
index c6807e08f9..973d15bb76 100644
--- a/app/Api/V1/Controllers/AvailableBudgetController.php
+++ b/app/Api/V1/Controllers/AvailableBudgetController.php
@@ -145,6 +145,9 @@ class AvailableBudgetController extends Controller
public function store(AvailableBudgetRequest $request): JsonResponse
{
$data = $request->getAll();
+ $data['start']->startOfDay();
+ $data['end']->endOfDay();
+
/** @var TransactionCurrencyFactory $factory */
$factory = app(TransactionCurrencyFactory::class);
$currency = $factory->find($data['currency_id'], $data['currency_code']);
diff --git a/app/Http/Controllers/Budget/AvailableBudgetController.php b/app/Http/Controllers/Budget/AvailableBudgetController.php
index 6c2d9cdd69..324d7de3a5 100644
--- a/app/Http/Controllers/Budget/AvailableBudgetController.php
+++ b/app/Http/Controllers/Budget/AvailableBudgetController.php
@@ -198,7 +198,8 @@ class AvailableBudgetController extends Controller
return redirect(route('budgets.index', [$start->format('Y-m-d'), $end->format('Y-m-d')]));
}
-
+ $start->startOfDay();
+ $end->endOfDay();
// find existing AB
$existing = $this->abRepository->find($currency, $start, $end);
if (null === $existing) {
diff --git a/app/Repositories/Budget/AvailableBudgetRepository.php b/app/Repositories/Budget/AvailableBudgetRepository.php
index 127df8f18b..66b82d5366 100644
--- a/app/Repositories/Budget/AvailableBudgetRepository.php
+++ b/app/Repositories/Budget/AvailableBudgetRepository.php
@@ -39,19 +39,7 @@ use Log;
*/
class AvailableBudgetRepository implements AvailableBudgetRepositoryInterface
{
- /** @var User */
- private $user;
-
- /**
- * Constructor.
- */
- public function __construct()
- {
- if ('testing' === config('app.env')) {
- Log::warning(sprintf('%s should not be instantiated in the TEST environment!', get_class($this)));
- die(get_class($this));
- }
- }
+ private User $user;
/**
* @param AvailableBudget $availableBudget
@@ -99,7 +87,7 @@ class AvailableBudgetRepository implements AvailableBudgetRepositoryInterface
$query->where(
static function (Builder $q1) use ($start, $end) {
$q1->where('start_date', '=', $start->format('Y-m-d 00:00:00'));
- $q1->where('end_date', '=', $end->format('Y-m-d 00:00:00'));
+ $q1->where('end_date', '=', $end->format('Y-m-d 23:59:59'));
}
);
}
diff --git a/app/Repositories/Budget/BudgetLimitRepository.php b/app/Repositories/Budget/BudgetLimitRepository.php
index ce6ad0e504..2282daa0c1 100644
--- a/app/Repositories/Budget/BudgetLimitRepository.php
+++ b/app/Repositories/Budget/BudgetLimitRepository.php
@@ -44,17 +44,6 @@ class BudgetLimitRepository implements BudgetLimitRepositoryInterface
{
private User $user;
- /**
- * Constructor.
- */
- public function __construct()
- {
- if ('testing' === config('app.env')) {
- Log::warning(sprintf('%s should not be instantiated in the TEST environment!', get_class($this)));
- die(get_class($this));
- }
- }
-
/**
* Tells you which amount has been budgeted (for the given budgets)
* in the selected query. Returns a positive amount as a string.
diff --git a/app/Repositories/Budget/OperationsRepository.php b/app/Repositories/Budget/OperationsRepository.php
index 150652dec4..6dac32b216 100644
--- a/app/Repositories/Budget/OperationsRepository.php
+++ b/app/Repositories/Budget/OperationsRepository.php
@@ -41,19 +41,7 @@ use Log;
*/
class OperationsRepository implements OperationsRepositoryInterface
{
- /** @var User */
- private $user;
-
- /**
- * Constructor.
- */
- public function __construct()
- {
- if ('testing' === config('app.env')) {
- Log::warning(sprintf('%s should not be instantiated in the TEST environment!', get_class($this)));
- die(get_class($this));
- }
- }
+ private User $user;
/**
* A method that returns the amount of money budgeted per day for this budget,