Solved newsletter display if forced. Delete all required when return

This commit is contained in:
fermin831 2016-05-26 18:41:38 +02:00
parent 8ef98134cf
commit c91a473748
2 changed files with 22 additions and 21 deletions

View File

@ -103,7 +103,7 @@ $display_forced = ($wizard_data['force_newsletter'] != -1) || ($wizard_data['for
// Return if it is fully completed
if ((!$display_register) && (!$display_newsletter)) return;
$return_button = get_parameter ('return_button', 0);
$return_button = get_parameter ('return_button', 0) == 1;
$email = db_get_value ('email', 'tusuario', 'id_user', $config['id_user']);
//Avoid to show default email
@ -172,8 +172,6 @@ var display_newsletter = <?php echo json_encode($display_newsletter); ?>;
var display_forced = <?php echo json_encode($display_forced); ?>;
var return_button = <?php echo json_encode($return_button); ?>;
console.log (display_forced + ".");
////////////////////////////////////////////////////////////////////////
//HELPER FUNCTIONS
@ -198,6 +196,7 @@ function submit_open_wizard (register, newsletter, email, forced) {
//EVENT FUNCTIONS
$("#submit-return_dialog_button").click (function () {
$("#login_accept_register" ).dialog('close');
$("#all-required").hide();
$("#login_id_dialog" ).dialog('open');
});
@ -217,7 +216,8 @@ $("#submit-finish_dialog_button").click (function () {
if (!register && display_register && !display_forced) {
$("#login_registration_yesno").dialog('open');
} else {
submit_open_wizard (1, newsletter, email, display_forced);
var register_forced = register ? 1 : 0;
submit_open_wizard (register_forced, newsletter, email, display_forced);
$("#login_accept_register" ).dialog('close');
}
});

View File

@ -1459,6 +1459,24 @@ function config_check () {
// At this first version I'm passing errors using session variables, because the error management
// is done by an AJAX request. Better solutions could be implemented in the future :-)
if (license_free() && users_is_admin($config['id_user'])) {
//Registration advice
if (!isset ($config['instance_registered']) || ($config['instance_registered'] != 1)) {
set_pandora_error_for_header(
__('Click <a style="font-weight:bold;" href="javascript: force_run_register();"> HERE </a> to init the registration process'),
__("This PandoraFMS instance is not registered"));
}
//Newsletter advice
$newsletter = db_get_value ('middlename', 'tusuario', 'id_user', $config['id_user']);
if ($newsletter != 1) {
set_pandora_error_for_header(
__('Click <a style="font-weight:bold;" href="javascript: force_run_newsletter();"> HERE </a> to init the newsletter subscription process'),
__("Missing user in newsletter"));
}
}
// Check default password for "admin"
$is_admin = db_get_value('is_admin', 'tusuario', 'id_user', $config['id_user']);
if ($is_admin) {
@ -1624,23 +1642,6 @@ function config_check () {
__('Please, change it on your PHP configuration file (php.ini) or contact with administrator (Dont forget restart apache process after changes)'), __("Problems with disable functions in PHP.INI"));
}
if (license_free() && users_is_admin($config['id_user'])) {
//Newsletter advice
$newsletter = db_get_value ('middlename', 'tusuario', 'id_user', $config['id_user']);
if ($newsletter != 1) {
set_pandora_error_for_header(
__('Click <a style="font-weight:bold;" href="javascript: force_run_newsletter();"> HERE </a> to init the newsletter subscription process'),
__("Missing user in newsletter"));
}
//Registration advice
if (!isset ($config['instance_registered']) || ($config['instance_registered'] != 1)) {
set_pandora_error_for_header(
__('Click <a style="font-weight:bold;" href="javascript: force_run_register();"> HERE </a> to init the registration process'),
__("This PandoraFMS instance is not registered"));
}
}
}
function config_return_in_bytes($val) {