From 82480623cdadfe2a093389f10ae53e1c22d58b6c Mon Sep 17 00:00:00 2001
From: "cedric@yterium.com" <>
Date: Wed, 2 Mar 2011 10:31:29 +0000
Subject: [PATCH] =?UTF-8?q?Lorsqu'on=20dissocie=20un=20document=20ajoute?=
 =?UTF-8?q?=20lors=20de=20la=20creation=20d'un=20article=20(ou=20autre),?=
 =?UTF-8?q?=20on=20appelle=20l'action/dissocier=5Fdocument=20avec=20un=20i?=
 =?UTF-8?q?d=5Fobjet=20negatif.=20Ne=20pas=20se=20prendre=20les=20pieds=20?=
 =?UTF-8?q?dans=20le=20tapis=20lors=20de=20la=20decomposition=20de=20$arg?=
 =?UTF-8?q?=20(r=C3=A9soud=20accessoirement=20http://core.spip.org/issues/?=
 =?UTF-8?q?1990,=20mais=20sans=20aucun=20rapport=20avec=20la=20cause=20ini?=
 =?UTF-8?q?tiale=20du=20ticket)?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

---
 action/dissocier_document.php | 14 +++++++++++---
 1 file changed, 11 insertions(+), 3 deletions(-)

diff --git a/action/dissocier_document.php b/action/dissocier_document.php
index 7f6169c4..4d06d240 100644
--- a/action/dissocier_document.php
+++ b/action/dissocier_document.php
@@ -17,7 +17,7 @@ if (!defined("_ECRIRE_INC_VERSION")) return;
  * Dissocier un document
  * $arg fournit les arguments de la fonction dissocier_document
  * sous la forme
- * $document-$objet-$id_objet-suppr-safe
+ * $id_objet-$objet-$document-suppr-safe
  *
  * 4eme arg : suppr = true, false sinon
  * 5eme arg : safe = true, false sinon
@@ -28,9 +28,17 @@ function action_dissocier_document_dist(){
 	$securiser_action = charger_fonction('securiser_action', 'inc');
 	$arg = $securiser_action();
 
-	$arg = explode('-',$arg);
+	// attention au cas ou id_objet est negatif !
+	if (strncmp($arg,'-',1)==0){
+		$arg = explode('-',substr($arg,1));
+		list($id_objet, $objet, $document) = $arg;
+		$id_objet = -$id_objet;
+	}
+	else {
+		$arg = explode('-',$arg);
+		list($id_objet, $objet, $document) = $arg;
+	}
 
-	list($id_objet, $objet, $document) = $arg;
 	$suppr=false;
 	if (count($arg)>3 AND $arg[3]=='suppr')
 		$suppr = true;
-- 
GitLab