diff --git a/src/Objects/CapacidadProfesional.php b/src/Objects/CapacidadProfesional.php index a159bc0..615aa3f 100644 --- a/src/Objects/CapacidadProfesional.php +++ b/src/Objects/CapacidadProfesional.php @@ -41,16 +41,15 @@ /** * Devuelve una lista de tecnolog�as asociadas a la capacidad - * OJO ESTA TABLA TAMBIEN GUARDA EL ID_PERFIL_TECNICO POR SI EN UN FUTURO, SE REQUIERE QUE UNA CAPACIDAD TENGA VARIOS PERFILES TECNICOS + * (LO QUITAMOS)OJO ESTA TABLA TAMBIEN GUARDA EL ID_PERFIL_TECNICO POR SI EN UN FUTURO, SE REQUIERE QUE UNA CAPACIDAD TENGA VARIOS PERFILES TECNICOS */ private function _getTecnologias(){ $bd = new BD(); $consulta = ""; - $consulta = "SELECT CPT.id_capacidad, CPT.id_perfil_tecnico, CPT.id_tecnologia, CPT.meses, T.id "; + $consulta = "SELECT CPT.id_capacidad, CPT.id_tecnologia, CPT.meses, T.id "; $consulta = $consulta. "FROM capacidades_perfil_tecnologias as CPT "; $consulta = $consulta. "left join tecnologia as T on (T.oid = CPT.id_tecnologia) "; $consulta = $consulta. "where CPT.id_capacidad = ". $this->campos["id"]; -// $consulta = $consulta. " and CPT.id_perfil_tecnico = ". $this->campos["id_perfil_tecnico"]; $resultado = $bd->execQuery($consulta); if (mysql_num_rows($resultado) != 0) { $this->tecnologias = null; @@ -85,7 +84,7 @@ } //Insertamos en la BD - $consulta = "INSERT INTO capacidades ($inserto) VALUES ($valores)"; + $consulta = "INSERT INTO capacidades ($inserto) VALUES ($valores)"; //echo $consulta; $bd = new BD(); if(!$bd->execQuery($consulta)){ @@ -107,12 +106,11 @@ */ private function addTecnologia($id_tecnologia,$meses){ $id_capacidad = $this->campos["id"]; - $id_perfil_tecnico = $this->campos["id_perfil_tecnico"]; - if(!in_array($id_tecnologia, $this->tecnologias)){ + if(($id_tecnologia>0) && (!in_array($id_tecnologia, $this->tecnologias))){ $consulta = "DELETE FROM capacidades_perfil_tecnologias where id_capacidad='$id_capacidad' and id_tecnologia='$id_tecnologia'"; $bd = new BD(); $bd->execQuery($consulta); - $consulta = "INSERT INTO capacidades_perfil_tecnologias (id_capacidad, id_perfil_tecnico, id_tecnologia, meses) VALUES('$id_capacidad', '$id_perfil_tecnico', '$id_tecnologia', '$meses')"; + $consulta = "INSERT INTO capacidades_perfil_tecnologias (id_capacidad, id_tecnologia, meses) VALUES('$id_capacidad', '$id_tecnologia', '$meses')"; //echo $consulta; $bd = new BD(); if($bd->execQuery($consulta)){ diff --git a/src/Objects/ListaOfertas.php b/src/Objects/ListaOfertas.php index 441eade..b766fb4 100644 --- a/src/Objects/ListaOfertas.php +++ b/src/Objects/ListaOfertas.php @@ -102,7 +102,7 @@ class ListaOfertas { // Calculamos el id $referencia = $this->calculaReferencia($campos["pedido"]); $inserto = "fecha, referencia"; - $fecha = "'" . date("Y-m-d") . "'"; + $fecha = "'" . date("Y-m-d H:i:s") . "'"; $valores = "$fecha, $referencia"; // Procesamos los datos foreach ($campos as $key => $value) { diff --git a/src/Objects/Pedido.php b/src/Objects/Pedido.php index cbcca59..a881cb9 100644 --- a/src/Objects/Pedido.php +++ b/src/Objects/Pedido.php @@ -1092,6 +1092,28 @@ class Pedido { exit; } } + + function setOfertaElaborada() { + $resultado = false; + $estado = $this->getValor("estado"); + switch ($estado) { + case 120; + case 140; + case 150: $resultado=true; + break; + + case 110; + case 130: $consulta = "UPDATE pedidos SET estado=140 where oid='".$this->getValor("oid")."'"; + $bd = new BD(); + return $bd->execQuery($consulta); + break; + + default: $resultado=false; + break; + } + + return $resultado; + } } diff --git a/src/addOferta.php b/src/addOferta.php index da7200d..3ccdc0f 100644 --- a/src/addOferta.php +++ b/src/addOferta.php @@ -4,6 +4,7 @@ include("seguridad.php"); include("functions.php"); include_once("Objects/ListaOfertas.php"); include_once("Objects/Oferta.php"); +include_once("Objects/Pedido.php"); include_once("Objects/HTML.php"); $html = new HTML($locale); @@ -45,6 +46,7 @@ if (!empty($_POST)) { } */ if ($_POST['action'] == "add") { + // Comprobamos campos obligatorios if (empty($solicitud)) { $errores[] = "1"; @@ -80,8 +82,17 @@ if (!empty($_POST)) { $msg = "No se ha podido agregar la oferta"; $tipo = "error"; } else { - $oferta = $listaOfertas->buscarOferta($idOferta); - header("Location: oferta.php?idOferta=" . $idOferta . "&msg=1"); + $pedido = new Pedido($solicitud,$usuario); + if ($pedido->setOfertaElaborada()) { + $oferta = $listaOfertas->buscarOferta($idOferta); + header("Location: oferta.php?idOferta=" . $idOferta . "&msg=1"); + } + else { + // Se he producido un fallo al cambiar de estado la solicitud + $errores[] = "0"; + $msg = "Se he producido un fallo al cambiar de estado la solicitud"; + $tipo = "error"; + } } } } @@ -111,7 +122,7 @@ if (in_array("1", $errores)) echo ">" . $locale['1025'] . ":
"; -rellena_desplegable_pedidos_estado("solicitud", "130", array($solicitud)); +rellena_desplegable_pedidos_estado("solicitud", "130, 140", array($solicitud)); echo " "; @@ -130,4 +141,4 @@ echo ''; echo ""; echo ""; include_once("html/pie.php"); -?> \ No newline at end of file +?> diff --git a/src/functions_util.php b/src/functions_util.php index b5cdf9f..fdf74c7 100644 --- a/src/functions_util.php +++ b/src/functions_util.php @@ -160,8 +160,8 @@ function rellena_desplegable_pedidos_estado($nombre, $estado, $seleccionadas) { include LOCALE . LOCALESET . "lenguaje.php"; echo ' @@ -149,17 +190,22 @@ echo $mensaje; ?> - - - getValor("nombre_candidato")); ?> - + - - - getValor("observaciones")); ?> - - - +
+ +
+ + + + + +
+REQUISITOS SOLICITUD + +DETALLES CANDIDATO +
+