From 30ce8f65e4ae6ff96caed00815210e31918b18fb Mon Sep 17 00:00:00 2001 From: fbsanchez Date: Wed, 29 May 2019 10:01:21 +0200 Subject: [PATCH] UM register, UM newsletter flow improved --- pandora_console/general/register.php | 4 +- .../include/functions_update_manager.php | 120 ++++++++++-------- 2 files changed, 71 insertions(+), 53 deletions(-) diff --git a/pandora_console/general/register.php b/pandora_console/general/register.php index eae4be58b2..e6a26bb250 100644 --- a/pandora_console/general/register.php +++ b/pandora_console/general/register.php @@ -140,7 +140,7 @@ $registration = isset($config['pandora_uid']) !== true || $config['pandora_uid'] == ''; -if ($initial) { +if ($initial && users_is_admin()) { // Show all forms in order. // 1- Ask for email, timezone, etc. Fullfill alerts and user mail. config_wiz_modal( @@ -150,7 +150,7 @@ if ($initial) { ); } -if ($registration) { +if ($registration && users_is_admin()) { // Prepare registration wizard, not launch. leave control to flow. registration_wiz_modal( false, diff --git a/pandora_console/include/functions_update_manager.php b/pandora_console/include/functions_update_manager.php index fb499e45e7..cc148be7b9 100755 --- a/pandora_console/include/functions_update_manager.php +++ b/pandora_console/include/functions_update_manager.php @@ -865,50 +865,63 @@ function show_newsletter_wizard() { var language = $("#language").val(); var email_identification = $("#text-email-newsletter").val(); - jQuery.post ( - "ajax.php", - { - "page": "general/register", - "register_newsletter": 1, - "email": email_identification - }, - function (data) { - cl = ''; - msg = 'no response'; - - try { - json = JSON.parse(data); - cl = json.status - msg = json.message; - - } catch (error) { - msg = 'Failed: ' + error; - cl = 'error'; - } - - if (!cl || cl == 'error') { - cl = 'error'; - } else { - // Success. - } - - $('#news_result_content').html(msg); - $('#news_result').addClass(cl); - $('#news_result').dialog({ - buttons: { - 'Ok': function() { - $(this).dialog('close'); - $("#newsletter_wizard").dialog('close'); - - } + if (email_identification == '') { + msg = ''; + $('#news_result_content').html(msg); + $('#news_result').dialog({ + buttons: { + 'Ok': function() { + $(this).dialog('close'); } - }); - } - ); + } + }); + } else { + + jQuery.post ( + "ajax.php", + { + "page": "general/register", + "register_newsletter": 1, + "email": email_identification + }, + function (data) { + cl = ''; + msg = 'no response'; + + try { + json = JSON.parse(data); + cl = json.status + msg = json.message; + + } catch (error) { + msg = 'Failed: ' + error; + cl = 'error'; + } + + if (!cl || cl == 'error') { + cl = 'error'; + } else { + // Success. + } + + $('#news_result_content').html(msg); + $('#news_result').addClass(cl); + $('#news_result').dialog({ + buttons: { + 'Ok': function() { + $(this).dialog('close'); + $("#newsletter_wizard").dialog('close'); + + } + } + }); + } + ); + } } }); } @@ -1570,15 +1583,20 @@ function update_manager_register_instance() global $config; $email = db_get_value('email', 'tusuario', 'id_user', $config['id_user']); + + $um_config_values = update_manager_get_config_values(); + $params = [ - 'language' => $config['language'], - 'timezone' => $config['timezone'], - 'email' => $email, - 'license' => db_get_value_filter( - 'value', - 'tupdate_settings', - ['key' => 'customer_key'] - ), + 'action' => 'newest_package', + 'license' => $um_config_values['license'], + 'limit_count' => $um_config_values['limit_count'], + 'current_package' => $um_config_values['current_update'], + 'version' => $um_config_values['version'], + 'build' => $um_config_values['build'], + 'puid' => $um_config_values['puid'], + 'email' => $email, + 'language' => $config['language'], + 'timezone' => $config['timezone'], ]; $result = update_manager_curl_request('new_register', $params);