mirror of
https://github.com/firefly-iii/firefly-iii.git
synced 2025-10-16 17:33:45 +00:00
Fix #3790
This commit is contained in:
@@ -145,6 +145,9 @@ class AvailableBudgetController extends Controller
|
|||||||
public function store(AvailableBudgetRequest $request): JsonResponse
|
public function store(AvailableBudgetRequest $request): JsonResponse
|
||||||
{
|
{
|
||||||
$data = $request->getAll();
|
$data = $request->getAll();
|
||||||
|
$data['start']->startOfDay();
|
||||||
|
$data['end']->endOfDay();
|
||||||
|
|
||||||
/** @var TransactionCurrencyFactory $factory */
|
/** @var TransactionCurrencyFactory $factory */
|
||||||
$factory = app(TransactionCurrencyFactory::class);
|
$factory = app(TransactionCurrencyFactory::class);
|
||||||
$currency = $factory->find($data['currency_id'], $data['currency_code']);
|
$currency = $factory->find($data['currency_id'], $data['currency_code']);
|
||||||
|
@@ -198,7 +198,8 @@ class AvailableBudgetController extends Controller
|
|||||||
|
|
||||||
return redirect(route('budgets.index', [$start->format('Y-m-d'), $end->format('Y-m-d')]));
|
return redirect(route('budgets.index', [$start->format('Y-m-d'), $end->format('Y-m-d')]));
|
||||||
}
|
}
|
||||||
|
$start->startOfDay();
|
||||||
|
$end->endOfDay();
|
||||||
// find existing AB
|
// find existing AB
|
||||||
$existing = $this->abRepository->find($currency, $start, $end);
|
$existing = $this->abRepository->find($currency, $start, $end);
|
||||||
if (null === $existing) {
|
if (null === $existing) {
|
||||||
|
@@ -39,19 +39,7 @@ use Log;
|
|||||||
*/
|
*/
|
||||||
class AvailableBudgetRepository implements AvailableBudgetRepositoryInterface
|
class AvailableBudgetRepository implements AvailableBudgetRepositoryInterface
|
||||||
{
|
{
|
||||||
/** @var User */
|
private User $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));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param AvailableBudget $availableBudget
|
* @param AvailableBudget $availableBudget
|
||||||
@@ -99,7 +87,7 @@ class AvailableBudgetRepository implements AvailableBudgetRepositoryInterface
|
|||||||
$query->where(
|
$query->where(
|
||||||
static function (Builder $q1) use ($start, $end) {
|
static function (Builder $q1) use ($start, $end) {
|
||||||
$q1->where('start_date', '=', $start->format('Y-m-d 00:00:00'));
|
$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'));
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
@@ -44,17 +44,6 @@ class BudgetLimitRepository implements BudgetLimitRepositoryInterface
|
|||||||
{
|
{
|
||||||
private User $user;
|
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)
|
* Tells you which amount has been budgeted (for the given budgets)
|
||||||
* in the selected query. Returns a positive amount as a string.
|
* in the selected query. Returns a positive amount as a string.
|
||||||
|
@@ -41,19 +41,7 @@ use Log;
|
|||||||
*/
|
*/
|
||||||
class OperationsRepository implements OperationsRepositoryInterface
|
class OperationsRepository implements OperationsRepositoryInterface
|
||||||
{
|
{
|
||||||
/** @var User */
|
private User $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));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* A method that returns the amount of money budgeted per day for this budget,
|
* A method that returns the amount of money budgeted per day for this budget,
|
||||||
|
Reference in New Issue
Block a user