Skip to content

Commit

Permalink
Collegamento anagrafica obbligatorio per utenti
Browse files Browse the repository at this point in the history
  • Loading branch information
lucasalva87 committed Jun 25, 2018
1 parent e143624 commit 6fecb90
Show file tree
Hide file tree
Showing 2 changed files with 32 additions and 14 deletions.
12 changes: 7 additions & 5 deletions modules/utenti/edit.php
Original file line number Diff line number Diff line change
Expand Up @@ -53,10 +53,10 @@
if ($utente['id'] != '1') {
if ($utente['enabled'] == 1) {
echo '
<a href="javascript:;" onclick="if( confirm(\''.tr('Disabilitare questo utente?').'\') ){ location.href=\''.$rootdir.'/editor.php?id_module='.$id_module.'&id_record='.$id_record.'&op=disable&id_utente='.$utente['id'].'&idgruppo='.$record['id'].'\'; }" title="Disabilita utente" class="text-danger tip"><i class="fa fa-2x fa-eye-slash"></i></a>';
<a href="javascript:;" onclick="swal({ title: \''.tr('Disabilitare questo utente?').'\', type: \'info\', showCancelButton: true, confirmButtonText: \''.tr('S&igrave;').'\' }).then(function (result) { location.href=\''.$rootdir.'/editor.php?id_module='.$id_module.'&id_record='.$id_record.'&op=disable&id_utente='.$utente['id'].'&idgruppo='.$record['id'].'\'; }) " title="Disabilita utente" class="text-danger tip"><i class="fa fa-2x fa-eye-slash"></i></a>';
} else {
echo '
<a href="javascript:;" onclick="if( confirm(\'Abilitare questo utente?\') ){ location.href=\''.$rootdir.'/editor.php?id_module='.$id_module.'&id_record='.$id_record.'&op=enable&id_utente='.$utente['id'].'&idgruppo='.$record['id'].'\'; }" title="Abilita utente" class="text-success tip"><i class="fa fa-2x fa-eye"></i></a>';
echo '
<a href="javascript:;" onclick="swal({ title: \''.tr('Abilitare questo utente?').'\', type: \'info\', showCancelButton: true, confirmButtonText: \''.tr('S&igrave;').'\' }).then(function (result) { location.href=\''.$rootdir.'/editor.php?id_module='.$id_module.'&id_record='.$id_record.'&op=enable&id_utente='.$utente['id'].'&idgruppo='.$record['id'].'\'; }) " title="Abilita utente" class="text-success tip"><i class="fa fa-2x fa-eye"></i></a>';
}
} else {
echo '
Expand All @@ -69,8 +69,10 @@

// Eliminazione utente, se diverso da id_utente #1 (admin)
if ($utente['id'] != '1') {
echo '
<a href="javascript:;" onclick="if( confirm(\'Sei sicuro di voler eliminare questo utente?\') ){ location.href=\''.$rootdir.'/editor.php?id_module='.$id_module.'&id_record='.$id_record.'&op=delete&id_utente='.$utente['id'].'&idgruppo='.$record['id'].'\'; }" title="Elimina utente" class="text-danger tip"><i class="fa fa-2x fa-trash"></i></a>';

echo '
<a href="javascript:;" onclick="swal({ title: \''.tr('Eliminare questo utente?').'\', type: \'info\', showCancelButton: true, confirmButtonText: \''.tr('S&igrave;').'\' }).then(function (result) { location.href=\''.$rootdir.'/editor.php?id_module='.$id_module.'&id_record='.$id_record.'&op=delete&id_utente='.$utente['id'].'&idgruppo='.$record['id'].'\'; }) " title="Elimina utente" class="text-danger tip"><i class="fa fa-2x fa-trash"></i></a>';

} else {
echo '
<span onclick="alert(\"'.tr("Non è possibile eliminare l'utente admin").'\")" class="text-muted tip"><i class="fa fa-2x fa-trash"></i></span>';
Expand Down
34 changes: 25 additions & 9 deletions modules/utenti/user.php
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,10 @@
} else {
$idgruppo = intval(filter('idgruppo'));
$id_utente = filter('id_utente');

$nome_gruppo = $dbo->fetchArray('SELECT nome FROM zz_groups WHERE id='.prepare($idgruppo))[0]['nome'];
$nome_gruppo = substr($nome_gruppo, 0, -1).'o';

}

if (!empty($id_utente)) {
Expand Down Expand Up @@ -78,7 +82,7 @@
<div class="row">
<div class="col-md-12">
{[ "type": "select", "label": "'.tr('Collega ad una anagrafica').'", "name": "idanag", "ajax-source": "anagrafiche_utenti", "value": "'.$id_anagrafica.'" ]}
{[ "type": "select", "label": "'.tr('Collega ad una anagrafica').'", "name": "idanag", "required": 1, "ajax-source": "anagrafiche_utenti", "value": "'.$id_anagrafica.'", "icon-after": "add|'.Modules::get("Anagrafiche")["id"].'|tipoanagrafica='.$nome_gruppo.'" ]}
</div>
</div>';
} else {
Expand All @@ -96,17 +100,29 @@
var min_length_username = '.$min_length_username.';
function do_submit(){
if( $("#password1").val() == "" || $("#password2").val() == "" )
alert("'.tr('Inserire una password valida').'.");
swal({
title: "'.tr('Inserire una password valida.').'",
type: "error",
});
else if( $("#password1").val() != $("#password2").val() )
alert("'.tr('Le password non coincidono').'.");
swal({
title: "'.tr('Le password non coincidono.').'",
type: "error",
});
else if( $("#password1").val().length < min_length )
alert("'.tr('La password deve essere lunga minimo _MIN_ caratteri!', [
'_MIN_' => $min_length_password,
]).'");
swal({
title: "'.tr('La password deve essere lunga minimo _MIN_ caratteri!', [
'_MIN_' => $min_length_password,
]).'",
type: "error",
});
else if( $("#username").val().length < min_length_username )
alert("'.tr("L'username deve essere lungo minimo _MIN_ caratteri!", [
'_MIN_' => $min_length_username,
]).'");
swal({
title: "'.tr('L\'username deve essere lungo minimo _MIN_ caratteri.', [
'_MIN_' => $min_length_username,
]).'",
type: "error",
});
else
$("#link_form").submit();
}
Expand Down

0 comments on commit 6fecb90

Please sign in to comment.