mirror of
https://github.com/firefly-iii/firefly-iii.git
synced 2025-10-12 07:34:43 +00:00
Inline edit for v2
This commit is contained in:
@@ -50,6 +50,9 @@ trait CollectorProperties
|
||||
private array $postFilters;
|
||||
private HasMany $query;
|
||||
private array $stringFields;
|
||||
|
||||
private ?int $startRow;
|
||||
private ?int $endRow;
|
||||
/*
|
||||
* This array is used to collect ALL tags the user may search for (using 'setTags').
|
||||
* This way the user can call 'setTags' multiple times and get a joined result.
|
||||
|
@@ -67,6 +67,8 @@ class GroupCollector implements GroupCollectorInterface
|
||||
$this->userGroup = null;
|
||||
$this->limit = null;
|
||||
$this->page = null;
|
||||
$this->startRow = null;
|
||||
$this->endRow = null;
|
||||
|
||||
$this->hasAccountInfo = false;
|
||||
$this->hasCatInformation = false;
|
||||
@@ -473,6 +475,10 @@ class GroupCollector implements GroupCollectorInterface
|
||||
|
||||
return $collection->slice($offset, $this->limit);
|
||||
}
|
||||
// OR filter the array according to the start and end row variable
|
||||
if (null !== $this->startRow && null !== $this->endRow) {
|
||||
return $collection->slice((int)$this->startRow, (int)$this->endRow);
|
||||
}
|
||||
|
||||
return $collection;
|
||||
}
|
||||
@@ -486,6 +492,10 @@ class GroupCollector implements GroupCollectorInterface
|
||||
if (0 === $this->limit) {
|
||||
$this->setLimit(50);
|
||||
}
|
||||
if(null !== $this->startRow && null !== $this->endRow) {
|
||||
$total = (int)($this->endRow - $this->startRow);
|
||||
return new LengthAwarePaginator($set, $this->total, $total, 1);
|
||||
}
|
||||
|
||||
return new LengthAwarePaginator($set, $this->total, $this->limit, $this->page);
|
||||
}
|
||||
@@ -1055,4 +1065,18 @@ class GroupCollector implements GroupCollectorInterface
|
||||
->orderBy('transaction_journals.description', 'DESC')
|
||||
->orderBy('source.amount', 'DESC');
|
||||
}
|
||||
|
||||
public function setEndRow(int $endRow): self
|
||||
{
|
||||
$this->endRow = $endRow;
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function setStartRow(int $startRow): self
|
||||
{
|
||||
$this->startRow = $startRow;
|
||||
return $this;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
@@ -526,6 +526,16 @@ interface GroupCollectorInterface
|
||||
*/
|
||||
public function setPage(int $page): self;
|
||||
|
||||
/**
|
||||
* Set the page to get.
|
||||
*/
|
||||
public function setStartRow(int $startRow): self;
|
||||
|
||||
/**
|
||||
* Set the page to get.
|
||||
*/
|
||||
public function setEndRow(int $endRow): self;
|
||||
|
||||
/**
|
||||
* Set the start and end time of the results to return.
|
||||
*/
|
||||
|
Reference in New Issue
Block a user