From 8c552b8fa82f32d4ec164153c8f3e6a457f844eb Mon Sep 17 00:00:00 2001 From: Ruben Verhoef Date: Thu, 26 Mar 2020 19:52:30 +0100 Subject: [PATCH] Fix functions `moveValutadatumDescription` and `removeNameIngDescription` --- app/Import/Specifics/IngDescription.php | 13 +++++-------- 1 file changed, 5 insertions(+), 8 deletions(-) diff --git a/app/Import/Specifics/IngDescription.php b/app/Import/Specifics/IngDescription.php index f33062a58e..a8cd78a2c7 100644 --- a/app/Import/Specifics/IngDescription.php +++ b/app/Import/Specifics/IngDescription.php @@ -112,9 +112,10 @@ class IngDescription implements SpecificInterface protected function moveValutadatumDescription(): void { $matches = []; - preg_match('/Valutadatum: ([0-9-]+)/', $this->row[8], $matches); - $this->row[9] = date("Ymd", strtotime($matches[1])); - $this->row[8] = preg_replace('/Valutadatum: [0-9-]+/', '', $this->row[8]); + if (preg_match('/Valutadatum: ([0-9-]+)/', $this->row[8], $matches)) { + $this->row[9] = date("Ymd", strtotime($matches[1])); + $this->row[8] = preg_replace('/Valutadatum: [0-9-]+/', '', $this->row[8]); + } } /** @@ -140,11 +141,7 @@ class IngDescription implements SpecificInterface */ protected function removeNameIngDescription(): void { - $matches = []; - if (preg_match('/Valutadatum: ([0-9-]+)/', $this->row[8], $matches)) { - $this->row[9] = date("Ymd", strtotime($matches[1])); - $this->row[8] = preg_replace('/Valutadatum: [0-9-]+/', '', $this->row[8]); - } + $this->row[8] = preg_replace('/Naam:.*?([a-zA-Z\/]+:)/', '$1', $this->row[8]); } /**