Merge branch 'ent-6577-creacion-de-usuario-con-global-profile-administrator-no-deberia-necesitar-anadirle-mas-perfiles' into 'develop'

Able to create users without profile assignment

See merge request artica/pandorafms!3555
This commit is contained in:
Daniel Rodriguez 2020-11-03 16:00:06 +01:00
commit 41b603d5a0

View File

@ -1387,14 +1387,32 @@ $(document).ready (function () {
}); });
}); });
$('#submit-crtbutton').click(function (e) { function checkProfiles(e) {
e.preventDefault(); e.preventDefault();
var rows = $("#table_profiles tr").length; if ($('input[name="is_admin"]:checked').val() == 1) {
if ((is_metaconsole === '1' && rows <= 3) || (is_metaconsole === '' && rows <= 2)) { // Admin does not require profiles.
alert('<?php echo __('please add a profile'); ?>'); $('#user_profile_form').submit();
} else { } else {
this.form.submit(); if ($('#table_profiles tbody').children().length == 1) {
confirmDialog({
title: "<?php echo __('Warning'); ?>",
message: "<?php echo __('User will be created without profiles assigned and won\'t be able to log in, are you sure?'); ?>",
onAccept: function() {
$('#user_profile_form').submit();
}
});
} else {
$('#user_profile_form').submit();
}
} }
}
$('#submit-crtbutton').click(function (e) {
checkProfiles(e);
});
$('#submit-uptbutton').click(function (e) {
checkProfiles(e);
}); });
}); });