Firefly III: a personal finances manager
PHP accountingbudgetbudgetingbudgetscash-flowcashflowcredit-carddockerexpensesfinancefinancesfinanciallinuxmoneypaycheckpersonal-financephpphp7
Fix #2956
James Coled116609389d8
diff --git a/app/Http/Controllers/Account/ReconcileController.php b/app/Http/Controllers/Account/ReconcileController.phpindex 0c862a9419..fd112c3691 100644--- a/app/Http/Controllers/Account/ReconcileController.php+++ b/app/Http/Controllers/Account/ReconcileController.php@@ -90,6 +90,7 @@ class ReconcileController extends Controllerreturn $this->redirectAccountToAccount($account); // @codeCoverageIgnore}+if (AccountType::ASSET !== $account->accountType->type) {// @codeCoverageIgnoreStartsession()->flash('error', (string)trans('firefly.must_be_asset_account'));@@ -117,6 +118,9 @@ class ReconcileController extends Controller$end = app('navigation')->endOfPeriod($start, $range);}// @codeCoverageIgnoreEnd+ if ($end->lt($start)) {+ [$start, $end] = [$end, $start];+ }$startDate = clone $start;$startDate->subDay();@@ -163,6 +167,11 @@ class ReconcileController extends Controller}Log::debug('Reconciled all transactions.');+ // switch dates if necessary+ if ($end->lt($start)) {+ [$start, $end] = [$end, $start];+ }+// create reconciliation transaction (if necessary):$result = '';if ('create' === $data['reconcile']) {@@ -182,9 +191,16 @@ class ReconcileController extends Controller/*** Creates a reconciliation group.+ *+ * @param Account $account+ * @param Carbon $start+ * @param Carbon $end+ * @param string $difference+ ** @return string+ * @throws \FireflyIII\Exceptions\DuplicateTransactionException*/- private function createReconciliation(Account $account, Carbon $start, Carbon $end, string $difference): string+ private function createReconciliation(Account $account, Carbon $start, Carbon $end, string $difference){if (!$this->isEditableAccount($account)) {return $this->redirectAccountToAccount($account); // @codeCoverageIgnore@@ -199,6 +215,10 @@ class ReconcileController extends Controller$destination = $reconciliation;}+ if ($end->lt($start)) {+ [$start, $end] = [$end, $start];+ }+// title:$description = trans('firefly.reconciliation_transaction_title',['from' => $start->formatLocalized($this->monthAndDayFormat), 'to' => $end->formatLocalized($this->monthAndDayFormat)]);diff --git a/app/Http/Controllers/Json/ReconcileController.php b/app/Http/Controllers/Json/ReconcileController.phpindex b8f9491843..38f1a52f62 100644--- a/app/Http/Controllers/Json/ReconcileController.php+++ b/app/Http/Controllers/Json/ReconcileController.php@@ -93,6 +93,11 @@ class ReconcileController extends Controller$accountCurrency = $this->accountRepos->getAccountCurrency($account) ?? app('amount')->getDefaultCurrency();$amount = '0';$clearedAmount = '0';++ if ($end->lt($start)) {+ [$start, $end] = [$end, $start];+ }+$route = route('accounts.reconcile.submit', [$account->id, $start->format('Ymd'), $end->format('Ymd')]);$selectedIds = $request->get('journals') ?? [];$clearedJournals = [];@@ -171,6 +176,9 @@ class ReconcileController extends Controller*/public function transactions(Account $account, Carbon $start, Carbon $end){+ if ($end->lt($start)) {+ [$end, $start] = [$start, $end];+ }$startDate = clone $start;$startDate->subDay();