mirror of
https://github.com/firefly-iii/firefly-iii.git
synced 2025-02-12 00:15:50 -06:00
Parse description from FinTSTransaction
This commit is contained in:
parent
78cd1629de
commit
4e48961c2b
@ -145,7 +145,7 @@ class StageImportDataHandler
|
||||
'user' => $this->importJob->user_id,
|
||||
'type' => $type,
|
||||
'date' => $transaction->getValutaDate()->format('Y-m-d'),
|
||||
'description' => $transaction->getDescription1(),
|
||||
'description' => $this->getDescription($transaction),
|
||||
'piggy_bank_id' => null,
|
||||
'piggy_bank_name' => null,
|
||||
'bill_id' => null,
|
||||
@ -182,4 +182,14 @@ class StageImportDataHandler
|
||||
|
||||
return $storeData;
|
||||
}
|
||||
|
||||
private function getDescription(FinTSTransaction $transaction)
|
||||
{
|
||||
//Given a description like 'EREF+AbcCRED+DE123SVWZ+DefABWA+Ghi' or 'EREF+AbcCRED+DE123SVWZ+Def' return 'Def'
|
||||
$finTSDescription = $transaction->getDescription1();
|
||||
if (preg_match('/SVWZ\+([^\+]*)([A-Z]{4}\+|$)/', $finTSDescription, $matches) === 1) {
|
||||
return $matches[1];
|
||||
}
|
||||
return $finTSDescription;
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue
Block a user