source: admin/WebConsole/gestores/relaciones/trabajos_eliminacion.php @ 5d05b06

Last change on this file since 5d05b06 was b6ec162, checked in by Ramón M. Gómez <ramongomez@…>, 6 years ago

#834: Remove all redundant PHP closing tags.

  • Property mode set to 100644
File size: 2.2 KB
RevLine 
[043e67d]1<?php
[3ec149c]2// *************************************************************************************************************************************************
3// Aplicación WEB: ogAdmWebCon
4// Autor: José Manuel Alonso (E.T.S.I.I.) Universidad de Sevilla
5// Fecha Creación: Año 2009-2010
6// Fecha Última modificación: Agosto-2010
7// Nombre del fichero: trabajos_eliminacion.php
8// Descripción :
9//      Elimina en cascada registros de la tabla trabajos
10//              Parametros:
11//              -       cmd:Una comando ya operativo (con conexión abierta) 
12//              -       identificador: El identificador por el que se eliminará el trabajo
13//              -       nombreid: Nombre del campo identificador del registro
14//              -       swid: Indica 0= El identificador es tipo alfanumérico   1= EI identificador es tipo numérico ( valor por defecto) *************************************************************************************************************************************************
15function        EliminaTrabajos($cmd,$identificador,$nombreid,$swid=1){
16        global $EJECUCION_TRABAJO;
17        if (empty($identificador)) return(true);
18        if($swid==0)
19                $cmd->texto="SELECT  idtrabajo  FROM  trabajos WHERE ".$nombreid."='".$identificador."'";
20        else
21                $cmd->texto='SELECT  idtrabajo  FROM trabajos WHERE '.$nombreid.'='.$identificador;
22        $rs=new Recordset;
23        $rs->Comando=&$cmd;
24        if (!$rs->Abrir()) return(false); // Error al abrir recordset
25        if ($rs->numeroderegistros==0) return(true);
26        $rs->Primero();
27        while (!$rs->EOF){
28                $cmd->texto="DELETE FROM  acciones_menus WHERE tipoaccion=".$EJECUCION_TRABAJO." AND idtipoaccion=".$rs->campos["idtrabajo"];
29                $resul=$cmd->Ejecutar();
30                if ($resul){
31                        $cmd->texto="DELETE  FROM programaciones WHERE tipoaccion=".$EJECUCION_TRABAJO." AND identificador=".$rs->campos["idtrabajo"];
32                        $resul=$cmd->Ejecutar();
33                        if ($resul){
34                                $cmd->texto="DELETE  FROM trabajos_tareas WHERE idtrabajo=".$rs->campos["idtrabajo"];
35                                $resul=$cmd->Ejecutar();
36                        }
37                }
38                if (!$resul){
39                        $rs->Cerrar();
40                        return(false);
41                }
42                $rs->Siguiente();
43        }
44        if($swid==0)
45                $cmd->texto="DELETE FROM  trabajos WHERE ".$nombreid."='".$identificador."'";
46        else
47                $cmd->texto='DELETE FROM  trabajos  WHERE '.$nombreid.'='.$identificador;
48        $resul=$cmd->Ejecutar();
49        return($resul);
50}
[b6ec162]51
Note: See TracBrowser for help on using the repository browser.