From 9b3ed5ac71ddf2dee5ec4879c7a2b2dcc1d45774 Mon Sep 17 00:00:00 2001 From: Michiel Kodde Date: Wed, 28 Jun 2023 09:50:48 +0200 Subject: [PATCH] Check if manage id field exists on ticket If the custom field, containing the manage Id does not exist. Do not consider that ticket to be interesting to us --- .../Infrastructure/Jira/Repository/IssueRepository.php | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/Surfnet/ServiceProviderDashboard/Infrastructure/Jira/Repository/IssueRepository.php b/src/Surfnet/ServiceProviderDashboard/Infrastructure/Jira/Repository/IssueRepository.php index 68dbd409c..1f15dfd43 100644 --- a/src/Surfnet/ServiceProviderDashboard/Infrastructure/Jira/Repository/IssueRepository.php +++ b/src/Surfnet/ServiceProviderDashboard/Infrastructure/Jira/Repository/IssueRepository.php @@ -27,6 +27,7 @@ use Surfnet\ServiceProviderDashboard\Infrastructure\Jira\Factory\IssueFieldFactory; use Surfnet\ServiceProviderDashboard\Infrastructure\Jira\Factory\JiraServiceFactory; use Webmozart\Assert\Assert; +use function array_key_exists; class IssueRepository implements TicketServiceInterface { @@ -55,6 +56,9 @@ public function findByManageIds(array $manageIds) ); $collection = []; foreach ($issues->issues as $issue) { + if (!array_key_exists($this->manageIdFieldName, $issue->fields->customFields)) { + continue; + } $manageId = $issue->fields->customFields[$this->manageIdFieldName]; if (in_array($manageId, $manageIds)) { $collection[$manageId] = new Issue($issue->key, $this->issueType, $issue->fields->status->name);