mirror of
https://github.com/firefly-iii/firefly-iii.git
synced 2025-10-12 15:35:15 +00:00
Some more work on the transactions.
This commit is contained in:
@@ -191,11 +191,16 @@ class TransactionJournal implements TransactionJournalInterface, CUD, CommonData
|
||||
$errors->add('date', 'This date is invalid.');
|
||||
}
|
||||
|
||||
if (isset($model['to_id']) && intval($model['to_id']) < 0) {
|
||||
if (isset($model['to_id']) && intval($model['to_id']) < 1) {
|
||||
$errors->add('account_to', 'Invalid to-account');
|
||||
}
|
||||
if (isset($model['from_id']) && intval($model['from_id']) < 0) {
|
||||
|
||||
if (isset($model['from_id']) && intval($model['from_id']) < 1) {
|
||||
$errors->add('account_from', 'Invalid from-account');
|
||||
|
||||
}
|
||||
if (isset($model['account_id']) && intval($model['account_id']) < 1) {
|
||||
$errors->add('account_id', 'Invalid account!');
|
||||
}
|
||||
if (isset($model['to']) && !($model['to'] instanceof \Account)) {
|
||||
$errors->add('account_to', 'Invalid to-account');
|
||||
@@ -208,6 +213,7 @@ class TransactionJournal implements TransactionJournalInterface, CUD, CommonData
|
||||
}
|
||||
if (!isset($model['from']) && !isset($model['to'])) {
|
||||
$errors->add('account_to', 'No accounts found!');
|
||||
$errors->add('account_id', 'No accounts found!');
|
||||
}
|
||||
|
||||
$validator = \Validator::make([$model], \Transaction::$rules);
|
||||
@@ -358,7 +364,6 @@ class TransactionJournal implements TransactionJournalInterface, CUD, CommonData
|
||||
}
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Finds an account type using one of the "$what"'s: expense, asset, revenue, opening, etc.
|
||||
*
|
||||
|
Reference in New Issue
Block a user