From 070db42c413852580fa12fd5b1d03f820fd44bd8 Mon Sep 17 00:00:00 2001
From: m-lopez-f <miguel.lopez@artica.es>
Date: Mon, 27 Feb 2017 11:26:48 +0100
Subject: [PATCH] Add default value of field advance ad configuration. Gitlab:
 #367

---
 pandora_console/include/auth/mysql.php        | 4 +++-
 pandora_console/include/functions_config.php  | 4 ++++
 pandora_console/include/functions_profile.php | 2 +-
 3 files changed, 8 insertions(+), 2 deletions(-)

diff --git a/pandora_console/include/auth/mysql.php b/pandora_console/include/auth/mysql.php
index ad1c3cb650..ef85faa41e 100644
--- a/pandora_console/include/auth/mysql.php
+++ b/pandora_console/include/auth/mysql.php
@@ -268,7 +268,9 @@ function process_user_login_remote ($login, $pass, $api = false) {
 		return false;
 	}
 	
-	if ($config["auth"] === 'ad' && (isset($config['ad_advanced_config']) && $config['ad_advanced_config'])) {
+	if ($config["auth"] === 'ad' && 
+		(isset($config['ad_advanced_config']) && 
+			$config['ad_advanced_config'])) {
 		
 		
 		if ( defined('METACONSOLE') ) {
diff --git a/pandora_console/include/functions_config.php b/pandora_console/include/functions_config.php
index a5622a0836..8f8676641f 100644
--- a/pandora_console/include/functions_config.php
+++ b/pandora_console/include/functions_config.php
@@ -1253,6 +1253,10 @@ function config_process_config () {
 		config_update_value ( 'ad_advanced_config', 0);
 	}
 	
+	if (!isset ($config['ad_adv_user_node'])) {
+		config_update_value ( 'ad_adv_user_node', 1);
+	}
+	
 	if (!isset ($config['ad_domain'])) {
 		config_update_value ( 'ad_domain', '');
 	}
diff --git a/pandora_console/include/functions_profile.php b/pandora_console/include/functions_profile.php
index 877933b0d4..3de2fb28ad 100644
--- a/pandora_console/include/functions_profile.php
+++ b/pandora_console/include/functions_profile.php
@@ -95,7 +95,7 @@ function profile_create_user_profile ($id_user,
 	}
 	
 	if ($assignUser !== false)
-	$assign = $assignUser;
+		$assign = $assignUser;
 	
 	$insert = array (
 		"id_usuario" => $id_user,