1 |
<?php |
<?php |
2 |
//$Id$ |
/** |
3 |
//gen openMairie le 10/02/2011 20:34 |
* |
4 |
/* |
* |
5 |
$Id: instruction.class.php,v 1.29 2010-10-27 10:52:20 fraynaud Exp $ |
* specific : |
6 |
specific : |
* - cle secondaire |
7 |
- cle secondaire |
* destruction autorisée que pour le dernier evenement |
8 |
destruction autorisée que pour le dernier evenement |
* [delete the last event ] |
9 |
[delete the last event ] |
* - variable globale [global variables] |
10 |
- variable globale [global variables] |
* var $archive_date_depot; |
11 |
var $archive_date_depot; |
* var $retourformulaire; |
12 |
var $retourformulaire; |
* var $idxformulaire; |
13 |
var $idxformulaire; |
* - modification des données dans dossier trigger avant |
14 |
- modification des données dans dossier trigger avant |
* [modify dossier data with trigger function] |
15 |
[modify dossier data with trigger function] |
* - function moisdate : pour ajouter des mois a une date |
16 |
- function moisdate : pour ajouter des mois a une date |
* [add months (delay) and calculation final date] |
17 |
[add months (delay) and calculation final date] |
* - voir script_lang.js : bible ... |
18 |
- voir script_lang.js : bible ... |
* |
19 |
*/ |
* @package openfoncier |
20 |
require_once ("../gen/obj/instruction.class.php"); |
* @version SVN : $Id$ |
21 |
require_once("../services/outgoing/messageenqueuer.php"); |
*/ |
22 |
|
|
23 |
|
// |
24 |
|
require_once "../gen/obj/instruction.class.php"; |
25 |
|
|
26 |
|
// |
27 |
|
require_once "../services/outgoing/messageenqueuer.php"; |
28 |
|
|
29 |
|
// |
30 |
class instruction extends instruction_gen { |
class instruction extends instruction_gen { |
31 |
|
|
32 |
var $archive_date_depot; // specific |
var $archive_date_depot; // specific |
33 |
var $retourformulaire; // specific |
var $retourformulaire; // specific |
34 |
var $idxformulaire; // specific |
var $idxformulaire; // specific |
35 |
|
var $valEvenement; |
36 |
|
|
37 |
function instruction($id,&$db,$debug) { |
function instruction($id, &$db, $debug) { |
38 |
$this->constructeur($id,$db,$debug); |
$this->constructeur($id, $db, $debug); |
39 |
}// fin constructeur |
} |
40 |
|
|
41 |
// {{{ Gestion de la confidentialité des données spécifiques |
// {{{ Gestion de la confidentialité des données spécifiques |
42 |
|
|
46 |
function checkAccessibility() { |
function checkAccessibility() { |
47 |
// |
// |
48 |
parent::checkAccessibility(); |
parent::checkAccessibility(); |
49 |
// Si l'utilisateur est un intructeur qui en correspond pas à la |
// Si l'utilisateur est un intructeur qui ne correspond pas à la |
50 |
// division du dossier |
// division du dossier |
51 |
if ($this->f->isUserInstructeur() |
if ($this->f->isUserInstructeur() |
52 |
&& isset($this->f->om_utilisateur["division"]) |
&& isset($this->f->om_utilisateur["division"]) |
62 |
&& $this->val[array_search("lu", $this->champs)]== "t") { |
&& $this->val[array_search("lu", $this->champs)]== "t") { |
63 |
unset($this->actions_sup["lu"]); |
unset($this->actions_sup["lu"]); |
64 |
} |
} |
65 |
|
|
66 |
|
//Si le document est déjà finalisé, on affiche uniquement le lien de |
67 |
|
//dé-finalisation |
68 |
|
if ( isset($this->actions_sup["finalisation"]) && |
69 |
|
isset($this->val[array_search("om_final_instruction", $this->champs)]) |
70 |
|
&& $this->val[array_search("om_final_instruction", $this->champs)]== "t" ){ |
71 |
|
unset($this->actions_sup["finalisation"]); |
72 |
|
} |
73 |
|
//Si le document n'est pas finalisé, on affiche uniquement le lien de |
74 |
|
//finalisation |
75 |
|
if ( isset($this->actions_sup["definalisation"]) && |
76 |
|
isset($this->val[array_search("om_final_instruction", $this->champs)]) |
77 |
|
&& $this->val[array_search("om_final_instruction", $this->champs)]!= "t" ){ |
78 |
|
unset($this->actions_sup["definalisation"]); |
79 |
|
} |
80 |
} |
} |
81 |
|
|
82 |
/** |
/** |
90 |
&& $this->f->om_utilisateur["division"] != $this->getDivisionFromDossier() |
&& $this->f->om_utilisateur["division"] != $this->getDivisionFromDossier() |
91 |
&& $this->getParameter("maj") != 3) { |
&& $this->getParameter("maj") != 3) { |
92 |
// |
// |
93 |
|
$this->addToLog("canAccess(): utilisateur instructeur sur un dossier d'une autre division", EXTRA_VERBOSE_MODE); |
94 |
return false; |
return false; |
95 |
} |
} |
96 |
// |
// |
98 |
} |
} |
99 |
|
|
100 |
/** |
/** |
101 |
* Cette méthode permet de récupérer la division d'un dossier |
* Cette variable permet de stocker le résultat de la méthode |
102 |
|
* getDivisionFromDossier() afin de ne pas effectuer le recalcul à chacun de |
103 |
|
* ces appels. |
104 |
|
* @var string Code de la division du dossier en cours |
105 |
|
*/ |
106 |
|
var $_division_from_dossier = NULL; |
107 |
|
|
108 |
|
/** |
109 |
|
* Cette méthode permet de récupérer le code de division correspondant |
110 |
|
* au dossier sur lequel on se trouve. |
111 |
|
* |
112 |
|
* @return string Code de la division du dossier en cours |
113 |
*/ |
*/ |
114 |
function getDivisionFromDossier() { |
function getDivisionFromDossier() { |
115 |
|
|
116 |
|
// Cette méthode peut être appelée plusieurs fois lors d'une requête. |
117 |
|
// Pour éviter de refaire le traitement de recherche de la division |
118 |
|
// alors on vérifie si nous ne l'avons pas déjà calculé. |
119 |
|
if ($this->_division_from_dossier != NULL) { |
120 |
|
// Logger |
121 |
|
$this->addToLog("getDivisionFromDossier(): retour de la valeur déjà calculée - '".$this->_division_from_dossier."'", EXTRA_VERBOSE_MODE); |
122 |
|
// On retourne la valeur déjà calculée |
123 |
|
return $this->_division_from_dossier; |
124 |
|
} |
125 |
|
|
126 |
|
// Par défaut, on définit la valeur du dossier à NULL |
127 |
|
$dossier = NULL; |
128 |
|
// Test sur le mode et le contexte du formulaire |
129 |
|
if ($this->getParameter("maj") == 0 |
130 |
|
&& ($this->getParameter("retourformulaire") == "dossier" |
131 |
|
|| $this->getParameter("retourformulaire") == "dossier_instruction" |
132 |
|
|| $this->getParameter("retourformulaire") == "dossier_instruction_mes_encours" |
133 |
|
|| $this->getParameter("retourformulaire") == "dossier_instruction_tous_encours" |
134 |
|
|| $this->getParameter("retourformulaire") == "dossier_instruction_mes_clotures" |
135 |
|
|| $this->getParameter("retourformulaire") == "dossier_instruction_tous_clotures")) { |
136 |
|
// Si on se trouve en mode AJOUT (seul mode où l'enregistrement |
137 |
|
// n'existe pas en base de données) ET que nous nous trouvons |
138 |
|
// dans le contexte d'un dossier d'instruction alors on récupère |
139 |
|
// le numéro de dossier depuis le paramètre 'idxformulaire' |
140 |
|
$dossier = $this->getParameter("idxformulaire"); |
141 |
|
} else { |
142 |
|
// Sinon on récupère le numéro de dossier dans le champs dossier de |
143 |
|
// l'enregistrement (en base de données) |
144 |
|
$dossier = $this->getVal("dossier"); |
145 |
|
} |
146 |
|
|
147 |
|
// On appelle la méthode de la classe utils qui renvoi le code de la |
148 |
|
// division d'un dossier, on la stocke pour ne pas refaire le calcul au |
149 |
|
// prochain appel de cette méthode |
150 |
|
$this->_division_from_dossier = $this->f->getDivisionFromDossier($dossier); |
151 |
|
// Logger |
152 |
|
$this->addToLog("getDivisionFromDossier(): retour de la valeur nouvellement calculée - '".$this->_division_from_dossier."'", EXTRA_VERBOSE_MODE); |
153 |
|
// On retourne la valeur retournée |
154 |
|
return $this->_division_from_dossier; |
155 |
|
|
156 |
|
} |
157 |
|
|
158 |
|
/** |
159 |
|
* Cette méthode permet de récupérer le dossier d'autorisation d'un dossier |
160 |
|
*/ |
161 |
|
function getDossierAutorisationFromDossier($id) { |
162 |
// |
// |
163 |
if (!isset($this->val[array_search("dossier", $this->champs)])) { |
if (!isset($id)) { |
164 |
return NULL; |
return NULL; |
165 |
} |
} |
166 |
// |
// |
167 |
$sql = "select division from ".DB_PREFIXE."dossier "; |
$sql = "select dossier_autorisation from ".DB_PREFIXE."dossier "; |
168 |
$sql .= " where dossier='".$this->val[array_search("dossier", $this->champs)]."'"; |
$sql .= " where dossier='".$id."'"; |
169 |
// |
// |
170 |
$division = $this->db->getOne($sql); |
$dossier_autorisation = $this->db->getOne($sql); |
171 |
$this->addToLog("getDivisionFromDossier(): db->getone(\"".$sql."\")", VERBOSE_MODE); |
$this->addToLog("getDossierAutorisationFromDossier(): db->getone(\"".$sql."\")", VERBOSE_MODE); |
172 |
database::isError($division); |
database::isError($dossier_autorisation); |
173 |
// |
// |
174 |
return $division; |
return $dossier_autorisation; |
175 |
} |
} |
176 |
|
|
177 |
// }}} |
// }}} |
178 |
|
|
179 |
function cleSecondaire($id,&$db,$val,$DEBUG) { |
function setType(&$form, $maj) { |
180 |
parent::cleSecondaire($id,$db,$val,$DEBUG); |
// |
181 |
// controle suppression cle secondaire [secondary key delete control] |
parent::setType($form, $maj); |
182 |
// ------------------------------------------------------------------------------------ |
// On cache tous les champs |
183 |
// specifique detruire que le dernier [specific instruction : delete the last event ] |
// XXX |
|
// ------------------------------------------------------------------------------------ |
|
|
$dernierevenement=''; |
|
|
$sql="select max(instruction) from ".DB_PREFIXE."instruction where dossier ='". |
|
|
$this->idxformulaire."'"; |
|
|
$dernierevenement = $db->getOne($sql); |
|
|
if($dernierevenement==$id){ |
|
|
$this->correct=true; |
|
|
$this->addToMessage(_('Destruction_chronologique')); |
|
|
}else{ |
|
|
$this->addToMessage(_('Destruction_evenement')." : ".$dernierevenement); |
|
|
$this->addToMessage(_('Destruction_chronologique')); |
|
|
$this->correct=false; |
|
|
} |
|
|
} |
|
|
|
|
|
// Sélectionne le signataire_arrete par défaut |
|
|
function setVal(&$form,$maj,$validation){ |
|
|
|
|
|
// Ajout |
|
|
if($maj == 0) { |
|
|
|
|
|
// Création de la requête |
|
|
$sql = "SELECT signataire_arrete |
|
|
FROM ".DB_PREFIXE."signataire_arrete |
|
|
WHERE defaut IS TRUE"; |
|
|
|
|
|
// Exécution de la requête |
|
|
$this->f->addToLog("deleteAllLienDossierInstructionTypeEvenementEvenement(): db->query(\"".$sql."\");", VERBOSE_MODE); |
|
|
$res = $this->f->db->query($sql); |
|
|
$this->f->isDatabaseError(); |
|
|
|
|
|
$row = $res->fetchrow(DB_FETCHMODE_ASSOC); |
|
|
|
|
|
if ( isset($row['signataire_arrete']) && is_numeric($row['signataire_arrete'])){ |
|
|
|
|
|
$form->setVal("signataire_arrete",$row['signataire_arrete']); |
|
|
} |
|
|
} |
|
|
} |
|
|
|
|
|
/*Met des valeurs par défaut dans certains des sous-formulaire*/ |
|
|
function setValsousformulaire(&$form,$maj,$validation,$idxformulaire,$retourformulaire,$typeformulaire){ |
|
|
if ($validation==0 and $maj<2) { |
|
|
if ($maj == 0){ |
|
|
$form->setVal("destinataire", $idxformulaire); |
|
|
$form->setVal("dossier", $idxformulaire); |
|
|
$form->setVal("date_evenement", date('Y-m-d')); |
|
|
} |
|
|
$form->setVal("bible_auto","bible_auto()"); |
|
|
$form->setVal("bible","bible()"); |
|
|
$form->setVal("bible2","bible2()"); |
|
|
} |
|
|
$this->retourformulaire=$retourformulaire; |
|
|
$this->idxformulaire=$idxformulaire; |
|
|
} |
|
|
|
|
|
/*Affecte un type à certains champs*/ |
|
|
function setType(&$form,$maj) { |
|
|
parent::setType($form,$maj); |
|
|
if ($maj < 2) { //ajouter et modifier |
|
|
$form->setType('destinataire', 'hidden'); |
|
|
$form->setType('lettretype', 'hiddenstatic'); |
|
|
$form->setType('complement', 'textarea'); |
|
|
$form->setType('complement2', 'textarea'); |
|
|
$form->setType('bible_auto', 'httpclick'); |
|
|
$form->setType('bible', 'httpclick'); |
|
|
$form->setType('bible2', 'httpclick'); |
|
|
$form->setType('dossier', 'hidden'); |
|
|
$form->setType('libelle', 'hiddenstatic'); |
|
|
$form->setType('signataire_arrete','select'); |
|
|
if($maj==0){ // add |
|
|
$form->setType('instruction', 'hiddenstatic'); |
|
|
$form->setType('evenement', 'select'); |
|
|
$form->setType('date_evenement', 'date2'); |
|
|
}else{ // modify |
|
|
$form->setType('instruction', 'hiddenstatic'); |
|
|
$form->setType('evenement', 'hiddenstatic'); |
|
|
//$form->setType('date_evenement', 'hiddenstaticdate'); |
|
|
$form->setType('date_evenement', 'date2'); |
|
|
// necessaire pour calcul de date en modification |
|
|
$form->setType('delai', 'hiddenstatic'); |
|
|
} |
|
|
} elseif($maj==2){ |
|
|
$form->setType('dossier', 'hidden'); |
|
|
$form->setType('bible_auto', 'hidden'); |
|
|
$form->setType('bible', 'hidden'); |
|
|
$form->setType('bible2', 'hidden'); |
|
|
}else { |
|
|
$form->setType('destinataire', 'hidden'); |
|
|
$form->setType('dossier', 'hidden'); |
|
|
$form->setType('bible_auto', 'hidden'); |
|
|
$form->setType('bible', 'hidden'); |
|
|
$form->setType('bible2', 'hidden'); |
|
|
} |
|
184 |
$form->setType('complement3', 'hidden'); |
$form->setType('complement3', 'hidden'); |
185 |
$form->setType('bible3', 'hidden'); |
$form->setType('bible3', 'hidden'); |
186 |
$form->setType('complement4', 'hidden'); |
$form->setType('complement4', 'hidden'); |
207 |
$form->setType('bible14', 'hidden'); |
$form->setType('bible14', 'hidden'); |
208 |
$form->setType('complement15', 'hidden'); |
$form->setType('complement15', 'hidden'); |
209 |
$form->setType('bible15', 'hidden'); |
$form->setType('bible15', 'hidden'); |
210 |
|
// |
211 |
$form->setType('delai', 'hidden'); |
$form->setType('delai', 'hidden'); |
212 |
$form->setType('etat', 'hidden'); |
$form->setType('etat', 'hidden'); |
213 |
$form->setType('accord_tacite', 'hidden'); |
$form->setType('accord_tacite', 'hidden'); |
214 |
$form->setType('action', 'hidden'); |
$form->setType('action', 'hidden'); |
215 |
$form->setType('delai_notification', 'hidden'); |
$form->setType('delai_notification', 'hidden'); |
216 |
$form->setType('avis_decision', 'hidden'); |
$form->setType('avis_decision', 'hidden'); |
217 |
|
// |
218 |
$form->setType('archive_delai', 'hidden'); |
$form->setType('archive_delai', 'hidden'); |
219 |
$form->setType('archive_etat', 'hidden'); |
$form->setType('archive_etat', 'hidden'); |
220 |
$form->setType('archive_accord_tacite', 'hidden'); |
$form->setType('archive_accord_tacite', 'hidden'); |
221 |
$form->setType('archive_avis', 'hidden'); |
$form->setType('archive_avis', 'hidden'); |
222 |
$form->setType('archive_date_complet', 'hidden'); |
$form->setType('archive_date_complet', 'hidden'); |
223 |
|
$form->setType('archive_date_dernier_depot', 'hidden'); |
224 |
$form->setType('archive_date_rejet', 'hidden'); |
$form->setType('archive_date_rejet', 'hidden'); |
225 |
$form->setType('archive_date_limite', 'hidden'); |
$form->setType('archive_date_limite', 'hidden'); |
226 |
$form->setType('archive_date_notification_delai', 'hidden'); |
$form->setType('archive_date_notification_delai', 'hidden'); |
229 |
$form->setType('archive_date_achevement', 'hidden'); |
$form->setType('archive_date_achevement', 'hidden'); |
230 |
$form->setType('archive_date_conformite', 'hidden'); |
$form->setType('archive_date_conformite', 'hidden'); |
231 |
$form->setType('archive_date_chantier', 'hidden'); |
$form->setType('archive_date_chantier', 'hidden'); |
232 |
|
// |
233 |
$form->setType('numero_arrete', 'hidden'); |
$form->setType('numero_arrete', 'hidden'); |
234 |
|
// |
235 |
|
$form->setType('code_barres', 'hidden'); |
236 |
|
|
237 |
|
// |
238 |
|
$form->setType('archive_incompletude','hidden'); |
239 |
|
$form->setType('archive_evenement_suivant_tacite','hidden'); |
240 |
|
$form->setType('archive_evenement_suivant_tacite_incompletude','hidden'); |
241 |
|
$form->setType('archive_etat_pendant_incompletude','hidden'); |
242 |
|
$form->setType('archive_date_limite_incompletude','hidden'); |
243 |
|
$form->setType('archive_delai_incompletude','hidden'); |
244 |
|
if ($maj < 2) { //ajouter et modifier |
245 |
|
$form->setType('destinataire', 'hidden'); |
246 |
|
$form->setType('lettretype', 'hiddenstatic'); |
247 |
|
$form->setType('complement', 'textarea'); |
248 |
|
$form->setType('complement2', 'textarea'); |
249 |
|
$form->setType('bible_auto', 'httpclick'); |
250 |
|
$form->setType('bible', 'httpclick'); |
251 |
|
$form->setType('bible2', 'httpclick'); |
252 |
|
$form->setType('dossier', 'hidden'); |
253 |
|
$form->setType('libelle', 'hiddenstatic'); |
254 |
|
$form->setType('signataire_arrete','select'); |
255 |
|
$form->setType('date_envoi_signature','datedisabled'); |
256 |
|
$form->setType('date_retour_signature','datedisabled'); |
257 |
|
$form->setType('date_envoi_rar','datedisabled'); |
258 |
|
$form->setType('date_retour_rar','datedisabled'); |
259 |
|
$form->setType('date_envoi_controle_legalite','datedisabled'); |
260 |
|
$form->setType('date_retour_controle_legalite','datedisabled'); |
261 |
|
if($maj==0){ // add |
262 |
|
$form->setType('instruction', 'hiddenstatic'); |
263 |
|
$form->setType('evenement', 'select'); |
264 |
|
$form->setType('date_evenement', 'date2'); |
265 |
|
}else{ // modify |
266 |
|
$form->setType('instruction', 'hiddenstatic'); |
267 |
|
$form->setType('evenement', 'selecthiddenstatic'); |
268 |
|
//$form->setType('date_evenement', 'hiddenstaticdate'); |
269 |
|
$form->setType('date_evenement', 'date2'); |
270 |
|
// necessaire pour calcul de date en modification |
271 |
|
//$form->setType('delai', 'hiddenstatic'); |
272 |
|
} |
273 |
|
} elseif($maj==2){ |
274 |
|
$form->setType('dossier', 'hidden'); |
275 |
|
$form->setType('bible_auto', 'hidden'); |
276 |
|
$form->setType('bible', 'hidden'); |
277 |
|
$form->setType('bible2', 'hidden'); |
278 |
|
}else { |
279 |
|
$form->setType('destinataire', 'hidden'); |
280 |
|
$form->setType('dossier', 'hidden'); |
281 |
|
$form->setType('bible_auto', 'hidden'); |
282 |
|
$form->setType('bible', 'hidden'); |
283 |
|
$form->setType('bible2', 'hidden'); |
284 |
|
} |
285 |
|
|
286 |
|
//Cache les champs pour la finalisation |
287 |
|
$form->setType('om_fichier_instruction', 'hidden'); |
288 |
|
$form->setType('om_final_instruction', 'hidden'); |
289 |
} |
} |
290 |
|
|
291 |
/*Met des valeurs choisies dans certains select du formulaire*/ |
function setSelect(&$form, $maj,&$db,$debug) { |
292 |
function setSelect(&$form, $maj,&$db,$DEBUG) { |
/** |
293 |
|
* On ne surcharge pas la méthode parent car une requête sur la table |
294 |
|
* dossier est mauvaise pour les performances, car la requête qui |
295 |
|
* concerne evenement est plus complexe que celle générée et car les |
296 |
|
* champs action, avis_decision et etat ne sont pas utilisés comme des |
297 |
|
* select |
298 |
|
*/ |
299 |
if(file_exists ("../sql/".$db->phptype."/".$this->table.".form.inc.php")) |
if(file_exists ("../sql/".$db->phptype."/".$this->table.".form.inc.php")) |
300 |
include ("../sql/".$db->phptype."/".$this->table.".form.inc.php"); |
include ("../sql/".$db->phptype."/".$this->table.".form.inc.php"); |
301 |
|
elseif(file_exists ("../sql/".$db->phptype."/".$this->table.".form.inc")) |
302 |
|
include ("../sql/".$db->phptype."/".$this->table.".form.inc"); |
303 |
|
|
304 |
parent::setSelect($form, $maj, $db, $DEBUG); |
//// action |
305 |
|
//$this->init_select($form, $db, $maj, $debug, "action", |
306 |
// *** evenement *** |
// $sql_action, $sql_action_by_id, false); |
307 |
$contenu=array(); |
|
308 |
// etat du dossier |
//// avis_decision |
309 |
$sql="select etat from ".DB_PREFIXE."dossier where dossier ='". |
//$this->init_select($form, $db, $maj, $debug, "avis_decision", |
310 |
$this->idxformulaire."'"; |
// $sql_avis_decision, $sql_avis_decision_by_id, false); |
311 |
$etat_dossier = $db->getOne($sql); |
|
312 |
// nature du dossier d'autorisation |
//// dossier |
313 |
$sql="select code from ".DB_PREFIXE."dossier |
//$this->init_select($form, $db, $maj, $debug, "dossier", |
314 |
INNER JOIN ".DB_PREFIXE."dossier_autorisation ON |
// $sql_dossier, $sql_dossier_by_id, false); |
315 |
dossier.dossier_autorisation = dossier_autorisation.dossier_autorisation |
|
316 |
INNER JOIN ".DB_PREFIXE."dossier_autorisation_type_detaille ON |
//// etat |
317 |
dossier_autorisation.dossier_autorisation_type_detaille = |
//$this->init_select($form, $db, $maj, $debug, "etat", |
318 |
dossier_autorisation_type_detaille.dossier_autorisation_type_detaille |
// $sql_etat, $sql_etat_by_id, false); |
319 |
WHERE dossier ='". |
|
320 |
$this->idxformulaire."'"; |
//// evenement |
321 |
$nature_dossier = $db->getOne($sql); |
//$this->init_select($form, $db, $maj, $debug, "evenement", |
322 |
|
// $sql_evenement, $sql_evenement_by_id, false); |
323 |
// recherche des evenement de transition |
|
324 |
// XXX modifier la requète après la modification de structure du workflow |
// signataire_arrete |
325 |
$sql= $sql_transition." where transition.etat ='".$etat_dossier."' and dossier='". |
$this->init_select($form, $db, $maj, $debug, "signataire_arrete", |
326 |
$this->idxformulaire."' order by evenement.action"; |
$sql_signataire_arrete, $sql_signataire_arrete_by_id, true); |
327 |
|
|
328 |
// *** attention en dur le CU |
/** |
329 |
$this->addToLog("setSelect(): db->query(\"".$sql."\");", VERBOSE_MODE); |
* Gestion du filtre sur les événements de workflow disponibles |
330 |
|
* On récupère ici en fonction de l'état du dossier d'instruction en |
331 |
|
* cours et du type du dossier d'instruction en cours la liste |
332 |
|
* événements disponibles. |
333 |
|
*/ |
334 |
|
if ($maj == 0) { |
335 |
|
// Récupération des événements par une jointure entre la table dossier |
336 |
|
// et la table transition et la table evenement et la table |
337 |
|
// lien_dossier_instruction_type_evenement en fonction de l'identifiant |
338 |
|
// du dossier d'instruction en cours |
339 |
|
$sql = "SELECT |
340 |
|
evenement.evenement, |
341 |
|
(evenement.libelle||' ['||evenement.action||']') as lib |
342 |
|
FROM ".DB_PREFIXE."dossier |
343 |
|
INNER JOIN ".DB_PREFIXE."lien_dossier_instruction_type_evenement |
344 |
|
ON dossier.dossier_instruction_type=lien_dossier_instruction_type_evenement.dossier_instruction_type |
345 |
|
INNER JOIN ".DB_PREFIXE."evenement |
346 |
|
ON evenement.evenement=lien_dossier_instruction_type_evenement.evenement |
347 |
|
INNER JOIN ".DB_PREFIXE."transition |
348 |
|
ON evenement.evenement = transition.evenement |
349 |
|
AND dossier.etat=transition.etat |
350 |
|
WHERE dossier.dossier='".$this->idxformulaire."' |
351 |
|
ORDER BY evenement.action"; |
352 |
|
$res = $db->query($sql); |
353 |
|
$this->addToLog("setSelect(): db->query(\"".$sql."\");", VERBOSE_MODE); |
354 |
|
if (database::isError($res)) { |
355 |
|
die($res->getMessage()); |
356 |
|
} |
357 |
|
// Remplissage du tableau du select |
358 |
|
$contenu = array( |
359 |
|
0 => array("",), |
360 |
|
1 => array(_('choisir')." "._('evenement'),) |
361 |
|
); |
362 |
|
while ($row=& $res->fetchRow()) { |
363 |
|
$contenu[0][] = $row[0]; |
364 |
|
$contenu[1][] = $row[1]; |
365 |
|
} |
366 |
|
$form->setSelect("evenement", $contenu); |
367 |
|
} else { |
368 |
|
$sql = "SELECT |
369 |
|
(evenement.libelle||' ['||evenement.action||']') as lib |
370 |
|
FROM ".DB_PREFIXE."evenement |
371 |
|
WHERE evenement.evenement=".$this->getVal("evenement").""; |
372 |
|
$res = $db->getone($sql); |
373 |
|
$this->addToLog("setSelect(): db->getone(\"".$sql."\");", VERBOSE_MODE); |
374 |
|
if (database::isError($res)) { |
375 |
|
die($res->getMessage()); |
376 |
|
} |
377 |
|
// |
378 |
|
$contenu = array( |
379 |
|
0 => array($this->getVal("evenement"),), |
380 |
|
1 => array($res,) |
381 |
|
); |
382 |
|
$form->setSelect("evenement", $contenu); |
383 |
|
} |
384 |
|
|
385 |
$res = $db->query($sql); |
/** |
386 |
if (database::isError($res)) |
* Gesion des liens vers la bible |
387 |
die($res->getMessage()); |
*/ |
388 |
$contenu[0][0]=""; |
// lien bible_auto |
389 |
$contenu[1][0]=_('choisir')." "._('evenement'); |
$contenu = array(_("automatique")); |
|
$k=1; |
|
|
while ($row=& $res->fetchRow()){ |
|
|
if($maj==0){ // ajouter |
|
|
$contenu[0][$k]=$row[0]; |
|
|
$contenu[1][$k]=$row[1]; |
|
|
$k++; |
|
|
}else{ |
|
|
// select hiddenstatic |
|
|
$contenu[0][$k]=$row[0]; |
|
|
$contenu[1][$k]=$row[1]; |
|
|
$k++; |
|
|
} |
|
|
} |
|
|
$form->setSelect("evenement",$contenu); |
|
|
// lien bible_auto [link] |
|
|
$contenu=array(); |
|
|
$contenu[0]=" automatique "; |
|
390 |
$form->setSelect("bible_auto",$contenu); |
$form->setSelect("bible_auto",$contenu); |
391 |
// lien bible1 |
// lien bible1 |
392 |
$contenu=array(); |
$contenu = array(_("bible")); |
|
$contenu[0]=" Bible "; |
|
393 |
$form->setSelect("bible",$contenu); |
$form->setSelect("bible",$contenu); |
394 |
// lien bible2 |
// lien bible2 |
395 |
$contenu=array(); |
$contenu = array(_("bible")); |
|
$contenu[0]=" Bible "; |
|
396 |
$form->setSelect("bible2",$contenu); |
$form->setSelect("bible2",$contenu); |
397 |
} // function select |
} |
398 |
|
|
399 |
|
function cleSecondaire($id, &$db, $val, $DEBUG) { |
400 |
|
// |
401 |
|
parent::cleSecondaire($id, $db, $val, $DEBUG); |
402 |
|
|
403 |
|
/** |
404 |
|
* Vérification que l'élément supprimé est le dernier pour pouvoir |
405 |
|
* remodifier les données de manière itérative. |
406 |
|
*/ |
407 |
|
// Initialisation |
408 |
|
$dernierevenement = ""; |
409 |
|
// Récupération du dernier élément de la table d'instruction qui |
410 |
|
// concerne le dossier en cours |
411 |
|
$sql = "SELECT max(instruction) |
412 |
|
FROM ".DB_PREFIXE."instruction |
413 |
|
WHERE dossier ='".$this->idxformulaire."'"; |
414 |
|
$dernierevenement = $db->getOne($sql); |
415 |
|
$this->addToLog("setSelect(): db->getone(\"".$sql."\");", VERBOSE_MODE); |
416 |
|
if (database::isError($dernierevenement)) { |
417 |
|
die($dernierevenement->getMessage()); |
418 |
|
} |
419 |
|
// Si on se trouve effectivement sur le dernier evenement d'instruction |
420 |
|
if ($dernierevenement == $id) { |
421 |
|
// Alors on valide la suppression |
422 |
|
$this->correct = true; |
423 |
|
$this->addToMessage(_('Destruction_chronologique')); |
424 |
|
} else { |
425 |
|
// Alors on annule la suppression |
426 |
|
$this->correct = false; |
427 |
|
$this->addToMessage(_("Seul le dernier evenement d'instruction peut etre supprime.")); |
428 |
|
} |
429 |
|
} |
430 |
|
|
431 |
|
// Vérification de la non modification des dates de suivi |
432 |
|
function updateDate($champ) { |
433 |
|
if($this->valF[$champ] != "") { |
434 |
|
if($this->getVal($champ) != "" AND $this->getVal($champ) != $this->valF[$champ]) { |
435 |
|
$this->correct = false; |
436 |
|
$this->addToMessage(_("Les dates de suivis ne peuvent etre modifiees")); |
437 |
|
} |
438 |
|
} |
439 |
|
} |
440 |
|
|
441 |
|
// Sélectionne le signataire_arrete par défaut |
442 |
|
function setVal(&$form,$maj,$validation){ |
443 |
|
|
444 |
|
// Ajout |
445 |
|
if($maj == 0) { |
446 |
|
|
447 |
|
// Création de la requête |
448 |
|
$sql = "SELECT signataire_arrete |
449 |
|
FROM ".DB_PREFIXE."signataire_arrete |
450 |
|
WHERE defaut IS TRUE"; |
451 |
|
|
452 |
|
// Exécution de la requête |
453 |
|
$res = $this->f->db->query($sql); |
454 |
|
$this->f->addToLog("deleteAllLienDossierInstructionTypeEvenementEvenement(): db->query(\"".$sql."\");", VERBOSE_MODE); |
455 |
|
if ( database::isError($res)){ |
456 |
|
die(); |
457 |
|
} |
458 |
|
|
459 |
|
$row = $res->fetchrow(DB_FETCHMODE_ASSOC); |
460 |
|
|
461 |
|
if ( isset($row['signataire_arrete']) && is_numeric($row['signataire_arrete'])){ |
462 |
|
|
463 |
|
$form->setVal("signataire_arrete",$row['signataire_arrete']); |
464 |
|
} |
465 |
|
} |
466 |
|
} |
467 |
|
|
468 |
|
/*Met des valeurs par défaut dans certains des sous-formulaire*/ |
469 |
|
function setValsousformulaire(&$form,$maj,$validation,$idxformulaire,$retourformulaire,$typeformulaire){ |
470 |
|
if ($validation==0 and $maj<2) { |
471 |
|
if ($maj == 0){ |
472 |
|
$form->setVal("destinataire", $idxformulaire); |
473 |
|
$form->setVal("dossier", $idxformulaire); |
474 |
|
$form->setVal("date_evenement", date('Y-m-d')); |
475 |
|
} |
476 |
|
$form->setVal("bible_auto","bible_auto()"); |
477 |
|
$form->setVal("bible","bible()"); |
478 |
|
$form->setVal("bible2","bible2()"); |
479 |
|
} |
480 |
|
$this->retourformulaire=$retourformulaire; |
481 |
|
$this->idxformulaire=$idxformulaire; |
482 |
|
} |
483 |
|
|
484 |
|
|
485 |
function setLayout(&$form, $maj){ |
function setLayout(&$form, $maj){ |
486 |
if ( $maj < 2 OR $maj == 3 ) { |
if ( $maj < 2 OR $maj == 3 ) { |
488 |
$form->setBloc('evenement','D',"","col_12"); |
$form->setBloc('evenement','D',"","col_12"); |
489 |
|
|
490 |
$form->setFieldset('evenement','D',_('Evenement')); |
$form->setFieldset('evenement','D',_('Evenement')); |
|
$form->setBloc('evenement','D',"","group col_12"); |
|
|
$form->setBloc('date_evenement','F'); |
|
491 |
$form->setFieldset('lettretype','F',''); |
$form->setFieldset('lettretype','F',''); |
492 |
|
|
493 |
$form->setBloc('lettretype','F'); |
$form->setBloc('lettretype','F'); |
516 |
} |
} |
517 |
} |
} |
518 |
|
|
519 |
/*Change le libellé de certains champs*/ |
function setLib(&$form, $maj) { |
520 |
function setLib(&$form,$maj) { |
// |
521 |
parent :: setLib($form,$maj); |
parent::setLib($form, $maj); |
522 |
$form->setLib('libelle',' '); |
// |
523 |
$form->setLib('bible_auto',""); |
$form->setLib('bible_auto', ""); |
524 |
$form->setLib('bible',""); |
$form->setLib('bible', ""); |
525 |
$form->setLib('bible2',""); |
$form->setLib('bible2', ""); |
526 |
} |
} |
527 |
|
|
528 |
// ================================================================== |
function triggerajouter($id, &$db, $val, $DEBUG) { |
529 |
// trigger avant modification des données [trigger before modify data] |
/** |
530 |
// ================================================================== |
* Le code suivant permet de récupérer des valeurs des tables evenement |
531 |
function triggerajouter($id,&$db,$val,$DEBUG) { |
* et dossier pour les stocker dans l'instruction : |
532 |
// mise a jour instruction avec evenement |
* DEPUIS L'EVENEMENT |
533 |
// [modify instruction with evenement] |
* - action |
534 |
$sql= "select * from ".DB_PREFIXE."evenement where evenement =".$this->valF['evenement']; |
* - delai |
535 |
|
* - accord_tacite |
536 |
|
* - etat |
537 |
|
* - avis_decision |
538 |
|
* - delai_notification |
539 |
|
* - lettretype |
540 |
|
* DEPUIS LE DOSSIER D'INSTRUCTION |
541 |
|
* - archive_delai |
542 |
|
* - archive_accord_tacite |
543 |
|
* - archive_etat |
544 |
|
* - archive_avis |
545 |
|
* - date_complet |
546 |
|
* - date_rejet |
547 |
|
* - date_limite |
548 |
|
* - date_notification_delai |
549 |
|
* - date_decision |
550 |
|
* - date_validite |
551 |
|
* - date_achevement |
552 |
|
* - date_chantier |
553 |
|
* - date_conformite |
554 |
|
* Il permet également de stocker la date_depot du dossier d'instruction |
555 |
|
* dans l'attribut $this->archive_date_depot de la classe. |
556 |
|
*/ |
557 |
|
// Récupération de tous les paramètres de l'événement sélectionné |
558 |
|
$sql = "SELECT * FROM ".DB_PREFIXE."evenement |
559 |
|
WHERE evenement=".$this->valF['evenement']; |
560 |
$res = $db->query($sql); |
$res = $db->query($sql); |
561 |
if (database::isError($res)) die($res->getMessage()); |
$this->addToLog("triggerajouter(): db->query(\"".$sql."\");", VERBOSE_MODE); |
562 |
|
if (database::isError($res)) { |
563 |
if ($DEBUG == 1) |
die($res->getMessage()); |
564 |
echo " la requete ".$sql." est exécutée<br>"; |
} |
565 |
|
while ($row=& $res->fetchRow(DB_FETCHMODE_ASSOC)) { |
566 |
while ($row=& $res->fetchRow(DB_FETCHMODE_ASSOC)){ |
// Récupération de l'identifiant de l'action |
567 |
|
// si une action est paramétrée dans l'événement |
568 |
if(isset($row['action']) and !empty($row['action'])) { |
$this->valF['action'] = NULL; |
569 |
|
if (isset($row['action']) and !empty($row['action'])) { |
570 |
$this->valF['action']=$row['action']; |
$this->valF['action']=$row['action']; |
|
} else { |
|
|
$this->valF['action']=NULL; |
|
571 |
} |
} |
572 |
$this->valF['delai']=$row['delai']; |
// Récupération de la valeur du délai |
573 |
if(isset($row['etat']) and !empty($row['etat'])) { |
$this->valF['delai'] = $row['delai']; |
574 |
|
// Récupération de l'identifiant de l'état |
575 |
|
// si un état est paramétré dans l'événement |
576 |
|
$this->valF['etat']=NULL; |
577 |
|
if (isset($row['etat']) and !empty($row['etat'])) { |
578 |
$this->valF['etat']=$row['etat']; |
$this->valF['etat']=$row['etat']; |
|
} else { |
|
|
$this->valF['etat']=NULL; |
|
579 |
} |
} |
580 |
|
// Récupération de la valeur d'accord tacite |
581 |
$this->valF['accord_tacite']=$row['accord_tacite']; |
$this->valF['accord_tacite']=$row['accord_tacite']; |
582 |
|
// Récupération de la valeur du délai de notification |
583 |
$this->valF['delai_notification']=$row['delai_notification']; |
$this->valF['delai_notification']=$row['delai_notification']; |
584 |
|
// Récupération de l'identifiant de l'avis |
585 |
|
// si un avis est paramétré dans l'événement |
586 |
|
$this->valF['avis_decision'] = NULL; |
587 |
if(isset($row['avis_decision']) and !empty($row['avis_decision'])) { |
if(isset($row['avis_decision']) and !empty($row['avis_decision'])) { |
588 |
$this->valF['avis_decision']=$row['avis_decision']; |
$this->valF['avis_decision']=$row['avis_decision']; |
|
} else { |
|
|
$this->valF['avis_decision']=NULL; |
|
589 |
} |
} |
590 |
if($row['lettretype']!="") |
// Récupération de la valeur de la lettre type |
591 |
|
// Sinon on lui affecte lavaleur par défaut standard |
592 |
|
if ($row['lettretype'] != "") { |
593 |
$this->valF['lettretype']=$row['lettretype']; |
$this->valF['lettretype']=$row['lettretype']; |
594 |
else |
} else { |
595 |
$this->valF['lettretype']="standard"; |
$this->valF['lettretype'] = "standard"; // XXX |
596 |
|
} |
597 |
} |
} |
598 |
$sql= "select * from ".DB_PREFIXE."dossier where dossier = '".$this->valF['dossier']."'"; |
// Récupération de toutes les valeurs du dossier d'instruction en cours |
599 |
|
$sql = "SELECT * FROM ".DB_PREFIXE."dossier |
600 |
|
WHERE dossier='".$this->valF['dossier']."'"; |
601 |
$res = $db->query($sql); |
$res = $db->query($sql); |
602 |
if (database::isError($res)) |
$this->addToLog("triggerajouter(): db->query(\"".$sql."\");", VERBOSE_MODE); |
603 |
|
if (database::isError($res)) { |
604 |
die($res->getMessage()); |
die($res->getMessage()); |
605 |
if ($DEBUG == 1) |
} |
606 |
echo " la requete ".$sql." est exécutée<br>"; |
while ($row=& $res->fetchRow(DB_FETCHMODE_ASSOC)) { |
607 |
while ($row=& $res->fetchRow(DB_FETCHMODE_ASSOC)){ |
// XXX On stocke la date de dépôt actuelle du dossier d'instruction |
608 |
// |
// dans un attribut de la classe |
609 |
$this->archive_date_depot = $row['date_depot']; |
$this->archive_date_depot = $row['date_depot']; |
610 |
// archive en instruction (si suppression) |
// Récupération de la valeur actuelle du délai, de l'accord tacite, |
611 |
|
// de l'état et de l'avis du dossier d'instruction |
612 |
$this->valF['archive_delai']=$row['delai']; |
$this->valF['archive_delai']=$row['delai']; |
613 |
$this->valF['archive_accord_tacite']=$row['accord_tacite']; |
$this->valF['archive_accord_tacite']=$row['accord_tacite']; |
614 |
$this->valF['archive_etat']=$row['etat']; |
$this->valF['archive_etat']=$row['etat']; |
615 |
$this->valF['archive_avis']=$row['avis_decision']; |
$this->valF['archive_avis']=$row['avis_decision']; |
616 |
// compatibilite pgsql |
// Récupération de la valeur actuelle des 9 dates du dossier |
617 |
if($row['date_complet']!='') |
// d'instruction |
618 |
$this->valF['archive_date_complet']=$row['date_complet']; |
if ($row['date_complet'] != '') { |
619 |
if($row['date_rejet']!='') |
$this->valF['archive_date_complet']=$row['date_complet']; |
620 |
$this->valF['archive_date_rejet']= $row['date_rejet']; |
} |
621 |
if($row['date_limite']!='') |
if ($row['date_dernier_depot'] != '') { |
622 |
$this->valF['archive_date_limite']= $row['date_limite']; |
$this->valF['archive_date_dernier_depot']=$row['date_dernier_depot']; |
623 |
if($row['date_notification_delai']!='') |
} |
624 |
$this->valF['archive_date_notification_delai']= $row['date_notification_delai']; |
if ($row['date_rejet']!='') { |
625 |
if($row['date_decision']!='') |
$this->valF['archive_date_rejet']= $row['date_rejet']; |
626 |
$this->valF['archive_date_decision']= $row['date_decision']; |
} |
627 |
if($row['date_validite']!='') |
if ($row['date_limite']!='') { |
628 |
$this->valF['archive_date_validite']= $row['date_validite']; |
$this->valF['archive_date_limite']= $row['date_limite']; |
629 |
if($row['date_achevement']!='') |
} |
630 |
$this->valF['archive_date_achevement']= $row['date_achevement']; |
if ($row['date_notification_delai']!='') { |
631 |
if($row['date_chantier']!='') |
$this->valF['archive_date_notification_delai']= $row['date_notification_delai']; |
632 |
$this->valF['archive_date_chantier']= $row['date_chantier']; |
} |
633 |
if($row['date_conformite']!='') |
if ($row['date_decision']!='') { |
634 |
$this->valF['archive_date_conformite']= $row['date_conformite']; |
$this->valF['archive_date_decision']= $row['date_decision']; |
635 |
|
} |
636 |
|
if ($row['date_validite']!='') { |
637 |
|
$this->valF['archive_date_validite']= $row['date_validite']; |
638 |
|
} |
639 |
|
if ($row['date_achevement']!='') { |
640 |
|
$this->valF['archive_date_achevement']= $row['date_achevement']; |
641 |
|
} |
642 |
|
if ($row['date_chantier']!='') { |
643 |
|
$this->valF['archive_date_chantier']= $row['date_chantier']; |
644 |
|
} |
645 |
|
if ($row['date_conformite']!='') { |
646 |
|
$this->valF['archive_date_conformite']= $row['date_conformite']; |
647 |
|
} |
648 |
|
if ($row['incompletude']!='') { |
649 |
|
$this->valF['archive_incompletude']= $row['incompletude']; |
650 |
|
} |
651 |
|
if ($row['evenement_suivant_tacite']!='') { |
652 |
|
$this->valF['archive_evenement_suivant_tacite']= $row['evenement_suivant_tacite']; |
653 |
|
} |
654 |
|
if ($row['evenement_suivant_tacite_incompletude']!='') { |
655 |
|
$this->valF['archive_evenement_suivant_tacite_incompletude']= $row['evenement_suivant_tacite_incompletude']; |
656 |
|
} |
657 |
|
if ($row['etat_pendant_incompletude']!='') { |
658 |
|
$this->valF['archive_etat_pendant_incompletude']= $row['etat_pendant_incompletude']; |
659 |
|
} |
660 |
|
if ($row['date_limite_incompletude']!='') { |
661 |
|
$this->valF['archive_date_limite_incompletude']= $row['date_limite_incompletude']; |
662 |
|
} |
663 |
|
if ($row['delai_incompletude']!='') { |
664 |
|
$this->valF['archive_delai_incompletude']= $row['delai_incompletude']; |
665 |
|
} |
666 |
} |
} |
667 |
|
|
668 |
|
// Identifiant du type de courrier |
669 |
|
$idTypeCourrier = '11'; |
670 |
|
$idCourrier = str_pad($this->valF["instruction"], 10, "0", STR_PAD_LEFT); |
671 |
|
// Code barres |
672 |
|
$this->valF["code_barres"] = $idTypeCourrier . $idCourrier; |
673 |
} |
} |
674 |
|
|
675 |
// Test si une restriction est valide |
// Test si une restriction est valide |
787 |
} |
} |
788 |
|
|
789 |
|
|
790 |
|
|
|
// ================================================================== |
|
|
// valeur dossier apres modification [values dossier after action] |
|
|
// ================================================================== |
|
791 |
function triggerajouterapres($id,&$db,$val,$DEBUG) { |
function triggerajouterapres($id,&$db,$val,$DEBUG) { |
792 |
// mise a null au lieu de "" / voir compatibilite mysql |
/** |
793 |
// voir parametrage CU en dur |
* Mise à jour des valeurs du dossier en fonction des valeurs calculées |
794 |
// voir parametrage des actions en dur |
* par l'action |
795 |
$param=1; |
*/ |
796 |
if($param==1){ |
$this->getValEvenement(); |
797 |
$sql="select * from ".DB_PREFIXE."action where action = '".$this->valF['action']."'"; |
// Initialisation |
798 |
$res = $db->query($sql); |
$valF = ""; |
799 |
if (database::isError($res)) |
// état de complétude actuel du dossier |
800 |
die($res->getMessage()); |
$incompletude = $this->dossierIncomplet(); |
801 |
while ($row=& $res->fetchRow(DB_FETCHMODE_ASSOC)){ |
|
802 |
if($row['regle_etat']!=''){ |
if($incompletude === FALSE) { |
803 |
$valF['etat']= $this->regle($row['regle_etat']); |
// Si l'événement d'instruction est de type incompletude |
804 |
} |
if($this->valEvenement['type'] == "incompletude") { |
805 |
if($row['regle_delai']!=''){ |
// On marque le dossier en incomplétude pour application des actions |
806 |
$valF['delai']= $this->regle($row['regle_delai']); |
$incompletude = TRUE; |
807 |
} |
// Set du flag incomplétude de la table dossier |
808 |
if($row['regle_accord_tacite']!=''){ |
$valF['incompletude'] = TRUE; |
809 |
$valF['accord_tacite']= $this->regle($row['regle_accord_tacite']); |
// Enregistrement de l'état dans la variable provisoire |
810 |
} |
$valF['etat_pendant_incompletude'] = $this->valF['archive_etat']; |
811 |
if($row['regle_avis']!=''){ |
} |
812 |
$valF['avis_decision']= $this->regle($row['regle_avis']); |
} else { |
813 |
} |
// Si l'evenement d'instruction est de type retour ou contient une |
814 |
if($row['regle_date_limite']!=''){ |
// decision, on sort d'incomplétude |
815 |
$valF['date_limite']= $this->regle($row['regle_date_limite']); |
if($this->valEvenement['type'] == "retour" OR |
816 |
} |
$this->valEvenement['avis_decision'] != NULL) { |
817 |
if($row['regle_date_complet']!=''){ |
// On enlève la marque d'incomplétude pour application des actions |
818 |
$valF['date_complet']= $this->regle($row['regle_date_complet']); |
$incompletude = FALSE; |
819 |
} |
// On enlève le flag d'incomplétude sur l'enregistrement de la table dossier |
820 |
if($row['regle_date_notification_delai']!=''){ |
$valF['incompletude'] = FALSE; |
821 |
$valF['date_notification_delai']= $this->regle($row['regle_date_notification_delai']); |
// Restauration de l'état depuis l'état provisoire |
822 |
} |
$valF['etat'] = $this->valF['archive_etat_pendant_incompletude']; |
823 |
if($row['regle_date_decision']!=''){ |
// On vide la variable provisoire ainsi que le délai de complétude |
824 |
$valF['date_decision']= $this->regle($row['regle_date_decision']); |
// et la date limite de complétude |
825 |
} |
$valF['etat_pendant_incompletude'] = NULL; |
826 |
if($row['regle_date_rejet']!=''){ |
$valF['delai_incompletude'] = NULL; |
827 |
$valF['date_rejet']= $this->regle($row['regle_date_rejet']); |
$valF['date_limite_incompletude'] = NULL; |
828 |
} |
} |
829 |
if($row['regle_date_validite']!=''){ |
} |
830 |
$valF['date_validite']= $this->regle($row['regle_date_validite']); |
// Récupération des paramètres de l'action |
831 |
} |
$sql = "SELECT * FROM ".DB_PREFIXE."action |
832 |
if($row['regle_date_chantier']!=''){ |
WHERE action='".$this->valF['action']."'"; |
833 |
$valF['date_chantier']= $this->regle($row['regle_date_chantier']); |
$res = $db->query($sql); |
834 |
} |
$this->addToLog("triggerajouterapres(): db->query(\"".$sql."\");", VERBOSE_MODE); |
835 |
if($row['regle_date_achevement']!=''){ |
if (database::isError($res)) { |
836 |
$valF['date_achevement']= $this->regle($row['regle_date_achevement']); |
die($res->getMessage()); |
837 |
|
} |
838 |
|
while ($row=& $res->fetchRow(DB_FETCHMODE_ASSOC)) { |
839 |
|
|
840 |
|
// pour chacune des regles, on applique la regle |
841 |
|
if($row['regle_delai']!=''){ |
842 |
|
$valF['delai'] = $this->regle($row['regle_delai']); |
843 |
|
} |
844 |
|
if($row['regle_accord_tacite']!=''){ |
845 |
|
$valF['accord_tacite'] = $this->regle($row['regle_accord_tacite']); |
846 |
|
} |
847 |
|
if($row['regle_avis']!=''){ |
848 |
|
$valF['avis_decision'] = $this->regle($row['regle_avis']); |
849 |
|
} |
850 |
|
if($row['regle_date_limite']!=''){ |
851 |
|
$valF['date_limite']= $this->regle($row['regle_date_limite']); |
852 |
|
} |
853 |
|
if($row['regle_date_complet']!=''){ |
854 |
|
$valF['date_complet']= $this->regle($row['regle_date_complet']); |
855 |
|
} |
856 |
|
if($row['regle_date_dernier_depot']!=''){ |
857 |
|
$valF['date_dernier_depot']= $this->regle($row['regle_date_dernier_depot']); |
858 |
|
} |
859 |
|
if($row['regle_date_notification_delai']!=''){ |
860 |
|
$valF['date_notification_delai']= $this->regle($row['regle_date_notification_delai']); |
861 |
|
} |
862 |
|
if($row['regle_date_decision']!=''){ |
863 |
|
$valF['date_decision']= $this->regle($row['regle_date_decision']); |
864 |
|
} |
865 |
|
if($row['regle_date_rejet']!=''){ |
866 |
|
$valF['date_rejet']= $this->regle($row['regle_date_rejet']); |
867 |
|
} |
868 |
|
if($row['regle_date_validite']!=''){ |
869 |
|
$valF['date_validite']= $this->regle($row['regle_date_validite']); |
870 |
|
} |
871 |
|
if($row['regle_date_chantier']!=''){ |
872 |
|
$valF['date_chantier']= $this->regle($row['regle_date_chantier']); |
873 |
|
} |
874 |
|
if($row['regle_date_achevement']!=''){ |
875 |
|
$valF['date_achevement']= $this->regle($row['regle_date_achevement']); |
876 |
|
} |
877 |
|
if($row['regle_date_conformite']!=''){ |
878 |
|
$valF['date_conformite']= $this->regle($row['regle_date_conformite']); |
879 |
|
} |
880 |
|
if($row['regle_date_limite_incompletude']!=''){ |
881 |
|
$valF['date_limite_incompletude']= $this->regle($row['regle_date_limite_incompletude']); |
882 |
|
} |
883 |
|
if($row['regle_delai_incompletude']!=''){ |
884 |
|
$valF['delai_incompletude']= $this->regle($row['regle_delai_incompletude']); |
885 |
|
} |
886 |
|
if($row['regle_etat']!=''){ |
887 |
|
// Si on est dans le cas général ou qu'on est en incomplétude et |
888 |
|
// qu'on a un événement de type incomplétude alors : on stocke |
889 |
|
// l'état dans la variable courante |
890 |
|
if ($incompletude == FALSE OR $this->valEvenement['type'] == "incompletude") { |
891 |
|
$valF['etat'] = $this->regle($row['regle_etat']); |
892 |
|
} else { |
893 |
|
$valF['etat_pendant_incompletude'] = $this->regle($row['regle_etat']); |
894 |
} |
} |
895 |
if($row['regle_date_conformite']!=''){ |
} |
896 |
$valF['date_conformite']= $this->regle($row['regle_date_conformite']); |
|
897 |
|
if($this->valEvenement['evenement_suivant_tacite'] != '') { |
898 |
|
// Si on est pas en incomplétude on stocke l'événement tacite |
899 |
|
//de l'événement dans la variable courante |
900 |
|
if ($incompletude == FALSE) { |
901 |
|
$valF['evenement_suivant_tacite'] = $this->valEvenement['evenement_suivant_tacite']; |
902 |
|
} else { |
903 |
|
$valF['evenement_suivant_tacite_incompletude'] = $this->valEvenement['evenement_suivant_tacite']; |
904 |
} |
} |
905 |
|
} |
906 |
// Appel des méthode stockées dans le champ methode_trigger |
} |
907 |
if($row['methode_trigger'] != "") { |
// Si des valeurs ont été calculées alors on met à jour l'enregistrement |
908 |
foreach (explode(";", $row['methode_trigger']) as $methode) { |
if ($valF != "") { |
909 |
if(method_exists($this, $methode)) { |
// On met à jour le dossier |
910 |
$this->$methode(); |
$cle = " dossier='".$this->valF['dossier']."'"; |
911 |
} |
$res1 = $db->autoExecute(DB_PREFIXE.'dossier', $valF, DB_AUTOQUERY_UPDATE, $cle); |
912 |
|
$this->addToLog("triggerajouterapres(): db->autoexecute(\"".DB_PREFIXE."dossier\", ".print_r($valF, true).", DB_AUTOQUERY_UPDATE, \"".$cle."\");", VERBOSE_MODE); |
913 |
} |
if (database::isError($res1)) { |
|
} |
|
|
} |
|
|
}else{ |
|
|
switch ($this->valF['action']) { |
|
|
case "initialisation" : |
|
|
$valF['delai']= $this->valF['delai']; |
|
|
$valF['etat']= $this->valF['etat']; |
|
|
$valF['accord_tacite']= $this->valF['accord_tacite']; |
|
|
// la date_complet est la date de depot |
|
|
$valF['date_complet']= $this->archive_date_depot; // **** |
|
|
$valF['date_limite'] = $this->moisdate($valF['date_complet'],$valF['delai']); |
|
|
$valF['date_notification_delai'] = $this->moisdate($valF['date_complet'],1); |
|
|
break; |
|
|
case "notification" : |
|
|
$valF['delai']= $this->valF['delai']; |
|
|
$valF['etat']= $this->valF['etat']; |
|
|
$valF['accord_tacite']= $this->valF['accord_tacite']; |
|
|
// la date_complet est celle precedemment saisie |
|
|
$valF['date_complet']=$this->valF['archive_date_complet']; |
|
|
$valF['date_limite'] = $this->moisdate($valF['date_complet'],$valF['delai']); |
|
|
$valF['date_notification_delai'] = $this->moisdate($valF['date_complet'],1); |
|
|
// la date du courrier ne doit pas etre depasse par rapport au delai de |
|
|
// notification [verify notification date] |
|
|
if($this->valF['archive_date_notification_delai']<$this->valF['date_evenement']) |
|
|
$this->msg=$this->msg."<br><img src='../img/erreur.gif'> "._("date_notification_delai")." ". |
|
|
$this->valF['archive_date_notification_delai']." < "._('date_evenement'); |
|
|
// |
|
|
break; |
|
|
case "retour" : |
|
|
$valF['delai']= $this->valF['delai']; |
|
|
$valF['etat']= $this->valF['etat']; |
|
|
$valF['accord_tacite']= $this->valF['accord_tacite']; |
|
|
// la date_complet est celle de l evenement |
|
|
$valF['date_complet']= $this->valF['date_evenement']; |
|
|
$valF['date_limite'] = $this->moisdate($valF['date_complet'],$valF['delai']); |
|
|
$valF['date_notification_delai'] = $this->moisdate($valF['date_complet'],1); |
|
|
break; |
|
|
case "rejet" : |
|
|
//$valF['delai']=0; // *** delai a garder pour etat dpc |
|
|
$valF['etat']= $this->valF['etat']; |
|
|
$valF['accord_tacite']= $this->valF['accord_tacite']; |
|
|
// la date rejet est initialisee |
|
|
$valF['date_rejet']= $this->valF['date_evenement']; |
|
|
// les dates de depart et fin d instruction sont annulées |
|
|
$valF['date_limite'] =null; |
|
|
$valF['date_notification_delai'] =null; |
|
|
$valF['date_complet']=null; |
|
|
break; |
|
|
case "majoration" : |
|
|
$valF['delai']= $this->valF['archive_delai']+$this->valF['delai']; |
|
|
$valF['etat']= $this->valF['etat']; |
|
|
$valF['accord_tacite']= $this->valF['accord_tacite']; |
|
|
$valF['date_complet']=$this->valF['archive_date_complet']; |
|
|
// majoration de la date limite |
|
|
$valF['date_limite'] = $this->moisdate($valF['date_complet'],$valF['delai']); |
|
|
$valF['date_notification_delai'] = $this->moisdate($valF['date_complet'],1); |
|
|
// la date du courrier ne doit pas etre depasse par rapport au delai de |
|
|
// notification |
|
|
if($this->valF['archive_date_notification_delai']<$this->valF['date_evenement']) |
|
|
$this->msg=$this->msg."<br><img src='../img/erreur.gif'>"._("date_notification_delai"). |
|
|
$this->valF['archive_date_notification_delai']." < "._('date_evenement'); |
|
|
break; |
|
|
case "acceptation" : |
|
|
$valF['etat']= $this->valF['etat']; |
|
|
$valF['date_decision']= $this->valF['date_evenement']; |
|
|
$valF['avis_decision']= $this->valF['avis_decision']; |
|
|
// date de validite = date de l evenement + delai |
|
|
$valF['date_validite'] = $this->moisdate($this->valF['date_evenement'],$this->valF['delai']); |
|
|
break; |
|
|
case "refus" : |
|
|
$valF['etat']= $this->valF['etat']; |
|
|
$valF['date_decision']= $this->valF['date_evenement']; |
|
|
$valF['avis_decision']= $this->valF['avis_decision']; |
|
|
break; |
|
|
case "prolongation" : |
|
|
$valF['date_validite'] = $this->moisdate($this->valF['archive_date_validite'],$this->valF['delai']); |
|
|
break; |
|
|
case "sursis" : |
|
|
$valF['date_limite'] = $this->moisdate($this->valF['date_evenement'],$this->valF['delai']); |
|
|
$valF['etat']= $this->valF['etat']; |
|
|
$valF['accord_tacite']= $this->valF['accord_tacite']; |
|
|
$valF['avis_decision']= $this->valF['avis_decision']; |
|
|
$valF['date_decision']= $this->valF['date_evenement']; |
|
|
$temp = $valF['date_limite']; |
|
|
$valF['date_validite']= $this->moisdate($temp,2); |
|
|
break; |
|
|
case "execution" : |
|
|
$valF['etat']= $this->valF['etat']; |
|
|
$valF['date_chantier'] = $this->valF['date_evenement']; |
|
|
//echo $this->msg=$this->msg.$valF['date_chantier'].""; |
|
|
break; |
|
|
case "achevement" : |
|
|
$valF['etat']= $this->valF['etat']; |
|
|
$valF['date_achevement'] = $this->valF['date_evenement']; |
|
|
break; |
|
|
case "archivage" : |
|
|
$valF['etat']= $this->valF['etat']; |
|
|
$valF['date_conformite'] = $this->valF['date_evenement']; |
|
|
break; |
|
|
|
|
|
default: |
|
|
if ($this->valF['etat']!="") |
|
|
$valF['etat']= $this->valF['etat']; |
|
|
}// end switch |
|
|
} // end param |
|
|
if($valF!=""){ |
|
|
$cle= " dossier = '".$this->valF['dossier']."'"; |
|
|
$res1= $db->autoExecute(DB_PREFIXE.'dossier',$valF,DB_AUTOQUERY_UPDATE,$cle); |
|
|
if (database::isError($res1)) |
|
914 |
die($res->getMessage()); |
die($res->getMessage()); |
915 |
if ($DEBUG == 1) |
} |
916 |
echo "La requête de mise à jour est effectuée.<br>"; |
// Affichage d'informations à l'utilisateur |
917 |
$this->msg=$this->msg."<br>"._('enregistrement')." ". |
$this->addToMessage(_('enregistrement')." ".$this->valF['dossier']." "._('table')." dossier [".$db->affectedRows()." "._('enregistrement')." "._('mis_a_jour')."]"); |
|
$this->valF['dossier']." "._('table')." dossier [". |
|
|
$db->affectedRows()." "._('enregistrement'). |
|
|
" "._('mis_a_jour')."]" ; |
|
918 |
} |
} |
919 |
|
|
920 |
|
/** |
921 |
|
* REFERENTIEL ERP |
922 |
|
*/ |
923 |
// verification si envoi vers ERP est active |
// verification si envoi vers ERP est active |
924 |
if ($this->f->getParameter('option_erp') != "") { |
if ($this->f->getParameter('option_erp') != "") { |
925 |
// la nature du dossier |
// la nature du dossier |
926 |
$nature_dossier = substr($this->idxformulaire,0,2); |
$nature_dossier = substr($this->idxformulaire,0,2); |
927 |
$dossier_erp = $this->getFromDB("SELECT erp FROM ".DB_PREFIXE."dossier WHERE dossier = '" . |
// |
928 |
$this->valF['dossier'] . "'"); |
$sql = "SELECT erp |
929 |
$evenement_libelle = $this->getFromDB( |
FROM ".DB_PREFIXE."dossier |
930 |
"SELECT libelle FROM ".DB_PREFIXE."evenement WHERE evenement = '" . |
WHERE dossier='".$this->valF['dossier']."'"; |
931 |
$this->valF['evenement'] . "'"); |
$dossier_erp = $this->db->getone($sql); |
932 |
|
$this->addToLog("triggerajouterapres(): db->getone(\"".$sql."\");", VERBOSE_MODE); |
933 |
|
if (database::isError($res)) { |
934 |
|
die($res->getMessage()); |
935 |
|
} |
936 |
|
// |
937 |
|
$sql = "SELECT libelle |
938 |
|
FROM ".DB_PREFIXE."evenement |
939 |
|
WHERE evenement='".$this->valF['evenement']."'"; |
940 |
|
$evenement_libelle = $this->db->getone($sql); |
941 |
|
$this->addToLog("triggerajouterapres(): db->getone(\"".$sql."\");", VERBOSE_MODE); |
942 |
|
if (database::isError($res)) { |
943 |
|
die($res->getMessage()); |
944 |
|
} |
945 |
|
// |
946 |
if ($dossier_erp == 't') { |
if ($dossier_erp == 't') { |
947 |
// envoi du message en cas d'un PC qui est ERP et sur lequel un evenement |
// envoi du message en cas d'un PC qui est ERP et sur lequel un evenement |
948 |
// d'acceptation etait fait |
// d'acceptation etait fait |
963 |
} |
} |
964 |
} |
} |
965 |
} // fin de if ($this->f->getParameter('option_erp') != "") |
} // fin de if ($this->f->getParameter('option_erp') != "") |
|
} |
|
|
|
|
|
|
|
|
/** |
|
|
* Fait une requette sql pour extraire la valeur d'un champ, et retourne |
|
|
* cette valeur |
|
|
* @param string $sql La requete sql a executer |
|
|
* @return La valeur du champs cherche, sinon NULL. En cas d'erreur de la BD |
|
|
* l'execution s'arrete. |
|
|
*/ |
|
|
function getFromDB($sql) { |
|
|
//$sql = "SELECT libelle FROM ".DB_PREFIXE."dossier WHERE dossier = '" . $dossier . "'"; |
|
|
$res = $this->db->limitquery($sql, 0, 1); |
|
|
$this->addToLog("getDossierERPSpecification(): db->limitquery(\"". |
|
|
str_replace(",",", ",$sql)."\", 0, 1);", VERBOSE_MODE); |
|
|
// Si une erreur survient on die |
|
|
if (database::isError($res, true)) { |
|
|
// Appel de la methode de recuperation des erreurs |
|
|
$this->erreur_db($res->getDebugInfo(), $res->getMessage(), 'instruction'); |
|
|
} |
|
|
// retourne la nature du dossier |
|
|
while ($row =& $res->fetchRow()) { |
|
|
return $row[0]; |
|
|
} |
|
|
// la nature n'etait pas trouve, ce qui ne devrait pas se passer |
|
|
return NULL; |
|
966 |
|
|
967 |
} |
// Mise à jour des données du dossier d'autorisation |
968 |
|
require_once "../obj/dossier_autorisation.class.php"; |
969 |
|
$da = new dossier_autorisation($this->getDossierAutorisationFromDossier($this->valF['dossier']), $this->db, DEBUG); |
970 |
|
$da->majDossierAutorisation(); |
971 |
|
} |
972 |
|
|
973 |
function triggermodifierapres($id,&$db,$val,$DEBUG) { |
function triggermodifierapres($id,&$db,$val,$DEBUG) { |
974 |
/* |
/** |
975 |
* cette fonction a pour objet de permettre de modifier la date courrier |
* L'objectif ici est d'effectuer les recalculs de date dans le dossier |
976 |
*/ |
* si la date de l'evenement est modifiee |
977 |
$valF=array(); |
*/ |
978 |
$sql= "select action from ".DB_PREFIXE."evenement where evenement =".$this->valF['evenement']; |
// Initialisation |
979 |
|
$valF = ""; |
980 |
|
// Récupération de l'action correspondante à l'événement |
981 |
|
$sql = "SELECT action |
982 |
|
FROM ".DB_PREFIXE."evenement |
983 |
|
WHERE evenement=".$this->valF['evenement']; |
984 |
$action = $db->getOne($sql); |
$action = $db->getOne($sql); |
985 |
if (database::isError($action)) die($action->getMessage().$sql); |
$this->addToLog("triggermodifierapres(): db->getone(\"".$sql."\");", VERBOSE_MODE); |
986 |
$sql="select * from ".DB_PREFIXE."action where action = '".$action."'"; |
if (database::isError($action)) { |
987 |
|
die($action->getMessage()); |
988 |
|
} |
989 |
|
|
990 |
|
// Récupération de tous les paramètres de l'événement sélectionné |
991 |
|
$sql = "SELECT * FROM ".DB_PREFIXE."evenement |
992 |
|
WHERE evenement=".$this->valF['evenement']; |
993 |
$res = $db->query($sql); |
$res = $db->query($sql); |
994 |
if (database::isError($res)) die($res->getMessage().$sql); |
$this->addToLog("triggerajouter(): db->query(\"".$sql."\");", VERBOSE_MODE); |
995 |
|
if (database::isError($res)) { |
996 |
|
die($res->getMessage()); |
997 |
|
} |
998 |
|
while ($row=& $res->fetchRow(DB_FETCHMODE_ASSOC)) { |
999 |
|
// Si la date de retour signature est éditée on vérifie si il existe un événement automatique |
1000 |
|
if ($this->getVal('date_retour_signature') == "" AND |
1001 |
|
$this->valF['date_retour_signature'] != "" AND |
1002 |
|
$row['evenement_retour_signature'] != "") { |
1003 |
|
$new_instruction = new instruction("]", $db, $DEBUG); |
1004 |
|
// Création d'un tableau avec la liste des champs de l'instruction |
1005 |
|
foreach($new_instruction->champs as $champ) { |
1006 |
|
$valNewInstr[$champ] = ""; |
1007 |
|
} |
1008 |
|
// Définition des valeurs de la nouvelle instruction |
1009 |
|
$valNewInstr["evenement"] = $row['evenement_retour_signature']; |
1010 |
|
$valNewInstr["destinataire"] = $this->valF['destinataire']; |
1011 |
|
$valNewInstr["dossier"] = $this->valF['dossier']; |
1012 |
|
$valNewInstr["date_evenement"] = date("d/m/Y"); |
1013 |
|
$new_instruction->ajouter($valNewInstr,$db, $DEBUG); |
1014 |
|
} |
1015 |
|
// Si la date de retour AR est éditée on vérifie si il existe un événement automatique |
1016 |
|
if ($this->getVal('date_retour_rar') == "" AND |
1017 |
|
$this->valF['date_retour_rar'] != "" AND |
1018 |
|
$row['evenement_retour_ar'] != "" ) { |
1019 |
|
$new_instruction = new instruction("]", $db, $DEBUG); |
1020 |
|
// Création d'un tableau avec la liste des champs de l'instruction |
1021 |
|
foreach($new_instruction->champs as $champ) { |
1022 |
|
$valNewInstr[$champ] = ""; |
1023 |
|
} |
1024 |
|
// Définition des valeurs de la nouvelle instruction |
1025 |
|
$valNewInstr["evenement"] = $row['evenement_retour_ar']; |
1026 |
|
$valNewInstr["destinataire"] = $this->valF['destinataire']; |
1027 |
|
$valNewInstr["dossier"] = $this->valF['dossier']; |
1028 |
|
$valNewInstr["date_evenement"] = date("d/m/Y"); |
1029 |
|
$new_instruction->ajouter($valNewInstr,$db, $DEBUG); |
1030 |
|
} |
1031 |
|
} |
1032 |
|
|
1033 |
|
// Récupération des paramètres de l'action |
1034 |
|
$sql = "SELECT * FROM ".DB_PREFIXE."action |
1035 |
|
WHERE action='".$action."'"; |
1036 |
|
$res = $db->query($sql); |
1037 |
|
$this->addToLog("triggermodifierapres(): db->query(\"".$sql."\");", VERBOSE_MODE); |
1038 |
|
if (database::isError($res)) { |
1039 |
|
die($res->getMessage()); |
1040 |
|
} |
1041 |
while ($row=& $res->fetchRow(DB_FETCHMODE_ASSOC)){ |
while ($row=& $res->fetchRow(DB_FETCHMODE_ASSOC)){ |
1042 |
// application des regles sur le courrier + delai |
// application des regles sur le courrier + delai |
1043 |
if(preg_match("/date_evenement/",$row['regle_date_limite'])){ |
if(preg_match("/date_evenement/",$row['regle_date_limite'])){ |
1046 |
if(preg_match("/date_evenement/",$row['regle_date_complet'])){ |
if(preg_match("/date_evenement/",$row['regle_date_complet'])){ |
1047 |
$valF['date_complet']= $this->regle($row['regle_date_complet']); |
$valF['date_complet']= $this->regle($row['regle_date_complet']); |
1048 |
} |
} |
1049 |
|
if(preg_match("/date_evenement/",$row['regle_date_dernier_depot'])){ |
1050 |
|
$valF['date_dernier_depot']= $this->regle($row['regle_date_dernier_depot']); |
1051 |
|
} |
1052 |
if(preg_match("/date_evenement/",$row['regle_date_notification_delai'])){ |
if(preg_match("/date_evenement/",$row['regle_date_notification_delai'])){ |
1053 |
$valF['date_notification_delai']= $this->regle($row['regle_date_notification_delai']); |
$valF['date_notification_delai']= $this->regle($row['regle_date_notification_delai']); |
1054 |
} |
} |
1070 |
if(preg_match("/date_evenement/",$row['regle_date_conformite'])){ |
if(preg_match("/date_evenement/",$row['regle_date_conformite'])){ |
1071 |
$valF['date_conformite']= $this->regle($row['regle_date_conformite']); |
$valF['date_conformite']= $this->regle($row['regle_date_conformite']); |
1072 |
} |
} |
1073 |
} // while |
} |
1074 |
if($valF!=array()){ |
// Si des valeurs ont été calculées alors on met à jour l'enregistrement |
1075 |
$cle= " dossier = '".$this->valF['dossier']."'"; |
if ($valF != "") { |
1076 |
$res1= $db->autoExecute(DB_PREFIXE.'dossier',$valF,DB_AUTOQUERY_UPDATE,$cle); |
// On met à jour le dossier |
1077 |
if (database::isError($res1)) |
$cle = " dossier='".$this->valF['dossier']."'"; |
1078 |
|
$res1 = $db->autoExecute(DB_PREFIXE.'dossier', $valF, DB_AUTOQUERY_UPDATE, $cle); |
1079 |
|
$this->addToLog("triggerajouterapres(): db->autoexecute(\"".DB_PREFIXE."dossier\", ".print_r($valF, true).", DB_AUTOQUERY_UPDATE, \"".$cle."\");", VERBOSE_MODE); |
1080 |
|
if (database::isError($res1)) { |
1081 |
die($res->getMessage()); |
die($res->getMessage()); |
1082 |
if ($DEBUG == 1) |
} |
1083 |
echo "La requête de mise à jour est effectuée.<br>"; |
// Affichage d'informations à l'utilisateur |
1084 |
$this->msg=$this->msg."<br>"._('enregistrement')." ". |
$this->addToMessage(_('enregistrement')." ".$this->valF['dossier']." "._('table')." dossier [".$db->affectedRows()." "._('enregistrement')." "._('mis_a_jour')."]"); |
|
$this->valF['dossier']." "._('table')." dossier [". |
|
|
$db->affectedRows()." "._('enregistrement'). |
|
|
" "._('mis_a_jour')."]" ; |
|
|
} |
|
|
|
|
|
// Envoi des infos au |
|
|
if ($this->valF['date_retour_signature'] != $this->getVal('date_retour_signature')) { |
|
|
$msgenque = new MessageEnqueuer(); |
|
|
$sqlArrete = "SELECT instruction.signataire_arrete as \"ws_DA_In_Signataire\", |
|
|
signataire_arrete.nom as \"ws_DA_In_Sign_Nom\", |
|
|
signataire_arrete.prenom as \"ws_DA_In_Sign_Prenom\", |
|
|
signataire_arrete.qualite as \"ws_DA_In_Sign_Qualite\", |
|
|
instruction.date_evenement as \"ws_DA_In_Dte_Redac\", |
|
|
'' as \"ws_DA_In_lieu_Redac\", |
|
|
instruction.dossier as \"ws_DA_In_N_Doss_DAS\", |
|
|
'' as \"ws_DA_In_Sigle\", |
|
|
instruction.etat as \"ws_DA_In_Decision\", |
|
|
dossier.date_depot as \"ws_DA_In_Dte_Depot_Dem\", |
|
|
dossier.terrain_numero as \"ws_DA_In_N_Voie\", |
|
|
'' as \"ws_DA_In_Type_Voie\", |
|
|
dossier.complement as \"ws_DA_In_Adresse1\", |
|
|
dossier.terrain_adresse_lieu_dit as \"ws_DA_In_Adresse2\", |
|
|
dossier.terrain_adresse_code_postal as \"ws_DA_In_CP\", |
|
|
dossier.terrain_adresse_localite as \"ws_DA_In_Ville\", |
|
|
dossier.terrain_references_cadastrales as \"ws_DA_In_Nb_Parcelle\", |
|
|
'' as \"ws_DA_In_Detail_Parcelle\", |
|
|
CONCAT(donnees_techniques.am_projet_desc,' ',donnees_techniques.co_projet_desc) as \"ws_DA_In_Nature_Trvx\", |
|
|
'' as \"ws_DA_In_Destination_Trvx\", |
|
|
dossier_autorisation_type_detaille.code as \"ws_DA_In_Type_Dos_Autoris\", |
|
|
COALESCE(particulier_nom,personne_morale_raison_sociale) as \"ws_DA_In_Nom_Petition\", |
|
|
COALESCE(particulier_prenom, personne_morale_denomination) as \"ws_DA_In_Prenom_Petition\", |
|
|
'' as \"ws_DA_In_Piece_GED\", |
|
|
instruction.date_retour_signature as \"ws_DA_In_Dte_Signature\" |
|
|
FROM ".DB_PREFIXE."instruction |
|
|
LEFT JOIN ".DB_PREFIXE."signataire_arrete ON |
|
|
instruction.signataire_arrete = signataire_arrete.signataire_arrete |
|
|
LEFT JOIN ".DB_PREFIXE."dossier ON |
|
|
instruction.dossier = dossier.dossier |
|
|
LEFT JOIN ".DB_PREFIXE."lien_dossier_demandeur ON |
|
|
lien_dossier_demandeur.dossier = dossier.dossier |
|
|
LEFT JOIN ".DB_PREFIXE."demandeur ON |
|
|
lien_dossier_demandeur.demandeur = demandeur.demandeur |
|
|
LEFT JOIN ".DB_PREFIXE."dossier_instruction_type ON |
|
|
dossier.dossier_instruction_type = dossier_instruction_type.dossier_instruction_type |
|
|
LEFT JOIN ".DB_PREFIXE."dossier_autorisation_type_detaille ON |
|
|
dossier_instruction_type.dossier_autorisation_type_detaille = |
|
|
dossier_autorisation_type_detaille.dossier_autorisation_type_detaille |
|
|
LEFT JOIN ".DB_PREFIXE."donnees_techniques ON |
|
|
donnees_techniques.dossier_instruction = dossier.dossier |
|
|
WHERE instruction.instruction = ".$this->valF['instruction']; |
|
|
$resArrete = $this->db->query($sqlArrete); |
|
|
$this->f->addToLog("triggerModifierApres(): db->query(\"".$sqlArrete."\");", VERBOSE_MODE); |
|
|
$this->f->isDatabaseError(); |
|
|
|
|
|
$rowArrete = $resArrete->fetchRow(DB_FETCHMODE_ASSOC); |
|
|
$msgenque->setArreteInfo($rowArrete); |
|
|
$msgenque->enqueueMessage($msgenque::$ARRETE_ENVOI); |
|
1085 |
} |
} |
|
} |
|
|
|
|
1086 |
|
|
1087 |
|
/** |
1088 |
|
* REFERENTIEL ARRETE |
1089 |
|
*/ |
1090 |
|
if ($this->f->getParameter('option_referentiel_arrete') != "") { |
1091 |
|
if ($this->valF['date_retour_signature'] != $this->getVal('date_retour_signature')) { |
1092 |
|
$msgenque = new MessageEnqueuer(); |
1093 |
|
$sqlArrete = "SELECT instruction.signataire_arrete as \"ws_DA_In_Signataire\", |
1094 |
|
signataire_arrete.nom as \"ws_DA_In_Sign_Nom\", |
1095 |
|
signataire_arrete.prenom as \"ws_DA_In_Sign_Prenom\", |
1096 |
|
signataire_arrete.qualite as \"ws_DA_In_Sign_Qualite\", |
1097 |
|
instruction.date_evenement as \"ws_DA_In_Dte_Redac\", |
1098 |
|
'' as \"ws_DA_In_lieu_Redac\", |
1099 |
|
instruction.dossier as \"ws_DA_In_N_Doss_DAS\", |
1100 |
|
'' as \"ws_DA_In_Sigle\", |
1101 |
|
instruction.etat as \"ws_DA_In_Decision\", |
1102 |
|
dossier.date_depot as \"ws_DA_In_Dte_Depot_Dem\", |
1103 |
|
dossier.terrain_numero as \"ws_DA_In_N_Voie\", |
1104 |
|
'' as \"ws_DA_In_Type_Voie\", |
1105 |
|
dossier.complement as \"ws_DA_In_Adresse1\", |
1106 |
|
dossier.terrain_adresse_lieu_dit as \"ws_DA_In_Adresse2\", |
1107 |
|
dossier.terrain_adresse_code_postal as \"ws_DA_In_CP\", |
1108 |
|
dossier.terrain_adresse_localite as \"ws_DA_In_Ville\", |
1109 |
|
dossier.terrain_references_cadastrales as \"ws_DA_In_Nb_Parcelle\", |
1110 |
|
'' as \"ws_DA_In_Detail_Parcelle\", |
1111 |
|
CONCAT(donnees_techniques.am_projet_desc,' ',donnees_techniques.co_projet_desc) as \"ws_DA_In_Nature_Trvx\", |
1112 |
|
'' as \"ws_DA_In_Destination_Trvx\", |
1113 |
|
dossier_autorisation_type_detaille.code as \"ws_DA_In_Type_Dos_Autoris\", |
1114 |
|
COALESCE(particulier_nom,personne_morale_raison_sociale) as \"ws_DA_In_Nom_Petition\", |
1115 |
|
COALESCE(particulier_prenom, personne_morale_denomination) as \"ws_DA_In_Prenom_Petition\", |
1116 |
|
'' as \"ws_DA_In_Piece_GED\", |
1117 |
|
instruction.date_retour_signature as \"ws_DA_In_Dte_Signature\" |
1118 |
|
FROM ".DB_PREFIXE."instruction |
1119 |
|
LEFT JOIN ".DB_PREFIXE."signataire_arrete ON |
1120 |
|
instruction.signataire_arrete = signataire_arrete.signataire_arrete |
1121 |
|
LEFT JOIN ".DB_PREFIXE."dossier ON |
1122 |
|
instruction.dossier = dossier.dossier |
1123 |
|
LEFT JOIN ".DB_PREFIXE."lien_dossier_demandeur ON |
1124 |
|
lien_dossier_demandeur.dossier = dossier.dossier |
1125 |
|
LEFT JOIN ".DB_PREFIXE."demandeur ON |
1126 |
|
lien_dossier_demandeur.demandeur = demandeur.demandeur |
1127 |
|
LEFT JOIN ".DB_PREFIXE."dossier_instruction_type ON |
1128 |
|
dossier.dossier_instruction_type = dossier_instruction_type.dossier_instruction_type |
1129 |
|
LEFT JOIN ".DB_PREFIXE."dossier_autorisation_type_detaille ON |
1130 |
|
dossier_instruction_type.dossier_autorisation_type_detaille = |
1131 |
|
dossier_autorisation_type_detaille.dossier_autorisation_type_detaille |
1132 |
|
LEFT JOIN ".DB_PREFIXE."donnees_techniques ON |
1133 |
|
donnees_techniques.dossier_instruction = dossier.dossier |
1134 |
|
WHERE instruction.instruction = ".$this->valF['instruction']; |
1135 |
|
$resArrete = $this->db->query($sqlArrete); |
1136 |
|
$this->f->addToLog("triggerModifierApres(): db->query(\"".$sqlArrete."\");", VERBOSE_MODE); |
1137 |
|
if ( database::isError($resArrete)){ |
1138 |
|
die(); |
1139 |
|
} |
1140 |
|
|
1141 |
// trigger before delete |
$rowArrete = $resArrete->fetchRow(DB_FETCHMODE_ASSOC); |
1142 |
|
$msgenque->setArreteInfo($rowArrete); |
1143 |
|
$msgenque->enqueueMessage($msgenque::$ARRETE_ENVOI); |
1144 |
|
} |
1145 |
|
} |
1146 |
|
|
1147 |
|
// Mise à jour des données du dossier d'autorisation |
1148 |
|
require_once "../obj/dossier_autorisation.class.php"; |
1149 |
|
$da = new dossier_autorisation($this->getDossierAutorisationFromDossier($this->valF['dossier']), $this->db, DEBUG); |
1150 |
|
$da->majDossierAutorisation(); |
1151 |
|
} |
1152 |
|
|
1153 |
function triggersupprimer($id,&$db,$val,$DEBUG) { |
function triggersupprimer($id,&$db,$val,$DEBUG) { |
1154 |
// archive en instruction (si suppression) [archive if delete instruction] |
/** |
1155 |
$valF['delai']=$val['archive_delai']; |
* L'objectif ici est de repositionner les valeurs récupérées en |
1156 |
$valF['accord_tacite']=$val['archive_accord_tacite']; |
* archive dans le dossier d'instruction avant de supprimer l'événement |
1157 |
$valF['etat']=$val['archive_etat']; |
* d'instruction |
1158 |
if($val['archive_avis']=='') |
*/ |
1159 |
$valF['avis_decision']= null; |
// Mise à jour des 4 valeurs modifiées par l'action |
1160 |
else |
$valF['delai'] = $val['archive_delai']; |
1161 |
$valF['avis_decision']=$val['archive_avis']; |
$valF['accord_tacite'] = $val['archive_accord_tacite']; |
1162 |
// if= compatibilite pgsql |
$valF['etat'] = $val['archive_etat']; |
1163 |
if($val['archive_date_complet']!='') |
if ($val['archive_avis'] != '') { |
1164 |
$valF['date_complet']=$val['archive_date_complet']; |
$valF['avis_decision'] = $val['archive_avis']; |
1165 |
if($val['archive_date_rejet']!='') |
} else { |
1166 |
$valF['date_rejet']= $val['archive_date_rejet']; |
$valF['avis_decision'] = NULL; |
1167 |
if($val['archive_date_limite']!='') |
} |
1168 |
$valF['date_limite']= $val['archive_date_limite']; |
// Mise à jour des 10 dates avec la valeur présente dans le formulaire |
1169 |
if($val['archive_date_notification_delai']!='') |
// de suppression. Si la valeur de la date est vide alors on fixe |
1170 |
$valF['date_notification_delai']= $val['archive_date_notification_delai']; |
// à la valeur NULL |
1171 |
if($val['archive_date_decision']!='') |
// |
1172 |
$valF['date_decision']= $val['archive_date_decision']; |
if ($val['archive_date_complet'] != '') { |
1173 |
if($val['archive_date_validite']!='') |
$valF['date_complet'] = $val['archive_date_complet']; |
1174 |
$valF['date_validite']= $val['archive_date_validite']; |
} else { |
1175 |
if($val['archive_date_achevement']!='') |
$valF['date_complet'] = NULL; |
1176 |
$valF['date_achevement']= $val['archive_date_achevement']; |
} |
1177 |
if($val['archive_date_chantier']!='') |
if ($val['archive_date_dernier_depot'] != '') { |
1178 |
$valF['date_chantier']= $val['archive_date_chantier']; |
$valF['date_dernier_depot'] = $val['archive_date_dernier_depot']; |
1179 |
if($val['archive_date_conformite']!='') |
} else { |
1180 |
$valF['date_conformite']= $val['archive_date_conformite']; |
$valF['date_dernier_depot'] = NULL; |
1181 |
|
} |
1182 |
$cle= " dossier = '".$val['dossier']."'"; |
if ($val['archive_date_rejet'] != '') { |
1183 |
$res= $db->autoExecute(DB_PREFIXE.'dossier',$valF,DB_AUTOQUERY_UPDATE,$cle); |
$valF['date_rejet'] = $val['archive_date_rejet']; |
1184 |
if (database::isError($res)) |
} else { |
1185 |
|
$valF['date_rejet'] = NULL; |
1186 |
|
} |
1187 |
|
if ($val['archive_date_limite'] != '') { |
1188 |
|
$valF['date_limite'] = $val['archive_date_limite']; |
1189 |
|
} else { |
1190 |
|
$valF['date_limite'] = NULL; |
1191 |
|
} |
1192 |
|
if ($val['archive_date_notification_delai'] != '') { |
1193 |
|
$valF['date_notification_delai'] = $val['archive_date_notification_delai']; |
1194 |
|
} else { |
1195 |
|
$valF['date_notification_delai'] = NULL; |
1196 |
|
} |
1197 |
|
if ($val['archive_date_decision'] != '') { |
1198 |
|
$valF['date_decision'] = $val['archive_date_decision']; |
1199 |
|
} else { |
1200 |
|
$valF['date_decision'] = NULL; |
1201 |
|
} |
1202 |
|
if ($val['archive_date_validite'] != '') { |
1203 |
|
$valF['date_validite'] = $val['archive_date_validite']; |
1204 |
|
} else { |
1205 |
|
$valF['date_validite'] = NULL; |
1206 |
|
} |
1207 |
|
if ($val['archive_date_achevement'] != '') { |
1208 |
|
$valF['date_achevement'] = $val['archive_date_achevement']; |
1209 |
|
} else { |
1210 |
|
$valF['date_achevement'] = NULL; |
1211 |
|
} |
1212 |
|
if ($val['archive_date_chantier'] != '') { |
1213 |
|
$valF['date_chantier'] = $val['archive_date_chantier']; |
1214 |
|
} else { |
1215 |
|
$valF['date_chantier'] = NULL; |
1216 |
|
} |
1217 |
|
if ($val['archive_date_conformite'] != '') { |
1218 |
|
$valF['date_conformite'] = $val['archive_date_conformite']; |
1219 |
|
} else { |
1220 |
|
$valF['date_conformite'] = NULL; |
1221 |
|
} |
1222 |
|
if ($val['archive_incompletude'] != '') { |
1223 |
|
$valF['incompletude'] = $val['archive_incompletude']; |
1224 |
|
} else { |
1225 |
|
$valF['incompletude'] = NULL; |
1226 |
|
} |
1227 |
|
if ($val['archive_evenement_suivant_tacite'] != '') { |
1228 |
|
$valF['evenement_suivant_tacite'] = $val['archive_evenement_suivant_tacite']; |
1229 |
|
} else { |
1230 |
|
$valF['evenement_suivant_tacite'] = NULL; |
1231 |
|
} |
1232 |
|
if ($val['archive_evenement_suivant_tacite_incompletude'] != '') { |
1233 |
|
$valF['evenement_suivant_tacite_incompletude'] = $val['archive_evenement_suivant_tacite_incompletude']; |
1234 |
|
} else { |
1235 |
|
$valF['evenement_suivant_tacite_incompletude'] = NULL; |
1236 |
|
} |
1237 |
|
if ($val['archive_etat_pendant_incompletude'] != '') { |
1238 |
|
$valF['etat_pendant_incompletude'] = $val['archive_etat_pendant_incompletude']; |
1239 |
|
} else { |
1240 |
|
$valF['etat_pendant_incompletude'] = NULL; |
1241 |
|
} |
1242 |
|
if ($val['archive_date_limite_incompletude'] != '') { |
1243 |
|
$valF['date_limite_incompletude'] = $val['archive_date_limite_incompletude']; |
1244 |
|
} else { |
1245 |
|
$valF['date_limite_incompletude'] = NULL; |
1246 |
|
} |
1247 |
|
if ($val['archive_delai_incompletude'] != '') { |
1248 |
|
$valF['delai_incompletude'] = $val['archive_delai_incompletude']; |
1249 |
|
} else { |
1250 |
|
$valF['delai_incompletude'] = NULL; |
1251 |
|
} |
1252 |
|
// On met à jour le dossier |
1253 |
|
$cle = " dossier='".$val['dossier']."'"; |
1254 |
|
$res = $db->autoExecute(DB_PREFIXE.'dossier', $valF, DB_AUTOQUERY_UPDATE, $cle); |
1255 |
|
$this->addToLog("triggersupprimer(): db->autoexecute(\"".DB_PREFIXE."dossier\", ".print_r($valF, true).", DB_AUTOQUERY_UPDATE, \"".$cle."\");", VERBOSE_MODE); |
1256 |
|
if (database::isError($res)) { |
1257 |
die($res->getMessage()); |
die($res->getMessage()); |
|
else{ |
|
|
if ($DEBUG == 1) |
|
|
echo "La requête de mise à jour est effectuée.<br>"; |
|
1258 |
} |
} |
1259 |
|
// Affichage d'informations à l'utilisateur |
1260 |
|
$this->addToMessage(_("Suppression de l'instruction")." [".$db->affectedRows()." "._('enregistrement')." "._('mis_a_jour')."]"); |
1261 |
|
|
1262 |
} |
} |
1263 |
|
|
1264 |
|
function triggersupprimerapres($id,&$db,$val,$DEBUG) { |
1265 |
|
|
1266 |
|
// Mise à jour des données du dossier d'autorisation |
1267 |
|
require_once "../obj/dossier_autorisation.class.php"; |
1268 |
|
$da = new dossier_autorisation($this->getDossierAutorisationFromDossier($val["dossier"]), $this->db, DEBUG); |
1269 |
|
$da->majDossierAutorisation(); |
1270 |
|
} |
1271 |
|
|
1272 |
// ============================================= |
// ============================================= |
1273 |
// calcul de date avec ajout de mois (delais) |
// calcul de date avec ajout de mois (delais) |
1274 |
// [add months (delay) and calculation final date] |
// [add months (delay) and calculation final date] |
1323 |
// Vérifie la restriction sur l'événement |
// Vérifie la restriction sur l'événement |
1324 |
function verifier($val = array(), &$db, $DEBUG){ |
function verifier($val = array(), &$db, $DEBUG){ |
1325 |
parent::verifier($val, $db, $DEBUG); |
parent::verifier($val, $db, $DEBUG); |
|
//Récupère la restriction |
|
|
$sql= "SELECT |
|
|
restriction |
|
|
FROM |
|
|
".DB_PREFIXE."evenement |
|
|
WHERE |
|
|
evenement =".$this->valF['evenement']; |
|
1326 |
|
|
1327 |
$res = $db->query($sql); |
if ( isset($val['evenement']) && is_numeric($val['evenement'])){ |
1328 |
$this->f->addToLog("verifier(): db->query(\"".$sql."\");", VERBOSE_MODE); |
//Récupère la restriction |
1329 |
$this->f->isDatabaseError(); |
$sql= "SELECT |
1330 |
|
restriction |
1331 |
$row=& $res->fetchRow(DB_FETCHMODE_ASSOC); |
FROM |
1332 |
|
".DB_PREFIXE."evenement |
1333 |
//Test qu'une restriction est présente |
WHERE |
1334 |
if ( isset($row['restriction']) && $row['restriction'] != "" ){ |
evenement =".$val['evenement']; |
1335 |
|
|
1336 |
//Test si la restriction est valide |
$res = $db->query($sql); |
1337 |
if ( !$this->restrictionIsValid($row['restriction']) ){ |
$this->addToLog("verifier(): db->query(\"".$sql."\");", VERBOSE_MODE); |
1338 |
|
if (database::isError($res)) { |
1339 |
$this->correct=false; |
die($res->getMessage()); |
1340 |
$this->addToMessage(_("Restriction non valide")); |
} |
1341 |
} |
$row=& $res->fetchRow(DB_FETCHMODE_ASSOC); |
1342 |
else { |
|
1343 |
|
//Test qu'une restriction est présente |
1344 |
|
if ( isset($row['restriction']) && $row['restriction'] != "" ){ |
1345 |
|
|
1346 |
$this->correct = true; |
//Test si la restriction est valide |
1347 |
|
if ( !$this->restrictionIsValid($row['restriction']) ){ |
1348 |
|
|
1349 |
|
$this->correct=false; |
1350 |
|
$this->addToMessage(_("Restriction non valide")); |
1351 |
|
} |
1352 |
|
else { |
1353 |
|
|
1354 |
|
$this->correct = true; |
1355 |
|
} |
1356 |
} |
} |
1357 |
} |
} |
1358 |
|
|
1359 |
|
$this->updateDate("date_envoi_signature"); |
1360 |
|
$this->updateDate("date_retour_signature"); |
1361 |
|
$this->updateDate("date_envoi_rar"); |
1362 |
|
$this->updateDate("date_retour_rar"); |
1363 |
|
$this->updateDate("date_envoi_controle_legalite"); |
1364 |
|
$this->updateDate("date_retour_controle_legalite"); |
1365 |
} |
} |
1366 |
|
|
1367 |
/** |
/** |
1368 |
* Méthode permettant de mettre à jour l'état d'un DA |
* Méthode permettant de récupérer toutes les valeurs de l'événement |
1369 |
|
* sélectionné après validation du formulaire d'instruction |
1370 |
|
* |
1371 |
|
* @return array() veleurs de l'événement lié |
1372 |
*/ |
*/ |
|
function majEtatDA() { |
|
|
if($this->valF['action'] == 'accepter' AND $this->valF['avis_decision'] == 8) { |
|
|
$val['etat_dossier_autorisation']=5; |
|
|
} elseif($this->valF['action'] == 'accepter' AND $this->valF['avis_decision'] == 15) { |
|
|
$val['etat_dossier_autorisation']=3; |
|
|
} elseif($this->valF['action'] == 'accepter') { |
|
|
$val['etat_dossier_autorisation']=2; |
|
|
} elseif($this->valF['action'] == 'rejeter') { |
|
|
$val['etat_dossier_autorisation']=4; |
|
|
} elseif($this->valF['action'] == 'terminer') { |
|
|
$val['etat_dossier_autorisation']=8; |
|
|
} elseif($this->valF['action'] == 'majorer') { |
|
|
$val['etat_dossier_autorisation']=6; |
|
|
} else { |
|
|
$val['etat_dossier_autorisation']=7; |
|
|
} |
|
|
|
|
|
//Récupération du numéro de dossier d'autorisation lié au dossier d'instruction |
|
|
$IDdossier_autorisation = $this->getDossierAutorisation($this->valF['dossier']); |
|
|
|
|
|
// Mis à jour de l'état du dossier d'autorisation |
|
|
require_once '../obj/dossier_autorisation.class.php'; |
|
|
$dossier_autorisation = new dossier_autorisation($IDdossier_autorisation,$this->db,DEBUG); |
|
|
|
|
|
$dossier_autorisation->val[array_search("etat_dossier_autorisation", $dossier_autorisation->champs)] = $val['etat_dossier_autorisation']; |
|
|
|
|
|
//Récupération des données |
|
|
$valDossierAutorisation = array(); |
|
|
for ( $i=0 ; $i<count($dossier_autorisation->champs); $i++){ |
|
|
|
|
|
$valDossierAutorisation[$dossier_autorisation->champs[$i]]= |
|
|
$dossier_autorisation->val[$i]; |
|
|
} |
|
1373 |
|
|
1374 |
$dossier_autorisation->modifier($valDossierAutorisation, $this->db, DEBUG); |
private function getValEvenement() { |
1375 |
} |
if(!empty($this->valEvenement)) { |
1376 |
|
return $this->valEvenement; |
1377 |
/** |
} else { |
1378 |
* Méthode permettant de mettre à jour les données d'un DA |
$sql = "SELECT * FROM ".DB_PREFIXE."evenement |
1379 |
*/ |
WHERE evenement=".$this->valF['evenement']; |
1380 |
function majDataDA() { |
$res = $this->db->query($sql); |
1381 |
|
$this->addToLog("getValEvenement(): db->query(\"".$sql."\");", VERBOSE_MODE); |
1382 |
//Récupération du numéro de dossier d'autorisation lié au dossier d'instruction |
if (database::isError($res)) { |
1383 |
$IDdossier_autorisation = $this->getDossierAutorisation($this->valF['dossier']); |
die($res->getMessage()); |
|
require_once '../obj/dossier_autorisation.class.php'; |
|
|
$dossier_autorisation = new dossier_autorisation($IDdossier_autorisation,$this->db,DEBUG); |
|
|
|
|
|
require_once '../obj/dossier.class.php'; |
|
|
$dossier = new dossier($this->valF['dossier'],$this->db,DEBUG); |
|
|
|
|
|
//Récupération des données |
|
|
$valDossierAutorisation = array(); |
|
|
for ( $i=0 ; $i<count($dossier_autorisation->champs); $i++){ |
|
|
|
|
|
if ( array_search($dossier_autorisation->champs[$i], $dossier->champs) ){ |
|
|
|
|
|
$valDossierAutorisation[$dossier_autorisation->champs[$i]]=$dossier->getVal($dossier_autorisation->champs[$i]); |
|
|
} |
|
|
else { |
|
|
$valDossierAutorisation[$dossier_autorisation->champs[$i]]= |
|
|
$dossier_autorisation->val[$i]; |
|
1384 |
} |
} |
1385 |
|
$this->valEvenement = $res->fetchRow(DB_FETCHMODE_ASSOC); |
1386 |
|
return $this->valEvenement; |
1387 |
} |
} |
1388 |
|
} |
1389 |
|
|
1390 |
$dossier_autorisation->modifier($valDossierAutorisation, $this->db, DEBUG); |
/** |
1391 |
|
* Méthode permettant de savoir si le dossier lié à l'instruction à le flag |
1392 |
// Suppression du liens entre les lots et le DA |
* incompletude à true après validation du formulaire d'instruction |
1393 |
$valLot['dossier_autorisation'] = NULL; |
* |
1394 |
$this->db->autoExecute(DB_PREFIXE."lot", $valLot, DB_AUTOQUERY_UPDATE, "dossier_autorisation='".$IDdossier_autorisation."'"); |
* @return boolean |
1395 |
|
*/ |
1396 |
// Liaison des lots du DI avec le DA |
private function dossierIncomplet() { |
1397 |
$sqlLot = "SELECT lot FROM ".DB_PREFIXE."lien_dossier_lot WHERE dossier='".$this->valF['dossier']."'"; |
$sql = "SELECT incompletude FROM ".DB_PREFIXE."dossier |
1398 |
$res = $this->db->query($sqlLot); |
WHERE dossier='".$this->valF['dossier']."'"; |
1399 |
$this->addToLog($sqlLot); |
$incompletude = $this->db->getOne($sql); |
1400 |
$this->f->isDatabaseError(); |
$this->addToLog("dossierIncomplet(): db->query(\"".$sql."\");", VERBOSE_MODE); |
1401 |
while($rowLot = $res->fetchRow(DB_FETCHMODE_ASSOC)) { |
if (database::isError($incompletude)) { |
1402 |
$valLot['dossier_autorisation'] = $IDdossier_autorisation; |
die($incompletude->getMessage()); |
1403 |
$this->db->autoExecute(DB_PREFIXE."lot", $valLot, DB_AUTOQUERY_UPDATE, "lot=".$rowLot['lot']); |
} |
1404 |
|
if ($incompletude == 't') { |
1405 |
|
return true; |
1406 |
|
} else { |
1407 |
|
return false; |
1408 |
} |
} |
1409 |
} |
} |
1410 |
|
|
|
// Récupération de l'identifiant du dossier d'autorisation lié au dossier d'instruction |
|
|
function getDossierAutorisation($dossier_instruction){ |
|
|
|
|
|
$sql = "SELECT |
|
|
dossier_autorisation.dossier_autorisation |
|
|
FROM |
|
|
".DB_PREFIXE."dossier_autorisation |
|
|
LEFT JOIN |
|
|
".DB_PREFIXE."dossier |
|
|
ON |
|
|
dossier_autorisation.dossier_autorisation = dossier.dossier_autorisation |
|
|
WHERE |
|
|
dossier.dossier = '".$dossier_instruction."'"; |
|
|
|
|
|
$IDdossier_autorisation = $this->db->getOne($sql); |
|
|
$this->addToLog("getDossierAutorisation(): db->getone(\"".$sql."\")", VERBOSE_MODE); |
|
|
database::isError($IDdossier_autorisation); |
|
|
|
|
|
return $IDdossier_autorisation; |
|
|
} |
|
1411 |
}// fin classe |
}// fin classe |
1412 |
?> |
?> |