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

ensure bank integration id is always present

This commit is contained in:
David Bomba 2022-11-14 09:33:04 +11:00
parent 1050b76fce
commit 59afb55963
3 changed files with 7 additions and 1 deletions

View File

@ -34,6 +34,9 @@ class StoreBankTransactionRequest extends Request
$rules = [];
if(isset($this->bank_integration_id))
$rules['bank_integration_id'] = 'bail|required|exists:bank_integrations,id,company_id,'.auth()->user()->company()->id.',is_deleted,0';
return $rules;
}

View File

@ -45,6 +45,9 @@ class UpdateBankTransactionRequest extends Request
if(isset($this->expense_id))
$rules['expense_id'] = 'bail|required|exists:expenses,id,company_id,'.auth()->user()->company()->id.',is_deleted,0';
if(isset($this->bank_integration_id))
$rules['bank_integration_id'] = 'bail|required|exists:bank_integrations,id,company_id,'.auth()->user()->company()->id.',is_deleted,0';
return $rules;
}

View File

@ -24,7 +24,7 @@ class BankTransactionRepository extends BaseRepository
public function save($data, BankTransaction $bank_transaction)
{
if(!isset($bank_transaction->bank_integration_id) && array_key_exists('bank_integration_id', $data))
if(array_key_exists('bank_integration_id', $data))
$bank_transaction->bank_integration_id = $data['bank_integration_id'];
$bank_transaction->fill($data);