Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix wrongly initiliazed destination config fields #18609

Merged
merged 1 commit into from
Jan 6, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions phpunit/functional/Glpi/Helpdesk/DefaultDataManagerTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -209,6 +209,9 @@ public function testIncidentFormQuestions(): void
[$computer->getID()],
array_values($ticket->getLinkedItems()[Computer::class])
);
$actors = $ticket->getActorsForType(CommonITILActor::REQUESTER);
$actor = current($actors);
$this->assertEquals(TU_USER, $actor['title']);
}

public function testRequestFormQuestions(): void
Expand Down Expand Up @@ -301,6 +304,9 @@ public function testRequestFormQuestions(): void
[$computer->getID()],
array_values($ticket->getLinkedItems()[Computer::class])
);
$actors = $ticket->getActorsForType(CommonITILActor::REQUESTER);
$actor = current($actors);
$this->assertEquals(TU_USER, $actor['title']);
}

public function testIncidentFormShouldBeAccessibleBySelfServiceUsers(): void
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -206,6 +206,10 @@ public function prepareInput(array $input): array
{
$input = parent::prepareInput($input);

if (!isset($input[$this->getKey()][AssociatedItemsFieldConfig::STRATEGY])) {
return $input;
}

// Ensure that question_ids is an array
if (!is_array($input[$this->getKey()][AssociatedItemsFieldConfig::SPECIFIC_QUESTION_IDS] ?? null)) {
$input[$this->getKey()][AssociatedItemsFieldConfig::SPECIFIC_QUESTION_IDS] = null;
Expand Down
4 changes: 4 additions & 0 deletions src/Glpi/Form/Destination/CommonITILField/ITILActorField.php
Original file line number Diff line number Diff line change
Expand Up @@ -140,6 +140,10 @@ public function prepareInput(array $input): array
{
$input = parent::prepareInput($input);

if (!isset($input[$this->getKey()][ITILActorFieldConfig::STRATEGY])) {
return $input;
}

// Ensure that itilactors_ids is an array
if (!is_array($input[$this->getKey()][ITILActorFieldConfig::SPECIFIC_ITILACTORS_IDS] ?? null)) {
$input[$this->getKey()][ITILActorFieldConfig::SPECIFIC_ITILACTORS_IDS] = null;
Expand Down
4 changes: 4 additions & 0 deletions src/Glpi/Form/Destination/CommonITILField/ValidationField.php
Original file line number Diff line number Diff line change
Expand Up @@ -199,6 +199,10 @@ public function prepareInput(array $input): array
{
$input = parent::prepareInput($input);

if (!isset($input[$this->getKey()][ValidationFieldConfig::STRATEGY])) {
return $input;
}

// Ensure that question_ids is an array
if (!is_array($input[$this->getKey()][ValidationFieldConfig::SPECIFIC_QUESTION_IDS] ?? null)) {
$input[$this->getKey()][ValidationFieldConfig::SPECIFIC_QUESTION_IDS] = null;
Expand Down
Loading