[Fusionforge-commits] r10228 - trunk/src/plugins/projects_hierarchy/www

Franck VILLAUME nerville at libremir.placard.fr.eu.org
Tue Jul 13 15:39:25 CEST 2010


Author: nerville
Date: 2010-07-13 15:39:25 +0200 (Tue, 13 Jul 2010)
New Revision: 10228

Modified:
   trunk/src/plugins/projects_hierarchy/www/add_son.php
   trunk/src/plugins/projects_hierarchy/www/wait_son.php
Log:
send notification mail to son project admins when new son relationship added, send notification mail to parent project admins when this son relationship is validated

Modified: trunk/src/plugins/projects_hierarchy/www/add_son.php
===================================================================
--- trunk/src/plugins/projects_hierarchy/www/add_son.php	2010-07-12 17:11:21 UTC (rev 10227)
+++ trunk/src/plugins/projects_hierarchy/www/add_son.php	2010-07-13 13:39:25 UTC (rev 10228)
@@ -1,26 +1,23 @@
 <?php
 /**
- * Role Editing Page
- *
  * Copyright 2004 (c) GForge LLC
+ * Copyright 2006 (c) Sogeti : Fabien Regnier
+ * Copyright 2010 (c) Capgemini : Franck Villaume
  *
- * @author Fabien Regnier fabien.regnier at sogeti.com
- * @date 2006-10-10
+ * This file is part of FusionForge.
  *
- * This file is part of GForge.
- *
- * GForge is free software; you can redistribute it and/or modify
+ * FusionForge is free software; you can redistribute it and/or modify
  * it under the terms of the GNU General Public License as published by
  * the Free Software Foundation; either version 2 of the License, or
  * (at your option) any later version.
  *
- * GForge is distributed in the hope that it will be useful,
+ * FusionForge is distributed in the hope that it will be useful,
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  * GNU General Public License for more details.
  *
  * You should have received a copy of the GNU General Public License
- * along with GForge; if not, write to the Free Software
+ * along with FusionForge; if not, write to the Free Software
  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
  */
 
@@ -41,5 +38,45 @@
 				$com)) or die(db_error());
 db_commit();
 
+// send mail to admin of the son project for validation
+$project_name_res = db_query_params ('SELECT group_name from groups where group_id=$1',
+                                     array ( $group_id ) );
+echo db_error();
+$row =& db_fetch_array($project_name_res);
+
+$project_name = $row['group_name'];
+
+$child_project_name_res = db_query_params ('SELECT group_name from groups where group_id=$1',
+                                     array ( $sub_project_id ) );
+echo db_error();
+$row =& db_fetch_array($child_project_name_res);
+
+$child_project_name = $row['group_name'];
+
+$message = sprintf(_('New Parent Relation Submitted 
+
+Parent Project Full Name: %1$s
+Child Project Full Name: %2$s 
+Need validation.
+Please visit the following URL %3$s'), $project_name,$child_project_name,util_make_url ('project/admin/index.php?group_id='.$sub_project_id));
+
+$res = db_query_params ('SELECT users.email, users.language, users.user_id
+                         FROM users, user_group
+                         WHERE group_id=$1 
+                         AND user_group.admin_flags=$2
+                         AND users.user_id=user_group.user_id',
+                         array ($sub_project_id,'A'));
+
+if (db_numrows($res) < 1) {
+    $this->setError(_("There is no administrator to send the mail."));
+    return false;
+}
+
+for ($i=0; $i<db_numrows($res) ; $i++) {
+    $admin_email = db_result($res,$i,'email') ;
+
+    util_send_message($admin_email,sprintf(_('New Parent %1$s Relation Submitted'), $project_name), $message);
+}
+
 header("Location: ".util_make_url ('/project/admin/index.php?group_id='.$group_id));
 ?>

Modified: trunk/src/plugins/projects_hierarchy/www/wait_son.php
===================================================================
--- trunk/src/plugins/projects_hierarchy/www/wait_son.php	2010-07-12 17:11:21 UTC (rev 10227)
+++ trunk/src/plugins/projects_hierarchy/www/wait_son.php	2010-07-13 13:39:25 UTC (rev 10228)
@@ -1,26 +1,23 @@
 <?php
 /**
- * Role Editing Page
- *
  * Copyright 2004 (c) GForge LLC
+ * Copyright 2006 (c) Sogeti : Fabien Regnier
+ * Copyright 2010 (c) Capgemini : Franck Villaume
  *
- * @author Fabien Regnier fabien.regnier at sogeti.com
- * @date 2006-10-10
+ * This file is part of FusionForge.
  *
- * This file is part of GForge.
- *
- * GForge is free software; you can redistribute it and/or modify
+ * FusionForge is free software; you can redistribute it and/or modify
  * it under the terms of the GNU General Public License as published by
  * the Free Software Foundation; either version 2 of the License, or
  * (at your option) any later version.
  *
- * GForge is distributed in the hope that it will be useful,
+ * FusionForge is distributed in the hope that it will be useful,
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  * GNU General Public License for more details.
  *
  * You should have received a copy of the GNU General Public License
- * along with GForge; if not, write to the Free Software
+ * along with FusionForge; if not, write to the Free Software
  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
  */
 
@@ -44,5 +41,43 @@
 
 plugin_hook('add_cal_link_father',$params);
 
+// send mail to admin of the parent project for share knowledge
+$project_name_res = db_query_params ('SELECT group_name from groups where group_id=$1',
+                                     array ( $group_id ) );
+echo db_error();
+$row =& db_fetch_array($project_name_res);
+
+$project_name = $row['group_name'];
+
+$child_project_name_res = db_query_params ('SELECT group_name from groups where group_id=$1',
+                                     array ( $sub_group_id ) );
+echo db_error();
+$row =& db_fetch_array($child_project_name_res);
+
+$child_project_name = $row['group_name'];
+
+$message = sprintf(_('New Parent Relation Validated 
+
+Parent Project Full Name: %1$s
+Child Project Full Name: %2$s'), $project_name,$child_project_name);
+
+$res = db_query_params ('SELECT users.email, users.language, users.user_id
+                         FROM users, user_group
+                         WHERE group_id=$1 
+                         AND user_group.admin_flags=$2
+                         AND users.user_id=user_group.user_id',
+                         array ($group_id,'A'));
+
+if (db_numrows($res) < 1) {
+    $this->setError(_("There is no administrator to send the mail."));
+    return false;
+}
+
+for ($i=0; $i<db_numrows($res) ; $i++) {
+    $admin_email = db_result($res,$i,'email') ;
+
+    util_send_message($admin_email,sprintf('New Parent %1$s Relation Validated', $project_name), $message);
+}
+
 header("Location: ".util_make_url ('/project/admin/index.php?group_id='.$sub_group_id));
 ?>




More information about the Fusionforge-commits mailing list