Skip to content

Commit 69fab36

Browse files
dariusstefanrazvancrainea
authored andcommitted
alias_mgm: move some suppress alias type logic
1 parent a399550 commit 69fab36

File tree

2 files changed

+10
-4
lines changed

2 files changed

+10
-4
lines changed

Diff for: web/tools/users/alias_management/alias_management.php

+10
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,9 @@
3535

3636
$implicit_domain = get_settings_value("implicit_domain");
3737

38+
$suppress_alias_type = get_settings_value("suppress_alias_type");
39+
$suppress_alias_type = $suppress_alias_type && (count($options) == 1);
40+
3841
$current_page="current_page_alias_management";
3942

4043

@@ -81,6 +84,9 @@
8184
$username = $_POST['username'];
8285
$domain = $_POST['domain'];
8386

87+
if ($suppress_alias_type) {
88+
$alias_type = $options[0]['value'];
89+
}
8490

8591
$sql = "INSERT INTO ".$alias_type."
8692
(alias_username, alias_domain, username, domain) VALUES (?, ?, ?, ?)";
@@ -145,6 +151,10 @@
145151
$username = $_POST['username'];
146152
$domain= $_POST['domain'];
147153

154+
if ($suppress_alias_type) {
155+
$user_table = $options[0]['value'];
156+
}
157+
148158
if ($alias_username=="" || $alias_domain=="" || $username=="" || $domain=="") {
149159
$errors = "Invalid data, the entry was not modified in the database";
150160
} else {

Diff for: web/tools/users/alias_management/template/alias_management.form.php

-4
Original file line numberDiff line numberDiff line change
@@ -46,8 +46,4 @@
4646
if (!$am_edit && (count($alias_types) != 1 || !$suppress_atype))
4747
form_generate_select("Alias Type", "The type of the alias, as you may have multiple type/groups of aliases, for different purposes",
4848
"alias_type", 64, $am_form['alias_type'], array_values($alias_types), array_keys($alias_types));
49-
50-
if (count($alias_types) == 1 && $suppress_atype) {
51-
form_generate_hidden("alias_type", array_values($alias_types)[0]);
52-
}
5349
?>

0 commit comments

Comments
 (0)