From d479579267b24807c12615f5dbb082f3ee73c559 Mon Sep 17 00:00:00 2001 From: JulSteele <20680187+julsteele@users.noreply.github.com> Date: Mon, 14 Aug 2023 16:44:28 +0200 Subject: [PATCH 1/2] Added reg_id to CSV export --- app/Models/Application.php | 1 + 1 file changed, 1 insertion(+) diff --git a/app/Models/Application.php b/app/Models/Application.php index 83caf88..467af42 100644 --- a/app/Models/Application.php +++ b/app/Models/Application.php @@ -312,6 +312,7 @@ public static function getAllApplicationsForExport() 'applications.id AS app_id', 'users.name AS user_name', 'users.email AS email', + 'users.reg_id AS reg_id', 'type AS app_type', 'parent', 'display_name', From b6b2e8722ed2b877603720389a2d62a722d65102 Mon Sep 17 00:00:00 2001 From: JulSteele <20680187+julsteele@users.noreply.github.com> Date: Mon, 14 Aug 2023 16:54:42 +0200 Subject: [PATCH 2/2] Fix exception in case of invalid reg id --- app/Http/Controllers/Client/RegSysClientController.php | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/app/Http/Controllers/Client/RegSysClientController.php b/app/Http/Controllers/Client/RegSysClientController.php index 5ad585f..21692b9 100644 --- a/app/Http/Controllers/Client/RegSysClientController.php +++ b/app/Http/Controllers/Client/RegSysClientController.php @@ -103,7 +103,13 @@ public static function getSingleReg(string|null $reg_id): mixed ]); if ($response->ok()) { - return $response->json('result')[0]; + if (!empty($response->json('result'))) { + return $response->json('result')[0]; + } else { + // If reg ID is invalid, regsys returns HTTP 200 but an empty array. + self::logError("Registration with id " . $reg_id . " could not be retrieved, reg id invalid."); + return null; + } } else { self::logError("Registration with id " . $reg_id . " could not be retrieved, reason: " . $response->reason()); return null;