* @link http://www.orfeolibre.org * @version SVN: $Id$ * @since */ /* ---------------------------------------------------------+ | INCLUDES | +--------------------------------------------------------- */ /* ---------------------------------------------------------+ | DEFINICIONES | +--------------------------------------------------------- */ session_start(); error_reporting(7); $url_raiz = ".."; $dir_raiz = $_SESSION['dir_raiz']; $ESTILOS_PATH2 = $_SESSION['ESTILOS_PATH2']; /* ---------------------------------------------------------+ | MAIN | +--------------------------------------------------------- */ foreach ($_GET as $key => $valor) ${$key} = $valor; foreach ($_POST as $key => $valor) ${$key} = $valor; $krdOld = $krd; if (!$krd) $krd = $krdOsld; if (!$_SESSION['dependencia']) include "$dir_raiz/rec_session.php"; if (!$carpeta) { $carpeta = $carpetaOld; $tipo_carp = $tipoCarpOld; } $verrad = ""; include_once "$dir_raiz/include/db/ConnectionHandler.php"; $db = new ConnectionHandler($dir_raiz); //$db->conn->debug = true; if (!$tipo_archivo) $tipo_archivo = 0; //Para la consulta a archivados /* * ******************************************************************************* * Filename: formEnvio.php * Modificado 1/3/2006 IIAC * ******************************************************************************* */ // echo '
'; //print_r($_REQUEST); //echo ''; // formEnvio CustomIncludes begin include ("common.php"); // Save Page and File Name available into variables $sFileName = "formEnvio.php"; // Variables de control $pageAnt = strip(get_param("sFileName")); $opcionMenu = get_param("opcionMenu"); //opci�n: prestar(1), cancelar(3) o devolver(2) $ordenar = strip(get_param("ordenar")); //1 si se dio ordenar y 0 de otro modo // Recupera el identificador de los registros seleccionados $cantRegistros = intval(get_param("prestado")); //cantidad de registros listados en la consulta if ($ordenar == "1") { $setFiltroSelect = strip(get_param("s_PRES_ID")); } //Recupera todos los registros presentados si se da ordenar else { //Recupera solo los registros seleccionados $j = 0; $setFiltroSelect = ""; //PRES_ID separados por coma for ($i = 0; $i < $cantRegistros; $i++) { $x = get_param("rta_" . $i); if ($x != "") { if ($j != 0) { $setFiltroSelect .= ","; } $setFiltroSelect .= $x; $j++; } } } // Inicializa la identificaci�n del usuario solicitante $usua_codi = strip(get_param("usua_codi")); $query = "select USUA_LOGIN_ACTU from PRESTAMO where PRES_ID in ($setFiltroSelect)"; //primer usuario de los registros $rs = $db->conn->query($query); if ($rs && !$rs->EOF) { $usua_codi_n = $rs->fields("USUA_LOGIN_ACTU"); } //primer usuario de los registros $cant = 0; //cantidad de registros solicitados por el mismo usuario if ($pageAnt == $sFileName && $ordenar == 0) { $query = "count(PRES_ID) as TOTAL from PRESTAMO where PRES_ID in ($setFiltroSelect) and USUA_LOGIN_ACTU='" . $usua_codi . "'"; $rs = $db->conn->query($query); if ($rs && !$rs->EOF) { $cant = $rs->fields("TOTAL"); } } if ($cant == 0) { $usua_codi = $usua_codi_n; } // Recupera radicado e identificador de los registros seleccionados include("$dir_raiz/include/query/busqueda/busquedaPiloto1.php"); if ($pageAnt == $sFileName && $ordenar == 0) { $query = "select PRES_ID,$radi_nume_radi AS RADI_NUME_RADI from PRESTAMO r where PRES_ID in ($setFiltroSelect) and USUA_LOGIN_ACTU='" . $usua_codi . "'"; } else { $query = "select PRES_ID,$radi_nume_radi AS RADI_NUME_RADI from PRESTAMO r where PRES_ID in ($setFiltroSelect)"; } $rs = $db->conn->query($query); $fldRADICADO = ""; //RADI_NUME_RADI separados por coma $setFiltroSelect = ""; //PRES_ID separados por coma $j = 0; while ($rs && !$rs->EOF) { $x = $rs->fields("RADI_NUME_RADI"); $y = $rs->fields("PRES_ID"); if ($j != 0) { $fldRADICADO .= ","; $setFiltroSelect .= ","; } $setFiltroSelect .= $y; $fldRADICADO .= $x; $j++; $rs->MoveNext(); } // Procesamiento de los registros seleccionados $encabezado = "&krd=" . tourl($krd) . "&s_PRES_ID=" . tourl($setFiltroSelect) . "&dependencia=" . tourl($dependencia) . "&radicado=" . tourl($fldRADICADO) . "&s_PRES_REQUERIMIENTO=&FormAction="; $enviar = 0; if ($opcionMenu == 3) { //cancelar $encabezado .= "delete&"; $enviar = 1; } elseif ($opcionMenu == 1 || $opcionMenu == 2) { //prestamo y devoluci�n // Oculta o hace visible el campo que solicita la contrase�a $verClave = 0; $query = "select PARAM_VALOR from SGD_PARAMETRO where PARAM_NOMB='PRESTAMO_PASW'"; $rs = $db->conn->query($query); if ($rs && !$rs->EOF) { $verClave = $rs->fields("PARAM_VALOR"); } // Inicializa las variables $flds_PRES_ESTADO = strip(get_param("s_PRES_ESTADO")); if ($opcionMenu == 1) { //Pr�stamo if ($flds_PRES_ESTADO == 5) { $encabezado .= "prestamoIndefinido&"; } else { $encabezado .= "prestamo&"; } $titCaj = "Prestar Documento"; // Inicializaci�n de la fecha de vencimiento if ($fechaVencimiento == "") { $query = "select PARAM_VALOR,PARAM_NOMB from SGD_PARAMETRO where PARAM_NOMB='PRESTAMO_DIAS_PREST'"; $rs = $db->conn->query($query); if (!$rs->EOF) { $x = $rs->fields("PARAM_VALOR"); // d�as por defecto $hastaXDias = strtotime("+" . $x . " day"); $fechaVencimiento = date("Y-m-d", $hastaXDias); } } } else { // Devoluci�n $encabezado .= "devolucion&"; $titCaj = "Devolver Documento"; } // Procesa la solicitud if ($pageAnt == $sFileName) { $nover = 0; $observa = strip(get_param("observa")); $encabezado .= "&observa=" . tourl($observa) . "&"; // Validaci�n de la fecha de vencimiento para los prestamos if ($ordenar == 0 && $opcionMenu == 1 && $flds_PRES_ESTADO == 2) { $x = date("Y-m-d"); if ($fechaVencimiento > $x) { $encabezado .= "&fechaVencimiento=" . tourl($fechaVencimiento) . "&"; $enviar = 1; } else { echo ""; $nover = 1; } } // Validaci�n de la contrase�a //$flds_CONTRASENA=strip(get_param("s_CONTRASENA")); $flds_CONTRASENA = $_POST['s_CONTRASENA']; if ($ordenar == 0 && $verClave == 1 && $nover != 1) { $query = "select USUA_CODI from USUARIO where USUA_LOGIN='" . $usua_codi . "' and USUA_PASW='" . SUBSTR(md5($flds_CONTRASENA), 1, 26) . "'"; $rs = $db->conn->query($query); if ($rs && !$rs->EOF) { $enviar = 1; } else { echo ""; $enviar = 0; } } } } if ($enviar == 1) { // Llama la p�gina que hace el procesamiento echo " .. "; echo "
'; // print_r($rsListado->fields); // echo ''; // Build SQL $sSQLsele = " and P.PRES_ID in (" . $setFiltroSelect . ") "; include $dir_raiz . "/include/query/prestamo/builtSQL1.inc"; include $dir_raiz . "/include/query/prestamo/builtSQL3.inc"; // Build ORDER statement $iSort = strip(get_param("FormPedidos_Sorting")); $iSorted = strip(get_param("FormPedidos_Sorted")); $sDirection = strip(get_param("s_Direction")); if ($pageAnt != $sFileName) { if ($iSorted == $iSort && $sDirection = " DESC ") { $sDirection = " ASC "; } else { $sDirection = " DESC "; } } if ($iSorted != $iSort) { $sDirection = " DESC "; } else { if (strcasecmp($sDirection, " DESC ") == 0) { $sDirection = " ASC "; } else { $sDirection = " DESC "; } } $sOrder = " order by " . $iSort . $sDirection . ",PRESTAMO_ID"; $sSQLtot = $sSQL . $sOrder; // Inicializa los campos de la tabla que van a ser vistos include "inicializarRTA.inc"; // HTML column prestamo headers ?>