[20902] fix : better management of relation removal..

Pascal Vilarem <[email protected]>
Newsgroups gmane.comp.web.phpgroupware.cvs
Message-ID <[email protected]>
Revision: 20902
          http://svn.sv.gnu.org/viewvc/?view=rev&root=phpgroupware&revision=20902
Author:   maat
Date:     2010-01-04 15:37:43 +0000 (Mon, 04 Jan 2010)
Log Message:
-----------
fix : better management of relation removal..

Modified Paths:
--------------
    modules/ged/trunk/inc/class.flow_client.inc.php

Modified: modules/ged/trunk/inc/class.flow_client.inc.php
===================================================================
--- modules/ged/trunk/inc/class.flow_client.inc.php	2009-11-30 17:28:53 UTC (rev 20901)
+++ modules/ged/trunk/inc/class.flow_client.inc.php	2010-01-04 15:37:43 UTC (rev 20902)
@@ -263,9 +263,25 @@
 		$update_version=$this->get_var('update_version', array('POST', 'GET'));
 		$go_back=$this->get_var('go_back', array('POST', 'GET'));
 		$search=$this->get_var('search', array('POST', 'GET'));
-		$do_add_relation=$this->get_var('do_add_relation', array('POST', 'GET'));
-		$do_remove_relation=$this->get_var('do_remove_relation', array('POST', 'GET'));
+		$tmp_array=$this->get_var('do_add_relation', array('POST', 'GET'));
 		
+		if(is_array($tmp_array))
+		{
+			$key=array_keys($tmp_array);
+			$do_add_relation=$key[0];
+		}
+		else
+			$do_add_relation = null;
+		$tmp_array=$this->get_var('do_remove_relation', array('POST', 'GET'));
+		if(is_array($tmp_array))
+		{
+			$key=array_keys($tmp_array);
+			$do_remove_relation=$key[0];
+		}
+		else
+			$do_remove_relation=null;
+	//	var_dump($_POST);
+		
 		// needed for 'update_file' action
 		$new_file_name=$this->get_var('file_name', array('POST', 'GET'));
 		$new_file_description=$this->get_var('file_description', array('POST', 'GET'));
@@ -408,8 +424,7 @@
 			{
 				$search_results=$this->ged_dm->search($query);
 			}
-			
-			if ( is_array($new_relations) || $search=="search" || $do_add_relation != '' || $do_remove_relation != '' )
+			if ( ( is_array($new_relations) || $search=="search" || $do_add_relation != '' || $do_remove_relation != '' ) && !is_null($new_relations) )
 			{
 				// TODO : Enrichir un peu pour afficher plus d'infos'					
 				$i=0;
@@ -453,7 +468,8 @@
     	
     	$new_relations=null;
     	$nri=0;
-    	if ( is_array($version_relations))
+   
+    	if ( isset($version_relations) && is_array($version_relations))
     	{
     		foreach ( $version_relations as $version_relation )
     		{
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.