diff s4-funcs.sh @ 424:c250bc6da8ad

Notify group join/resign of group to adminsl
author HIROSE Yuuji <yuuji@gentei.org>
date Mon, 10 Apr 2017 22:32:14 +0859
parents a183d6e0ed5e
children 961173fdc904
line wrap: on
line diff
--- a/s4-funcs.sh	Sat Mar 18 08:25:55 2017 +0859
+++ b/s4-funcs.sh	Mon Apr 10 22:32:14 2017 +0859
@@ -2802,9 +2802,12 @@
     esac
   fi
   qgname=`sqlquote $1`
+  grid=`query "SELECT rowid FROM grp WHERE gname=$qgname;"`
   cond="where gname=$qgname and user='$2'"
   if [ x"$3" = x"yes" ]; then
     query "replace into grp_mem values($qgname, '$2');"
+    # Notify joingrp to admin
+    action="に加入しました。"
     if [ -n "$4" ]; then
       if msg=`emaildomaincheck "$4"`; then
 	query "replace into grp_mem_s values($qgname, '$user', 'email', \
@@ -2832,7 +2835,14 @@
     query "delete from grp_mem $cond;
 delete from grp_mem_s $cond;
 delete from grp_mem_m $cond;"
+    action="から脱退しました。"
   fi
+  smail "$(collectemail `getgroupadmins $1`)" "Member change of $1"<<-EOF
+	$url?grp+$grid
+    	$user (`gecos $user`)さんが
+	グループ $1
+	$action
+	EOF
 }
 grp_add_team() (
   # $1=grp-rowid $2=team $3...=user-rowid(s)

yatex.org