12 |
* var $idxformulaire; |
* var $idxformulaire; |
13 |
* - modification des données dans dossier trigger avant |
* - modification des données dans dossier trigger avant |
14 |
* [modify dossier data with trigger function] |
* [modify dossier data with trigger function] |
15 |
* - function moisdate : pour ajouter des mois a une date |
* - function mois_date : pour ajouter des mois a une date |
16 |
* [add months (delay) and calculation final date] |
* [add months (delay) and calculation final date] |
17 |
* - voir script_lang.js : bible ... |
* - voir script_lang.js : bible ... |
18 |
* |
* |
39 |
var $metadata = array( |
var $metadata = array( |
40 |
"om_fichier_instruction" => array( |
"om_fichier_instruction" => array( |
41 |
"dossier" => "getDossier", |
"dossier" => "getDossier", |
42 |
"dossier_autorisation" => "getDossierAutorisation", |
"dossier_version" => "getDossierVersion", |
43 |
"date_demande_initiale" => "getDateDemandeInitiale", |
"numDemandeAutor" => "getNumDemandeAutor", |
44 |
"dossier_instruction_type" => "getDossierInstructionType", |
"anneemoisDemandeAutor" => "getAnneemoisDemandeAutor", |
45 |
"statut" => "getStatut", |
"typeInstruction" => "getTypeInstruction", |
46 |
"dossier_autorisation_type" => "getDossierAutorisationType", |
"statutAutorisation" => "getStatutAutorisation", |
47 |
"date_creation" => "getDateEvenement", |
"typeAutorisation" => "getTypeAutorisation", |
48 |
"groupe_instruction" => 'getGroupeInstruction', |
"dateEvenementDocument" => "getDateEvenementDocument", |
49 |
), |
"groupeInstruction" => 'getGroupeInstruction', |
50 |
"document_arrete" => array( |
"title" => 'getTitle', |
|
"numArrete" => "getNumArrete", |
|
|
"specialiteArrete" => "getSpecialiteArrete", |
|
|
"decisionArrete" => "getDecisionArrete", |
|
|
"chketatReglementaire" => "getChketatReglementaire", |
|
|
"chkNotification" => "getChkNotification", |
|
|
"dateNotification" => "getDateNotification", |
|
|
"chkCreationdroit" => "getChkCreationdroit", |
|
|
"chkPublication" => "getChkPublication", |
|
|
"datePublication" => "getDatePublication", |
|
|
"chkControleLegalite" => "getChkControleLegalite", |
|
|
"dateSignatureArrete" => "getDateSignatureArrete", |
|
|
"nomSignataire" => "getNomSignataire", |
|
|
"qualiteSignataire" => "getQualiteSignataire", |
|
|
"chkDelegation" => "getChkDelegation", |
|
|
"ap_numRue" => "getAp_numRue", |
|
|
"ap_nomDeLaVoie" => "getAp_nomDeLaVoie", |
|
|
"ap_codePostal" => "getAp_codePostal", |
|
|
"ap_ville" => "getAp_ville", |
|
51 |
), |
), |
52 |
); |
); |
53 |
|
|
54 |
|
|
55 |
function instruction($id, &$db, $debug) { |
function __construct($id, &$db, $debug) { |
56 |
$this->constructeur($id, $db, $debug); |
$this->constructeur($id, $db, $debug); |
57 |
} |
} |
58 |
|
|
70 |
&& isset($this->f->om_utilisateur["division"]) |
&& isset($this->f->om_utilisateur["division"]) |
71 |
&& $this->f->om_utilisateur["division"] != $this->getDivisionFromDossier()) { |
&& $this->f->om_utilisateur["division"] != $this->getDivisionFromDossier()) { |
72 |
// |
// |
73 |
$this->actions_sup = array(); |
//On cache les liens d'action |
74 |
$this->setParameter("actions", array()); |
$this->parameters["actions"]["modifier"] = NULL; |
75 |
|
$this->parameters["actions"]["supprimer"] = NULL; |
76 |
|
$this->actions_sup["finalisation"] = NULL; |
77 |
} |
} |
78 |
// Si une action 'lu' est présente et que le champ lu est à true |
// Si une action 'lu' est présente et que le champ lu est à true |
79 |
// on supprime l'action |
// on supprime l'action |
89 |
if ( isset($this->actions_sup["finalisation"]) && |
if ( isset($this->actions_sup["finalisation"]) && |
90 |
$om_final_instruction== "t" ){ |
$om_final_instruction== "t" ){ |
91 |
|
|
92 |
|
//On cache les liens d'action |
93 |
|
$this->parameters["actions"]["modifier"] = NULL; |
94 |
|
$this->parameters["actions"]["supprimer"] = NULL; |
95 |
//On cache le lien de finalisation et on affiche le bon lien pour l'édition |
//On cache le lien de finalisation et on affiche le bon lien pour l'édition |
96 |
unset($this->actions_sup["finalisation"]); |
$this->actions_sup["finalisation"] = NULL; |
97 |
$this->actions_sup["pdfetat"]["lien"] = "../spg/file.php?id="; |
$this->actions_sup["pdfetat"]["lien"] = "../spg/file.php?id="; |
98 |
$this->actions_sup["pdfetat"]["id"] = |
$this->actions_sup["pdfetat"]["id"] = |
99 |
"&obj=instruction&champ=om_fichier_instruction"; |
"&obj=instruction&champ=om_fichier_instruction"; |
104 |
$om_final_instruction!= "t" ){ |
$om_final_instruction!= "t" ){ |
105 |
|
|
106 |
//On cache le lien de finalisation et on affiche le bon lien pour l'édition |
//On cache le lien de finalisation et on affiche le bon lien pour l'édition |
107 |
unset($this->actions_sup["definalisation"]); |
$this->actions_sup["definalisation"] = NULL; |
108 |
$this->actions_sup["pdfetat"]["lien"] = "../app/pdf_instruction.php?idx="; |
$this->actions_sup["pdfetat"]["lien"] = "../app/pdf_instruction.php?idx="; |
109 |
$this->actions_sup["pdfetat"]["id"] = ""; |
$this->actions_sup["pdfetat"]["id"] = ""; |
110 |
} |
} |
124 |
)){ |
)){ |
125 |
|
|
126 |
//On récuppère le statut du dossier d'instruction |
//On récuppère le statut du dossier d'instruction |
127 |
$statut = $this->getStatutDossier($idxformulaire); |
$statut = $this->getStatutAutorisationDossier($idxformulaire); |
128 |
if ( $this->f->isUserInstructeur() && $statut == "cloture" ){ |
// Si l'utilisateur est un instructeur, que le statut est clôturé |
129 |
|
// et que l'événement n'est pas identifié comme non verrouillable |
130 |
|
if ( $this->f->isUserInstructeur() && $statut == "cloture" |
131 |
|
&& $this->checkEvenementNonVerrouillable($this->getVal("instruction")) === false){ |
132 |
|
|
133 |
//On cache le lien de modification |
//On cache les liens du portlet |
134 |
$this->parameters["actions"]["modifier"] = NULL; |
$this->parameters["actions"]["modifier"] = NULL; |
135 |
$this->actions_sup["finalisation"] = NULL; |
$this->actions_sup["finalisation"] = NULL; |
136 |
$this->actions_sup["definalisation"] = NULL; |
$this->actions_sup["definalisation"] = NULL; |
154 |
} |
} |
155 |
|
|
156 |
$retourformulaire = $this->getParameter("retourformulaire"); |
$retourformulaire = $this->getParameter("retourformulaire"); |
157 |
// Si l'utilisateur est un instructeur et que le dossier est cloturé |
// Si l'utilisateur est un instructeur, que le dossier est cloturé, |
158 |
|
// que l'utilisateur est dans un sous formulaire précis, que le |
159 |
|
// formulaire n'est pas en mode consulter ou ajouter et que l'événement |
160 |
|
// n'est pas identifié comme non verrouillable |
161 |
if ( $this->f->isUserInstructeur() && |
if ( $this->f->isUserInstructeur() && |
162 |
$this->getStatutDossier($this->getParameter("idxformulaire")) == "cloture" && |
$this->getStatutAutorisationDossier($this->getParameter("idxformulaire")) == "cloture" |
163 |
( |
&& ( |
164 |
$retourformulaire == 'dossier' || |
$retourformulaire == 'dossier' || |
165 |
$retourformulaire == 'dossier_instruction' || |
$retourformulaire == 'dossier_instruction' || |
166 |
$retourformulaire == 'dossier_instruction_mes_encours' || |
$retourformulaire == 'dossier_instruction_mes_encours' || |
168 |
$retourformulaire == 'dossier_instruction_mes_clotures' || |
$retourformulaire == 'dossier_instruction_mes_clotures' || |
169 |
$retourformulaire == 'dossier_instruction_tous_clotures' |
$retourformulaire == 'dossier_instruction_tous_clotures' |
170 |
) |
) |
171 |
&& $this->getParameter("maj") != 3 && $this->getParameter("maj") != 0 ) { |
&& $this->getParameter("maj") != 3 |
172 |
|
&& $this->getParameter("maj") != 0 |
173 |
|
&& $this->checkEvenementNonVerrouillable($this->getVal("instruction")) === false) { |
174 |
|
|
175 |
return false; |
return false; |
176 |
} |
} |
177 |
// |
// |
239 |
/** |
/** |
240 |
* Cette méthode permet de récupérer le dossier d'autorisation d'un dossier |
* Cette méthode permet de récupérer le dossier d'autorisation d'un dossier |
241 |
*/ |
*/ |
242 |
function getDossierAutorisationFromDossier($id) { |
function getNumDemandeAutorFromDossier($id) { |
243 |
// |
// |
244 |
if (!isset($id)) { |
if (!isset($id)) { |
245 |
return NULL; |
return NULL; |
249 |
$sql .= " where dossier='".$id."'"; |
$sql .= " where dossier='".$id."'"; |
250 |
// |
// |
251 |
$dossier_autorisation = $this->db->getOne($sql); |
$dossier_autorisation = $this->db->getOne($sql); |
252 |
$this->addToLog("getDossierAutorisationFromDossier(): db->getone(\"".$sql."\")", VERBOSE_MODE); |
$this->addToLog("getNumDemandeAutorFromDossier(): db->getone(\"".$sql."\")", VERBOSE_MODE); |
253 |
database::isError($dossier_autorisation); |
database::isError($dossier_autorisation); |
254 |
// |
// |
255 |
return $dossier_autorisation; |
return $dossier_autorisation; |
262 |
parent::setType($form, $maj); |
parent::setType($form, $maj); |
263 |
// On cache tous les champs |
// On cache tous les champs |
264 |
// XXX |
// XXX |
265 |
$form->setType('complement3', 'hidden'); |
$form->setType('complement3_om_html', 'hidden'); |
266 |
$form->setType('bible3', 'hidden'); |
$form->setType('bible3', 'hidden'); |
267 |
$form->setType('complement4', 'hidden'); |
$form->setType('complement4_om_html', 'hidden'); |
268 |
$form->setType('bible4', 'hidden'); |
$form->setType('bible4', 'hidden'); |
269 |
$form->setType('complement5', 'hidden'); |
$form->setType('complement5_om_html', 'hidden'); |
270 |
$form->setType('bible5', 'hidden'); |
$form->setType('bible5', 'hidden'); |
271 |
$form->setType('complement6', 'hidden'); |
$form->setType('complement6_om_html', 'hidden'); |
272 |
$form->setType('bible6', 'hidden'); |
$form->setType('bible6', 'hidden'); |
273 |
$form->setType('complement7', 'hidden'); |
$form->setType('complement7_om_html', 'hidden'); |
274 |
$form->setType('bible7', 'hidden'); |
$form->setType('bible7', 'hidden'); |
275 |
$form->setType('complement8', 'hidden'); |
$form->setType('complement8_om_html', 'hidden'); |
276 |
$form->setType('bible8', 'hidden'); |
$form->setType('bible8', 'hidden'); |
277 |
$form->setType('complement9', 'hidden'); |
$form->setType('complement9_om_html', 'hidden'); |
278 |
$form->setType('bible9', 'hidden'); |
$form->setType('bible9', 'hidden'); |
279 |
$form->setType('complement10', 'hidden'); |
$form->setType('complement10_om_html', 'hidden'); |
280 |
$form->setType('bible10', 'hidden'); |
$form->setType('bible10', 'hidden'); |
281 |
$form->setType('complement11', 'hidden'); |
$form->setType('complement11_om_html', 'hidden'); |
282 |
$form->setType('bible11', 'hidden'); |
$form->setType('bible11', 'hidden'); |
283 |
$form->setType('complement12', 'hidden'); |
$form->setType('complement12_om_html', 'hidden'); |
284 |
$form->setType('bible12', 'hidden'); |
$form->setType('bible12', 'hidden'); |
285 |
$form->setType('complement13', 'hidden'); |
$form->setType('complement13_om_html', 'hidden'); |
286 |
$form->setType('bible13', 'hidden'); |
$form->setType('bible13', 'hidden'); |
287 |
$form->setType('complement14', 'hidden'); |
$form->setType('complement14_om_html', 'hidden'); |
288 |
$form->setType('bible14', 'hidden'); |
$form->setType('bible14', 'hidden'); |
289 |
$form->setType('complement15', 'hidden'); |
$form->setType('complement15_om_html', 'hidden'); |
290 |
$form->setType('bible15', 'hidden'); |
$form->setType('bible15', 'hidden'); |
291 |
// |
// |
292 |
$form->setType('delai', 'hidden'); |
$form->setType('delai', 'hidden'); |
295 |
$form->setType('action', 'hidden'); |
$form->setType('action', 'hidden'); |
296 |
$form->setType('delai_notification', 'hidden'); |
$form->setType('delai_notification', 'hidden'); |
297 |
$form->setType('avis_decision', 'hidden'); |
$form->setType('avis_decision', 'hidden'); |
298 |
|
$form->setType('autorite_competente', 'hidden'); |
299 |
// |
// |
300 |
$form->setType('archive_delai', 'hidden'); |
$form->setType('archive_delai', 'hidden'); |
301 |
$form->setType('archive_etat', 'hidden'); |
$form->setType('archive_etat', 'hidden'); |
310 |
$form->setType('archive_date_validite', 'hidden'); |
$form->setType('archive_date_validite', 'hidden'); |
311 |
$form->setType('archive_date_achevement', 'hidden'); |
$form->setType('archive_date_achevement', 'hidden'); |
312 |
$form->setType('archive_date_conformite', 'hidden'); |
$form->setType('archive_date_conformite', 'hidden'); |
313 |
$form->setType('archive_date_chantier', 'hidden'); |
$form->setType('archive_date_chantier', 'hidden'); |
314 |
|
$form->setType('archive_autorite_competente','hidden'); |
315 |
// |
// |
316 |
$form->setType('numero_arrete', 'hidden'); |
$form->setType('numero_arrete', 'hidden'); |
317 |
// |
// |
324 |
$form->setType('archive_etat_pendant_incompletude','hidden'); |
$form->setType('archive_etat_pendant_incompletude','hidden'); |
325 |
$form->setType('archive_date_limite_incompletude','hidden'); |
$form->setType('archive_date_limite_incompletude','hidden'); |
326 |
$form->setType('archive_delai_incompletude','hidden'); |
$form->setType('archive_delai_incompletude','hidden'); |
327 |
|
|
328 |
|
// |
329 |
|
$form->setType('duree_validite','hidden'); |
330 |
|
$form->setType('duree_validite_parametrage','hidden'); |
331 |
if ($maj < 2) { //ajouter et modifier |
if ($maj < 2) { //ajouter et modifier |
332 |
$form->setType('destinataire', 'hidden'); |
$form->setType('destinataire', 'hidden'); |
333 |
$form->setType('lettretype', 'hiddenstatic'); |
$form->setType('lettretype', 'hiddenstatic'); |
334 |
$form->setType('complement', 'textarea'); |
$form->setType('complement_om_html', 'html'); |
335 |
$form->setType('complement2', 'textarea'); |
$form->setType('complement2_om_html', 'html'); |
336 |
$form->setType('bible_auto', 'httpclick'); |
$form->setType('bible_auto', 'httpclick'); |
337 |
$form->setType('bible', 'httpclick'); |
$form->setType('bible', 'httpclick'); |
338 |
$form->setType('bible2', 'httpclick'); |
$form->setType('bible2', 'httpclick'); |
346 |
$form->setType('date_envoi_controle_legalite','datedisabled'); |
$form->setType('date_envoi_controle_legalite','datedisabled'); |
347 |
$form->setType('date_retour_controle_legalite','datedisabled'); |
$form->setType('date_retour_controle_legalite','datedisabled'); |
348 |
$form->setType('date_finalisation_courrier','datedisabled'); |
$form->setType('date_finalisation_courrier','datedisabled'); |
349 |
|
|
350 |
|
// l'administrateur peut modifier les champs de retour de date |
351 |
|
if ($this->f->user_is_admin == true) { |
352 |
|
$form->setType('date_retour_signature','date'); |
353 |
|
$form->setType('date_retour_rar','date'); |
354 |
|
$form->setType('date_retour_controle_legalite','date'); |
355 |
|
} |
356 |
|
|
357 |
if($maj==0){ // add |
if($maj==0){ // add |
358 |
$form->setType('instruction', 'hiddenstatic'); |
$form->setType('instruction', 'hiddenstatic'); |
359 |
$form->setType('evenement', 'select'); |
$form->setType('evenement', 'select'); |
383 |
$form->setType('om_fichier_instruction', 'hidden'); |
$form->setType('om_fichier_instruction', 'hidden'); |
384 |
$form->setType('om_final_instruction', 'hidden'); |
$form->setType('om_final_instruction', 'hidden'); |
385 |
// Cache le document arrêté |
// Cache le document arrêté |
386 |
$form->setType('document_arrete', 'hidden'); |
$form->setType('document_numerise', 'hidden'); |
387 |
|
|
388 |
|
//Masquer les champs date_envoi_controle_legalite et |
389 |
|
//date_retour_controle_legalite si ce n'est pas un arrêté |
390 |
|
if ( !is_numeric($this->getVal("avis_decision"))){ |
391 |
|
|
392 |
|
$form->setType("date_envoi_controle_legalite", "hidden"); |
393 |
|
$form->setType("date_retour_controle_legalite", "hidden"); |
394 |
|
} |
395 |
} |
} |
396 |
|
|
397 |
function setSelect(&$form, $maj,&$db,$debug) { |
function setSelect(&$form, $maj,&$db,$debug) { |
444 |
// du dossier d'instruction en cours |
// du dossier d'instruction en cours |
445 |
$sql = "SELECT |
$sql = "SELECT |
446 |
evenement.evenement, |
evenement.evenement, |
447 |
(evenement.libelle||' ['||evenement.action||']') as lib |
CONCAT(evenement.libelle, ' ['||evenement.action||']') as lib |
448 |
FROM ".DB_PREFIXE."dossier |
FROM ".DB_PREFIXE."dossier |
449 |
INNER JOIN ".DB_PREFIXE."lien_dossier_instruction_type_evenement |
INNER JOIN ".DB_PREFIXE."lien_dossier_instruction_type_evenement |
450 |
ON dossier.dossier_instruction_type=lien_dossier_instruction_type_evenement.dossier_instruction_type |
ON dossier.dossier_instruction_type=lien_dossier_instruction_type_evenement.dossier_instruction_type |
454 |
ON evenement.evenement = transition.evenement |
ON evenement.evenement = transition.evenement |
455 |
AND dossier.etat=transition.etat |
AND dossier.etat=transition.etat |
456 |
WHERE dossier.dossier='".$this->idxformulaire."' |
WHERE dossier.dossier='".$this->idxformulaire."' |
457 |
ORDER BY evenement.action"; |
ORDER BY evenement.libelle, evenement.action"; |
458 |
$res = $db->query($sql); |
$res = $db->query($sql); |
459 |
$this->addToLog("setSelect(): db->query(\"".$sql."\");", VERBOSE_MODE); |
$this->addToLog("setSelect(): db->query(\"".$sql."\");", VERBOSE_MODE); |
460 |
if (database::isError($res)) { |
if (database::isError($res)) { |
472 |
$form->setSelect("evenement", $contenu); |
$form->setSelect("evenement", $contenu); |
473 |
} else { |
} else { |
474 |
$sql = "SELECT |
$sql = "SELECT |
475 |
(evenement.libelle||' ['||evenement.action||']') as lib |
CONCAT(evenement.libelle, ' ['||evenement.action||']') as lib |
476 |
FROM ".DB_PREFIXE."evenement |
FROM ".DB_PREFIXE."evenement |
477 |
WHERE evenement.evenement=".$this->getVal("evenement").""; |
WHERE evenement.evenement=".$this->getVal("evenement").""; |
478 |
$res = $db->getone($sql); |
$res = $db->getone($sql); |
505 |
function cleSecondaire($id, &$db, $val, $DEBUG) { |
function cleSecondaire($id, &$db, $val, $DEBUG) { |
506 |
// |
// |
507 |
parent::cleSecondaire($id, $db, $val, $DEBUG); |
parent::cleSecondaire($id, $db, $val, $DEBUG); |
508 |
|
|
509 |
|
$id = $this->getVal($this->clePrimaire); |
510 |
|
|
511 |
/** |
|
512 |
* Vérification que l'élément supprimé est le dernier pour pouvoir |
//Requête de vérification que cet événement d'instruction n'est pas lié |
513 |
* remodifier les données de manière itérative. |
//à la création d'un dossier d'instruction |
514 |
*/ |
$sql = "SELECT demande_type.dossier_instruction_type |
515 |
// Initialisation |
FROM ".DB_PREFIXE."demande_type |
516 |
$dernierevenement = ""; |
LEFT JOIN ".DB_PREFIXE."demande |
517 |
// Récupération du dernier élément de la table d'instruction qui |
ON demande.demande_type = demande_type.demande_type |
518 |
// concerne le dossier en cours |
WHERE demande.instruction_recepisse = ".$id; |
519 |
$sql = "SELECT max(instruction) |
$res = $this->db->getOne($sql); |
520 |
FROM ".DB_PREFIXE."instruction |
$this->addToLog("cleSecondaire(): db->getone(\"".$sql."\");", VERBOSE_MODE); |
521 |
WHERE dossier ='".$this->idxformulaire."'"; |
if (database::isError($res)) { |
522 |
$dernierevenement = $db->getOne($sql); |
die($res->getMessage()); |
523 |
$this->addToLog("setSelect(): db->getone(\"".$sql."\");", VERBOSE_MODE); |
} |
524 |
if (database::isError($dernierevenement)) { |
|
525 |
die($dernierevenement->getMessage()); |
// Aucune clé secondaire n'a été trouvée ou c'est un événement sans |
526 |
} |
//création de dossier d'instruction, l'événement d'instruction peut être |
527 |
// Si on se trouve effectivement sur le dernier evenement d'instruction |
//supprimé |
528 |
if ($dernierevenement == $id) { |
if ( $this->correct !== false || $res == null || $res == ""){ |
529 |
// Alors on valide la suppression |
|
530 |
$this->correct = true; |
// Requête de vérification que cet événement d'instruction est lié |
531 |
$this->addToMessage(_('Destruction_chronologique')); |
// à une demande |
532 |
} else { |
$sql = "SELECT demande |
533 |
// Alors on annule la suppression |
FROM ".DB_PREFIXE."demande |
534 |
$this->correct = false; |
WHERE instruction_recepisse = ".$id; |
535 |
$this->addToMessage(_("Seul le dernier evenement d'instruction peut etre supprime.")); |
$res = $this->db->getOne($sql); |
536 |
|
$this->addToLog("cleSecondaire(): db->getone(\"".$sql."\");", VERBOSE_MODE); |
537 |
|
if (database::isError($res)) { |
538 |
|
die($res->getMessage()); |
539 |
|
} |
540 |
|
|
541 |
|
//Si c'est un événement d'instruction lié à une demande |
542 |
|
if ($res != null || $res != ""){ |
543 |
|
|
544 |
|
require_once "../obj/demande.class.php"; |
545 |
|
$demande = new demande($res, $this->db, DEBUG); |
546 |
|
|
547 |
|
//On met à jour la demande en supprimant la liaison vers |
548 |
|
//l'événement d'instruction |
549 |
|
$demande->setParameter("maj", 1); |
550 |
|
$valF = array(); |
551 |
|
foreach($demande->champs as $identifiant => $champ) { |
552 |
|
$valF[$champ] = $demande->val[$identifiant]; |
553 |
|
} |
554 |
|
$valF['date_demande']=$demande->dateDBToForm($valF['date_demande']); |
555 |
|
$valF['instruction_recepisse']=NULL; |
556 |
|
$ret = $demande->modifier($valF, $this->db, DEBUG); |
557 |
|
} |
558 |
|
|
559 |
|
/** |
560 |
|
* Vérification que l'élément supprimé est le dernier pour pouvoir |
561 |
|
* remodifier les données de manière itérative. |
562 |
|
*/ |
563 |
|
// Initialisation |
564 |
|
$dernierevenement = ""; |
565 |
|
// Récupération du dernier élément de la table d'instruction qui |
566 |
|
// concerne le dossier en cours |
567 |
|
$sql = "SELECT max(instruction) |
568 |
|
FROM ".DB_PREFIXE."instruction |
569 |
|
WHERE dossier ='".$this->idxformulaire."'"; |
570 |
|
$dernierevenement = $db->getOne($sql); |
571 |
|
$this->addToLog("setSelect(): db->getone(\"".$sql."\");", VERBOSE_MODE); |
572 |
|
if (database::isError($dernierevenement)) { |
573 |
|
die($dernierevenement->getMessage()); |
574 |
|
} |
575 |
|
// Si on se trouve effectivement sur le dernier evenement d'instruction |
576 |
|
if ($dernierevenement == $id) { |
577 |
|
// Alors on valide la suppression |
578 |
|
$this->correct = true; |
579 |
|
$this->addToMessage(_('Destruction_chronologique')); |
580 |
|
} else { |
581 |
|
// Alors on annule la suppression |
582 |
|
$this->correct = false; |
583 |
|
$this->addToMessage(_("Seul le dernier evenement d'instruction peut etre supprime.")); |
584 |
|
} |
585 |
} |
} |
586 |
} |
} |
587 |
|
|
588 |
// Vérification de la non modification des dates de suivi |
/** |
589 |
|
* Vérification de la possibilité ou non de modifier des dates de suivi |
590 |
|
* @param string $champ champ date à vérifier |
591 |
|
*/ |
592 |
function updateDate($champ) { |
function updateDate($champ) { |
593 |
if($this->valF[$champ] != "") { |
|
594 |
if($this->getVal($champ) != "" AND $this->getVal($champ) != $this->valF[$champ]) { |
//Si le retourformulaire est "dossier_instruction" |
595 |
$this->correct = false; |
if ($this->retourformulaire == "dossier_instruction") { |
596 |
$this->addToMessage(_("Les dates de suivis ne peuvent etre modifiees")); |
|
597 |
|
// Vérification de la possibilité de modifier les dates si déjà éditées |
598 |
|
if($this->valF[$champ] != "" AND !$this->f->user_is_admin) { |
599 |
|
// si l'utilisateur n'est pas un admin |
600 |
|
if($this->getVal($champ) != "" AND $this->getVal($champ) != $this->valF[$champ]) { |
601 |
|
$this->correct = false; |
602 |
|
$this->addToMessage(_("Les dates de suivis ne peuvent etre modifiees")); |
603 |
|
} |
604 |
} |
} |
605 |
} |
} |
606 |
|
|
607 |
|
// |
608 |
|
return true; |
609 |
} |
} |
610 |
|
|
611 |
// Sélectionne le signataire_arrete par défaut |
// Sélectionne le signataire_arrete par défaut |
621 |
|
|
622 |
// Exécution de la requête |
// Exécution de la requête |
623 |
$res = $this->f->db->query($sql); |
$res = $this->f->db->query($sql); |
624 |
$this->f->addToLog("deleteAllLienDossierInstructionTypeEvenementEvenement(): db->query(\"".$sql."\");", VERBOSE_MODE); |
$this->f->addToLog("setVal(): db->query(\"".$sql."\");", VERBOSE_MODE); |
625 |
if ( database::isError($res)){ |
if ( database::isError($res)){ |
626 |
die(); |
die(); |
627 |
} |
} |
674 |
|
|
675 |
$form->setBloc('date_retour_controle_legalite','F'); |
$form->setBloc('date_retour_controle_legalite','F'); |
676 |
|
|
677 |
$form->setBloc('complement','D',"","col_12"); |
$form->setBloc('complement_om_html','D',"","col_12"); |
678 |
$form->setFieldset('complement','D',_('Complement')); |
$form->setFieldset('complement_om_html','D',_('Complement')); |
679 |
$form->setFieldset('bible','F',''); |
$form->setFieldset('bible','F',''); |
680 |
$form->setBloc('bible','F'); |
$form->setBloc('bible','F'); |
681 |
|
|
682 |
$form->setBloc('complement2','D',"","col_12"); |
$form->setBloc('complement2_om_html','D',"","col_12"); |
683 |
$form->setFieldset('complement2','D',_('Complement 2')); |
$form->setFieldset('complement2_om_html','D',_('Complement 2')); |
684 |
$form->setFieldset('bible2','F',''); |
$form->setFieldset('bible2','F',''); |
685 |
$form->setBloc('bible2','F'); |
$form->setBloc('bible2','F'); |
686 |
} |
} |
707 |
* - avis_decision |
* - avis_decision |
708 |
* - delai_notification |
* - delai_notification |
709 |
* - lettretype |
* - lettretype |
710 |
|
* - autorite_competente |
711 |
* DEPUIS LE DOSSIER D'INSTRUCTION |
* DEPUIS LE DOSSIER D'INSTRUCTION |
712 |
* - archive_delai |
* - archive_delai |
713 |
* - archive_accord_tacite |
* - archive_accord_tacite |
722 |
* - date_achevement |
* - date_achevement |
723 |
* - date_chantier |
* - date_chantier |
724 |
* - date_conformite |
* - date_conformite |
725 |
|
* - avis_decision |
726 |
* Il permet également de stocker la date_depot du dossier d'instruction |
* Il permet également de stocker la date_depot du dossier d'instruction |
727 |
* dans l'attribut $this->archive_date_depot de la classe. |
* dans l'attribut $this->archive_date_depot de la classe. |
728 |
*/ |
*/ |
759 |
if(isset($row['avis_decision']) and !empty($row['avis_decision'])) { |
if(isset($row['avis_decision']) and !empty($row['avis_decision'])) { |
760 |
$this->valF['avis_decision']=$row['avis_decision']; |
$this->valF['avis_decision']=$row['avis_decision']; |
761 |
} |
} |
762 |
|
// Récupération de la valeur de l'autorité compétente |
763 |
|
// si l'autorité compétente est paramétré dans l'événement |
764 |
|
$this->valF['autorite_competente'] = NULL; |
765 |
|
if(isset($row['autorite_competente']) and !empty($row['autorite_competente'])) { |
766 |
|
$this->valF['autorite_competente']=$row['autorite_competente']; |
767 |
|
} |
768 |
// Récupération de la valeur de la lettre type |
// Récupération de la valeur de la lettre type |
769 |
// Sinon on lui affecte lavaleur par défaut standard |
// Sinon on lui affecte lavaleur par défaut standard |
770 |
if ($row['lettretype'] != "") { |
if ($row['lettretype'] != "") { |
781 |
if (database::isError($res)) { |
if (database::isError($res)) { |
782 |
die($res->getMessage()); |
die($res->getMessage()); |
783 |
} |
} |
784 |
while ($row=& $res->fetchRow(DB_FETCHMODE_ASSOC)) { |
$row=& $res->fetchRow(DB_FETCHMODE_ASSOC); |
785 |
// XXX On stocke la date de dépôt actuelle du dossier d'instruction |
$this->updateArchiveData($row); |
786 |
// dans un attribut de la classe |
$this->archive_date_depot = $row['date_depot']; |
787 |
$this->archive_date_depot = $row['date_depot']; |
|
788 |
// Récupération de la valeur actuelle du délai, de l'accord tacite, |
// Récupération de la duree de validite du dossier d'autorisation |
789 |
// de l'état et de l'avis du dossier d'instruction |
$sql = "SELECT duree_validite_parametrage |
790 |
$this->valF['archive_delai']=$row['delai']; |
FROM ".DB_PREFIXE."dossier_autorisation_type_detaille |
791 |
$this->valF['archive_accord_tacite']=$row['accord_tacite']; |
LEFT JOIN ".DB_PREFIXE."dossier_autorisation |
792 |
$this->valF['archive_etat']=$row['etat']; |
ON dossier_autorisation.dossier_autorisation_type_detaille = dossier_autorisation_type_detaille.dossier_autorisation_type_detaille |
793 |
$this->valF['archive_avis']=$row['avis_decision']; |
LEFT JOIN ".DB_PREFIXE."dossier |
794 |
// Récupération de la valeur actuelle des 9 dates du dossier |
ON dossier.dossier_autorisation = dossier_autorisation.dossier_autorisation |
795 |
// d'instruction |
WHERE dossier.dossier='".$this->valF['dossier']."'"; |
796 |
if ($row['date_complet'] != '') { |
$duree_validite_parametrage = $db->getOne($sql); |
797 |
$this->valF['archive_date_complet']=$row['date_complet']; |
$this->addToLog("triggerajouter(): db->getOne(\"".$sql."\");", VERBOSE_MODE); |
798 |
} |
database::isError($duree_validite_parametrage); |
799 |
if ($row['date_dernier_depot'] != '') { |
if ($duree_validite_parametrage != '') { |
800 |
$this->valF['archive_date_dernier_depot']=$row['date_dernier_depot']; |
$this->valF['duree_validite_parametrage']= $duree_validite_parametrage; |
|
} |
|
|
if ($row['date_rejet']!='') { |
|
|
$this->valF['archive_date_rejet']= $row['date_rejet']; |
|
|
} |
|
|
if ($row['date_limite']!='') { |
|
|
$this->valF['archive_date_limite']= $row['date_limite']; |
|
|
} |
|
|
if ($row['date_notification_delai']!='') { |
|
|
$this->valF['archive_date_notification_delai']= $row['date_notification_delai']; |
|
|
} |
|
|
if ($row['date_decision']!='') { |
|
|
$this->valF['archive_date_decision']= $row['date_decision']; |
|
|
} |
|
|
if ($row['date_validite']!='') { |
|
|
$this->valF['archive_date_validite']= $row['date_validite']; |
|
|
} |
|
|
if ($row['date_achevement']!='') { |
|
|
$this->valF['archive_date_achevement']= $row['date_achevement']; |
|
|
} |
|
|
if ($row['date_chantier']!='') { |
|
|
$this->valF['archive_date_chantier']= $row['date_chantier']; |
|
|
} |
|
|
if ($row['date_conformite']!='') { |
|
|
$this->valF['archive_date_conformite']= $row['date_conformite']; |
|
|
} |
|
|
if ($row['incompletude']!='') { |
|
|
$this->valF['archive_incompletude']= $row['incompletude']; |
|
|
} |
|
|
if ($row['evenement_suivant_tacite']!='') { |
|
|
$this->valF['archive_evenement_suivant_tacite']= $row['evenement_suivant_tacite']; |
|
|
} |
|
|
if ($row['evenement_suivant_tacite_incompletude']!='') { |
|
|
$this->valF['archive_evenement_suivant_tacite_incompletude']= $row['evenement_suivant_tacite_incompletude']; |
|
|
} |
|
|
if ($row['etat_pendant_incompletude']!='') { |
|
|
$this->valF['archive_etat_pendant_incompletude']= $row['etat_pendant_incompletude']; |
|
|
} |
|
|
if ($row['date_limite_incompletude']!='') { |
|
|
$this->valF['archive_date_limite_incompletude']= $row['date_limite_incompletude']; |
|
|
} |
|
|
if ($row['delai_incompletude']!='') { |
|
|
$this->valF['archive_delai_incompletude']= $row['delai_incompletude']; |
|
|
} |
|
801 |
} |
} |
802 |
|
|
803 |
// Identifiant du type de courrier |
// Identifiant du type de courrier |
810 |
// Test si une restriction est valide |
// Test si une restriction est valide |
811 |
// return boolean |
// return boolean |
812 |
function restrictionIsValid($restriction){ |
function restrictionIsValid($restriction){ |
813 |
|
|
814 |
|
// Liste des opérateurs possible |
815 |
|
$operateurs = array(">=", "<=", "+", "-"); |
816 |
|
// Liste des opérateurs avec espace |
817 |
|
$operateurs_blank = array(" >= ", " <= ", " + ", " - "); |
818 |
|
|
819 |
|
// Supprime tous les espaces de la chaîne de caractère |
820 |
|
$restriction = str_replace(' ', '', $restriction); |
821 |
|
|
822 |
/* Met des espace avant et après les opérateurs puis transforme la chaine en |
// Met des espace avant et après les opérateurs puis transforme la |
823 |
* un tableau */ |
// chaine en un tableau |
824 |
$tabRestriction = str_replace(">="," >= ", |
$tabRestriction = str_replace($operateurs, $operateurs_blank, |
825 |
str_replace("<="," <= ", |
$restriction); |
826 |
str_replace("-"," - ", |
$tabRestriction = explode(" ", $tabRestriction); |
827 |
str_replace("+"," + ",$restriction)))); |
|
828 |
$tabRestriction = explode( " ", $tabRestriction); |
// Tableau comprenant les résultat |
|
|
|
|
//Variables de résultat |
|
829 |
$res = array(); |
$res = array(); |
830 |
$i = 0; |
// Compteur pour les résultat |
831 |
$comp = ""; |
// commence à 1 car le 0 doit rester inchangé tout au long du traitement |
832 |
|
$j = 1; |
833 |
|
// Comparateur du calcul |
834 |
//Test que le tableau n'est pas vide |
$comparateur = ''; |
835 |
if ( count($tabRestriction) > 0 ){ |
// Booléen retourné |
836 |
|
$res_bool = true; |
837 |
$res[0] = $this->getRestrictionValue($tabRestriction[0]); |
|
838 |
|
// S'il y a un comparateur |
839 |
//Calcul des variables |
if (in_array(">=", $tabRestriction) |
840 |
for ( $j = 1 ; $j < count($tabRestriction) ; $j += 2 ) { |
|| in_array("<=", $tabRestriction)) { |
841 |
|
|
842 |
//Variable de comparaison |
// Si le tableau n'est pas vide |
843 |
if ( strcmp( ">=", $tabRestriction[$j] ) == 0 || |
if (count($tabRestriction) > 0) { |
844 |
strcmp( "<=", $tabRestriction[$j]) ==0 ){ |
|
845 |
|
// Boucle dans le tableau pour récupérer seulement les valeurs |
846 |
|
foreach ($tabRestriction as $key => $value) { |
847 |
|
|
848 |
$comp = $tabRestriction[$j]; |
// |
849 |
$res[++$i] = $this->getRestrictionValue($tabRestriction[$j+1]); |
if (!in_array($value, $operateurs)) { |
850 |
|
if ($this->getRestrictionValue($value) != false) { |
851 |
|
$res[] = $this->getRestrictionValue($value); |
852 |
|
} else { |
853 |
|
// Message d'erreur |
854 |
|
$error_message = sprintf(_("Le champ %s de l'instruction %s est vide"), "<span class='bold'>".$value."</span>", "<span class='bold'>".$this->valF["instruction"]."</span>"); |
855 |
|
$this->addToMessage($error_message); |
856 |
|
// Arrête le traitement |
857 |
|
return false; |
858 |
|
} |
859 |
|
} |
860 |
} |
} |
861 |
// Fait l'addition |
|
862 |
elseif ( strcmp( "+", $tabRestriction[$j]) == 0 ){ |
// Boucle dans le tableau |
863 |
|
// commence à 1 car le 0 doit rester inchangé tout au long du |
864 |
|
// traitement |
865 |
|
for ($i = 1; $i<count($tabRestriction); $i++) { |
866 |
|
|
867 |
$res[$i] = $this->moisdate( $res[$i], $this->getRestrictionValue($tabRestriction[$j+1]) ); |
// Récupère le comparateur |
868 |
|
if ($tabRestriction[$i] === ">=" |
869 |
|
|| $tabRestriction[$i] === "<=") { |
870 |
|
$comparateur = $tabRestriction[$i]; |
871 |
|
} |
872 |
|
|
873 |
|
// Si l'opérateur qui suit est un "+" |
874 |
|
if ($tabRestriction[$i] === "+") { |
875 |
|
$dateDep = $res[$j]; |
876 |
|
unset($res[$j]);$j++; |
877 |
|
$duree = $res[$j]; |
878 |
|
unset($res[$j]); |
879 |
|
$res[$j] = $this->f->mois_date($dateDep, $duree, "+"); |
880 |
|
} |
881 |
|
|
882 |
|
// Si l'opérateur qui suit est un "-" |
883 |
|
if ($tabRestriction[$i] === "-") { |
884 |
|
$dateDep = $res[$j]; |
885 |
|
unset($res[$j]);$j++; |
886 |
|
$duree = $res[$j]; |
887 |
|
unset($res[$j]); |
888 |
|
$res[$j] = $this->f->mois_date($dateDep, $duree, "-"); |
889 |
|
} |
890 |
} |
} |
|
} |
|
|
} |
|
|
|
|
|
// Effectue le test |
|
|
if ( strcmp($comp, ">=") == 0 ){ |
|
|
|
|
|
if ( $res[0] >= $res[1] || $res[0] == "" ){ |
|
891 |
|
|
|
return true; |
|
|
} |
|
|
else { |
|
|
|
|
|
return false; |
|
892 |
} |
} |
|
} |
|
|
elseif ( strcmp($comp, "<=") == 0 ){ |
|
893 |
|
|
894 |
if ( $res[0] <= $res[1] || $res[1] == "" ){ |
// Si les tableau des résultats n'est pas vide |
895 |
|
if (count($res) > 0) { |
896 |
|
// |
897 |
|
$res_bool = false; |
898 |
|
// Effectue le test |
899 |
|
if ($comparateur === ">=") { |
900 |
|
// |
901 |
|
if (strtotime($res[0]) >= strtotime($res[$j])) { |
902 |
|
$res_bool = true; |
903 |
|
} |
904 |
|
} |
905 |
|
if ($comparateur === "<=") { |
906 |
|
|
907 |
return true; |
if (strtotime($res[0]) <= strtotime($res[$j])) { |
908 |
|
$res_bool = true; |
909 |
|
} |
910 |
|
} |
911 |
} |
} |
912 |
else { |
// Sinon une erreur s'affiche |
913 |
|
} else { |
914 |
|
|
915 |
return false; |
// Message d'erreur |
916 |
} |
$error_message = _("La restriction est sans comparateur"); |
917 |
|
$this->addToMessage($error_message); |
918 |
|
// Arrête le traitement |
919 |
|
return false; |
920 |
} |
} |
921 |
|
|
922 |
return true; |
return $res_bool; |
923 |
|
|
924 |
} |
} |
925 |
|
|
926 |
//Retourne la valeur de valF si $restrictionValue n'est pas un chiffre, le chiffre sinon |
/** |
927 |
|
* Récupère la valeur du champ dans la restriction |
928 |
|
* @param string $restrictionValue Nom du champ |
929 |
|
* @return mixed Valeur du champ |
930 |
|
*/ |
931 |
function getRestrictionValue($restrictionValue){ |
function getRestrictionValue($restrictionValue){ |
932 |
|
|
933 |
return ( is_numeric($restrictionValue) ) ? |
// Initialisation de la valeur de retour |
934 |
$restrictionValue : |
$return = false; |
935 |
$this->valF[$restrictionValue]; |
|
936 |
|
// Récupére les valeurs du dossier |
937 |
|
$value_dossier = $this->get_dossier_actual(); |
938 |
|
|
939 |
|
// |
940 |
|
if (is_numeric($restrictionValue)) { |
941 |
|
$return = $restrictionValue; |
942 |
|
}elseif (isset($value_dossier[$restrictionValue])) { |
943 |
|
$return = $value_dossier[$restrictionValue]; |
944 |
|
}elseif (isset($this->valF[$restrictionValue])) { |
945 |
|
$return = $this->valF[$restrictionValue]; |
946 |
|
} |
947 |
|
|
948 |
|
// Retourne la valeur du champ |
949 |
|
return $return; |
950 |
} |
} |
951 |
|
|
952 |
function regle($regle){ |
/** |
953 |
$temp = explode ("+",$regle); |
* Calcul des règle d'action. |
954 |
//echo '|'.$regle; |
* @param string $rule Règle d'action |
955 |
// cas rejet |
* @param string $rule_name Nom de la règle |
956 |
if($regle=="null") // 1 dimension -> null |
* @param string $type Type de la règle |
957 |
|
* |
958 |
|
* @return mixed Résultat de la règle |
959 |
|
*/ |
960 |
|
function regle($rule, $rule_name, $type = null) { |
961 |
|
|
962 |
|
// Supprime tous les espaces de la chaîne de caractère |
963 |
|
$rule = str_replace(' ', '', $rule); |
964 |
|
// Coupe la chaîne au niveau de l'opérateur |
965 |
|
$operands = explode ("+", $rule); |
966 |
|
// Nombre d'opérande |
967 |
|
$nb_operands = count($operands); |
968 |
|
|
969 |
|
// Règle à null |
970 |
|
if ($rule == "null") { |
971 |
return null; |
return null; |
|
if(sizeof($temp)==1) // 1 dimension |
|
|
if($temp[0]=="archive_date_depot") // initialisation avec le depot |
|
|
return $this->$regle; |
|
|
else // cas general |
|
|
return $this->valF[$regle]; |
|
|
if(sizeof($temp)==2){ // 2 dimensions |
|
|
if($temp[0]=="archive_date_depot") //initialisation avec le depot |
|
|
if(is_numeric($temp[1])) |
|
|
return $this->moisdate($this->$temp[0], $temp[1]); |
|
|
else |
|
|
return $this->moisdate($this->$temp[0], $this->valF[$temp[1]]); |
|
|
if($temp[0]=="archive_delai") // majoration de delai |
|
|
return $this->valF[$temp[0]]+$this->valF[$temp[1]]; |
|
|
// cas general 2 dimensions |
|
|
if(is_numeric($temp[1])) |
|
|
return $this->moisdate($this->valF[$temp[0]], $temp[1]); |
|
|
else |
|
|
return $this->moisdate($this->valF[$temp[0]], $this->valF[$temp[1]]); |
|
|
} |
|
|
if(sizeof($temp)==3){ // 3 dimensions |
|
|
// cas date de validite de sursis |
|
|
if(is_numeric($temp[1])) |
|
|
$temp1 = $this->moisdate($this->valF[$temp[0]], $temp[1]); |
|
|
else |
|
|
$temp1 = $this->moisdate($this->valF[$temp[0]], $this->valF[$temp[1]]); |
|
|
if(is_numeric($temp[2])) |
|
|
return $this->moisdate($temp1, $temp[2]); |
|
|
else |
|
|
return $this->moisdate($temp1, $this->valF[$temp[2]]); |
|
972 |
} |
} |
973 |
|
|
974 |
|
// Si c'est une règle spécifique |
975 |
|
if ($rule_name == "regle_autorite_competente" |
976 |
|
|| $rule_name == "regle_etat" |
977 |
|
|| $rule_name == "regle_accord_tacite" |
978 |
|
|| $rule_name == "regle_avis") { |
979 |
|
// |
980 |
|
return $this->valF[$rule]; |
981 |
|
} |
982 |
|
|
983 |
|
// Tableau des champs de type date |
984 |
|
$rule_type_date = array( |
985 |
|
"regle_date_limite", |
986 |
|
"regle_date_notification_delai", |
987 |
|
"regle_date_complet", |
988 |
|
"regle_date_validite", |
989 |
|
"regle_date_decision", |
990 |
|
"regle_date_chantier", |
991 |
|
"regle_date_achevement", |
992 |
|
"regle_date_conformite", |
993 |
|
"regle_date_rejet", |
994 |
|
"regle_date_dernier_depot", |
995 |
|
"regle_date_limite_incompletude", |
996 |
|
); |
997 |
|
// Tableau des champs de type numérique |
998 |
|
$rule_type_numeric = array( |
999 |
|
"regle_delai", |
1000 |
|
"regle_delai_incompletude", |
1001 |
|
); |
1002 |
|
|
1003 |
|
// Définit le type du champ |
1004 |
|
if (in_array($rule_name, $rule_type_date) == true) { |
1005 |
|
$type = "date"; |
1006 |
|
} |
1007 |
|
if (in_array($rule_name, $rule_type_numeric) == true) { |
1008 |
|
$type = "numeric"; |
1009 |
|
} |
1010 |
|
|
1011 |
|
// Initialisation des variables |
1012 |
|
$key_date = 0; |
1013 |
|
$total_numeric = 0; |
1014 |
|
|
1015 |
|
// Pour chaque opérande |
1016 |
|
foreach ($operands as $key => $operand) { |
1017 |
|
|
1018 |
|
// Si c'est une règle de type date |
1019 |
|
if ($type == 'date') { |
1020 |
|
// Vérifie si au moins une des opérandes est une date |
1021 |
|
if (!is_numeric($operand) |
1022 |
|
&& isset($this->valF[$operand]) |
1023 |
|
&& $this->f->check_date($this->valF[$operand]) == true) { |
1024 |
|
// Récupère la position de la date |
1025 |
|
$key_date = $key; |
1026 |
|
} |
1027 |
|
// Les autres opérandes doivent être que des numériques |
1028 |
|
if (is_numeric($operand) == true) { |
1029 |
|
// Ajoute l'opérande au total |
1030 |
|
$total_numeric += $operand; |
1031 |
|
} |
1032 |
|
if (!is_numeric($operand) |
1033 |
|
&& isset($this->valF[$operand]) |
1034 |
|
&& is_numeric($this->valF[$operand]) == true) { |
1035 |
|
// Ajoute l'opérande au total |
1036 |
|
$total_numeric += $this->valF[$operand]; |
1037 |
|
} |
1038 |
|
} |
1039 |
|
|
1040 |
|
// Si c'est une règle de type numérique |
1041 |
|
if ($type == 'numeric') { |
1042 |
|
// Les opérandes doivent être que des numériques |
1043 |
|
if (is_numeric($operand) == true) { |
1044 |
|
// Ajoute l'opérande au total |
1045 |
|
$total_numeric += $operand; |
1046 |
|
} |
1047 |
|
if (!is_numeric($operand) |
1048 |
|
&& isset($this->valF[$operand]) |
1049 |
|
&& is_numeric($this->valF[$operand]) == true) { |
1050 |
|
// Ajoute l'opérande au total |
1051 |
|
$total_numeric += $this->valF[$operand]; |
1052 |
|
} |
1053 |
|
} |
1054 |
|
} |
1055 |
|
|
1056 |
|
// Résultat pour une règle de type date |
1057 |
|
if ($type == 'date') { |
1058 |
|
// Retourne le calcul de la date |
1059 |
|
return $this->f->mois_date($this->valF[$operands[$key_date]], |
1060 |
|
$total_numeric, "+"); |
1061 |
|
} |
1062 |
|
|
1063 |
|
// Résultat pour une règle de type numérique |
1064 |
|
if ($type == 'numeric') { |
1065 |
|
// Retourne le calcul |
1066 |
|
return $total_numeric; |
1067 |
|
} |
1068 |
|
|
1069 |
} |
} |
|
|
|
|
|
|
1070 |
|
|
1071 |
function triggerajouterapres($id,&$db,$val,$DEBUG) { |
function triggerajouterapres($id,&$db,$val,$DEBUG) { |
1072 |
/** |
/** |
1119 |
|
|
1120 |
// pour chacune des regles, on applique la regle |
// pour chacune des regles, on applique la regle |
1121 |
if($row['regle_delai']!=''){ |
if($row['regle_delai']!=''){ |
1122 |
$valF['delai'] = $this->regle($row['regle_delai']); |
$valF['delai'] = $this->regle($row['regle_delai'], 'regle_delai'); |
1123 |
} |
} |
1124 |
if($row['regle_accord_tacite']!=''){ |
if($row['regle_accord_tacite']!=''){ |
1125 |
$valF['accord_tacite'] = $this->regle($row['regle_accord_tacite']); |
$valF['accord_tacite'] = $this->regle($row['regle_accord_tacite'], 'regle_accord_tacite'); |
1126 |
} |
} |
1127 |
if($row['regle_avis']!=''){ |
if($row['regle_avis']!=''){ |
1128 |
$valF['avis_decision'] = $this->regle($row['regle_avis']); |
$valF['avis_decision'] = $this->regle($row['regle_avis'], 'regle_avis'); |
1129 |
} |
} |
1130 |
if($row['regle_date_limite']!=''){ |
if($row['regle_date_limite']!=''){ |
1131 |
$valF['date_limite']= $this->regle($row['regle_date_limite']); |
$valF['date_limite']= $this->regle($row['regle_date_limite'], 'regle_date_limite'); |
1132 |
} |
} |
1133 |
if($row['regle_date_complet']!=''){ |
if($row['regle_date_complet']!=''){ |
1134 |
$valF['date_complet']= $this->regle($row['regle_date_complet']); |
$valF['date_complet']= $this->regle($row['regle_date_complet'], 'regle_date_complet'); |
1135 |
} |
} |
1136 |
if($row['regle_date_dernier_depot']!=''){ |
if($row['regle_date_dernier_depot']!=''){ |
1137 |
$valF['date_dernier_depot']= $this->regle($row['regle_date_dernier_depot']); |
$valF['date_dernier_depot']= $this->regle($row['regle_date_dernier_depot'], 'regle_date_dernier_depot'); |
1138 |
} |
} |
1139 |
if($row['regle_date_notification_delai']!=''){ |
if($row['regle_date_notification_delai']!=''){ |
1140 |
$valF['date_notification_delai']= $this->regle($row['regle_date_notification_delai']); |
$valF['date_notification_delai']= $this->regle($row['regle_date_notification_delai'], 'regle_date_notification_delai'); |
1141 |
} |
} |
1142 |
if($row['regle_date_decision']!=''){ |
if($row['regle_date_decision']!=''){ |
1143 |
$valF['date_decision']= $this->regle($row['regle_date_decision']); |
$valF['date_decision']= $this->regle($row['regle_date_decision'], 'regle_date_decision'); |
1144 |
} |
} |
1145 |
if($row['regle_date_rejet']!=''){ |
if($row['regle_date_rejet']!=''){ |
1146 |
$valF['date_rejet']= $this->regle($row['regle_date_rejet']); |
$valF['date_rejet']= $this->regle($row['regle_date_rejet'], 'regle_date_rejet'); |
1147 |
} |
} |
1148 |
if($row['regle_date_validite']!=''){ |
if($row['regle_date_validite']!=''){ |
1149 |
$valF['date_validite']= $this->regle($row['regle_date_validite']); |
$valF['date_validite']= $this->regle($row['regle_date_validite'], 'regle_date_validite'); |
1150 |
} |
} |
1151 |
if($row['regle_date_chantier']!=''){ |
if($row['regle_date_chantier']!=''){ |
1152 |
$valF['date_chantier']= $this->regle($row['regle_date_chantier']); |
$valF['date_chantier']= $this->regle($row['regle_date_chantier'], 'regle_date_chantier'); |
1153 |
} |
} |
1154 |
if($row['regle_date_achevement']!=''){ |
if($row['regle_date_achevement']!=''){ |
1155 |
$valF['date_achevement']= $this->regle($row['regle_date_achevement']); |
$valF['date_achevement']= $this->regle($row['regle_date_achevement'], 'regle_date_achevement'); |
1156 |
} |
} |
1157 |
if($row['regle_date_conformite']!=''){ |
if($row['regle_date_conformite']!=''){ |
1158 |
$valF['date_conformite']= $this->regle($row['regle_date_conformite']); |
$valF['date_conformite']= $this->regle($row['regle_date_conformite'], 'regle_date_conformite'); |
1159 |
} |
} |
1160 |
if($row['regle_date_limite_incompletude']!=''){ |
if($row['regle_date_limite_incompletude']!=''){ |
1161 |
$valF['date_limite_incompletude']= $this->regle($row['regle_date_limite_incompletude']); |
$valF['date_limite_incompletude']= $this->regle($row['regle_date_limite_incompletude'], 'regle_date_limite_incompletude'); |
1162 |
} |
} |
1163 |
if($row['regle_delai_incompletude']!=''){ |
if($row['regle_delai_incompletude']!=''){ |
1164 |
$valF['delai_incompletude']= $this->regle($row['regle_delai_incompletude']); |
$valF['delai_incompletude']= $this->regle($row['regle_delai_incompletude'], 'regle_delai_incompletude'); |
1165 |
|
} |
1166 |
|
if($row['regle_autorite_competente']!=''){ |
1167 |
|
$valF['autorite_competente']= $this->regle($row['regle_autorite_competente'], 'regle_autorite_competente'); |
1168 |
} |
} |
1169 |
if($row['regle_etat']!=''){ |
if($row['regle_etat']!=''){ |
1170 |
// Si on est dans le cas général ou qu'on est en incomplétude et |
// Si on est dans le cas général ou qu'on est en incomplétude et |
1171 |
// qu'on a un événement de type incomplétude alors : on stocke |
// qu'on a un événement de type incomplétude alors : on stocke |
1172 |
// l'état dans la variable courante |
// l'état dans la variable courante |
1173 |
if ($incompletude == FALSE OR $this->valEvenement['type'] == "incompletude") { |
if ($incompletude == FALSE OR $this->valEvenement['type'] == "incompletude") { |
1174 |
$valF['etat'] = $this->regle($row['regle_etat']); |
$valF['etat'] = $this->regle($row['regle_etat'], 'regle_etat'); |
1175 |
} else { |
} else { |
1176 |
$valF['etat_pendant_incompletude'] = $this->regle($row['regle_etat']); |
$valF['etat_pendant_incompletude'] = $this->regle($row['regle_etat'], 'regle_etat'); |
1177 |
} |
} |
1178 |
} |
} |
|
|
|
1179 |
if($this->valEvenement['evenement_suivant_tacite'] != '') { |
if($this->valEvenement['evenement_suivant_tacite'] != '') { |
1180 |
// Si on est pas en incomplétude on stocke l'événement tacite |
// Si on est pas en incomplétude on stocke l'événement tacite |
1181 |
//de l'événement dans la variable courante |
//de l'événement dans la variable courante |
1248 |
|
|
1249 |
// Mise à jour des données du dossier d'autorisation |
// Mise à jour des données du dossier d'autorisation |
1250 |
require_once "../obj/dossier_autorisation.class.php"; |
require_once "../obj/dossier_autorisation.class.php"; |
1251 |
$da = new dossier_autorisation($this->getDossierAutorisationFromDossier($this->valF['dossier']), $this->db, DEBUG); |
$da = new dossier_autorisation($this->getNumDemandeAutorFromDossier($this->valF['dossier']), $this->db, DEBUG); |
1252 |
$da->majDossierAutorisation(); |
$da->majDossierAutorisation(); |
1253 |
} |
} |
1254 |
function triggermodifier($id,&$db,$val,$DEBUG) { |
|
|
// Ajout de l'arrêté dans la GED |
|
|
if ($this->valF['numero_arrete'] != $this->getVal('numero_arrete') |
|
|
AND $this->valF["om_fichier_instruction"] != "") { |
|
|
$file = $this->f->storage->get($this->valF["om_fichier_instruction"]); |
|
|
if(isset($file) and $file != null) { |
|
|
// Récupération des métadonnées calculées après validation |
|
|
$spe_metadata = $this->getMetadata("document_arrete"); |
|
|
$pdf_output = $file["file_content"]; |
|
|
//Métadonnées du document |
|
|
$metadata = array( |
|
|
'filename' => 'instruction_'.$this->valF[$this->clePrimaire].'.pdf', |
|
|
'mimetype' => 'application/pdf', |
|
|
'size' => strlen($pdf_output) |
|
|
); |
|
|
$metadata = array_merge($metadata, $spe_metadata); |
|
|
|
|
|
//Si le document a déjà été finalisé |
|
|
//on met à jour le document mais pas son uid |
|
|
if ( $this->getVal("document_arrete") != '' ){ |
|
|
$uid = $this->f->storage->update( |
|
|
$this->getVal("document_arrete"), $pdf_output, $metadata); |
|
|
} |
|
|
//Sinon, on joute le document et on récupère son uid |
|
|
else { |
|
|
//Stockage du PDF |
|
|
$uid = $this->f->storage->create($pdf_output, $metadata); |
|
|
} |
|
|
if($uid != OP_FAILURE) { |
|
|
$this->valF["document_arrete"] = $uid; |
|
|
} |
|
|
} |
|
|
|
|
|
} |
|
|
} |
|
1255 |
function triggermodifierapres($id,&$db,$val,$DEBUG) { |
function triggermodifierapres($id,&$db,$val,$DEBUG) { |
1256 |
/** |
/** |
1257 |
* L'objectif ici est d'effectuer les recalculs de date dans le dossier |
* L'objectif ici est d'effectuer les recalculs de date dans le dossier |
1259 |
*/ |
*/ |
1260 |
// Initialisation |
// Initialisation |
1261 |
$valF = ""; |
$valF = ""; |
1262 |
|
// Initialisation du type d'événement |
1263 |
|
$type_evmt = ""; |
1264 |
// Récupération de l'action correspondante à l'événement |
// Récupération de l'action correspondante à l'événement |
1265 |
$sql = "SELECT action |
$sql = "SELECT action |
1266 |
FROM ".DB_PREFIXE."evenement |
FROM ".DB_PREFIXE."evenement |
1271 |
die($action->getMessage()); |
die($action->getMessage()); |
1272 |
} |
} |
1273 |
|
|
|
// Récupération de tous les paramètres de l'événement sélectionné |
|
|
$sql = "SELECT * FROM ".DB_PREFIXE."evenement |
|
|
WHERE evenement=".$this->valF['evenement']; |
|
|
$res = $db->query($sql); |
|
|
$this->addToLog("triggerajouter(): db->query(\"".$sql."\");", VERBOSE_MODE); |
|
|
if (database::isError($res)) { |
|
|
die($res->getMessage()); |
|
|
} |
|
|
while ($row=& $res->fetchRow(DB_FETCHMODE_ASSOC)) { |
|
|
// Si la date de retour signature est éditée on vérifie si il existe un événement automatique |
|
|
if ($this->getVal('date_retour_signature') == "" AND |
|
|
$this->valF['date_retour_signature'] != "" AND |
|
|
$row['evenement_retour_signature'] != "") { |
|
|
$new_instruction = new instruction("]", $db, $DEBUG); |
|
|
// Création d'un tableau avec la liste des champs de l'instruction |
|
|
foreach($new_instruction->champs as $champ) { |
|
|
$valNewInstr[$champ] = ""; |
|
|
} |
|
|
// Définition des valeurs de la nouvelle instruction |
|
|
$valNewInstr["evenement"] = $row['evenement_retour_signature']; |
|
|
$valNewInstr["destinataire"] = $this->valF['destinataire']; |
|
|
$valNewInstr["dossier"] = $this->valF['dossier']; |
|
|
$valNewInstr["date_evenement"] = date("d/m/Y"); |
|
|
$new_instruction->ajouter($valNewInstr,$db, $DEBUG); |
|
|
} |
|
|
// Si la date de retour AR est éditée on vérifie si il existe un événement automatique |
|
|
if ($this->getVal('date_retour_rar') == "" AND |
|
|
$this->valF['date_retour_rar'] != "" AND |
|
|
$row['evenement_retour_ar'] != "" ) { |
|
|
$new_instruction = new instruction("]", $db, $DEBUG); |
|
|
// Création d'un tableau avec la liste des champs de l'instruction |
|
|
foreach($new_instruction->champs as $champ) { |
|
|
$valNewInstr[$champ] = ""; |
|
|
} |
|
|
// Définition des valeurs de la nouvelle instruction |
|
|
$valNewInstr["evenement"] = $row['evenement_retour_ar']; |
|
|
$valNewInstr["destinataire"] = $this->valF['destinataire']; |
|
|
$valNewInstr["dossier"] = $this->valF['dossier']; |
|
|
$valNewInstr["date_evenement"] = date("d/m/Y"); |
|
|
$new_instruction->ajouter($valNewInstr,$db, $DEBUG); |
|
|
} |
|
|
} |
|
|
|
|
1274 |
// Récupération des paramètres de l'action |
// Récupération des paramètres de l'action |
1275 |
$sql = "SELECT * FROM ".DB_PREFIXE."action |
$sql = "SELECT * FROM ".DB_PREFIXE."action |
1276 |
WHERE action='".$action."'"; |
WHERE action='".$action."'"; |
1282 |
while ($row=& $res->fetchRow(DB_FETCHMODE_ASSOC)){ |
while ($row=& $res->fetchRow(DB_FETCHMODE_ASSOC)){ |
1283 |
// application des regles sur le courrier + delai |
// application des regles sur le courrier + delai |
1284 |
if(preg_match("/date_evenement/",$row['regle_date_limite'])){ |
if(preg_match("/date_evenement/",$row['regle_date_limite'])){ |
1285 |
$valF['date_limite']= $this->regle($row['regle_date_limite']); |
$valF['date_limite']= $this->regle($row['regle_date_limite'], 'regle_date_limite'); |
1286 |
} |
} |
1287 |
if(preg_match("/date_evenement/",$row['regle_date_complet'])){ |
if(preg_match("/date_evenement/",$row['regle_date_complet'])){ |
1288 |
$valF['date_complet']= $this->regle($row['regle_date_complet']); |
$valF['date_complet']= $this->regle($row['regle_date_complet'], 'regle_date_complet'); |
1289 |
} |
} |
1290 |
if(preg_match("/date_evenement/",$row['regle_date_dernier_depot'])){ |
if(preg_match("/date_evenement/",$row['regle_date_dernier_depot'])){ |
1291 |
$valF['date_dernier_depot']= $this->regle($row['regle_date_dernier_depot']); |
$valF['date_dernier_depot']= $this->regle($row['regle_date_dernier_depot'], 'regle_date_dernier_depot'); |
1292 |
} |
} |
1293 |
if(preg_match("/date_evenement/",$row['regle_date_notification_delai'])){ |
if(preg_match("/date_evenement/",$row['regle_date_notification_delai'])){ |
1294 |
$valF['date_notification_delai']= $this->regle($row['regle_date_notification_delai']); |
$valF['date_notification_delai']= $this->regle($row['regle_date_notification_delai'], 'regle_date_notification_delai'); |
1295 |
} |
} |
1296 |
if(preg_match("/date_evenement/",$row['regle_date_decision'])){ |
if(preg_match("/date_evenement/",$row['regle_date_decision'])){ |
1297 |
$valF['date_decision']= $this->regle($row['regle_date_decision']); |
$valF['date_decision']= $this->regle($row['regle_date_decision'], 'regle_date_decision'); |
1298 |
} |
} |
1299 |
if(preg_match("/date_evenement/",$row['regle_date_rejet'])){ |
if(preg_match("/date_evenement/",$row['regle_date_rejet'])){ |
1300 |
$valF['date_rejet']= $this->regle($row['regle_date_rejet']); |
$valF['date_rejet']= $this->regle($row['regle_date_rejet'], 'regle_date_rejet'); |
1301 |
} |
} |
1302 |
if(preg_match("/date_evenement/",$row['regle_date_validite'])){ |
if(preg_match("/date_evenement/",$row['regle_date_validite'])){ |
1303 |
$valF['date_validite']= $this->regle($row['regle_date_validite']); |
$valF['date_validite']= $this->regle($row['regle_date_validite'], 'regle_date_validite'); |
1304 |
} |
} |
1305 |
if(preg_match("/date_evenement/",$row['regle_date_chantier'])){ |
if(preg_match("/date_evenement/",$row['regle_date_chantier'])){ |
1306 |
$valF['date_chantier']= $this->regle($row['regle_date_chantier']); |
$valF['date_chantier']= $this->regle($row['regle_date_chantier'], 'regle_date_chantier'); |
1307 |
} |
} |
1308 |
if(preg_match("/date_evenement/",$row['regle_date_achevement'])){ |
if(preg_match("/date_evenement/",$row['regle_date_achevement'])){ |
1309 |
$valF['date_achevement']= $this->regle($row['regle_date_achevement']); |
$valF['date_achevement']= $this->regle($row['regle_date_achevement'], 'regle_date_achevement'); |
1310 |
} |
} |
1311 |
if(preg_match("/date_evenement/",$row['regle_date_conformite'])){ |
if(preg_match("/date_evenement/",$row['regle_date_conformite'])){ |
1312 |
$valF['date_conformite']= $this->regle($row['regle_date_conformite']); |
$valF['date_conformite']= $this->regle($row['regle_date_conformite'], 'regle_date_conformite'); |
1313 |
} |
} |
1314 |
} |
} |
1315 |
// Si des valeurs ont été calculées alors on met à jour l'enregistrement |
// Si des valeurs ont été calculées alors on met à jour l'enregistrement |
1317 |
// On met à jour le dossier |
// On met à jour le dossier |
1318 |
$cle = " dossier='".$this->valF['dossier']."'"; |
$cle = " dossier='".$this->valF['dossier']."'"; |
1319 |
$res1 = $db->autoExecute(DB_PREFIXE.'dossier', $valF, DB_AUTOQUERY_UPDATE, $cle); |
$res1 = $db->autoExecute(DB_PREFIXE.'dossier', $valF, DB_AUTOQUERY_UPDATE, $cle); |
1320 |
$this->addToLog("triggerajouterapres(): db->autoexecute(\"".DB_PREFIXE."dossier\", ".print_r($valF, true).", DB_AUTOQUERY_UPDATE, \"".$cle."\");", VERBOSE_MODE); |
$this->addToLog("triggermodifierapres(): db->autoexecute(\"".DB_PREFIXE."dossier\", ".print_r($valF, true).", DB_AUTOQUERY_UPDATE, \"".$cle."\");", VERBOSE_MODE); |
1321 |
if (database::isError($res1)) { |
if (database::isError($res1)) { |
1322 |
die($res->getMessage()); |
die($res->getMessage()); |
1323 |
} |
} |
1325 |
$this->addToMessage(_('enregistrement')." ".$this->valF['dossier']." "._('table')." dossier [".$db->affectedRows()." "._('enregistrement')." "._('mis_a_jour')."]"); |
$this->addToMessage(_('enregistrement')." ".$this->valF['dossier']." "._('table')." dossier [".$db->affectedRows()." "._('enregistrement')." "._('mis_a_jour')."]"); |
1326 |
} |
} |
1327 |
|
|
1328 |
|
// Récupération de tous les paramètres de l'événement sélectionné |
1329 |
|
$sql = "SELECT * FROM ".DB_PREFIXE."evenement |
1330 |
|
WHERE evenement=".$this->valF['evenement']; |
1331 |
|
$res = $db->query($sql); |
1332 |
|
$this->addToLog("triggermodifierapres(): db->query(\"".$sql."\");", VERBOSE_MODE); |
1333 |
|
if (database::isError($res)) { |
1334 |
|
die($res->getMessage()); |
1335 |
|
} |
1336 |
|
while ($row=& $res->fetchRow(DB_FETCHMODE_ASSOC)) { |
1337 |
|
// Si la date de retour signature est éditée on vérifie si il existe un événement automatique |
1338 |
|
if ($this->getVal('date_retour_signature') == "" AND |
1339 |
|
$this->valF['date_retour_signature'] != "" AND |
1340 |
|
$row['evenement_retour_signature'] != "") { |
1341 |
|
$new_instruction = new instruction("]", $db, $DEBUG); |
1342 |
|
// Création d'un tableau avec la liste des champs de l'instruction |
1343 |
|
foreach($new_instruction->champs as $champ) { |
1344 |
|
$valNewInstr[$champ] = ""; |
1345 |
|
} |
1346 |
|
// Définition des valeurs de la nouvelle instruction |
1347 |
|
$valNewInstr["evenement"] = $row['evenement_retour_signature']; |
1348 |
|
$valNewInstr["destinataire"] = $this->valF['destinataire']; |
1349 |
|
$valNewInstr["dossier"] = $this->valF['dossier']; |
1350 |
|
$valNewInstr["date_evenement"] = $this->f->formatDate($this->valF['date_retour_signature']); |
1351 |
|
$valNewInstr["date_envoi_signature"] = $this->f->formatDate($this->valF['date_envoi_signature']); |
1352 |
|
$valNewInstr["date_retour_signature"] = $this->f->formatDate($this->valF['date_retour_signature']); |
1353 |
|
$valNewInstr["date_envoi_rar"] = $this->f->formatDate($this->valF['date_envoi_rar']); |
1354 |
|
$valNewInstr["date_retour_rar"] = $this->f->formatDate($this->valF['date_retour_rar']); |
1355 |
|
$valNewInstr["date_envoi_controle_legalite"] = $this->f->formatDate($this->valF['date_envoi_controle_legalite']); |
1356 |
|
$valNewInstr["date_retour_controle_legalite"] = $this->f->formatDate($this->valF['date_retour_controle_legalite']); |
1357 |
|
$new_instruction->ajouter($valNewInstr,$db, $DEBUG); |
1358 |
|
} |
1359 |
|
// Si la date de retour AR est éditée on vérifie si il existe un événement automatique |
1360 |
|
if ($this->getVal('date_retour_rar') == "" AND |
1361 |
|
$this->valF['date_retour_rar'] != "" AND |
1362 |
|
$row['evenement_retour_ar'] != "" ) { |
1363 |
|
$new_instruction = new instruction("]", $db, $DEBUG); |
1364 |
|
// Création d'un tableau avec la liste des champs de l'instruction |
1365 |
|
foreach($new_instruction->champs as $champ) { |
1366 |
|
$valNewInstr[$champ] = ""; |
1367 |
|
} |
1368 |
|
// Définition des valeurs de la nouvelle instruction |
1369 |
|
$valNewInstr["evenement"] = $row['evenement_retour_ar']; |
1370 |
|
$valNewInstr["destinataire"] = $this->valF['destinataire']; |
1371 |
|
$valNewInstr["dossier"] = $this->valF['dossier']; |
1372 |
|
$valNewInstr["date_evenement"] = $this->f->formatDate($this->valF['date_retour_rar']); |
1373 |
|
$valNewInstr["date_envoi_signature"] = $this->f->formatDate($this->valF['date_envoi_signature']); |
1374 |
|
$valNewInstr["date_retour_signature"] = $this->f->formatDate($this->valF['date_retour_signature']); |
1375 |
|
$valNewInstr["date_envoi_rar"] = $this->f->formatDate($this->valF['date_envoi_rar']); |
1376 |
|
$valNewInstr["date_retour_rar"] = $this->f->formatDate($this->valF['date_retour_rar']); |
1377 |
|
$valNewInstr["date_envoi_controle_legalite"] = $this->f->formatDate($this->valF['date_envoi_controle_legalite']); |
1378 |
|
$valNewInstr["date_retour_controle_legalite"] = $this->f->formatDate($this->valF['date_retour_controle_legalite']); |
1379 |
|
$new_instruction->ajouter($valNewInstr,$db, $DEBUG); |
1380 |
|
} |
1381 |
|
} |
1382 |
|
|
1383 |
/** |
/** |
1384 |
* REFERENTIEL ARRETE |
* REFERENTIEL ARRETE |
1385 |
*/ |
*/ |
1386 |
if ($this->f->getParameter('option_referentiel_arrete') != "") { |
// Si l'option référentiel arrêté est activé et l'événement est de type |
1387 |
|
// arrêté |
1388 |
|
if ($this->f->getParameter('option_referentiel_arrete') != "" AND |
1389 |
|
$type_evmt == "arrete") { |
1390 |
if ($this->valF['date_retour_signature'] != $this->getVal('date_retour_signature')) { |
if ($this->valF['date_retour_signature'] != $this->getVal('date_retour_signature')) { |
1391 |
$msgenque = new MessageEnqueuer(); |
$msgenque = new MessageEnqueuer(); |
1392 |
$sqlArrete = "SELECT instruction.signataire_arrete as \"ws_DA_In_Signataire\", |
$sqlArrete = "SELECT instruction.signataire_arrete as \"ws_DA_In_Signataire\", |
1399 |
'' as \"ws_DA_In_Sigle\", |
'' as \"ws_DA_In_Sigle\", |
1400 |
instruction.etat as \"ws_DA_In_Decision\", |
instruction.etat as \"ws_DA_In_Decision\", |
1401 |
dossier.date_depot as \"ws_DA_In_Dte_Depot_Dem\", |
dossier.date_depot as \"ws_DA_In_Dte_Depot_Dem\", |
1402 |
dossier.terrain_numero as \"ws_DA_In_N_Voie\", |
dossier.terrain_adresse_voie_numero as \"ws_DA_In_N_Voie\", |
1403 |
'' as \"ws_DA_In_Type_Voie\", |
'' as \"ws_DA_In_Type_Voie\", |
1404 |
dossier.complement as \"ws_DA_In_Adresse1\", |
dossier.terrain_adresse_voie as \"ws_DA_In_Adresse1\", |
1405 |
dossier.terrain_adresse_lieu_dit as \"ws_DA_In_Adresse2\", |
dossier.terrain_adresse_lieu_dit as \"ws_DA_In_Adresse2\", |
1406 |
dossier.terrain_adresse_code_postal as \"ws_DA_In_CP\", |
dossier.terrain_adresse_code_postal as \"ws_DA_In_CP\", |
1407 |
dossier.terrain_adresse_localite as \"ws_DA_In_Ville\", |
dossier.terrain_adresse_localite as \"ws_DA_In_Ville\", |
1432 |
donnees_techniques.dossier_instruction = dossier.dossier |
donnees_techniques.dossier_instruction = dossier.dossier |
1433 |
WHERE instruction.instruction = ".$this->valF['instruction']; |
WHERE instruction.instruction = ".$this->valF['instruction']; |
1434 |
$resArrete = $this->db->query($sqlArrete); |
$resArrete = $this->db->query($sqlArrete); |
1435 |
$this->f->addToLog("triggerModifierApres(): db->query(\"".$sqlArrete."\");", VERBOSE_MODE); |
$this->f->addToLog("triggermodifierapres(): db->query(\"".$sqlArrete."\");", VERBOSE_MODE); |
1436 |
if ( database::isError($resArrete)){ |
if ( database::isError($resArrete)){ |
1437 |
die(); |
die(); |
1438 |
} |
} |
1445 |
|
|
1446 |
// Mise à jour des données du dossier d'autorisation |
// Mise à jour des données du dossier d'autorisation |
1447 |
require_once "../obj/dossier_autorisation.class.php"; |
require_once "../obj/dossier_autorisation.class.php"; |
1448 |
$da = new dossier_autorisation($this->getDossierAutorisationFromDossier($this->valF['dossier']), $this->db, DEBUG); |
$da = new dossier_autorisation($this->getNumDemandeAutorFromDossier($this->valF['dossier']), $this->db, DEBUG); |
1449 |
$da->majDossierAutorisation(); |
$da->majDossierAutorisation(); |
1450 |
} |
} |
1451 |
|
|
|
/** |
|
|
* Méthode de récupération des métadonnées arrêtés dans la base de données, |
|
|
* les données sont stockés dans l'attribut $this->metadonneesArrete |
|
|
*/ |
|
|
function getArreteMetadata() { |
|
|
$sqlArrete = "SELECT signataire_arrete.nom as \"nomsignataire\", |
|
|
signataire_arrete.qualite as \"qualitesignataire\", |
|
|
instruction.date_evenement as \"datesignaturearrete\", |
|
|
instruction.etat as \"decisionarrete\", |
|
|
dossier.terrain_adresse_voie_numero as \"ap_numrue\", |
|
|
dossier.complement as \"ap_nomdelavoie\", |
|
|
dossier.terrain_adresse_code_postal as \"ap_codepostal\", |
|
|
dossier.terrain_adresse_localite as \"ap_ville\" |
|
|
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."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); |
|
|
if ( database::isError($resArrete)){ |
|
|
die(); |
|
|
} |
|
|
|
|
|
$this->metadonneesArrete = $resArrete->fetchRow(DB_FETCHMODE_ASSOC); |
|
|
} |
|
|
|
|
|
// {{{ |
|
|
// Méthodes de récupération des métadonnées arrêté |
|
|
/** |
|
|
* @return string Retourne le numéro d'arrêté |
|
|
*/ |
|
|
function getNumArrete() { |
|
|
return $this->valF['numero_arrete']; |
|
|
} |
|
|
/** |
|
|
* @return string ads |
|
|
*/ |
|
|
function getSpecialiteArrete() { |
|
|
return "ADS"; |
|
|
} |
|
|
/** |
|
|
* @return string decision |
|
|
*/ |
|
|
function getDecisionArrete() { |
|
|
if (empty($this->metadonneesArrete)) { |
|
|
$this->getArreteMetadata(); |
|
|
} |
|
|
return $this->metadonneesArrete["decisionarrete"]; |
|
|
} |
|
|
/** |
|
|
* @return chaîne vide |
|
|
*/ |
|
|
function getChketatReglementaire() { |
|
|
return ""; |
|
|
} |
|
|
/** |
|
|
* @return boolean de notification au pétitionnaire |
|
|
*/ |
|
|
function getChkNotification() { |
|
|
if( isset($this->valF["date_retour_rar"]) ) { |
|
|
return true; |
|
|
} else { |
|
|
return false; |
|
|
} |
|
|
} |
|
|
/** |
|
|
* @return date de notification au pétitionnaire |
|
|
*/ |
|
|
function getDateNotification() { |
|
|
return date("d/m/Y", strtotime($this->valF["date_retour_rar"])); |
|
|
} |
|
|
/** |
|
|
* @return chaîne vide |
|
|
*/ |
|
|
function getChkCreationdroit() { |
|
|
return ""; |
|
|
} |
|
|
/** |
|
|
* @return chaîne vide |
|
|
*/ |
|
|
function getChkPublication() { |
|
|
return ""; |
|
|
} |
|
|
/** |
|
|
* @return chaîne vide |
|
|
*/ |
|
|
function getDatePublication() { |
|
|
return ""; |
|
|
} |
|
|
/** |
|
|
* @return boolean check si le document est passé au contrôle de légalité |
|
|
*/ |
|
|
function getChkControleLegalite() { |
|
|
if( isset($this->valF["date_retour_controle_legalite"]) ) { |
|
|
return true; |
|
|
} else { |
|
|
return false; |
|
|
} |
|
|
} |
|
|
/** |
|
|
* @return date de signature de l'arrêté |
|
|
*/ |
|
|
function getDateSignatureArrete() { |
|
|
return date("d/m/Y", strtotime($this->valF['date_retour_signature'])); |
|
|
} |
|
|
/** |
|
|
* @return string nom du signataire |
|
|
*/ |
|
|
function getNomSignataire() { |
|
|
if (empty($this->metadonneesArrete)) { |
|
|
$this->getArreteMetadata(); |
|
|
} |
|
|
return $this->metadonneesArrete["nomsignataire"]; |
|
|
} |
|
|
/** |
|
|
* @return string qualité du signataire |
|
|
*/ |
|
|
function getQualiteSignataire() { |
|
|
if (empty($this->metadonneesArrete)) { |
|
|
$this->getArreteMetadata(); |
|
|
} |
|
|
return $this->metadonneesArrete["qualitesignataire"]; |
|
|
} |
|
|
/** |
|
|
* @return string chaîne vide |
|
|
*/ |
|
|
function getChkDelegation() { |
|
|
return ""; |
|
|
} |
|
|
/** |
|
|
* @return string numéro du terrain |
|
|
*/ |
|
|
function getAp_numRue() { |
|
|
if (empty($this->metadonneesArrete)) { |
|
|
$this->getArreteMetadata(); |
|
|
} |
|
|
return $this->metadonneesArrete["ap_numrue"]; |
|
|
} |
|
|
/** |
|
|
* @return string nom de la rue du terrain |
|
|
*/ |
|
|
function getAp_nomDeLaVoie() { |
|
|
if (empty($this->metadonneesArrete)) { |
|
|
$this->getArreteMetadata(); |
|
|
} |
|
|
return $this->metadonneesArrete["ap_nomdelavoie"]; |
|
|
} |
|
|
/** |
|
|
* @return string code postal du terrain |
|
|
*/ |
|
|
function getAp_codePostal() { |
|
|
if (empty($this->metadonneesArrete)) { |
|
|
$this->getArreteMetadata(); |
|
|
} |
|
|
return $this->metadonneesArrete["ap_codepostal"]; |
|
|
} |
|
|
/** |
|
|
* @return string ville du terrain |
|
|
*/ |
|
|
function getAp_ville() { |
|
|
if (empty($this->metadonneesArrete)) { |
|
|
$this->getArreteMetadata(); |
|
|
} |
|
|
return $this->metadonneesArrete["ap_ville"]; |
|
|
} |
|
|
|
|
|
// Fin des méthodes de récupération des métadonnées |
|
|
// }}} |
|
|
|
|
1452 |
function triggersupprimer($id,&$db,$val,$DEBUG) { |
function triggersupprimer($id,&$db,$val,$DEBUG) { |
1453 |
/** |
/** |
1454 |
* L'objectif ici est de repositionner les valeurs récupérées en |
* L'objectif ici est de repositionner les valeurs récupérées en |
1455 |
* archive dans le dossier d'instruction avant de supprimer l'événement |
* archive dans le dossier d'instruction avant de supprimer l'événement |
1456 |
* d'instruction |
* d'instruction |
1457 |
*/ |
*/ |
1458 |
// Mise à jour des 4 valeurs modifiées par l'action |
|
1459 |
$valF['delai'] = $val['archive_delai']; |
// Mise à jour des 4 valeurs modifiées par l'action |
1460 |
$valF['accord_tacite'] = $val['archive_accord_tacite']; |
$valF['delai'] = $val['archive_delai']; |
1461 |
$valF['etat'] = $val['archive_etat']; |
$valF['accord_tacite'] = $val['archive_accord_tacite']; |
1462 |
if ($val['archive_avis'] != '') { |
$valF['etat'] = $val['archive_etat']; |
1463 |
$valF['avis_decision'] = $val['archive_avis']; |
if ($val['archive_avis'] != '') { |
1464 |
} else { |
$valF['avis_decision'] = $val['archive_avis']; |
1465 |
$valF['avis_decision'] = NULL; |
} else { |
1466 |
} |
$valF['avis_decision'] = NULL; |
1467 |
// Mise à jour des 10 dates avec la valeur présente dans le formulaire |
} |
1468 |
// de suppression. Si la valeur de la date est vide alors on fixe |
// Mise à jour des 10 dates avec la valeur présente dans le formulaire |
1469 |
// à la valeur NULL |
// de suppression. Si la valeur de la date est vide alors on fixe |
1470 |
// |
// à la valeur NULL |
1471 |
if ($val['archive_date_complet'] != '') { |
// |
1472 |
$valF['date_complet'] = $val['archive_date_complet']; |
if ($val['archive_date_complet'] != '') { |
1473 |
} else { |
$valF['date_complet'] = $val['archive_date_complet']; |
1474 |
$valF['date_complet'] = NULL; |
} else { |
1475 |
} |
$valF['date_complet'] = NULL; |
1476 |
if ($val['archive_date_dernier_depot'] != '') { |
} |
1477 |
$valF['date_dernier_depot'] = $val['archive_date_dernier_depot']; |
if ($val['archive_date_dernier_depot'] != '') { |
1478 |
} else { |
$valF['date_dernier_depot'] = $val['archive_date_dernier_depot']; |
1479 |
$valF['date_dernier_depot'] = NULL; |
} else { |
1480 |
} |
$valF['date_dernier_depot'] = NULL; |
1481 |
if ($val['archive_date_rejet'] != '') { |
} |
1482 |
$valF['date_rejet'] = $val['archive_date_rejet']; |
if ($val['archive_date_rejet'] != '') { |
1483 |
} else { |
$valF['date_rejet'] = $val['archive_date_rejet']; |
1484 |
$valF['date_rejet'] = NULL; |
} else { |
1485 |
} |
$valF['date_rejet'] = NULL; |
1486 |
if ($val['archive_date_limite'] != '') { |
} |
1487 |
$valF['date_limite'] = $val['archive_date_limite']; |
if ($val['archive_date_limite'] != '') { |
1488 |
} else { |
$valF['date_limite'] = $val['archive_date_limite']; |
1489 |
$valF['date_limite'] = NULL; |
} else { |
1490 |
} |
$valF['date_limite'] = NULL; |
1491 |
if ($val['archive_date_notification_delai'] != '') { |
} |
1492 |
$valF['date_notification_delai'] = $val['archive_date_notification_delai']; |
if ($val['archive_date_notification_delai'] != '') { |
1493 |
} else { |
$valF['date_notification_delai'] = $val['archive_date_notification_delai']; |
1494 |
$valF['date_notification_delai'] = NULL; |
} else { |
1495 |
} |
$valF['date_notification_delai'] = NULL; |
1496 |
if ($val['archive_date_decision'] != '') { |
} |
1497 |
$valF['date_decision'] = $val['archive_date_decision']; |
if ($val['archive_date_decision'] != '') { |
1498 |
} else { |
$valF['date_decision'] = $val['archive_date_decision']; |
1499 |
$valF['date_decision'] = NULL; |
} else { |
1500 |
} |
$valF['date_decision'] = NULL; |
1501 |
if ($val['archive_date_validite'] != '') { |
} |
1502 |
$valF['date_validite'] = $val['archive_date_validite']; |
if ($val['archive_date_validite'] != '') { |
1503 |
} else { |
$valF['date_validite'] = $val['archive_date_validite']; |
1504 |
$valF['date_validite'] = NULL; |
} else { |
1505 |
} |
$valF['date_validite'] = NULL; |
1506 |
if ($val['archive_date_achevement'] != '') { |
} |
1507 |
$valF['date_achevement'] = $val['archive_date_achevement']; |
if ($val['archive_date_achevement'] != '') { |
1508 |
} else { |
$valF['date_achevement'] = $val['archive_date_achevement']; |
1509 |
$valF['date_achevement'] = NULL; |
} else { |
1510 |
} |
$valF['date_achevement'] = NULL; |
1511 |
if ($val['archive_date_chantier'] != '') { |
} |
1512 |
$valF['date_chantier'] = $val['archive_date_chantier']; |
if ($val['archive_date_chantier'] != '') { |
1513 |
} else { |
$valF['date_chantier'] = $val['archive_date_chantier']; |
1514 |
$valF['date_chantier'] = NULL; |
} else { |
1515 |
} |
$valF['date_chantier'] = NULL; |
1516 |
if ($val['archive_date_conformite'] != '') { |
} |
1517 |
$valF['date_conformite'] = $val['archive_date_conformite']; |
if ($val['archive_date_conformite'] != '') { |
1518 |
} else { |
$valF['date_conformite'] = $val['archive_date_conformite']; |
1519 |
$valF['date_conformite'] = NULL; |
} else { |
1520 |
} |
$valF['date_conformite'] = NULL; |
1521 |
if ($val['archive_incompletude'] != '') { |
} |
1522 |
$valF['incompletude'] = $val['archive_incompletude']; |
if ($val['archive_incompletude'] != '') { |
1523 |
} else { |
$valF['incompletude'] = $val['archive_incompletude']; |
1524 |
$valF['incompletude'] = NULL; |
} else { |
1525 |
} |
$valF['incompletude'] = NULL; |
1526 |
if ($val['archive_evenement_suivant_tacite'] != '') { |
} |
1527 |
$valF['evenement_suivant_tacite'] = $val['archive_evenement_suivant_tacite']; |
if ($val['archive_evenement_suivant_tacite'] != '') { |
1528 |
} else { |
$valF['evenement_suivant_tacite'] = $val['archive_evenement_suivant_tacite']; |
1529 |
$valF['evenement_suivant_tacite'] = NULL; |
} else { |
1530 |
} |
$valF['evenement_suivant_tacite'] = NULL; |
1531 |
if ($val['archive_evenement_suivant_tacite_incompletude'] != '') { |
} |
1532 |
$valF['evenement_suivant_tacite_incompletude'] = $val['archive_evenement_suivant_tacite_incompletude']; |
if ($val['archive_evenement_suivant_tacite_incompletude'] != '') { |
1533 |
} else { |
$valF['evenement_suivant_tacite_incompletude'] = $val['archive_evenement_suivant_tacite_incompletude']; |
1534 |
$valF['evenement_suivant_tacite_incompletude'] = NULL; |
} else { |
1535 |
} |
$valF['evenement_suivant_tacite_incompletude'] = NULL; |
1536 |
if ($val['archive_etat_pendant_incompletude'] != '') { |
} |
1537 |
$valF['etat_pendant_incompletude'] = $val['archive_etat_pendant_incompletude']; |
if ($val['archive_etat_pendant_incompletude'] != '') { |
1538 |
} else { |
$valF['etat_pendant_incompletude'] = $val['archive_etat_pendant_incompletude']; |
1539 |
$valF['etat_pendant_incompletude'] = NULL; |
} else { |
1540 |
} |
$valF['etat_pendant_incompletude'] = NULL; |
1541 |
if ($val['archive_date_limite_incompletude'] != '') { |
} |
1542 |
$valF['date_limite_incompletude'] = $val['archive_date_limite_incompletude']; |
if ($val['archive_date_limite_incompletude'] != '') { |
1543 |
} else { |
$valF['date_limite_incompletude'] = $val['archive_date_limite_incompletude']; |
1544 |
$valF['date_limite_incompletude'] = NULL; |
} else { |
1545 |
} |
$valF['date_limite_incompletude'] = NULL; |
1546 |
if ($val['archive_delai_incompletude'] != '') { |
} |
1547 |
$valF['delai_incompletude'] = $val['archive_delai_incompletude']; |
if ($val['archive_delai_incompletude'] != '') { |
1548 |
} else { |
$valF['delai_incompletude'] = $val['archive_delai_incompletude']; |
1549 |
$valF['delai_incompletude'] = NULL; |
} else { |
1550 |
} |
$valF['delai_incompletude'] = NULL; |
1551 |
// On met à jour le dossier |
} |
1552 |
$cle = " dossier='".$val['dossier']."'"; |
if ($val['archive_autorite_competente'] != '') { |
1553 |
$res = $db->autoExecute(DB_PREFIXE.'dossier', $valF, DB_AUTOQUERY_UPDATE, $cle); |
$valF['autorite_competente'] = $val['archive_autorite_competente']; |
1554 |
$this->addToLog("triggersupprimer(): db->autoexecute(\"".DB_PREFIXE."dossier\", ".print_r($valF, true).", DB_AUTOQUERY_UPDATE, \"".$cle."\");", VERBOSE_MODE); |
} else { |
1555 |
if (database::isError($res)) { |
$valF['autorite_competente'] = NULL; |
1556 |
die($res->getMessage()); |
} |
1557 |
} |
// On met à jour le dossier |
1558 |
// Affichage d'informations à l'utilisateur |
$cle = " dossier='".$val['dossier']."'"; |
1559 |
$this->addToMessage(_("Suppression de l'instruction")." [".$db->affectedRows()." "._('enregistrement')." "._('mis_a_jour')."]"); |
$res = $db->autoExecute(DB_PREFIXE.'dossier', $valF, DB_AUTOQUERY_UPDATE, $cle); |
1560 |
|
$this->addToLog("triggersupprimer(): db->autoexecute(\"".DB_PREFIXE."dossier\", ".print_r($valF, true).", DB_AUTOQUERY_UPDATE, \"".$cle."\");", VERBOSE_MODE); |
1561 |
|
if (database::isError($res)) { |
1562 |
|
die($res->getMessage()); |
1563 |
|
} |
1564 |
|
// Affichage d'informations à l'utilisateur |
1565 |
|
$this->addToMessage(_("Suppression de l'instruction")." [".$db->affectedRows()." "._('enregistrement')." "._('mis_a_jour')."]"); |
1566 |
|
|
1567 |
|
// Mise à jour de la demande si un récépissé d'instruction correspond à l'instruction à supprimer |
1568 |
} |
} |
1569 |
|
|
1570 |
function triggersupprimerapres($id,&$db,$val,$DEBUG) { |
function triggersupprimerapres($id,&$db,$val,$DEBUG) { |
1571 |
|
|
1572 |
// Mise à jour des données du dossier d'autorisation |
// Mise à jour des données du dossier d'autorisation |
1573 |
require_once "../obj/dossier_autorisation.class.php"; |
require_once "../obj/dossier_autorisation.class.php"; |
1574 |
$da = new dossier_autorisation($this->getDossierAutorisationFromDossier($val["dossier"]), $this->db, DEBUG); |
$da = new dossier_autorisation($this->getNumDemandeAutorFromDossier($val["dossier"]), $this->db, DEBUG); |
1575 |
$da->majDossierAutorisation(); |
$da->majDossierAutorisation(); |
1576 |
} |
} |
1577 |
|
|
|
// ============================================= |
|
|
// calcul de date avec ajout de mois (delais) |
|
|
// [add months (delay) and calculation final date] |
|
|
// LIMITE DE LA FONCTION si delai >24 MOIS |
|
|
// [limit : delay < 24 month] |
|
|
// ============================================= |
|
|
function moisdate($date,$delaimois) { |
|
|
$temp = explode("-" , $date); |
|
|
$jour = (int) $temp[2]; |
|
|
$mois = (int) $temp[1]; |
|
|
$annee = (int) $temp[0]; |
|
|
// calcul si delai superieur à 12 (limite 24) [delay > 24 month] |
|
|
if($delaimois>=12){ |
|
|
$delaimois=$delaimois-12; |
|
|
$annee=$annee+1; |
|
|
} |
|
|
if($delaimois>=12){ |
|
|
$delaimois=$delaimois-12; |
|
|
$annee=$annee+1; |
|
|
} |
|
|
// mois |
|
|
$mois=$mois+$delaimois; |
|
|
// calcul mois annee [calculation number of years if > 12 month] |
|
|
// nb de mois > à 12 |
|
|
if ($mois>12){ |
|
|
$mois=$mois-12; |
|
|
$annee=$annee+1; |
|
|
} |
|
|
// Calcul du nombre de jours dans le mois sélectionné [calculation number of days] |
|
|
switch($mois) { |
|
|
case "2": |
|
|
if ($annee % 4 == 0 && $annee % 100 != 0 || $annee % 400 == 0) |
|
|
$jourmax = 29; |
|
|
else |
|
|
$jourmax = 28; |
|
|
break; |
|
|
case "4": |
|
|
case "6": |
|
|
case "9": |
|
|
case "11": |
|
|
$jourmax = 30; |
|
|
break; |
|
|
default: |
|
|
$jourmax = 31; |
|
|
} |
|
|
if ($jour > $jourmax) |
|
|
$jour = $jourmax; |
|
|
//$dateretour=$annee."-".$mois."-".$jour; |
|
|
return $annee."-".$mois."-".$jour ; |
|
|
} |
|
|
|
|
1578 |
// Vérifie la restriction sur l'événement |
// Vérifie la restriction sur l'événement |
1579 |
function verifier($val = array(), &$db, $DEBUG){ |
function verifier($val = array(), &$db, $DEBUG){ |
1580 |
parent::verifier($val, $db, $DEBUG); |
parent::verifier($val, $db, $DEBUG); |
1581 |
|
|
1582 |
if ( isset($val['evenement']) && is_numeric($val['evenement'])){ |
if ( isset($val['evenement']) && is_numeric($val['evenement'])){ |
1583 |
//Récupère la restriction |
//Récupère la restriction |
1584 |
$sql= "SELECT |
$sql= "SELECT |
1585 |
restriction |
restriction |
1586 |
FROM |
FROM |
1597 |
|
|
1598 |
//Test qu'une restriction est présente |
//Test qu'une restriction est présente |
1599 |
if ( isset($row['restriction']) && $row['restriction'] != "" ){ |
if ( isset($row['restriction']) && $row['restriction'] != "" ){ |
1600 |
|
|
1601 |
|
$restriction = $row['restriction']; |
1602 |
|
|
1603 |
//Test si la restriction est valide |
//Test si la restriction est valide |
1604 |
if ( !$this->restrictionIsValid($row['restriction']) ){ |
if ( !$this->restrictionIsValid($restriction) ){ |
1605 |
|
|
1606 |
$this->correct=false; |
$this->correct=false; |
1607 |
$this->addToMessage(_("Restriction non valide")); |
$this->addToMessage(_("Restriction non valide")); |
1610 |
|
|
1611 |
$this->correct = true; |
$this->correct = true; |
1612 |
} |
} |
1613 |
|
|
1614 |
|
// Liste des opérateurs possible |
1615 |
|
$operateurs = array(">=", "<=", "+", "-"); |
1616 |
|
|
1617 |
|
// Supprime tous les espaces de la chaîne de caractère |
1618 |
|
$restriction = str_replace(' ', '', $restriction); |
1619 |
|
|
1620 |
|
// Met des espace avant et après les opérateurs puis transforme la |
1621 |
|
// chaine en un tableau |
1622 |
|
$tabRestriction = str_replace($operateurs, " ", $restriction); |
1623 |
|
// Tableau des champ |
1624 |
|
$tabRestriction = explode(" ", $tabRestriction); |
1625 |
|
// Supprime les numériques du tableau |
1626 |
|
foreach ($tabRestriction as $key => $value) { |
1627 |
|
if (is_numeric($value)) { |
1628 |
|
unset($tabRestriction[$key]); |
1629 |
|
} |
1630 |
|
} |
1631 |
|
|
1632 |
|
// Vérifie les champs utilisés pour la restriction |
1633 |
|
$check_field_exist = $this->f->check_field_exist($tabRestriction, 'instruction'); |
1634 |
|
if ($check_field_exist !== true) { |
1635 |
|
|
1636 |
|
// Liste des champs en erreur |
1637 |
|
$string_error_fields = implode(", ", $check_field_exist); |
1638 |
|
|
1639 |
|
// Message d'erreur |
1640 |
|
$error_message = _("Le champ %s n'est pas utilisable pour le champ %s"); |
1641 |
|
if (count($check_field_exist) > 1) { |
1642 |
|
$error_message = _("Les champs %s ne sont pas utilisable pour le champ %s"); |
1643 |
|
} |
1644 |
|
|
1645 |
|
// Affiche l'erreur |
1646 |
|
$this->correct=false; |
1647 |
|
$this->addToMessage(sprintf($error_message, $string_error_fields, _("restriction"))); |
1648 |
|
$this->addToMessage(_("Veuillez contacter votre administrateur.")); |
1649 |
|
} |
1650 |
} |
} |
1651 |
|
|
1652 |
|
} |
1653 |
|
if(!$this->updateDate("date_envoi_signature")) { |
1654 |
|
return false; |
1655 |
|
} |
1656 |
|
if(!$this->updateDate("date_retour_signature")) { |
1657 |
|
return false; |
1658 |
|
} |
1659 |
|
if(!$this->updateDate("date_envoi_rar")) { |
1660 |
|
return false; |
1661 |
|
} |
1662 |
|
if(!$this->updateDate("date_retour_rar")) { |
1663 |
|
return false; |
1664 |
|
} |
1665 |
|
if(!$this->updateDate("date_envoi_controle_legalite")) { |
1666 |
|
return false; |
1667 |
|
} |
1668 |
|
if(!$this->updateDate("date_retour_controle_legalite")) { |
1669 |
|
return false; |
1670 |
} |
} |
1671 |
|
|
|
$this->updateDate("date_envoi_signature"); |
|
|
$this->updateDate("date_retour_signature"); |
|
|
$this->updateDate("date_envoi_rar"); |
|
|
$this->updateDate("date_retour_rar"); |
|
|
$this->updateDate("date_envoi_controle_legalite"); |
|
|
$this->updateDate("date_retour_controle_legalite"); |
|
1672 |
} |
} |
1673 |
|
|
1674 |
/** |
/** |
1721 |
* @param booleen $status permet de définir si on finalise ou définalise |
* @param booleen $status permet de définir si on finalise ou définalise |
1722 |
* @param string $sousform permet de savoir si se trouve dans un sousformulaire (passé au javascript) |
* @param string $sousform permet de savoir si se trouve dans un sousformulaire (passé au javascript) |
1723 |
*/ |
*/ |
1724 |
function finaliser( $champ = '', $status, $sousform){ |
function finaliser( $champ = '', $status, $sousform, $retourformulaire){ |
1725 |
|
|
1726 |
//Si on finalise le document |
//Si on finalise le document |
1727 |
if ( $status == 1 ){ |
if ( $status == 1 ){ |
1759 |
$uid = $this->getVal("om_fichier_instruction"); |
$uid = $this->getVal("om_fichier_instruction"); |
1760 |
|
|
1761 |
//On dé-finalise avant de finaliser |
//On dé-finalise avant de finaliser |
1762 |
if ( $uid == '' ){ |
if ( $uid == '' || $uid == 'OP_FAILURE' ){ |
1763 |
return -1; |
return -1; |
1764 |
} |
} |
1765 |
} |
} |
1766 |
|
|
1767 |
//Mise à jour des données |
//Mise à jour des données |
1768 |
if ( $uid != '' ){ |
if ( $uid != '' && $uid != 'OP_FAILURE' ){ |
1769 |
// Logger |
// Logger |
1770 |
$this->addToLog("finaliser() - begin", EXTRA_VERBOSE_MODE); |
$this->addToLog("finaliser() - begin", EXTRA_VERBOSE_MODE); |
1771 |
// Recuperation de la valeur de la cle primaire de l'objet |
// Recuperation de la valeur de la cle primaire de l'objet |
1773 |
$id = $this->getVal($this->clePrimaire); |
$id = $this->getVal($this->clePrimaire); |
1774 |
else |
else |
1775 |
$id=$this->id; |
$id=$this->id; |
1776 |
|
|
1777 |
|
$actions = array(); |
1778 |
//Tableau contenant le lien vers le PDF et lien du portlet pour la mise |
//Tableau contenant le lien vers le PDF et lien du portlet pour la mise |
1779 |
//à jour de l'interface |
//à jour de l'interface |
1780 |
if ( $status == 0 ){ |
if ( $status == 0 ){ |
1781 |
$lien = '../app/pdf_instruction.php?idx='.$id; |
$lien = '../app/pdf_instruction.php?idx='.$id; |
1782 |
|
|
1783 |
|
//Ajout des actions |
1784 |
|
//Si l'utilisateur a le droit de modifier l'objet |
1785 |
|
if ( $this->f->isAccredited('instruction') || |
1786 |
|
$this->f->isAccredited('instruction_modifier') ){ |
1787 |
|
|
1788 |
|
$actions["modifier"] = ($sousform!='')? |
1789 |
|
'<li><a href="#" onclick="ajaxIt(\'instruction\', |
1790 |
|
\'../scr/sousform.php?obj=instruction&action=1&idx='. |
1791 |
|
$this->getVal($this->clePrimaire). |
1792 |
|
'&premiersf=0&trisf=&retourformulaire='.$retourformulaire.'&idxformulaire='. |
1793 |
|
$this->getVal("dossier"). |
1794 |
|
'&retour=form\');"> |
1795 |
|
<span class="om-prev-icon om-icon-16 edit-16" title="'. |
1796 |
|
_('Modifier').'">'. |
1797 |
|
_('Modifier'). |
1798 |
|
'</span></a></li>': |
1799 |
|
'<li> |
1800 |
|
<a href="form.php?obj=instruction&action=1'.'&idx='. |
1801 |
|
$this->getVal($this->clePrimaire). |
1802 |
|
'&premier=&advs_id=&recherche=&tricol=&selectioncol=&valide=&retour=form"> |
1803 |
|
<span class="om-prev-icon om-icon-16 edit-16" title="'. |
1804 |
|
_('Modifier').'">'. |
1805 |
|
_('Modifier'). |
1806 |
|
'</span></a></li>'; |
1807 |
|
} |
1808 |
|
//Si l'utilisateur a le droit de supprimer l'objet |
1809 |
|
if ( $this->f->isAccredited('instruction') || |
1810 |
|
$this->f->isAccredited('instruction_supprimer') ){ |
1811 |
|
|
1812 |
|
$actions["supprimer"] = ($sousform!='')? |
1813 |
|
'<li><a href="#" onclick="ajaxIt(\'instruction\', |
1814 |
|
\'../scr/sousform.php?obj=instruction&action=2&idx='. |
1815 |
|
$this->getVal($this->clePrimaire). |
1816 |
|
'&premiersf=0&trisf=&retourformulaire='.$retourformulaire.'&idxformulaire='. |
1817 |
|
$this->getVal("dossier"). |
1818 |
|
'&retour=form\');"> |
1819 |
|
<span class="om-prev-icon om-icon-16 delete-16" title="'. |
1820 |
|
_('Supprimer').'">'. |
1821 |
|
_('Supprimer'). |
1822 |
|
'</span></a></li>': |
1823 |
|
'<li> |
1824 |
|
<a href="form.php?obj=instruction&action=1'.'&idx='. |
1825 |
|
$this->getVal($this->clePrimaire). |
1826 |
|
'&premier=&advs_id=&recherche=&tricol=&selectioncol=&valide=&retour=form"> |
1827 |
|
<span class="om-prev-icon om-icon-16 delete-16" title="'. |
1828 |
|
_('Supprimer').'">'. |
1829 |
|
_('Supprimer'). |
1830 |
|
'</span></a></li>'; |
1831 |
|
} |
1832 |
} |
} |
1833 |
else { |
else { |
1834 |
$lien = '../spg/file.php?obj=instruction&'. |
$lien = '../spg/file.php?obj=instruction&'. |
1838 |
$retour = array( |
$retour = array( |
1839 |
"portlet"=> "<a href=\"#\" onclick=\"finalizeDocument(". |
"portlet"=> "<a href=\"#\" onclick=\"finalizeDocument(". |
1840 |
$id.", 'instruction', '".$sousform."', ".(($status==0)?1:0).")\"> |
$id.", 'instruction', '".$sousform."', ".(($status==0)?1:0).")\"> |
1841 |
<span class=\"om-prev-icon om-icon-16 om-icon-fix delete-16 " |
<span class=\"om-prev-icon om-icon-16 om-icon-fix " |
1842 |
.(($status==1)?"de":"")."finalise\" title=\"". |
.(($status==1)?"de":"")."finalise\" title=\"". |
1843 |
(($status==1)?_("Reprendre la redaction du document"):_("Finaliser le document"))."\">". |
(($status==1)?_("Reprendre la redaction du document"):_("Finaliser le document"))."\">". |
1844 |
(($status==1)?_("Reprendre la redaction du document"):_("Finaliser le document"))."</span> |
(($status==1)?_("Reprendre la redaction du document"):_("Finaliser le document"))."</span> |
1845 |
</a>", |
</a>", |
1846 |
"pdf" => $lien |
"pdf" => $lien, |
1847 |
|
"actions" => $actions |
1848 |
); |
); |
1849 |
|
|
1850 |
foreach ( $this->champs as $key=>$value ) |
foreach ( $this->champs as $key=>$value ) |
1913 |
} else { |
} else { |
1914 |
// Message d'echec (saut d'une ligne supplementaire avant le |
// Message d'echec (saut d'une ligne supplementaire avant le |
1915 |
// message pour qu'il soit mis en evidence) |
// message pour qu'il soit mis en evidence) |
1916 |
$this->addToLog("Finalisation non enregistree"); |
$this->addToLog(_("Finalisation non enregistree")); |
1917 |
return -1; |
return -1; |
1918 |
} |
} |
1919 |
} |
} |
1934 |
return $this->specificMetadata->dossier; |
return $this->specificMetadata->dossier; |
1935 |
} |
} |
1936 |
/** |
/** |
1937 |
|
* Récupération la version du dossier d'instruction à ajouter aux métadonnées |
1938 |
|
* @return int Version |
1939 |
|
*/ |
1940 |
|
protected function getDossierVersion() { |
1941 |
|
if(empty($this->specificMetadata)) { |
1942 |
|
$this->getSpecificMetadata(); |
1943 |
|
} |
1944 |
|
return $this->specificMetadata->version; |
1945 |
|
} |
1946 |
|
/** |
1947 |
* Récupération du numéro de dossier d'autorisation à ajouter aux métadonnées |
* Récupération du numéro de dossier d'autorisation à ajouter aux métadonnées |
1948 |
* @return string numéro de dossier d'autorisation |
* @return string numéro de dossier d'autorisation |
1949 |
*/ |
*/ |
1950 |
protected function getDossierAutorisation() { |
protected function getNumDemandeAutor() { |
1951 |
if(empty($this->specificMetadata)) { |
if(empty($this->specificMetadata)) { |
1952 |
$this->getSpecificMetadata(); |
$this->getSpecificMetadata(); |
1953 |
} |
} |
1957 |
* Récupération de la date de demande initiale du dossier à ajouter aux métadonnées |
* Récupération de la date de demande initiale du dossier à ajouter aux métadonnées |
1958 |
* @return date de la demande initiale |
* @return date de la demande initiale |
1959 |
*/ |
*/ |
1960 |
protected function getDateDemandeInitiale() { |
protected function getAnneemoisDemandeAutor() { |
1961 |
if(empty($this->specificMetadata)) { |
if(empty($this->specificMetadata)) { |
1962 |
$this->getSpecificMetadata(); |
$this->getSpecificMetadata(); |
1963 |
} |
} |
1967 |
* Récupération du type de dossier d'instruction à ajouter aux métadonnées |
* Récupération du type de dossier d'instruction à ajouter aux métadonnées |
1968 |
* @return string type du dossier d'instruction |
* @return string type du dossier d'instruction |
1969 |
*/ |
*/ |
1970 |
protected function getDossierInstructionType() { |
protected function getTypeInstruction() { |
1971 |
if(empty($this->specificMetadata)) { |
if(empty($this->specificMetadata)) { |
1972 |
$this->getSpecificMetadata(); |
$this->getSpecificMetadata(); |
1973 |
} |
} |
1977 |
* Récupération du statut du dossier d'autorisation à ajouter aux métadonnées |
* Récupération du statut du dossier d'autorisation à ajouter aux métadonnées |
1978 |
* @return string avis |
* @return string avis |
1979 |
*/ |
*/ |
1980 |
protected function getStatut() { |
protected function getStatutAutorisation() { |
1981 |
if(empty($this->specificMetadata)) { |
if(empty($this->specificMetadata)) { |
1982 |
$this->getSpecificMetadata(); |
$this->getSpecificMetadata(); |
1983 |
} |
} |
1987 |
* Récupération du type de dossier d'autorisation à ajouter aux métadonnées |
* Récupération du type de dossier d'autorisation à ajouter aux métadonnées |
1988 |
* @return string type du dossier d'autorisation |
* @return string type du dossier d'autorisation |
1989 |
*/ |
*/ |
1990 |
protected function getDossierAutorisationType() { |
protected function getTypeAutorisation() { |
1991 |
if(empty($this->specificMetadata)) { |
if(empty($this->specificMetadata)) { |
1992 |
$this->getSpecificMetadata(); |
$this->getSpecificMetadata(); |
1993 |
} |
} |
1997 |
* Récupération de la date d'ajout de document à ajouter aux métadonnées |
* Récupération de la date d'ajout de document à ajouter aux métadonnées |
1998 |
* @return date de l'évènement |
* @return date de l'évènement |
1999 |
*/ |
*/ |
2000 |
protected function getDateEvenement() { |
protected function getDateEvenementDocument() { |
2001 |
return date("d/m/Y"); |
return date("Y-m-d"); |
2002 |
} |
} |
2003 |
/** |
/** |
2004 |
* Récupération du groupe d'instruction à ajouter aux métadonnées |
* Récupération du groupe d'instruction à ajouter aux métadonnées |
2010 |
} |
} |
2011 |
return $this->specificMetadata->groupe_instruction; |
return $this->specificMetadata->groupe_instruction; |
2012 |
} |
} |
2013 |
|
/** |
2014 |
|
* Récupération du libellé du type du document à ajouter aux métadonnées |
2015 |
|
* @return string Groupe d'instruction |
2016 |
|
*/ |
2017 |
|
protected function getTitle() { |
2018 |
|
|
2019 |
|
// Récupère le champ événement |
2020 |
|
if (isset($this->valF["evenement"]) AND $this->valF["evenement"] != "") { |
2021 |
|
$evenement = $this->valF["evenement"]; |
2022 |
|
} else { |
2023 |
|
$evenement = $this->getVal("evenement"); |
2024 |
|
} |
2025 |
|
|
2026 |
|
// Requête sql |
2027 |
|
$sql = "SELECT libelle FROM ".DB_PREFIXE."evenement |
2028 |
|
WHERE evenement=".$evenement; |
2029 |
|
$evenement_libelle = $this->db->getOne($sql); |
2030 |
|
$this->addToLog("getTitle(): db->getOne(\"".$sql."\");", VERBOSE_MODE); |
2031 |
|
if (database::isError($evenement_libelle)) { |
2032 |
|
die(); |
2033 |
|
} |
2034 |
|
|
2035 |
|
// Retourne le libelle de l'événement |
2036 |
|
return $evenement_libelle; |
2037 |
|
} |
2038 |
|
|
2039 |
/** |
/** |
2040 |
* Cette méthode permet de stocker en attribut toutes les métadonnées |
* Cette méthode permet de stocker en attribut toutes les métadonnées |
2069 |
ON dossier_autorisation_type.groupe = groupe.groupe |
ON dossier_autorisation_type.groupe = groupe.groupe |
2070 |
WHERE dossier.dossier = '".$dossier."'"; |
WHERE dossier.dossier = '".$dossier."'"; |
2071 |
$res = $this->db->query($sql); |
$res = $this->db->query($sql); |
2072 |
$this->f->addToLog("obj/document_numerise.class.php : db->query(".$sql.")", VERBOSE_MODE); |
$this->f->addToLog("getSpecificMetadata() : db->query(".$sql.")", VERBOSE_MODE); |
2073 |
if ( database::isError($res)){ |
if ( database::isError($res)){ |
2074 |
die(); |
die(); |
2075 |
} |
} |
2079 |
|
|
2080 |
//Si il y a un résultat |
//Si il y a un résultat |
2081 |
if ($row !== null) { |
if ($row !== null) { |
2082 |
|
|
2083 |
|
//Génération du numéro de version |
2084 |
|
$sql = "SELECT |
2085 |
|
count(*) |
2086 |
|
FROM |
2087 |
|
".DB_PREFIXE."dossier |
2088 |
|
LEFT JOIN |
2089 |
|
".DB_PREFIXE."dossier_autorisation |
2090 |
|
ON |
2091 |
|
dossier_autorisation.dossier_autorisation = dossier.dossier_autorisation |
2092 |
|
LEFT JOIN |
2093 |
|
".DB_PREFIXE."dossier_instruction_type |
2094 |
|
ON |
2095 |
|
dossier_instruction_type.dossier_instruction_type = dossier.dossier_instruction_type |
2096 |
|
WHERE |
2097 |
|
dossier_autorisation.dossier_autorisation = '".$row->dossier_autorisation."' |
2098 |
|
AND |
2099 |
|
dossier_instruction_type.code = '".$row->dossier_instruction_type."'"; |
2100 |
|
$row->version = $this->db->getOne($sql); |
2101 |
|
$this->f->addToLog("getSpecificMetadata(): db->getOne(\"".$sql."\")", VERBOSE_MODE); |
2102 |
|
if ( database::isError($row->version)){ |
2103 |
|
$this->f->addToError("", $row->version, $row->version); |
2104 |
|
return false; |
2105 |
|
} |
2106 |
|
|
2107 |
|
//Formatage du numéro de version |
2108 |
|
$row->version = str_pad($row->version, 2, "0", STR_PAD_LEFT); |
2109 |
|
|
2110 |
//Alors on créé l'objet dossier_instruction |
//Alors on créé l'objet dossier_instruction |
2111 |
$this->specificMetadata = $row; |
$this->specificMetadata = $row; |
2118 |
* @param string $idx Identifiant du dossier d'instruction |
* @param string $idx Identifiant du dossier d'instruction |
2119 |
* @return string Le statut du dossier d'instruction |
* @return string Le statut du dossier d'instruction |
2120 |
*/ |
*/ |
2121 |
function getStatutDossier($idx){ |
function getStatutAutorisationDossier($idx){ |
2122 |
|
|
2123 |
$statut = ''; |
$statut = ''; |
2124 |
|
|
2135 |
dossier.etat = etat.etat |
dossier.etat = etat.etat |
2136 |
WHERE dossier ='".$idx."'"; |
WHERE dossier ='".$idx."'"; |
2137 |
$statut = $this->db->getOne($sql); |
$statut = $this->db->getOne($sql); |
2138 |
$this->f->addToLog("getStatutDossier() : db->getOne(\"".$sql."\")", VERBOSE_MODE); |
$this->f->addToLog("getStatutAutorisationDossier() : db->getOne(\"".$sql."\")", VERBOSE_MODE); |
2139 |
if ( database::isError($statut)){ |
if ( database::isError($statut)){ |
2140 |
die(); |
die(); |
2141 |
} |
} |
2142 |
} |
} |
2143 |
return $statut; |
return $statut; |
2144 |
} |
} |
2145 |
|
|
2146 |
|
/** |
2147 |
|
* Récupère les données du dossier |
2148 |
|
* @return array |
2149 |
|
*/ |
2150 |
|
function get_dossier_actual() { |
2151 |
|
|
2152 |
|
// Initialisation de la valeur de retour |
2153 |
|
$return = array(); |
2154 |
|
|
2155 |
|
// Récupération de toutes les valeurs du dossier d'instruction en cours |
2156 |
|
$sql = "SELECT * FROM ".DB_PREFIXE."dossier |
2157 |
|
WHERE dossier='".$this->valF['dossier']."'"; |
2158 |
|
$res = $this->db->query($sql); |
2159 |
|
$this->addToLog("get_dossier_actual(): db->query(\"".$sql."\");", VERBOSE_MODE); |
2160 |
|
$this->f->isDatabaseError($res); |
2161 |
|
|
2162 |
|
// |
2163 |
|
while ($row=& $res->fetchRow(DB_FETCHMODE_ASSOC)) { |
2164 |
|
|
2165 |
|
// Récupération de la valeur actuelle du délai, de l'accord tacite, |
2166 |
|
// de l'état et de l'avis du dossier d'instruction |
2167 |
|
$return['archive_delai']=$row['delai']; |
2168 |
|
$return['archive_accord_tacite']=$row['accord_tacite']; |
2169 |
|
$return['archive_etat']=$row['etat']; |
2170 |
|
$return['archive_avis']=$row['avis_decision']; |
2171 |
|
// Récupération de la valeur actuelle des 9 dates du dossier |
2172 |
|
// d'instruction |
2173 |
|
$return['archive_date_complet']=$row['date_complet']; |
2174 |
|
$return['archive_date_dernier_depot']=$row['date_dernier_depot']; |
2175 |
|
$return['archive_date_rejet']= $row['date_rejet']; |
2176 |
|
$return['archive_date_limite']= $row['date_limite']; |
2177 |
|
$return['archive_date_notification_delai']= $row['date_notification_delai']; |
2178 |
|
$return['archive_date_decision']= $row['date_decision']; |
2179 |
|
$return['archive_date_validite']= $row['date_validite']; |
2180 |
|
$return['archive_date_achevement']= $row['date_achevement']; |
2181 |
|
$return['archive_date_chantier']= $row['date_chantier']; |
2182 |
|
$return['archive_date_conformite']= $row['date_conformite']; |
2183 |
|
$return['archive_incompletude']= $row['incompletude']; |
2184 |
|
$return['archive_evenement_suivant_tacite']= $row['evenement_suivant_tacite']; |
2185 |
|
$return['archive_evenement_suivant_tacite_incompletude']= $row['evenement_suivant_tacite_incompletude']; |
2186 |
|
$return['archive_etat_pendant_incompletude']= $row['etat_pendant_incompletude']; |
2187 |
|
$return['archive_date_limite_incompletude']= $row['date_limite_incompletude']; |
2188 |
|
$return['archive_delai_incompletude']= $row['delai_incompletude']; |
2189 |
|
$return['archive_autorite_competente']= $row['autorite_competente']; |
2190 |
|
$return['duree_validite']= $row['duree_validite']; |
2191 |
|
} |
2192 |
|
|
2193 |
|
// Retour de la fonction |
2194 |
|
return $return; |
2195 |
|
|
2196 |
|
} |
2197 |
|
|
2198 |
|
/** |
2199 |
|
* Permet de vérifier qu'un événement est verrouillable |
2200 |
|
* @param integer $idx Identifiant de l'instruction |
2201 |
|
* @return boolean |
2202 |
|
*/ |
2203 |
|
function checkEvenementNonVerrouillable($idx) { |
2204 |
|
|
2205 |
|
// Initialisation du résultat |
2206 |
|
$non_verrouillable = false; |
2207 |
|
|
2208 |
|
// Si la condition n'est pas vide |
2209 |
|
if ($idx != "") { |
2210 |
|
|
2211 |
|
// Requête SQL |
2212 |
|
$sql = "SELECT evenement.non_verrouillable |
2213 |
|
FROM ".DB_PREFIXE."evenement |
2214 |
|
LEFT JOIN ".DB_PREFIXE."instruction |
2215 |
|
ON instruction.evenement = evenement.evenement |
2216 |
|
WHERE instruction.instruction = $idx"; |
2217 |
|
$this->f->addToLog("checkEvenementNonVerrouillable() : db->getOne(\"".$sql."\")", VERBOSE_MODE); |
2218 |
|
$res = $this->db->getOne($sql); |
2219 |
|
$this->f->isDatabaseError($res); |
2220 |
|
|
2221 |
|
// Si le retour de la requête est true |
2222 |
|
if ($res == 't') { |
2223 |
|
// |
2224 |
|
$non_verrouillable = true; |
2225 |
|
} |
2226 |
|
} |
2227 |
|
|
2228 |
|
// Retourne résultat |
2229 |
|
return $non_verrouillable; |
2230 |
|
} |
2231 |
|
|
2232 |
|
/** |
2233 |
|
* Mise à jour des champs archive_* |
2234 |
|
* @param mixed $row La ligne de données |
2235 |
|
*/ |
2236 |
|
public function updateArchiveData($row){ |
2237 |
|
|
2238 |
|
// Récupération de la valeur actuelle du délai, de l'accord tacite, |
2239 |
|
// de l'état et de l'avis du dossier d'instruction |
2240 |
|
$this->valF['archive_delai']=$row['delai']; |
2241 |
|
$this->valF['archive_accord_tacite']=$row['accord_tacite']; |
2242 |
|
$this->valF['archive_etat']=$row['etat']; |
2243 |
|
$this->valF['archive_avis']=$row['avis_decision']; |
2244 |
|
// Récupération de la valeur actuelle des 9 dates du dossier |
2245 |
|
// d'instruction |
2246 |
|
if ($row['date_complet'] != '') { |
2247 |
|
$this->valF['archive_date_complet']=$row['date_complet']; |
2248 |
|
} |
2249 |
|
if ($row['date_dernier_depot'] != '') { |
2250 |
|
$this->valF['archive_date_dernier_depot']=$row['date_dernier_depot']; |
2251 |
|
} |
2252 |
|
if ($row['date_rejet']!='') { |
2253 |
|
$this->valF['archive_date_rejet']= $row['date_rejet']; |
2254 |
|
} |
2255 |
|
if ($row['date_limite']!='') { |
2256 |
|
$this->valF['archive_date_limite']= $row['date_limite']; |
2257 |
|
} |
2258 |
|
if ($row['date_notification_delai']!='') { |
2259 |
|
$this->valF['archive_date_notification_delai']= $row['date_notification_delai']; |
2260 |
|
} |
2261 |
|
if ($row['date_decision']!='') { |
2262 |
|
$this->valF['archive_date_decision']= $row['date_decision']; |
2263 |
|
} |
2264 |
|
if ($row['date_validite']!='') { |
2265 |
|
$this->valF['archive_date_validite']= $row['date_validite']; |
2266 |
|
} |
2267 |
|
if ($row['date_achevement']!='') { |
2268 |
|
$this->valF['archive_date_achevement']= $row['date_achevement']; |
2269 |
|
} |
2270 |
|
if ($row['date_chantier']!='') { |
2271 |
|
$this->valF['archive_date_chantier']= $row['date_chantier']; |
2272 |
|
} |
2273 |
|
if ($row['date_conformite']!='') { |
2274 |
|
$this->valF['archive_date_conformite']= $row['date_conformite']; |
2275 |
|
} |
2276 |
|
if ($row['incompletude']!='') { |
2277 |
|
$this->valF['archive_incompletude']= $row['incompletude']; |
2278 |
|
} |
2279 |
|
if ($row['evenement_suivant_tacite']!='') { |
2280 |
|
$this->valF['archive_evenement_suivant_tacite']= $row['evenement_suivant_tacite']; |
2281 |
|
} |
2282 |
|
if ($row['evenement_suivant_tacite_incompletude']!='') { |
2283 |
|
$this->valF['archive_evenement_suivant_tacite_incompletude']= $row['evenement_suivant_tacite_incompletude']; |
2284 |
|
} |
2285 |
|
if ($row['etat_pendant_incompletude']!='') { |
2286 |
|
$this->valF['archive_etat_pendant_incompletude']= $row['etat_pendant_incompletude']; |
2287 |
|
} |
2288 |
|
if ($row['date_limite_incompletude']!='') { |
2289 |
|
$this->valF['archive_date_limite_incompletude']= $row['date_limite_incompletude']; |
2290 |
|
} |
2291 |
|
if ($row['delai_incompletude']!='') { |
2292 |
|
$this->valF['archive_delai_incompletude']= $row['delai_incompletude']; |
2293 |
|
} |
2294 |
|
if ($row['autorite_competente']!='') { |
2295 |
|
$this->valF['archive_autorite_competente']= $row['autorite_competente']; |
2296 |
|
} |
2297 |
|
if ($row['duree_validite']!='') { |
2298 |
|
$this->valF['duree_validite']= $row['duree_validite']; |
2299 |
|
} |
2300 |
|
} |
2301 |
}// fin classe |
}// fin classe |
2302 |
?> |
?> |