Incam_Intranet/eliminar_empleado.php

32 lines
778 B
PHP
Raw Permalink Normal View History

<?php
include("seguridad.php");
include("functions.php");
// S<>lo RRHH y Admin pueden eliminar
if(!$usuario->tieneRol("4")
&& !$usuario->tieneRol("1")){
header("Location: aplicacion.php?e=permiso");
exit;
}
$idEmpleado=$_GET['oid'];
if($_GET['byEstado']!=""){
$tipoPedidos=stripinput($_GET['byEstado']);
} else {
$tipoPedidos="10";
}
include_once("Objects/Empleado.php");
try{
$empleado=new Empleado($usuario,$idEmpleado);
$resultado=$empleado->eliminar();
if($resultado){
header("Location: lista_empleados.php?msg=1&byEstado=".$tipoPedidos);
} else {
header("Location: lista_empleados.php?msg=2&byEstado=".$tipoPedidos);
}
} catch (Exception $e) {
$msg=$e->getMessage();
include_once("showError.php");
}
exit();
?>