Merge branch 'ent-4302-Opcion_para_deshabilitar_aviso_de_suscripcion_a_newsletter' into 'develop'

new tocken user edit newslatter info

See merge request artica/pandorafms!2589
This commit is contained in:
Daniel Rodriguez 2019-07-11 15:36:56 +02:00
commit cdf7c84b81
5 changed files with 67 additions and 40 deletions

View File

@ -122,7 +122,6 @@ if (is_ajax()) {
exit();
}
ui_require_css_file('register');
$initial = isset($config['initial_wizard']) !== true
@ -150,26 +149,27 @@ if ($initial && users_is_admin()) {
);
}
if ($registration && users_is_admin()) {
// Prepare registration wizard, not launch. leave control to flow.
registration_wiz_modal(
false,
// Launch only if not being launch from 'initial'.
!$initial,
(($show_newsletter === true) ? 'force_run_newsletter()' : null)
);
} else {
if ($show_newsletter) {
// Show newsletter wizard for current user.
newsletter_wiz_modal(
if (!$config['disabled_newsletter']) {
if ($registration && users_is_admin()) {
// Prepare registration wizard, not launch. leave control to flow.
registration_wiz_modal(
false,
// Launch only if not being call from 'registration'.
!$registration && !$initial
// Launch only if not being launch from 'initial'.
!$initial,
(($show_newsletter === true) ? 'force_run_newsletter()' : null)
);
} else {
if ($show_newsletter) {
// Show newsletter wizard for current user.
newsletter_wiz_modal(
false,
// Launch only if not being call from 'registration'.
!$registration && !$initial
);
}
}
}
$newsletter = null;
?>

View File

@ -137,6 +137,8 @@ if ($new_user && $config['admin_can_add_user']) {
$user_info['not_login'] = false;
$user_info['strict_acl'] = false;
$user_info['session_time'] = 0;
$user_info['middlename'] = 0;
if ($isFunctionSkins !== ENTERPRISE_NOT_HOOK) {
$user_info['id_skin'] = '';
}
@ -218,6 +220,7 @@ if ($create_user) {
}
$values['not_login'] = (bool) get_parameter('not_login', false);
$values['middlename'] = get_parameter('middlename', 0);
$values['strict_acl'] = (bool) get_parameter('strict_acl', false);
$values['session_time'] = (int) get_parameter('session_time', 0);
@ -317,12 +320,13 @@ if ($update_user) {
$values['timezone'] = (string) get_parameter('timezone');
$values['default_event_filter'] = (int) get_parameter('default_event_filter');
$values['default_custom_view'] = (int) get_parameter('default_custom_view');
// eHorus user level conf
// eHorus user level conf.
$values['ehorus_user_level_enabled'] = (bool) get_parameter('ehorus_user_level_enabled', false);
$values['ehorus_user_level_user'] = (string) get_parameter('ehorus_user_level_user');
$values['ehorus_user_level_pass'] = (string) get_parameter('ehorus_user_level_pass');
$values['middlename'] = get_parameter('middlename', 0);
$dashboard = get_parameter('dashboard', '');
$visual_console = get_parameter('visual_console', '');
@ -869,13 +873,27 @@ foreach ($event_filter_data as $filter) {
$table->data[16][0] = __('Default event filter');
$table->data[16][1] = html_print_select($event_filter, 'default_event_filter', $user_info['default_event_filter'], '', '', __('None'), true, false, false);
$table->data[17][0] = __('Disabled newsletter');
if ($user_info['middlename'] >= 0) {
$middlename = false;
} else {
$middlename = true;
}
$table->data[17][1] = html_print_checkbox(
'middlename',
-1,
$middlename,
true
);
if ($config['ehorus_user_level_conf']) {
$table->data[17][0] = __('eHorus user acces enabled');
$table->data[17][1] = html_print_checkbox('ehorus_user_level_enabled', 1, $user_info['ehorus_user_level_enabled'], true);
$table->data[18][0] = __('eHorus user');
$table->data[19][0] = __('eHorus password');
$table->data[18][1] = html_print_input_text('ehorus_user_level_user', $user_info['ehorus_user_level_user'], '', 15, 45, true);
$table->data[19][1] = html_print_input_password('ehorus_user_level_pass', io_output_password($user_info['ehorus_user_level_pass']), '', 15, 45, true);
$table->data[18][0] = __('eHorus user acces enabled');
$table->data[18][1] = html_print_checkbox('ehorus_user_level_enabled', 1, $user_info['ehorus_user_level_enabled'], true);
$table->data[19][0] = __('eHorus user');
$table->data[20][0] = __('eHorus password');
$table->data[19][1] = html_print_input_text('ehorus_user_level_user', $user_info['ehorus_user_level_user'], '', 15, 45, true);
$table->data[20][1] = html_print_input_password('ehorus_user_level_pass', io_output_password($user_info['ehorus_user_level_pass']), '', 15, 45, true);
}

View File

@ -1976,7 +1976,7 @@ class ConsoleSupervisor
'id_user',
$config['id_user']
);
if (license_free() === true
if (!$config['disabled_newsletter']
&& $newsletter != 1
&& $login === false
) {

View File

@ -395,6 +395,10 @@ function config_update_config()
$error_update[] = __('Enable Update Manager');
}
if (!config_update_value('disabled_newsletter', get_parameter('disabled_newsletter'))) {
$error_update[] = __('Disabled newsletter');
}
if (!config_update_value('ipam_ocuppied_critical_treshold', get_parameter('ipam_ocuppied_critical_treshold'))) {
$error_update[] = __('Ipam Ocuppied Manager Critical');
}
@ -1723,6 +1727,10 @@ function config_process_config()
config_update_value('enable_update_manager', 1);
}
if (!isset($config['disabled_newsletter'])) {
config_update_value('disabled_newsletter', 0);
}
if (!isset($config['ipam_ocuppied_critical_treshold'])) {
config_update_value('ipam_ocuppied_critical_treshold', 90);
}

View File

@ -426,24 +426,25 @@ if (check_acl($config['id_user'], 0, 'ER')) {
).'</div>';
}
if (!$config['disabled_newsletter']) {
$newsletter = '<div class="label_select_simple"><p class="edit_user_labels">'.__('Newsletter Subscribed').': </p>';
if ($user_info['middlename'] > 0) {
$newsletter .= '<span>'.__('Already subscribed to %s newsletter', get_product_name()).'</span>';
} else {
$newsletter .= '<span><a href="javascript: force_run_newsletter();">'.__('Subscribe to our newsletter').'</a></span></div>';
$newsletter_reminder = '<div class="label_select_simple"><p class="edit_user_labels">'.__('Newsletter Reminder').': </p>';
$newsletter_reminder .= html_print_switch(
[
'name' => 'newsletter_reminder',
'value' => $newsletter_reminder_value,
'disabled' => false,
]
);
}
$newsletter = '<div class="label_select_simple"><p class="edit_user_labels">'.__('Newsletter Subscribed').': </p>';
if ($user_info['middlename'] > 0) {
$newsletter .= '<span>'.__('Already subscribed to %s newsletter', get_product_name()).'</span>';
} else {
$newsletter .= '<span><a href="javascript: force_run_newsletter();">'.__('Subscribe to our newsletter').'</a></span></div>';
$newsletter_reminder = '<div class="label_select_simple"><p class="edit_user_labels">'.__('Newsletter Reminder').': </p>';
$newsletter_reminder .= html_print_switch(
[
'name' => 'newsletter_reminder',
'value' => $newsletter_reminder_value,
'disabled' => false,
]
);
$newsletter_reminder .= '</div>';
}
$newsletter_reminder .= '</div>';
$autorefresh_list_out = [];