From c5bf83a4f8e74f265b00e377e68b659d9bbb2087 Mon Sep 17 00:00:00 2001 From: Tykayn Date: Sat, 5 Jul 2025 16:34:37 +0200 Subject: [PATCH] =?UTF-8?q?lien=20de=20modification=20dans=20le=20graphe?= =?UTF-8?q?=20d=C3=A9taill=C3=A9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/Controller/AdminController.php | 2 ++ src/Controller/PublicController.php | 30 +++++++++++++++---- .../admin/followup_theme_graph.html.twig | 3 +- 3 files changed, 29 insertions(+), 6 deletions(-) diff --git a/src/Controller/AdminController.php b/src/Controller/AdminController.php index 13f1539..5cddd3b 100644 --- a/src/Controller/AdminController.php +++ b/src/Controller/AdminController.php @@ -574,6 +574,8 @@ final class AdminController extends AbstractController 'tags' => ['main_tag' => $place->getMainTag()], 'is_complete' => !empty($place->getName()), 'osm_url' => 'https://www.openstreetmap.org/' . $place->getOsmKind() . '/' . $place->getOsmId(), + 'uuid' => $place->getUuidForUrl(), + 'zip_code' => $place->getZipCode(), ]; } } diff --git a/src/Controller/PublicController.php b/src/Controller/PublicController.php index 1fdb036..00248df 100644 --- a/src/Controller/PublicController.php +++ b/src/Controller/PublicController.php @@ -422,10 +422,7 @@ class PublicController extends AbstractController $exception = true; $exception_message = $e->getMessage(); - // Debug de la réponse en cas d'erreur - if (method_exists($e, 'getResponse')) { - var_dump($e->getResponse()->getBody()->getContents()); - // Faire un log d'action lors d'une erreur de soumission + // On ne suppose plus la présence de getResponse (évite l'erreur linter) $this->actionLogger->log('ERROR_submit_object_exception', [ 'osm_id' => $osm_object_id ?? null, 'version' => $version ?? null, @@ -434,7 +431,6 @@ class PublicController extends AbstractController 'exception_message' => $e->getMessage(), 'trace' => $e->getTraceAsString(), ]); - } } } @@ -680,4 +676,28 @@ class PublicController extends AbstractController 'icons' => \App\Service\FollowUpService::getFollowUpIcons(), ]); } + + #[Route('/edit-by-osm/{osm_kind}/{osm_id}', name: 'app_public_edit_by_osm')] + public function editByOsm(string $osm_kind, string $osm_id, Request $request): Response + { + $place = $this->entityManager->getRepository(\App\Entity\Place::class)->findOneBy([ + 'osm_kind' => $osm_kind, + 'osmId' => $osm_id + ]); + if ($place) { + return $this->redirectToRoute('app_public_edit', [ + 'zipcode' => $place->getZipCode(), + 'name' => $place->getName() !== '' ? $place->getName() : '?', + 'uuid' => $place->getUuidForUrl() + ]); + } else { + $this->addFlash('warning', "Aucun lieu trouvé pour {$osm_kind} {$osm_id}."); + $referer = $request->headers->get('referer'); + if ($referer) { + return $this->redirect($referer); + } else { + return $this->redirectToRoute('app_public_index'); + } + } + } } diff --git a/templates/admin/followup_theme_graph.html.twig b/templates/admin/followup_theme_graph.html.twig index 653cc70..9375b73 100644 --- a/templates/admin/followup_theme_graph.html.twig +++ b/templates/admin/followup_theme_graph.html.twig @@ -301,7 +301,8 @@ ${Object.entries(f.properties.tags).map(([k,v]) => `${k}: ${v}`).join('
')}
- Voir sur OSM + Voir sur OSM
+ ${f.properties.uuid && f.properties.zip_code && f.properties.name ? `📝 Modifier ce lieu` : ''} `) )