From 41d7d170bc4673e9a4e89a49c191b414e38ef0d7 Mon Sep 17 00:00:00 2001
From: Sergio Cambra <sergio@programatica.es>
Date: Tue, 08 Jul 2014 08:00:01 -0400
Subject: [PATCH] default servers on system config for admin use
---
interface/web/client/domain_edit.php | 16 +++++++++++++---
1 files changed, 13 insertions(+), 3 deletions(-)
diff --git a/interface/web/client/domain_edit.php b/interface/web/client/domain_edit.php
index 735ec0b..a79ba85 100644
--- a/interface/web/client/domain_edit.php
+++ b/interface/web/client/domain_edit.php
@@ -166,9 +166,10 @@
}
else {
/*
- * We edit a existing one, but there is nothing to edit
+ * We edit a existing one, but domain name can't be changed
*/
- $this->dataRecord = $app->tform->getDataRecord($this->id);
+ $oldData = $app->tform->getDataRecord($this->id);
+ $this->dataRecord["domain"] = $oldData["domain"];
}
} else {
if($this->id > 0) {
@@ -203,11 +204,20 @@
function onAfterUpdate() {
global $app, $conf;
+ if($_SESSION["s"]["user"]["typ"] != 'admin' && isset($this->dataRecord["client_group_id"])) {
+ $client_group_id = $app->functions->intval($_SESSION["s"]["user"]["default_group"]);
+ $client = $app->db->queryOneRecord("SELECT client.client_id FROM sys_group, client WHERE sys_group.client_id = client.client_id and sys_group.groupid = $client_group_id");
+ $group = $app->db->queryOneRecord("SELECT sys_group.groupid FROM sys_group, client WHERE sys_group.client_id = client.client_id AND client.parent_client_id = ".$client['client_id']." AND sys_group.groupid = ".$this->dataRecord["client_group_id"]." ORDER BY client.company_name, client.contact_name, sys_group.name";
+ $this->dataRecord["client_group_id"] = $group["groupid"];
+ }
+
// make sure that the record belongs to the client group and not the admin group when admin inserts it
// also make sure that the user can not delete domain created by a admin
- if($_SESSION["s"]["user"]["typ"] == 'admin' && isset($this->dataRecord["client_group_id"])) {
+ if(isset($this->dataRecord["client_group_id"])) {
$client_group_id = $app->functions->intval($this->dataRecord["client_group_id"]);
$app->db->query("UPDATE domain SET sys_groupid = $client_group_id, sys_perm_group = 'ru' WHERE domain_id = ".$this->id);
+ $lng_text = $app->lng("domain_owner_changed");
+ $_SESSION['show_warning_msg'] = str_replace("{domain}", $this->dataRecord["domain"], $lng_text);
}
}
--
Gitblit v1.9.1