From 21b6004208d44289e4695016e9c7634ea658bd77 Mon Sep 17 00:00:00 2001 From: Herman van Rink <rink@initfour.nl> Date: Mon, 10 Feb 2020 09:40:53 +0100 Subject: [PATCH] Show (disabled) client field on mail_domain edit --- interface/web/mail/mail_domain_edit.php | 8 +++++++- interface/web/mail/templates/mail_domain_edit.htm | 13 ++++++++++--- 2 files changed, 17 insertions(+), 4 deletions(-) diff --git a/interface/web/mail/mail_domain_edit.php b/interface/web/mail/mail_domain_edit.php index 51d55ef2de..6f2bdb8f91 100644 --- a/interface/web/mail/mail_domain_edit.php +++ b/interface/web/mail/mail_domain_edit.php @@ -75,7 +75,13 @@ class page_action extends tform_actions { $app->uses('ini_parser,getconf'); $settings = $app->getconf->get_global_config('domains'); - if($_SESSION["s"]["user"]["typ"] == 'admin' && $settings['use_domain_module'] != 'y') { + if($_SESSION["s"]["user"]["typ"] == 'admin' && $settings['use_domain_module'] == 'y') { + $sql = "SELECT CONCAT(IF(client.company_name != '', CONCAT(client.company_name, ' :: '), ''), client.contact_name, ' (', client.username, IF(client.customer_no != '', CONCAT(', ', client.customer_no), ''), ')') as contactname FROM sys_group, client WHERE sys_group.client_id = client.client_id AND sys_group.client_id = ?"; + $clients = $app->db->queryAllRecords($sql, $this->dataRecord['sys_groupid']); + $client_select = '<option value="dummy">'.$clients[0]['contactname'].'</option>'; + $app->tpl->setVar("client_group_name", $client_select); + } + elseif($_SESSION["s"]["user"]["typ"] == 'admin' && $settings['use_domain_module'] != 'y') { // Getting Clients of the user $sql = "SELECT sys_group.groupid, sys_group.name, CONCAT(IF(client.company_name != '', CONCAT(client.company_name, ' :: '), ''), client.contact_name, ' (', client.username, IF(client.customer_no != '', CONCAT(', ', client.customer_no), ''), ')') as contactname FROM sys_group, client WHERE sys_group.client_id = client.client_id AND sys_group.client_id > 0 ORDER BY client.company_name, client.contact_name, sys_group.name"; diff --git a/interface/web/mail/templates/mail_domain_edit.htm b/interface/web/mail/templates/mail_domain_edit.htm index 1e4a49c2a5..42ae8fe280 100644 --- a/interface/web/mail/templates/mail_domain_edit.htm +++ b/interface/web/mail/templates/mail_domain_edit.htm @@ -6,21 +6,28 @@ {tmpl_var name='server_id'} </select></div> <input type="hidden" name="server_id" value="{tmpl_var name='server_id_value'}" /> - <tmpl_else> + <tmpl_else> <label for="server_id" class="col-sm-3 control-label">{tmpl_var name='server_id_txt'}</label> <div class="col-sm-9"><select name="server_id" id="server_id" class="form-control"> {tmpl_var name='server_id'} </select></div> </tmpl_if> </div> - <tmpl_unless name="domain_option"> + <tmpl_if name="domain_option"> + <div class="form-group"> + <label for="client_group_id" class="col-sm-3 control-label">{tmpl_var name='client_txt'}</label> + <div class="col-sm-9"><select name="server_id_disabled" id="server_id_disabled" class="form-control" disabled="disabled"> + {tmpl_var name='client_group_name'} + </select></div> + </div> + <tmpl_else> <div class="form-group"> <label for="client_group_id" class="col-sm-3 control-label">{tmpl_var name='client_txt'}</label> <div class="col-sm-9"><select name="client_group_id" id="client_group_id" class="form-control"> {tmpl_var name='client_group_id'} </select></div> </div> - </tmpl_unless> + </tmpl_if> <tmpl_else> <tmpl_if name="only_one_server"> <input type="hidden" id="server_id" name="server_id" value="{tmpl_var name='server_id_value'}" /> -- GitLab