Skip to content

Commit

Permalink
OrgU: 42554 get correct row id in multiple cases.
Browse files Browse the repository at this point in the history
  • Loading branch information
lukastocker committed Dec 4, 2024
1 parent 1691b43 commit ededed9
Showing 1 changed file with 12 additions and 3 deletions.
15 changes: 12 additions & 3 deletions components/ILIAS/OrgUnit/classes/ARHelper/BaseCommands.php
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
<?php

/**
* This file is part of ILIAS, a powerful learning management system
* published by ILIAS open source e-Learning e.V.
Expand All @@ -16,6 +17,8 @@
********************************************************************
*/

declare(strict_types=1);

namespace ILIAS\components\OrgUnit\ARHelper;

use ILIAS\DI\Container;
Expand Down Expand Up @@ -209,7 +212,7 @@ protected function getParentRefId(): ?int
{
$ref_id = $this->http->request()->getQueryParams()["ref_id"];

return $ref_id;
return (int) $ref_id;
}

public function addSubTabs(): void
Expand All @@ -218,11 +221,17 @@ public function addSubTabs(): void

protected function getRowIdFromQuery(): int
{
if($this->query->has($this->row_id_token->getName())) {
if ($this->query->has($this->row_id_token->getName())) {
return $this->query->retrieve(
$this->row_id_token->getName(),
$this->refinery->custom()->transformation(fn($v) => (int)array_shift($v))
$this->refinery->custom()->transformation(fn($v) => (int) array_shift($v))
);
} elseif ($_POST[self::AR_ID]) {
$id = $_POST[self::AR_ID] ?? [$_POST[self::AR_ID]];
if (is_array($id)) {
return (int) array_shift($id);
}
return (int) $id;
}
throw new \Exception('no position-id in query');
}
Expand Down

0 comments on commit ededed9

Please sign in to comment.