1
0
mirror of https://github.com/invoiceninja/invoiceninja.git synced 2024-11-10 13:12:50 +01:00

Merge OFX fixes

This commit is contained in:
Hillel Coren 2017-07-11 13:26:41 +03:00
parent 9812eecd54
commit 0ff4fe09c7

View File

@ -128,6 +128,7 @@ class BankAccountService extends BaseService
return $data;
} catch (\Exception $e) {
Utils::logError($e);
return false;
}
}
@ -183,11 +184,12 @@ class BankAccountService extends BaseService
$ofxParser = new \OfxParser\Parser();
$ofx = $ofxParser->loadFromString($data);
$account->start_date = $ofx->BankAccount->Statement->startDate;
$account->end_date = $ofx->BankAccount->Statement->endDate;
$bankAccount = reset($ofx->bankAccounts);
$account->start_date = $bankAccount->statement->startDate;
$account->end_date = $bankAccount->statement->endDate;
$account->transactions = [];
foreach ($ofx->BankAccount->Statement->transactions as $transaction) {
foreach ($bankAccount->statement->transactions as $transaction) {
// ensure transactions aren't imported as expenses twice
if (isset($expenses[$transaction->uniqueId])) {
continue;