1 | <?php |
---|
2 | /** |
---|
3 | * Sistema Automatizado para la Planificación Estratégico-Situacional en la Administración Pública Venezolana |
---|
4 | * @file proyecto_operativo_seguimiento.module |
---|
5 | * Drupal part Module to code proyectos operativos module |
---|
6 | * Copyright 2012 Sistema Automatizado para la Planificación Estratégico-Situacional en la Administración Pública Venezolana (CENDITEL) |
---|
7 | * |
---|
8 | * This program is free software; you can redistribute it and/or modify |
---|
9 | * it under the terms of the GNU General Public License as published by |
---|
10 | * the Free Software Foundation; either version 2 of the License, or |
---|
11 | * (at your option) any later version. |
---|
12 | * |
---|
13 | * This program is distributed in the hope that it will be useful, |
---|
14 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
---|
15 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
---|
16 | * GNU General Public License for more details. |
---|
17 | * |
---|
18 | * You should have received a copy of the GNU General Public License |
---|
19 | * along with this program; if not, write to the Free Software |
---|
20 | * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA |
---|
21 | * |
---|
22 | * @author CENDITEL Merida - Ing. Diego Uzcategui |
---|
23 | * @date 2013-02-07 // (anno-mes-dia) |
---|
24 | * @version 0.1 |
---|
25 | * |
---|
26 | */ |
---|
27 | |
---|
28 | function _crear_flujodetrabajo_seguimientoMes() { |
---|
29 | |
---|
30 | //Nombre del Flujo de trabajo, estados y transición de Seguimiento Mes |
---|
31 | $name_wf_po="Seguimiento_Mes"; |
---|
32 | $states_wf_po=array( |
---|
33 | Ingresado, |
---|
34 | Enviado_a_supervisor, |
---|
35 | Enviado_a_control, |
---|
36 | Aprobado, |
---|
37 | Devuelto_a_control, |
---|
38 | Devuelto_a_enlace |
---|
39 | ); |
---|
40 | //Definición de las reglas de trasnsición Seguimiento Mes |
---|
41 | $reglas_transicion_po[t('(creation)')]['Ingresado']['author'] = 1; |
---|
42 | $reglas_transicion_po[t('(creation)')]['Ingresado']['Enlace'] = 1; |
---|
43 | //$reglas_transicion_po['Preingresado']['Anulado']['Enlace'] = 1; |
---|
44 | //$reglas_transicion_po['Preingresado']['Ingresado']['Enlace'] = 1; |
---|
45 | //$reglas_transicion_po['Ingresado']['Anulado']['Enlace'] = 1; |
---|
46 | $reglas_transicion_po['Ingresado']['Enviado_a_supervisor']['Enlace'] = 1; |
---|
47 | $reglas_transicion_po['Enviado_a_supervisor']['Devuelto_a_enlace']['Supervisor'] = 1; |
---|
48 | $reglas_transicion_po['Enviado_a_supervisor']['Enviado_a_control']['Supervisor'] = 1; |
---|
49 | $reglas_transicion_po['Enviado_a_control']['Aprobado']['Control'] = 1; |
---|
50 | $reglas_transicion_po['Enviado_a_control']['Devuelto_a_enlace']['Control'] = 1; //Hacer envio de mensaje a supervisor (notificación) |
---|
51 | $reglas_transicion_po['Aprobado']['Devuelto_a_control']['Administrador'] = 1; //Solo Administrador puede des-aprobar un proyecto operativo |
---|
52 | $reglas_transicion_po['Devuelto_a_control']['Aprobado']['Control'] = 1; |
---|
53 | $reglas_transicion_po['Devuelto_a_control']['Devuelto_a_enlace']['Control'] = 1; |
---|
54 | //$reglas_transicion_po['Devuelto_a_enlace']['Anulado']['Enlace'] = 1; |
---|
55 | $reglas_transicion_po['Devuelto_a_enlace']['Enviado_a_supervisor']['Enlace'] = 1; |
---|
56 | //$reglas_transicion_po['Anulado']['Preingresado']['Administrador'] = 1; |
---|
57 | |
---|
58 | $tab_roles_po=array( |
---|
59 | Administrador, |
---|
60 | Enlace, |
---|
61 | Supervisor, |
---|
62 | Control |
---|
63 | ); |
---|
64 | |
---|
65 | //Creando el Workflow de Proyectos Operativos del proyecto SIPP |
---|
66 | $wid_po=create_workflow_sipp_1($name_wf_po, $states_wf_po); |
---|
67 | //Generando las transiciones del Workflow |
---|
68 | workflow_transition_for_sipp($wid_po,$reglas_transicion_po); |
---|
69 | update_tab_roles_workflow($wid_po, $tab_roles_po); |
---|
70 | |
---|
71 | return TRUE; |
---|
72 | } |
---|
73 | |
---|
74 | function create_workflow_sipp_1($name_wf, $states_wf){ |
---|
75 | $wid = workflow_create($name_wf); |
---|
76 | foreach($states_wf as $i => $value) { |
---|
77 | $state_wf = array('wid' => $wid, 'state' => $value, 'weight' => $i+1); |
---|
78 | $sid = workflow_state_save($state_wf); |
---|
79 | } |
---|
80 | variable_set('ente_planificador_sipp_wf_' . $name_wf, $wid); |
---|
81 | return $wid; |
---|
82 | } |
---|