Skip to content

Commit

Permalink
alias_mgm: move some suppress alias type logic
Browse files Browse the repository at this point in the history
  • Loading branch information
dariusstefan authored and razvancrainea committed Aug 19, 2024
1 parent a399550 commit 69fab36
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 4 deletions.
10 changes: 10 additions & 0 deletions web/tools/users/alias_management/alias_management.php
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,9 @@

$implicit_domain = get_settings_value("implicit_domain");

$suppress_alias_type = get_settings_value("suppress_alias_type");
$suppress_alias_type = $suppress_alias_type && (count($options) == 1);

$current_page="current_page_alias_management";


Expand Down Expand Up @@ -81,6 +84,9 @@
$username = $_POST['username'];
$domain = $_POST['domain'];

if ($suppress_alias_type) {
$alias_type = $options[0]['value'];
}

$sql = "INSERT INTO ".$alias_type."
(alias_username, alias_domain, username, domain) VALUES (?, ?, ?, ?)";
Expand Down Expand Up @@ -145,6 +151,10 @@
$username = $_POST['username'];
$domain= $_POST['domain'];

if ($suppress_alias_type) {
$user_table = $options[0]['value'];
}

if ($alias_username=="" || $alias_domain=="" || $username=="" || $domain=="") {
$errors = "Invalid data, the entry was not modified in the database";
} else {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -46,8 +46,4 @@
if (!$am_edit && (count($alias_types) != 1 || !$suppress_atype))
form_generate_select("Alias Type", "The type of the alias, as you may have multiple type/groups of aliases, for different purposes",
"alias_type", 64, $am_form['alias_type'], array_values($alias_types), array_keys($alias_types));

if (count($alias_types) == 1 && $suppress_atype) {
form_generate_hidden("alias_type", array_values($alias_types)[0]);
}
?>

0 comments on commit 69fab36

Please sign in to comment.