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:
parent
1050b76fce
commit
59afb55963
@ -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;
|
||||
}
|
||||
|
||||
|
@ -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;
|
||||
}
|
||||
|
@ -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);
|
||||
|
Loading…
Reference in New Issue
Block a user