mirror of
https://github.com/firefly-iii/firefly-iii.git
synced 2025-02-25 18:45:27 -06:00
Strip newlines and tabs from description.
This commit is contained in:
parent
82e7202ad2
commit
8fd64791d6
@ -36,6 +36,11 @@ use Log;
|
|||||||
*/
|
*/
|
||||||
class TransactionJournalFactory
|
class TransactionJournalFactory
|
||||||
{
|
{
|
||||||
|
/** @var User The user */
|
||||||
|
private $user;
|
||||||
|
|
||||||
|
use JournalServiceTrait, TransactionTypeTrait;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Constructor.
|
* Constructor.
|
||||||
*/
|
*/
|
||||||
@ -46,10 +51,6 @@ class TransactionJournalFactory
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
use JournalServiceTrait, TransactionTypeTrait;
|
|
||||||
/** @var User The user */
|
|
||||||
private $user;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Store a new transaction journal.
|
* Store a new transaction journal.
|
||||||
*
|
*
|
||||||
@ -67,13 +68,15 @@ class TransactionJournalFactory
|
|||||||
$type = $this->findTransactionType($data['type']);
|
$type = $this->findTransactionType($data['type']);
|
||||||
$defaultCurrency = app('amount')->getDefaultCurrencyByUser($this->user);
|
$defaultCurrency = app('amount')->getDefaultCurrencyByUser($this->user);
|
||||||
Log::debug(sprintf('Going to store a %s', $type->type));
|
Log::debug(sprintf('Going to store a %s', $type->type));
|
||||||
|
$description = app('steam')->cleanString($data['description']);
|
||||||
|
$description = str_replace(["\n", "\t", "\r"], "\x20", $description);
|
||||||
$journal = TransactionJournal::create(
|
$journal = TransactionJournal::create(
|
||||||
[
|
[
|
||||||
'user_id' => $data['user'],
|
'user_id' => $data['user'],
|
||||||
'transaction_type_id' => $type->id,
|
'transaction_type_id' => $type->id,
|
||||||
'bill_id' => null,
|
'bill_id' => null,
|
||||||
'transaction_currency_id' => $defaultCurrency->id,
|
'transaction_currency_id' => $defaultCurrency->id,
|
||||||
'description' => $data['description'],
|
'description' => $description,
|
||||||
'date' => $data['date']->format('Y-m-d'),
|
'date' => $data['date']->format('Y-m-d'),
|
||||||
'order' => 0,
|
'order' => 0,
|
||||||
'tag_count' => 0,
|
'tag_count' => 0,
|
||||||
|
Loading…
Reference in New Issue
Block a user