diff --git a/app/Import/Specifics/IngDescription.php b/app/Import/Specifics/IngDescription.php new file mode 100644 index 0000000000..15595084f3 --- /dev/null +++ b/app/Import/Specifics/IngDescription.php @@ -0,0 +1,112 @@ +row = $row; + if (count($this->row) >= 8) { // check if the array is correct + switch ($this->row[4]) { // Get value for the mutation type + case 'GT': // InternetBanieren + case 'OV': // Overschrijving + case 'VZ': // Verzamelbetaling + case 'IC': // Incasso + $this->removeIBANIngDescription(); + $this->removeNameIngDescription(); + break; + case 'BA' : // Betaalautomaat + $this->addNameIngDescription(); + break; + } + } + + return $this->row; + } + + /** + * Remove IBAN number out of the description + * Default description of Description is: Naam: Omschrijving: IBAN: + * + * @return bool true + */ + protected function removeIBANIngDescription() + { + // Try replace the iban number with nothing. The IBAN nr is found in the third row + $this->row[8] = preg_replace('/\sIBAN:\s'.$this->row[3].'/', '', $this->row[8]); + return true; + } + + + /** + * Remove name from the description (Remove everything before the description incl the word 'Omschrijving' ) + * + * @return bool true + */ + protected function removeNameIngDescription() + { + // Try remove everything bevore the 'Omschrijving' + $this->row[8] = preg_replace('/.+Omschrijving: /', '', $this->row[8]); + return true; + } + + + /** + * Add the Opposing name from cell 1 in the description for Betaalautomaten + * Otherwise the description is only: 'Pasvolgnr: Transactie: Term:' + * + * @return bool true + */ + protected function addNameIngDescription() + { + $this->row[8] = $this->row[1]. " " . $this->row[8]; + return true; + } + +} diff --git a/config/csv.php b/config/csv.php index 6fc0ffa20a..4cd4835d83 100644 --- a/config/csv.php +++ b/config/csv.php @@ -8,6 +8,7 @@ return [ * Configuration for the CSV specifics. */ 'import_specifics' => [ + 'IngDescription' => 'FireflyIII\Import\Specifics\IngDescription', 'RabobankDescription' => 'FireflyIII\Import\Specifics\RabobankDescription', 'AbnAmroDescription' => 'FireflyIII\Import\Specifics\AbnAmroDescription', 'PresidentsChoice' => 'FireflyIII\Import\Specifics\PresidentsChoice',