mirror of
https://github.com/firefly-iii/firefly-iii.git
synced 2025-10-12 15:35:15 +00:00
Fix various code.
This commit is contained in:
@@ -55,7 +55,7 @@ class CreateAutoBudgetLimits implements ShouldQueue
|
||||
*/
|
||||
public function __construct(?Carbon $date)
|
||||
{
|
||||
if (null !== $date) {
|
||||
if ($date instanceof Carbon) {
|
||||
$newDate = clone $date;
|
||||
$newDate->startOfDay();
|
||||
$this->date = $newDate;
|
||||
@@ -127,7 +127,7 @@ class CreateAutoBudgetLimits implements ShouldQueue
|
||||
// find budget limit:
|
||||
$budgetLimit = $this->findBudgetLimit($autoBudget->budget, $start, $end);
|
||||
|
||||
if (null === $budgetLimit && AutoBudgetType::AUTO_BUDGET_RESET->value === (int) $autoBudget->auto_budget_type) {
|
||||
if (!$budgetLimit instanceof BudgetLimit && AutoBudgetType::AUTO_BUDGET_RESET->value === (int) $autoBudget->auto_budget_type) {
|
||||
// that's easy: create one.
|
||||
// do nothing else.
|
||||
$this->createBudgetLimit($autoBudget, $start, $end);
|
||||
@@ -136,14 +136,14 @@ class CreateAutoBudgetLimits implements ShouldQueue
|
||||
return;
|
||||
}
|
||||
|
||||
if (null === $budgetLimit && AutoBudgetType::AUTO_BUDGET_ROLLOVER->value === (int) $autoBudget->auto_budget_type) {
|
||||
if (!$budgetLimit instanceof BudgetLimit && AutoBudgetType::AUTO_BUDGET_ROLLOVER->value === (int) $autoBudget->auto_budget_type) {
|
||||
// budget limit exists already,
|
||||
$this->createRollover($autoBudget);
|
||||
app('log')->debug(sprintf('Done with auto budget #%d', $autoBudget->id));
|
||||
|
||||
return;
|
||||
}
|
||||
if (null === $budgetLimit && AutoBudgetType::AUTO_BUDGET_ADJUSTED->value === (int) $autoBudget->auto_budget_type) {
|
||||
if (!$budgetLimit instanceof BudgetLimit && AutoBudgetType::AUTO_BUDGET_ADJUSTED->value === (int) $autoBudget->auto_budget_type) {
|
||||
// budget limit exists already,
|
||||
$this->createAdjustedLimit($autoBudget);
|
||||
app('log')->debug(sprintf('Done with auto budget #%d', $autoBudget->id));
|
||||
@@ -256,7 +256,7 @@ class CreateAutoBudgetLimits implements ShouldQueue
|
||||
// has budget limit in previous period?
|
||||
$budgetLimit = $this->findBudgetLimit($autoBudget->budget, $previousStart, $previousEnd);
|
||||
|
||||
if (null === $budgetLimit) {
|
||||
if (!$budgetLimit instanceof BudgetLimit) {
|
||||
app('log')->debug('No budget limit exists in previous period, so create one.');
|
||||
// if not, create it and we're done.
|
||||
$this->createBudgetLimit($autoBudget, $start, $end);
|
||||
@@ -316,7 +316,7 @@ class CreateAutoBudgetLimits implements ShouldQueue
|
||||
// has budget limit in previous period?
|
||||
$budgetLimit = $this->findBudgetLimit($autoBudget->budget, $previousStart, $previousEnd);
|
||||
|
||||
if (null === $budgetLimit) {
|
||||
if (!$budgetLimit instanceof BudgetLimit) {
|
||||
app('log')->debug('No budget limit exists in previous period, so create one.');
|
||||
// if not, create standard amount, and we're done.
|
||||
$this->createBudgetLimit($autoBudget, $start, $end);
|
||||
|
Reference in New Issue
Block a user