Skip to content

Commit

Permalink
Add extra check
Browse files Browse the repository at this point in the history
  • Loading branch information
JC5 committed Jul 16, 2022
1 parent da92271 commit 9a3c5ff
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions app/Services/Shared/Import/Routine/ApiSubmitter.php
Original file line number Diff line number Diff line change
Expand Up @@ -233,7 +233,7 @@ private function searchField(string $field, string $value): int
*/
private function processTransaction(int $index, array $line): array
{
$line = $this->replaceMappings($line);
$line = $this->cleanupLine($line);
$return = [];
$url = SecretManager::getBaseUrl();
$token = SecretManager::getAccessToken();
Expand Down Expand Up @@ -329,7 +329,7 @@ private function processTransaction(int $index, array $line): array
* @param array $line
* @return array
*/
private function replaceMappings(array $line): array
private function cleanupLine(array $line): array
{
app('log')->debug('Going to map data for this line.');
if (array_key_exists(0, $this->mapping)) {
Expand Down Expand Up @@ -359,6 +359,9 @@ private function replaceMappings(array $line): array
app('log')->debug(sprintf('Replaced source name "%s" with a reference to account id #%d', $source, $this->mapping[0][$source]));
}
}
if ('' === trim((string) $transaction['description'] ?? '')) {
$transaction['description'] = '(no description)';
}
$line['transactions'][$index] = $this->updateTransactionType($transaction);
}
}
Expand Down

0 comments on commit 9a3c5ff

Please sign in to comment.