[Fusionforge-commits] FusionForge branch Branch_5_2 updated. dd7afaa5129bd518836c549eca43ef9c61c30410

Franck VILLAUME nerville at fusionforge.org
Sat Mar 9 17:34:36 CET 2013


This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "FusionForge".

The branch, Branch_5_2 has been updated
       via  dd7afaa5129bd518836c549eca43ef9c61c30410 (commit)
      from  9b87c74306de5eec75770be3ac46f812f01f9c48 (commit)

Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.

- Log -----------------------------------------------------------------
commit dd7afaa5129bd518836c549eca43ef9c61c30410
Author: Franck Villaume <franck.villaume at trivialdev.com>
Date:   Sat Mar 9 17:33:56 2013 +0100

    fix #528: complains about forums when creating mailing-list even if forum tool is deactivated

diff --git a/src/common/forum/Forum.class.php b/src/common/forum/Forum.class.php
index 697f406..df91168 100644
--- a/src/common/forum/Forum.class.php
+++ b/src/common/forum/Forum.class.php
@@ -6,6 +6,7 @@
  * Copyright 2002, Tim Perdue/GForge, LLC
  * Copyright 2009, Roland Mas
  * Copyright (C) 2011 Alain Peyrat - Alcatel-Lucent
+ * Copyright 2013, Franck Villaume - TrivialDev
  *
  * This file is part of FusionForge. FusionForge is free software;
  * you can redistribute it and/or modify it under the terms of the
@@ -598,6 +599,17 @@ class Forum extends Error {
 			return false;
 		}
 
+		$project_name = $this->Group->getUnixName();
+		$result_list_samename = db_query_params('SELECT 1 FROM mail_group_list WHERE list_name=$1 AND group_id=$2',
+
+							array($project_name.'-'.strtolower($forum_name),
+								$this->Group->getID()));
+
+		if (db_numrows($result_list_samename) > 0){
+			$this->setError(_('Mailing List Exists with same name'));
+			return false;
+		}
+		
 		$res = db_query_params('UPDATE forum_group_list SET
 			forum_name=$1,
 			description=$2,
diff --git a/src/common/include/utils.php b/src/common/include/utils.php
index 6c1914d..8209926 100644
--- a/src/common/include/utils.php
+++ b/src/common/include/utils.php
@@ -8,6 +8,7 @@
  * Copyright (c) 2010, 2011, 2012
  *	Thorsten Glaser <t.glaser at tarent.de>
  * Copyright 2010-2011, Alain Peyrat - Alcatel-Lucent
+ * Copyright 2013, Franck Villaume - TrivialDev
  *
  * This file is part of FusionForge. FusionForge is free software;
  * you can redistribute it and/or modify it under the terms of the
@@ -1219,37 +1220,41 @@ function util_ensure_value_in_set ($value, $set) {
 
 function check_email_available($group, $email, &$response) {
 	// Check if a mailing list with same name already exists
-	$mlFactory = new MailingListFactory($group);
-	if (!$mlFactory || !is_object($mlFactory) || $mlFactory->isError()) {
-		$response .= $mlFactory->getErrorMessage();
-		return false;
-	}
-	$mlArray = $mlFactory->getMailingLists();
-	if ($mlFactory->isError()) {
-		$response .= $mlFactory->getErrorMessage();
-		return false;
-	}
-	for ($j = 0; $j < count($mlArray); $j++) {
-		$currentList =& $mlArray[$j];
-		if ($email == $currentList->getName()) {
-			$response .= _('Error: a mailing list with the same email address already exists.');
+	if ($group->usesMail()) {
+		$mlFactory = new MailingListFactory($group);
+		if (!$mlFactory || !is_object($mlFactory) || $mlFactory->isError()) {
+			$response .= $mlFactory->getErrorMessage();
 			return false;
 		}
+		$mlArray = $mlFactory->getMailingLists();
+		if ($mlFactory->isError()) {
+			$response .= $mlFactory->getErrorMessage();
+			return false;
+		}
+		for ($j = 0; $j < count($mlArray); $j++) {
+			$currentList =& $mlArray[$j];
+			if ($email == $currentList->getName()) {
+				$response .= _('Error: a mailing list with the same email address already exists.');
+				return false;
+			}
+		}
 	}
 
 	// Check if a forum with same name already exists
-	$ff = new ForumFactory($group);
-	if (!$ff || !is_object($ff) || $ff->isError()) {
-		$response .= $ff->getErrorMessage();
-		return false;
-	}
-	$farr = $ff->getForums();
-	$prefix = $group->getUnixName() . '-';
-	for ($j = 0; $j < count($farr); $j++) {
-		if (is_object($farr[$j])) {
-			if ($email == $prefix . $farr[$j]->getName()) {
-				$response .= _('Error: a forum with the same email address already exists.');
-				return false;
+	if ($group->usesForum()) {
+		$ff = new ForumFactory($group);
+		if (!$ff || !is_object($ff) || $ff->isError()) {
+			$response .= $ff->getErrorMessage();
+			return false;
+		}
+		$farr = $ff->getForums();
+		$prefix = $group->getUnixName() . '-';
+		for ($j = 0; $j < count($farr); $j++) {
+			if (is_object($farr[$j])) {
+				if ($email == $prefix . $farr[$j]->getName()) {
+					$response .= _('Error: a forum with the same email address already exists.');
+					return false;
+				}
 			}
 		}
 	}

-----------------------------------------------------------------------

Summary of changes:
 src/common/forum/Forum.class.php |   12 ++++++++
 src/common/include/utils.php     |   57 +++++++++++++++++++++-----------------
 2 files changed, 43 insertions(+), 26 deletions(-)


hooks/post-receive
-- 
FusionForge



More information about the Fusionforge-commits mailing list