mirror of
https://github.com/firefly-iii/firefly-iii.git
synced 2025-10-25 21:16:47 +00:00
Improve tests, models and views.
This commit is contained in:
@@ -291,7 +291,7 @@ class TransactionController extends Controller
|
||||
|
||||
$selectedGroup = $collector->getGroups()->first();
|
||||
if (null === $selectedGroup) {
|
||||
throw new NotFoundHttpException();
|
||||
throw new NotFoundHttpException(); // @codeCoverageIgnore
|
||||
}
|
||||
/** @var TransactionGroupTransformer $transformer */
|
||||
$transformer = app(TransactionGroupTransformer::class);
|
||||
@@ -335,7 +335,7 @@ class TransactionController extends Controller
|
||||
|
||||
$selectedGroup = $collector->getGroups()->first();
|
||||
if (null === $selectedGroup) {
|
||||
throw new NotFoundHttpException();
|
||||
throw new NotFoundHttpException(); // @codeCoverageIgnore
|
||||
}
|
||||
/** @var TransactionGroupTransformer $transformer */
|
||||
$transformer = app(TransactionGroupTransformer::class);
|
||||
|
||||
@@ -182,7 +182,7 @@ class TransactionStoreRequest extends Request
|
||||
// the group must have a description if > 1 journal.
|
||||
$this->validateGroupDescription($validator);
|
||||
|
||||
// TODO validate that the currency fits the source and/or destination account.
|
||||
// TODO the currency info must match the accounts involved.
|
||||
|
||||
}
|
||||
);
|
||||
@@ -217,8 +217,8 @@ class TransactionStoreRequest extends Request
|
||||
'foreign_currency_code' => $this->stringFromValue($object['foreign_currency_code']),
|
||||
|
||||
// amount and foreign amount. Cannot be 0.
|
||||
'amount' => $this->stringFromValue($object['amount']),
|
||||
'foreign_amount' => $this->stringFromValue($object['foreign_amount']),
|
||||
'amount' => $this->stringFromValue((string)$object['amount']),
|
||||
'foreign_amount' => $this->stringFromValue((string)$object['foreign_amount']),
|
||||
|
||||
// description.
|
||||
'description' => $this->stringFromValue($object['description']),
|
||||
|
||||
@@ -237,13 +237,12 @@ class TransactionUpdateRequest extends Request
|
||||
// all transaction types must be equal:
|
||||
$this->validateTransactionTypesForUpdate($validator);
|
||||
|
||||
// if type is set, source + destination info is mandatory.
|
||||
$this->validateAccountPresence($validator);
|
||||
|
||||
// validate source/destination is equal, depending on the transaction journal type.
|
||||
$this->validateEqualAccountsForUpdate($validator, $transactionGroup);
|
||||
|
||||
// TODO if type is set, source + destination info is mandatory.
|
||||
// TODO validate that the currency fits the source and/or destination account.
|
||||
// TODO the currency info must match the accounts involved.
|
||||
|
||||
// all journals must have a description
|
||||
//$this->validateDescriptions($validator);
|
||||
@@ -308,7 +307,7 @@ class TransactionUpdateRequest extends Request
|
||||
|
||||
foreach ($this->arrayFields as $fieldName) {
|
||||
if (array_key_exists($fieldName, $transaction)) {
|
||||
$current[$fieldName] = $this->arrayFromValue((string)$transaction[$fieldName]);
|
||||
$current[$fieldName] = $this->arrayFromValue($transaction[$fieldName]);
|
||||
}
|
||||
}
|
||||
$return[] = $current;
|
||||
|
||||
Reference in New Issue
Block a user