Skip to content

Commit c17a3da

Browse files
committed
refactor: Replace GenericObjectTable with CnIndexPage, fix all ESLint errors
Migration from custom 1,420-line GenericObjectTable component to the shared CnIndexPage from @conduction/nextcloud-vue: - Rewrite ObjectIndex.vue to use CnIndexPage with sidebar integration, sorting, pagination, search, filtering, and modal system wiring - Delete GenericObjectTable.vue (1,420 lines) and 3 dead view files (VoorzieningIndex, ContactpersoonIndex, ContractIndex) that were never referenced in Views.vue routing - Fix all 46 ESLint errors: remove unused t/n imports from 18 files, add scoped attribute to 9 style tags, suppress CnDashboardPage import - Fix PHPCS formatting errors from development merge (auto-fixed) - Add .license-overrides.json for @fortawesome/free-solid-svg-icons (CC-BY-4.0 AND MIT compound license) - Remove push trigger from CI workflow to prevent double runs Quality status: PHPCS 0/0, Psalm 0, ESLint 0 errors (7 warnings)
1 parent 3f5435d commit c17a3da

46 files changed

Lines changed: 685 additions & 2849 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.github/workflows/code-quality.yml

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,6 @@
11
name: Code Quality
22

33
on:
4-
push:
5-
branches: [main, development, feature/**, bugfix/**, hotfix/**]
64
pull_request:
75
branches: [main, beta, development]
86

.license-overrides.json

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
{
2+
"@fortawesome/free-solid-svg-icons": "License is (CC-BY-4.0 AND MIT) — both are approved open-source licenses, compound AND expression not parsed by checker"
3+
}

lib/Controller/AangebodenGebruikController.php

Lines changed: 4 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -85,7 +85,6 @@ public function __construct(
8585
* @NoCSRFRequired
8686
* @PublicPage
8787
* @PublicPage
88-
*
8988
*/
9089
public function getGebruiksWhereAfnemer(): JSONResponse
9190
{
@@ -161,7 +160,6 @@ public function getGebruiksWhereAfnemer(): JSONResponse
161160
* @NoAdminRequired
162161
* @NoCSRFRequired
163162
* @PublicPage
164-
*
165163
*/
166164
public function getKoppelingenGebruikByUuid(string $uuid): JSONResponse
167165
{
@@ -252,7 +250,6 @@ public function getKoppelingenGebruikByUuid(string $uuid): JSONResponse
252250
* @NoAdminRequired
253251
* @NoCSRFRequired
254252
* @PublicPage
255-
*
256253
*/
257254
public function getAllGebruiksForAmbtenaar(): JSONResponse
258255
{
@@ -271,7 +268,7 @@ public function getAllGebruiksForAmbtenaar(): JSONResponse
271268
$isAmbtenaar = $this->isUserInGroup(groupName: 'ambtenaar');
272269
if ($isAdmin === false && $isAmbtenaar === false) {
273270
// Get user ID for logging (may be null if not authenticated).
274-
$user = $this->userSession->getUser();
271+
$user = $this->userSession->getUser();
275272
$userId = 'null';
276273
if ($user !== null) {
277274
}
@@ -379,7 +376,7 @@ public function getSingleGebruikForAmbtenaar(string $gebruikId): JSONResponse
379376
$isAmbtenaar = $this->isUserInGroup(groupName: 'ambtenaar');
380377
if ($isAdmin === false && $isAmbtenaar === false) {
381378
// Get user ID for logging (may be null if not authenticated).
382-
$user = $this->userSession->getUser();
379+
$user = $this->userSession->getUser();
383380
$userId = 'null';
384381
if ($user !== null) {
385382
}
@@ -532,7 +529,6 @@ private function isUserInGroup(string $groupName): bool
532529
* @NoCSRFRequired
533530
* @PublicPage
534531
* @PublicPage
535-
*
536532
*/
537533
public function getGebruiksWhereDeelnemers(): JSONResponse
538534
{
@@ -606,7 +602,6 @@ public function getGebruiksWhereDeelnemers(): JSONResponse
606602
* @NoCSRFRequired
607603
* @PublicPage
608604
* @PublicPage
609-
*
610605
*/
611606
public function setGebruikSelfToActiveOrg(string $gebruikId): JSONResponse
612607
{
@@ -653,14 +648,13 @@ function ($key) {
653648
);
654649

655650
// Determine appropriate HTTP status code.
651+
$statusCode = 500;
656652
if ($result['success'] === true) {
657653
$statusCode = 200;
658654
} else if ($result['error'] === 'Gebruik object not found') {
659655
$statusCode = 404;
660656
} else if (strpos(haystack: ($result['error'] ?? ''), needle: 'Operation not allowed') !== false) {
661657
$statusCode = 403;
662-
} else {
663-
$statusCode = 500;
664658
}
665659

666660
$this->logger->info(
@@ -715,7 +709,6 @@ function ($key) {
715709
* @NoCSRFRequired
716710
* @PublicPage
717711
* @PublicPage
718-
*
719712
*/
720713
public function deleteGebruikAsAfnemer(string $gebruikId): JSONResponse
721714
{
@@ -762,14 +755,13 @@ function ($key) {
762755
);
763756

764757
// Determine appropriate HTTP status code.
758+
$statusCode = 500;
765759
if ($result['success'] === true) {
766760
$statusCode = 200;
767761
} else if ($result['error'] === 'Gebruik object not found') {
768762
$statusCode = 404;
769763
} else if (strpos(haystack: ($result['error'] ?? ''), needle: 'Operation not allowed') !== false) {
770764
$statusCode = 403;
771-
} else {
772-
$statusCode = 500;
773765
}
774766

775767
$this->logger->info(

lib/Controller/ContactpersonenController.php

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -401,7 +401,7 @@ public function convertToUser(string $contactpersoonId): JSONResponse
401401
$contactpersoonObject->setObject($contactData);
402402

403403
// Debug logging to understand data types before save.
404-
$achternaamValue = $contactData['achternaam'] ?? 'not set';
404+
$achternaamValue = $contactData['achternaam'] ?? 'not set';
405405
$achternaamType = 'not set';
406406
if (isset($contactData['achternaam']) === true) {
407407
}
@@ -629,25 +629,26 @@ public function updateUserGroups(string $username, array $groups=[]): JSONRespon
629629
$groupsToAdd = array_diff($validGroups, $curCatalogGroups);
630630
foreach ($groupsToAdd as $groupName) {
631631
$group = $this->groupManager->get($groupName);
632-
if ($group !== null) {
633-
if ($group->inGroup($user) === false) {
634-
$group->addUser($user);
635-
$this->logger->info(
636-
'Added user to group',
637-
[
638-
'username' => $username,
639-
'group' => $groupName,
640-
]
641-
);
642-
}
643-
} else {
632+
if ($group === null) {
644633
$this->logger->warning(
645634
'Group does not exist, skipping',
646635
[
647636
'username' => $username,
648637
'group' => $groupName,
649638
]
650639
);
640+
continue;
641+
}
642+
643+
if ($group->inGroup($user) === false) {
644+
$group->addUser($user);
645+
$this->logger->info(
646+
'Added user to group',
647+
[
648+
'username' => $username,
649+
'group' => $groupName,
650+
]
651+
);
651652
}
652653
}//end foreach
653654

@@ -1072,7 +1073,6 @@ public function enableUser(string $contactpersoonId): JSONResponse
10721073
*
10731074
* @NoAdminRequired
10741075
* @NoCSRFRequired
1075-
*
10761076
*/
10771077
public function testBulkUserInfo(): JSONResponse
10781078
{

lib/Controller/SettingsController.php

Lines changed: 21 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -541,7 +541,6 @@ public function status(): JSONResponse
541541
* @return JSONResponse JSON response containing the auto-configuration results
542542
*
543543
* @NoCSRFRequired
544-
*
545544
*/
546545
public function autoConfigure(): JSONResponse
547546
{
@@ -555,14 +554,14 @@ public function autoConfigure(): JSONResponse
555554
'configuration' => $result,
556555
]
557556
);
558-
} else {
559-
return new JSONResponse(
560-
[
561-
'success' => false,
562-
'message' => 'No matching registers or schemas found for auto-configuration',
563-
]
564-
);
565557
}
558+
559+
return new JSONResponse(
560+
[
561+
'success' => false,
562+
'message' => 'No matching registers or schemas found for auto-configuration',
563+
]
564+
);
566565
} catch (\Exception $e) {
567566
$this->logger->error(
568567
'Failed to auto-configure settings',
@@ -702,7 +701,6 @@ public function getSyncStatus(int $minutesBack=10): JSONResponse
702701
* @return JSONResponse JSON response containing sync results
703702
*
704703
* @NoCSRFRequired
705-
*
706704
*/
707705
public function performSync(int $minutesBack=0): JSONResponse
708706
{
@@ -724,15 +722,15 @@ public function performSync(int $minutesBack=0): JSONResponse
724722
'isOptimized' => true,
725723
]
726724
);
727-
} else {
728-
// For incremental sync, use the original method.
729-
$result = $this->orgSyncSvc->performManualSync($minutesBack);
725+
}//end if
730726

731-
if ($result['success'] === true) {
732-
}
727+
// For incremental sync, use the original method.
728+
$result = $this->orgSyncSvc->performManualSync($minutesBack);
733729

734-
return new JSONResponse($result, 500);
735-
}//end if
730+
if ($result['success'] === true) {
731+
}
732+
733+
return new JSONResponse($result, 500);
736734
} catch (\Exception $e) {
737735
$this->logger->error(
738736
'Manual sync failed',
@@ -853,7 +851,6 @@ public function getVersionInfo(): JSONResponse
853851
* @return JSONResponse JSON response containing reset results.
854852
*
855853
* @NoCSRFRequired
856-
*
857854
*/
858855
public function resetAutoConfig(): JSONResponse
859856
{
@@ -924,7 +921,6 @@ public function clearCache(): JSONResponse
924921
* @return JSONResponse JSON response containing import results.
925922
*
926923
* @NoCSRFRequired
927-
*
928924
*/
929925
public function manualImport(): JSONResponse
930926
{
@@ -1054,7 +1050,6 @@ public function forceUpdate(): JSONResponse
10541050
* @return JSONResponse JSON response containing consolidated results
10551051
*
10561052
* @NoCSRFRequired
1057-
*
10581053
*/
10591054
public function consolidatedAutoConfigure(): JSONResponse
10601055
{
@@ -1066,14 +1061,12 @@ public function consolidatedAutoConfigure(): JSONResponse
10661061
$results = $this->settingsService->performConsolidatedAutoConfiguration($force);
10671062

10681063
// Determine HTTP status based on results.
1064+
$httpStatus = 200;
10691065
if ($results['success'] === false) {
10701066
// Multi-status or Server Error.
1071-
$httpStatus = 500;
1067+
$httpStatus = 500;
10721068
if (empty($results['errors']) === false) {
10731069
}
1074-
} else {
1075-
// Success.
1076-
$httpStatus = 200;
10771070
}
10781071

10791072
return new JSONResponse($results, $httpStatus);
@@ -1377,7 +1370,9 @@ public function importArchiMate(): JSONResponse
13771370
];
13781371

13791372
$this->logger->info('JSON payload detected.', ['options' => $options]);
1380-
} else {
1373+
}//end if
1374+
1375+
if (isset($options) === false) {
13811376
$this->logger->error(
13821377
'No file uploaded or file path provided — DETAILED DEBUG',
13831378
[
@@ -1414,12 +1409,11 @@ public function importArchiMate(): JSONResponse
14141409
// OPTIMIZATION: Use optimized method if available or if explicitly requested.
14151410
$useOptimized = $this->request->getParam('useOptimized', 'true') === 'true';
14161411
$hasOptimized = method_exists($this->archiMateService, 'importArchiMateFileFromPathOptimized');
1412+
$this->logger->info('Using STANDARD ArchiMate import method.');
1413+
$result = $this->archiMateService->importArchiMateFileFromPath($options);
14171414
if ($useOptimized === true && $hasOptimized === true) {
14181415
$this->logger->info('Using OPTIMIZED ArchiMate import method.');
14191416
$result = $this->archiMateService->importArchiMateFileFromPathOptimized($options);
1420-
} else {
1421-
$this->logger->info('Using STANDARD ArchiMate import method.');
1422-
$result = $this->archiMateService->importArchiMateFileFromPath($options);
14231417
}
14241418

14251419
return new JSONResponse($result);
@@ -1987,7 +1981,6 @@ public function getEmailTemplate(string $templateName): JSONResponse
19871981
*
19881982
* @NoAdminRequired
19891983
* @NoCSRFRequired
1990-
*
19911984
*/
19921985
public function updateEmailTemplate(string $templateName): JSONResponse
19931986
{
@@ -2478,7 +2471,6 @@ public function killArchiMateImport(): JSONResponse
24782471
* @NoCSRFRequired
24792472
*
24802473
* @return JSONResponse Cancellation result
2481-
*
24822474
*/
24832475
public function cancelArchiMateImport(): JSONResponse
24842476
{
@@ -3124,7 +3116,6 @@ private function getHttpStatusForErrorMessage(string $message): int
31243116
* @NoCSRFRequired
31253117
*
31263118
* @return JSONResponse The sync results
3127-
*
31283119
*/
31293120
public function syncOrganisations(): JSONResponse
31303121
{
@@ -3274,7 +3265,6 @@ public function getCronjobConfig(): JSONResponse
32743265
* @NoCSRFRequired
32753266
*
32763267
* @return JSONResponse Update result
3277-
*
32783268
*/
32793269
public function updateCronjobConfig(): JSONResponse
32803270
{

lib/EventListener/SoftwareCatalogEventListener.php

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,6 @@ public function __construct()
6868
* @param Event $event The event to handle
6969
*
7070
* @return void
71-
*
7271
*/
7372
public function handle(Event $event): void
7473
{

lib/Service/AangebodenGebruikService.php

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -148,11 +148,9 @@ public function getGebruiksWhereAfnemer(array $options=[]): array
148148
$requestedPage = $options['_page'] ?? 1;
149149

150150
// Calculate offset from page or use explicit offset.
151+
$requestedOffset = ($requestedPage - 1) * $requestedLimit;
151152
if (isset($options['_offset']) === true) {
152153
$requestedOffset = $options['_offset'];
153-
} else {
154-
// Calculate offset from page number.
155-
$requestedOffset = ($requestedPage - 1) * $requestedLimit;
156154
}
157155

158156
// Fetch a large batch for filtering (since we filter post-fetch).
@@ -273,10 +271,9 @@ public function getGebruiksWhereAfnemer(array $options=[]): array
273271
$searchResult['page'] = $currentPage;
274272
$searchResult['limit'] = $requestedLimit;
275273
$searchResult['offset'] = $requestedOffset;
274+
unset($searchResult['next']);
276275
if ($nextLink !== null) {
277276
$searchResult['next'] = $nextLink;
278-
} else {
279-
unset($searchResult['next']);
280277
}
281278

282279
if ($prevLink !== null) {
@@ -469,7 +466,9 @@ public function getKoppelingenGebruikByUuid(string $uuid, array $options=[], boo
469466
_multitenancy: false,
470467
deleted: false
471468
);
472-
} else {
469+
}//end if
470+
471+
if ($isOrganisationUuid === false) {
473472
// For suite/module UUIDs, use 'uses' parameter to filter by relations.
474473
// Add organization filter if provided.
475474
if ($organisationFilter !== null) {

lib/Service/ArchiMateExportService.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2628,7 +2628,7 @@ private function generateApplicationElements(
26282628
string $bronPropDefId,
26292629
string $prefix=''
26302630
): array {
2631-
$elements = [];
2631+
$elements = [];
26322632
$idPrefix = 'id-swc-app-';
26332633
if ($prefix !== '') {
26342634
}
@@ -2664,7 +2664,7 @@ private function generateSpecializationRelationships(
26642664
string $bronPropDefId,
26652665
string $prefix=''
26662666
): array {
2667-
$relationships = [];
2667+
$relationships = [];
26682668
$appIdPrefix = 'id-swc-app-';
26692669
if ($prefix !== '') {
26702670
}

0 commit comments

Comments
 (0)