mirror of
https://github.com/firefly-iii/firefly-iii.git
synced 2025-11-09 03:08:09 +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::
|
return \LimitRepetition::
|
||||||
leftJoin('budget_limits', 'limit_repetitions.budget_limit_id', '=', 'budget_limits.id')
|
leftJoin('budget_limits', 'limit_repetitions.budget_limit_id', '=', 'budget_limits.id')
|
||||||
->where('limit_repetitions.startdate', $date->format('Y-m-d 00:00:00'))
|
->where('limit_repetitions.startdate', $date->format('Y-m-d 00:00:00'))
|
||||||
->where('budget_limits.budget_id', $budget->id)
|
->where('budget_limits.budget_id', $budget->id)
|
||||||
->first(['limit_repetitions.*']);
|
->first(['limit_repetitions.*']);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -366,6 +366,9 @@ class Budget implements CUD, CommonDatabaseCalls, BudgetInterface
|
|||||||
*/
|
*/
|
||||||
public function limitOnStartingOnDate(\Budget $budget, Carbon $date)
|
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()
|
public function budgetlimits()
|
||||||
{
|
{
|
||||||
return $this->hasMany('BudgetLimit', 'budget_id');
|
return $this->hasMany('BudgetLimit');
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@@ -1,9 +1,10 @@
|
|||||||
<?php
|
<?php
|
||||||
|
|
||||||
use Carbon\Carbon;
|
use Carbon\Carbon;
|
||||||
|
use Illuminate\Database\Eloquent\Model as Eloquent;
|
||||||
use Illuminate\Database\QueryException;
|
use Illuminate\Database\QueryException;
|
||||||
use Watson\Validating\ValidatingTrait;
|
use Watson\Validating\ValidatingTrait;
|
||||||
use \Illuminate\Database\Eloquent\Model as Eloquent;
|
|
||||||
/**
|
/**
|
||||||
* Class Limit
|
* Class Limit
|
||||||
*/
|
*/
|
||||||
@@ -13,11 +14,11 @@ class BudgetLimit extends Eloquent
|
|||||||
use ValidatingTrait;
|
use ValidatingTrait;
|
||||||
public static $rules
|
public static $rules
|
||||||
= [
|
= [
|
||||||
'budget_id' => 'required|exists:budgets,id',
|
'budget_id' => 'required|exists:budgets,id',
|
||||||
'startdate' => 'required|date',
|
'startdate' => 'required|date',
|
||||||
'amount' => 'numeric|required|min:0.01',
|
'amount' => 'numeric|required|min:0.01',
|
||||||
'repeats' => 'required|boolean',
|
'repeats' => 'required|boolean',
|
||||||
'repeat_freq' => 'required|in:daily,weekly,monthly,quarterly,half-year,yearly'
|
'repeat_freq' => 'required|in:daily,weekly,monthly,quarterly,half-year,yearly'
|
||||||
|
|
||||||
];
|
];
|
||||||
|
|
||||||
@@ -27,7 +28,7 @@ class BudgetLimit extends Eloquent
|
|||||||
*/
|
*/
|
||||||
public function budget()
|
public function budget()
|
||||||
{
|
{
|
||||||
return $this->belongsTo('Budget','budget_id');
|
return $this->belongsTo('Budget');
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@@ -36,7 +36,7 @@ class Category extends Eloquent
|
|||||||
*/
|
*/
|
||||||
public function transactionjournals()
|
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