Skip to content

Firefly III: a personal finances manager

Fixed Rabo importer.

James Cole20cffd050235
diff --git a/app/Helpers/Csv/PostProcessing/OpposingAccount.php b/app/Helpers/Csv/PostProcessing/OpposingAccount.php
index f7690438be..146e15d931 100644
--- a/app/Helpers/Csv/PostProcessing/OpposingAccount.php
+++ b/app/Helpers/Csv/PostProcessing/OpposingAccount.php
@@ -24,6 +24,10 @@ class OpposingAccount implements PostProcessorInterface
*/
public function process()
{
+ // three values:
+ // opposing-account-id, opposing-account-iban, opposing-account-name
+
+
$result = $this->checkIdNameObject();
if (!is_null($result)) {
return $result;
@@ -56,11 +60,13 @@ class OpposingAccount implements PostProcessorInterface
protected function checkIdNameObject()
{
if ($this->data['opposing-account-id'] instanceof Account) { // first priority. try to find the account based on ID, if any
+ Log::debug('OpposingAccountPostProcession: opposing-account-id is an Account.');
$this->data['opposing-account-object'] = $this->data['opposing-account-id'];
return $this->data;
}
if ($this->data['opposing-account-iban'] instanceof Account) { // second: try to find the account based on IBAN, if any.
+ Log::debug('OpposingAccountPostProcession: opposing-account-iban is an Account.');
$this->data['opposing-account-object'] = $this->data['opposing-account-iban'];
return $this->data;
@@ -75,9 +81,12 @@ class OpposingAccount implements PostProcessorInterface
protected function checkIbanString()
{
$rules = ['iban' => 'iban'];
- $check = ['iban' => $this->data['opposing-account-iban']];
+ $iban = $this->data['opposing-account-iban'];
+ $check = ['iban' => $iban];
$validator = Validator::make($check, $rules);
- if (!$validator->fails()) {
+ if (is_string($iban) && strlen($iban) > 0 && !$validator->fails()) {
+
+ Log::debug('OpposingAccountPostProcession: opposing-account-iban is a string (' . $this->data['opposing-account-iban'] . ').');
$this->data['opposing-account-object'] = $this->parseIbanString();
return $this->data;
@@ -95,12 +104,14 @@ class OpposingAccount implements PostProcessorInterface
$accounts = Auth::user()->accounts()->get();
foreach ($accounts as $entry) {
if ($entry->iban == $this->data['opposing-account-iban']) {
+ Log::debug('OpposingAccountPostProcession: opposing-account-iban matches an Account.');
return $entry;
}
}
$account = $this->createAccount();
+
return $account;
}
@@ -123,6 +134,7 @@ class OpposingAccount implements PostProcessorInterface
'active' => true,
]
);
+ Log::debug('OpposingAccountPostProcession: created a new account.');
return $account;
}
@@ -153,11 +165,13 @@ class OpposingAccount implements PostProcessorInterface
protected function checkNameString()
{
if ($this->data['opposing-account-name'] instanceof Account) { // third: try to find account based on name, if any.
+ Log::debug('OpposingAccountPostProcession: opposing-account-name is an Account.');
$this->data['opposing-account-object'] = $this->data['opposing-account-name'];
return $this->data;
}
if (is_string($this->data['opposing-account-name'])) {
+
$this->data['opposing-account-object'] = $this->parseNameString();
return $this->data;
diff --git a/app/Validation/FireflyValidator.php b/app/Validation/FireflyValidator.php
index faa07a5e49..c878a6fd82 100644
--- a/app/Validation/FireflyValidator.php
+++ b/app/Validation/FireflyValidator.php
@@ -65,6 +65,9 @@ class FireflyValidator extends Validator
if (!is_string($value)) {
return false;
}
+ if (is_null($value)) {
+ return false;
+ }
if (strlen($value) === 0) {
return false;