mirror of
https://github.com/firefly-iii/firefly-iii.git
synced 2024-11-27 19:31:01 -06:00
Fix #2687
This commit is contained in:
parent
67f9d23714
commit
9b001f7c15
@ -46,11 +46,7 @@ use Symfony\Component\HttpKernel\Exception\NotFoundHttpException;
|
||||
* @property Carbon created_at
|
||||
* @property Carbon updated_at
|
||||
* @property User $user
|
||||
* @property \Illuminate\Support\Carbon|null $created_at
|
||||
* @property \Illuminate\Support\Carbon|null $updated_at
|
||||
* @property \Illuminate\Support\Carbon|null $deleted_at
|
||||
* @property bool $encrypted
|
||||
* @property-read \Illuminate\Database\Eloquent\Collection|\FireflyIII\Models\BudgetLimit[] $budgetlimits
|
||||
* @property-read \Illuminate\Database\Eloquent\Collection|\FireflyIII\Models\TransactionJournal[] $transactionJournals
|
||||
* @property-read \Illuminate\Database\Eloquent\Collection|\FireflyIII\Models\Transaction[] $transactions
|
||||
* @method static bool|null forceDelete()
|
||||
|
@ -69,12 +69,15 @@ class BudgetLimitRepository implements BudgetLimitRepositoryInterface
|
||||
public function budgeted(Carbon $start, Carbon $end, TransactionCurrency $currency, ?Collection $budgets = null): string
|
||||
{
|
||||
$query = BudgetLimit
|
||||
::where('start_date', $start->format('Y-m-d 00:00:00'))
|
||||
->where('end_date', $end->format('Y-m-d 00:00:00'))
|
||||
->where('transaction_currency_id', $currency->id);
|
||||
::leftJoin('budgets', 'budgets.id', '=', 'budget_limits.budget_id')
|
||||
->where('budget_limits.start_date', $start->format('Y-m-d 00:00:00'))
|
||||
->where('budget_limits.end_date', $end->format('Y-m-d 00:00:00'))
|
||||
->where('budget_limits.transaction_currency_id', $currency->id)
|
||||
->where('budgets.user_id', $this->user->id);
|
||||
if (null !== $budgets && $budgets->count() > 0) {
|
||||
$query->whereIn('budget_id', $budgets->pluck('id')->toArray());
|
||||
$query->whereIn('budget_limits.budget_id', $budgets->pluck('id')->toArray());
|
||||
}
|
||||
|
||||
$set = $query->get(['budget_limits.*']);
|
||||
$result = '0';
|
||||
/** @var BudgetLimit $budgetLimit */
|
||||
|
Loading…
Reference in New Issue
Block a user