From 0f0d316624c86531c6db9a4469bd3f9f59872be3 Mon Sep 17 00:00:00 2001 From: RastaPopoulos <rastapopoulos@spip.org> Date: Tue, 30 Aug 2022 16:09:57 +0200 Subject: [PATCH] =?UTF-8?q?feat:=20Ajouter=20des=20notifications=20normali?= =?UTF-8?q?s=C3=A9es=20g=C3=A9n=C3=A9riquement=20pour=20tous=20les=20objet?= =?UTF-8?q?s=20lors=20de=20leurs=20insertions=20et=20modifications?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Ref: #4874 --- ecrire/action/editer_objet.php | 26 ++++++++++++++++++++++++++ ecrire/inc/modifier.php | 11 +++++++++++ 2 files changed, 37 insertions(+) diff --git a/ecrire/action/editer_objet.php b/ecrire/action/editer_objet.php index 24f84b9cd7..b9cc68ee9a 100644 --- a/ecrire/action/editer_objet.php +++ b/ecrire/action/editer_objet.php @@ -295,6 +295,18 @@ function objet_inserer($objet, $id_parent = null, $set = null) { ] ); } + + // Appeler une notification + if ($notifications = charger_fonction('notifications', 'inc')) { + $notifications( + "{$objet}_inserer", + $id, + array( + 'id_parent' => $id_parent, + 'champs' => $champs, + ) + ); + } return $id; } @@ -471,6 +483,20 @@ function objet_instituer($objet, $id, $c, $calcul_rub = true) { // Notifications if ($notifications = charger_fonction('notifications', 'inc')) { + $notifications( + "{$objet}_instituer", + $id, + array( + 'statut' => $statut, + 'statut_ancien' => $statut_ancien, + 'date' => $date, + 'date_ancienne' => $date_ancienne, + 'id_parent_ancien' => $id_rubrique, + 'champs' => $champs + ) + ); + + // Rétro-compat $notifications( "instituer$objet", $id, diff --git a/ecrire/inc/modifier.php b/ecrire/inc/modifier.php index c91ffa392f..c401debfb2 100644 --- a/ecrire/inc/modifier.php +++ b/ecrire/inc/modifier.php @@ -311,6 +311,17 @@ function objet_modifier_champs($objet, $id_objet, $options, $c = null, $serveur ] ); } + + // Appeler une notification + if ($notifications = charger_fonction('notifications', 'inc')) { + $notifications( + "{$objet}_modifier", + $id_objet, + array( + 'champs' => $champs, + ) + ); + } // journaliser l'affaire // message a affiner :-) -- GitLab