mirror of
https://github.com/firefly-iii/firefly-iii.git
synced 2025-11-08 10:48:13 +00:00
Fixed various bugs that made tests fail.
This commit is contained in:
@@ -247,9 +247,9 @@ class Budget implements CUD, CommonDatabaseCalls, BudgetInterface
|
||||
{
|
||||
return \LimitRepetition::
|
||||
leftJoin('budget_limits', 'limit_repetitions.budget_limit_id', '=', 'budget_limits.id')
|
||||
->where('limit_repetitions.startdate', $date->format('Y-m-d 00:00:00'))
|
||||
->where('budget_limits.budget_id', $budget->id)
|
||||
->first(['limit_repetitions.*']);
|
||||
->where('limit_repetitions.startdate', $date->format('Y-m-d 00:00:00'))
|
||||
->where('budget_limits.budget_id', $budget->id)
|
||||
->first(['limit_repetitions.*']);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -366,6 +366,9 @@ class Budget implements CUD, CommonDatabaseCalls, BudgetInterface
|
||||
*/
|
||||
public function limitOnStartingOnDate(\Budget $budget, Carbon $date)
|
||||
{
|
||||
return $budget->budgetLimits()->where('startdate', $date->format('Y-m-d'))->first();
|
||||
return $budget->budgetLimits()->where('startdate', $date->format('Y-m-d 00:00:00'))->first();
|
||||
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
@@ -28,7 +28,7 @@ class Budget extends Eloquent
|
||||
*/
|
||||
public function budgetlimits()
|
||||
{
|
||||
return $this->hasMany('BudgetLimit', 'budget_id');
|
||||
return $this->hasMany('BudgetLimit');
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -1,9 +1,10 @@
|
||||
<?php
|
||||
|
||||
use Carbon\Carbon;
|
||||
use Illuminate\Database\Eloquent\Model as Eloquent;
|
||||
use Illuminate\Database\QueryException;
|
||||
use Watson\Validating\ValidatingTrait;
|
||||
use \Illuminate\Database\Eloquent\Model as Eloquent;
|
||||
|
||||
/**
|
||||
* Class Limit
|
||||
*/
|
||||
@@ -13,11 +14,11 @@ class BudgetLimit extends Eloquent
|
||||
use ValidatingTrait;
|
||||
public static $rules
|
||||
= [
|
||||
'budget_id' => 'required|exists:budgets,id',
|
||||
'startdate' => 'required|date',
|
||||
'amount' => 'numeric|required|min:0.01',
|
||||
'repeats' => 'required|boolean',
|
||||
'repeat_freq' => 'required|in:daily,weekly,monthly,quarterly,half-year,yearly'
|
||||
'budget_id' => 'required|exists:budgets,id',
|
||||
'startdate' => 'required|date',
|
||||
'amount' => 'numeric|required|min:0.01',
|
||||
'repeats' => 'required|boolean',
|
||||
'repeat_freq' => 'required|in:daily,weekly,monthly,quarterly,half-year,yearly'
|
||||
|
||||
];
|
||||
|
||||
@@ -27,7 +28,7 @@ class BudgetLimit extends Eloquent
|
||||
*/
|
||||
public function budget()
|
||||
{
|
||||
return $this->belongsTo('Budget','budget_id');
|
||||
return $this->belongsTo('Budget');
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -36,7 +36,7 @@ class Category extends Eloquent
|
||||
*/
|
||||
public function transactionjournals()
|
||||
{
|
||||
return $this->belongsToMany('TransactionJournal', 'budget_transaction_journal', 'budget_id');
|
||||
return $this->belongsToMany('TransactionJournal', 'category_transaction_journal', 'category_id');
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
Reference in New Issue
Block a user