diff --git a/src/messenger/.idea/projectCodeStyle.xml b/src/messenger/.idea/projectCodeStyle.xml
index 2a025446..596456e4 100644
--- a/src/messenger/.idea/projectCodeStyle.xml
+++ b/src/messenger/.idea/projectCodeStyle.xml
@@ -13,6 +13,16 @@
+
+
+
+
+
+
+
+
+
+
diff --git a/src/messenger/webim/leavemessage.php b/src/messenger/webim/leavemessage.php
index 0ee3f036..15ee680f 100644
--- a/src/messenger/webim/leavemessage.php
+++ b/src/messenger/webim/leavemessage.php
@@ -51,6 +51,7 @@ function store_message($name, $email, $info, $message,$groupid,$referrer) {
$groupid = "";
$groupname = "";
+$group = NULL;
loadsettings();
if($settings['enablegroups'] == '1') {
$groupid = verifyparam( "group", "/^\d{1,8}$/", "");
@@ -108,7 +109,11 @@ store_message($visitor_name, $email, $info, $message, $groupid, $referrer);
$subject = getstring2_("leavemail.subject", array($visitor_name), $message_locale);
$body = getstring2_("leavemail.body", array($visitor_name,$email,$message,$info ? "$info\n" : ""), $message_locale);
-$inbox_mail = $settings['email'];
+if (isset($group) && !empty($group['vcemail'])) {
+ $inbox_mail = $group['vcemail'];
+} else {
+ $inbox_mail = $settings['email'];
+}
if($inbox_mail) {
$link = connect();
diff --git a/src/messenger/webim/locales/en/properties b/src/messenger/webim/locales/en/properties
index 95efb873..ab9643c1 100644
--- a/src/messenger/webim/locales/en/properties
+++ b/src/messenger/webim/locales/en/properties
@@ -144,6 +144,7 @@ form.field.groupcommonname.description=Name in English.
form.field.groupcommonname=International name
form.field.groupdesc.description=Description of the group.
form.field.groupdesc=Description
+form.field.groupemail.description=Group email for notifications. Leave empty to use the default address.
form.field.groupname.description=Name to identify the group.
form.field.groupname=Name
form.field.login.description=Login can consist of small Latin letters and underscore.
diff --git a/src/messenger/webim/locales/ru/properties b/src/messenger/webim/locales/ru/properties
index 5b28257c..68c31a8e 100644
--- a/src/messenger/webim/locales/ru/properties
+++ b/src/messenger/webim/locales/ru/properties
@@ -144,6 +144,7 @@ form.field.groupcommonname.description=
form.field.groupcommonname=Интернациональное название
form.field.groupdesc.description=Будет доступно посетителям при выборе группы.
form.field.groupdesc=Описание
+form.field.groupemail.description=Адрес для извещений. Оставьте пустым, чтобы использовать глобальный адрес.
form.field.groupname.description=Может быть названием отдела в вашей компании.
form.field.groupname=Название группы
form.field.login.description=Логин может состоять из маленьких латинских букв и знака подчеркивания.
diff --git a/src/messenger/webim/operator/group.php b/src/messenger/webim/operator/group.php
index 1eb9ca86..745c46b8 100644
--- a/src/messenger/webim/operator/group.php
+++ b/src/messenger/webim/operator/group.php
@@ -39,16 +39,17 @@ function group_by_name($name)
return $group;
}
-function create_group($name, $descr, $commonname, $commondescr)
+function create_group($name, $descr, $commonname, $commondescr, $email)
{
global $mysqlprefix;
$link = connect();
$query = sprintf(
- "insert into ${mysqlprefix}chatgroup (vclocalname,vclocaldescription,vccommonname,vccommondescription) values ('%s','%s','%s','%s')",
+ "insert into ${mysqlprefix}chatgroup (vclocalname,vclocaldescription,vccommonname,vccommondescription,vcemail) values ('%s','%s','%s','%s','%s')",
mysql_real_escape_string($name),
mysql_real_escape_string($descr),
mysql_real_escape_string($commonname),
- mysql_real_escape_string($commondescr));
+ mysql_real_escape_string($commondescr),
+ mysql_real_escape_string($email));
perform_query($query, $link);
$id = mysql_insert_id($link);
@@ -58,16 +59,17 @@ function create_group($name, $descr, $commonname, $commondescr)
return $newdep;
}
-function update_group($groupid, $name, $descr, $commonname, $commondescr)
+function update_group($groupid, $name, $descr, $commonname, $commondescr, $email)
{
global $mysqlprefix;
$link = connect();
$query = sprintf(
- "update ${mysqlprefix}chatgroup set vclocalname = '%s', vclocaldescription = '%s', vccommonname = '%s', vccommondescription = '%s' where groupid = %s",
+ "update ${mysqlprefix}chatgroup set vclocalname = '%s', vclocaldescription = '%s', vccommonname = '%s', vccommondescription = '%s', vcemail = '%s' where groupid = %s",
mysql_real_escape_string($name),
mysql_real_escape_string($descr),
mysql_real_escape_string($commonname),
mysql_real_escape_string($commondescr),
+ mysql_real_escape_string($email),
$groupid);
perform_query($query, $link);
@@ -81,10 +83,14 @@ if (isset($_POST['name'])) {
$description = getparam('description');
$commonname = getparam('commonname');
$commondescription = getparam('commondescription');
+ $email = getparam('email');
if (!$name)
$errors[] = no_field("form.field.groupname");
+ if ($email != '' && !is_valid_email($email))
+ $errors[] = wrong_field("form.field.mail");
+
$existing_group = group_by_name($name);
if ((!$groupid && $existing_group) ||
($groupid && $existing_group && $groupid != $existing_group['groupid']))
@@ -92,11 +98,11 @@ if (isset($_POST['name'])) {
if (count($errors) == 0) {
if (!$groupid) {
- $newdep = create_group($name, $description, $commonname, $commondescription);
+ $newdep = create_group($name, $description, $commonname, $commondescription, $email);
header("Location: $webimroot/operator/groupmembers.php?gid=" . $newdep['groupid']);
exit;
} else {
- update_group($groupid, $name, $description, $commonname, $commondescription);
+ update_group($groupid, $name, $description, $commonname, $commondescription, $email);
header("Location: $webimroot/operator/group.php?gid=$groupid&stored");
exit;
}
@@ -105,6 +111,7 @@ if (isset($_POST['name'])) {
$page['formdescription'] = topage($description);
$page['formcommonname'] = topage($commonname);
$page['formcommondescription'] = topage($commondescription);
+ $page['formemail'] = topage($email);
$page['grid'] = topage($groupid);
}
@@ -120,6 +127,7 @@ if (isset($_POST['name'])) {
$page['formdescription'] = topage($group['vclocaldescription']);
$page['formcommonname'] = topage($group['vccommonname']);
$page['formcommondescription'] = topage($group['vccommondescription']);
+ $page['formemail'] = topage($group['vcemail']);
$page['grid'] = topage($group['groupid']);
}
}
@@ -129,4 +137,4 @@ prepare_menu($operator);
setup_group_settings_tabs($groupid, 0);
start_html_output();
require('../view/group.php');
-?>
\ No newline at end of file
+?>
diff --git a/src/messenger/webim/view/group.php b/src/messenger/webim/view/group.php
index 9ec6959f..bc9ba628 100644
--- a/src/messenger/webim/view/group.php
+++ b/src/messenger/webim/view/group.php
@@ -85,7 +85,16 @@ require_once('inc_errors.php');
—
-
+
+
+