diff --git a/ecrire/action/editer_article.php b/ecrire/action/editer_article.php index 51de629f009dbb5a3a8510be6cd1c47e095e59ce..0629cbf60e55bf76ac187a6719092d588f7ac78d 100644 --- a/ecrire/action/editer_article.php +++ b/ecrire/action/editer_article.php @@ -62,7 +62,6 @@ function articles_set($id_article, $c=false) { return $err; } -- // http://doc.spip.org/@insert_article function insert_article($id_rubrique) { @@ -250,7 +249,7 @@ function instituer_article($id_article, $c) { $s = spip_query("SELECT statut, id_rubrique FROM spip_articles WHERE id_article=$id_article"); $row = spip_fetch_array($s); $id_rubrique = $row['id_rubrique']; - $statut = $row['statut']; + $statut_ancien = $statut = $row['statut']; $s = _request('statut', $c); if ($s AND _request('statut', $c) != $statut) { @@ -261,9 +260,14 @@ function instituer_article($id_article, $c) { else spip_log("editer_article $id_article refus " . join(' ', $c)); - // En cas de publication, fixer la date a "maintenant". - if ($champs['statut'] == 'publie') - $champs['date'] = date('Y-m-d H:i:s'); + // En cas de publication, fixer la date a "maintenant" + // sauf si $c commande autre chose + if ($champs['statut'] == 'publie') { + if ($d = _request('date', $c)) + $champs['date'] = $d; + else + $champs['date'] = date('Y-m-d H:i:s'); + } } // Verifier que la rubrique demandee existe et est differente @@ -339,13 +343,15 @@ function instituer_article($id_article, $c) { calculer_rubriques(); // Notification ? + $data = $champs; + $data['statut_ancien'] = $statut_ancien; pipeline('post_edition', array( 'args' => array( 'table' => 'spip_articles', 'id_objet' => $id_article ), - 'data' => $champs + 'data' => $data ) ); } diff --git a/ecrire/inc/notifications.php b/ecrire/inc/notifications.php index 7b880a5a6c02b1a73294678b82befa7aa79d1376..7df5583e1f0991838a20dcc7501e90acc37baf14 100644 --- a/ecrire/inc/notifications.php +++ b/ecrire/inc/notifications.php @@ -27,17 +27,15 @@ function notifications($pipeline, $x) { OR $x['data']['statut'] == 'prop') ) { + $id_article = $x['args']['id_objet']; $statut = $x['data']['statut']; - $id_article = intval($x['args']['id_objet']); - $result = spip_query("SELECT statut FROM spip_articles WHERE id_article=$id_article"); - if ($row = spip_fetch_array($result)) - $statut_ancien = $row['statut']; - else - return $x; + $statut_ancien = $x['data']['statut_ancien']; // ne devrait jamais se produire - if ($statut == $statut_ancien) + if ($statut == $statut_ancien) { + spip_log("statut inchange"); return $x; + } include_spip('inc/lang'); include_spip('inc/texte');