[Fusionforge-commits] r12450 - trunk/src/plugins/mantisbt/common

Franck VILLAUME nerville at fusionforge.org
Mon Feb 28 23:37:15 CET 2011


Author: nerville
Date: 2011-02-28 23:37:12 +0100 (Mon, 28 Feb 2011)
New Revision: 12450

Modified:
   trunk/src/plugins/mantisbt/common/MantisBTPlugin.class.php
Log:
fix group_delete hook

Modified: trunk/src/plugins/mantisbt/common/MantisBTPlugin.class.php
===================================================================
--- trunk/src/plugins/mantisbt/common/MantisBTPlugin.class.php	2011-02-28 22:27:16 UTC (rev 12449)
+++ trunk/src/plugins/mantisbt/common/MantisBTPlugin.class.php	2011-02-28 22:37:12 UTC (rev 12450)
@@ -211,29 +211,28 @@
 	}
 
 	function removeProjectMantis($idProjet) {
-		$resIdProjetMantis = db_query_params('SELECT id_mantisbt FROM plugin_mantisbt WHERE id_group = $1',
-						array($idProjet));
+		$groupObject = group_get_object($idProjet);
+		$localMantisbtConf = $this->getMantisBTConf();
 
-		echo db_error();
-		$row = db_fetch_array($resIdProjetMantis);
-
-		if ($row == null || count($row)>2) {
-			echo 'removeProjetMantis:: ' . _('No project found');
-		}else{
-			$idMantisbt = $row['id_mantisbt'];
+		if (!$localMantisbtConf) {
+			$groupObject->setError('removeProjetMantis::Error' . ' '. _('No project found'));
+			return false;
+		} else {
 			try {
-				$clientSOAP = new SoapClient(forge_get_config('server_url','mantisbt')."/api/soap/mantisconnect.php?wsdl", array('trace'=>true, 'exceptions'=>true));
-				$delete = $clientSOAP->__soapCall('mc_project_delete', array("username" => forge_get_config('adminsoap_user','mantisbt'), "password" => forge_get_config('adminsoap_password','mantisbt'), "project_id" => $idMantisbt));
+				$clientSOAP = new SoapClient($localMantisbtConf['url']."/api/soap/mantisconnect.php?wsdl", array('trace'=>true, 'exceptions'=>true));
+				$delete = $clientSOAP->__soapCall('mc_project_delete', array("username" => $localMantisbtConf['soap_user'], "password" => $localMantisbtConf['soap_password'], "project_id" => $localMantisbtConf['id_mantisbt']));
 			} catch (SoapFault $soapFault) {
-				echo $soapFault->faultstring;
+				$groupObject->setError('removeProjetMantis::Error' . ' '.$soapFault->faultstring);
+				return false;
 			}
 			if (!isset($delete)){
-				echo 'removeProjetMantis:: ' . _('No project found in MantisBT') . ' ' .$idProjet;
+				$groupObject->setError('removeProjetMantis:: ' . _('No project found in MantisBT') . ' ' .$localMantisbtConf['id_mantisbt']);
+				return false
 			}else{
 				db_query_params('DELETE FROM plugin_mantisbt WHERE id_mantisbt = $1',
-						array($idMantisbt));
-				echo db_error();
+						array($localMantisbtConf['id_mantisbt']));
 			}
+			return true;
 		}
 	}
 




More information about the Fusionforge-commits mailing list