Merge branch 'ent-9722-cartel-de-licencia-expirada' into 'develop'

Ent 9722 cartel de licencia expirada

#9722

https://brutus.artica.es:8081/artica/pandora_enterprise/-/issues/9722

See merge request artica/pandorafms!5237
This commit is contained in:
Jimmy Olano 2022-11-04 10:07:56 +00:00
commit a548d2a798
4 changed files with 116 additions and 5 deletions

View File

@ -549,6 +549,43 @@ if ($create_user) {
$password_new = '';
$password_confirm = '';
$new_user = true;
} else {
$pm = db_get_value_filter('pandora_management', 'tperfil', ['id_perfil' => $profile2]);
if ((int) $pm === 1) {
$user_source = db_get_value_filter(
'id_source',
'tnotification_source_user',
[
'id_source' => $notification['id'],
'id_user' => $id,
]
);
if ($user_source === false) {
$notificationSources = db_get_all_rows_filter('tnotification_source', [], 'id');
foreach ($notificationSources as $notification) {
if ((int) $notification['id'] === 1 || (int) $notification['id'] === 5) {
$notification_user = db_get_value_filter(
'id_source',
'tnotification_source_user',
[
'id_source' => $notification['id'],
'id_user' => $id,
]
);
if ($notification_user === false) {
@db_process_sql_insert(
'tnotification_source_user',
[
'id_source' => $notification['id'],
'id_user' => $id,
]
);
}
}
}
}
}
}
ui_print_result_message(
@ -845,6 +882,43 @@ if ($add_profile && empty($json_profile)) {
$return = profile_create_user_profile($id2, $profile2, $group2, false, $tags, $no_hierarchy);
if ($return === false) {
$is_err = true;
} else {
$pm = db_get_value_filter('pandora_management', 'tperfil', ['id_perfil' => $profile2]);
if ((int) $pm === 1) {
$user_source = db_get_value_filter(
'id_source',
'tnotification_source_user',
[
'id_source' => $notification['id'],
'id_user' => $id,
]
);
if ($user_source === false) {
$notificationSources = db_get_all_rows_filter('tnotification_source', [], 'id');
foreach ($notificationSources as $notification) {
if ((int) $notification['id'] === 1 || (int) $notification['id'] === 5) {
$notification_user = db_get_value_filter(
'id_source',
'tnotification_source_user',
[
'id_source' => $notification['id'],
'id_user' => $id,
]
);
if ($notification_user === false) {
@db_process_sql_insert(
'tnotification_source_user',
[
'id_source' => $notification['id'],
'id_user' => $id,
]
);
}
}
}
}
}
}
ui_print_result_message(

View File

@ -809,7 +809,44 @@ function update_user(string $id_user, array $values)
return false;
}
return db_process_sql_update('tusuario', $values, ['id_user' => $id_user]);
$output = db_process_sql_update('tusuario', $values, ['id_user' => $id_user]);
if (isset($values['is_admin']) === true && (bool) $values['is_admin'] === true) {
// Administrator user must be activated in all notifications sections.
$notificationSources = db_get_all_rows_filter('tnotification_source', [], 'id');
foreach ($notificationSources as $notification) {
$user_source = db_get_value_filter(
'id_source',
'tnotification_source_user',
[
'id_source' => $notification['id'],
'id_user' => $id_user,
]
);
if ($user_source !== false) {
@db_process_sql_update(
'tnotification_source_user',
['enabled' => 1],
[
'id_source' => $notification['id'],
'id_user' => $id_user,
]
);
} else if ((int) $notification['id'] === 1 || (int) $notification['id'] === 5) {
@db_process_sql_insert(
'tnotification_source_user',
[
'id_source' => $notification['id'],
'id_user' => $id_user,
]
);
}
}
}
return $output;
}

View File

@ -679,7 +679,6 @@ class ConsoleSupervisor
$max_age = 0;
break;
case 'NOTIF.LICENSE.EXPIRATION':
case 'NOTIF.FILES.ATTACHMENT':
case 'NOTIF.FILES.DATAIN':
case 'NOTIF.FILES.DATAIN.BADXML':
@ -846,7 +845,9 @@ class ConsoleSupervisor
}
// Expiry.
if (($days_to_expiry <= 15) && ($days_to_expiry > 0)) {
if (($days_to_expiry <= 15) && ($days_to_expiry > 0)
&& ((is_user_admin($config['id_user'])) || (check_acl($config['id_user'], 0, 'PM')))
) {
if ($config['license_mode'] == 1) {
$title = __('License is about to expire');
$msg = 'Your license will expire in %d days. Please, contact our sales department.';
@ -867,7 +868,7 @@ class ConsoleSupervisor
'url' => '__url__/index.php?sec=gsetup&sec2=godmode/setup/license',
]
);
} else if ($days_to_expiry < 0) {
} else if (($days_to_expiry <= 0) && ((is_user_admin($config['id_user'])) || (check_acl($config['id_user'], 0, 'PM')))) {
if ($config['license_mode'] == 1) {
$title = __('Expired license');
$msg = __('Your license has expired. Please, contact our sales department.');

View File

@ -125,7 +125,6 @@ function notifications_get_subtypes(?string $source=null)
$subtypes = [
'System status' => [
'NOTIF.LICENSE.LIMITED',
'NOTIF.LICENSE.EXPIRATION',
'NOTIF.FILES.ATTACHMENT',
'NOTIF.FILES.DATAIN',
'NOTIF.FILES.DATAIN.BADXML',