mirror of
https://github.com/firefly-iii/firefly-iii.git
synced 2024-12-01 21:19:11 -06:00
This commit is contained in:
parent
280762fff3
commit
ec93b7b5a0
@ -481,6 +481,7 @@ class GroupCollector implements GroupCollectorInterface
|
|||||||
public function withAttachmentInformation(): GroupCollectorInterface
|
public function withAttachmentInformation(): GroupCollectorInterface
|
||||||
{
|
{
|
||||||
$this->fields[] = 'attachments.id as attachment_id';
|
$this->fields[] = 'attachments.id as attachment_id';
|
||||||
|
$this->fields[] = 'attachments.uploaded as attachment_uploaded';
|
||||||
$this->joinAttachmentTables();
|
$this->joinAttachmentTables();
|
||||||
|
|
||||||
return $this;
|
return $this;
|
||||||
@ -498,7 +499,7 @@ class GroupCollector implements GroupCollectorInterface
|
|||||||
->where(
|
->where(
|
||||||
static function (EloquentBuilder $q1) {
|
static function (EloquentBuilder $q1) {
|
||||||
$q1->where('attachments.attachable_type', TransactionJournal::class);
|
$q1->where('attachments.attachable_type', TransactionJournal::class);
|
||||||
$q1->where('attachments.uploaded', true);
|
//$q1->where('attachments.uploaded', true);
|
||||||
$q1->orWhereNull('attachments.attachable_type');
|
$q1->orWhereNull('attachments.attachable_type');
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
@ -594,7 +595,8 @@ class GroupCollector implements GroupCollectorInterface
|
|||||||
{
|
{
|
||||||
$newArray = $newJournal->toArray();
|
$newArray = $newJournal->toArray();
|
||||||
if (array_key_exists('attachment_id', $newArray)) {
|
if (array_key_exists('attachment_id', $newArray)) {
|
||||||
$attachmentId = (int)$newJournal['tag_id'];
|
$attachmentId = (int) $newJournal['attachment_id'];
|
||||||
|
|
||||||
$existingJournal['attachments'][$attachmentId] = [
|
$existingJournal['attachments'][$attachmentId] = [
|
||||||
'id' => $attachmentId,
|
'id' => $attachmentId,
|
||||||
];
|
];
|
||||||
@ -728,8 +730,9 @@ class GroupCollector implements GroupCollectorInterface
|
|||||||
|
|
||||||
// also merge attachments:
|
// also merge attachments:
|
||||||
if (array_key_exists('attachment_id', $result)) {
|
if (array_key_exists('attachment_id', $result)) {
|
||||||
|
$uploaded = 1 === (int)$result['attachment_uploaded'];
|
||||||
$attachmentId = (int) $augumentedJournal['attachment_id'];
|
$attachmentId = (int) $augumentedJournal['attachment_id'];
|
||||||
if (0 !== $attachmentId) {
|
if (0 !== $attachmentId && $uploaded) {
|
||||||
$result['attachments'][$attachmentId] = [
|
$result['attachments'][$attachmentId] = [
|
||||||
'id' => $attachmentId,
|
'id' => $attachmentId,
|
||||||
];
|
];
|
||||||
|
Loading…
Reference in New Issue
Block a user