From 7a0bdebc97beff66e16ba3ad84aef13de86b17de Mon Sep 17 00:00:00 2001 From: Benjamin AIMARD Date: Tue, 10 Nov 2026 07:32:00 +0000 Subject: [PATCH 1/2] =?UTF-8?q?feat:=20pr=C3=A9parer=20l=E2=80=99annonce?= =?UTF-8?q?=20Qonto=20par=20utilisateur=20pour=20Gestion=203.4.8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- appinfo/info.xml | 2 +- appinfo/routes.php | 1 + css/style.css | 2 + documentation/source/developer.rst | 21 +++++ l10n/fr.js | 4 + l10n/fr.json | 5 ++ lib/Controller/AnnouncementController.php | 27 ++++++ lib/Service/AnnouncementService.php | 32 +++++++ lib/Service/TemplateService.php | 4 +- package-lock.json | 4 +- package.json | 2 +- src/js/modules/workspace.js | 26 ++++++ templates/content/changelog.php | 13 +++ tests/Browser/announcements.cjs | 85 +++++++++++++++++++ .../Unit/Controller/RoutePermissionsTest.php | 2 +- .../Unit/Service/AnnouncementServiceTest.php | 62 ++++++++++++++ translationfiles/fr/gestion.po | 12 +++ 17 files changed, 298 insertions(+), 6 deletions(-) create mode 100644 lib/Controller/AnnouncementController.php create mode 100644 lib/Service/AnnouncementService.php create mode 100644 tests/Browser/announcements.cjs create mode 100644 tests/Unit/Service/AnnouncementServiceTest.php diff --git a/appinfo/info.xml b/appinfo/info.xml index 72b0a632..a889023f 100755 --- a/appinfo/info.xml +++ b/appinfo/info.xml @@ -29,7 +29,7 @@ If you require adaptations to comply with your country's regulations, please ope [![Donate](https://img.shields.io/badge/Donate-Buy%20me%20a%20coffee-yellow.svg)](https://www.buymeacoffee.com/benjaminaimard) ]]> - 3.4.7 + 3.4.8 agpl Benjamin AIMARD Gestion diff --git a/appinfo/routes.php b/appinfo/routes.php index 352fd786..8cb94d07 100755 --- a/appinfo/routes.php +++ b/appinfo/routes.php @@ -7,6 +7,7 @@ ['name' => 'view#produit', 'url' => '/produit', 'verb' => 'GET'], ['name' => 'configuration#config', 'url' => '/config', 'verb' => 'GET'], ['name' => 'configuration#isConfig', 'url' => '/isconfig', 'verb' => 'GET'], + ['name' => 'announcement#acknowledge', 'url' => '/announcements/acknowledge', 'verb' => 'POST'], ['name' => 'view#statistique', 'url' => '/statistique', 'verb' => 'GET'], ['name' => 'view#legalnotice', 'url' => '/legalnotice', 'verb' => 'GET'], ['name' => 'view#france', 'url' => '/legalnotice/france', 'verb' => 'GET'], diff --git a/css/style.css b/css/style.css index 9ba9bf32..0d4e785e 100755 --- a/css/style.css +++ b/css/style.css @@ -1053,6 +1053,8 @@ button.electronic-invoice-help:focus-visible { .gestion-workspace-dialog h2 { font-size: 22px; line-height: 1.4; margin: 0 0 16px; } .gestion-workspace-dialog p { margin-block: 12px; line-height: 1.6; } .gestion-workspace-dialog button { min-height: 44px; } +.gestion-announcement-actions { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 12px; margin-top: 20px; } +.gestion-announcement-actions .button { display: inline-flex; align-items: center; justify-content: center; min-height: 44px; padding: 8px 16px; border-radius: var(--border-radius-element, 8px); text-decoration: none; } .gestion-history { list-style: none; padding: 0; } .gestion-history li { padding: 16px 0; border-bottom: 1px solid var(--color-border); overflow-wrap: anywhere; } .gestion-history li p { margin: 4px 0; color: var(--color-text-maxcontrast); } diff --git a/documentation/source/developer.rst b/documentation/source/developer.rst index 1de7a937..00ae381a 100644 --- a/documentation/source/developer.rst +++ b/documentation/source/developer.rst @@ -128,6 +128,27 @@ PR fonctionnelle. Version et publication ---------------------- +Annonce à tous les utilisateurs +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + +La version ``3.4.8`` prépare un appel à bêta-testeurs pour l'application Qonto, +en vue d'une intégration complète avec Gestion. L'annonce apparaît à l'ouverture +de Gestion dès cette version, pour chaque utilisateur authentifié, même lorsque +plusieurs personnes partagent la même société. Le bouton de participation ouvre +le logiciel de messagerie ; Gestion n'envoie pas d'e-mail automatiquement. + +Le déclencheur est ``AnnouncementService::VERSION``. Pour une future annonce, +choisissez une nouvelle version, adaptez le texte traduisible dans +``templates/content/changelog.php`` et publiez une version de Gestion au moins +égale au déclencheur. Un simple correctif ultérieur ne réaffiche pas l'annonce +aux utilisateurs qui l'ont déjà fermée. Aucun tag ni aucune publication du store +n'est nécessaire pour préparer ces changements sur ``master``. + +L'acquittement est enregistré dans les préférences de l'utilisateur seulement +après fermeture et confirmation du serveur, par une requête authentifiée avec +protection CSRF. Recharger la page sans fermer le message ne le marque pas comme +lu. Ce mécanisme est distinct de l'ancien champ ``changelog`` des sociétés. + La source de vérité de la version est ``appinfo/info.xml``. L'interface et la documentation Sphinx lisent cette valeur automatiquement. Lors d'une publication, vérifiez également les métadonnées du paquet et le tag Git. diff --git a/l10n/fr.js b/l10n/fr.js index 7a1936bd..18565a3e 100644 --- a/l10n/fr.js +++ b/l10n/fr.js @@ -1,6 +1,10 @@ OC.L10N.register( "gestion", { + "Qonto application: beta testers wanted" : "Application Qonto : recherche de bêta-testeurs", + "I am looking for beta testers for the Qonto application, with the aim of fully integrating it with Gestion." : "Je recherche des bêta-testeurs pour l’application Qonto, en vue de son intégration complète avec Gestion.", + "Your feedback will help shape the integration and test real-world workflows. If you would like to take part, contact me and tell me how you use Qonto and Gestion." : "Vos retours aideront à concevoir cette intégration et à la tester en conditions réelles. Pour participer, contactez-moi en précisant votre utilisation de Qonto et de Gestion.", + "Join the beta testing" : "Participer aux bêta-tests", "Last name" : "Nom", "First name" : "Prénom", "Limited company" : "Siret", diff --git a/l10n/fr.json b/l10n/fr.json index f2367c6a..de4f3d10 100644 --- a/l10n/fr.json +++ b/l10n/fr.json @@ -1,4 +1,9 @@ { "translations": { + "Qonto application: beta testers wanted" : "Application Qonto : recherche de bêta-testeurs", + "I am looking for beta testers for the Qonto application, with the aim of fully integrating it with Gestion." : "Je recherche des bêta-testeurs pour l’application Qonto, en vue de son intégration complète avec Gestion.", + "Your feedback will help shape the integration and test real-world workflows. If you would like to take part, contact me and tell me how you use Qonto and Gestion." : "Vos retours aideront à concevoir cette intégration et à la tester en conditions réelles. Pour participer, contactez-moi en précisant votre utilisation de Qonto et de Gestion.", + "Join the beta testing" : "Participer aux bêta-tests", + "Last name" : "Nom", "First name" : "Prénom", "Limited company" : "Siret", diff --git a/lib/Controller/AnnouncementController.php b/lib/Controller/AnnouncementController.php new file mode 100644 index 00000000..2a906157 --- /dev/null +++ b/lib/Controller/AnnouncementController.php @@ -0,0 +1,27 @@ +announcementService->acknowledge($version); + return new DataResponse(['acknowledged' => true]); + } catch (\InvalidArgumentException $e) { + return new DataResponse(['message' => $e->getMessage()], 400); + } + } +} diff --git a/lib/Service/AnnouncementService.php b/lib/Service/AnnouncementService.php new file mode 100644 index 00000000..7d221b89 --- /dev/null +++ b/lib/Service/AnnouncementService.php @@ -0,0 +1,32 @@ +UserId || version_compare($this->appManager->getAppVersion('gestion'), self::VERSION, '<')) { + return ''; + } + $seen = $this->config->getUserValue($this->UserId, 'gestion', self::SEEN_KEY, ''); + return $seen !== '' && version_compare($seen, self::VERSION, '>=') ? '' : self::VERSION; + } + + public function acknowledge(string $version): void { + if (!$this->UserId || $version !== self::VERSION || version_compare($this->appManager->getAppVersion('gestion'), self::VERSION, '<')) { + throw new \InvalidArgumentException('Invalid announcement version.'); + } + $seen = $this->config->getUserValue($this->UserId, 'gestion', self::SEEN_KEY, ''); + if ($seen === '' || version_compare($seen, $version, '<')) { + $this->config->setUserValue($this->UserId, 'gestion', self::SEEN_KEY, $version); + } + } +} diff --git a/lib/Service/TemplateService.php b/lib/Service/TemplateService.php index a3d95752..e00d75d6 100755 --- a/lib/Service/TemplateService.php +++ b/lib/Service/TemplateService.php @@ -21,7 +21,8 @@ public function __construct( DataService $dataService, FileService $fileService, NavigationService $navigationService, - ContentSecurityPolicy $csp + ContentSecurityPolicy $csp, + private AnnouncementService $announcementService ) { $this->userId = $UserId; $this->appManager = $appManager; @@ -36,6 +37,7 @@ private function baseParams(): array { return [ 'path' => $this->userId, 'appVersion' => $this->appManager->getAppVersion('gestion'), + 'announcementVersion' => $this->announcementService->pendingVersion(), 'url' => $this->navigationService->getNavigationLink(), 'CompaniesList' => $this->companyService->getCompaniesList(), 'CurrentCompany' => $this->companyService->getCurrentCompany(), diff --git a/package-lock.json b/package-lock.json index 8dcf3781..83472dae 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,12 +1,12 @@ { "name": "gestion", - "version": "3.4.7", + "version": "3.4.8", "lockfileVersion": 3, "requires": true, "packages": { "": { "name": "gestion", - "version": "3.4.7", + "version": "3.4.8", "license": "AGPL-3.0-or-later", "devDependencies": { "@nextcloud/dialogs": "^7.4.0", diff --git a/package.json b/package.json index c267abf0..99c5eb39 100755 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "gestion", - "version": "3.4.7", + "version": "3.4.8", "description": "Application pour gérer votre micro entreprise, client, facture, devis", "author": "Benjamin AIMARD", "contributors": [ diff --git a/src/js/modules/workspace.js b/src/js/modules/workspace.js index 1782da33..582de1c6 100644 --- a/src/js/modules/workspace.js +++ b/src/js/modules/workspace.js @@ -174,6 +174,32 @@ function applyLockedState() { } document.addEventListener('DOMContentLoaded', () => { + const announcement = document.getElementById('gestion-announcement'); + if (announcement) { + const close = announcement.querySelector('[data-dismiss-announcement]'); + const dismiss = async () => { + if (close.disabled) return; + close.disabled = true; + try { + await request('/announcements/acknowledge', {version: announcement.dataset.announcementVersion}); + announcement.close(); + announcement.remove(); + } catch { + close.disabled = false; + showError(t('gestion', 'The operation could not be completed.')); + } + }; + close.addEventListener('click', dismiss); + announcement.addEventListener('cancel', event => { event.preventDefault(); dismiss(); }); + announcement.addEventListener('keydown', event => { + if (event.key === 'Escape') { + event.preventDefault(); + event.stopPropagation(); + dismiss(); + } + }); + announcement.showModal(); + } applyLockedState(); // Keep action menus outside table clipping, including on the final row. let openActions = null; diff --git a/templates/content/changelog.php b/templates/content/changelog.php index 4fc6ee21..e8cb1e22 100755 --- a/templates/content/changelog.php +++ b/templates/content/changelog.php @@ -1,3 +1,16 @@ + + +

t('Qonto application: beta testers wanted')); ?>

+
+

t('I am looking for beta testers for the Qonto application, with the aim of fully integrating it with Gestion.')); ?>

+

t('Your feedback will help shape the integration and test real-world workflows. If you would like to take part, contact me and tell me how you use Qonto and Gestion.')); ?>

+
+
+ t('Join the beta testing')); ?> + +
+
+