mirror of
https://github.com/pandorafms/pandorafms.git
synced 2025-09-25 19:09:08 +02:00
Fix reset user creation form on error
This commit is contained in:
parent
eed28bc668
commit
1c157ba2e4
@ -1444,7 +1444,7 @@ html_print_input_hidden('json_profile', '');
|
|||||||
echo '</form>';
|
echo '</form>';
|
||||||
|
|
||||||
|
|
||||||
profile_print_profile_table($id);
|
profile_print_profile_table($id, io_safe_output($json_profile));
|
||||||
|
|
||||||
echo '<br />';
|
echo '<br />';
|
||||||
|
|
||||||
@ -1560,11 +1560,11 @@ $(document).ready (function () {
|
|||||||
switch_ehorus_conf();
|
switch_ehorus_conf();
|
||||||
});
|
});
|
||||||
$('#checkbox-ehorus_user_level_enabled').trigger('change');
|
$('#checkbox-ehorus_user_level_enabled').trigger('change');
|
||||||
|
|
||||||
var img_delete = '<?php echo $delete_image; ?>';
|
var img_delete = '<?php echo $delete_image; ?>';
|
||||||
var id_user = '<?php echo io_safe_output($id); ?>';
|
var id_user = '<?php echo io_safe_output($id); ?>';
|
||||||
var is_metaconsole = '<?php echo $meta; ?>';
|
var is_metaconsole = '<?php echo $meta; ?>';
|
||||||
var user_is_global_admin = '<?php echo users_is_admin($id); ?>';
|
var user_is_global_admin = '<?php echo users_is_admin($id); ?>';
|
||||||
|
var is_err = '<?php echo $is_err; ?>';
|
||||||
var data = [];
|
var data = [];
|
||||||
|
|
||||||
$('input:image[name="add"]').click(function (e) {
|
$('input:image[name="add"]').click(function (e) {
|
||||||
@ -1588,7 +1588,7 @@ $(document).ready (function () {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (id_user === '') {
|
if (id_user === '' || is_err === 1) {
|
||||||
let new_json = `{"profile":${profile},"group":${group},"tags":[${tags}],"hierarchy":${hierarchy}}`;
|
let new_json = `{"profile":${profile},"group":${group},"tags":[${tags}],"hierarchy":${hierarchy}}`;
|
||||||
data.push(new_json);
|
data.push(new_json);
|
||||||
json_profile.val('['+data+']');
|
json_profile.val('['+data+']');
|
||||||
|
@ -181,7 +181,7 @@ function profile_delete_profile_and_clean_users($id_profile)
|
|||||||
* @param int User id
|
* @param int User id
|
||||||
* @param bool Show the tags select or not
|
* @param bool Show the tags select or not
|
||||||
*/
|
*/
|
||||||
function profile_print_profile_table($id)
|
function profile_print_profile_table($id, $json_profile=false)
|
||||||
{
|
{
|
||||||
global $config;
|
global $config;
|
||||||
|
|
||||||
@ -243,7 +243,19 @@ function profile_print_profile_table($id)
|
|||||||
}
|
}
|
||||||
|
|
||||||
if ($result === false) {
|
if ($result === false) {
|
||||||
$result = [];
|
if ($json_profile !== false && empty($json_profile) !== true) {
|
||||||
|
$profile_decoded = json_decode($json_profile);
|
||||||
|
foreach ($profile_decoded as $profile) {
|
||||||
|
$result[] = [
|
||||||
|
'id_grupo' => $profile->group,
|
||||||
|
'id_perfil' => $profile->profile,
|
||||||
|
'tags' => $profile->tags,
|
||||||
|
'hierarchy' => $profile->hierarchy,
|
||||||
|
];
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
$result = [];
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
foreach ($result as $profile) {
|
foreach ($result as $profile) {
|
||||||
@ -268,7 +280,12 @@ function profile_print_profile_table($id)
|
|||||||
if (empty($profile['tags'])) {
|
if (empty($profile['tags'])) {
|
||||||
$data['tags'] = '';
|
$data['tags'] = '';
|
||||||
} else {
|
} else {
|
||||||
$tags_ids = explode(',', $profile['tags']);
|
if (is_array($profile['tags'] === false)) {
|
||||||
|
$tags_ids = explode(',', $profile['tags']);
|
||||||
|
} else {
|
||||||
|
$tags_ids = $profile['tags'];
|
||||||
|
}
|
||||||
|
|
||||||
$tags = tags_get_tags($tags_ids);
|
$tags = tags_get_tags($tags_ids);
|
||||||
$data['tags'] = tags_get_tags_formatted($tags);
|
$data['tags'] = tags_get_tags_formatted($tags);
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user