This commit is contained in:
James Cole 2018-08-03 16:55:10 +02:00
parent 2290fcde22
commit 7a9ab190eb
No known key found for this signature in database
GPG Key ID: C16961E655E74B5E
3 changed files with 9 additions and 16 deletions

View File

@ -95,19 +95,13 @@ trait JournalServiceTrait
*/
protected function storeMeta(TransactionJournal $journal, array $data, string $field): void
{
if (!isset($data[$field])) {
Log::debug(sprintf('Want to store meta-field "%s", but no value.', $field));
return;
}
$set = [
'journal' => $journal,
'name' => $field,
'data' => (string)$data[$field],
'data' => (string)($data[$field] ?? ''),
];
Log::debug(sprintf('Going to store meta-field "%s", with value "%s".', $field, (string)$data[$field]));
Log::debug(sprintf('Going to store meta-field "%s", with value "%s".', $set['name'], $set['data']));
/** @var TransactionJournalMetaFactory $factory */
$factory = app(TransactionJournalMetaFactory::class);

View File

@ -183,7 +183,9 @@ class ImportTransaction
$meta = ['sepa-ct-id', 'sepa-ct-op', 'sepa-db', 'sepa-cc', 'sepa-country', 'sepa-batch-id', 'sepa-ep', 'sepa-ci', 'internal-reference', 'date-interest',
'date-invoice', 'date-book', 'date-payment', 'date-process', 'date-due',];
Log::debug(sprintf('Now going to check role "%s".', $role));
if (\in_array($role, $meta, true)) {
Log::debug(sprintf('Role "%s" is in allowed meta roles, so store its value %s.', $role, $columnValue->getValue()));
$this->meta[$role] = $columnValue->getValue();
return;

View File

@ -133,9 +133,9 @@ class ImportableConverter
/**
* @param string|null $date
*
* @return string
* @return string|null
*/
private function convertDateValue(string $date = null): string
private function convertDateValue(string $date = null): ?string
{
$result = null;
if (null !== $date) {
@ -147,11 +147,6 @@ class ImportableConverter
Log::error($e->getTraceAsString());
}
}
if (null === $result) {
$object = new Carbon;
$result = $object->format('Y-m-d');
}
return $result;
}
@ -167,6 +162,8 @@ class ImportableConverter
$foreignAmount = $importable->calculateForeignAmount();
$amount = $importable->calculateAmount();
Log::debug('All meta data: ', $importable->meta);
if ('' === $amount) {
$amount = $foreignAmount;
}
@ -215,7 +212,7 @@ class ImportableConverter
return [
'type' => $transactionType,
'date' => $this->convertDateValue($importable->date),
'date' => $this->convertDateValue($importable->date) ?? Carbon::create()->format('Y-m-d'),
'tags' => $importable->tags,
'user' => $this->importJob->user_id,
'notes' => $importable->note,