From d90321aa1e7a0252191804796767a8bf53fb5eeb Mon Sep 17 00:00:00 2001 From: James Cole Date: Sun, 8 Jan 2023 19:24:28 +0100 Subject: [PATCH] Catch bad upgrade command. --- app/Console/Commands/Upgrade/UpgradeLiabilitiesEight.php | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/app/Console/Commands/Upgrade/UpgradeLiabilitiesEight.php b/app/Console/Commands/Upgrade/UpgradeLiabilitiesEight.php index 54d47f9a72..ee05391032 100644 --- a/app/Console/Commands/Upgrade/UpgradeLiabilitiesEight.php +++ b/app/Console/Commands/Upgrade/UpgradeLiabilitiesEight.php @@ -140,7 +140,10 @@ class UpgradeLiabilitiesEight extends Command Log::debug(sprintf('Upgrade liability #%d ("%s")', $account->id, $account->name)); $direction = $repository->getMetaValue($account, 'liability_direction'); - if ('debit' === $direction && $this->hasBadOpening($account)) { + if ('debit' === $direction) { + Log::debug('Direction is debit ("I owe this amount"), so no need to upgrade.'); + } + if ('credit' === $direction && $this->hasBadOpening($account)) { $this->deleteCreditTransaction($account); $this->line(sprintf('Fixed correct bad opening for liability #%d ("%s")', $account->id, $account->name)); } @@ -203,6 +206,7 @@ class UpgradeLiabilitiesEight extends Command Log::debug('Account has opening/credit not on the same day.'); return false; } + Log::debug('Account has bad opening balance data.'); return true; }