mirror of
https://github.com/invoiceninja/invoiceninja.git
synced 2025-06-23 20:00:33 -04:00
Fixes for bank transactions:
This commit is contained in:
parent
73acc1b7d5
commit
8f0fc3a303
@ -79,24 +79,36 @@ class ProcessBankTransactions implements ShouldQueue
|
|||||||
'accountId' => $this->bank_integration->bank_account_id,
|
'accountId' => $this->bank_integration->bank_account_id,
|
||||||
];
|
];
|
||||||
|
|
||||||
|
//Get transaction count object
|
||||||
$transaction_count = $yodlee->getTransactionCount($data);
|
$transaction_count = $yodlee->getTransactionCount($data);
|
||||||
|
|
||||||
|
//Get int count
|
||||||
$count = $transaction_count->transaction->TOTAL->count;
|
$count = $transaction_count->transaction->TOTAL->count;
|
||||||
|
|
||||||
//expense transactions
|
//get transactions array
|
||||||
$transactions = $yodlee->getTransactions($data);
|
$transactions = $yodlee->getTransactions($data);
|
||||||
|
|
||||||
if(count($transactions) == 0)
|
//if no transactions, update the from_date and move on
|
||||||
return;
|
if(count($transactions) == 0){
|
||||||
|
|
||||||
|
$this->bank_integration->from_date = now();
|
||||||
|
$this->bank_integration->save();
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
//Harvest the company
|
||||||
$company = $this->bank_integration->company;
|
$company = $this->bank_integration->company;
|
||||||
|
|
||||||
MultiDB::setDb($company->db);
|
MultiDB::setDb($company->db);
|
||||||
|
|
||||||
|
/*Get the user */
|
||||||
$user_id = $company->owner()->id;
|
$user_id = $company->owner()->id;
|
||||||
|
|
||||||
|
/* Unguard the model to perform batch inserts */
|
||||||
BankTransaction::unguard();
|
BankTransaction::unguard();
|
||||||
|
|
||||||
|
$now = now();
|
||||||
|
|
||||||
foreach($transactions as $transaction)
|
foreach($transactions as $transaction)
|
||||||
{
|
{
|
||||||
|
|
||||||
@ -109,8 +121,8 @@ class ProcessBankTransactions implements ShouldQueue
|
|||||||
'company_id' => $company->id,
|
'company_id' => $company->id,
|
||||||
'user_id' => $user_id,
|
'user_id' => $user_id,
|
||||||
'bank_integration_id' => $this->bank_integration->id,
|
'bank_integration_id' => $this->bank_integration->id,
|
||||||
'created_at' => now(),
|
'created_at' => $now,
|
||||||
'updated_at' => now(),
|
'updated_at' => $now,
|
||||||
])
|
])
|
||||||
);
|
);
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user