Skip to content

Commit

Permalink
Bugfix/csv export regsys (#15)
Browse files Browse the repository at this point in the history
* Added reg_id to CSV export
* Fix exception in case of invalid reg id
  • Loading branch information
julsteele authored Aug 14, 2023
1 parent 9c955d6 commit 1ac3d89
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 1 deletion.
8 changes: 7 additions & 1 deletion app/Http/Controllers/Client/RegSysClientController.php
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
1 change: 1 addition & 0 deletions app/Models/Application.php
Original file line number Diff line number Diff line change
Expand Up @@ -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',
Expand Down

0 comments on commit 1ac3d89

Please sign in to comment.