Disable fix for the moment.

This commit is contained in:
James Cole
2025-05-11 07:29:18 +02:00
parent 9b6314066b
commit 01502b456e

View File

@@ -326,7 +326,6 @@ class CorrectsUnevenAmount extends Command
Log::debug('Destination is a liability account, source is an asset account, return TRUE.'); Log::debug('Destination is a liability account, source is an asset account, return TRUE.');
return true; return true;
} }
Log::debug('Not between asset and liability, return FALSE');
return false; return false;
} }
@@ -361,6 +360,8 @@ class CorrectsUnevenAmount extends Command
} }
$source = $journal->transactions()->where('amount', '<', 0)->first(); $source = $journal->transactions()->where('amount', '<', 0)->first();
$destination = $journal->transactions()->where('amount', '>', 0)->first(); $destination = $journal->transactions()->where('amount', '>', 0)->first();
$sourceAccount = $source->account;
$destAccount = $destination->account;
if (null === $source || null === $destination) { if (null === $source || null === $destination) {
Log::debug('Either transaction is NULL, continue.'); Log::debug('Either transaction is NULL, continue.');
@@ -372,15 +373,16 @@ class CorrectsUnevenAmount extends Command
continue; continue;
} }
Log::debug('Ready to swap data between transactions.'); Log::debug('Ready to swap data between transactions.');
$destination->foreign_currency_id = $source->transaction_currency_id; // // only fix the destination transaction
$destination->foreign_amount = app('steam')->positive($source->amount); // $destination->foreign_currency_id = $source->transaction_currency_id;
$destination->transaction_currency_id = $source->foreign_currency_id; // $destination->foreign_amount = app('steam')->positive($source->amount);
$destination->amount = app('steam')->positive($source->foreign_amount); // $destination->transaction_currency_id = $source->foreign_currency_id;
$destination->balance_dirty = true; // $destination->amount = app('steam')->positive($source->foreign_amount);
$source->balance_dirty = true; // $destination->balance_dirty = true;
$destination->save(); // $source->balance_dirty = true;
$source->save(); // $destination->save();
$this->friendlyWarning(sprintf('Corrected foreign amounts of transaction #%d.', $journal->id)); // $source->save();
// $this->friendlyWarning(sprintf('Corrected foreign amounts of transaction #%d.', $journal->id));
++$count; ++$count;
} }
if (0 === $count) { if (0 === $count) {