mirror of
https://github.com/firefly-iii/firefly-iii.git
synced 2025-02-25 18:45:27 -06:00
Validation bug.
This commit is contained in:
parent
9f9af0b693
commit
3fc560597c
@ -11,6 +11,7 @@ use FireflyIII\Models\Transaction;
|
|||||||
use FireflyIII\Models\TransactionJournal;
|
use FireflyIII\Models\TransactionJournal;
|
||||||
use FireflyIII\Models\TransactionType;
|
use FireflyIII\Models\TransactionType;
|
||||||
use Illuminate\Support\Collection;
|
use Illuminate\Support\Collection;
|
||||||
|
use Log;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Class JournalRepository
|
* Class JournalRepository
|
||||||
@ -153,6 +154,7 @@ class JournalRepository implements JournalRepositoryInterface
|
|||||||
$toType = AccountType::where('type', 'Cash account')->first();
|
$toType = AccountType::where('type', 'Cash account')->first();
|
||||||
$to = Account::firstOrCreate(['user_id' => $data['user'], 'account_type_id' => $toType->id, 'name' => 'Cash account', 'active' => 1]);
|
$to = Account::firstOrCreate(['user_id' => $data['user'], 'account_type_id' => $toType->id, 'name' => 'Cash account', 'active' => 1]);
|
||||||
}
|
}
|
||||||
|
Log::error('Could not store TO account for Withdrawal (Expense account) because: ' .$to->getErrors()->toJson());
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 'Deposit':
|
case 'Deposit':
|
||||||
|
@ -80,10 +80,12 @@ class FireflyValidator extends Validator
|
|||||||
public function validateUniqueAccountForUser($attribute, $value, $parameters)
|
public function validateUniqueAccountForUser($attribute, $value, $parameters)
|
||||||
{
|
{
|
||||||
// get account type from data, we must have this:
|
// get account type from data, we must have this:
|
||||||
$type = isset($this->data['what']) ? $this->data['what'] : null;
|
$validTypes = [array_keys(Config::get('firefly.subTitlesByIdentifier'))];
|
||||||
|
|
||||||
|
$type = isset($this->data['what']) && in_array($this->data['what'],$validTypes) ? $this->data['what'] : null;
|
||||||
// some fallback:
|
// some fallback:
|
||||||
if(is_null($type)) {
|
if(is_null($type)) {
|
||||||
$type = Input::get('what');
|
$type = in_array(Input::get('what'),$validTypes) ? Input::get('what') : null;
|
||||||
}
|
}
|
||||||
// still null?
|
// still null?
|
||||||
if(is_null($type)) {
|
if(is_null($type)) {
|
||||||
|
Loading…
Reference in New Issue
Block a user