diff --git a/Objects/ListaOfertas.php b/Objects/ListaOfertas.php index 86d7cbd..72c9bfb 100644 --- a/Objects/ListaOfertas.php +++ b/Objects/ListaOfertas.php @@ -106,8 +106,11 @@ class ListaOfertas { $valores = "$fecha, $referencia"; // Procesamos los datos foreach ($campos as $key => $value) { - $inserto .= ", $key"; - $valores .= ", '$value'"; + // Metemos todos los valores excepto el candidato, que se hace despus + 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 "########################
"; - print_r($rows); - echo "########################
"; $num = 1; if (!empty($rows[0])) { diff --git a/Objects/Oferta.php b/Objects/Oferta.php index 0116f60..bc0f979 100644 --- a/Objects/Oferta.php +++ b/Objects/Oferta.php @@ -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; @@ -270,6 +275,10 @@ class Oferta { $candidato = new Candidato($this->usuario, $idCandidato); $estadoCand = $candidato->getValor("estado"); + + dbug($estadoCand); + echo dbug('print'); + switch ($estadoCand) { case "540": @@ -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'); } } diff --git a/candidaturas.php b/candidaturas.php index 020c5b8..a673177 100644 --- a/candidaturas.php +++ b/candidaturas.php @@ -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 "
  • $oid - "; - if($usuario->tieneRol("4")){ + echo "
  • "; + echo "Oferta $referenciaOferta "; + echo "($estado) "; + echo "- Solicitud \"$pedido\"
  • "; + + // desactivar el comentario por ahora + if (false) { //if($usuario->tieneRol("4")){ ?> " /> @@ -62,8 +71,8 @@ if ($resultado = consultar($consulta)){ "; - }while ($row = mysql_fetch_array($resultado)); + + } while ($row = mysql_fetch_array($resultado)); echo ""; } }else{ diff --git a/detalles_usuario.php b/detalles_usuario.php index 55c9204..6a646e5 100644 --- a/detalles_usuario.php +++ b/detalles_usuario.php @@ -12,456 +12,444 @@ include_once("functions_get.php"); include_once("seguridad.php"); -$destinoURL=substr($_SERVER['REQUEST_URI'],strripos($_SERVER['REQUEST_URI'],"/")+1); -if(stripos($destinoURL,"?")>0){ - $destinoURL=substr($destinoURL,0,stripos($destinoURL,"?")); +$destinoURL = substr($_SERVER['REQUEST_URI'], strripos($_SERVER['REQUEST_URI'], "/") + 1); +if (stripos($destinoURL, "?") > 0) { + $destinoURL = substr($destinoURL, 0, stripos($destinoURL, "?")); } /* * Comprobamos acciones com�nes a editar en los detalles como: * - Cambiar la observaci�n de una candidatura por parte de RRHH */ -$action=""; -if($_GET['action']!="") $action= $_GET['action']; +$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 - try{ - $pedido=new Pedido($_POST['idPedido'],$usuario); - $pedido->addComentarioPropuestaRRHH($_POST['idCandidato'],$_POST['obs']); - $msg=$locale['4047']; - $tipo="ok"; - } catch(Exception $e){ - $msg=$e->getMessage(); - $tipo="error"; - } - } - break;; - default: - break; + case "addComent": if (($_POST['obs'] != "") && ($_POST['idCandidato'] != "") && ($_POST['idPedido'] != "")) { + // Agregamso comentario al candidato sobre el pedido + try { + $pedido = new Pedido($_POST['idPedido'], $usuario); + $pedido->addComentarioPropuestaRRHH($_POST['idCandidato'], $_POST['obs']); + $msg = $locale['4047']; + $tipo = "ok"; + } catch (Exception $e) { + $msg = $e->getMessage(); + $tipo = "error"; + } + } + break; + ; + default: + break; } ?> -

    getValor("nombre_tipo").": ".$persona->getValor("nombre")." ".$persona->getValor("apellidos");?>

    +

    getValor("nombre_tipo") . ": " . $persona->getValor("nombre") . " " . $persona->getValor("apellidos"); ?>

    -".$msg.""; -} ?> +" . $msg . ""; +} +?>
    - - -
    - - - - - - - - - - + + getValor("tipo_via")." ".$persona->getValor("direccion")." ".$persona->getValor("numero").", ".$persona->getValor("piso")." ".$persona->getValor("puerta"); ?> + + */ ?> + + + + + getValor("localidad")); ?> + + */ ?> + + + + + + + + +
    getValor("nombre")." ".$persona->getValor("apellidos"); ?>getValor("fecha_nacimiento"); ?>getValor("dni"); ?>
    getValor("t_movil"); ?>getValor("t_casa"); ?>getValor("tipo")=="usuario"){ - echo "".$locale['109']."".$persona->getValor("t_trabajo").""; - } - ?> + + +
    + + + + + + + + + + - - - - - + + + + + En la pantalla de alta/edición/ver de un candidato, ocultar los campos 'VÍA', 'NOMBRE VÍA', 'NÚMERO', 'PISO', 'PUERTA' y 'CP' -?> - - - getValor("tipo_via")." ".$persona->getValor("direccion")." ".$persona->getValor("numero").", ".$persona->getValor("piso")." ".$persona->getValor("puerta"); ?> - - */ - ?> - - - - - getValor("localidad")); ?> - - */ - ?> - - - - - - - - -
    getValor("nombre") . " " . $persona->getValor("apellidos"); ?>getValor("fecha_nacimiento"); ?>getValor("dni"); ?>
    getValor("t_movil"); ?>getValor("t_casa"); ?>getValor("tipo") == "usuario") { + echo "" . $locale['109'] . "" . $persona->getValor("t_trabajo") . ""; + } + ?> -
    ">getValor("email"); ?>
    ">getValor("email"); ?> getValor("cp"); ?>
    getValor("localidad"))); ?>getValor("tipo")=="usuario"){ - echo $locale['1905'].": ".$persona->getValor("extension"); - }else{ - echo ""; - } - ?>

    getValor("descripcion")); ?>
    + ?> +
    getValor("cp"); ?>
    getValor("localidad"))); ?>getValor("tipo") == "usuario") { + echo $locale['1905'] . ": " . $persona->getValor("extension"); + } else { + echo ""; + } + ?>

    getValor("descripcion")); ?>
    - -
    - - - - + +
    +if (in_array("laborables", $mostrarDetalle)) { ?> + +
    + + + + - - - - - - getValor("tipo")=="candidato"){ - ?> - - - - - - - - - + + + + + + getValor("tipo") == "candidato") { + ?> + + + + + + + + + - - getValor("tipo"); - if($tipo == "usuario"){ - ?> - - - - - - - - - getValor("tipo")=="usuario"){ - ?> - - + + getValor("tipo"); + if ($tipo == "usuario") { + ?> + + + + + + + + + getValor("tipo") == "usuario") { + ?> + + - getValor("tipo")=="candidato") { - ?> - - - - - - - - - - - - - + getValor("tipo") == "candidato") { + ?> + + + + + + + + + + + + + - -
    -
    &action=cambEstObs" method="post"> - " /> - -
    +
    &action=cambEstObs" method="post"> + " /> + +
    -
    - : getValor("nombre_estado"); ?> - getValor("msgEstado")!=""){ - echo " -> ".$persona->getValor("msgEstado"); - } - if(is_numeric($persona->getValor("diasEspera")) && ($persona->getValor("diasEspera")>0)){ - echo "
    ".$locale['1094']." ".$persona->getValor("diasEspera")." ".$locale['1093']; - } - echo "
    "; - $estadosSiguientes=$persona->getSiguientes(); - foreach($estadosSiguientes as $codEstado => $nombreEstado){ - // En estados 20,60 se necesita mensaj obs - if(($codEstado=="20") || ($codEstado=="60")){ - ?> - ','','txt;dias')" style="margin-bottom:5px"> - - ','','salario')" style="margin-bottom:5px"> + + : getValor("nombre_estado"); ?> + getValor("msgEstado") != "") { + echo " -> " . $persona->getValor("msgEstado"); + } + if (is_numeric($persona->getValor("diasEspera")) && ($persona->getValor("diasEspera") > 0)) { + echo "
    " . $locale['1094'] . " " . $persona->getValor("diasEspera") . " " . $locale['1093']; + } + echo "
    "; + $estadosSiguientes = $persona->getSiguientes(); + foreach ($estadosSiguientes as $codEstado => $nombreEstado) { + // En estados 20,60 se necesita mensaj obs + if (($codEstado == "20") || ($codEstado == "60")) { + ?> + ','','txt;dias')" style="margin-bottom:5px"> + + ','','salario')" style="margin-bottom:5px"> - - &action=cambEst&idEst='" style="margin-bottom:5px"> - "; - } - ?> -
    getValor("tipo")=="candidato"){ - echo $locale['1578']." : ".$persona->getValor("fecha_registro"); - }elseif ($persona->getValor("tipo")=="usuario") { - echo $locale['1589']." : ".$persona->getValor("fecha_alta"); - } - ?>getValor("fecha_modificacion"); ?>: getValor("fecha_entrevista"); ?>
    - getValor("tipo")=="candidato"){ - ?> - - getValor("procedencia")); ?>
    - - : - getValor("nombre_procedencia_cv"); ?>
    getValor("tipo")=="usuario"){ - ?> - getValor("localidad_trabajo")); ?> - - - getProvinciasDeseadas(); - $keylocalidades=array_values($localidadesDeseadas); - // Mostramos la lista - foreach ($localidadesDeseadas as $nombre =>$valor) { - echo $nombre.", "; - } - ?> -
    - + + &action=cambEst&idEst='" style="margin-bottom:5px"> + "; + } + ?> +
    getValor("tipo") == "candidato") { + echo $locale['1578'] . " : " . $persona->getValor("fecha_registro"); + } elseif ($persona->getValor("tipo") == "usuario") { + echo $locale['1589'] . " : " . $persona->getValor("fecha_alta"); + } + ?>getValor("fecha_modificacion"); ?>: getValor("fecha_entrevista"); ?>
    + getValor("tipo") == "candidato") { + ?> + + getValor("procedencia")); ?>
    + + : + getValor("nombre_procedencia_cv"); ?>
    getValor("tipo") == "usuario") { + ?> + getValor("localidad_trabajo")); ?> + + + getProvinciasDeseadas(); + $keylocalidades = array_values($localidadesDeseadas); + // Mostramos la lista + foreach ($localidadesDeseadas as $nombre => $valor) { + echo $nombre . ", "; + } + ?> +
    + - getProvinciasNoDeseadas(); - $keylocalidades=array_values($localidadesNoDeseadas); - // Mostramos la lista - foreach ($localidadesNoDeseadas as $nombre =>$valor) { - echo $nombre.", "; - } - ?> - -
    getValor("seguridad_social"); ?>getValor("cuenta_corriente"); ?>getValor("nombre_rol"); ?>
    - getPerfiles(); - $keylocalidades=array_values($perfiles); - // Mostramos la lista para borrar - foreach ($perfiles as $nombre =>$valor) { - echo $nombre.", "; - } - ?> : getValor("salario"); ?>tieneRol("4")){ - ?> -','v')"> - "; - $diaoff=substr(constante("daycacationsoff"),0,2); - $mesoff=substr(constante("daycacationsoff"),3,2); - $diaCierreVac=mktime(0,0,0,$mesoff,$diaoff,date('Y')); + getProvinciasNoDeseadas(); + $keylocalidades = array_values($localidadesNoDeseadas); + // Mostramos la lista + foreach ($localidadesNoDeseadas as $nombre => $valor) { + echo $nombre . ", "; + } + ?> - $hoy=mktime(0,0,0,date('m'),date('d'),date('Y')); - if($hoy>$diaCierreVac){ - // este y posterior - echo "(".date('Y').") ".$persona->getDiasVacaciones(date('Y'))."
    "; - $pos=date('Y')+1; - echo "(".$pos.") ".$persona->getDiasVacaciones($pos); - } else { - $pos=date('Y')-1; - echo "(".$pos.") ".$persona->getDiasVacaciones($pos). "
    "; - echo "(".date('Y').") ".$persona->getDiasVacaciones(date('Y')); - } +
    getValor("seguridad_social"); ?>getValor("cuenta_corriente"); ?>getValor("nombre_rol"); ?>
    + getPerfiles(); + $keylocalidades = array_values($perfiles); + // Mostramos la lista para borrar + foreach ($perfiles as $nombre => $valor) { + echo $nombre . ", "; + } + ?> : getValor("salario"); ?>tieneRol("4")) { + ?> + ','v')"> + "; + $diaoff = substr(constante("daycacationsoff"), 0, 2); + $mesoff = substr(constante("daycacationsoff"), 3, 2); + $diaCierreVac = mktime(0, 0, 0, $mesoff, $diaoff, date('Y')); - ?>getValor("nombre_salario_min"); ?> getValor("nombre_salario_max"); ?>
    getValor("cliente_actual")); ?>
    - + $hoy = mktime(0, 0, 0, date('m'), date('d'), date('Y')); + if ($hoy > $diaCierreVac) { + // este y posterior + echo "(" . date('Y') . ") " . $persona->getDiasVacaciones(date('Y')) . "
    "; + $pos = date('Y') + 1; + echo "(" . $pos . ") " . $persona->getDiasVacaciones($pos); + } else { + $pos = date('Y') - 1; + echo "(" . $pos . ") " . $persona->getDiasVacaciones($pos) . "
    "; + echo "(" . date('Y') . ") " . $persona->getDiasVacaciones(date('Y')); + } + ?>
    getValor("nombre_salario_min"); ?> getValor("nombre_salario_max"); ?>
    getValor("cliente_actual")); ?>
    + - -
    method="post" > - - - -
    + +
    method="post" > + + + +
    - -
    getValor("observaciones")); - -} ?>
    + +
    getValor("observaciones")); + } ?>
    - -
    - - - + + + + + + + + " method="POST" enctype="multipart/form-data"> + + + + +

    - getValor("oid")); - if(gettype($titulaciones)!="NULL"){ - foreach($titulaciones as $tecno){ - echo $tecno."
    "; - } +if (in_array("curriculum", $mostrarDetalle)) { ?> + +
    + + + - + - + - - - - - - - - " method="POST" enctype="multipart/form-data"> - - - - -

    + getValor("oid")); + if (gettype($titulaciones) != "NULL") { + foreach ($titulaciones as $tecno) { + echo $tecno . "
    "; + } } ?> -

    - getValor("oid")); - if(gettype($tecnologias)!="NULL"){ - foreach($tecnologias as $tecno){ - echo $tecno."
    "; - } +

    + getValor("oid")); + if (gettype($tecnologias) != "NULL") { + foreach ($tecnologias as $tecno) { + echo $tecno . "
    "; + } } ?> -

    - getValor("oid")); - if(gettype($idiomas)!="NULL"){ - foreach($idiomas as $tecno){ - echo $tecno."
    "; - } +

    + getValor("oid")); + if (gettype($idiomas) != "NULL") { + foreach ($idiomas as $tecno) { + echo $tecno . "
    "; + } } ?> -
    - addCurriculum($_FILES['userfile']);}?> - getValor("oid"), $tipo); ?> -

    - - - -
    +
    + addCurriculum($_FILES['userfile']); + } ?> + getValor("oid"), $tipo); ?> +

    + + + +
    - - -
    - - - + +
    -
    -
    - -
    - tieneRol("1") || $usuario->tieneRol("4")){ - ?> -
    -
    - -
    -
    - " /> - -
    - 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"); + getValor("estado") == "540") || + ($persona->getValor("estado") == "550") || + ($persona->getValor("estado") == "560"))) { ?> + +
    + + + - -
    +
    +
    + +
    + tieneRol("1") || $usuario->tieneRol("4")) { + ?> +
    +
    + +
    + + " /> + +
    + getPedidos(); + $listaProponer = array(); + foreach ($lpedPend as $pedAct) { + $listaProponer[$pedAct->getValor("oid")] = $pedAct->getValor("nombre"); + } - // A todos los pedidos pendientes y asignados, le restamos los que est� aceptado y rechazados - // �stos ser�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) { + ?> +
    +
    + Comentario:
    +
    + - if(count($listaProponer)>0){ - ?> -
    -
    - Comentario:
    -
    - +
    + + No hay solicitudes de oferta
    + + + + + - - - No hay solicitudes de oferta - - - - - - -
    - - -
    - - - -
    -
    - -
    - +
    + + +
    + + + +
    +
    + +
    +
    diff --git a/idiomas/sp/lenguaje.php b/idiomas/sp/lenguaje.php index dc74ae5..9c7b539 100644 --- a/idiomas/sp/lenguaje.php +++ b/idiomas/sp/lenguaje.php @@ -598,8 +598,8 @@ $locale['1079'] = "Peso idioma"; $locale['1080'] = "Peso perfí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ón correctamente"; $locale['1087'] = "Se ha cambiado correctamente el estado"; diff --git a/proponerCandidato.php b/proponerCandidato.php index f66441a..2e65f84 100644 --- a/proponerCandidato.php +++ b/proponerCandidato.php @@ -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); +foreach($pedidos as $codigo) { + $arrayInsert["pedido"] = $codigo; + $arrayInsert["obsGerente"] = $observacion; + $arrayInsert["estado"] = "110"; + $arrayInsert["candidato"] = $idCandidato; + + + $idOferta = $listaOfertas->addOferta($arrayInsert); + unset ($arrayInsert); } $back.="&msg=1"; header("Location: ".$back);