Update source account detection.

This commit is contained in:
James Cole
2024-02-25 18:14:30 +01:00
parent 9222c82af0
commit 2564470197
11 changed files with 95 additions and 95 deletions

View File

@@ -83,7 +83,7 @@ class TransactionController extends Controller
// collect transactions:
/** @var GroupCollectorInterface $collector */
$collector = app(GroupCollectorInterface::class);
$collector = app(GroupCollectorInterface::class);
$collector->setUserGroup(auth()->user()->userGroup)
->withAPIInformation()
->setStartRow($request->getStartRow())
@@ -92,8 +92,8 @@ class TransactionController extends Controller
->setSorting($instructions)
;
$start = $this->parameters->get('start');
$end = $this->parameters->get('end');
$start = $this->parameters->get('start');
$end = $this->parameters->get('end');
if (null !== $start) {
$collector->setStart($start);
}
@@ -101,8 +101,8 @@ class TransactionController extends Controller
$collector->setEnd($end);
}
$paginator = $collector->getPaginatedGroups();
$params = $request->buildParams();
$paginator = $collector->getPaginatedGroups();
$params = $request->buildParams();
$paginator->setPath(
sprintf(
'%s?%s',

View File

@@ -88,26 +88,28 @@ class InfiniteListRequest extends FormRequest
return 0 === $page || $page > 65536 ? 1 : $page;
}
public function getSortInstructions(): array {
public function getSortInstructions(): array
{
$allowed = config('firefly.sorting.allowed.transactions');
$set = $this->get('sorting', []);
$result= [];
if(0 === count($set)) {
$set = $this->get('sorting', []);
$result = [];
if (0 === count($set)) {
return [];
}
foreach($set as $info) {
$column = $info['column'] ?? 'NOPE';
$direction = $info['direction'] ?? 'NOPE';
if('asc' !== $direction && 'desc' !== $direction) {
foreach ($set as $info) {
$column = $info['column'] ?? 'NOPE';
$direction = $info['direction'] ?? 'NOPE';
if ('asc' !== $direction && 'desc' !== $direction) {
// skip invalid direction
continue;
}
if(in_array($column, $allowed, true) === false) {
if (false === in_array($column, $allowed, true)) {
// skip invalid column
continue;
}
$result[$column] = $direction;
}
return $result;
}