mirror of
https://github.com/firefly-iii/firefly-iii.git
synced 2025-02-25 18:45:27 -06:00
Fix #1238
This commit is contained in:
parent
c8ecb3e0ee
commit
85dc1263ea
@ -56,6 +56,16 @@ class TransactionJournalMetaFactory
|
||||
if ($data['data'] instanceof Carbon) {
|
||||
$value = $data['data']->toW3cString();
|
||||
}
|
||||
if (strlen($value) === 0) {
|
||||
// don't store blank strings.
|
||||
try {
|
||||
$entry->delete();
|
||||
} catch (Exception $e) { // @codeCoverageIgnore
|
||||
Log::error(sprintf('Could not delete transaction journal meta: %s', $e->getMessage())); // @codeCoverageIgnore
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
|
||||
if (null === $entry) {
|
||||
|
@ -23,6 +23,7 @@ declare(strict_types=1);
|
||||
namespace FireflyIII\Repositories\Journal;
|
||||
|
||||
use Carbon\Carbon;
|
||||
use Exception;
|
||||
use FireflyIII\Factory\TransactionJournalFactory;
|
||||
use FireflyIII\Models\Account;
|
||||
use FireflyIII\Models\AccountType;
|
||||
@ -376,6 +377,9 @@ class JournalRepository implements JournalRepositoryInterface
|
||||
*/
|
||||
public function getMetaField(TransactionJournal $journal, string $field): ?string
|
||||
{
|
||||
$class = new \stdClass;
|
||||
$class->value = 'hi there';
|
||||
|
||||
$value = null;
|
||||
$cache = new CacheProperties;
|
||||
$cache->addProperty('journal-meta');
|
||||
@ -394,7 +398,18 @@ class JournalRepository implements JournalRepositoryInterface
|
||||
$value = $entry->data;
|
||||
$cache->store($value);
|
||||
|
||||
return $value;
|
||||
if (is_array($value)) {
|
||||
return join(',', $value);
|
||||
}
|
||||
try {
|
||||
$return = strval($value);
|
||||
} catch (Exception $e) {
|
||||
Log::error($e->getMessage());
|
||||
|
||||
return '';
|
||||
}
|
||||
|
||||
return $return;
|
||||
}
|
||||
|
||||
/**
|
||||
|
Loading…
Reference in New Issue
Block a user