fix: [audit-logs:eventIndex] Fixed pagination issue while viewing event history

Fix #9726
feature/event-view-collapsible-objects
Sami Mokaddem 2024-05-14 11:16:16 +02:00
parent 05d8947386
commit d346b6cf74
No known key found for this signature in database
GPG Key ID: 164C473F627A06FA
1 changed files with 7 additions and 2 deletions

View File

@ -155,8 +155,14 @@ class AuditLogsController extends AppController
$this->set('title_for_layout', __('Audit logs'));
}
public function eventIndex($eventId, $org = null)
public function eventIndex($eventId = null, $org = null)
{
$params = $this->IndexFilter->harvestParameters(['created', 'org', 'eventId']);
if (!empty($params['eventId'])) {
$eventId = $params['eventId'];
} else if (empty($eventId)) {
$eventId = -1;
}
$event = $this->AuditLog->Event->fetchSimpleEvent($this->Auth->user(), $eventId);
if (empty($event)) {
throw new NotFoundException('Invalid event.');
@ -164,7 +170,6 @@ class AuditLogsController extends AppController
$this->paginate['conditions'] = $this->__createEventIndexConditions($event);
$this->set('passedArgsArray', ['eventId' => $eventId, 'org' => $org]);
$params = $this->IndexFilter->harvestParameters(['created', 'org']);
if ($org) {
$params['org'] = $org;
}