From 7a9168fcdb92febf358965bb00b22b95326836ef Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Julien=20Fastr=C3=A9?= Date: Fri, 14 Mar 2025 15:02:09 +0100 Subject: [PATCH 01/13] Refactor variable declarations in pick-entity module. Consolidated variable declarations into a single statement using const. This improves code readability and aligns with modern JavaScript best practices. --- .../Resources/public/module/pick-entity/index.js | 16 ++++++---------- 1 file changed, 6 insertions(+), 10 deletions(-) diff --git a/src/Bundle/ChillMainBundle/Resources/public/module/pick-entity/index.js b/src/Bundle/ChillMainBundle/Resources/public/module/pick-entity/index.js index 6f6aad7ff..1b3ee4594 100644 --- a/src/Bundle/ChillMainBundle/Resources/public/module/pick-entity/index.js +++ b/src/Bundle/ChillMainBundle/Resources/public/module/pick-entity/index.js @@ -12,10 +12,6 @@ function loadDynamicPicker(element) { let apps = element.querySelectorAll('[data-module="pick-dynamic"]'); apps.forEach(function (el) { - let suggested; - let as_id; - let submit_on_adding_new_entity; - let label; const isMultiple = parseInt(el.dataset.multiple) === 1, uniqId = el.dataset.uniqid, input = element.querySelector( @@ -26,12 +22,12 @@ function loadDynamicPicker(element) { ? JSON.parse(input.value) : input.value === "[]" || input.value === "" ? null - : [JSON.parse(input.value)]; - suggested = JSON.parse(el.dataset.suggested); - as_id = parseInt(el.dataset.asId) === 1; - submit_on_adding_new_entity = - parseInt(el.dataset.submitOnAddingNewEntity) === 1; - label = el.dataset.label; + : [JSON.parse(input.value)], + suggested = JSON.parse(el.dataset.suggested), + as_id = parseInt(el.dataset.asId) === 1, + submit_on_adding_new_entity = + parseInt(el.dataset.submitOnAddingNewEntity) === 1, + label = el.dataset.label; if (!isMultiple) { if (input.value === "[]") { From f202625ea834e3f0fee691bedf3bfd4ac414b695 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Julien=20Fastr=C3=A9?= Date: Fri, 14 Mar 2025 15:02:26 +0100 Subject: [PATCH 02/13] Fix LIKE clause logic in UserGroupRepository query Adjusted the parameter order and ensured consistent use of LOWER and UNACCENT functions in the LIKE clause. This resolves potential mismatches and improves query reliability for pattern matching. --- .changes/unreleased/Fixed-20250314-150408.yaml | 6 ++++++ .../ChillMainBundle/Repository/UserGroupRepository.php | 4 ++-- 2 files changed, 8 insertions(+), 2 deletions(-) create mode 100644 .changes/unreleased/Fixed-20250314-150408.yaml diff --git a/.changes/unreleased/Fixed-20250314-150408.yaml b/.changes/unreleased/Fixed-20250314-150408.yaml new file mode 100644 index 000000000..0c278aa12 --- /dev/null +++ b/.changes/unreleased/Fixed-20250314-150408.yaml @@ -0,0 +1,6 @@ +kind: Fixed +body: fix search query for user groups +time: 2025-03-14T15:04:08.622666838+01:00 +custom: + Issue: "368" + SchemaChange: No schema change diff --git a/src/Bundle/ChillMainBundle/Repository/UserGroupRepository.php b/src/Bundle/ChillMainBundle/Repository/UserGroupRepository.php index e1c54442d..71266f8e5 100644 --- a/src/Bundle/ChillMainBundle/Repository/UserGroupRepository.php +++ b/src/Bundle/ChillMainBundle/Repository/UserGroupRepository.php @@ -75,8 +75,8 @@ final class UserGroupRepository implements UserGroupRepositoryInterface, LocaleA ->setWhereClauses(' ug.active AND ( SIMILARITY(LOWER(UNACCENT(?)), ug.label->>?) > 0.15 - OR ug.label->>? LIKE \'%\' || LOWER(UNACCENT(?)) || \'%\') - ', [$pattern, $lang, $pattern, $lang]); + OR LOWER(UNACCENT(ug.label->>?)) LIKE \'%\' || LOWER(UNACCENT(?)) || \'%\') + ', [$pattern, $lang, $lang, $pattern]); return $query; } From 7ddf84ea5a76c63afa50f323fe37d6b3ea1d3517 Mon Sep 17 00:00:00 2001 From: Julie Lenaerts Date: Fri, 14 Mar 2025 15:07:23 +0100 Subject: [PATCH 03/13] Fix ts errors upon prod compilation --- assets/translator.ts | 2 +- package.json | 1 + .../public/vuejs/DocumentSignature/App.vue | 29 ++++++++++--------- .../HistoryButton/HistoryButtonModal.vue | 7 +++-- .../public/vuejs/WorkflowAttachment/App.vue | 5 +++- .../Component/PickGenericDoc.vue | 8 +++-- 6 files changed, 32 insertions(+), 20 deletions(-) diff --git a/assets/translator.ts b/assets/translator.ts index 4834e30a6..ad2de8c0b 100644 --- a/assets/translator.ts +++ b/assets/translator.ts @@ -1,5 +1,5 @@ // @ts-ignore Cannot find module (when used within an app) -import { trans, getLocale, setLocale, setLocaleFallbacks } from "@symfony/ux-translator"; +import { trans, setLocale, setLocaleFallbacks } from "@symfony/ux-translator"; setLocaleFallbacks({"en": "fr", "nl": "fr", "fr": "en"}); setLocale('fr'); diff --git a/package.json b/package.json index a24c4ee8f..e2b8d8ba3 100644 --- a/package.json +++ b/package.json @@ -11,6 +11,7 @@ "@hotwired/stimulus": "^3.0.0", "@luminateone/eslint-baseline": "^1.0.9", "@symfony/stimulus-bridge": "^3.2.0", + "@symfony/ux-translator": "file:vendor/symfony/ux-translator/assets", "@symfony/webpack-encore": "^4.1.0", "@tsconfig/node20": "^20.1.4", "@types/dompurify": "^3.0.5", diff --git a/src/Bundle/ChillDocStoreBundle/Resources/public/vuejs/DocumentSignature/App.vue b/src/Bundle/ChillDocStoreBundle/Resources/public/vuejs/DocumentSignature/App.vue index b47a6bce0..283156696 100644 --- a/src/Bundle/ChillDocStoreBundle/Resources/public/vuejs/DocumentSignature/App.vue +++ b/src/Bundle/ChillDocStoreBundle/Resources/public/vuejs/DocumentSignature/App.vue @@ -92,8 +92,7 @@ >