Skip to content

Commit 5dc7c8f

Browse files
committed
allow to change domain's owner to their reseller
1 parent a71b8a0 commit 5dc7c8f

File tree

1 file changed

+11
-3
lines changed

1 file changed

+11
-3
lines changed

interface/web/client/domain_edit.php

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -166,9 +166,10 @@ function onSubmit() {
166166
}
167167
else {
168168
/*
169-
* We edit a existing one, but there is nothing to edit
169+
* We edit a existing one, but domain name can't be changed
170170
*/
171-
$this->dataRecord = $app->tform->getDataRecord($this->id);
171+
$oldData = $app->tform->getDataRecord($this->id);
172+
$this->dataRecord["domain"] = $oldData["domain"];
172173
}
173174
} else {
174175
if($this->id > 0) {
@@ -203,9 +204,16 @@ function onAfterInsert() {
203204
function onAfterUpdate() {
204205
global $app, $conf;
205206

207+
if($_SESSION["s"]["user"]["typ"] != 'admin' && isset($this->dataRecord["client_group_id"])) {
208+
$client_group_id = $app->functions->intval($_SESSION["s"]["user"]["default_group"]);
209+
$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");
210+
$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";
211+
$this->dataRecord["client_group_id"] = $group["groupid"];
212+
}
213+
206214
// make sure that the record belongs to the client group and not the admin group when admin inserts it
207215
// also make sure that the user can not delete domain created by a admin
208-
if($_SESSION["s"]["user"]["typ"] == 'admin' && isset($this->dataRecord["client_group_id"])) {
216+
if(isset($this->dataRecord["client_group_id"])) {
209217
$client_group_id = $app->functions->intval($this->dataRecord["client_group_id"]);
210218
$app->db->query("UPDATE domain SET sys_groupid = $client_group_id, sys_perm_group = 'ru' WHERE domain_id = ".$this->id);
211219
$lng_text = $app->lng("domain_owner_changed");

0 commit comments

Comments
 (0)