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";
// Procesamos los datos
foreach ($campos as $key => $value) {
// Metemos todos los valores excepto el candidato, que se hace después
if ($key != "candidato") {
$inserto .= ", $key";
$valores .= ", '$value'";
}
}
// Insertamos en la BD
$consulta = "INSERT INTO candidato_pedido ($inserto) VALUES ($valores)";
@ -117,9 +120,14 @@ class ListaOfertas {
return "-1";
} else {
$id = mysql_insert_id();
$p = new Oferta($id, $this->gestor);
$ofertaNueva = new Oferta($id, $this->gestor);
$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;
}
@ -130,9 +138,6 @@ class ListaOfertas {
if ($resultado = $bd->execQuery($consulta)) {
$rows = mysql_fetch_array($resultado);
echo "########################<br/>";
print_r($rows);
echo "########################<br/>";
$num = 1;
if (!empty($rows[0])) {

View File

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

View File

@ -7,14 +7,16 @@ if(!$_SESSION["oid"]){
//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 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
WHERE U.oid='".$persona->getValor("oid")."'
AND CP.candidato=U.oid
AND P.oid=CP.pedido
AND CE.cod=CP.estado
AND CE.idioma=U.idioma
AND CP.estado <> '30'";
AND CE.idioma=U.idioma";
if ($resultado = consultar($consulta)){
$num = mysql_num_rows($resultado);
if($num == 0){
@ -28,12 +30,19 @@ if ($resultado = consultar($consulta)){
do{
$estado = $row["estado"];
$pedido = $row["pedido"];
$oid = $row["oid"];
$oid = $row["idPedido"];
$referenciaOferta = $row["referencia"];
$oidOferta = $row["idOferta"];
$obsRRHH = $row["obsRRHH"];
$obsGerente = $row["obsGerente"];
$idCandidato = $row["idCandidato"];
echo "<li><a href=\"pedido.php?idPedido=".$oid."\" target=\"_blank\" />$oid</a> - ";
if($usuario->tieneRol("4")){
echo "<li>";
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; ?>')">
<img src="<?php echo (($obsRRHH!="") || ($obsGerente!=""))? "css/coment.png" : "css/add_coment.png"; ?>" /></a>
@ -62,7 +71,7 @@ if ($resultado = consultar($consulta)){
</div>
<?php
}
echo " $pedido ($estado)</li>";
} while ($row = mysql_fetch_array($resultado));
echo "</ul>";
}

View File

@ -21,9 +21,11 @@ if(stripos($destinoURL,"?")>0){
* - Cambiar la observaci<EFBFBD>n de una candidatura por parte de RRHH
*/
$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) {
case "addComent": if (($_POST['obs'] != "") && ($_POST['idCandidato'] != "") && ($_POST['idPedido'] != "")) {
// Agregamso comentario al candidato sobre el pedido
@ -37,7 +39,8 @@ switch ($action) {
$tipo = "error";
}
}
break;;
break;
;
default:
break;
}
@ -45,14 +48,15 @@ switch ($action) {
<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>";
} ?>
}
?>
<div id="ContTabul">
<!-- Datos personales -->
<?php
if(in_array("personales",$mostrarDetalle)){ ?>
<?php if (in_array("personales", $mostrarDetalle)) { ?>
<div class="encabezado"><?php echo $locale['1548']; ?></div>
<table align="center" width="100%" border="0">
<tr>
@ -81,16 +85,14 @@ if(in_array("personales",$mostrarDetalle)){ ?>
<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>
<td class="sinborde" width="33%"><span class="resaltado"><?php echo $locale['1555']; ?></span> <?php echo $persona->getValor("cp"); ?></td>
*/
?>
*/ ?>
</tr>
<tr>
<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>
<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 -->
<div class="encabezado"><?php echo $locale['1550']; ?></div>
<table align="center" width="100%">
<?php
if(in_array("cambEstado",$mostrarDetalle)){ ?>
<?php if (in_array("cambEstado", $mostrarDetalle)) { ?>
<tr>
<td colspan="3" class="sinborde"><div id="obsCambioEst" class="obsCambioEst">
@ -198,8 +199,7 @@ if(in_array("personales",$mostrarDetalle)){ ?>
if ($persona->getValor("tipo") == "usuario") {
?>
<span class="resaltado"><?php echo $locale['1560']; ?></span> <?php echo nombre_localidad($persona->getValor("localidad_trabajo")); ?>
<?php
} ?>
<?php } ?>
</td>
<td class="sinborde" width="33%"><span class="resaltado"><?php echo $locale['1561']; ?></span>
<?php
@ -274,7 +274,6 @@ if(in_array("personales",$mostrarDetalle)){ ?>
echo "(" . $pos . ") " . $persona->getDiasVacaciones($pos) . "<br />";
echo "(" . date('Y') . ") " . $persona->getDiasVacaciones(date('Y'));
}
?></td>
<?php
} elseif ($persona->getValor("tipo") == "candidato") {
@ -311,7 +310,6 @@ if(in_array("personales",$mostrarDetalle)){ ?>
} else {
?>
<br><?php echo nl2br($persona->getValor("observaciones"));
} ?></td>
</tr>
</table>
@ -355,7 +353,8 @@ if(in_array("personales",$mostrarDetalle)){ ?>
<tr align="center">
<td colspan="3" width="100%">
<?php if (in_array("addCurriculum", $mostrarDetalle)) {
$persona->addCurriculum($_FILES['userfile']);}?>
$persona->addCurriculum($_FILES['userfile']);
} ?>
<?php echo ver_curriculums($persona->getValor("oid"), $tipo); ?>
</td>
</tr>
@ -374,7 +373,10 @@ if(in_array("personales",$mostrarDetalle)){ ?>
</table>
<?php }
if(in_array("candidaturas",$mostrarDetalle)){ ?>
if ((in_array("candidaturas", $mostrarDetalle)) &&
(($persona->getValor("estado") == "540") ||
($persona->getValor("estado") == "550") ||
($persona->getValor("estado") == "560"))) { ?>
<!-- CANDIDATURAS -->
<div class="encabezado"><?php echo $locale['1551']; ?></div>
<table align="center" width="100%">
@ -396,28 +398,14 @@ if(in_array("personales",$mostrarDetalle)){ ?>
<input type="hidden" name="back" value="<?php echo $back; ?>" />
<div style="float:left ">
<?php
// Todos los pedidos pendiente
// Todos los pedidos pendientes
include_once("Objects/ListaPedido.php");
$listaPedidosPend=new ListaPedido($usuario,"","","10");
$listaPedidosAsig=new ListaPedido($usuario,"","","20");
$listaPedidosPend = new ListaPedido($usuario, "", "", "130");
$lpedPend = $listaPedidosPend->getPedidos();
$listaProponer = array();
foreach ($lpedPend as $pedAct) {
$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) {
?><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['1081'] = "*Nota: La suma de todos los pesos tiene que ser 100";
$locale['1082'] = "Pesos para la afinidad";
$locale['1083'] = "Proponer para solicitud de oferta";
$locale['1084'] = "Proponer";
$locale['1083'] = "Proponer para oferta de una solicitud";
$locale['1084'] = "Crear 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['1087'] = "Se ha cambiado correctamente el estado";

View File

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