This commit is contained in:
James Cole
2022-10-04 20:31:57 +02:00
9 changed files with 274 additions and 46 deletions

View File

@@ -293,6 +293,7 @@ trait JournalServiceTrait
if ('' === $amount) {
throw new FireflyException(sprintf('The amount cannot be an empty string: "%s"', $amount));
}
Log::debug(sprintf('Now in getAmount("%s")', $amount));
if (0 === bccomp('0', $amount)) {
throw new FireflyException(sprintf('The amount seems to be zero: "%s"', $amount));
}

View File

@@ -48,6 +48,7 @@ class GroupUpdateService
*/
public function update(TransactionGroup $transactionGroup, array $data): TransactionGroup
{
Log::debug(sprintf('Now in %s', __METHOD__));
Log::debug('Now in group update service', $data);
/** @var array $transactions */
$transactions = $data['transactions'] ?? [];
@@ -117,6 +118,7 @@ class GroupUpdateService
*/
private function updateTransactionJournal(TransactionGroup $transactionGroup, TransactionJournal $journal, array $data): void
{
Log::debug(sprintf('Now in %s', __METHOD__));
if (empty($data)) {
return;
}
@@ -141,6 +143,7 @@ class GroupUpdateService
*/
private function updateTransactions(TransactionGroup $transactionGroup, array $transactions): array
{
Log::debug(sprintf('Now in %s', __METHOD__));
// updated or created transaction journals:
$updated = [];
/**

View File

@@ -126,6 +126,7 @@ class JournalUpdateService
*/
public function update(): void
{
Log::debug(sprintf('Now in %s', __METHOD__));
Log::debug(sprintf('Now in JournalUpdateService for journal #%d.', $this->transactionJournal->id));
if ($this->removeReconciliation()) {
@@ -690,11 +691,13 @@ class JournalUpdateService
*/
private function updateAmount(): void
{
Log::debug(sprintf('Now in %s', __METHOD__));
if (!$this->hasFields(['amount'])) {
return;
}
$value = $this->data['amount'] ?? '';
Log::debug(sprintf('Amount is now "%s"', $value));
try {
$amount = $this->getAmount($value);
} catch (FireflyException $e) {