mirror of
https://github.com/firefly-iii/firefly-iii.git
synced 2025-09-29 18:20:01 +00:00
Fix #1238
This commit is contained in:
@@ -56,6 +56,16 @@ class TransactionJournalMetaFactory
|
|||||||
if ($data['data'] instanceof Carbon) {
|
if ($data['data'] instanceof Carbon) {
|
||||||
$value = $data['data']->toW3cString();
|
$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) {
|
if (null === $entry) {
|
||||||
|
@@ -23,6 +23,7 @@ declare(strict_types=1);
|
|||||||
namespace FireflyIII\Repositories\Journal;
|
namespace FireflyIII\Repositories\Journal;
|
||||||
|
|
||||||
use Carbon\Carbon;
|
use Carbon\Carbon;
|
||||||
|
use Exception;
|
||||||
use FireflyIII\Factory\TransactionJournalFactory;
|
use FireflyIII\Factory\TransactionJournalFactory;
|
||||||
use FireflyIII\Models\Account;
|
use FireflyIII\Models\Account;
|
||||||
use FireflyIII\Models\AccountType;
|
use FireflyIII\Models\AccountType;
|
||||||
@@ -376,6 +377,9 @@ class JournalRepository implements JournalRepositoryInterface
|
|||||||
*/
|
*/
|
||||||
public function getMetaField(TransactionJournal $journal, string $field): ?string
|
public function getMetaField(TransactionJournal $journal, string $field): ?string
|
||||||
{
|
{
|
||||||
|
$class = new \stdClass;
|
||||||
|
$class->value = 'hi there';
|
||||||
|
|
||||||
$value = null;
|
$value = null;
|
||||||
$cache = new CacheProperties;
|
$cache = new CacheProperties;
|
||||||
$cache->addProperty('journal-meta');
|
$cache->addProperty('journal-meta');
|
||||||
@@ -394,7 +398,18 @@ class JournalRepository implements JournalRepositoryInterface
|
|||||||
$value = $entry->data;
|
$value = $entry->data;
|
||||||
$cache->store($value);
|
$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;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
Reference in New Issue
Block a user