Tareas #679. Al dar de alta una oferta, la lista de candidatos para la selección tiene que salir todos menos los "no disponibles".
update usuarios set estado = '540' where estado = '560'; update usuarios set estado = '530' where estado = '100'; Revisar la tabla candidatos_estados para que coincida con la de desarrollo git-svn-id: https://192.168.0.254/svn/Proyectos.Incam_Intranet/trunk/src@80 e2b1556b-49f8-d141-9351-52d6861a72d9
This commit is contained in:
parent
f73446c358
commit
400d81b595
@ -13,6 +13,7 @@ class ListaCandidatos extends ListaPersonas {
|
|||||||
//Atributos:
|
//Atributos:
|
||||||
//Constructor:
|
//Constructor:
|
||||||
//Funciones:
|
//Funciones:
|
||||||
|
public $estados = array();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Crea una lista de candidatos.
|
* Crea una lista de candidatos.
|
||||||
@ -24,6 +25,7 @@ class ListaCandidatos extends ListaPersonas {
|
|||||||
parent::ListaPersonas($usuario, $orden, $sql);
|
parent::ListaPersonas($usuario, $orden, $sql);
|
||||||
$this->tipo = "candidato";
|
$this->tipo = "candidato";
|
||||||
$this->estado = $estado;
|
$this->estado = $estado;
|
||||||
|
$this->estados = explode(",", $estado);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -62,17 +64,37 @@ class ListaCandidatos extends ListaPersonas {
|
|||||||
*/
|
*/
|
||||||
function getCandidatos() {
|
function getCandidatos() {
|
||||||
$candidatos = array();
|
$candidatos = array();
|
||||||
|
$value = "";
|
||||||
|
|
||||||
if ($this->sql != "") {
|
if ($this->sql != "") {
|
||||||
// metemos el estado si es > 0
|
// metemos el estado si es > 0
|
||||||
if ($this->estado > 0) {
|
if (count($this->estados) > 0) {
|
||||||
if (stripos($this->sql, "WHERE") > 0) {
|
if (stripos($this->sql, "WHERE") > 0) {
|
||||||
$sqlAntesWhere = substr($this->sql, 0, stripos($this->sql, "WHERE"));
|
$sqlAntesWhere = substr($this->sql, 0, stripos($this->sql, "WHERE"));
|
||||||
$sqlDespuesWhere = substr($this->sql, stripos($this->sql, "WHERE") + 5, strlen($this->sql));
|
$sqlDespuesWhere = substr($this->sql, stripos($this->sql, "WHERE") + 5, strlen($this->sql));
|
||||||
$sqlConEstado = "WHERE usuarios.estado='" . $this->estado . "' and ";
|
|
||||||
|
$sqlConEstado = "WHERE usuarios.estado in (";
|
||||||
|
$i=1;
|
||||||
|
foreach ($this->estados as $value) {
|
||||||
|
$sqlConEstado = $sqlConEstado. "'". $value . "'";
|
||||||
|
if ($i != count($this->estados))
|
||||||
|
$sqlConEstado = $sqlConEstado. ",";
|
||||||
|
$i++;
|
||||||
|
|
||||||
|
}
|
||||||
|
$sqlConEstado = $sqlConEstado. ") and ";
|
||||||
|
|
||||||
$sqlNueva = $sqlAntesWhere . $sqlConEstado . $sqlDespuesWhere;
|
$sqlNueva = $sqlAntesWhere . $sqlConEstado . $sqlDespuesWhere;
|
||||||
} else {
|
} else {
|
||||||
$sqlConEstado = "WHERE usuarios.estado='" . $this->estado . "' ";
|
$sqlConEstado = "WHERE usuarios.estado in (";
|
||||||
|
$i=1;
|
||||||
|
foreach ($this->estados as $value) {
|
||||||
|
$sqlConEstado = $sqlConEstado. "'". $value . "'";
|
||||||
|
if ($i != count($this->estados))
|
||||||
|
$sqlConEstado = $sqlConEstado. ",";
|
||||||
|
$i++;
|
||||||
|
}
|
||||||
|
$sqlConEstado = $sqlConEstado. ") ";
|
||||||
$sqlNueva = $this->sql . $sqlConEstado;
|
$sqlNueva = $this->sql . $sqlConEstado;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
@ -80,14 +102,22 @@ class ListaCandidatos extends ListaPersonas {
|
|||||||
}
|
}
|
||||||
$consulta = $sqlNueva . " " . $this->order_by;
|
$consulta = $sqlNueva . " " . $this->order_by;
|
||||||
} else {
|
} else {
|
||||||
if ($this->estado > 0) {
|
if (count($this->estados) > 0) {
|
||||||
$consulta = "SELECT oid from usuarios WHERE tipo='" . $this->tipo . "' and estado='" . $this->estado . "'" . $this->orden;
|
$consulta = "SELECT oid from usuarios WHERE tipo='" . $this->tipo . "' and estado in (";
|
||||||
|
$i=1;
|
||||||
|
foreach ($this->estados as $value) {
|
||||||
|
$consulta = $consulta. "'". $value . "'";
|
||||||
|
if ($i != count($this->estados))
|
||||||
|
$consulta = $consulta. ",";
|
||||||
|
$i++;
|
||||||
|
}
|
||||||
|
$consulta = $consulta. ")". $this->orden;
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
$consulta = "SELECT oid from usuarios WHERE tipo='" . $this->tipo . "'" . $this->orden . "";
|
$consulta = "SELECT oid from usuarios WHERE tipo='" . $this->tipo . "'" . $this->orden . "";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
$bd = new BD();
|
$bd = new BD();
|
||||||
$resultado = $bd->execQuery($consulta);
|
$resultado = $bd->execQuery($consulta);
|
||||||
|
|
||||||
|
|||||||
@ -7,6 +7,7 @@
|
|||||||
*/
|
*/
|
||||||
include_once("Candidato.php");
|
include_once("Candidato.php");
|
||||||
include_once("Empleado.php");
|
include_once("Empleado.php");
|
||||||
|
|
||||||
class ListaPersonas{
|
class ListaPersonas{
|
||||||
|
|
||||||
//Atributos:
|
//Atributos:
|
||||||
@ -30,7 +31,7 @@ include_once("Empleado.php");
|
|||||||
protected $order_by = "";
|
protected $order_by = "";
|
||||||
|
|
||||||
protected $estado = "";
|
protected $estado = "";
|
||||||
|
|
||||||
//Constructor:
|
//Constructor:
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@ -205,10 +205,10 @@ class Oferta {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Devuelve una lista de candidatos disponibles para una oferta
|
* Devuelve una lista de candidatos disponibles para una oferta, que son todos menos los no disponibles #679 Peticion
|
||||||
*/
|
*/
|
||||||
function getCandidatosDisponibles() {
|
function getCandidatosDisponibles() {
|
||||||
return $this->getCandidatos("540");
|
return $this->getCandidatos("510,521,522,523,540,550");
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user