Tarea #644 -> La ficha de un candidato mostrará la(s) oferta(s) en la que está incluido en lugar de las solicitudes de oferta como ahora

git-svn-id: https://192.168.0.254/svn/Proyectos.Incam_Intranet/trunk/src@69 e2b1556b-49f8-d141-9351-52d6861a72d9
This commit is contained in:
David Arranz 2011-05-19 16:07:16 +00:00
parent cb3bd79d58
commit eef3eef8e4
6 changed files with 466 additions and 439 deletions

View File

@ -106,9 +106,12 @@ class ListaOfertas {
$valores = "$fecha, $referencia"; $valores = "$fecha, $referencia";
// Procesamos los datos // Procesamos los datos
foreach ($campos as $key => $value) { foreach ($campos as $key => $value) {
// Metemos todos los valores excepto el candidato, que se hace después
if ($key != "candidato") {
$inserto .= ", $key"; $inserto .= ", $key";
$valores .= ", '$value'"; $valores .= ", '$value'";
} }
}
// Insertamos en la BD // Insertamos en la BD
$consulta = "INSERT INTO candidato_pedido ($inserto) VALUES ($valores)"; $consulta = "INSERT INTO candidato_pedido ($inserto) VALUES ($valores)";
@ -117,9 +120,14 @@ class ListaOfertas {
return "-1"; return "-1";
} else { } else {
$id = mysql_insert_id(); $id = mysql_insert_id();
$p = new Oferta($id, $this->gestor); $ofertaNueva = new Oferta($id, $this->gestor);
$mensaje = "Nueva oferta"; $mensaje = "Nueva oferta";
$p->actualizarHistorial($mensaje); $ofertaNueva->actualizarHistorial($mensaje);
// Si viene ya el candidato indicado, hay que cambiarlo de estado
if (array_key_exists("candidato", $campos)) {
$ofertaNueva->colocarCandidato($campos["candidato"]);
}
} }
return $id; return $id;
} }
@ -130,9 +138,6 @@ class ListaOfertas {
if ($resultado = $bd->execQuery($consulta)) { if ($resultado = $bd->execQuery($consulta)) {
$rows = mysql_fetch_array($resultado); $rows = mysql_fetch_array($resultado);
echo "########################<br/>";
print_r($rows);
echo "########################<br/>";
$num = 1; $num = 1;
if (!empty($rows[0])) { if (!empty($rows[0])) {

View File

@ -262,6 +262,11 @@ class Oferta {
function colocarCandidato($idCandidato) { function colocarCandidato($idCandidato) {
$idCand = $this->getValor("candidato"); $idCand = $this->getValor("candidato");
dbug($idCand);
echo dbug('print');
if (!empty($idCand)) { if (!empty($idCand)) {
if (!$this->quitarCandidato()) { if (!$this->quitarCandidato()) {
return false; return false;
@ -271,6 +276,10 @@ class Oferta {
$candidato = new Candidato($this->usuario, $idCandidato); $candidato = new Candidato($this->usuario, $idCandidato);
$estadoCand = $candidato->getValor("estado"); $estadoCand = $candidato->getValor("estado");
dbug($estadoCand);
echo dbug('print');
switch ($estadoCand) { switch ($estadoCand) {
case "540": case "540":
if ($candidato->transita("560", "")) { if ($candidato->transita("560", "")) {
@ -281,16 +290,21 @@ class Oferta {
$this->actualizarHistorial($mensaje); $this->actualizarHistorial($mensaje);
return true; return true;
} }
else { break;
dbug("error");
} case "560":
$this->setCampo("candidato", $idCandidato);
$nombre_candidato = $candidato->getValor("nombre") . " " . $candidato->getValor("apellidos");
$mensaje = "Asignado el candidato ".$nombre_candidato;
$this->actualizarHistorial($mensaje);
return true;
break; break;
default: default:
$error = "El candidato tiene un estado no permitido ('" . $candidato->getValor("estado") . "')"; $error = "El candidato tiene un estado no permitido ('" . $candidato->getValor("estado") . "')";
throw new Exception($error); throw new Exception($error);
} }
echo dbug('print');
} }
} }

View File

@ -7,14 +7,16 @@ if(!$_SESSION["oid"]){
//Mostramos al candidato //Mostramos al candidato
//$consulta = "select usuarios.nombre as nombre,usuarios.apellidos as apellidos, pedidos.nombre as pedido, estado_candidatura.id as estado from usuarios,candidato_pedido,pedidos,estado_candidatura where usuarios.oid='".$persona->getValor("oid")."' and candidato_pedido.candidato='".$persona->getValor("oid")."' and candidato_pedido.pedido = pedidos.oid and candidato_pedido.estado <> 6 "; //$consulta = "select usuarios.nombre as nombre,usuarios.apellidos as apellidos, pedidos.nombre as pedido, estado_candidatura.id as estado from usuarios,candidato_pedido,pedidos,estado_candidatura where usuarios.oid='".$persona->getValor("oid")."' and candidato_pedido.candidato='".$persona->getValor("oid")."' and candidato_pedido.pedido = pedidos.oid and candidato_pedido.estado <> 6 ";
$consulta = "SELECT U.oid as idCandidato,P.oid as idPedido, U.nombre,U.apellidos,P.nombre AS pedido, CE.nombre AS estado, P.oid,CP.obsRRHH,CP.obsGerente $consulta = "SELECT U.oid as idCandidato,CP.oid as idOferta, CP.referencia,
P.oid as idPedido, U.nombre,U.apellidos,P.nombre AS pedido, CE.nombre AS estado,
CP.obsRRHH,CP.obsGerente
FROM usuarios U,pedidos P,candidato_pedido CP,candidaturas_estados CE FROM usuarios U,pedidos P,candidato_pedido CP,candidaturas_estados CE
WHERE U.oid='".$persona->getValor("oid")."' WHERE U.oid='".$persona->getValor("oid")."'
AND CP.candidato=U.oid AND CP.candidato=U.oid
AND P.oid=CP.pedido AND P.oid=CP.pedido
AND CE.cod=CP.estado AND CE.cod=CP.estado
AND CE.idioma=U.idioma AND CE.idioma=U.idioma";
AND CP.estado <> '30'";
if ($resultado = consultar($consulta)){ if ($resultado = consultar($consulta)){
$num = mysql_num_rows($resultado); $num = mysql_num_rows($resultado);
if($num == 0){ if($num == 0){
@ -28,12 +30,19 @@ if ($resultado = consultar($consulta)){
do{ do{
$estado = $row["estado"]; $estado = $row["estado"];
$pedido = $row["pedido"]; $pedido = $row["pedido"];
$oid = $row["oid"]; $oid = $row["idPedido"];
$referenciaOferta = $row["referencia"];
$oidOferta = $row["idOferta"];
$obsRRHH = $row["obsRRHH"]; $obsRRHH = $row["obsRRHH"];
$obsGerente = $row["obsGerente"]; $obsGerente = $row["obsGerente"];
$idCandidato = $row["idCandidato"]; $idCandidato = $row["idCandidato"];
echo "<li><a href=\"pedido.php?idPedido=".$oid."\" target=\"_blank\" />$oid</a> - "; echo "<li>";
if($usuario->tieneRol("4")){ echo "Oferta <a href=\"oferta.php?idOferta=".$oidOferta."\" target=\"_blank\" />$referenciaOferta</a> ";
echo "($estado) ";
echo "- Solicitud \"<a href=\"pedido.php?idPedido=".$oid."\" target=\"_blank\" />$pedido</a>\"</li>";
// desactivar el comentario por ahora
if (false) { //if($usuario->tieneRol("4")){
?> ?>
<a onclick="mostrarCapa('obs-<?php echo $oid; ?>')" ondblclick="ocultarCapa('obs-<?php echo $oid; ?>')"> <a onclick="mostrarCapa('obs-<?php echo $oid; ?>')" ondblclick="ocultarCapa('obs-<?php echo $oid; ?>')">
<img src="<?php echo (($obsRRHH!="") || ($obsGerente!=""))? "css/coment.png" : "css/add_coment.png"; ?>" /></a> <img src="<?php echo (($obsRRHH!="") || ($obsGerente!=""))? "css/coment.png" : "css/add_coment.png"; ?>" /></a>
@ -62,7 +71,7 @@ if ($resultado = consultar($consulta)){
</div> </div>
<?php <?php
} }
echo " $pedido ($estado)</li>";
} while ($row = mysql_fetch_array($resultado)); } while ($row = mysql_fetch_array($resultado));
echo "</ul>"; echo "</ul>";
} }

View File

@ -21,9 +21,11 @@ if(stripos($destinoURL,"?")>0){
* - Cambiar la observaci<EFBFBD>n de una candidatura por parte de RRHH * - Cambiar la observaci<EFBFBD>n de una candidatura por parte de RRHH
*/ */
$action = ""; $action = "";
if($_GET['action']!="") $action= $_GET['action']; if ($_GET['action'] != "")
$action = $_GET['action'];
if($_POST['action']!="") $action= $_POST['action']; if ($_POST['action'] != "")
$action = $_POST['action'];
switch ($action) { switch ($action) {
case "addComent": if (($_POST['obs'] != "") && ($_POST['idCandidato'] != "") && ($_POST['idPedido'] != "")) { case "addComent": if (($_POST['obs'] != "") && ($_POST['idCandidato'] != "") && ($_POST['idPedido'] != "")) {
// Agregamso comentario al candidato sobre el pedido // Agregamso comentario al candidato sobre el pedido
@ -37,7 +39,8 @@ switch ($action) {
$tipo = "error"; $tipo = "error";
} }
} }
break;; break;
;
default: default:
break; break;
} }
@ -45,14 +48,15 @@ switch ($action) {
<h2><?php echo $persona->getValor("nombre_tipo") . ": " . $persona->getValor("nombre") . " " . $persona->getValor("apellidos"); ?></h2> <h2><?php echo $persona->getValor("nombre_tipo") . ": " . $persona->getValor("nombre") . " " . $persona->getValor("apellidos"); ?></h2>
<?php if($msg != "") { <?php
if ($msg != "") {
echo "<div class=\"aviso " . $tipo . "\">" . $msg . "</div>"; echo "<div class=\"aviso " . $tipo . "\">" . $msg . "</div>";
} ?> }
?>
<div id="ContTabul"> <div id="ContTabul">
<!-- Datos personales --> <!-- Datos personales -->
<?php <?php if (in_array("personales", $mostrarDetalle)) { ?>
if(in_array("personales",$mostrarDetalle)){ ?>
<div class="encabezado"><?php echo $locale['1548']; ?></div> <div class="encabezado"><?php echo $locale['1548']; ?></div>
<table align="center" width="100%" border="0"> <table align="center" width="100%" border="0">
<tr> <tr>
@ -81,16 +85,14 @@ if(in_array("personales",$mostrarDetalle)){ ?>
<td class="sinborde" width="33%"></td> <td class="sinborde" width="33%"></td>
<?php /* <td class="sinborde" width="33%"><span class="resaltado"><?php echo $locale['1554']; ?></span> <?php echo $persona->getValor("tipo_via")." ".$persona->getValor("direccion")." ".$persona->getValor("numero").", ".$persona->getValor("piso")." ".$persona->getValor("puerta"); ?></td> <?php /* <td class="sinborde" width="33%"><span class="resaltado"><?php echo $locale['1554']; ?></span> <?php echo $persona->getValor("tipo_via")." ".$persona->getValor("direccion")." ".$persona->getValor("numero").", ".$persona->getValor("piso")." ".$persona->getValor("puerta"); ?></td>
<td class="sinborde" width="33%"><span class="resaltado"><?php echo $locale['1555']; ?></span> <?php echo $persona->getValor("cp"); ?></td> <td class="sinborde" width="33%"><span class="resaltado"><?php echo $locale['1555']; ?></span> <?php echo $persona->getValor("cp"); ?></td>
*/ */ ?>
?>
</tr> </tr>
<tr> <tr>
<td class="sinborde" width="33%"></td> <td class="sinborde" width="33%"></td>
<td class="sinborde" width="33%"></td> <td class="sinborde" width="33%"></td>
<?php /* <td class="sinborde" width="33%"><span class="resaltado"><?php echo $locale['257']; ?></span><?php echo nombre_localidad($persona->getValor("localidad")); ?></td> <?php /* <td class="sinborde" width="33%"><span class="resaltado"><?php echo $locale['257']; ?></span><?php echo nombre_localidad($persona->getValor("localidad")); ?></td>
<td class="sinborde" width="33%"><span class="resaltado"><?php echo $locale['256']; ?></span><?php echo nombre_provincia(provincia($persona->getValor("localidad"))); ?></td> <td class="sinborde" width="33%"><span class="resaltado"><?php echo $locale['256']; ?></span><?php echo nombre_provincia(provincia($persona->getValor("localidad"))); ?></td>
*/ */ ?>
?>
@ -112,8 +114,7 @@ if(in_array("personales",$mostrarDetalle)){ ?>
<!-- Datos laborables --> <!-- Datos laborables -->
<div class="encabezado"><?php echo $locale['1550']; ?></div> <div class="encabezado"><?php echo $locale['1550']; ?></div>
<table align="center" width="100%"> <table align="center" width="100%">
<?php <?php if (in_array("cambEstado", $mostrarDetalle)) { ?>
if(in_array("cambEstado",$mostrarDetalle)){ ?>
<tr> <tr>
<td colspan="3" class="sinborde"><div id="obsCambioEst" class="obsCambioEst"> <td colspan="3" class="sinborde"><div id="obsCambioEst" class="obsCambioEst">
@ -198,8 +199,7 @@ if(in_array("personales",$mostrarDetalle)){ ?>
if ($persona->getValor("tipo") == "usuario") { if ($persona->getValor("tipo") == "usuario") {
?> ?>
<span class="resaltado"><?php echo $locale['1560']; ?></span> <?php echo nombre_localidad($persona->getValor("localidad_trabajo")); ?> <span class="resaltado"><?php echo $locale['1560']; ?></span> <?php echo nombre_localidad($persona->getValor("localidad_trabajo")); ?>
<?php <?php } ?>
} ?>
</td> </td>
<td class="sinborde" width="33%"><span class="resaltado"><?php echo $locale['1561']; ?></span> <td class="sinborde" width="33%"><span class="resaltado"><?php echo $locale['1561']; ?></span>
<?php <?php
@ -274,7 +274,6 @@ if(in_array("personales",$mostrarDetalle)){ ?>
echo "(" . $pos . ") " . $persona->getDiasVacaciones($pos) . "<br />"; echo "(" . $pos . ") " . $persona->getDiasVacaciones($pos) . "<br />";
echo "(" . date('Y') . ") " . $persona->getDiasVacaciones(date('Y')); echo "(" . date('Y') . ") " . $persona->getDiasVacaciones(date('Y'));
} }
?></td> ?></td>
<?php <?php
} elseif ($persona->getValor("tipo") == "candidato") { } elseif ($persona->getValor("tipo") == "candidato") {
@ -311,7 +310,6 @@ if(in_array("personales",$mostrarDetalle)){ ?>
} else { } else {
?> ?>
<br><?php echo nl2br($persona->getValor("observaciones")); <br><?php echo nl2br($persona->getValor("observaciones"));
} ?></td> } ?></td>
</tr> </tr>
</table> </table>
@ -355,7 +353,8 @@ if(in_array("personales",$mostrarDetalle)){ ?>
<tr align="center"> <tr align="center">
<td colspan="3" width="100%"> <td colspan="3" width="100%">
<?php if (in_array("addCurriculum", $mostrarDetalle)) { <?php if (in_array("addCurriculum", $mostrarDetalle)) {
$persona->addCurriculum($_FILES['userfile']);}?> $persona->addCurriculum($_FILES['userfile']);
} ?>
<?php echo ver_curriculums($persona->getValor("oid"), $tipo); ?> <?php echo ver_curriculums($persona->getValor("oid"), $tipo); ?>
</td> </td>
</tr> </tr>
@ -374,7 +373,10 @@ if(in_array("personales",$mostrarDetalle)){ ?>
</table> </table>
<?php } <?php }
if(in_array("candidaturas",$mostrarDetalle)){ ?> if ((in_array("candidaturas", $mostrarDetalle)) &&
(($persona->getValor("estado") == "540") ||
($persona->getValor("estado") == "550") ||
($persona->getValor("estado") == "560"))) { ?>
<!-- CANDIDATURAS --> <!-- CANDIDATURAS -->
<div class="encabezado"><?php echo $locale['1551']; ?></div> <div class="encabezado"><?php echo $locale['1551']; ?></div>
<table align="center" width="100%"> <table align="center" width="100%">
@ -396,28 +398,14 @@ if(in_array("personales",$mostrarDetalle)){ ?>
<input type="hidden" name="back" value="<?php echo $back; ?>" /> <input type="hidden" name="back" value="<?php echo $back; ?>" />
<div style="float:left "> <div style="float:left ">
<?php <?php
// Todos los pedidos pendiente // Todos los pedidos pendientes
include_once("Objects/ListaPedido.php"); include_once("Objects/ListaPedido.php");
$listaPedidosPend=new ListaPedido($usuario,"","","10"); $listaPedidosPend = new ListaPedido($usuario, "", "", "130");
$listaPedidosAsig=new ListaPedido($usuario,"","","20");
$lpedPend = $listaPedidosPend->getPedidos(); $lpedPend = $listaPedidosPend->getPedidos();
$listaProponer = array(); $listaProponer = array();
foreach ($lpedPend as $pedAct) { foreach ($lpedPend as $pedAct) {
$listaProponer[$pedAct->getValor("oid")] = $pedAct->getValor("nombre"); $listaProponer[$pedAct->getValor("oid")] = $pedAct->getValor("nombre");
} }
$lpedPend=$listaPedidosAsig->getPedidos();
foreach($lpedPend as $pedAct){
$listaProponer[$pedAct->getValor("oid")]=$pedAct->getValor("nombre");
}
$listaPedidosAcept=$persona->getPedidosByEstado("20");
$listaPedidosRech=$persona->getPedidosByEstado("10");
$listaPedidosRRHH=$persona->getPedidosByEstado("40");
// A todos los pedidos pendientes y asignados, le restamos los que est<73> aceptado y rechazados
// <20>stos ser<65>n a los que se pueda proponer
$listaProponer=array_diff_assoc($listaProponer,$listaPedidosAcept);
$listaProponer=array_diff_assoc($listaProponer,$listaPedidosRech);
$listaProponer=array_diff_assoc($listaProponer,$listaPedidosRRHH);
if (count($listaProponer) > 0) { if (count($listaProponer) > 0) {
?><select multiple="multiple" size="10" name="propPed[]" ><?php ?><select multiple="multiple" size="10" name="propPed[]" ><?php

View File

@ -598,8 +598,8 @@ $locale['1079'] = "Peso idioma";
$locale['1080'] = "Peso perf&iacute;l"; $locale['1080'] = "Peso perf&iacute;l";
$locale['1081'] = "*Nota: La suma de todos los pesos tiene que ser 100"; $locale['1081'] = "*Nota: La suma de todos los pesos tiene que ser 100";
$locale['1082'] = "Pesos para la afinidad"; $locale['1082'] = "Pesos para la afinidad";
$locale['1083'] = "Proponer para solicitud de oferta"; $locale['1083'] = "Proponer para oferta de una solicitud";
$locale['1084'] = "Proponer"; $locale['1084'] = "Crear oferta";
$locale['1085'] = "Se ha propuesto correctamente el candidato a las solicitudes de oferta"; $locale['1085'] = "Se ha propuesto correctamente el candidato a las solicitudes de oferta";
$locale['1086'] = "Se ha eliminado la titulaci&oacute;n correctamente"; $locale['1086'] = "Se ha eliminado la titulaci&oacute;n correctamente";
$locale['1087'] = "Se ha cambiado correctamente el estado"; $locale['1087'] = "Se ha cambiado correctamente el estado";

View File

@ -10,16 +10,27 @@ if(!$usuario->tieneRol("4")
exit; exit;
} }
include_once("Objects/Pedido.php"); include_once("Objects/Pedido.php");
include_once("Objects/ListaOfertas.php");
include_once("Objects/Oferta.php");
$idCandidato=$_POST['idCandidato']; $idCandidato=$_POST['idCandidato'];
$pedidos=$_POST['propPed']; $pedidos=$_POST['propPed'];
$back=$_POST['back']; $back=$_POST['back'];
$observacion=$_POST['obsProponer']; $observacion=$_POST['obsProponer'];
$listaOfertas = new ListaOfertas($usuario, "", "", "0");
$arrayInsert = array();
// Para cada pedido, proponer el candidato // Para cada pedido, proponer el candidato
foreach($pedidos as $codigo) { foreach($pedidos as $codigo) {
$pedidoAct=new Pedido($codigo,$usuario); $arrayInsert["pedido"] = $codigo;
$pedidoAct->proponerCandidato($idCandidato,$observacion); $arrayInsert["obsGerente"] = $observacion;
$arrayInsert["estado"] = "110";
$arrayInsert["candidato"] = $idCandidato;
$idOferta = $listaOfertas->addOferta($arrayInsert);
unset ($arrayInsert);
} }
$back.="&msg=1"; $back.="&msg=1";
header("Location: ".$back); header("Location: ".$back);