git-svn-id: https://192.168.0.254/svn/Proyectos.Incam_Intranet/trunk/src@1 e2b1556b-49f8-d141-9351-52d6861a72d9
79 lines
2.0 KiB
PHP
79 lines
2.0 KiB
PHP
<?php
|
|
include("seguridad.php");
|
|
include("functions.php");
|
|
|
|
if(!$usuario->tieneRol("3")){
|
|
header("Location: aplicacion.php?e=permiso");
|
|
exit;
|
|
}
|
|
|
|
|
|
if($_POST['action']=="add"){
|
|
$id=$_POST['id'];
|
|
$gerente=$_POST['gerente'];
|
|
$privado=$_POST['privado'];
|
|
$errores=array();
|
|
if($id=="") $errores[]="1";
|
|
if($gerente=="") $errores[]="2";
|
|
if($privado=="") $errores[]="3";
|
|
|
|
if(count($errores)==0){
|
|
try{
|
|
include_once("Objects/ListaEmpresas.php");
|
|
$listaEmpresas = new ListaEmpresas($usuario,$locale);
|
|
$arrayInsert=array();
|
|
$arrayInsert["id"]=$id;
|
|
$arrayInsert["gerente"]=$gerente;
|
|
$arrayInsert["privado"]=$privado;
|
|
$idEmpresaNew=$listaEmpresas->addEmpresa($arrayInsert);
|
|
header("Location: gestion_empresa.php?oid=".$idEmpresaNew);
|
|
|
|
} catch(Exception $e){
|
|
$msg=$e->getMessage();
|
|
$tipo="error";
|
|
}
|
|
}
|
|
}
|
|
include_once("html/cabecera.php");
|
|
include_once("Objects/HTML.php");
|
|
$html = new HTML($locale);
|
|
echo $html->menuEmpresas("","");
|
|
?>
|
|
<h2><?php echo $locale['2203']; ?></h2>
|
|
<?php if($msg!=""){
|
|
echo "<div class=\"aviso ".$tipo."\">".$msg."</div>";
|
|
} ?>
|
|
<div id="ContTabul">
|
|
<form action="addEmpresa.php" method="post" >
|
|
<input type="hidden" name="action" value="add" />
|
|
<table>
|
|
<tr>
|
|
<td><?php echo $locale['1803']; ?></td>
|
|
<td><input type="text" name="id" value="<?php echo $_POST['id']; ?>" /></td>
|
|
</tr>
|
|
<tr>
|
|
<td><?php echo $locale['2214']; ?></td>
|
|
<td>
|
|
<?php echo rellena_personal_permiso("gerente","GP",$auxiliar,$_POST['gerente']); ?>
|
|
</td>
|
|
</tr>
|
|
<tr>
|
|
<td><?php echo $locale['2215']; ?></td>
|
|
<td>
|
|
<select name="privado">
|
|
<option value="0" <?php if($_POST['privado']=="0") echo "selected"; ?>><?php echo $locale['2213']; ?></option>
|
|
<option value="1" <?php if($_POST['privado']=="1") echo "selected"; ?>><?php echo $locale['2212']; ?></option>
|
|
</select>
|
|
</td>
|
|
</tr>
|
|
</table>
|
|
<input type="submit" class="button" value="<?php echo $locale['add']; ?>" />
|
|
</form>
|
|
</div>
|
|
|
|
<?php
|
|
|
|
|
|
include_once("html/pie.php");
|
|
?>
|