14 |
* - voir script_lang.js : bible ... |
* - voir script_lang.js : bible ... |
15 |
* |
* |
16 |
* @package openfoncier |
* @package openfoncier |
17 |
* @version SVN : $Id: instruction.class.php 6178 2016-03-15 10:56:43Z nmeucci $ |
* @version SVN : $Id$ |
18 |
*/ |
*/ |
19 |
|
|
20 |
// |
// |
21 |
require_once "../gen/obj/instruction.class.php"; |
require_once "../gen/obj/instruction.class.php"; |
22 |
|
|
23 |
// |
// |
|
require_once "../services/outgoing/messageenqueuer.php"; |
|
|
|
|
|
// |
|
24 |
class instruction extends instruction_gen { |
class instruction extends instruction_gen { |
25 |
|
|
26 |
// Champs contenant les UID des fichiers |
// Champs contenant les UID des fichiers |
42 |
*/ |
*/ |
43 |
var $inst_dossier = null; |
var $inst_dossier = null; |
44 |
|
|
45 |
|
/** |
46 |
|
* Instance de la classe instructeur |
47 |
|
* |
48 |
|
* @var mixed |
49 |
|
*/ |
50 |
|
var $inst_instructeur = null; |
51 |
|
|
52 |
|
/** |
53 |
|
* Instance de la classe om_utilisateur |
54 |
|
* |
55 |
|
* @var mixed |
56 |
|
*/ |
57 |
|
var $inst_om_utilisateur = null; |
58 |
|
|
59 |
var $metadata = array( |
var $metadata = array( |
60 |
"om_fichier_instruction" => array( |
"om_fichier_instruction" => array( |
61 |
"dossier" => "getDossier", |
"dossier" => "getDossier", |
68 |
"dateEvenementDocument" => "getDateEvenementDocument", |
"dateEvenementDocument" => "getDateEvenementDocument", |
69 |
"groupeInstruction" => 'getGroupeInstruction', |
"groupeInstruction" => 'getGroupeInstruction', |
70 |
"title" => 'getTitle', |
"title" => 'getTitle', |
71 |
|
'concerneERP' => 'get_concerne_erp', |
72 |
), |
), |
73 |
"arrete" => array( |
"arrete" => array( |
74 |
"numArrete" => "getNumArrete", |
"numArrete" => "getNumArrete", |
87 |
"dateControleLegalite" => "getDateControleLegalite", |
"dateControleLegalite" => "getDateControleLegalite", |
88 |
), |
), |
89 |
); |
); |
|
/** @var boolean Les nouvelles actions sont activées sur cet objet */ |
|
|
var $activate_class_action; |
|
90 |
|
|
91 |
function __construct($id, &$db, $debug) { |
function __construct($id, &$db, $debug) { |
|
//On active les nouvelles actions |
|
|
$this->activate_class_action = true; |
|
92 |
$this->constructeur($id, $db, $debug); |
$this->constructeur($id, $db, $debug); |
93 |
} |
} |
94 |
|
|
105 |
|
|
106 |
// ACTION - 000 - ajouter |
// ACTION - 000 - ajouter |
107 |
// Modifie la condition d'affichage du bouton ajouter |
// Modifie la condition d'affichage du bouton ajouter |
108 |
$this->class_actions[0]["condition"] = "is_addable_editable_and_deletable"; |
$this->class_actions[0]["condition"] = array("is_addable", "can_user_access_dossier_contexte_ajout"); |
109 |
|
|
110 |
// ACTION - 001 - modifier |
// ACTION - 001 - modifier |
111 |
// Modifie la condition et le libellé du bouton modifier |
// Modifie la condition et le libellé du bouton modifier |
112 |
$this->class_actions[1]["condition"] = array("is_editable", "is_finalizable_without_bypass"); |
$this->class_actions[1]["condition"] = array( |
113 |
|
"is_editable", |
114 |
|
"is_finalizable_without_bypass", |
115 |
|
"can_user_access_dossier_contexte_modification", |
116 |
|
); |
117 |
$this->class_actions[1]["portlet"]["libelle"] = _("Modifier"); |
$this->class_actions[1]["portlet"]["libelle"] = _("Modifier"); |
118 |
|
|
119 |
// ACTION - 002 - supprimer |
// ACTION - 002 - supprimer |
120 |
// Modifie la condition et le libellé du bouton supprimer |
// Modifie la condition et le libellé du bouton supprimer |
121 |
$this->class_actions[2]["condition"] = array("is_deletable", "is_finalizable_without_bypass"); |
$this->class_actions[2]["condition"] = array( |
122 |
|
"is_deletable", |
123 |
|
"is_finalizable_without_bypass", |
124 |
|
"can_user_access_dossier_contexte_modification" |
125 |
|
); |
126 |
$this->class_actions[2]["portlet"]["libelle"] = _("Supprimer"); |
$this->class_actions[2]["portlet"]["libelle"] = _("Supprimer"); |
127 |
|
|
128 |
|
// ACTION - 003 - consulter |
129 |
|
// |
130 |
|
$this->class_actions[3]["condition"] = "can_user_access_dossier_contexte_modification"; |
131 |
|
|
132 |
// ACTION - 100 - finaliser |
// ACTION - 100 - finaliser |
133 |
// Finalise l'enregistrement |
// Finalise l'enregistrement |
134 |
$this->class_actions[100] = array( |
$this->class_actions[100] = array( |
143 |
"method" => "finalize", |
"method" => "finalize", |
144 |
"button" => "finaliser", |
"button" => "finaliser", |
145 |
"permission_suffix" => "finaliser", |
"permission_suffix" => "finaliser", |
146 |
"condition" => array("is_finalizable", "is_finalizable_without_bypass", "has_an_edition"), |
"condition" => array( |
147 |
|
"is_finalizable", |
148 |
|
"is_finalizable_without_bypass", |
149 |
|
"has_an_edition", |
150 |
|
"can_user_access_dossier_contexte_modification", |
151 |
|
), |
152 |
); |
); |
153 |
|
|
154 |
// ACTION - 110 - definaliser |
// ACTION - 110 - definaliser |
165 |
"method" => "unfinalize", |
"method" => "unfinalize", |
166 |
"button" => "definaliser", |
"button" => "definaliser", |
167 |
"permission_suffix" => "definaliser", |
"permission_suffix" => "definaliser", |
168 |
"condition" => array("is_unfinalizable", "is_unfinalizable_without_bypass"), |
"condition" => array( |
169 |
|
"is_unfinalizable", |
170 |
|
"is_unfinalizable_without_bypass", |
171 |
|
"can_user_access_dossier_contexte_modification", |
172 |
|
), |
173 |
); |
); |
174 |
|
|
175 |
// ACTION - 120 - edition |
// ACTION - 120 - edition |
183 |
"class" => "pdf-16", |
"class" => "pdf-16", |
184 |
), |
), |
185 |
"view" => "view_edition", |
"view" => "view_edition", |
186 |
"condition" => "has_an_edition", |
"condition" => array("has_an_edition", "can_user_access_dossier_contexte_modification"), |
187 |
"permission_suffix" => "om_fichier_instruction_telecharger", |
"permission_suffix" => "om_fichier_instruction_telecharger", |
188 |
); |
); |
189 |
|
|
198 |
"class" => "suivi-dates-16", |
"class" => "suivi-dates-16", |
199 |
), |
), |
200 |
"crud" => "update", |
"crud" => "update", |
201 |
"condition" => array("is_unfinalizable", "is_unfinalizable_without_bypass"), |
"condition" => array("can_monitoring_dates", "can_user_access_dossier_contexte_modification"), |
202 |
"permission_suffix" => "modification_dates", |
"permission_suffix" => "modification_dates", |
203 |
); |
); |
204 |
|
|
266 |
"view" => "view_generate_bordereau_envoi_maire", |
"view" => "view_generate_bordereau_envoi_maire", |
267 |
"permission_suffix" => "bordereau_envoi_maire", |
"permission_suffix" => "bordereau_envoi_maire", |
268 |
); |
); |
|
} |
|
|
|
|
|
/** |
|
|
* Cette variable permet de stocker le résultat de la méthode |
|
|
* getDivisionFromDossier() afin de ne pas effectuer le recalcul à chacun de |
|
|
* ces appels. |
|
|
* @var string Code de la division du dossier en cours |
|
|
*/ |
|
|
var $_division_from_dossier = NULL; |
|
|
|
|
|
/** |
|
|
* Cette méthode permet de récupérer le code de division correspondant |
|
|
* au dossier sur lequel on se trouve. |
|
|
* |
|
|
* @return string Code de la division du dossier en cours |
|
|
*/ |
|
|
function getDivisionFromDossier() { |
|
|
|
|
|
// Cette méthode peut être appelée plusieurs fois lors d'une requête. |
|
|
// Pour éviter de refaire le traitement de recherche de la division |
|
|
// alors on vérifie si nous ne l'avons pas déjà calculé. |
|
|
if ($this->_division_from_dossier != NULL) { |
|
|
// Logger |
|
|
$this->addToLog("getDivisionFromDossier(): retour de la valeur déjà calculée - '".$this->_division_from_dossier."'", EXTRA_VERBOSE_MODE); |
|
|
// On retourne la valeur déjà calculée |
|
|
return $this->_division_from_dossier; |
|
|
} |
|
269 |
|
|
270 |
// Par défaut, on définit la valeur du dossier à NULL |
// ACTION - 210 - notifier_commune |
271 |
$dossier = NULL; |
// Notifie la commune par mail d'un évément d'instruction finalisé |
272 |
// Test sur le mode et le contexte du formulaire |
$this->class_actions[210] = array( |
273 |
if ($this->getParameter("maj") == 0 |
"identifier" => "notifier_commune", |
274 |
&& ($this->getParameter("retourformulaire") == "dossier" |
"portlet" => array( |
275 |
|| $this->getParameter("retourformulaire") == "dossier_instruction" |
"type" => "action-direct-with-confirmation", |
276 |
|| $this->getParameter("retourformulaire") == "dossier_instruction_mes_encours" |
"libelle" => _("Notifier la commune par courriel"), |
277 |
|| $this->getParameter("retourformulaire") == "dossier_instruction_tous_encours" |
"order" => 210, |
278 |
|| $this->getParameter("retourformulaire") == "dossier_instruction_mes_clotures" |
"class" => "notifier_commune-16", |
279 |
|| $this->getParameter("retourformulaire") == "dossier_instruction_tous_clotures")) { |
), |
280 |
// Si on se trouve en mode AJOUT (seul mode où l'enregistrement |
"view" => "formulaire", |
281 |
// n'existe pas en base de données) ET que nous nous trouvons |
"method" => "notifier_commune", |
282 |
// dans le contexte d'un dossier d'instruction alors on récupère |
"permission_suffix" => "notifier_commune", |
283 |
// le numéro de dossier depuis le paramètre 'idxformulaire' |
"condition" => array("is_notifiable", "can_user_access_dossier_contexte_modification"), |
284 |
$dossier = $this->getParameter("idxformulaire"); |
); |
|
} else { |
|
|
// Sinon on récupère le numéro de dossier dans le champs dossier de |
|
|
// l'enregistrement (en base de données) |
|
|
$dossier = $this->getVal("dossier"); |
|
|
} |
|
285 |
|
|
286 |
// On appelle la méthode de la classe utils qui renvoi le code de la |
// ACTION - 220 - generate_suivi_bordereaux |
287 |
// division d'un dossier, on la stocke pour ne pas refaire le calcul au |
// GénÚre PDF bordereaux |
288 |
// prochain appel de cette méthode |
$this->class_actions[220] = array( |
289 |
$this->_division_from_dossier = $this->f->getDivisionFromDossier($dossier); |
"identifier" => "generate_suivi_bordereaux", |
290 |
// Logger |
"view" => "view_generate_suivi_bordereaux", |
291 |
$this->addToLog("getDivisionFromDossier(): retour de la valeur nouvellement calculée - '".$this->_division_from_dossier."'", EXTRA_VERBOSE_MODE); |
"permission_suffix" => "consulter", |
292 |
// On retourne la valeur retournée |
); |
|
return $this->_division_from_dossier; |
|
293 |
|
|
294 |
|
// ACTION - 777 - pdf_temp |
295 |
|
// Crée un PDF temporaire et affiche son contenu en base64 |
296 |
|
$this->class_actions[777] = array( |
297 |
|
"identifier" => "pdf_temp", |
298 |
|
"view" => "view_pdf_temp", |
299 |
|
"permission_suffix" => "modifier", |
300 |
|
"condition" => array("can_user_access_dossier_contexte_modification"), |
301 |
|
); |
302 |
} |
} |
303 |
|
|
304 |
|
|
305 |
/** |
/** |
306 |
* 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 |
307 |
*/ |
*/ |
390 |
$form->setType('archive_delai_incompletude','hidden'); |
$form->setType('archive_delai_incompletude','hidden'); |
391 |
|
|
392 |
// |
// |
393 |
|
$form->setType('archive_date_cloture_instruction','hidden'); |
394 |
|
$form->setType('archive_date_premiere_visite','hidden'); |
395 |
|
$form->setType('archive_date_derniere_visite','hidden'); |
396 |
|
$form->setType('archive_date_contradictoire','hidden'); |
397 |
|
$form->setType('archive_date_retour_contradictoire','hidden'); |
398 |
|
$form->setType('archive_date_ait','hiddendate'); |
399 |
|
$form->setType('archive_date_transmission_parquet','hidden'); |
400 |
|
|
401 |
|
// |
402 |
$form->setType('duree_validite','hidden'); |
$form->setType('duree_validite','hidden'); |
403 |
$form->setType('duree_validite_parametrage','hidden'); |
$form->setType('duree_validite_parametrage','hidden'); |
404 |
|
|
424 |
$form->setType('bible2', 'httpclick'); |
$form->setType('bible2', 'httpclick'); |
425 |
$form->setType('bible3', 'httpclick'); |
$form->setType('bible3', 'httpclick'); |
426 |
$form->setType('bible4', 'httpclick'); |
$form->setType('bible4', 'httpclick'); |
427 |
$form->setType('dossier', 'hidden'); |
$form->setType('btn_refresh', 'hidden'); |
428 |
|
$form->setType('live_preview', 'hidden'); |
429 |
|
$form->setType('dossier', 'hidden'); |
430 |
$form->setType('libelle', 'hiddenstatic'); |
$form->setType('libelle', 'hiddenstatic'); |
431 |
$form->setType('signataire_arrete','select'); |
$form->setType('signataire_arrete','select'); |
432 |
$form->setType('date_envoi_signature','datedisabled'); |
$form->setType('date_envoi_signature','datedisabled'); |
447 |
$form->setType('evenement', 'selecthiddenstatic'); |
$form->setType('evenement', 'selecthiddenstatic'); |
448 |
//$form->setType('date_evenement', 'hiddenstaticdate'); |
//$form->setType('date_evenement', 'hiddenstaticdate'); |
449 |
$form->setType('date_evenement', 'date2'); |
$form->setType('date_evenement', 'date2'); |
450 |
|
|
451 |
|
// Récupère la collectivité du dossier d'instruction |
452 |
|
$collectivite_di = $this->get_dossier_instruction_om_collectivite(); |
453 |
|
|
454 |
|
// |
455 |
|
if ($this->f->is_option_preview_pdf_enabled($collectivite_di) === true |
456 |
|
&& $this->has_an_edition() === true) { |
457 |
|
$form->setType('btn_refresh', 'httpclick'); |
458 |
|
$form->setType('live_preview', 'pdf'); |
459 |
|
} |
460 |
// necessaire pour calcul de date en modification |
// necessaire pour calcul de date en modification |
461 |
//$form->setType('delai', 'hiddenstatic'); |
//$form->setType('delai', 'hiddenstatic'); |
462 |
// les administrateurs technique et fonctionnel peuvent |
// les administrateurs technique et fonctionnel peuvent |
463 |
// modifier tous les champs de date |
// modifier tous les champs de date |
464 |
// si l'instruction a déjà été finalisée au moins une fois |
// si l'instruction a déjà été finalisée au moins une fois |
465 |
if ($this->f->isAccredited("instruction_modification_dates") |
if (($this->f->isAccredited(array(get_class($this), get_class($this)."modification_dates"), "OR") |
466 |
|
|| $this->f->isAccredited(array('instruction', 'instruction_modification_dates'), "OR")) |
467 |
&& $this->getVal("date_finalisation_courrier") != '') { |
&& $this->getVal("date_finalisation_courrier") != '') { |
468 |
$form->setType('date_envoi_signature', 'date'); |
$form->setType('date_envoi_signature', 'date'); |
469 |
$form->setType('date_retour_signature', 'date'); |
$form->setType('date_retour_signature', 'date'); |
474 |
$form->setType('date_finalisation_courrier', 'date'); |
$form->setType('date_finalisation_courrier', 'date'); |
475 |
// suivi des dates |
// suivi des dates |
476 |
if ($maj == 125) { |
if ($maj == 125) { |
477 |
|
$form->setType('date_evenement', 'hiddenstaticdate'); |
478 |
$form->setType('complement_om_html', 'hiddenstatic'); |
$form->setType('complement_om_html', 'hiddenstatic'); |
479 |
$form->setType('complement2_om_html', 'hiddenstatic'); |
$form->setType('complement2_om_html', 'hiddenstatic'); |
480 |
$form->setType('complement3_om_html', 'hiddenstatic'); |
$form->setType('complement3_om_html', 'hiddenstatic'); |
484 |
$form->setType('bible2', 'hidden'); |
$form->setType('bible2', 'hidden'); |
485 |
$form->setType('bible3', 'hidden'); |
$form->setType('bible3', 'hidden'); |
486 |
$form->setType('bible4', 'hidden'); |
$form->setType('bible4', 'hidden'); |
487 |
|
$form->setType('live_preview', 'hidden'); |
488 |
$form->setType('signataire_arrete','selecthiddenstatic'); |
$form->setType('signataire_arrete','selecthiddenstatic'); |
489 |
$form->setType('om_final_instruction_utilisateur', 'hiddenstatic'); |
$form->setType('om_final_instruction_utilisateur', 'hiddenstatic'); |
490 |
} |
} |
497 |
$form->setType('bible2', 'hidden'); |
$form->setType('bible2', 'hidden'); |
498 |
$form->setType('bible3', 'hidden'); |
$form->setType('bible3', 'hidden'); |
499 |
$form->setType('bible4', 'hidden'); |
$form->setType('bible4', 'hidden'); |
500 |
|
$form->setType('btn_refresh', 'hidden'); |
501 |
|
$form->setType('live_preview', 'hidden'); |
502 |
}else { |
}else { |
503 |
$form->setType('destinataire', 'hidden'); |
$form->setType('destinataire', 'hidden'); |
504 |
$form->setType('dossier', 'hidden'); |
$form->setType('dossier', 'hidden'); |
507 |
$form->setType('bible2', 'hidden'); |
$form->setType('bible2', 'hidden'); |
508 |
$form->setType('bible3', 'hidden'); |
$form->setType('bible3', 'hidden'); |
509 |
$form->setType('bible4', 'hidden'); |
$form->setType('bible4', 'hidden'); |
510 |
|
$form->setType('btn_refresh', 'hidden'); |
511 |
|
$form->setType('live_preview', 'hidden'); |
512 |
} |
} |
513 |
|
|
514 |
//Cache les champs pour la finalisation |
//Cache les champs pour la finalisation |
521 |
//date_retour_controle_legalite si ce n'est pas un arrêté et si ce n'est |
//date_retour_controle_legalite si ce n'est pas un arrêté et si ce n'est |
522 |
//pas un utilisateur ayant le droit spécifique |
//pas un utilisateur ayant le droit spécifique |
523 |
if ( !is_numeric($this->getVal("avis_decision"))&& |
if ( !is_numeric($this->getVal("avis_decision"))&& |
524 |
!$this->f->isAccredited("instruction_modification_dates")){ |
!$this->f->isAccredited(array("instruction", "instruction_modification_dates"), "OR")){ |
525 |
|
|
526 |
$form->setType("date_envoi_controle_legalite", "hiddendate"); |
$form->setType("date_envoi_controle_legalite", "hiddendate"); |
527 |
$form->setType("date_retour_controle_legalite", "hiddendate"); |
$form->setType("date_retour_controle_legalite", "hiddendate"); |
528 |
} |
} |
529 |
|
|
530 |
// Pour les actions finalize et unfinalize |
// Pour les actions finalize, unfinalize et notifier_commune |
531 |
if($maj == 100 || $maj == 110) { |
if($maj == 100 || $maj == 110 || $maj == 210) { |
532 |
// |
// |
533 |
foreach ($this->champs as $value) { |
foreach ($this->champs as $value) { |
534 |
// Cache tous les champs |
// Cache tous les champs |
537 |
} |
} |
538 |
} |
} |
539 |
|
|
540 |
function setSelect(&$form, $maj,&$db,$debug) { |
function setSelect(&$form, $maj, &$db = null, $debug = null) { |
541 |
/** |
/** |
542 |
* On ne surcharge pas la méthode parent car une requête sur la table |
* On ne surcharge pas la méthode parent car une requête sur la table |
543 |
* dossier est mauvaise pour les performances, car la requête qui |
* dossier est mauvaise pour les performances, car la requête qui |
577 |
|| $this->getParameter("retourformulaire") == "dossier_instruction_mes_encours" |
|| $this->getParameter("retourformulaire") == "dossier_instruction_mes_encours" |
578 |
|| $this->getParameter("retourformulaire") == "dossier_instruction_tous_encours" |
|| $this->getParameter("retourformulaire") == "dossier_instruction_tous_encours" |
579 |
|| $this->getParameter("retourformulaire") == "dossier_instruction_mes_clotures" |
|| $this->getParameter("retourformulaire") == "dossier_instruction_mes_clotures" |
580 |
|| $this->getParameter("retourformulaire") == "dossier_instruction_tous_clotures") { |
|| $this->getParameter("retourformulaire") == "dossier_instruction_tous_clotures" |
581 |
|
|| $this->getParameter("retourformulaire") == "dossier_contentieux_mes_infractions" |
582 |
|
|| $this->getParameter("retourformulaire") == "dossier_contentieux_toutes_infractions" |
583 |
|
|| $this->getParameter("retourformulaire") == "dossier_contentieux_mes_recours" |
584 |
|
|| $this->getParameter("retourformulaire") == "dossier_contentieux_tous_recours") { |
585 |
// on recupère les signataires de la multicollectivité et de celle du DI |
// on recupère les signataires de la multicollectivité et de celle du DI |
586 |
require_once "../obj/dossier_instruction.class.php"; |
require_once "../obj/dossier_instruction.class.php"; |
587 |
$di = new dossier_instruction($this->getParameter('idxformulaire'), $db, $debug); |
$di = new dossier_instruction($this->getParameter('idxformulaire'), $db, $debug); |
619 |
|
|
620 |
// Si changement de décision par instructeur commune |
// Si changement de décision par instructeur commune |
621 |
if($this->f->isUserInstructeur() === true |
if($this->f->isUserInstructeur() === true |
622 |
&& $this->f->getDivisionFromDossier($this->idxformulaire) != $_SESSION["division"] |
&& $this->getDivisionFromDossier($this->idxformulaire) != $_SESSION["division"] |
623 |
&& $this->f->isInstrCanChangeDecision($this->idxformulaire) === true) { |
&& $this->isInstrCanChangeDecision($this->idxformulaire) === true) { |
624 |
$sql .= "AND evenement.type IN ('arrete', 'changement_decision') "; |
$sql .= "AND evenement.type IN ('arrete', 'changement_decision') "; |
625 |
} |
} |
626 |
$sql .= "ORDER BY evenement.libelle, evenement.action"; |
$sql .= "ORDER BY evenement.libelle, evenement.action"; |
675 |
// lien bible4 |
// lien bible4 |
676 |
$contenu = array(_("bible")); |
$contenu = array(_("bible")); |
677 |
$form->setSelect("bible4",$contenu); |
$form->setSelect("bible4",$contenu); |
678 |
|
|
679 |
|
if ($maj == 1) { |
680 |
|
$base64 = $this->init_pdf_temp(); |
681 |
|
$form->setSelect('live_preview', array('base64'=>$base64)); |
682 |
|
$form->setSelect("btn_refresh", array(_('Actualiser'))); |
683 |
|
} |
684 |
} |
} |
685 |
|
|
686 |
function cleSecondaire($id, &$db, $val, $DEBUG) { |
function cleSecondaire($id, &$db = null, $val = array(), $DEBUG = null) { |
687 |
// |
// |
688 |
parent::cleSecondaire($id, $db, $val, $DEBUG); |
parent::cleSecondaire($id, $db, $val, $DEBUG); |
689 |
|
|
778 |
|| $this->getParameter("retourformulaire") == "dossier_instruction_mes_encours" |
|| $this->getParameter("retourformulaire") == "dossier_instruction_mes_encours" |
779 |
|| $this->getParameter("retourformulaire") == "dossier_instruction_tous_encours" |
|| $this->getParameter("retourformulaire") == "dossier_instruction_tous_encours" |
780 |
|| $this->getParameter("retourformulaire") == "dossier_instruction_mes_clotures" |
|| $this->getParameter("retourformulaire") == "dossier_instruction_mes_clotures" |
781 |
|| $this->getParameter("retourformulaire") == "dossier_instruction_tous_clotures") { |
|| $this->getParameter("retourformulaire") == "dossier_instruction_tous_clotures" |
782 |
|
|| $this->getParameter("retourformulaire") == "dossier_contentieux_mes_infractions" |
783 |
|
|| $this->getParameter("retourformulaire") == "dossier_contentieux_toutes_infractions" |
784 |
|
|| $this->getParameter("retourformulaire") == "dossier_contentieux_mes_recours" |
785 |
|
|| $this->getParameter("retourformulaire") == "dossier_contentieux_tous_recours") { |
786 |
|
|
787 |
// Vérification de la possibilité de modifier les dates si déjà éditées |
// Vérification de la possibilité de modifier les dates si déjà éditées |
788 |
if($this->valF[$champ] != "" AND !$this->f->user_is_admin) { |
if($this->valF[$champ] != "" AND !$this->f->user_is_admin) { |
799 |
} |
} |
800 |
|
|
801 |
/*Met des valeurs par défaut dans certains des sous-formulaire*/ |
/*Met des valeurs par défaut dans certains des sous-formulaire*/ |
802 |
function setValsousformulaire(&$form,$maj,$validation,$idxformulaire,$retourformulaire,$typeformulaire){ |
function setValsousformulaire(&$form, $maj, $validation, $idxformulaire, $retourformulaire, $typeformulaire, &$db = null, $DEBUG = null) { |
803 |
|
|
804 |
// |
// |
805 |
$this->retourformulaire=$retourformulaire; |
$this->retourformulaire=$retourformulaire; |
834 |
|| $this->getParameter("retourformulaire") == "dossier_instruction_mes_encours" |
|| $this->getParameter("retourformulaire") == "dossier_instruction_mes_encours" |
835 |
|| $this->getParameter("retourformulaire") == "dossier_instruction_tous_encours" |
|| $this->getParameter("retourformulaire") == "dossier_instruction_tous_encours" |
836 |
|| $this->getParameter("retourformulaire") == "dossier_instruction_mes_clotures" |
|| $this->getParameter("retourformulaire") == "dossier_instruction_mes_clotures" |
837 |
|| $this->getParameter("retourformulaire") == "dossier_instruction_tous_clotures") { |
|| $this->getParameter("retourformulaire") == "dossier_instruction_tous_clotures" |
838 |
|
|| $this->getParameter("retourformulaire") == "dossier_contentieux_mes_infractions" |
839 |
|
|| $this->getParameter("retourformulaire") == "dossier_contentieux_toutes_infractions" |
840 |
|
|| $this->getParameter("retourformulaire") == "dossier_contentieux_mes_recours" |
841 |
|
|| $this->getParameter("retourformulaire") == "dossier_contentieux_tous_recours") { |
842 |
// on recupère les signataires de la multicollectivité et de celle du DI |
// on recupère les signataires de la multicollectivité et de celle du DI |
843 |
require_once "../obj/dossier_instruction.class.php"; |
require_once "../obj/dossier_instruction.class.php"; |
844 |
$di = new dossier_instruction($this->getParameter('idxformulaire'), $db, DEBUG); |
$di = new dossier_instruction($this->getParameter('idxformulaire'), $db, DEBUG); |
871 |
$form->setVal("bible3","bible(3)"); |
$form->setVal("bible3","bible(3)"); |
872 |
$form->setVal("bible4","bible(4)"); |
$form->setVal("bible4","bible(4)"); |
873 |
} |
} |
874 |
|
|
875 |
|
// Récupère la collectivité du dossier d'instruction |
876 |
|
$collectivite_di = $this->get_dossier_instruction_om_collectivite(); |
877 |
|
|
878 |
|
// Modification |
879 |
|
if ($maj == 1 && $this->f->is_option_preview_pdf_enabled($collectivite_di) === true |
880 |
|
&& $this->has_an_edition() === true) { |
881 |
|
$form->setVal("live_preview",$this->getVal($this->clePrimaire)); |
882 |
|
$form->setVal("btn_refresh","reload_pdf_viewer()"); |
883 |
|
} |
884 |
} |
} |
885 |
|
|
886 |
|
|
906 |
|
|
907 |
$form->setBloc('date_retour_controle_legalite','F'); |
$form->setBloc('date_retour_controle_legalite','F'); |
908 |
|
|
909 |
$form->setBloc('complement_om_html','D',"","col_12"); |
if ($maj == 1) { |
910 |
$form->setFieldset('complement_om_html','D',_('Complement')); |
// Récupère la collectivité du dossier d'instruction |
911 |
$form->setFieldset('bible','F',''); |
$collectivite_di = $this->get_dossier_instruction_om_collectivite(); |
912 |
$form->setBloc('bible','F'); |
|
913 |
|
// |
914 |
$form->setBloc('complement2_om_html','D',"","col_12"); |
if ($this->f->is_option_preview_pdf_enabled($collectivite_di) === true |
915 |
$form->setFieldset('complement2_om_html','D',_('Complement 2')); |
&& $this->has_an_edition() === true) { |
916 |
$form->setFieldset('bible2','F',''); |
$form->setBloc('complement_om_html','D',"","col_12 container_preview_pdf"); |
917 |
$form->setBloc('bible2','F'); |
$form->setBloc('complement_om_html','D',"","col_6 hidelabel"); |
918 |
|
$form->setFieldset('complement_om_html','D',_('Complement')); |
919 |
$form->setBloc('complement3_om_html','D',"","col_12"); |
$form->setFieldset('bible','F',''); |
920 |
$form->setFieldset('complement3_om_html','D',_('Complement 3')); |
$form->setFieldset('complement2_om_html','D',_('Complement 2')); |
921 |
$form->setFieldset('bible3','F',''); |
$form->setFieldset('bible2','F',''); |
922 |
$form->setBloc('bible3','F'); |
$form->setFieldset('complement3_om_html','D',_('Complement 3')); |
923 |
|
$form->setFieldset('bible3','F',''); |
924 |
$form->setBloc('complement4_om_html','D',"","col_12"); |
$form->setFieldset('complement4_om_html','D',_('Complement 4')); |
925 |
$form->setFieldset('complement4_om_html','D',_('Complement 4')); |
$form->setFieldset('bible4','F',''); |
926 |
$form->setFieldset('bible4','F',''); |
$form->setBloc('bible4','F'); |
927 |
$form->setBloc('bible4','F'); |
$form->setBloc('btn_refresh','D',"","col_6 hidelabel"); |
928 |
|
$form->setFieldset('btn_refresh','D',_('Prévisualisation')); |
929 |
|
$form->setFieldset('live_preview','F'); |
930 |
|
$form->setBloc('live_preview','F'); |
931 |
|
$form->setBloc('live_preview','F'); |
932 |
|
} else { |
933 |
|
$form->setBloc('complement_om_html','D',"","col_12 hidelabel"); |
934 |
|
$form->setFieldset('complement_om_html','D',_('Complement')); |
935 |
|
$form->setFieldset('bible','F',''); |
936 |
|
$form->setFieldset('complement2_om_html','D',_('Complement 2')); |
937 |
|
$form->setFieldset('bible2','F',''); |
938 |
|
$form->setFieldset('complement3_om_html','D',_('Complement 3')); |
939 |
|
$form->setFieldset('bible3','F',''); |
940 |
|
$form->setFieldset('complement4_om_html','D',_('Complement 4')); |
941 |
|
$form->setFieldset('bible4','F',''); |
942 |
|
$form->setBloc('bible4','F'); |
943 |
|
} |
944 |
|
} else { |
945 |
|
$form->setBloc('complement_om_html','D',"","col_12 hidelabel"); |
946 |
|
$form->setFieldset('complement_om_html','D',_('Complement')); |
947 |
|
$form->setFieldset('bible','F',''); |
948 |
|
$form->setFieldset('complement2_om_html','D',_('Complement 2')); |
949 |
|
$form->setFieldset('bible2','F',''); |
950 |
|
$form->setFieldset('complement3_om_html','D',_('Complement 3')); |
951 |
|
$form->setFieldset('bible3','F',''); |
952 |
|
$form->setFieldset('complement4_om_html','D',_('Complement 4')); |
953 |
|
$form->setFieldset('bible4','F',''); |
954 |
|
$form->setBloc('bible4','F'); |
955 |
|
} |
956 |
} |
} |
957 |
} |
} |
958 |
|
|
965 |
$form->setLib('bible2', ""); |
$form->setLib('bible2', ""); |
966 |
$form->setLib('bible3', ""); |
$form->setLib('bible3', ""); |
967 |
$form->setLib('bible4', ""); |
$form->setLib('bible4', ""); |
968 |
|
$form->setLib('btn_refresh', ""); |
969 |
|
$form->setLib('live_preview', ""); |
970 |
$form->setLib('om_final_instruction_utilisateur', _("finalise par")); |
$form->setLib('om_final_instruction_utilisateur', _("finalise par")); |
971 |
} |
} |
972 |
|
|
973 |
function triggerajouter($id, &$db, $val, $DEBUG) { |
function triggerajouter($id, &$db = null, $val = array(), $DEBUG = null) { |
974 |
/** |
/** |
975 |
* Le code suivant permet de récupérer des valeurs des tables evenement |
* Le code suivant permet de récupérer des valeurs des tables evenement |
976 |
* et dossier pour les stocker dans l'instruction : |
* et dossier pour les stocker dans l'instruction : |
983 |
* - delai_notification |
* - delai_notification |
984 |
* - lettretype |
* - lettretype |
985 |
* - autorite_competente |
* - autorite_competente |
986 |
|
* - complement_om_html |
987 |
|
* - complement2_om_html |
988 |
|
* - complement3_om_html |
989 |
|
* - complement4_om_html |
990 |
|
* - complement5_om_html |
991 |
* DEPUIS LE DOSSIER D'INSTRUCTION |
* DEPUIS LE DOSSIER D'INSTRUCTION |
992 |
* - archive_delai |
* - archive_delai |
993 |
* - archive_accord_tacite |
* - archive_accord_tacite |
1330 |
return $return; |
return $return; |
1331 |
} |
} |
1332 |
|
|
1333 |
|
|
1334 |
/** |
/** |
1335 |
* Calcul des règle d'action. |
* Calcul des règle d'action selon leur type. |
1336 |
* @param string $rule Règle d'action |
* |
1337 |
* @param string $rule_name Nom de la règle |
* Types de règle : |
1338 |
* @param string $type Type de la règle |
* - date |
1339 |
|
* - numeric |
1340 |
|
* - text |
1341 |
|
* - bool |
1342 |
|
* - specific |
1343 |
|
* - technical_data |
1344 |
|
* |
1345 |
|
* @param string $rule Règle d'action. |
1346 |
|
* @param string $rule_name Nom de la règle. |
1347 |
|
* @param string $type Type de la règle. |
1348 |
* |
* |
1349 |
* @return mixed Résultat de la règle |
* @return mixed Résultat de la règle |
1350 |
*/ |
*/ |
1351 |
function regle($rule, $rule_name, $type = null) { |
public function regle($rule, $rule_name, $type = null) { |
1352 |
|
|
1353 |
// Supprime tous les espaces de la chaîne de caractère |
// Supprime tous les espaces de la chaîne de caractère |
1354 |
$rule = str_replace(' ', '', $rule); |
$rule = str_replace(' ', '', $rule); |
1362 |
return null; |
return null; |
1363 |
} |
} |
1364 |
|
|
|
// Si c'est une règle spécifique |
|
|
if ($rule_name == "regle_autorite_competente" |
|
|
|| $rule_name == "regle_etat" |
|
|
|| $rule_name == "regle_accord_tacite" |
|
|
|| $rule_name == "regle_avis") { |
|
|
// |
|
|
return $this->valF[$rule]; |
|
|
} |
|
|
|
|
1365 |
// Tableau des champs de type date |
// Tableau des champs de type date |
1366 |
$rule_type_date = array( |
$rule_type_date = array( |
1367 |
"regle_date_limite", |
"regle_date_limite", |
1375 |
"regle_date_rejet", |
"regle_date_rejet", |
1376 |
"regle_date_dernier_depot", |
"regle_date_dernier_depot", |
1377 |
"regle_date_limite_incompletude", |
"regle_date_limite_incompletude", |
1378 |
|
"regle_date_cloture_instruction", |
1379 |
|
"regle_date_premiere_visite", |
1380 |
|
"regle_date_derniere_visite", |
1381 |
|
"regle_date_contradictoire", |
1382 |
|
"regle_date_retour_contradictoire", |
1383 |
|
"regle_date_ait", |
1384 |
|
"regle_date_transmission_parquet", |
1385 |
); |
); |
1386 |
// Tableau des champs de type numérique |
// Tableau des champs de type numérique |
1387 |
$rule_type_numeric = array( |
$rule_type_numeric = array( |
1388 |
"regle_delai", |
"regle_delai", |
1389 |
"regle_delai_incompletude", |
"regle_delai_incompletude", |
1390 |
); |
); |
1391 |
|
// Tableau des champs de type text |
1392 |
|
$rule_type_text = array( |
1393 |
|
); |
1394 |
|
// Tableau des champs de type booléen |
1395 |
|
$rule_type_bool = array( |
1396 |
|
); |
1397 |
|
// Tableau des champs spécifiques |
1398 |
|
$rule_type_specific = array( |
1399 |
|
"regle_autorite_competente", |
1400 |
|
"regle_etat", |
1401 |
|
"regle_accord_tacite", |
1402 |
|
"regle_avis", |
1403 |
|
); |
1404 |
|
// Tableau des champs de données techniques |
1405 |
|
$rule_type_technical_data = array( |
1406 |
|
'regle_donnees_techniques1', |
1407 |
|
'regle_donnees_techniques2', |
1408 |
|
'regle_donnees_techniques3', |
1409 |
|
'regle_donnees_techniques4', |
1410 |
|
'regle_donnees_techniques5', |
1411 |
|
); |
1412 |
|
|
1413 |
// Définit le type du champ |
// Définit le type du champ |
1414 |
if (in_array($rule_name, $rule_type_date) == true) { |
if (in_array($rule_name, $rule_type_date) == true) { |
1417 |
if (in_array($rule_name, $rule_type_numeric) == true) { |
if (in_array($rule_name, $rule_type_numeric) == true) { |
1418 |
$type = "numeric"; |
$type = "numeric"; |
1419 |
} |
} |
1420 |
|
if (in_array($rule_name, $rule_type_text) === true) { |
1421 |
|
$type = "text"; |
1422 |
|
} |
1423 |
|
if (in_array($rule_name, $rule_type_bool) === true) { |
1424 |
|
$type = "bool"; |
1425 |
|
} |
1426 |
|
if (in_array($rule_name, $rule_type_specific) === true) { |
1427 |
|
$type = "specific"; |
1428 |
|
} |
1429 |
|
if (in_array($rule_name, $rule_type_technical_data) === true) { |
1430 |
|
$type = 'text'; |
1431 |
|
} |
1432 |
|
|
1433 |
|
// Si c'est un type spécifique ou booléen alors il n'a qu'un opérande |
1434 |
|
// Récupère directement la valeur de l'opérande |
1435 |
|
if ($type === 'specific' || $type === 'bool') { |
1436 |
|
// |
1437 |
|
return $this->get_value_for_rule($rule); |
1438 |
|
} |
1439 |
|
|
1440 |
// Initialisation des variables |
// Initialisation des variables |
1441 |
$key_date = 0; |
$key_date = 0; |
1442 |
$total_numeric = 0; |
$total_numeric = 0; |
1443 |
|
$res_text = ''; |
1444 |
|
|
1445 |
// Pour chaque opérande |
// Pour chaque opérande |
1446 |
foreach ($operands as $key => $operand) { |
foreach ($operands as $key => $operand) { |
1448 |
// Si c'est une règle de type date |
// Si c'est une règle de type date |
1449 |
if ($type == 'date') { |
if ($type == 'date') { |
1450 |
// Vérifie si au moins une des opérandes est une date |
// Vérifie si au moins une des opérandes est une date |
1451 |
if (!is_numeric($operand) |
if (is_numeric($operand) === false |
1452 |
&& isset($this->valF[$operand]) |
&& $this->get_value_for_rule($operand) !== null |
1453 |
&& $this->f->check_date($this->valF[$operand]) == true) { |
&& $this->f->check_date($this->get_value_for_rule($operand)) == true) { |
1454 |
// Récupère la position de la date |
// Récupère la position de la date |
1455 |
$key_date = $key; |
$key_date = $key; |
1456 |
} |
} |
1459 |
// Ajoute l'opérande au total |
// Ajoute l'opérande au total |
1460 |
$total_numeric += $operand; |
$total_numeric += $operand; |
1461 |
} |
} |
1462 |
if (!is_numeric($operand) |
if (is_numeric($operand) === false |
1463 |
&& isset($this->valF[$operand]) |
&& $this->get_value_for_rule($operand) !== null |
1464 |
&& is_numeric($this->valF[$operand]) == true) { |
&& is_numeric($this->get_value_for_rule($operand)) == true) { |
1465 |
// Ajoute l'opérande au total |
// Ajoute l'opérande au total |
1466 |
$total_numeric += $this->valF[$operand]; |
$total_numeric += $this->get_value_for_rule($operand); |
1467 |
} |
} |
1468 |
} |
} |
1469 |
|
|
1474 |
// Ajoute l'opérande au total |
// Ajoute l'opérande au total |
1475 |
$total_numeric += $operand; |
$total_numeric += $operand; |
1476 |
} |
} |
1477 |
if (!is_numeric($operand) |
if (is_numeric($operand) === false |
1478 |
&& isset($this->valF[$operand]) |
&& $this->get_value_for_rule($operand) !== null |
1479 |
&& is_numeric($this->valF[$operand]) == true) { |
&& is_numeric($this->get_value_for_rule($operand)) == true) { |
1480 |
// Ajoute l'opérande au total |
// Ajoute l'opérande au total |
1481 |
$total_numeric += $this->valF[$operand]; |
$total_numeric += $this->get_value_for_rule($operand); |
1482 |
} |
} |
1483 |
} |
} |
1484 |
|
|
1485 |
|
// Si c'est une règle de type text |
1486 |
|
if ($type === 'text') { |
1487 |
|
// Concatène toutes les chaînes de caractère |
1488 |
|
$res_text .= $this->get_value_for_rule($operand); |
1489 |
|
} |
1490 |
} |
} |
1491 |
|
|
1492 |
// Résultat pour une règle de type date |
// Résultat pour une règle de type date |
1501 |
// Retourne le calcul |
// Retourne le calcul |
1502 |
return $total_numeric; |
return $total_numeric; |
1503 |
} |
} |
1504 |
|
|
1505 |
|
// Résultat pour une règle de type text |
1506 |
|
if ($type === 'text') { |
1507 |
|
// Retourne la chaîne de caractère |
1508 |
|
return $res_text; |
1509 |
|
} |
1510 |
|
} |
1511 |
|
|
1512 |
|
|
1513 |
|
/** |
1514 |
|
* Récupère la valeur du champs dans l'instruction ou dans les données |
1515 |
|
* techniques. |
1516 |
|
* Spécifique au calcul des règles. |
1517 |
|
* |
1518 |
|
* @param string $field Champ |
1519 |
|
* |
1520 |
|
* @return mixed Valeur du champ |
1521 |
|
*/ |
1522 |
|
private function get_value_for_rule($field) { |
1523 |
|
// Si le champ n'existe pas dans la table instruction |
1524 |
|
if (array_key_exists($field, $this->valF) === false) { |
1525 |
|
// Récupère l'instance de la classe donnees_techniques |
1526 |
|
$inst_donnees_techniques = $this->get_inst_donnees_techniques(); |
1527 |
|
// Retourne la valeur de la donnée technique |
1528 |
|
return $inst_donnees_techniques->getVal($field); |
1529 |
|
} |
1530 |
|
|
1531 |
|
// |
1532 |
|
return $this->valF[$field]; |
1533 |
|
} |
1534 |
|
|
1535 |
|
|
1536 |
|
/** |
1537 |
|
* [get_inst_donnees_techniques description] |
1538 |
|
* |
1539 |
|
* @param [type] $donnees_techniques [description] |
1540 |
|
* |
1541 |
|
* @return [type] [description] |
1542 |
|
*/ |
1543 |
|
function get_inst_donnees_techniques($donnees_techniques = null) { |
1544 |
|
// |
1545 |
|
if (isset($this->inst_donnees_techniques) === false or |
1546 |
|
$this->inst_donnees_techniques === null) { |
1547 |
|
// |
1548 |
|
if (is_null($donnees_techniques)) { |
1549 |
|
$donnees_techniques = $this->getDonneesTechniques(); |
1550 |
|
} |
1551 |
|
// |
1552 |
|
require_once "../obj/donnees_techniques.class.php"; |
1553 |
|
$this->inst_donnees_techniques = new donnees_techniques($donnees_techniques); |
1554 |
|
} |
1555 |
|
// |
1556 |
|
return $this->inst_donnees_techniques; |
1557 |
|
} |
1558 |
|
|
1559 |
|
|
1560 |
|
/** |
1561 |
|
* Retourne l'identifiant des données techniques liées du dossier |
1562 |
|
* @return string L'identifiant des données techniques liées du dossier |
1563 |
|
*/ |
1564 |
|
function getDonneesTechniques() { |
1565 |
|
|
1566 |
|
$donnees_techniques = ''; |
1567 |
|
|
1568 |
|
$sql = "SELECT donnees_techniques |
1569 |
|
FROM ".DB_PREFIXE."donnees_techniques |
1570 |
|
WHERE dossier_instruction ='".$this->valF["dossier"]."'"; |
1571 |
|
$donnees_techniques = $this->db->getOne($sql); |
1572 |
|
$this->f->addToLog("getStatut() : db->getOne(\"".$sql."\")", VERBOSE_MODE); |
1573 |
|
if ( database::isError($donnees_techniques)){ |
1574 |
|
die(); |
1575 |
|
} |
1576 |
|
|
1577 |
|
return $donnees_techniques; |
1578 |
} |
} |
1579 |
|
|
1580 |
function triggerajouterapres($id,&$db,$val,$DEBUG) { |
|
1581 |
|
/** |
1582 |
|
* TRIGGER - triggerajouterapres. |
1583 |
|
* |
1584 |
|
* - Mise à jour des informations liées au workflow sur le dossier |
1585 |
|
* - Interface avec le référentiel ERP [105][111] |
1586 |
|
* - Mise à jour du DA |
1587 |
|
* - Historisation de la vie du DI |
1588 |
|
* |
1589 |
|
* @return boolean |
1590 |
|
*/ |
1591 |
|
function triggerajouterapres($id, &$db = null, $val = array(), $DEBUG = null) { |
1592 |
|
|
1593 |
|
// On a besoin de l'instance du dossier lié à l'événement d'instruction |
1594 |
|
$inst_di = $this->get_inst_dossier($this->valF['dossier']); |
1595 |
|
|
1596 |
|
// Instance de la classe evenement |
1597 |
|
$inst_evenement = $this->get_inst_evenement($this->valF['evenement']); |
1598 |
|
|
1599 |
/** |
/** |
1600 |
* Mise à jour des valeurs du dossier en fonction des valeurs calculées |
* Mise à jour des valeurs du dossier en fonction des valeurs calculées |
1601 |
* par l'action |
* par l'action |
1602 |
*/ |
*/ |
1603 |
$this->getValEvenement(); |
// état de complétude actuel du dossier |
1604 |
|
$incompletude = ($inst_di->getVal('incompletude') == 't' ? true : false); |
1605 |
// Initialisation |
// Initialisation |
1606 |
$valF = ""; |
$valF = ""; |
1607 |
// état de complétude actuel du dossier |
$valF_dt = ""; |
1608 |
$incompletude = $this->dossierIncomplet(); |
// |
|
|
|
1609 |
if($incompletude === FALSE) { |
if($incompletude === FALSE) { |
1610 |
// Si l'événement d'instruction est de type incompletude |
// Si l'événement d'instruction est de type incompletude |
1611 |
if($this->valEvenement['type'] == "incompletude") { |
if($inst_evenement->getVal('type') == "incompletude") { |
1612 |
// On marque le dossier en incomplétude pour application des actions |
// On marque le dossier en incomplétude pour application des actions |
1613 |
$incompletude = TRUE; |
$incompletude = TRUE; |
1614 |
// Set du flag incomplétude de la table dossier |
// Set du flag incomplétude de la table dossier |
1619 |
} else { |
} else { |
1620 |
// Si l'evenement d'instruction est de type retour ou contient une |
// Si l'evenement d'instruction est de type retour ou contient une |
1621 |
// decision, on sort d'incomplétude |
// decision, on sort d'incomplétude |
1622 |
if($this->valEvenement['type'] == "retour" OR |
if($inst_evenement->getVal('type') == "retour" OR |
1623 |
$this->valEvenement['avis_decision'] != NULL) { |
$inst_evenement->getVal('avis_decision') != NULL) { |
1624 |
// On enlève la marque d'incomplétude pour application des actions |
// On enlève la marque d'incomplétude pour application des actions |
1625 |
$incompletude = FALSE; |
$incompletude = FALSE; |
1626 |
// On enlève le flag d'incomplétude sur l'enregistrement de la table dossier |
// On enlève le flag d'incomplétude sur l'enregistrement de la table dossier |
1647 |
while ($row=& $res->fetchRow(DB_FETCHMODE_ASSOC)) { |
while ($row=& $res->fetchRow(DB_FETCHMODE_ASSOC)) { |
1648 |
|
|
1649 |
// pour chacune des regles, on applique la regle |
// pour chacune des regles, on applique la regle |
1650 |
if($row['regle_delai']!=''){ |
if ($row['regle_delai'] != '') { |
1651 |
$valF['delai'] = $this->regle($row['regle_delai'], 'regle_delai'); |
$valF['delai'] = $this->regle($row['regle_delai'], 'regle_delai'); |
1652 |
} |
} |
1653 |
if($row['regle_accord_tacite']!=''){ |
if ($row['regle_accord_tacite'] != '') { |
1654 |
$valF['accord_tacite'] = $this->regle($row['regle_accord_tacite'], 'regle_accord_tacite'); |
$valF['accord_tacite'] = $this->regle($row['regle_accord_tacite'], 'regle_accord_tacite'); |
1655 |
} |
} |
1656 |
if($row['regle_avis']!=''){ |
if ($row['regle_avis'] != '') { |
1657 |
$valF['avis_decision'] = $this->regle($row['regle_avis'], 'regle_avis'); |
$valF['avis_decision'] = $this->regle($row['regle_avis'], 'regle_avis'); |
1658 |
} |
} |
1659 |
if($row['regle_date_limite']!=''){ |
if ($row['regle_date_limite'] != '') { |
1660 |
$valF['date_limite']= $this->regle($row['regle_date_limite'], 'regle_date_limite'); |
$valF['date_limite'] = $this->regle($row['regle_date_limite'], 'regle_date_limite'); |
1661 |
} |
} |
1662 |
if($row['regle_date_complet']!=''){ |
if ($row['regle_date_complet'] != '') { |
1663 |
$valF['date_complet']= $this->regle($row['regle_date_complet'], 'regle_date_complet'); |
$valF['date_complet'] = $this->regle($row['regle_date_complet'], 'regle_date_complet'); |
1664 |
} |
} |
1665 |
if($row['regle_date_dernier_depot']!=''){ |
if ($row['regle_date_dernier_depot'] != '') { |
1666 |
$valF['date_dernier_depot']= $this->regle($row['regle_date_dernier_depot'], 'regle_date_dernier_depot'); |
$valF['date_dernier_depot'] = $this->regle($row['regle_date_dernier_depot'], 'regle_date_dernier_depot'); |
1667 |
} |
} |
1668 |
if($row['regle_date_notification_delai']!=''){ |
if ($row['regle_date_notification_delai'] != '') { |
1669 |
$valF['date_notification_delai']= $this->regle($row['regle_date_notification_delai'], 'regle_date_notification_delai'); |
$valF['date_notification_delai'] = $this->regle($row['regle_date_notification_delai'], 'regle_date_notification_delai'); |
1670 |
} |
} |
1671 |
if($row['regle_date_decision']!=''){ |
if ($row['regle_date_decision'] != '') { |
1672 |
$valF['date_decision']= $this->regle($row['regle_date_decision'], 'regle_date_decision'); |
$valF['date_decision'] = $this->regle($row['regle_date_decision'], 'regle_date_decision'); |
1673 |
} |
} |
1674 |
if($row['regle_date_rejet']!=''){ |
if ($row['regle_date_rejet'] != '') { |
1675 |
$valF['date_rejet']= $this->regle($row['regle_date_rejet'], 'regle_date_rejet'); |
$valF['date_rejet'] = $this->regle($row['regle_date_rejet'], 'regle_date_rejet'); |
1676 |
} |
} |
1677 |
if($row['regle_date_validite']!=''){ |
if ($row['regle_date_validite'] != '') { |
1678 |
$valF['date_validite']= $this->regle($row['regle_date_validite'], 'regle_date_validite'); |
$valF['date_validite'] = $this->regle($row['regle_date_validite'], 'regle_date_validite'); |
1679 |
} |
} |
1680 |
if($row['regle_date_chantier']!=''){ |
if ($row['regle_date_chantier'] != '') { |
1681 |
$valF['date_chantier']= $this->regle($row['regle_date_chantier'], 'regle_date_chantier'); |
$valF['date_chantier'] = $this->regle($row['regle_date_chantier'], 'regle_date_chantier'); |
1682 |
} |
} |
1683 |
if($row['regle_date_achevement']!=''){ |
if ($row['regle_date_achevement'] != '') { |
1684 |
$valF['date_achevement']= $this->regle($row['regle_date_achevement'], 'regle_date_achevement'); |
$valF['date_achevement'] = $this->regle($row['regle_date_achevement'], 'regle_date_achevement'); |
1685 |
} |
} |
1686 |
if($row['regle_date_conformite']!=''){ |
if ($row['regle_date_conformite'] != '') { |
1687 |
$valF['date_conformite']= $this->regle($row['regle_date_conformite'], 'regle_date_conformite'); |
$valF['date_conformite'] = $this->regle($row['regle_date_conformite'], 'regle_date_conformite'); |
1688 |
} |
} |
1689 |
if($row['regle_date_limite_incompletude']!=''){ |
if ($row['regle_date_limite_incompletude'] != '') { |
1690 |
$valF['date_limite_incompletude']= $this->regle($row['regle_date_limite_incompletude'], 'regle_date_limite_incompletude'); |
$valF['date_limite_incompletude'] = $this->regle($row['regle_date_limite_incompletude'], 'regle_date_limite_incompletude'); |
1691 |
} |
} |
1692 |
if($row['regle_delai_incompletude']!=''){ |
if ($row['regle_delai_incompletude'] != '') { |
1693 |
$valF['delai_incompletude']= $this->regle($row['regle_delai_incompletude'], 'regle_delai_incompletude'); |
$valF['delai_incompletude'] = $this->regle($row['regle_delai_incompletude'], 'regle_delai_incompletude'); |
1694 |
} |
} |
1695 |
if($row['regle_autorite_competente']!=''){ |
if ($row['regle_autorite_competente'] != '') { |
1696 |
$valF['autorite_competente']= $this->regle($row['regle_autorite_competente'], 'regle_autorite_competente'); |
$valF['autorite_competente'] = $this->regle($row['regle_autorite_competente'], 'regle_autorite_competente'); |
1697 |
} |
} |
1698 |
if($row['regle_etat']!=''){ |
if ($row['regle_etat'] != '') { |
1699 |
// 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 |
1700 |
// 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 |
1701 |
// l'état dans la variable courante |
// l'état dans la variable courante |
1702 |
if ($incompletude == FALSE OR $this->valEvenement['type'] == "incompletude") { |
if ($incompletude == FALSE OR $inst_evenement->getVal('type') == "incompletude") { |
1703 |
$valF['etat'] = $this->regle($row['regle_etat'], 'regle_etat'); |
$valF['etat'] = $this->regle($row['regle_etat'], 'regle_etat'); |
1704 |
} else { |
} else { |
1705 |
$valF['etat_pendant_incompletude'] = $this->regle($row['regle_etat'], 'regle_etat'); |
$valF['etat_pendant_incompletude'] = $this->regle($row['regle_etat'], 'regle_etat'); |
1706 |
} |
} |
1707 |
} |
} |
1708 |
|
if ($row['regle_date_cloture_instruction'] !== '') { |
1709 |
|
$valF['date_cloture_instruction'] = $this->regle($row['regle_date_cloture_instruction'], 'regle_date_cloture_instruction'); |
1710 |
|
} |
1711 |
|
if ($row['regle_date_premiere_visite'] !== '') { |
1712 |
|
$valF['date_premiere_visite'] = $this->regle($row['regle_date_premiere_visite'], 'regle_date_premiere_visite'); |
1713 |
|
} |
1714 |
|
if ($row['regle_date_derniere_visite'] !== '') { |
1715 |
|
$valF['date_derniere_visite'] = $this->regle($row['regle_date_derniere_visite'], 'regle_date_derniere_visite'); |
1716 |
|
} |
1717 |
|
if ($row['regle_date_contradictoire'] !== '') { |
1718 |
|
$valF['date_contradictoire'] = $this->regle($row['regle_date_contradictoire'], 'regle_date_contradictoire'); |
1719 |
|
} |
1720 |
|
if ($row['regle_date_retour_contradictoire'] !== '') { |
1721 |
|
$valF['date_retour_contradictoire'] = $this->regle($row['regle_date_retour_contradictoire'], 'regle_date_retour_contradictoire'); |
1722 |
|
} |
1723 |
|
if ($row['regle_date_ait'] !== '') { |
1724 |
|
$valF['date_ait'] = $this->regle($row['regle_date_ait'], 'regle_date_ait'); |
1725 |
|
} |
1726 |
|
if ($row['regle_donnees_techniques1'] !== '') { |
1727 |
|
$valF_dt[$row['cible_regle_donnees_techniques1']] = $this->regle($row['regle_donnees_techniques1'], 'regle_donnees_techniques1'); |
1728 |
|
} |
1729 |
|
if ($row['regle_donnees_techniques2'] !== '') { |
1730 |
|
$valF_dt[$row['cible_regle_donnees_techniques2']] = $this->regle($row['regle_donnees_techniques2'], 'regle_donnees_techniques2'); |
1731 |
|
} |
1732 |
|
if ($row['regle_donnees_techniques3'] !== '') { |
1733 |
|
$valF_dt[$row['cible_regle_donnees_techniques3']] = $this->regle($row['regle_donnees_techniques3'], 'regle_donnees_techniques3'); |
1734 |
|
} |
1735 |
|
if ($row['regle_donnees_techniques4'] !== '') { |
1736 |
|
$valF_dt[$row['cible_regle_donnees_techniques4']] = $this->regle($row['regle_donnees_techniques4'], 'regle_donnees_techniques4'); |
1737 |
|
} |
1738 |
|
if ($row['regle_donnees_techniques5'] !== '') { |
1739 |
|
$valF_dt[$row['cible_regle_donnees_techniques5']] = $this->regle($row['regle_donnees_techniques5'], 'regle_donnees_techniques5'); |
1740 |
|
} |
1741 |
|
if ($row['regle_date_transmission_parquet'] !== '') { |
1742 |
|
$valF['date_transmission_parquet'] = $this->regle($row['regle_date_transmission_parquet'], 'regle_date_transmission_parquet'); |
1743 |
|
} |
1744 |
} |
} |
1745 |
if($this->valEvenement['evenement_suivant_tacite'] != '') { |
|
1746 |
// Si on est pas en incomplétude on stocke l'événement tacite |
// Si l'événement a un événement suivant tacite |
1747 |
//de l'événement dans la variable courante |
if($inst_evenement->getVal('evenement_suivant_tacite') != '') { |
1748 |
|
// Si le DI n'est pas en incomplétude, l'événement tacite est stocké |
1749 |
if ($incompletude == FALSE OR $this->valEvenement['type'] != "incompletude") { |
// dans le champ evenement_suivant_tacite du dossier |
1750 |
$valF['evenement_suivant_tacite'] = $this->valEvenement['evenement_suivant_tacite']; |
if ($incompletude == false OR $inst_evenement->getVal('type') != "incompletude") { |
1751 |
} else { |
// |
1752 |
$valF['evenement_suivant_tacite_incompletude'] = $this->valEvenement['evenement_suivant_tacite']; |
$valF['evenement_suivant_tacite'] = $inst_evenement->getVal('evenement_suivant_tacite'); |
1753 |
} |
} else { |
1754 |
|
// Sinon l'événement tacite est stocké dans le champ |
1755 |
|
// evenement_suivant_tacite_incompletude du dossier |
1756 |
|
$valF['evenement_suivant_tacite_incompletude'] = $inst_evenement->getVal('evenement_suivant_tacite'); |
1757 |
|
} |
1758 |
|
} |
1759 |
|
// Si des valeurs de données techniques ont été calculées alors on met à jour l'enregistrement |
1760 |
|
if ($valF_dt != "") { |
1761 |
|
$dt_id = $this->getDonneesTechniques(); |
1762 |
|
// On met à jour le dossier |
1763 |
|
$cle = " donnees_techniques='".$dt_id."'"; |
1764 |
|
$res1 = $db->autoExecute(DB_PREFIXE.'donnees_techniques', $valF_dt, DB_AUTOQUERY_UPDATE, $cle); |
1765 |
|
$this->addToLog("triggerajouterapres(): db->autoexecute(\"".DB_PREFIXE."donnees_techniques\", ".print_r($valF_dt, true).", DB_AUTOQUERY_UPDATE, \"".$cle."\");", VERBOSE_MODE); |
1766 |
|
if (database::isError($res1)) { |
1767 |
|
die($res->getMessage()); |
1768 |
|
} |
1769 |
|
// Affichage d'informations à l'utilisateur |
1770 |
|
$this->addToMessage(_('enregistrement')." ".$this->valF['dossier']." "._('table')." dossier [".$db->affectedRows()." "._('enregistrement')." "._('mis_a_jour')."]"); |
1771 |
} |
} |
1772 |
// 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 |
1773 |
if ($valF != "") { |
if ($valF != "") { |
1783 |
} |
} |
1784 |
|
|
1785 |
/** |
/** |
1786 |
* REFERENTIEL ERP |
* Interface avec le référentiel ERP. |
1787 |
|
* |
1788 |
|
* (WS->ERP)[105] Arrêté d'un dossier PC effectué -> PC qui concerne un ERP |
1789 |
|
* (WS->ERP)[111] Décision de conformité effectuée -> PC qui concerne un ERP |
1790 |
|
* Déclencheur : |
1791 |
|
* - L'option ERP est activée |
1792 |
|
* - Le dossier est marqué comme "connecté au référentiel ERP" |
1793 |
|
* - Le dossier est de type PC |
1794 |
|
* - Le formulaire d'ajout d'un événement d'instruction est validé |
1795 |
|
* avec un événement pour lequel les services ERP doivent être |
1796 |
|
* informé |
1797 |
*/ |
*/ |
1798 |
// verification si envoi vers ERP est active |
// |
1799 |
if ($this->f->getParameter('option_erp') === 'true') { |
if ($this->f->is_option_referentiel_erp_enabled() === true |
1800 |
// la nature du dossier |
&& $inst_di->is_connected_to_referentiel_erp() === true |
1801 |
$nature_dossier = substr($this->idxformulaire,0,2); |
&& $this->f->getDATCode($this->valF['dossier']) == $this->f->getParameter('erp__dossier__nature__pc') |
1802 |
// |
&& in_array($inst_evenement->getVal($inst_evenement->clePrimaire), explode(";", $this->f->getParameter('erp__evenements__decision__pc')))) { |
|
$sql = "SELECT erp |
|
|
FROM ".DB_PREFIXE."dossier |
|
|
WHERE dossier='".$this->valF['dossier']."'"; |
|
|
$dossier_erp = $this->db->getone($sql); |
|
|
$this->addToLog("triggerajouterapres(): db->getone(\"".$sql."\");", VERBOSE_MODE); |
|
|
if (database::isError($res)) { |
|
|
die($res->getMessage()); |
|
|
} |
|
1803 |
// |
// |
1804 |
$sql = "SELECT libelle |
$infos = array( |
1805 |
FROM ".DB_PREFIXE."evenement |
"dossier_instruction" => $this->valF['dossier'], |
1806 |
WHERE evenement='".$this->valF['evenement']."'"; |
"decision" => $inst_evenement->getVal("libelle"), |
1807 |
$evenement_libelle = $this->db->getone($sql); |
); |
|
$this->addToLog("triggerajouterapres(): db->getone(\"".$sql."\");", VERBOSE_MODE); |
|
|
if (database::isError($res)) { |
|
|
die($res->getMessage()); |
|
|
} |
|
1808 |
// |
// |
1809 |
if ($dossier_erp == 't') { |
$ret = $this->f->send_message_to_referentiel_erp(105, $infos); |
1810 |
// envoi du message en cas d'un PC qui est ERP et sur lequel un evenement |
if ($ret !== true) { |
1811 |
// d'acceptation etait fait |
$this->cleanMessage(); |
1812 |
if ($nature_dossier == |
$this->addToMessage(_("Une erreur s'est produite lors de la notification (105) du référentiel ERP. Contactez votre administrateur.")); |
1813 |
$this->f->getParameter('erp_evenement_accepter_dossier_PC') |
return false; |
|
&& $this->valF['evenement'] == |
|
|
$this->f->getParameter('erp_evenement_accepter_sans_reserve')) { |
|
|
$msgenque = new MessageEnqueuer(); |
|
|
$msgenque->setDossierInstructionIdentifier($this->valF['dossier']); |
|
|
$msgenque->setDecision($evenement_libelle); |
|
|
$return = $msgenque->enqueueMessage($msgenque::$ERP_ARRETE_PC_EFFECTUE); |
|
|
//Si une erreur s'est produite on arrête le traitement et on |
|
|
//retourne une erreur |
|
|
if ($return !== 0){ |
|
|
|
|
|
$this->addToMessage(_("Une erreur s'est produite lors de ". |
|
|
"l'envoi du message au referentiel ERP. Merci de ". |
|
|
"contacter votre administrateur")); |
|
|
//On ne valide pas le formulaire |
|
|
$this->addToMessage("<br/>"._("SAISIE NON ENREGISTREE")."<br/>"); |
|
|
$this->correct = false; |
|
|
return false; |
|
|
} |
|
|
else { |
|
|
$this->addToMessage(_("Le message a ete transmis au ". |
|
|
"referentiel ERP.")); |
|
|
} |
|
|
} |
|
|
if ($this->valF['evenement'] == |
|
|
$this->f->getParameter('erp_evenement_refuser_dossier')) { |
|
|
$msgenque = new MessageEnqueuer(); |
|
|
$msgenque->setDossierInstructionIdentifier($this->valF['dossier']); |
|
|
$return = $msgenque->enqueueMessage($msgenque::$ERP_DECISION_CONFORMITE_EFFECTUE); |
|
|
//Si une erreur s'est produite on arrête le traitement et on |
|
|
//retourne une erreur |
|
|
if ($return !== 0){ |
|
|
|
|
|
$this->addToMessage(_("Une erreur s'est produite lors de ". |
|
|
"l'envoi du message au referentiel ERP. Merci de ". |
|
|
"contacter votre administrateur")); |
|
|
//On ne valide pas le formulaire |
|
|
$this->addToMessage("<br/>"._("SAISIE NON ENREGISTREE")."<br/>"); |
|
|
$this->correct = false; |
|
|
return false; |
|
|
} |
|
|
else { |
|
|
$this->addToMessage(_("Le message a ete transmis au ". |
|
|
"referentiel ERP.")); |
|
|
} |
|
|
} |
|
1814 |
} |
} |
1815 |
} // fin de if ($this->f->getParameter('option_erp') === 'true') |
$this->addToMessage(_("Notification (105) du référentiel ERP OK.")); |
1816 |
|
} |
1817 |
|
|
1818 |
// Mise à jour des données du dossier d'autorisation |
/** |
1819 |
require_once "../obj/dossier_autorisation.class.php"; |
* Mise à jour des données du DA. |
1820 |
$da = new dossier_autorisation($this->getNumDemandeAutorFromDossier($this->valF['dossier']), $this->db, DEBUG); |
*/ |
1821 |
if($da->majDossierAutorisation() === false) { |
// |
1822 |
|
$inst_da = $inst_di->get_inst_dossier_autorisation(); |
1823 |
|
// |
1824 |
|
if ($inst_da->majDossierAutorisation() === false) { |
1825 |
$this->addToMessage(_("Erreur lors de la mise a jour des donnees du dossier d'autorisation. Contactez votre administrateur.")); |
$this->addToMessage(_("Erreur lors de la mise a jour des donnees du dossier d'autorisation. Contactez votre administrateur.")); |
1826 |
$this->correct = false; |
$this->correct = false; |
1827 |
return false; |
return false; |
1828 |
} |
} |
1829 |
return $this->add_log_to_dossier('ajouter', $id, $val); |
|
1830 |
|
/** |
1831 |
|
* Finalisation automatique des instructions tacites ou retours. |
1832 |
|
*/ |
1833 |
|
// Si l'option de finalisation automatique des instructions tacites ou |
1834 |
|
// retours est activée et l'événement d'instruction a une lettre type |
1835 |
|
// associée |
1836 |
|
$collectivite_di = $this->get_dossier_instruction_om_collectivite($val['dossier']); |
1837 |
|
if ($this->f->is_option_finalisation_auto_enabled($collectivite_di) === true |
1838 |
|
&& $inst_evenement->getVal('lettretype') !== '' |
1839 |
|
&& $inst_evenement->getVal('lettretype') !== null) { |
1840 |
|
|
1841 |
|
// Rècupère l'identifiant de l'événement |
1842 |
|
$evenement_id = $inst_evenement->getVal($inst_evenement->clePrimaire); |
1843 |
|
|
1844 |
|
// Si l'événement d'instruction est identifié comme un événement |
1845 |
|
// retour |
1846 |
|
// OU l'événement d'instruction est l'événement suivant tacite du |
1847 |
|
// dossier d'instruction (incomplétude prise en compte) |
1848 |
|
if ($inst_evenement->getVal("retour") === 't' |
1849 |
|
|| ($inst_di->getVal('evenement_suivant_tacite_incompletude') === $evenement_id |
1850 |
|
|| $inst_di->getVal('evenement_suivant_tacite') === $evenement_id)) { |
1851 |
|
|
1852 |
|
// Finalise l'instruction |
1853 |
|
$inst_instruction = new instruction($this->valF[$this->clePrimaire], $this->f->db, 0); |
1854 |
|
$inst_instruction->setParameter('maj', 100); |
1855 |
|
$finalize = $inst_instruction->finalize($inst_instruction->valF); |
1856 |
|
if ($finalize === false) { |
1857 |
|
// |
1858 |
|
return false; |
1859 |
|
} |
1860 |
|
} |
1861 |
|
} |
1862 |
|
|
1863 |
|
/** |
1864 |
|
* Historisation de la vie du DI. |
1865 |
|
*/ |
1866 |
|
// |
1867 |
|
return $this->add_log_to_dossier($id, array_merge($val, $this->valF)); |
1868 |
} |
} |
1869 |
|
|
1870 |
function triggermodifierapres($id,&$db,$val,$DEBUG) { |
function triggermodifierapres($id, &$db = null, $val = array(), $DEBUG = null) { |
1871 |
/** |
/** |
1872 |
* 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 |
1873 |
* si la date de l'evenement est modifiee |
* si la date de l'evenement est modifiee |
1874 |
*/ |
*/ |
1875 |
// Initialisation |
// Initialisation |
1876 |
$valF = ""; |
$valF = ""; |
1877 |
|
$valF_dt = ""; |
1878 |
// Initialisation du type d'événement |
// Initialisation du type d'événement |
1879 |
$type_evmt = ""; |
$type_evmt = ""; |
1880 |
// Récupération de l'action correspondante à l'événement |
// Récupération de l'action correspondante à l'événement |
1927 |
if(preg_match("/date_evenement/",$row['regle_date_conformite'])){ |
if(preg_match("/date_evenement/",$row['regle_date_conformite'])){ |
1928 |
$valF['date_conformite']= $this->regle($row['regle_date_conformite'], 'regle_date_conformite'); |
$valF['date_conformite']= $this->regle($row['regle_date_conformite'], 'regle_date_conformite'); |
1929 |
} |
} |
1930 |
|
if(preg_match("/date_evenement/",$row['regle_date_cloture_instruction'])){ |
1931 |
|
$valF['date_cloture_instruction']= $this->regle($row['regle_date_cloture_instruction'], 'regle_date_cloture_instruction'); |
1932 |
|
} |
1933 |
|
if(preg_match("/date_evenement/",$row['regle_date_premiere_visite'])){ |
1934 |
|
$valF['date_premiere_visite']= $this->regle($row['regle_date_premiere_visite'], 'regle_date_premiere_visite'); |
1935 |
|
} |
1936 |
|
if(preg_match("/date_evenement/",$row['regle_date_derniere_visite'])){ |
1937 |
|
$valF['date_derniere_visite']= $this->regle($row['regle_date_derniere_visite'], 'regle_date_derniere_visite'); |
1938 |
|
} |
1939 |
|
if(preg_match("/date_evenement/",$row['regle_date_contradictoire'])){ |
1940 |
|
$valF['date_contradictoire']= $this->regle($row['regle_date_contradictoire'], 'regle_date_contradictoire'); |
1941 |
|
} |
1942 |
|
if(preg_match("/date_evenement/",$row['regle_date_retour_contradictoire'])){ |
1943 |
|
$valF['date_retour_contradictoire']= $this->regle($row['regle_date_retour_contradictoire'], 'regle_date_retour_contradictoire'); |
1944 |
|
} |
1945 |
|
if(preg_match("/date_evenement/",$row['regle_date_ait'])){ |
1946 |
|
$valF['date_ait']= $this->regle($row['regle_date_ait'], 'regle_date_ait'); |
1947 |
|
} |
1948 |
|
if(preg_match("/date_evenement/",$row['regle_date_transmission_parquet'])){ |
1949 |
|
$valF['date_transmission_parquet']= $this->regle($row['regle_date_transmission_parquet'], 'regle_date_transmission_parquet'); |
1950 |
|
} |
1951 |
|
if ($row['regle_donnees_techniques1'] !== '') { |
1952 |
|
$valF_dt[$row['cible_regle_donnees_techniques1']] = $this->regle($row['regle_donnees_techniques1'], 'regle_donnees_techniques1'); |
1953 |
|
} |
1954 |
|
if ($row['regle_donnees_techniques2'] !== '') { |
1955 |
|
$valF_dt[$row['cible_regle_donnees_techniques2']] = $this->regle($row['regle_donnees_techniques2'], 'regle_donnees_techniques2'); |
1956 |
|
} |
1957 |
|
if ($row['regle_donnees_techniques3'] !== '') { |
1958 |
|
$valF_dt[$row['cible_regle_donnees_techniques3']] = $this->regle($row['regle_donnees_techniques3'], 'regle_donnees_techniques3'); |
1959 |
|
} |
1960 |
|
if ($row['regle_donnees_techniques4'] !== '') { |
1961 |
|
$valF_dt[$row['cible_regle_donnees_techniques4']] = $this->regle($row['regle_donnees_techniques4'], 'regle_donnees_techniques4'); |
1962 |
|
} |
1963 |
|
if ($row['regle_donnees_techniques5'] !== '') { |
1964 |
|
$valF_dt[$row['cible_regle_donnees_techniques5']] = $this->regle($row['regle_donnees_techniques5'], 'regle_donnees_techniques5'); |
1965 |
|
} |
1966 |
|
} |
1967 |
|
// Si des valeurs de données techniques ont été calculées alors on met à jour l'enregistrement |
1968 |
|
if ($valF_dt != "") { |
1969 |
|
$dt_id = $this->getDonneesTechniques(); |
1970 |
|
// On met à jour le dossier |
1971 |
|
$cle = " donnees_techniques='".$dt_id."'"; |
1972 |
|
$res1 = $db->autoExecute(DB_PREFIXE.'donnees_techniques', $valF_dt, DB_AUTOQUERY_UPDATE, $cle); |
1973 |
|
$this->addToLog("triggerajouterapres(): db->autoexecute(\"".DB_PREFIXE."donnees_techniques\", ".print_r($valF_dt, true).", DB_AUTOQUERY_UPDATE, \"".$cle."\");", VERBOSE_MODE); |
1974 |
|
if (database::isError($res1)) { |
1975 |
|
die($res->getMessage()); |
1976 |
|
} |
1977 |
|
// Affichage d'informations à l'utilisateur |
1978 |
|
$this->addToMessage(_('enregistrement')." ".$this->valF['dossier']." "._('table')." dossier [".$db->affectedRows()." "._('enregistrement')." "._('mis_a_jour')."]"); |
1979 |
} |
} |
1980 |
// 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 |
1981 |
if ($valF != "") { |
if ($valF != "") { |
2002 |
if (database::isError($res)) { |
if (database::isError($res)) { |
2003 |
die($res->getMessage()); |
die($res->getMessage()); |
2004 |
} |
} |
2005 |
|
$current_id = $this->getVal($this->clePrimaire); |
2006 |
while ($row=& $res->fetchRow(DB_FETCHMODE_ASSOC)) { |
while ($row=& $res->fetchRow(DB_FETCHMODE_ASSOC)) { |
2007 |
// Si la date de retour signature est éditée on vérifie si il existe un événement automatique |
// Si la date de retour signature est éditée on vérifie si il existe un événement automatique |
2008 |
if ($this->getVal('date_retour_signature') == "" AND |
if ($this->getVal('date_retour_signature') == "" AND |
2024 |
$valNewInstr["date_retour_rar"] = $this->f->formatDate($this->valF['date_retour_rar']); |
$valNewInstr["date_retour_rar"] = $this->f->formatDate($this->valF['date_retour_rar']); |
2025 |
$valNewInstr["date_envoi_controle_legalite"] = $this->f->formatDate($this->valF['date_envoi_controle_legalite']); |
$valNewInstr["date_envoi_controle_legalite"] = $this->f->formatDate($this->valF['date_envoi_controle_legalite']); |
2026 |
$valNewInstr["date_retour_controle_legalite"] = $this->f->formatDate($this->valF['date_retour_controle_legalite']); |
$valNewInstr["date_retour_controle_legalite"] = $this->f->formatDate($this->valF['date_retour_controle_legalite']); |
2027 |
|
$new_instruction->setParameter("maj", 0); |
2028 |
|
$new_instruction->class_actions[0]["identifier"] = |
2029 |
|
"retour signature de l'instruction $current_id"; |
2030 |
$retour = $new_instruction->ajouter($valNewInstr,$db, $DEBUG); |
$retour = $new_instruction->ajouter($valNewInstr,$db, $DEBUG); |
2031 |
|
|
2032 |
//Si une erreur s'est produite et qu'il s'agit d'un problème |
//Si une erreur s'est produite et qu'il s'agit d'un problème |
2066 |
$valNewInstr["date_retour_rar"] = $this->f->formatDate($this->valF['date_retour_rar']); |
$valNewInstr["date_retour_rar"] = $this->f->formatDate($this->valF['date_retour_rar']); |
2067 |
$valNewInstr["date_envoi_controle_legalite"] = $this->f->formatDate($this->valF['date_envoi_controle_legalite']); |
$valNewInstr["date_envoi_controle_legalite"] = $this->f->formatDate($this->valF['date_envoi_controle_legalite']); |
2068 |
$valNewInstr["date_retour_controle_legalite"] = $this->f->formatDate($this->valF['date_retour_controle_legalite']); |
$valNewInstr["date_retour_controle_legalite"] = $this->f->formatDate($this->valF['date_retour_controle_legalite']); |
2069 |
$new_instruction->setParameter("maj", $this->getParameter("maj")); |
$new_instruction->setParameter("maj", 0); |
2070 |
|
$new_instruction->class_actions[0]["identifier"] = |
2071 |
|
"retour RAR de l'instruction $current_id"; |
2072 |
$retour = $new_instruction->ajouter($valNewInstr,$db, $DEBUG); |
$retour = $new_instruction->ajouter($valNewInstr,$db, $DEBUG); |
2073 |
|
|
2074 |
//Si une erreur s'est produite et qu'il s'agit d'un problème |
//Si une erreur s'est produite et qu'il s'agit d'un problème |
2116 |
} |
} |
2117 |
} |
} |
2118 |
|
|
|
//Récupération du type de l'événement |
|
|
$sql = "SELECT type |
|
|
FROM ".DB_PREFIXE."evenement |
|
|
WHERE evenement=".$this->valF['evenement']; |
|
|
$type_evmt = $db->getOne($sql); |
|
|
$this->addToLog("triggermodifierapres(): db->getone(\"".$sql."\");", VERBOSE_MODE); |
|
|
if (database::isError($type_evmt)) { |
|
|
die($type_evmt->getMessage()); |
|
|
} |
|
|
|
|
|
/** |
|
|
* REFERENTIEL ARRETE |
|
|
*/ |
|
|
// Si l'option référentiel arrêté est activé et l'événement est de type |
|
|
// arrêté |
|
|
|
|
|
if ($this->f->getParameter('option_referentiel_arrete') === 'true' AND |
|
|
$type_evmt == "arrete") { |
|
|
if ($this->valF['date_retour_signature'] != $this->getVal('date_retour_signature')) { |
|
|
$msgenque = new MessageEnqueuer(); |
|
|
$sqlArrete = "SELECT instruction.signataire_arrete as \"ws_DA_In_Signataire\", |
|
|
signataire_arrete.nom as \"ws_DA_In_Sign_Nom\", |
|
|
signataire_arrete.prenom as \"ws_DA_In_Sign_Prenom\", |
|
|
signataire_arrete.qualite as \"ws_DA_In_Sign_Qualite\", |
|
|
instruction.date_evenement as \"ws_DA_In_Dte_Redac\", |
|
|
'' as \"ws_DA_In_lieu_Redac\", |
|
|
instruction.dossier as \"ws_DA_In_N_Doss_DAS\", |
|
|
'' as \"ws_DA_In_Sigle\", |
|
|
instruction.etat as \"ws_DA_In_Decision\", |
|
|
dossier.date_depot as \"ws_DA_In_Dte_Depot_Dem\", |
|
|
dossier.terrain_adresse_voie_numero as \"ws_DA_In_N_Voie\", |
|
|
'' as \"ws_DA_In_Type_Voie\", |
|
|
dossier.terrain_adresse_voie as \"ws_DA_In_Adresse1\", |
|
|
dossier.terrain_adresse_lieu_dit as \"ws_DA_In_Adresse2\", |
|
|
dossier.terrain_adresse_code_postal as \"ws_DA_In_CP\", |
|
|
dossier.terrain_adresse_localite as \"ws_DA_In_Ville\", |
|
|
dossier.terrain_references_cadastrales as \"ws_DA_In_Nb_Parcelle\", |
|
|
'' as \"ws_DA_In_Detail_Parcelle\", |
|
|
CONCAT(donnees_techniques.am_projet_desc,' ',donnees_techniques.co_projet_desc) as \"ws_DA_In_Nature_Trvx\", |
|
|
'' as \"ws_DA_In_Destination_Trvx\", |
|
|
dossier_autorisation_type_detaille.code as \"ws_DA_In_Type_Dos_Autoris\", |
|
|
COALESCE(particulier_nom,personne_morale_raison_sociale) as \"ws_DA_In_Nom_Petition\", |
|
|
COALESCE(particulier_prenom, personne_morale_denomination) as \"ws_DA_In_Prenom_Petition\", |
|
|
'' as \"ws_DA_In_Piece_GED\", |
|
|
instruction.date_retour_signature as \"ws_DA_In_Dte_Signature\" |
|
|
FROM ".DB_PREFIXE."instruction |
|
|
LEFT JOIN ".DB_PREFIXE."signataire_arrete ON |
|
|
instruction.signataire_arrete = signataire_arrete.signataire_arrete |
|
|
LEFT JOIN ".DB_PREFIXE."dossier ON |
|
|
instruction.dossier = dossier.dossier |
|
|
LEFT JOIN ".DB_PREFIXE."lien_dossier_demandeur ON |
|
|
lien_dossier_demandeur.dossier = dossier.dossier |
|
|
LEFT JOIN ".DB_PREFIXE."demandeur ON |
|
|
lien_dossier_demandeur.demandeur = demandeur.demandeur |
|
|
LEFT JOIN ".DB_PREFIXE."dossier_instruction_type ON |
|
|
dossier.dossier_instruction_type = dossier_instruction_type.dossier_instruction_type |
|
|
LEFT JOIN ".DB_PREFIXE."dossier_autorisation_type_detaille ON |
|
|
dossier_instruction_type.dossier_autorisation_type_detaille = |
|
|
dossier_autorisation_type_detaille.dossier_autorisation_type_detaille |
|
|
LEFT JOIN ".DB_PREFIXE."donnees_techniques ON |
|
|
donnees_techniques.dossier_instruction = dossier.dossier |
|
|
WHERE instruction.instruction = ".$this->valF['instruction']; |
|
|
$resArrete = $this->db->query($sqlArrete); |
|
|
$this->f->addToLog("triggermodifierapres(): db->query(\"".$sqlArrete."\");", VERBOSE_MODE); |
|
|
if ( database::isError($resArrete)){ |
|
|
die(); |
|
|
} |
|
|
|
|
|
$rowArrete = $resArrete->fetchRow(DB_FETCHMODE_ASSOC); |
|
|
$msgenque->setArreteInfo($rowArrete); |
|
|
$return = $msgenque->enqueueMessage($msgenque::$ARRETE_ENVOI); |
|
|
//Si une erreur s'est produite on arrête le traitement et on |
|
|
//retourne une erreur |
|
|
if ($return !== 0){ |
|
|
|
|
|
//On supprime les messages précédents |
|
|
$this->msg = ''; |
|
|
$this->addToMessage(_("Une erreur s'est produite lors de ". |
|
|
"l'envoi du message au referentiel arrêté. Merci de ". |
|
|
"contacter votre administrateur.")); |
|
|
//On ne valide pas le formulaire |
|
|
$this->addToMessage("<br/>"._("SAISIE NON ENREGISTREE")."<br/>"); |
|
|
$this->correct = false; |
|
|
return false; |
|
|
} |
|
|
else { |
|
|
$this->addToMessage(_("Le message a ete transmis au ". |
|
|
"referentiel arrêté.")); |
|
|
} |
|
|
} |
|
|
} |
|
|
|
|
2119 |
// Mise à jour des données du dossier d'autorisation |
// Mise à jour des données du dossier d'autorisation |
2120 |
require_once "../obj/dossier_autorisation.class.php"; |
require_once "../obj/dossier_autorisation.class.php"; |
2121 |
$da = new dossier_autorisation($this->getNumDemandeAutorFromDossier($this->valF['dossier']), $this->db, DEBUG); |
$da = new dossier_autorisation($this->getNumDemandeAutorFromDossier($this->valF['dossier']), $this->db, DEBUG); |
2124 |
$this->correct = false; |
$this->correct = false; |
2125 |
return false; |
return false; |
2126 |
} |
} |
2127 |
return $this->add_log_to_dossier('modifier', $id, $val); |
return $this->add_log_to_dossier($id, $val); |
2128 |
} |
} |
2129 |
|
|
2130 |
function triggersupprimer($id,&$db,$val,$DEBUG) { |
function triggersupprimer($id, &$db = null, $val = array(), $DEBUG = null) { |
2131 |
/** |
/** |
2132 |
* 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 |
2133 |
* archive dans le dossier d'instruction avant de supprimer l'événement |
* archive dans le dossier d'instruction avant de supprimer l'événement |
2134 |
* d'instruction |
* d'instruction |
2135 |
*/ |
*/ |
2136 |
|
|
2137 |
// Mise à jour des 4 valeurs modifiées par l'action |
// Mise à jour des 4 valeurs modifiées par l'action |
2138 |
$valF['delai'] = $val['archive_delai']; |
$valF['delai'] = $val['archive_delai']; |
2139 |
$valF['accord_tacite'] = $val['archive_accord_tacite']; |
$valF['accord_tacite'] = $val['archive_accord_tacite']; |
2140 |
$valF['etat'] = $val['archive_etat']; |
$valF['etat'] = $val['archive_etat']; |
2141 |
if ($val['archive_avis'] != '') { |
if ($val['archive_avis'] != '') { |
2142 |
$valF['avis_decision'] = $val['archive_avis']; |
$valF['avis_decision'] = $val['archive_avis']; |
2143 |
} else { |
} else { |
2144 |
$valF['avis_decision'] = NULL; |
$valF['avis_decision'] = null; |
2145 |
} |
} |
2146 |
// Mise à jour des 10 dates avec la valeur présente dans le formulaire |
// Mise à jour des dates avec la valeur présente dans le formulaire |
2147 |
// de suppression. Si la valeur de la date est vide alors on fixe |
// de suppression. Si la valeur de la date est vide alors on fixe |
2148 |
// à la valeur NULL |
// à la valeur null |
2149 |
// |
if ($val['archive_date_complet'] != '') { |
2150 |
if ($val['archive_date_complet'] != '') { |
$valF['date_complet'] = $val['archive_date_complet']; |
2151 |
$valF['date_complet'] = $val['archive_date_complet']; |
} else { |
2152 |
} else { |
$valF['date_complet'] = null; |
2153 |
$valF['date_complet'] = NULL; |
} |
2154 |
} |
if ($val['archive_date_dernier_depot'] != '') { |
2155 |
if ($val['archive_date_dernier_depot'] != '') { |
$valF['date_dernier_depot'] = $val['archive_date_dernier_depot']; |
2156 |
$valF['date_dernier_depot'] = $val['archive_date_dernier_depot']; |
} else { |
2157 |
} else { |
$valF['date_dernier_depot'] = null; |
2158 |
$valF['date_dernier_depot'] = NULL; |
} |
2159 |
} |
if ($val['archive_date_rejet'] != '') { |
2160 |
if ($val['archive_date_rejet'] != '') { |
$valF['date_rejet'] = $val['archive_date_rejet']; |
2161 |
$valF['date_rejet'] = $val['archive_date_rejet']; |
} else { |
2162 |
} else { |
$valF['date_rejet'] = null; |
2163 |
$valF['date_rejet'] = NULL; |
} |
2164 |
} |
if ($val['archive_date_limite'] != '') { |
2165 |
if ($val['archive_date_limite'] != '') { |
$valF['date_limite'] = $val['archive_date_limite']; |
2166 |
$valF['date_limite'] = $val['archive_date_limite']; |
} else { |
2167 |
} else { |
$valF['date_limite'] = null; |
2168 |
$valF['date_limite'] = NULL; |
} |
2169 |
} |
if ($val['archive_date_notification_delai'] != '') { |
2170 |
if ($val['archive_date_notification_delai'] != '') { |
$valF['date_notification_delai'] = $val['archive_date_notification_delai']; |
2171 |
$valF['date_notification_delai'] = $val['archive_date_notification_delai']; |
} else { |
2172 |
} else { |
$valF['date_notification_delai'] = null; |
2173 |
$valF['date_notification_delai'] = NULL; |
} |
2174 |
} |
if ($val['archive_date_decision'] != '') { |
2175 |
if ($val['archive_date_decision'] != '') { |
$valF['date_decision'] = $val['archive_date_decision']; |
2176 |
$valF['date_decision'] = $val['archive_date_decision']; |
} else { |
2177 |
} else { |
$valF['date_decision'] = null; |
2178 |
$valF['date_decision'] = NULL; |
} |
2179 |
} |
if ($val['archive_date_validite'] != '') { |
2180 |
if ($val['archive_date_validite'] != '') { |
$valF['date_validite'] = $val['archive_date_validite']; |
2181 |
$valF['date_validite'] = $val['archive_date_validite']; |
} else { |
2182 |
} else { |
$valF['date_validite'] = null; |
2183 |
$valF['date_validite'] = NULL; |
} |
2184 |
} |
if ($val['archive_date_achevement'] != '') { |
2185 |
if ($val['archive_date_achevement'] != '') { |
$valF['date_achevement'] = $val['archive_date_achevement']; |
2186 |
$valF['date_achevement'] = $val['archive_date_achevement']; |
} else { |
2187 |
} else { |
$valF['date_achevement'] = null; |
2188 |
$valF['date_achevement'] = NULL; |
} |
2189 |
} |
if ($val['archive_date_chantier'] != '') { |
2190 |
if ($val['archive_date_chantier'] != '') { |
$valF['date_chantier'] = $val['archive_date_chantier']; |
2191 |
$valF['date_chantier'] = $val['archive_date_chantier']; |
} else { |
2192 |
} else { |
$valF['date_chantier'] = null; |
2193 |
$valF['date_chantier'] = NULL; |
} |
2194 |
} |
if ($val['archive_date_conformite'] != '') { |
2195 |
if ($val['archive_date_conformite'] != '') { |
$valF['date_conformite'] = $val['archive_date_conformite']; |
2196 |
$valF['date_conformite'] = $val['archive_date_conformite']; |
} else { |
2197 |
} else { |
$valF['date_conformite'] = null; |
2198 |
$valF['date_conformite'] = NULL; |
} |
2199 |
} |
if ($val['archive_incompletude'] != '') { |
2200 |
if ($val['archive_incompletude'] != '') { |
$valF['incompletude'] = $val['archive_incompletude']; |
2201 |
$valF['incompletude'] = $val['archive_incompletude']; |
} else { |
2202 |
} else { |
$valF['incompletude'] = null; |
2203 |
$valF['incompletude'] = NULL; |
} |
2204 |
} |
if ($val['archive_incomplet_notifie'] != '') { |
2205 |
if ($val['archive_incomplet_notifie'] != '') { |
$valF['incomplet_notifie'] = $val['archive_incomplet_notifie']; |
2206 |
$valF['incomplet_notifie'] = $val['archive_incomplet_notifie']; |
} else { |
2207 |
} else { |
$valF['incomplet_notifie'] = null; |
2208 |
$valF['incomplet_notifie'] = NULL; |
} |
2209 |
} |
if ($val['archive_evenement_suivant_tacite'] != '') { |
2210 |
if ($val['archive_evenement_suivant_tacite'] != '') { |
$valF['evenement_suivant_tacite'] = $val['archive_evenement_suivant_tacite']; |
2211 |
$valF['evenement_suivant_tacite'] = $val['archive_evenement_suivant_tacite']; |
} else { |
2212 |
} else { |
$valF['evenement_suivant_tacite'] = null; |
2213 |
$valF['evenement_suivant_tacite'] = NULL; |
} |
2214 |
} |
if ($val['archive_evenement_suivant_tacite_incompletude'] != '') { |
2215 |
if ($val['archive_evenement_suivant_tacite_incompletude'] != '') { |
$valF['evenement_suivant_tacite_incompletude'] = $val['archive_evenement_suivant_tacite_incompletude']; |
2216 |
$valF['evenement_suivant_tacite_incompletude'] = $val['archive_evenement_suivant_tacite_incompletude']; |
} else { |
2217 |
} else { |
$valF['evenement_suivant_tacite_incompletude'] = null; |
2218 |
$valF['evenement_suivant_tacite_incompletude'] = NULL; |
} |
2219 |
} |
if ($val['archive_etat_pendant_incompletude'] != '') { |
2220 |
if ($val['archive_etat_pendant_incompletude'] != '') { |
$valF['etat_pendant_incompletude'] = $val['archive_etat_pendant_incompletude']; |
2221 |
$valF['etat_pendant_incompletude'] = $val['archive_etat_pendant_incompletude']; |
} else { |
2222 |
} else { |
$valF['etat_pendant_incompletude'] = null; |
2223 |
$valF['etat_pendant_incompletude'] = NULL; |
} |
2224 |
} |
if ($val['archive_date_limite_incompletude'] != '') { |
2225 |
if ($val['archive_date_limite_incompletude'] != '') { |
$valF['date_limite_incompletude'] = $val['archive_date_limite_incompletude']; |
2226 |
$valF['date_limite_incompletude'] = $val['archive_date_limite_incompletude']; |
} else { |
2227 |
} else { |
$valF['date_limite_incompletude'] = null; |
2228 |
$valF['date_limite_incompletude'] = NULL; |
} |
2229 |
} |
if ($val['archive_delai_incompletude'] != '') { |
2230 |
if ($val['archive_delai_incompletude'] != '') { |
$valF['delai_incompletude'] = $val['archive_delai_incompletude']; |
2231 |
$valF['delai_incompletude'] = $val['archive_delai_incompletude']; |
} else { |
2232 |
} else { |
$valF['delai_incompletude'] = null; |
2233 |
$valF['delai_incompletude'] = NULL; |
} |
2234 |
} |
if ($val['archive_autorite_competente'] != '') { |
2235 |
if ($val['archive_autorite_competente'] != '') { |
$valF['autorite_competente'] = $val['archive_autorite_competente']; |
2236 |
$valF['autorite_competente'] = $val['archive_autorite_competente']; |
} else { |
2237 |
} else { |
$valF['autorite_competente'] = null; |
2238 |
$valF['autorite_competente'] = NULL; |
} |
2239 |
} |
$valF['date_cloture_instruction'] = null; |
2240 |
// On met à jour le dossier |
if ($val['archive_date_cloture_instruction'] !== '') { |
2241 |
$cle = " dossier='".$val['dossier']."'"; |
$valF['date_cloture_instruction'] = $val['archive_date_cloture_instruction']; |
2242 |
$res = $db->autoExecute(DB_PREFIXE.'dossier', $valF, DB_AUTOQUERY_UPDATE, $cle); |
} |
2243 |
$this->addToLog("triggersupprimer(): db->autoexecute(\"".DB_PREFIXE."dossier\", ".print_r($valF, true).", DB_AUTOQUERY_UPDATE, \"".$cle."\");", VERBOSE_MODE); |
// Dates concernant les dossiers contentieux |
2244 |
if (database::isError($res)) { |
// Date de première visite |
2245 |
die($res->getMessage()); |
$valF['date_premiere_visite'] = null; |
2246 |
} |
if ($val['archive_date_premiere_visite'] !== '') { |
2247 |
// Affichage d'informations à l'utilisateur |
$valF['date_premiere_visite'] = $val['archive_date_premiere_visite']; |
2248 |
$this->addToMessage(_("Suppression de l'instruction")." [".$db->affectedRows()." "._('enregistrement')." "._('mis_a_jour')."]"); |
} |
2249 |
|
// Date de dernière visite |
2250 |
// Mise à jour de la demande si un récépissé d'instruction correspond à l'instruction à supprimer |
$valF['date_derniere_visite'] = null; |
2251 |
|
if ($val['archive_date_derniere_visite'] !== '') { |
2252 |
|
$valF['date_derniere_visite'] = $val['archive_date_derniere_visite']; |
2253 |
|
} |
2254 |
|
// Date contradictoire |
2255 |
|
$valF['date_contradictoire'] = null; |
2256 |
|
if ($val['archive_date_contradictoire'] !== '') { |
2257 |
|
$valF['date_contradictoire'] = $val['archive_date_contradictoire']; |
2258 |
|
} |
2259 |
|
// Date de retour contradictoire |
2260 |
|
$valF['date_retour_contradictoire'] = null; |
2261 |
|
if ($val['archive_date_retour_contradictoire'] !== '') { |
2262 |
|
$valF['date_retour_contradictoire'] = $val['archive_date_retour_contradictoire']; |
2263 |
|
} |
2264 |
|
// Date de l'AIT |
2265 |
|
$valF['date_ait'] = null; |
2266 |
|
if ($val['archive_date_ait'] !== '') { |
2267 |
|
$valF['date_ait'] = $val['archive_date_ait']; |
2268 |
|
} |
2269 |
|
// Date de transmission au parquet |
2270 |
|
$valF['date_transmission_parquet'] = null; |
2271 |
|
if ($val['archive_date_transmission_parquet'] !== '') { |
2272 |
|
$valF['date_transmission_parquet'] = $val['archive_date_transmission_parquet']; |
2273 |
|
} |
2274 |
|
|
2275 |
|
// On met à jour le dossier |
2276 |
|
$cle = " dossier='".$val['dossier']."'"; |
2277 |
|
$res = $db->autoExecute(DB_PREFIXE.'dossier', $valF, DB_AUTOQUERY_UPDATE, $cle); |
2278 |
|
$this->addToLog("triggersupprimer(): db->autoexecute(\"".DB_PREFIXE."dossier\", ".print_r($valF, true).", DB_AUTOQUERY_UPDATE, \"".$cle."\");", VERBOSE_MODE); |
2279 |
|
if (database::isError($res)) { |
2280 |
|
die($res->getMessage()); |
2281 |
|
} |
2282 |
|
// Affichage d'informations à l'utilisateur |
2283 |
|
$this->addToMessage(_("Suppression de l'instruction")." [".$db->affectedRows()." "._('enregistrement')." "._('mis_a_jour')."]"); |
2284 |
|
|
2285 |
|
// Mise à jour de la demande si un récépissé d'instruction correspond à l'instruction à supprimer |
2286 |
} |
} |
2287 |
|
|
2288 |
function triggersupprimerapres($id,&$db,$val,$DEBUG) { |
function triggersupprimerapres($id, &$db = null, $val = array(), $DEBUG = null) { |
2289 |
|
|
2290 |
// Mise à jour des données du dossier d'autorisation |
// Mise à jour des données du dossier d'autorisation |
2291 |
require_once "../obj/dossier_autorisation.class.php"; |
require_once "../obj/dossier_autorisation.class.php"; |
2295 |
$this->correct = false; |
$this->correct = false; |
2296 |
return false; |
return false; |
2297 |
} |
} |
2298 |
return $this->add_log_to_dossier('supprimer', $id, $val); |
$val['evenement'] = $this->getVal('evenement'); |
2299 |
|
return $this->add_log_to_dossier($id, $val); |
2300 |
} |
} |
2301 |
|
|
2302 |
/** |
/** |
2346 |
* |
* |
2347 |
* @return [type] [description] |
* @return [type] [description] |
2348 |
*/ |
*/ |
2349 |
function verifier($val = array(), &$db, $DEBUG) { |
function verifier($val = array(), &$db = null, $DEBUG = null) { |
2350 |
parent::verifier($val, $db, $DEBUG); |
parent::verifier($val, $db, $DEBUG); |
2351 |
|
|
2352 |
if ( isset($val['evenement']) && is_numeric($val['evenement'])){ |
if ( isset($val['evenement']) && is_numeric($val['evenement'])){ |
2425 |
} |
} |
2426 |
|
|
2427 |
} |
} |
|
|
|
|
/** |
|
|
* Méthode permettant de récupérer toutes les valeurs de l'événement |
|
|
* sélectionné après validation du formulaire d'instruction |
|
|
* |
|
|
* @return array() veleurs de l'événement lié |
|
|
*/ |
|
|
|
|
|
private function getValEvenement() { |
|
|
if(!empty($this->valEvenement)) { |
|
|
return $this->valEvenement; |
|
|
} else { |
|
|
$sql = "SELECT * FROM ".DB_PREFIXE."evenement |
|
|
WHERE evenement=".$this->valF['evenement']; |
|
|
$res = $this->db->query($sql); |
|
|
$this->addToLog("getValEvenement(): db->query(\"".$sql."\");", VERBOSE_MODE); |
|
|
if (database::isError($res)) { |
|
|
die($res->getMessage()); |
|
|
} |
|
|
$this->valEvenement = $res->fetchRow(DB_FETCHMODE_ASSOC); |
|
|
return $this->valEvenement; |
|
|
} |
|
|
} |
|
|
|
|
|
/** |
|
|
* Méthode permettant de savoir si le dossier lié à l'instruction à le flag |
|
|
* incompletude à true après validation du formulaire d'instruction |
|
|
* |
|
|
* @return boolean |
|
|
*/ |
|
|
private function dossierIncomplet() { |
|
|
$sql = "SELECT incompletude FROM ".DB_PREFIXE."dossier |
|
|
WHERE dossier='".$this->valF['dossier']."'"; |
|
|
$incompletude = $this->db->getOne($sql); |
|
|
$this->addToLog("dossierIncomplet(): db->query(\"".$sql."\");", VERBOSE_MODE); |
|
|
if (database::isError($incompletude)) { |
|
|
die($incompletude->getMessage()); |
|
|
} |
|
|
if ($incompletude == 't') { |
|
|
return true; |
|
|
} else { |
|
|
return false; |
|
|
} |
|
|
} |
|
2428 |
|
|
2429 |
/** |
/** |
2430 |
* Finalisation des documents. |
* Finalisation des documents. |
2433 |
* @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) |
2434 |
*/ |
*/ |
2435 |
function manage_finalizing($mode = null, $val = array()) { |
function manage_finalizing($mode = null, $val = array()) { |
2436 |
|
// |
2437 |
|
$this->begin_treatment(__METHOD__); |
2438 |
|
|
2439 |
// Si le mode n'existe pas on retourne false |
// |
2440 |
if ($mode != "finalize" && $mode != "unfinalize") { |
$id_inst = $this->getVal($this->clePrimaire); |
|
return false; |
|
|
} |
|
2441 |
|
|
2442 |
// Recuperation de la valeur de la cle primaire de l'objet |
// |
2443 |
$id = $this->getVal($this->clePrimaire); |
$admin_msg_error = _("Veuillez contacter votre administrateur."); |
2444 |
|
$file_msg_error = _("Erreur de traitement de fichier.") |
2445 |
|
." ".$admin_msg_error; |
2446 |
|
$bdd_msg_error = _("Erreur de base de données.") |
2447 |
|
." ".$admin_msg_error; |
2448 |
|
$log_msg_error = "Finalisation non enregistrée - id instruction = %s - uid fichier = %s"; |
2449 |
|
|
2450 |
// Si on finalise le document |
// Si on finalise le document |
2451 |
if ($mode == "finalize"){ |
if ($mode == "finalize"){ |
2452 |
|
// |
2453 |
|
$etat = _('finalisation'); |
2454 |
|
|
2455 |
// Récupère la collectivite du dossier d'instruction |
// Récupère la collectivite du dossier d'instruction |
2456 |
$dossier_instruction_om_collectivite = $this->get_dossier_instruction_om_collectivite(); |
$dossier_instruction_om_collectivite = $this->get_dossier_instruction_om_collectivite(); |
2464 |
|
|
2465 |
//Métadonnées du document |
//Métadonnées du document |
2466 |
$metadata = array( |
$metadata = array( |
2467 |
'filename' => 'instruction_'.$id.'.pdf', |
'filename' => 'instruction_'.$id_inst.'.pdf', |
2468 |
'mimetype' => 'application/pdf', |
'mimetype' => 'application/pdf', |
2469 |
'size' => strlen($pdf_output) |
'size' => strlen($pdf_output) |
2470 |
); |
); |
2478 |
WHERE evenement = ".$this->getVal("evenement"); |
WHERE evenement = ".$this->getVal("evenement"); |
2479 |
$typeEvenement = $this->db->getOne($sql); |
$typeEvenement = $this->db->getOne($sql); |
2480 |
$this->addToLog(__METHOD__."(): db->getOne(\"".$sql."\");", VERBOSE_MODE); |
$this->addToLog(__METHOD__."(): db->getOne(\"".$sql."\");", VERBOSE_MODE); |
2481 |
if (database::isError($typeEvenement, true)) { |
if ($this->f->isDatabaseError($typeEvenement, true) === true) { |
2482 |
die(); |
$this->correct = false; |
2483 |
|
$this->addToMessage($bdd_msg_error); |
2484 |
|
return $this->end_treatment(__METHOD__, false); |
2485 |
} |
} |
2486 |
|
|
2487 |
//Initialisation de la variable |
//Initialisation de la variable |
2493 |
|
|
2494 |
$metadata = array_merge($metadata, $spe_metadata, $arrete_metadata); |
$metadata = array_merge($metadata, $spe_metadata, $arrete_metadata); |
2495 |
|
|
2496 |
// Si le document a déjà été finalisé |
// Si le document a déjà été finalisé on le met à jour |
2497 |
// met à jour le document mais pas son uid |
// en conservant son UID |
2498 |
if ($this->getVal("om_fichier_instruction") != ''){ |
if ($this->getVal("om_fichier_instruction") != ''){ |
|
|
|
|
// Met à jour le document |
|
2499 |
$uid = $this->f->storage->update( |
$uid = $this->f->storage->update( |
2500 |
$this->getVal("om_fichier_instruction"), $pdf_output, $metadata); |
$this->getVal("om_fichier_instruction"), $pdf_output, $metadata); |
2501 |
} |
} |
2502 |
//Sinon, ajoute le document et récupère son uid |
// Sinon on crée un nouveau document et dont on récupère l'UID |
2503 |
else { |
else { |
|
|
|
|
//Stockage du PDF |
|
2504 |
$uid = $this->f->storage->create($pdf_output, $metadata); |
$uid = $this->f->storage->create($pdf_output, $metadata); |
2505 |
} |
} |
2506 |
} |
} |
2507 |
|
|
2508 |
// Si on finalise le document |
// Si on définalise le document |
2509 |
if ($mode == "unfinalize") { |
if ($mode == "unfinalize") { |
2510 |
|
// |
2511 |
|
$etat = _('définalisation'); |
2512 |
// Récupération de l'uid du document finalisé |
// Récupération de l'uid du document finalisé |
2513 |
$uid = $this->getVal("om_fichier_instruction"); |
$uid = $this->getVal("om_fichier_instruction"); |
2514 |
} |
} |
2515 |
|
|
2516 |
// |
// Si on définalise l'UID doit être défini |
2517 |
|
// Si on finalise la création/modification du fichier doit avoir réussi |
2518 |
if ($uid == '' || $uid == 'OP_FAILURE' ) { |
if ($uid == '' || $uid == 'OP_FAILURE' ) { |
2519 |
// Stop le traitement |
$this->correct = false; |
2520 |
return false; |
$this->addToMessage($file_msg_error); |
2521 |
|
$this->addToLog(sprintf($log_msg_error, $id_inst, $uid)); |
2522 |
// Message d'echec (saut d'une ligne supplementaire avant le |
return $this->end_treatment(__METHOD__, false); |
|
// message pour qu'il soit mis en evidence) |
|
|
$this->addToLog( |
|
|
_("Finalisation non enregistree")." - ". |
|
|
_("id instruction")." = ".$id." - ". |
|
|
_("uid fichier")." = ".$uid |
|
|
); |
|
2523 |
} |
} |
2524 |
|
|
|
// Logger |
|
|
$this->addToLog(__METHOD__."() - begin", EXTRA_VERBOSE_MODE); |
|
|
|
|
2525 |
// |
// |
2526 |
foreach ($this->champs as $key => $champ) { |
foreach ($this->champs as $key => $champ) { |
2527 |
// |
// |
2529 |
} |
} |
2530 |
|
|
2531 |
// |
// |
2532 |
$val['date_evenement']=$this->dateDBToForm($val['date_evenement']); |
$val['date_evenement'] = $this->dateDBToForm($val['date_evenement']); |
2533 |
$val['archive_date_complet']=$this->dateDBToForm($val['archive_date_complet']); |
$val['archive_date_complet'] = $this->dateDBToForm($val['archive_date_complet']); |
2534 |
$val['archive_date_rejet']=$this->dateDBToForm($val['archive_date_rejet']); |
$val['archive_date_rejet'] = $this->dateDBToForm($val['archive_date_rejet']); |
2535 |
$val['archive_date_limite']=$this->dateDBToForm($val['archive_date_limite']); |
$val['archive_date_limite'] = $this->dateDBToForm($val['archive_date_limite']); |
2536 |
$val['archive_date_notification_delai']=$this->dateDBToForm($val['archive_date_notification_delai']); |
$val['archive_date_notification_delai'] = $this->dateDBToForm($val['archive_date_notification_delai']); |
2537 |
$val['archive_date_decision']=$this->dateDBToForm($val['archive_date_decision']); |
$val['archive_date_decision'] = $this->dateDBToForm($val['archive_date_decision']); |
2538 |
$val['archive_date_validite']=$this->dateDBToForm($val['archive_date_validite']); |
$val['archive_date_validite'] = $this->dateDBToForm($val['archive_date_validite']); |
2539 |
$val['archive_date_achevement']=$this->dateDBToForm($val['archive_date_achevement']); |
$val['archive_date_achevement'] = $this->dateDBToForm($val['archive_date_achevement']); |
2540 |
$val['archive_date_chantier']=$this->dateDBToForm($val['archive_date_chantier']); |
$val['archive_date_chantier'] = $this->dateDBToForm($val['archive_date_chantier']); |
2541 |
$val['archive_date_conformite']=$this->dateDBToForm($val['archive_date_conformite']); |
$val['archive_date_conformite'] = $this->dateDBToForm($val['archive_date_conformite']); |
2542 |
$val['archive_date_dernier_depot']=$this->dateDBToForm($val['archive_date_dernier_depot']); |
$val['archive_date_dernier_depot'] = $this->dateDBToForm($val['archive_date_dernier_depot']); |
2543 |
$val['archive_date_limite_incompletude']=$this->dateDBToForm($val['archive_date_limite_incompletude']); |
$val['archive_date_limite_incompletude'] = $this->dateDBToForm($val['archive_date_limite_incompletude']); |
2544 |
$val['date_finalisation_courrier']=$this->dateDBToForm($val['date_finalisation_courrier']); |
$val['date_finalisation_courrier'] = $this->dateDBToForm($val['date_finalisation_courrier']); |
2545 |
$val['date_envoi_signature']=$this->dateDBToForm($val['date_envoi_signature']); |
$val['date_envoi_signature'] = $this->dateDBToForm($val['date_envoi_signature']); |
2546 |
$val['date_retour_signature']=$this->dateDBToForm($val['date_retour_signature']); |
$val['date_retour_signature'] = $this->dateDBToForm($val['date_retour_signature']); |
2547 |
$val['date_envoi_rar']=$this->dateDBToForm($val['date_envoi_rar']); |
$val['date_envoi_rar'] = $this->dateDBToForm($val['date_envoi_rar']); |
2548 |
$val['date_retour_rar']=$this->dateDBToForm($val['date_retour_rar']); |
$val['date_retour_rar'] = $this->dateDBToForm($val['date_retour_rar']); |
2549 |
$val['date_envoi_controle_legalite']=$this->dateDBToForm($val['date_envoi_controle_legalite']); |
$val['date_envoi_controle_legalite'] = $this->dateDBToForm($val['date_envoi_controle_legalite']); |
2550 |
$val['date_retour_controle_legalite']=$this->dateDBToForm($val['date_retour_controle_legalite']); |
$val['date_retour_controle_legalite'] = $this->dateDBToForm($val['date_retour_controle_legalite']); |
2551 |
|
$val['archive_date_cloture_instruction'] = $this->dateDBToForm($val['archive_date_cloture_instruction']); |
2552 |
|
$val['archive_date_premiere_visite'] = $this->dateDBToForm($val['archive_date_premiere_visite']); |
2553 |
|
$val['archive_date_derniere_visite'] = $this->dateDBToForm($val['archive_date_derniere_visite']); |
2554 |
|
$val['archive_date_contradictoire'] = $this->dateDBToForm($val['archive_date_contradictoire']); |
2555 |
|
$val['archive_date_retour_contradictoire'] = $this->dateDBToForm($val['archive_date_retour_contradictoire']); |
2556 |
|
$val['archive_date_ait'] = $this->dateDBToForm($val['archive_date_ait']); |
2557 |
|
$val['archive_date_transmission_parquet'] = $this->dateDBToForm($val['archive_date_transmission_parquet']); |
2558 |
$this->setvalF($val); |
$this->setvalF($val); |
2559 |
|
|
2560 |
// Verification de la validite des donnees |
// Verification de la validite des donnees |
2561 |
$this->verifier($this->val, $this->db, DEBUG); |
$this->verifier($this->val, $this->db, DEBUG); |
|
// Verification du verrou |
|
|
$this->testverrou(); |
|
2562 |
// Si les verifications precedentes sont correctes, on procede a |
// Si les verifications precedentes sont correctes, on procede a |
2563 |
// la modification, sinon on ne fait rien et on retourne une erreur |
// la modification, sinon on ne fait rien et on retourne une erreur |
2564 |
if ($this->correct) { |
if ($this->correct === true) { |
|
// Execution du trigger 'before' specifique au MODE 'update' |
|
|
$this->triggermodifier($id, $this->db, $this->val, DEBUG); |
|
|
|
|
2565 |
// |
// |
2566 |
$valF = array( |
$valF = array( |
2567 |
"om_fichier_instruction" => $uid, |
"om_fichier_instruction" => $uid, |
2570 |
// |
// |
2571 |
if($mode=="finalize") { |
if($mode=="finalize") { |
2572 |
// état finalisé vrai |
// état finalisé vrai |
2573 |
$valF["om_final_instruction"] = 't'; |
$valF["om_final_instruction"] = true; |
2574 |
// ajout log utilisateur |
// ajout log utilisateur |
2575 |
$login = $_SESSION['login']; |
$login = $_SESSION['login']; |
2576 |
$nom = ""; |
$nom = ""; |
2585 |
} |
} |
2586 |
} else { |
} else { |
2587 |
// état finalisé faux |
// état finalisé faux |
2588 |
$valF["om_final_instruction"] = 'f'; |
$valF["om_final_instruction"] = false; |
2589 |
// suppression log utilisateur |
// suppression log utilisateur |
2590 |
$valF["om_final_instruction_utilisateur"] = ''; |
$valF["om_final_instruction_utilisateur"] = ''; |
2591 |
} |
} |
2593 |
// Execution de la requête de modification des donnees de l'attribut |
// Execution de la requête de modification des donnees de l'attribut |
2594 |
// valF de l'objet dans l'attribut table de l'objet |
// valF de l'objet dans l'attribut table de l'objet |
2595 |
$res = $this->db->autoExecute(DB_PREFIXE.$this->table, $valF, |
$res = $this->db->autoExecute(DB_PREFIXE.$this->table, $valF, |
2596 |
DB_AUTOQUERY_UPDATE, $this->getCle($id)); |
DB_AUTOQUERY_UPDATE, $this->getCle($id_inst)); |
2597 |
$this->addToLog(__METHOD__."() : db->autoExecute(\"".DB_PREFIXE.$this->table."\", ".print_r($valF, true).", DB_AUTOQUERY_UPDATE, \"".$this->getCle($id)."\")", VERBOSE_MODE); |
$this->addToLog(__METHOD__."() : db->autoExecute(\"".DB_PREFIXE.$this->table."\", ".print_r($valF, true).", DB_AUTOQUERY_UPDATE, \"".$this->getCle($id_inst)."\")", VERBOSE_MODE); |
2598 |
// Si une erreur survient |
// |
2599 |
if (database::isError($res, true)) { |
if ($this->f->isDatabaseError($res, true) === true) { |
2600 |
// Appel de la methode de recuperation des erreurs |
$this->correct = false; |
2601 |
$this->erreur_db($res->getDebugInfo(), $res->getMessage(), ''); |
$this->addToMessage($bdd_msg_error); |
2602 |
} else { |
return $this->end_treatment(__METHOD__, false); |
2603 |
// Log |
} |
|
$this->addToLog(_("Requete executee"), VERBOSE_MODE); |
|
|
// Log |
|
|
$message = _("Enregistrement")." ".$id." "; |
|
|
$message .= _("de la table")." \"".$this->table."\" "; |
|
|
$message .= "[ ".$this->db->affectedRows()." "; |
|
|
$message .= _("enregistrement(s) mis a jour")." ]"; |
|
|
$this->addToLog($message, VERBOSE_MODE); |
|
|
// Mise en place du verrou pour ne pas finaliser plusieurs fois |
|
|
// le meme document |
|
|
$this->verrouille(); |
|
|
// Execution du trigger 'after' specifique au MODE 'update' |
|
|
//$this->triggermodifierapres($id, $this->db, $val, DEBUG); |
|
|
|
|
|
if($mode == "finalize") { |
|
|
$etat = _('finalisation'); |
|
|
} else { |
|
|
$etat = _('definalisation'); |
|
|
} |
|
|
$this->msg = ""; |
|
|
$this->addToMessage(sprintf(_("La %s du document s'est effectuee avec succes."), $etat)); |
|
2604 |
|
|
2605 |
return true; |
// |
2606 |
} |
$this->addToMessage(sprintf(_("La %s du document s'est effectuee avec succes."), $etat)); |
2607 |
} else { |
// |
2608 |
// Message d'echec (saut d'une ligne supplementaire avant le |
if ($this->add_log_to_dossier($id_inst, $val) === false) { |
2609 |
// message pour qu'il soit mis en evidence) |
return $this->end_treatment(__METHOD__, false); |
2610 |
$this->addToLog( |
} |
2611 |
_("Finalisation non enregistree")." - ". |
// |
2612 |
_("id instruction")." = ".$id." - ". |
return $this->end_treatment(__METHOD__, true); |
|
_("uid fichier")." = ".$uid |
|
|
); |
|
|
return false; |
|
2613 |
} |
} |
2614 |
|
// L'appel de verifier() a déjà positionné correct à false |
2615 |
|
// et défini un message d'erreur. |
2616 |
|
$this->addToLog(sprintf($log_msg_error, $id_inst, $uid)); |
2617 |
|
return $this->end_treatment(__METHOD__, false); |
2618 |
} |
} |
2619 |
|
|
2620 |
/** |
/** |
2730 |
return $evenement_libelle; |
return $evenement_libelle; |
2731 |
} |
} |
2732 |
|
|
2733 |
|
|
2734 |
|
/** |
2735 |
|
* Récupération du champ ERP du dossier d'instruction. |
2736 |
|
* |
2737 |
|
* @return boolean |
2738 |
|
*/ |
2739 |
|
public function get_concerne_erp() { |
2740 |
|
// |
2741 |
|
if(empty($this->specificMetadata)) { |
2742 |
|
$this->getSpecificMetadata(); |
2743 |
|
} |
2744 |
|
// |
2745 |
|
return $this->specificMetadata->erp; |
2746 |
|
} |
2747 |
|
|
2748 |
|
|
2749 |
/** |
/** |
2750 |
* 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 |
2751 |
* nécessaire à l'ajout d'un document. |
* nécessaire à l'ajout d'un document. |
2763 |
dossier_instruction_type.code as dossier_instruction_type, |
dossier_instruction_type.code as dossier_instruction_type, |
2764 |
etat_dossier_autorisation.libelle as statut, |
etat_dossier_autorisation.libelle as statut, |
2765 |
dossier_autorisation_type.code as dossier_autorisation_type, |
dossier_autorisation_type.code as dossier_autorisation_type, |
2766 |
groupe.code as groupe_instruction |
groupe.code as groupe_instruction, |
2767 |
|
CASE WHEN dossier.erp IS TRUE |
2768 |
|
THEN 'true' |
2769 |
|
ELSE 'false' |
2770 |
|
END as erp |
2771 |
FROM ".DB_PREFIXE."dossier |
FROM ".DB_PREFIXE."dossier |
2772 |
LEFT JOIN ".DB_PREFIXE."dossier_instruction_type |
LEFT JOIN ".DB_PREFIXE."dossier_instruction_type |
2773 |
ON dossier.dossier_instruction_type = dossier_instruction_type.dossier_instruction_type |
ON dossier.dossier_instruction_type = dossier_instruction_type.dossier_instruction_type |
2857 |
|
|
2858 |
// Récupération de la valeur actuelle du délai, de l'accord tacite, |
// Récupération de la valeur actuelle du délai, de l'accord tacite, |
2859 |
// de l'état et de l'avis du dossier d'instruction |
// de l'état et de l'avis du dossier d'instruction |
2860 |
$return['archive_delai']=$row['delai']; |
$return['archive_delai'] = $row['delai']; |
2861 |
$return['archive_accord_tacite']=$row['accord_tacite']; |
$return['archive_accord_tacite'] = $row['accord_tacite']; |
2862 |
$return['archive_etat']=$row['etat']; |
$return['archive_etat'] = $row['etat']; |
2863 |
$return['archive_avis']=$row['avis_decision']; |
$return['archive_avis'] = $row['avis_decision']; |
2864 |
// Récupération de la valeur actuelle des 9 dates du dossier |
// Récupération de la valeur actuelle des dates du dossier |
2865 |
// d'instruction |
// d'instruction |
2866 |
$return['archive_date_complet']=$row['date_complet']; |
$return['archive_date_complet'] = $row['date_complet']; |
2867 |
$return['archive_date_dernier_depot']=$row['date_dernier_depot']; |
$return['archive_date_dernier_depot'] = $row['date_dernier_depot']; |
2868 |
$return['archive_date_rejet']= $row['date_rejet']; |
$return['archive_date_rejet'] = $row['date_rejet']; |
2869 |
$return['archive_date_limite']= $row['date_limite']; |
$return['archive_date_limite'] = $row['date_limite']; |
2870 |
$return['archive_date_notification_delai']= $row['date_notification_delai']; |
$return['archive_date_notification_delai'] = $row['date_notification_delai']; |
2871 |
$return['archive_date_decision']= $row['date_decision']; |
$return['archive_date_decision'] = $row['date_decision']; |
2872 |
$return['archive_date_validite']= $row['date_validite']; |
$return['archive_date_validite'] = $row['date_validite']; |
2873 |
$return['archive_date_achevement']= $row['date_achevement']; |
$return['archive_date_achevement'] = $row['date_achevement']; |
2874 |
$return['archive_date_chantier']= $row['date_chantier']; |
$return['archive_date_chantier'] = $row['date_chantier']; |
2875 |
$return['archive_date_conformite']= $row['date_conformite']; |
$return['archive_date_conformite'] = $row['date_conformite']; |
2876 |
$return['archive_incompletude']= $row['incompletude']; |
$return['archive_incompletude'] = $row['incompletude']; |
2877 |
$return['archive_incomplet_notifie']= $row['incomplet_notifie']; |
$return['archive_incomplet_notifie'] = $row['incomplet_notifie']; |
2878 |
$return['archive_evenement_suivant_tacite']= $row['evenement_suivant_tacite']; |
$return['archive_evenement_suivant_tacite'] = $row['evenement_suivant_tacite']; |
2879 |
$return['archive_evenement_suivant_tacite_incompletude']= $row['evenement_suivant_tacite_incompletude']; |
$return['archive_evenement_suivant_tacite_incompletude'] = $row['evenement_suivant_tacite_incompletude']; |
2880 |
$return['archive_etat_pendant_incompletude']= $row['etat_pendant_incompletude']; |
$return['archive_etat_pendant_incompletude'] = $row['etat_pendant_incompletude']; |
2881 |
$return['archive_date_limite_incompletude']= $row['date_limite_incompletude']; |
$return['archive_date_limite_incompletude'] = $row['date_limite_incompletude']; |
2882 |
$return['archive_delai_incompletude']= $row['delai_incompletude']; |
$return['archive_delai_incompletude'] = $row['delai_incompletude']; |
2883 |
$return['archive_autorite_competente']= $row['autorite_competente']; |
$return['archive_autorite_competente'] = $row['autorite_competente']; |
2884 |
$return['duree_validite']= $row['duree_validite']; |
$return['duree_validite'] = $row['duree_validite']; |
2885 |
$return['date_depot']= $row['date_depot']; |
$return['date_depot'] = $row['date_depot']; |
2886 |
|
$return['archive_date_cloture_instruction'] = $row['date_cloture_instruction']; |
2887 |
|
$return['archive_date_premiere_visite'] = $row['date_premiere_visite']; |
2888 |
|
$return['archive_date_derniere_visite'] = $row['date_derniere_visite']; |
2889 |
|
$return['archive_date_contradictoire'] = $row['date_contradictoire']; |
2890 |
|
$return['archive_date_retour_contradictoire'] = $row['date_retour_contradictoire']; |
2891 |
|
$return['archive_date_ait'] = $row['date_ait']; |
2892 |
|
$return['archive_date_transmission_parquet'] = $row['date_transmission_parquet']; |
2893 |
} |
} |
2894 |
|
|
2895 |
// Retour de la fonction |
// Retour de la fonction |
2951 |
if ($row['date_dernier_depot'] != '') { |
if ($row['date_dernier_depot'] != '') { |
2952 |
$this->valF['archive_date_dernier_depot']=$row['date_dernier_depot']; |
$this->valF['archive_date_dernier_depot']=$row['date_dernier_depot']; |
2953 |
} |
} |
2954 |
if ($row['date_rejet']!='') { |
if ($row['date_rejet'] != '') { |
2955 |
$this->valF['archive_date_rejet']= $row['date_rejet']; |
$this->valF['archive_date_rejet']= $row['date_rejet']; |
2956 |
} |
} |
2957 |
if ($row['date_limite']!='') { |
if ($row['date_limite'] != '') { |
2958 |
$this->valF['archive_date_limite']= $row['date_limite']; |
$this->valF['archive_date_limite']= $row['date_limite']; |
2959 |
} |
} |
2960 |
if ($row['date_notification_delai']!='') { |
if ($row['date_notification_delai'] != '') { |
2961 |
$this->valF['archive_date_notification_delai']= $row['date_notification_delai']; |
$this->valF['archive_date_notification_delai']= $row['date_notification_delai']; |
2962 |
} |
} |
2963 |
if ($row['date_decision']!='') { |
if ($row['date_decision'] != '') { |
2964 |
$this->valF['archive_date_decision']= $row['date_decision']; |
$this->valF['archive_date_decision']= $row['date_decision']; |
2965 |
} |
} |
2966 |
if ($row['date_validite']!='') { |
if ($row['date_validite'] != '') { |
2967 |
$this->valF['archive_date_validite']= $row['date_validite']; |
$this->valF['archive_date_validite']= $row['date_validite']; |
2968 |
} |
} |
2969 |
if ($row['date_achevement']!='') { |
if ($row['date_achevement'] != '') { |
2970 |
$this->valF['archive_date_achevement']= $row['date_achevement']; |
$this->valF['archive_date_achevement']= $row['date_achevement']; |
2971 |
} |
} |
2972 |
if ($row['date_chantier']!='') { |
if ($row['date_chantier'] != '') { |
2973 |
$this->valF['archive_date_chantier']= $row['date_chantier']; |
$this->valF['archive_date_chantier']= $row['date_chantier']; |
2974 |
} |
} |
2975 |
if ($row['date_conformite']!='') { |
if ($row['date_conformite'] != '') { |
2976 |
$this->valF['archive_date_conformite']= $row['date_conformite']; |
$this->valF['archive_date_conformite']= $row['date_conformite']; |
2977 |
} |
} |
2978 |
if ($row['incompletude']!='') { |
if ($row['incompletude'] != '') { |
2979 |
$this->valF['archive_incompletude']= $row['incompletude']; |
$this->valF['archive_incompletude']= $row['incompletude']; |
2980 |
} |
} |
2981 |
if ($row['incomplet_notifie']!='') { |
if ($row['incomplet_notifie'] != '') { |
2982 |
$this->valF['archive_incomplet_notifie']= $row['incomplet_notifie']; |
$this->valF['archive_incomplet_notifie']= $row['incomplet_notifie']; |
2983 |
} |
} |
2984 |
if ($row['evenement_suivant_tacite']!='') { |
if ($row['evenement_suivant_tacite'] != '') { |
2985 |
$this->valF['archive_evenement_suivant_tacite']= $row['evenement_suivant_tacite']; |
$this->valF['archive_evenement_suivant_tacite']= $row['evenement_suivant_tacite']; |
2986 |
} |
} |
2987 |
if ($row['evenement_suivant_tacite_incompletude']!='') { |
if ($row['evenement_suivant_tacite_incompletude'] != '') { |
2988 |
$this->valF['archive_evenement_suivant_tacite_incompletude']= $row['evenement_suivant_tacite_incompletude']; |
$this->valF['archive_evenement_suivant_tacite_incompletude']= $row['evenement_suivant_tacite_incompletude']; |
2989 |
} |
} |
2990 |
if ($row['etat_pendant_incompletude']!='') { |
if ($row['etat_pendant_incompletude'] != '') { |
2991 |
$this->valF['archive_etat_pendant_incompletude']= $row['etat_pendant_incompletude']; |
$this->valF['archive_etat_pendant_incompletude']= $row['etat_pendant_incompletude']; |
2992 |
} |
} |
2993 |
if ($row['date_limite_incompletude']!='') { |
if ($row['date_limite_incompletude'] != '') { |
2994 |
$this->valF['archive_date_limite_incompletude']= $row['date_limite_incompletude']; |
$this->valF['archive_date_limite_incompletude']= $row['date_limite_incompletude']; |
2995 |
} |
} |
2996 |
if ($row['delai_incompletude']!='') { |
if ($row['delai_incompletude'] != '') { |
2997 |
$this->valF['archive_delai_incompletude']= $row['delai_incompletude']; |
$this->valF['archive_delai_incompletude']= $row['delai_incompletude']; |
2998 |
} |
} |
2999 |
if ($row['autorite_competente']!='') { |
if ($row['autorite_competente'] != '') { |
3000 |
$this->valF['archive_autorite_competente']= $row['autorite_competente']; |
$this->valF['archive_autorite_competente']= $row['autorite_competente']; |
3001 |
} |
} |
3002 |
if ($row['duree_validite']!='') { |
if ($row['duree_validite'] != '') { |
3003 |
$this->valF['duree_validite']= $row['duree_validite']; |
$this->valF['duree_validite']= $row['duree_validite']; |
3004 |
} |
} |
3005 |
if ($row['date_depot']!='') { |
if ($row['date_depot'] != '') { |
3006 |
$this->valF['date_depot']= $row['date_depot']; |
$this->valF['date_depot']= $row['date_depot']; |
3007 |
} |
} |
3008 |
|
// Dates concernant les dossiers contentieux |
3009 |
|
if ($row['date_cloture_instruction'] != '') { |
3010 |
|
$this->valF['archive_date_cloture_instruction']= $row['date_cloture_instruction']; |
3011 |
|
} |
3012 |
|
if ($row['date_premiere_visite'] != '') { |
3013 |
|
$this->valF['archive_date_premiere_visite']= $row['date_premiere_visite']; |
3014 |
|
} |
3015 |
|
if ($row['date_derniere_visite'] != '') { |
3016 |
|
$this->valF['archive_date_derniere_visite']= $row['date_derniere_visite']; |
3017 |
|
} |
3018 |
|
if ($row['date_contradictoire'] != '') { |
3019 |
|
$this->valF['archive_date_contradictoire']= $row['date_contradictoire']; |
3020 |
|
} |
3021 |
|
if ($row['date_retour_contradictoire'] != '') { |
3022 |
|
$this->valF['archive_date_retour_contradictoire']= $row['date_retour_contradictoire']; |
3023 |
|
} |
3024 |
|
if ($row['date_ait'] != '') { |
3025 |
|
$this->valF['archive_date_ait']= $row['date_ait']; |
3026 |
|
} |
3027 |
|
if ($row['date_transmission_parquet'] != '') { |
3028 |
|
$this->valF['archive_date_transmission_parquet']= $row['date_transmission_parquet']; |
3029 |
|
} |
3030 |
} |
} |
3031 |
|
|
3032 |
// {{{ |
// {{{ |
3196 |
// Récupère la valeur du champ lettretype |
// Récupère la valeur du champ lettretype |
3197 |
$lettretype = $this->getVal("lettretype"); |
$lettretype = $this->getVal("lettretype"); |
3198 |
// Si le champ est vide |
// Si le champ est vide |
3199 |
if (empty($lettretype)) { |
if ($lettretype !== '' && $lettretype !== null) { |
3200 |
// |
// |
3201 |
return false; |
return true; |
3202 |
} |
} |
3203 |
|
|
3204 |
// |
// |
3205 |
return true; |
return false; |
3206 |
} |
} |
3207 |
|
|
3208 |
/** |
/** |
3214 |
*/ |
*/ |
3215 |
function is_editable() { |
function is_editable() { |
3216 |
// Contrôle si l'utilisateur possède un bypass |
// Contrôle si l'utilisateur possède un bypass |
3217 |
$bypass = $this->f->isAccredited(get_class()."_modifier_bypass"); |
$bypass = $this->f->isAccredited(get_class($this)."_modifier_bypass"); |
3218 |
// |
// |
3219 |
if ($bypass == true) { |
if ($bypass == true) { |
|
|
|
3220 |
// |
// |
3221 |
return true; |
return true; |
3222 |
} |
} |
3223 |
|
|
|
// Si l'utilisateur est un intructeur qui ne correspond pas à la |
|
|
// division du dossier |
|
|
if ($this->f->isUserInstructeur() |
|
|
&& $this->f->om_utilisateur["division"] != $this->getDivisionFromDossier() |
|
|
&& $this->f->isAccredited("instruction_changer_decision") === false) { |
|
|
|
|
|
// |
|
|
return false; |
|
|
} |
|
|
|
|
|
// si instructeur commune |
|
|
if($this->f->isAccredited("instruction_changer_decision") === true |
|
|
&& $this->f->om_utilisateur["division"] != $this->getDivisionFromDossier() |
|
|
&& ($this->f->isInstrCanChangeDecision($this->getVal('dossier')) !== true |
|
|
|| $this->getVal('created_by_commune') !== 't')) { |
|
|
return false; |
|
|
} |
|
3224 |
// Si l'utilisateur est un instructeur, que le dossier est cloturé et |
// Si l'utilisateur est un instructeur, que le dossier est cloturé et |
3225 |
// que l'événement n'est pas identifié comme non verrouillable |
// que l'événement n'est pas identifié comme non verrouillable |
3226 |
if ($this->f->isUserInstructeur() |
if ($this->f->isUserInstructeur() |
3227 |
&& $this->getStatutAutorisationDossier($this->getParameter("idxformulaire")) == "cloture" |
&& $this->getStatutAutorisationDossier($this->getParameter("idxformulaire")) == "cloture" |
3228 |
&& $this->checkEvenementNonVerrouillable($this->getVal("instruction")) === false) { |
&& $this->checkEvenementNonVerrouillable($this->getVal("instruction")) === false) { |
|
|
|
3229 |
// |
// |
3230 |
return false; |
return false; |
3231 |
} |
} |
3232 |
|
|
3233 |
|
// Si l'utilisateur est un intructeur qui correspond à la division du |
3234 |
|
// dossier |
3235 |
|
if ($this->is_instructeur_from_division_dossier() === true) { |
3236 |
|
// |
3237 |
|
return true; |
3238 |
|
} |
3239 |
|
|
3240 |
|
// Si l'utilisateur est instructeur de la commune du dossier et que la |
3241 |
|
// décision peut être changée par la commune. |
3242 |
|
if ($this->is_instructeur_from_collectivite_dossier() === true and |
3243 |
|
$this->isInstrCanChangeDecision($this->getVal('dossier')) === true) { |
3244 |
|
return true; |
3245 |
|
} |
3246 |
|
|
3247 |
|
// Si l'utilisateur est instructeur de la commune du dossier et que |
3248 |
|
// l'instruction est créée par un instructeur de la commune |
3249 |
|
if ($this->is_instructeur_from_collectivite_dossier() === true and |
3250 |
|
$this->getVal('created_by_commune') === 't') { |
3251 |
|
return true; |
3252 |
|
} |
3253 |
|
|
3254 |
// |
// |
3255 |
return true; |
return false; |
3256 |
} |
} |
3257 |
|
|
3258 |
/** |
/** |
3259 |
* CONDITION - is_deletable. |
* CONDITION - is_deletable. |
3260 |
* |
* |
3261 |
* Condition pour lma modification. |
* Condition pour la suppression. |
3262 |
* |
* |
3263 |
* @return boolean |
* @return boolean |
3264 |
*/ |
*/ |
3265 |
function is_deletable() { |
function is_deletable() { |
3266 |
// Contrôle si l'utilisateur possède un bypass |
// Contrôle si l'utilisateur possède un bypass intégral |
3267 |
$bypass = $this->f->isAccredited(get_class()."_supprimer_bypass"); |
$bypass = $this->f->isAccredited(get_class($this)."_supprimer_bypass"); |
3268 |
// |
// |
3269 |
if ($bypass == true) { |
if ($bypass == true) { |
3270 |
|
|
3273 |
} |
} |
3274 |
|
|
3275 |
// Si l'utilisateur est un intructeur qui ne correspond pas à la |
// Si l'utilisateur est un intructeur qui ne correspond pas à la |
3276 |
// division du dossier |
// division du dossier et si l'utilisateur n'a pas la permission bypass |
3277 |
if ($this->f->isUserInstructeur() |
// de la division |
3278 |
&& $this->f->om_utilisateur["division"] != $this->getDivisionFromDossier()) { |
if ($this->is_instructeur_from_division_dossier() === false |
3279 |
|
&& $this->f->isAccredited(get_class()."_supprimer_bypass_division") === false) { |
3280 |
|
|
3281 |
// |
// |
3282 |
return false; |
return false; |
3283 |
} |
} |
3284 |
|
|
3285 |
|
// l'événement est-il le dernier ? |
3286 |
|
$dernier_evenement = false; |
3287 |
|
// instanciation dossier |
3288 |
|
require_once "../obj/dossier.class.php"; |
3289 |
|
$dossier = new dossier($this->getVal('dossier'), $this->db, DEBUG); |
3290 |
|
// récupération dernier événement |
3291 |
|
$id_dernier_evenement = $dossier->get_dernier_evenement(); |
3292 |
|
if ($id_dernier_evenement == $this->getVal($this->clePrimaire)) { |
3293 |
|
$dernier_evenement = true; |
3294 |
|
} |
3295 |
|
|
3296 |
|
// Si dossier cloturé ou si pas dernier événement |
3297 |
|
// ou de type retour ou si une date est renseignée |
3298 |
|
// ET utilisateur non administrateur |
3299 |
|
if ($this->getStatutAutorisationDossier($this->getVal('dossier')) == 'cloture' |
3300 |
|
|| $dernier_evenement == false |
3301 |
|
|| $this->is_evenement_retour($this->getVal("evenement")) == true |
3302 |
|
|| $this->getVal('date_envoi_signature') != '' |
3303 |
|
|| $this->getVal('date_retour_signature') != '' |
3304 |
|
|| $this->getVal('date_envoi_rar') != '' |
3305 |
|
|| $this->getVal('date_retour_rar') != '' |
3306 |
|
|| $this->getVal('date_envoi_controle_legalite') != '' |
3307 |
|
|| $this->getVal('date_retour_controle_legalite') != '') { |
3308 |
|
// pas le droit de supprimer |
3309 |
|
return false;; |
3310 |
|
} |
3311 |
|
|
3312 |
// |
// |
3313 |
return true; |
return true; |
3314 |
} |
} |
3315 |
|
|
3316 |
|
|
3317 |
|
/** |
3318 |
|
* Vérifie que l'utilisateur est instructeur et qu'il est de la division du |
3319 |
|
* dossier. |
3320 |
|
* |
3321 |
|
* @return, boolean true/false |
3322 |
|
*/ |
3323 |
|
function is_instructeur_from_collectivite_dossier() { |
3324 |
|
if ($this->f->isUserInstructeur() === true and |
3325 |
|
$this->f->om_utilisateur["om_collectivite"] == $this->get_dossier_instruction_om_collectivite()) { |
3326 |
|
return true; |
3327 |
|
} |
3328 |
|
return false; |
3329 |
|
} |
3330 |
|
|
3331 |
/** |
/** |
3332 |
* CONDITION - is_addable. |
* CONDITION - is_addable. |
3333 |
* |
* |
3337 |
*/ |
*/ |
3338 |
function is_addable() { |
function is_addable() { |
3339 |
// Contrôle si l'utilisateur possède un bypass |
// Contrôle si l'utilisateur possède un bypass |
3340 |
$bypass = $this->f->isAccredited(get_class()."_ajouter_bypass"); |
$bypass = $this->f->isAccredited(get_class($this)."_ajouter_bypass"); |
3341 |
// |
// |
3342 |
if ($bypass == true) { |
if ($bypass == true) { |
3343 |
|
|
3344 |
// |
// |
3345 |
return true; |
return true; |
3346 |
} |
} |
3347 |
|
// Si l'utilisateur est un intructeur qui correspond à la |
3348 |
// Si l'utilisateur est un intructeur qui ne correspond pas à la |
// division du dossier ou qu'il peut changer la décision |
3349 |
// division du dossier |
if ($this->is_instructeur_from_division_dossier() === true or |
3350 |
if ($this->f->isUserInstructeur() |
$this->isInstrCanChangeDecision($this->getParameter('idxformulaire')) === true) { |
|
&& $this->f->om_utilisateur["division"] != $this->getDivisionFromDossier() |
|
|
&& $this->f->isAccredited("instruction_changer_decision") === false) { |
|
|
|
|
3351 |
// |
// |
3352 |
return false; |
return true; |
|
} |
|
|
|
|
|
// si instructeur commune |
|
|
if($this->f->isAccredited("instruction_changer_decision") === false |
|
|
&& $this->f->isInstrCanChangeDecision($this->getVal('dossier')) === true) { |
|
|
return false; |
|
3353 |
} |
} |
3354 |
|
|
|
|
|
3355 |
// |
// |
3356 |
return true; |
return false; |
3357 |
} |
} |
3358 |
|
|
3359 |
/** |
/** |
3365 |
*/ |
*/ |
3366 |
function is_finalizable() { |
function is_finalizable() { |
3367 |
// Contrôle si l'utilisateur possède un bypass |
// Contrôle si l'utilisateur possède un bypass |
3368 |
$bypass = $this->f->isAccredited(get_class()."_finaliser_bypass"); |
$bypass = $this->f->isAccredited(get_class($this)."_finaliser_bypass"); |
3369 |
// |
// |
3370 |
if ($bypass == true) { |
if ($bypass == true) { |
|
|
|
3371 |
// |
// |
3372 |
return true; |
return true; |
3373 |
} |
} |
3374 |
|
|
|
// Si l'utilisateur est un intructeur qui ne correspond pas à la |
|
|
// division du dossier |
|
|
if ($this->f->isUserInstructeur() |
|
|
&& $this->f->om_utilisateur["division"] != $this->getDivisionFromDossier() |
|
|
&& $this->f->isAccredited("instruction_changer_decision") === false) { |
|
|
|
|
|
// |
|
|
return false; |
|
|
} |
|
|
|
|
|
// si instructeur commune |
|
|
if($this->f->isAccredited("instruction_changer_decision") === true |
|
|
&& $this->f->om_utilisateur["division"] != $this->getDivisionFromDossier() |
|
|
&& ($this->f->isInstrCanChangeDecision($this->getVal('dossier')) !== true |
|
|
|| $this->getVal('created_by_commune') !== 't')) { |
|
|
return false; |
|
|
} |
|
|
|
|
3375 |
// Si l'utilisateur est un instructeur, que le dossier est cloturé et |
// Si l'utilisateur est un instructeur, que le dossier est cloturé et |
3376 |
// que l'événement n'est pas identifié comme non verrouillable |
// que l'événement n'est pas identifié comme non verrouillable |
3377 |
if ($this->f->isUserInstructeur() |
if ($this->f->isUserInstructeur() |
3378 |
&& $this->getStatutAutorisationDossier($this->getParameter("idxformulaire")) == "cloture" |
&& $this->getStatutAutorisationDossier($this->getParameter("idxformulaire")) == "cloture" |
3379 |
&& $this->checkEvenementNonVerrouillable($this->getVal("instruction")) === false) { |
&& $this->checkEvenementNonVerrouillable($this->getVal("instruction")) === false) { |
|
|
|
3380 |
// |
// |
3381 |
return false; |
return false; |
3382 |
} |
} |
3383 |
|
|
3384 |
|
// Si l'utilisateur est un intructeur qui correspond à la division du |
3385 |
|
// dossier |
3386 |
|
if ($this->is_instructeur_from_division_dossier() === true) { |
3387 |
|
// |
3388 |
|
return true; |
3389 |
|
} |
3390 |
|
|
3391 |
|
// Si l'utilisateur est instructeur de la commune du dossier et que la |
3392 |
|
// décision peut être changée par la commune. |
3393 |
|
if ($this->is_instructeur_from_collectivite_dossier() === true and |
3394 |
|
$this->isInstrCanChangeDecision($this->getVal('dossier')) === true) { |
3395 |
|
return true; |
3396 |
|
} |
3397 |
|
|
3398 |
|
// Si l'utilisateur est instructeur de la commune du dossier et que |
3399 |
|
// l'instruction est créée par un instructeur de la commune |
3400 |
|
if ($this->is_instructeur_from_collectivite_dossier() === true and |
3401 |
|
$this->getVal('created_by_commune') === 't') { |
3402 |
|
return true; |
3403 |
|
} |
3404 |
|
|
3405 |
// |
// |
3406 |
return true; |
return false; |
3407 |
} |
} |
3408 |
|
|
3409 |
/** |
/** |
3437 |
*/ |
*/ |
3438 |
function is_unfinalizable(){ |
function is_unfinalizable(){ |
3439 |
// Contrôle si l'utilisateur possède un bypass |
// Contrôle si l'utilisateur possède un bypass |
3440 |
$bypass = $this->f->isAccredited(get_class()."_definaliser_bypass"); |
$bypass = $this->f->isAccredited(get_class($this)."_definaliser_bypass"); |
3441 |
// |
// |
3442 |
if ($bypass == true) { |
if ($bypass == true) { |
|
|
|
3443 |
// |
// |
3444 |
return true; |
return true; |
3445 |
} |
} |
3446 |
|
|
3447 |
// Si l'utilisateur est un intructeur qui ne correspond pas à la |
// Si l'utilisateur est un instructeur, que le dossier est cloturé et |
3448 |
// division du dossier |
// que l'événement n'est pas identifié comme non verrouillable |
3449 |
if ($this->f->isUserInstructeur() |
if ($this->f->isUserInstructeur() |
3450 |
&& $this->f->om_utilisateur["division"] != $this->getDivisionFromDossier() |
&& $this->getStatutAutorisationDossier($this->getParameter("idxformulaire")) == "cloture" |
3451 |
&& $this->f->isAccredited("instruction_changer_decision") === false) { |
&& $this->checkEvenementNonVerrouillable($this->getVal("instruction")) === false) { |
|
|
|
3452 |
// |
// |
3453 |
return false; |
return false; |
3454 |
} |
} |
3455 |
|
|
3456 |
// si instructeur commune |
// Si l'utilisateur est un intructeur qui correspond à la division du |
3457 |
if($this->f->isAccredited("instruction_changer_decision") === true |
// dossier |
3458 |
&& $this->f->om_utilisateur["division"] != $this->getDivisionFromDossier() |
if ($this->is_instructeur_from_division_dossier() === true) { |
3459 |
&& ($this->f->isInstrCanChangeDecision($this->getVal('dossier')) !== true |
// |
3460 |
|| $this->getVal('created_by_commune') !== 't')) { |
return true; |
|
return false; |
|
3461 |
} |
} |
3462 |
|
|
3463 |
// Si l'utilisateur est un instructeur, que le dossier est cloturé et |
// Si l'utilisateur est instructeur de la commune du dossier et que la |
3464 |
// que l'événement n'est pas identifié comme non verrouillable |
// décision peut être changée par la commune. |
3465 |
if ($this->f->isUserInstructeur() |
if ($this->is_instructeur_from_collectivite_dossier() === true and |
3466 |
&& $this->getStatutAutorisationDossier($this->getParameter("idxformulaire")) == "cloture" |
$this->isInstrCanChangeDecision($this->getVal('dossier')) === true) { |
3467 |
&& $this->checkEvenementNonVerrouillable($this->getVal("instruction")) === false) { |
return true; |
3468 |
|
} |
3469 |
|
|
3470 |
// |
// Si l'utilisateur est instructeur de la commune du dossier et que |
3471 |
return false; |
// l'instruction est créée par un instructeur de la commune |
3472 |
|
if ($this->is_instructeur_from_collectivite_dossier() === true and |
3473 |
|
$this->getVal('created_by_commune') === 't') { |
3474 |
|
return true; |
3475 |
} |
} |
3476 |
|
|
3477 |
// |
// |
3478 |
return true; |
return false; |
3479 |
} |
} |
3480 |
|
|
3481 |
/** |
/** |
3499 |
return false; |
return false; |
3500 |
} |
} |
3501 |
|
|
3502 |
|
|
3503 |
|
/** |
3504 |
|
* Permet de définir si un instructeur commune peut editer une instruction |
3505 |
|
* |
3506 |
|
* @return boolean true si il peut |
3507 |
|
*/ |
3508 |
|
function isInstrCanChangeDecision($idx) { |
3509 |
|
|
3510 |
|
if ($this->f->isAccredited(array("instruction", "instruction_changer_decision"), "OR") !== true or |
3511 |
|
$this->f->isUserInstructeur() !== true) { |
3512 |
|
return false; |
3513 |
|
} |
3514 |
|
|
3515 |
|
|
3516 |
|
|
3517 |
|
// Sinon on vérifie l'éligibilité du dossier au changement de décision |
3518 |
|
$sql = |
3519 |
|
"SELECT |
3520 |
|
dossier.dossier |
3521 |
|
FROM |
3522 |
|
".DB_PREFIXE."dossier |
3523 |
|
JOIN ".DB_PREFIXE."instruction ON instruction.instruction = ( |
3524 |
|
SELECT instruction |
3525 |
|
FROM ".DB_PREFIXE."instruction |
3526 |
|
JOIN ".DB_PREFIXE."evenement on instruction.evenement=evenement.evenement |
3527 |
|
WHERE instruction.dossier = dossier.dossier |
3528 |
|
AND evenement.retour IS FALSE |
3529 |
|
ORDER BY date_evenement DESC, instruction DESC |
3530 |
|
LIMIT 1 |
3531 |
|
) |
3532 |
|
JOIN ".DB_PREFIXE."evenement ON instruction.evenement=evenement.evenement |
3533 |
|
JOIN ".DB_PREFIXE."instructeur ON dossier.instructeur=instructeur.instructeur |
3534 |
|
JOIN ".DB_PREFIXE."om_utilisateur ON instructeur.om_utilisateur=om_utilisateur.om_utilisateur |
3535 |
|
JOIN ".DB_PREFIXE."om_collectivite ON om_collectivite.om_collectivite=om_utilisateur.om_collectivite |
3536 |
|
JOIN ".DB_PREFIXE."etat ON dossier.etat = etat.etat |
3537 |
|
WHERE |
3538 |
|
|
3539 |
|
( |
3540 |
|
evenement.type = 'arrete' AND |
3541 |
|
( |
3542 |
|
instruction.om_final_instruction IS TRUE |
3543 |
|
OR instruction.created_by_commune IS TRUE |
3544 |
|
) OR |
3545 |
|
evenement.type = 'changement_decision' |
3546 |
|
) |
3547 |
|
AND evenement.retour IS FALSE |
3548 |
|
AND instruction.date_retour_signature IS NULL |
3549 |
|
AND instruction.date_envoi_rar IS NULL |
3550 |
|
AND instruction.date_retour_rar IS NULL |
3551 |
|
AND instruction.date_envoi_controle_legalite IS NULL |
3552 |
|
AND instruction.date_retour_controle_legalite IS NULL |
3553 |
|
AND etat.statut = 'encours' |
3554 |
|
AND dossier.dossier = '".$idx."' |
3555 |
|
AND om_collectivite.niveau = '2' |
3556 |
|
"; |
3557 |
|
|
3558 |
|
|
3559 |
|
// Si collectivité de l'utilisateur niveau mono alors filtre sur celle-ci |
3560 |
|
if ($this->f->isCollectiviteMono($_SESSION['collectivite']) === true) { |
3561 |
|
$sql .= " AND dossier.om_collectivite=".$_SESSION['collectivite']; |
3562 |
|
} |
3563 |
|
$res = $this->db->getone($sql); |
3564 |
|
if (database::isError($res)) { |
3565 |
|
die(); |
3566 |
|
} |
3567 |
|
// Si le dossier n'est pas sujet au changement de decision |
3568 |
|
if($res == null) { |
3569 |
|
return false; |
3570 |
|
} |
3571 |
|
return true; |
3572 |
|
} |
3573 |
|
|
3574 |
|
|
3575 |
|
/** |
3576 |
|
* CONDITION - can_monitoring_dates. |
3577 |
|
* |
3578 |
|
* Condition pour afficher le bouton de suivi des dates. |
3579 |
|
* |
3580 |
|
* @return boolean |
3581 |
|
*/ |
3582 |
|
public function can_monitoring_dates() { |
3583 |
|
// Récupère la valeur du champ finalisé |
3584 |
|
$om_final_instruction = $this->getVal('om_final_instruction'); |
3585 |
|
|
3586 |
|
// Si l'instruction n'est pas finalisée |
3587 |
|
if ($om_final_instruction !== 't') { |
3588 |
|
// |
3589 |
|
return false; |
3590 |
|
} |
3591 |
|
|
3592 |
|
// Contrôle si l'utilisateur possède un bypass |
3593 |
|
$bypass = $this->f->isAccredited(get_class($this)."_modification_dates_bypass"); |
3594 |
|
if ($bypass === true) { |
3595 |
|
return true; |
3596 |
|
} |
3597 |
|
|
3598 |
|
// On vérifie en premier lieu que le DI n'est pas clôturé |
3599 |
|
$inst_dossier = $this->get_inst_dossier(); |
3600 |
|
if ($inst_dossier->getStatut() === 'cloture') { |
3601 |
|
// |
3602 |
|
return false; |
3603 |
|
} |
3604 |
|
// On récupère ses infos |
3605 |
|
$coll_di = $inst_dossier->getVal('om_collectivite'); |
3606 |
|
$div_di = $this->getDivisionFromDossier(); |
3607 |
|
// et celles de son éventuel instructeur |
3608 |
|
$instr_di = $inst_dossier->getVal('instructeur'); |
3609 |
|
|
3610 |
|
// Il faut disposer d'une entrée instructeur |
3611 |
|
if ($this->f->isUserInstructeur() === false) { |
3612 |
|
return false; |
3613 |
|
} |
3614 |
|
|
3615 |
|
// Par défaut on prétend que l'instructeur n'est pas multi |
3616 |
|
$instr_di_coll_multi = false; |
3617 |
|
// Si un instructeur est affecté au dossier |
3618 |
|
if ($instr_di !== '' && $instr_di !== null) { |
3619 |
|
// Vérifie si l'instructeur est de la collectivité de niveau 2 |
3620 |
|
$instr_di_coll = $this->get_instructeur_om_collectivite($instr_di); |
3621 |
|
if ($this->f->isCollectiviteMono($instr_di_coll) === false) { |
3622 |
|
// |
3623 |
|
$instr_di_coll_multi = true; |
3624 |
|
} |
3625 |
|
} |
3626 |
|
|
3627 |
|
// Il faut qu'il instruise le dossier ou soit de la même division |
3628 |
|
if ($this->f->om_utilisateur['instructeur'] === $instr_di |
3629 |
|
|| $this->f->om_utilisateur['division'] === $div_di) { |
3630 |
|
// |
3631 |
|
return true; |
3632 |
|
} |
3633 |
|
|
3634 |
|
// On donne également le droit s'il est de la même collectivité que |
3635 |
|
// le dossier ET si l'instruction est déléguée à la communauté |
3636 |
|
if ($this->f->isCollectiviteMono($this->f->om_utilisateur['om_collectivite']) === true |
3637 |
|
&& $this->f->om_utilisateur['om_collectivite'] === $coll_di |
3638 |
|
&& $instr_di_coll_multi === true) { |
3639 |
|
// |
3640 |
|
return true; |
3641 |
|
} |
3642 |
|
|
3643 |
|
// Si l'instructeur ne rentre pas dans les deux cas précédents |
3644 |
|
return false; |
3645 |
|
} |
3646 |
|
|
3647 |
|
|
3648 |
/** |
/** |
3649 |
* TREATMENT - finalize. |
* TREATMENT - finalize. |
3650 |
* |
* |
3667 |
if ($ret !== true) { |
if ($ret !== true) { |
3668 |
|
|
3669 |
// Termine le traitement |
// Termine le traitement |
3670 |
$this->end_treatment(__METHOD__, false); |
return $this->end_treatment(__METHOD__, false); |
3671 |
} |
} |
3672 |
|
|
3673 |
// Termine le traitement |
// Termine le traitement |
3696 |
if ($ret !== true) { |
if ($ret !== true) { |
3697 |
|
|
3698 |
// Termine le traitement |
// Termine le traitement |
3699 |
$this->end_treatment(__METHOD__, false); |
return $this->end_treatment(__METHOD__, false); |
3700 |
} |
} |
3701 |
|
|
3702 |
// Termine le traitement |
// Termine le traitement |
3750 |
/** |
/** |
3751 |
* Récupère la collectivité du dossier d'instruction. |
* Récupère la collectivité du dossier d'instruction. |
3752 |
* |
* |
3753 |
|
* @param string $dossier_instruction_id Identifiant du DI. |
3754 |
|
* |
3755 |
* @return integer |
* @return integer |
3756 |
*/ |
*/ |
3757 |
function get_dossier_instruction_om_collectivite() { |
function get_dossier_instruction_om_collectivite($dossier_instruction_id = null) { |
3758 |
|
|
3759 |
|
// Si l'identifiant n'est pas renseigné |
3760 |
|
if ($dossier_instruction_id === null) { |
3761 |
|
// Récupère la valeur en base de données |
3762 |
|
$dossier_instruction_id = $this->getVal('dossier'); |
3763 |
|
} |
3764 |
|
|
3765 |
// |
// |
3766 |
require_once "../obj/dossier_instruction.class.php"; |
require_once "../obj/dossier_instruction.class.php"; |
3767 |
$dossier_instruction = new dossier_instruction($this->getVal('dossier'), $this->f->db, false); |
$dossier_instruction = new dossier_instruction($dossier_instruction_id, $this->f->db, false); |
3768 |
|
|
3769 |
// |
// |
3770 |
return $dossier_instruction->getVal('om_collectivite'); |
return $dossier_instruction->getVal('om_collectivite'); |
3811 |
$evenement = intval($evenement); |
$evenement = intval($evenement); |
3812 |
// |
// |
3813 |
($f->get_submitted_get_value("idx") ? $idx = $f->get_submitted_get_value("idx") : $idx = ""); |
($f->get_submitted_get_value("idx") ? $idx = $f->get_submitted_get_value("idx") : $idx = ""); |
3814 |
$nature = substr($idx, 0, 2); |
// Récupération du code du type de DA |
3815 |
|
$code_da_type = ''; |
3816 |
|
if (preg_match('/[A-Za-z]{2,3}/', $idx, $matches) !== false) { |
3817 |
|
$code_da_type = $matches[0]; |
3818 |
|
} |
3819 |
// |
// |
3820 |
($f->get_submitted_get_value("complement") ? $complement = $f->get_submitted_get_value("complement") : $complement = "1"); |
($f->get_submitted_get_value("complement") ? $complement = $f->get_submitted_get_value("complement") : $complement = "1"); |
3821 |
|
|
3833 |
ON bible.dossier_autorisation_type=dossier_autorisation_type.dossier_autorisation_type |
ON bible.dossier_autorisation_type=dossier_autorisation_type.dossier_autorisation_type |
3834 |
LEFT JOIN ".DB_PREFIXE."om_collectivite |
LEFT JOIN ".DB_PREFIXE."om_collectivite |
3835 |
ON bible.om_collectivite = om_collectivite.om_collectivite |
ON bible.om_collectivite = om_collectivite.om_collectivite |
3836 |
WHERE evenement=".$evenement." |
WHERE (evenement=".$evenement." OR evenement IS NULL) |
3837 |
AND complement=".$complement." |
AND complement=".$complement." |
3838 |
AND (bible.dossier_autorisation_type IS NULL |
AND (bible.dossier_autorisation_type IS NULL |
3839 |
OR dossier_autorisation_type.code ='".$nature."') |
OR dossier_autorisation_type.code ='".$code_da_type."') |
3840 |
AND (om_collectivite.niveau = '2' |
AND (om_collectivite.niveau = '2' |
3841 |
OR bible.om_collectivite = ".$dossier->getVal("om_collectivite").") |
OR bible.om_collectivite = ".$dossier->getVal("om_collectivite").") |
3842 |
ORDER BY bible_lib ASC"; |
ORDER BY bible_lib ASC"; |
3902 |
} |
} |
3903 |
|
|
3904 |
/** |
/** |
3905 |
* VIEW - view_bible |
* VIEW - view_bible_auto |
3906 |
* |
* |
3907 |
* Affiche la bible manuelle. |
* Renvoie les valeurs de la bible à placer dans les compléments de l'instruction. |
3908 |
* |
* |
3909 |
* @return void |
* @return void |
3910 |
*/ |
*/ |
3970 |
$temp=$temp." du ".$date_retour_f; |
$temp=$temp." du ".$date_retour_f; |
3971 |
} |
} |
3972 |
// Concaténation des retours d'avis de consultation |
// Concaténation des retours d'avis de consultation |
3973 |
$retour['complement_om_html'] .= $temp; |
$retour['complement_om_html'] .= $temp . "<br/><br/>"; |
3974 |
} // while |
} // while |
3975 |
|
|
3976 |
} // consultation |
} // consultation |
3989 |
} |
} |
3990 |
|
|
3991 |
/** |
/** |
3992 |
|
* VIEW - view_pdf_temp |
3993 |
|
* |
3994 |
|
* @return void |
3995 |
|
*/ |
3996 |
|
function view_pdf_temp() { |
3997 |
|
$this->checkAccessibility(); |
3998 |
|
$this->f->set_submitted_value(); |
3999 |
|
$merge_fields = array( |
4000 |
|
'[complement_instruction]' => urldecode($_POST['c1']), |
4001 |
|
'[complement1_instruction]' => urldecode($_POST['c1']), |
4002 |
|
'[complement2_instruction]' => urldecode($_POST['c2']), |
4003 |
|
'[complement3_instruction]' => urldecode($_POST['c3']), |
4004 |
|
'[complement4_instruction]' => urldecode($_POST['c4']), |
4005 |
|
); |
4006 |
|
$params = array( |
4007 |
|
"watermark" => true, |
4008 |
|
"specific" => array( |
4009 |
|
"merge_fields" => $merge_fields, |
4010 |
|
), |
4011 |
|
); |
4012 |
|
$dossier_instruction_om_collectivite = $this->get_dossier_instruction_om_collectivite(); |
4013 |
|
$collectivite = $this->f->getCollectivite($dossier_instruction_om_collectivite); |
4014 |
|
$result = $this->compute_pdf_output('lettretype', $this->getVal('lettretype'), $collectivite, null, $params); |
4015 |
|
$retour = array( |
4016 |
|
'base' => base64_encode($result['pdf_output']), |
4017 |
|
); |
4018 |
|
echo json_encode($retour); |
4019 |
|
} |
4020 |
|
|
4021 |
|
/** |
4022 |
|
* Dans le contexte de prévisualisation des éditions, génère le rendu du |
4023 |
|
* PDF sans prise en compte de la valeur des compléments et le retourne en |
4024 |
|
* base 64. |
4025 |
|
* |
4026 |
|
* @return string Rendu PDF converti en base 64. |
4027 |
|
*/ |
4028 |
|
function init_pdf_temp() { |
4029 |
|
$params = array( |
4030 |
|
"watermark" => true, |
4031 |
|
); |
4032 |
|
$dossier_instruction_om_collectivite = $this->get_dossier_instruction_om_collectivite(); |
4033 |
|
$collectivite = $this->f->getCollectivite($dossier_instruction_om_collectivite); |
4034 |
|
$result = $this->compute_pdf_output('lettretype', $this->getVal('lettretype'), $collectivite, null, $params); |
4035 |
|
|
4036 |
|
return base64_encode($result['pdf_output']); |
4037 |
|
} |
4038 |
|
|
4039 |
|
/** |
4040 |
* Récupération des éléments de bible. |
* Récupération des éléments de bible. |
4041 |
* |
* |
4042 |
* @param utils $f handler de om_application |
* @param utils $f handler de om_application |
4050 |
// Récupération de la collectivité du dossier |
// Récupération de la collectivité du dossier |
4051 |
require_once "../obj/dossier.class.php"; |
require_once "../obj/dossier.class.php"; |
4052 |
$dossier = new dossier($idx, $f->db, DEBUG); |
$dossier = new dossier($idx, $f->db, DEBUG); |
4053 |
|
// Récupération du code du type de DA |
4054 |
|
$code_da_type = ''; |
4055 |
|
if (preg_match('/[A-Za-z]{2,3}/', $idx, $matches) !== false) { |
4056 |
|
$code_da_type = $matches[0]; |
4057 |
|
} |
4058 |
// |
// |
4059 |
$sql = "SELECT * FROM ".DB_PREFIXE."bible |
$sql = "SELECT * FROM ".DB_PREFIXE."bible |
4060 |
LEFT OUTER JOIN ".DB_PREFIXE."dossier_autorisation_type |
LEFT OUTER JOIN ".DB_PREFIXE."dossier_autorisation_type |
4063 |
LEFT JOIN |
LEFT JOIN |
4064 |
".DB_PREFIXE."om_collectivite |
".DB_PREFIXE."om_collectivite |
4065 |
ON bible.om_collectivite = om_collectivite.om_collectivite |
ON bible.om_collectivite = om_collectivite.om_collectivite |
4066 |
WHERE evenement =".$event." and |
WHERE (evenement =".$event." or evenement IS NULL) and |
4067 |
complement=".$compnb." and |
complement=".$compnb." and |
4068 |
automatique='Oui' and |
automatique='Oui' and |
4069 |
(dossier_autorisation_type.code ='".substr($idx, 0, 2)."' or |
(dossier_autorisation_type.code ='".$code_da_type."' or |
4070 |
bible.dossier_autorisation_type IS NULL) and |
bible.dossier_autorisation_type IS NULL) and |
4071 |
(om_collectivite.niveau = '2' OR bible.om_collectivite = ".$dossier->getVal("om_collectivite").")"; |
(om_collectivite.niveau = '2' OR bible.om_collectivite = ".$dossier->getVal("om_collectivite").")"; |
4072 |
|
|
4078 |
$temp .= preg_replace( |
$temp .= preg_replace( |
4079 |
'#(\\\r|\\\r\\\n|\\\n)#', '<br/>', $row['contenu'] |
'#(\\\r|\\\r\\\n|\\\n)#', '<br/>', $row['contenu'] |
4080 |
); |
); |
4081 |
|
// Ajout d'un saut de ligne entre chaque bible. |
4082 |
|
$temp .= '<br/>'; |
4083 |
} // fin while |
} // fin while |
4084 |
return $temp; |
return $temp; |
4085 |
} |
} |
4087 |
/** |
/** |
4088 |
* VIEW - view_suivi_bordereaux. |
* VIEW - view_suivi_bordereaux. |
4089 |
* |
* |
4090 |
* Vu pour imprimer un bordereau d'envoi. |
* Formulaire de choix du bordereau de suivi, permettant de générer les 4 bordereaux. |
4091 |
|
* Si l'utilisateur est d'une collectivité de niveau 2 il a le choix de la |
4092 |
|
* collectivité des dossiers affichés. |
4093 |
* |
* |
4094 |
* @return void |
* @return void |
4095 |
*/ |
*/ |
4121 |
$message_class = "error"; |
$message_class = "error"; |
4122 |
$message = _("Veuillez saisir une date valide."); |
$message = _("Veuillez saisir une date valide."); |
4123 |
} |
} |
4124 |
|
// Sinon si les dates ne sont pas valides |
4125 |
|
elseif ($f->get_submitted_post_value("bordereau") === "bordereau_avis_maire_prefet" |
4126 |
|
&& $f->getParameter("id_evenement_bordereau_avis_maire_prefet") == null) { |
4127 |
|
// Si aucune date n'a été saisie |
4128 |
|
$message_class = "error"; |
4129 |
|
$message = _("Erreur de parametrage. Contactez votre administrateur."); |
4130 |
|
} |
4131 |
// Affiche le message de validation |
// Affiche le message de validation |
4132 |
else { |
else { |
4133 |
// On récupère le libellé du bordereau pour l'afficher à l'utilisateur |
// On récupère le libellé du bordereau pour l'afficher à l'utilisateur |
4143 |
$message .= " : <br/><br/>"; |
$message .= " : <br/><br/>"; |
4144 |
$message .= "<a class='om-prev-icon pdf-16'"; |
$message .= "<a class='om-prev-icon pdf-16'"; |
4145 |
$message .= " title=\""._("Bordereau")."\""; |
$message .= " title=\""._("Bordereau")."\""; |
4146 |
$message .= " href='../pdf/pdfetat.php?obj=".$f->get_submitted_post_value("bordereau")."&date_bordereau_debut=".$f->get_submitted_post_value("date_bordereau_debut"); |
$message .= "href='../scr/form.php?obj=instruction"; |
4147 |
|
$message .= "&action=220"; |
4148 |
|
$message .= "&idx=0"; |
4149 |
|
$message .= "&type_bordereau=".$f->get_submitted_post_value("bordereau"); |
4150 |
|
$message .= "&date_bordereau_debut=".$f->get_submitted_post_value("date_bordereau_debut"); |
4151 |
$message .= "&date_bordereau_fin=".$f->get_submitted_post_value("date_bordereau_fin"); |
$message .= "&date_bordereau_fin=".$f->get_submitted_post_value("date_bordereau_fin"); |
4152 |
// Si l'utilisateur est MULTI alors on ajoute le paramètre collectivite |
// Si l'utilisateur est MULTI alors on ajoute le paramètre collectivite |
4153 |
if ($f->get_submitted_post_value("om_collectivite") !== null) { |
if ($f->get_submitted_post_value("om_collectivite") !== null) { |
4279 |
|
|
4280 |
} |
} |
4281 |
|
|
4282 |
|
|
4283 |
|
/** |
4284 |
|
* VIEW - view_generate_suivi_bordereaux. |
4285 |
|
* |
4286 |
|
* Génère et affiche les bordereaux de suivi. |
4287 |
|
* |
4288 |
|
* @return [void] |
4289 |
|
*/ |
4290 |
|
function view_generate_suivi_bordereaux() { |
4291 |
|
// Vérification de l'accessibilité sur l'élément |
4292 |
|
$this->checkAccessibility(); |
4293 |
|
// Récupération du type de bordereau |
4294 |
|
$bordereau = $this->f->get_submitted_get_value('type_bordereau'); |
4295 |
|
// Génération du PDF |
4296 |
|
$result = $this->compute_pdf_output('etat', $bordereau, null, $this->getVal($this->clePrimaire)); |
4297 |
|
// Affichage du PDF |
4298 |
|
$this->expose_pdf_output( |
4299 |
|
$result['pdf_output'], |
4300 |
|
$result['filename'] |
4301 |
|
); |
4302 |
|
} |
4303 |
|
|
4304 |
|
|
4305 |
/** |
/** |
4306 |
* VIEW - view_suivi_envoi_lettre_rar. |
* VIEW - view_suivi_envoi_lettre_rar. |
4307 |
* |
* |
4337 |
// |
// |
4338 |
$error = ""; |
$error = ""; |
4339 |
|
|
4340 |
|
// Initialisation du tableau qui va contenir les DI pour lister les liens |
4341 |
|
$dossierTab = array(); |
4342 |
|
// On vérifie que l'utilisateur ait les droits pour afficher des consultations |
4343 |
|
$isAccredited = $this->f->isAccredited(array("dossier_instruction","dossier_instruction_consulter"), "OR"); |
4344 |
|
$hasHidden = true; |
4345 |
|
// S'il ne peut pas les consulter il aura des dossiers caché |
4346 |
|
if ($isAccredited === true) { |
4347 |
|
$hasHidden = false; |
4348 |
|
} |
4349 |
|
|
4350 |
/** |
/** |
4351 |
* Validation du formulaire |
* Validation du formulaire |
4352 |
*/ |
*/ |
4369 |
// Si la valeur transmise est numérique |
// Si la valeur transmise est numérique |
4370 |
if (is_numeric($code_barres)) { |
if (is_numeric($code_barres)) { |
4371 |
// |
// |
4372 |
$sql = "SELECT count(*) FROM ".DB_PREFIXE."instruction WHERE code_barres='".$code_barres."'"; |
$sql = "SELECT count(*) |
4373 |
|
FROM ".DB_PREFIXE."instruction |
4374 |
|
INNER JOIN ".DB_PREFIXE."dossier |
4375 |
|
ON dossier.dossier=instruction.dossier |
4376 |
|
INNER JOIN ".DB_PREFIXE."dossier_instruction_type |
4377 |
|
ON dossier.dossier_instruction_type = dossier_instruction_type.dossier_instruction_type |
4378 |
|
INNER JOIN ".DB_PREFIXE."dossier_autorisation_type_detaille |
4379 |
|
ON dossier_instruction_type.dossier_autorisation_type_detaille = dossier_autorisation_type_detaille.dossier_autorisation_type_detaille |
4380 |
|
INNER JOIN ".DB_PREFIXE."dossier_autorisation_type |
4381 |
|
ON dossier_autorisation_type_detaille.dossier_autorisation_type = dossier_autorisation_type.dossier_autorisation_type |
4382 |
|
INNER JOIN ".DB_PREFIXE."groupe |
4383 |
|
ON dossier_autorisation_type.groupe = groupe.groupe |
4384 |
|
WHERE code_barres='".$this->f->db->escapesimple($code_barres)."'"; |
4385 |
|
|
4386 |
|
// Ajout d'un filtre sur les groupes auxquels l'utilisateur a accès |
4387 |
|
$group_clause = array(); |
4388 |
|
foreach ($_SESSION["groupe"] as $key => $value) { |
4389 |
|
$group_clause[$key] = "(groupe.code = '".$key."'"; |
4390 |
|
if($value["confidentiel"] !== true) { |
4391 |
|
$group_clause[$key] .= " AND dossier_autorisation_type.confidentiel IS NOT TRUE"; |
4392 |
|
} |
4393 |
|
$group_clause[$key] .= ")"; |
4394 |
|
} |
4395 |
|
$conditions = implode(" OR ", $group_clause); |
4396 |
|
$sql .= " AND (" . $conditions . ")"; |
4397 |
|
|
4398 |
$nbInstr = $f->db->getone($sql); |
$nbInstr = $f->db->getone($sql); |
4399 |
$f->addToLog(__METHOD__.": db->getone(\"".$sql."\")", VERBOSE_MODE); |
$f->addToLog(__METHOD__.": db->getone(\"".$sql."\")", VERBOSE_MODE); |
4400 |
$f->isDatabaseError($nbInstr); |
$f->isDatabaseError($nbInstr); |
4411 |
if ($row["date_envoi_rar"] == "" || $row["date_envoi_rar"] == $date) { |
if ($row["date_envoi_rar"] == "" || $row["date_envoi_rar"] == $date) { |
4412 |
|
|
4413 |
require_once '../obj/instruction.class.php'; |
require_once '../obj/instruction.class.php'; |
4414 |
|
require_once '../obj/dossier.class.php'; |
4415 |
|
|
4416 |
$instr = new instruction($row['instruction'], $f->db, DEBUG); |
$instr = new instruction($row['instruction'], $f->db, DEBUG); |
4417 |
$valF = array(); |
$valF = array(); |
4418 |
foreach($instr->champs as $id => $champ) { |
foreach($instr->champs as $id => $champ) { |
4419 |
$valF[$champ] = $instr->val[$id]; |
$valF[$champ] = $instr->val[$id]; |
4420 |
} |
} |
4421 |
|
|
4422 |
|
# Si on peut consulter les dossiers et que le dossier n'existe pas déjà dans la liste |
4423 |
|
if ($isAccredited === true |
4424 |
|
&& array_key_exists($instr->getVal("dossier"), $dossierTab) === false) { |
4425 |
|
$dossier = new dossier($instr->getVal("dossier")); |
4426 |
|
if ($dossier->is_user_from_allowed_collectivite()){ |
4427 |
|
$dossierTab[$instr->getVal("dossier")] = $dossier; |
4428 |
|
} else { |
4429 |
|
$hasHidden = true; |
4430 |
|
} |
4431 |
|
} |
4432 |
|
|
4433 |
$valF['date_evenement']= |
$valF['date_evenement']= |
4434 |
$instr->dateDBToForm($valF['date_evenement']); |
$instr->dateDBToForm($valF['date_evenement']); |
4435 |
$valF['archive_date_complet']= |
$valF['archive_date_complet']= |
4468 |
$instr->dateDBToForm($valF['date_envoi_controle_legalite']); |
$instr->dateDBToForm($valF['date_envoi_controle_legalite']); |
4469 |
$valF['date_retour_controle_legalite']= |
$valF['date_retour_controle_legalite']= |
4470 |
$instr->dateDBToForm($valF['date_retour_controle_legalite']); |
$instr->dateDBToForm($valF['date_retour_controle_legalite']); |
|
|
|
4471 |
$valF['date_envoi_rar'] = $date; |
$valF['date_envoi_rar'] = $date; |
4472 |
|
|
4473 |
// Vérification de la finalisation du document |
// Vérification de la finalisation du document |
4474 |
// correspondant au code barres |
// correspondant au code barres |
4475 |
if($instr->getVal("om_final_instruction") === 't') { |
if($instr->getVal("om_final_instruction") === 't') { |
4476 |
$instr->setParameter('maj', 1); |
$instr->setParameter('maj', 1); |
4477 |
|
$instr->class_actions[1]["identifier"] = |
4478 |
|
"envoi lettre RAR (depuis le menu suivi des pièces)"; |
4479 |
if ($instr->modifier($valF, $f->db, DEBUG) == true) { |
if ($instr->modifier($valF, $f->db, DEBUG) == true) { |
4480 |
$id4Gen[] = $code_barres; |
$id4Gen[] = $code_barres; |
4481 |
$nbLettres ++; |
$nbLettres ++; |
4540 |
// Affichage du message de validation de la saisie |
// Affichage du message de validation de la saisie |
4541 |
if ($nbLettres > 0) { |
if ($nbLettres > 0) { |
4542 |
// |
// |
4543 |
$message_class = "valid"; |
echo "\n<div class=\"message ui-widget ui-corner-all ui-state-highlight ui-state-valid\" >"; |
4544 |
$message = _("Cliquez sur le lien ci-dessous pour telecharger votre document"); |
echo "\n<p>"; |
4545 |
$message .= " : <br/><br/>"; |
echo "\n<span class=\"ui-icon ui-icon-info\"></span>"; |
4546 |
$message .= "<a class='om-prev-icon pdf-16'"; |
echo "\n<span class=\"text\">"; |
4547 |
$message .= " title=\""._("imprimer les RAR")."\""; |
echo _("Cliquez sur le lien ci-dessous pour telecharger votre document"); |
4548 |
$message .= " href=\"../scr/form.php?obj=instruction&action=180&idx=0&liste=".implode(",",$id4Gen)."\""; |
echo " : \n<br/><br/>"; |
4549 |
$message .= " target='_blank'>"; |
echo "\n<a class='om-prev-icon pdf-16'"; |
4550 |
$message .= _("Telecharger le document pour")." ".$nbLettres." "._("RAR"); |
echo "\n title=\""._("imprimer les RAR")."\""; |
4551 |
$message .= "</a>"; |
echo "\n href=\"../scr/form.php?obj=instruction&action=180&idx=0&liste=".implode(",",$id4Gen)."\""; |
4552 |
$f->displayMessage($message_class, $message); |
echo "\n target='_blank'>"; |
4553 |
|
echo _("Telecharger le document pour")." ".$nbLettres." "._("RAR"); |
4554 |
|
echo "\n</a>"; |
4555 |
|
echo "\n</span>"; |
4556 |
|
echo "\n</p>"; |
4557 |
|
echo "\n<br/>\n"; |
4558 |
|
if ($isAccredited === true) { |
4559 |
|
echo '<fieldset id="fieldset-form-rar-lien_di" class="cadre ui-corner-all startClosed" style="background-color: inherite;">'; |
4560 |
|
echo "\n<legend class=\"ui-corner-all ui-widget-content ui-state-active\" style=\"background-color: transparent; color: inherit;\">\n"; |
4561 |
|
echo _('Dossiers concernés par ce traitement'); |
4562 |
|
echo "\n</legend>"; |
4563 |
|
echo "\n<div class=\"fieldsetContent\" style=\"display: none;background-color: inherite\">"; |
4564 |
|
|
4565 |
|
if ($hasHidden === true) { |
4566 |
|
echo "\n<br/>"; |
4567 |
|
echo "\n<p>"; |
4568 |
|
echo "\n<span class='text'>"; |
4569 |
|
echo _("Certains dossiers ont été omis de la liste ci-dessous car vous ne possédez pas les permissions nécessaires pour y accéder."); |
4570 |
|
echo "</span>"; |
4571 |
|
echo "\n</p>"; |
4572 |
|
echo "\n<br/>"; |
4573 |
|
} |
4574 |
|
foreach ($dossierTab as $dossier) { |
4575 |
|
|
4576 |
|
$inst_da = $this->get_inst_common("dossier_autorisation", $dossier->getVal('dossier_autorisation')); |
4577 |
|
$inst_datd = $this->get_inst_common("dossier_autorisation_type_detaille", $inst_da->getVal('dossier_autorisation_type_detaille')); |
4578 |
|
$code_datd = $inst_datd->getVal('code'); |
4579 |
|
|
4580 |
|
$obj = "dossier_instruction"; |
4581 |
|
if ($code_datd === 'REC' OR $code_datd === 'REG') { |
4582 |
|
$obj = "dossier_contentieux_tous_recours"; |
4583 |
|
} |
4584 |
|
if ($code_datd === 'IN') { |
4585 |
|
$obj = "dossier_contentieux_toutes_infractions"; |
4586 |
|
} |
4587 |
|
|
4588 |
|
echo "\n<div class=\"bloc group\">"; |
4589 |
|
echo "\n<div class=\"field field-type-text\">"; |
4590 |
|
|
4591 |
|
echo "\n<p>"; |
4592 |
|
echo "\n<span class='text'>"; |
4593 |
|
echo "\n<a class=\"om-icon om-icon-16 consult-16\" title=\"" . _('Consulter') . "\""; |
4594 |
|
echo "\n href=\"../scr/form.php?obj=dossier_instruction&action=3&idx="; |
4595 |
|
echo $dossier->getVal("dossier"); |
4596 |
|
echo "\">"; |
4597 |
|
echo "\n</a>"; |
4598 |
|
|
4599 |
|
echo "\n<a title=\""._("Consulter")."\" style=\"vertical-align:middle;\""; |
4600 |
|
echo " href=\"../scr/form.php?obj="; |
4601 |
|
echo $obj; |
4602 |
|
echo "&action=3&idx="; |
4603 |
|
echo $dossier->getVal("dossier"); |
4604 |
|
echo "\">"; |
4605 |
|
echo $dossier->getVal("dossier_libelle"); |
4606 |
|
echo "\n</a>"; |
4607 |
|
echo "\n</span>"; |
4608 |
|
echo "\n</p>"; |
4609 |
|
|
4610 |
|
echo "\n</div>"; |
4611 |
|
echo "\n</div>"; |
4612 |
|
} |
4613 |
|
echo "\n</div>"; |
4614 |
|
echo "\n</fieldset>"; |
4615 |
|
} |
4616 |
|
echo "\n</div>"; |
4617 |
|
echo "\n</div>"; |
4618 |
} |
} |
4619 |
// Inclusion de la classe de gestion des formulaires |
// Inclusion de la classe de gestion des formulaires |
4620 |
require_once "../obj/om_formulaire.class.php"; |
require_once "../obj/om_formulaire.class.php"; |
4701 |
if ($f->get_submitted_post_value('validation') !== null) { |
if ($f->get_submitted_post_value('validation') !== null) { |
4702 |
if(!empty($type_mise_a_jour) and !empty($date) and !empty($code_barres)) { |
if(!empty($type_mise_a_jour) and !empty($date) and !empty($code_barres)) { |
4703 |
|
|
4704 |
//Vérification de l'existance de l'instruction |
// Vérification de l'existence de l'instruction |
4705 |
$sql = "SELECT instruction FROM ".DB_PREFIXE."instruction WHERE code_barres='".$this->f->db->escapesimple($code_barres)."'"; |
$sql = "SELECT instruction |
4706 |
|
FROM ".DB_PREFIXE."instruction |
4707 |
|
INNER JOIN ".DB_PREFIXE."dossier |
4708 |
|
ON dossier.dossier=instruction.dossier |
4709 |
|
INNER JOIN ".DB_PREFIXE."dossier_instruction_type |
4710 |
|
ON dossier.dossier_instruction_type = dossier_instruction_type.dossier_instruction_type |
4711 |
|
INNER JOIN ".DB_PREFIXE."dossier_autorisation_type_detaille |
4712 |
|
ON dossier_instruction_type.dossier_autorisation_type_detaille = dossier_autorisation_type_detaille.dossier_autorisation_type_detaille |
4713 |
|
INNER JOIN ".DB_PREFIXE."dossier_autorisation_type |
4714 |
|
ON dossier_autorisation_type_detaille.dossier_autorisation_type = dossier_autorisation_type.dossier_autorisation_type |
4715 |
|
INNER JOIN ".DB_PREFIXE."groupe |
4716 |
|
ON dossier_autorisation_type.groupe = groupe.groupe |
4717 |
|
WHERE code_barres='".$this->f->db->escapesimple($code_barres)."'"; |
4718 |
|
|
4719 |
|
// Ajout d'un filtre sur les groupes auxquels l'utilisateur a accès |
4720 |
|
$group_clause = array(); |
4721 |
|
foreach ($_SESSION["groupe"] as $key => $value) { |
4722 |
|
$group_clause[$key] = "(groupe.code = '".$key."'"; |
4723 |
|
if($value["confidentiel"] !== true) { |
4724 |
|
$group_clause[$key] .= " AND dossier_autorisation_type.confidentiel IS NOT TRUE"; |
4725 |
|
} |
4726 |
|
$group_clause[$key] .= ")"; |
4727 |
|
} |
4728 |
|
$conditions = implode(" OR ", $group_clause); |
4729 |
|
$sql .= " AND (" . $conditions . ")"; |
4730 |
|
|
4731 |
|
|
4732 |
$res = $f->db->query($sql); |
$res = $f->db->query($sql); |
4733 |
$f->addToLog(__METHOD__.": db->query(\"".$sql."\")", VERBOSE_MODE); |
$f->addToLog(__METHOD__.": db->query(\"".$sql."\")", VERBOSE_MODE); |
4734 |
$f->isDatabaseError($res); |
$f->isDatabaseError($res); |
4744 |
foreach($instr->champs as $id => $champ) { |
foreach($instr->champs as $id => $champ) { |
4745 |
$valF[$champ] = $instr->val[$id]; |
$valF[$champ] = $instr->val[$id]; |
4746 |
} |
} |
4747 |
$valF['date_evenement']=$instr->dateDBToForm($valF['date_evenement']); |
$valF['date_evenement'] = $instr->dateDBToForm($valF['date_evenement']); |
4748 |
$valF['archive_date_complet']=$instr->dateDBToForm($valF['archive_date_complet']); |
$valF['archive_date_complet'] = $instr->dateDBToForm($valF['archive_date_complet']); |
4749 |
$valF['archive_date_rejet']=$instr->dateDBToForm($valF['archive_date_rejet']); |
$valF['archive_date_rejet'] = $instr->dateDBToForm($valF['archive_date_rejet']); |
4750 |
$valF['archive_date_limite']=$instr->dateDBToForm($valF['archive_date_limite']); |
$valF['archive_date_limite'] = $instr->dateDBToForm($valF['archive_date_limite']); |
4751 |
$valF['archive_date_notification_delai']=$instr->dateDBToForm($valF['archive_date_notification_delai']); |
$valF['archive_date_notification_delai'] = $instr->dateDBToForm($valF['archive_date_notification_delai']); |
4752 |
$valF['archive_date_decision']=$instr->dateDBToForm($valF['archive_date_decision']); |
$valF['archive_date_decision'] = $instr->dateDBToForm($valF['archive_date_decision']); |
4753 |
$valF['archive_date_validite']=$instr->dateDBToForm($valF['archive_date_validite']); |
$valF['archive_date_validite'] = $instr->dateDBToForm($valF['archive_date_validite']); |
4754 |
$valF['archive_date_achevement']=$instr->dateDBToForm($valF['archive_date_achevement']); |
$valF['archive_date_achevement'] = $instr->dateDBToForm($valF['archive_date_achevement']); |
4755 |
$valF['archive_date_chantier']=$instr->dateDBToForm($valF['archive_date_chantier']); |
$valF['archive_date_chantier'] = $instr->dateDBToForm($valF['archive_date_chantier']); |
4756 |
$valF['archive_date_conformite']=$instr->dateDBToForm($valF['archive_date_conformite']); |
$valF['archive_date_conformite'] = $instr->dateDBToForm($valF['archive_date_conformite']); |
4757 |
$valF['archive_date_dernier_depot']=$instr->dateDBToForm($valF['archive_date_dernier_depot']); |
$valF['archive_date_dernier_depot'] = $instr->dateDBToForm($valF['archive_date_dernier_depot']); |
4758 |
$valF['archive_date_limite_incompletude']=$instr->dateDBToForm($valF['archive_date_limite_incompletude']); |
$valF['archive_date_limite_incompletude'] = $instr->dateDBToForm($valF['archive_date_limite_incompletude']); |
4759 |
$valF['date_finalisation_courrier']=$instr->dateDBToForm($valF['date_finalisation_courrier']); |
$valF['date_finalisation_courrier'] = $instr->dateDBToForm($valF['date_finalisation_courrier']); |
4760 |
$valF['date_envoi_signature']=$instr->dateDBToForm($valF['date_envoi_signature']); |
$valF['date_envoi_signature'] = $instr->dateDBToForm($valF['date_envoi_signature']); |
4761 |
$valF['date_retour_signature']=$instr->dateDBToForm($valF['date_retour_signature']); |
$valF['date_retour_signature'] = $instr->dateDBToForm($valF['date_retour_signature']); |
4762 |
$valF['date_envoi_rar']=$instr->dateDBToForm($valF['date_envoi_rar']); |
$valF['date_envoi_rar'] = $instr->dateDBToForm($valF['date_envoi_rar']); |
4763 |
$valF['date_retour_rar']=$instr->dateDBToForm($valF['date_retour_rar']); |
$valF['date_retour_rar'] = $instr->dateDBToForm($valF['date_retour_rar']); |
4764 |
$valF['date_envoi_controle_legalite']=$instr->dateDBToForm($valF['date_envoi_controle_legalite']); |
$valF['date_envoi_controle_legalite'] = $instr->dateDBToForm($valF['date_envoi_controle_legalite']); |
4765 |
$valF['date_retour_controle_legalite']=$instr->dateDBToForm($valF['date_retour_controle_legalite']); |
$valF['date_retour_controle_legalite'] = $instr->dateDBToForm($valF['date_retour_controle_legalite']); |
4766 |
|
$valF['archive_date_cloture_instruction'] = $instr->dateDBToForm($valF['archive_date_cloture_instruction']); |
4767 |
|
$valF['archive_date_premiere_visite'] = $instr->dateDBToForm($valF['archive_date_premiere_visite']); |
4768 |
|
$valF['archive_date_derniere_visite'] = $instr->dateDBToForm($valF['archive_date_derniere_visite']); |
4769 |
|
$valF['archive_date_contradictoire'] = $instr->dateDBToForm($valF['archive_date_contradictoire']); |
4770 |
|
$valF['archive_date_retour_contradictoire'] = $instr->dateDBToForm($valF['archive_date_retour_contradictoire']); |
4771 |
|
$valF['archive_date_ait'] = $instr->dateDBToForm($valF['archive_date_ait']); |
4772 |
|
$valF['archive_date_transmission_parquet'] = $instr->dateDBToForm($valF['archive_date_transmission_parquet']); |
4773 |
|
|
4774 |
foreach(explode(";", $type_mise_a_jour) as $maj_date) { |
foreach(explode(";", $type_mise_a_jour) as $maj_date) { |
4775 |
$valF[$maj_date]=$date; |
$valF[$maj_date]=$date; |
4786 |
|
|
4787 |
//On modifie les valeurs de l'instruction |
//On modifie les valeurs de l'instruction |
4788 |
$instr->setParameter('maj', 170); |
$instr->setParameter('maj', 170); |
4789 |
|
$instr->class_actions[170]["identifier"] = |
4790 |
|
"mise à jour des dates (depuis le menu suivi des pièces)"; |
4791 |
$retour = $instr->modifier($valF, $f->db, DEBUG); |
$retour = $instr->modifier($valF, $f->db, DEBUG); |
4792 |
|
|
4793 |
//Si une erreur s'est produite, on défait les modifications |
//Si une erreur s'est produite, on défait les modifications |
5057 |
// Initialisation de la mise en page |
// Initialisation de la mise en page |
5058 |
$pdf_lettre_rar->init($f); |
$pdf_lettre_rar->init($f); |
5059 |
|
|
5060 |
|
require_once "../obj/dossier.class.php"; |
5061 |
|
|
5062 |
foreach ($listeCodeBarres as $code_barres) { |
foreach ($listeCodeBarres as $code_barres) { |
5063 |
|
|
5064 |
|
// On récupère le dossier |
5065 |
|
$sql = "SELECT dossier |
5066 |
|
FROM " . DB_PREFIXE . "instruction |
5067 |
|
WHERE code_barres = '" . $code_barres . "'"; |
5068 |
|
$dossier = $this->db->getOne($sql); |
5069 |
|
$this->f->addToLog(__METHOD__."(): db->getOne(\"".$sql."\")", VERBOSE_MODE); |
5070 |
|
$this->f->isDatabaseError($dossier); |
5071 |
|
$inst_dossier = new dossier($dossier); |
5072 |
|
|
5073 |
|
// En fonction du type de dossier, on récupère un demandeur différent dans les requêtes |
5074 |
|
$groupe = $inst_dossier->get_type_affichage_formulaire(); |
5075 |
|
switch ($groupe) { |
5076 |
|
case 'CTX IN': |
5077 |
|
$sql_demandeur = "(lien_dossier_demandeur.petitionnaire_principal IS TRUE AND demandeur.type_demandeur='plaignant')"; |
5078 |
|
break; |
5079 |
|
case 'CTX RE': |
5080 |
|
$sql_demandeur = "(lien_dossier_demandeur.petitionnaire_principal IS TRUE AND demandeur.type_demandeur='requerant')"; |
5081 |
|
break; |
5082 |
|
case 'ADS': |
5083 |
|
case 'DPC': |
5084 |
|
default: |
5085 |
|
$sql_demandeur = "((lien_dossier_demandeur.petitionnaire_principal IS TRUE AND demandeur.type_demandeur='petitionnaire') OR demandeur.type_demandeur='delegataire')"; |
5086 |
|
break; |
5087 |
|
} |
5088 |
|
|
5089 |
// Test si l'evenement est de type arrete et si un délégataire a été nommé |
// Test si l'evenement est de type arrete et si un délégataire a été nommé |
5090 |
$sql = "SELECT |
$sql = "SELECT |
5091 |
dossier.dossier_libelle, |
dossier.dossier_libelle, |
5111 |
inner join ".DB_PREFIXE."demandeur on |
inner join ".DB_PREFIXE."demandeur on |
5112 |
demandeur.demandeur=lien_dossier_demandeur.demandeur |
demandeur.demandeur=lien_dossier_demandeur.demandeur |
5113 |
WHERE code_barres='".$code_barres."' |
WHERE code_barres='".$code_barres."' |
5114 |
AND ((lien_dossier_demandeur.petitionnaire_principal IS TRUE AND demandeur.type_demandeur='petitionnaire') |
AND " . $sql_demandeur . " |
|
OR demandeur.type_demandeur='delegataire') |
|
5115 |
GROUP BY dossier.dossier_libelle, evenement.type, phase.code, division.libelle"; |
GROUP BY dossier.dossier_libelle, evenement.type, phase.code, division.libelle"; |
5116 |
|
|
5117 |
$res = $f->db->query($sql); |
$res = $f->db->query($sql); |
5165 |
if($testDemandeur['type'] != 'arrete' AND $testDemandeur['nbdemandeur'] > 1) { |
if($testDemandeur['type'] != 'arrete' AND $testDemandeur['nbdemandeur'] > 1) { |
5166 |
$sqlAdresse .= " AND demandeur.type_demandeur='delegataire'"; |
$sqlAdresse .= " AND demandeur.type_demandeur='delegataire'"; |
5167 |
} else { |
} else { |
5168 |
$sqlAdresse .= " AND lien_dossier_demandeur.petitionnaire_principal IS TRUE AND demandeur.type_demandeur='petitionnaire'"; |
$sqlAdresse .= " AND " . $sql_demandeur; |
5169 |
} |
} |
5170 |
|
|
5171 |
$resAdresse = $f->db->query($sqlAdresse); |
$resAdresse = $f->db->query($sqlAdresse); |
5201 |
$specifique_content[] = $testDemandeur['dossier_libelle']; |
$specifique_content[] = $testDemandeur['dossier_libelle']; |
5202 |
$specifique_content[] = "|||||".$adresse_dest['code_barres']."|||||"; |
$specifique_content[] = "|||||".$adresse_dest['code_barres']."|||||"; |
5203 |
unset($adresse_dest['code_barres']); |
unset($adresse_dest['code_barres']); |
|
|
|
5204 |
// Ajout d'une page aux pdf |
// Ajout d'une page aux pdf |
5205 |
$pdf_lettre_rar->addLetter($adresse_destinataire, $specifique_content, $testDemandeur['code_phase']); |
$pdf_lettre_rar->addLetter($adresse_destinataire, $specifique_content, $testDemandeur['code_phase']); |
5206 |
|
|
5207 |
} |
} |
5208 |
$pdf_output = $pdf_lettre_rar->output("lettre_rar".date("dmYHis").".pdf","S"); |
$pdf_output = $pdf_lettre_rar->output("lettre_rar".date("dmYHis").".pdf","S"); |
5209 |
require_once PATH_OPENMAIRIE."om_edition.class.php"; |
$om_edition = $this->f->get_inst__om_edition(); |
|
$om_edition = new edition(); |
|
5210 |
$om_edition->expose_pdf_output($pdf_output, "lettre_rar".date("dmYHis").".pdf"); |
$om_edition->expose_pdf_output($pdf_output, "lettre_rar".date("dmYHis").".pdf"); |
5211 |
} |
} |
5212 |
} |
} |
5387 |
} |
} |
5388 |
|
|
5389 |
/** |
/** |
5390 |
* Retourne l'événement d'instruction dont on donne le code-barres |
* Retourne l'événement d'instruction dont on donne le code-barres, avec un filtre |
5391 |
|
* pour exclure les dossiers du groupe contentieux. |
5392 |
* |
* |
5393 |
* @param [string] $barcode numéro du code-barres |
* @param [string] $barcode numéro du code-barres |
5394 |
* @return [mixed] ID de son instruction ou null si aucun code |
* @return [mixed] ID de son instruction ou null si aucun code |
5397 |
// Begin |
// Begin |
5398 |
$this->begin_treatment(__METHOD__); |
$this->begin_treatment(__METHOD__); |
5399 |
// Vérification de l'existence de l'événement d'instruction |
// Vérification de l'existence de l'événement d'instruction |
5400 |
// pour le code-barres donné |
// pour le code-barres donné, en excluant les dossiers liés au groupe CTX |
5401 |
$sql = "SELECT instruction |
$sql = "SELECT instruction |
5402 |
FROM ".DB_PREFIXE."instruction |
FROM ".DB_PREFIXE."instruction |
5403 |
WHERE code_barres = '".$this->f->db->escapesimple($barcode)."'"; |
INNER JOIN ".DB_PREFIXE."dossier |
5404 |
|
ON dossier.dossier=instruction.dossier |
5405 |
|
INNER JOIN ".DB_PREFIXE."dossier_instruction_type |
5406 |
|
ON dossier.dossier_instruction_type = dossier_instruction_type.dossier_instruction_type |
5407 |
|
INNER JOIN ".DB_PREFIXE."dossier_autorisation_type_detaille |
5408 |
|
ON dossier_instruction_type.dossier_autorisation_type_detaille = dossier_autorisation_type_detaille.dossier_autorisation_type_detaille |
5409 |
|
INNER JOIN ".DB_PREFIXE."dossier_autorisation_type |
5410 |
|
ON dossier_autorisation_type_detaille.dossier_autorisation_type = dossier_autorisation_type.dossier_autorisation_type |
5411 |
|
INNER JOIN ".DB_PREFIXE."groupe |
5412 |
|
ON dossier_autorisation_type.groupe = groupe.groupe |
5413 |
|
AND groupe.code != 'CTX' |
5414 |
|
WHERE code_barres = '".$this->f->db->escapesimple($barcode)."'"; |
5415 |
$res = $this->f->db->getOne($sql); |
$res = $this->f->db->getOne($sql); |
5416 |
$this->f->addToLog(__METHOD__." : db->getOne(\"".$sql."\")", VERBOSE_MODE); |
$this->f->addToLog(__METHOD__." : db->getOne(\"".$sql."\")", VERBOSE_MODE); |
5417 |
$this->f->isDatabaseError($res); |
$this->f->isDatabaseError($res); |
5453 |
* validation du formulaire d'ajout. |
* validation du formulaire d'ajout. |
5454 |
* @param array $val tableau des valeurs retournées par le formulaire |
* @param array $val tableau des valeurs retournées par le formulaire |
5455 |
*/ |
*/ |
5456 |
function setValFAjout($val) { |
function setValFAjout($val = array()) { |
5457 |
// Mise à jour du flag created_by_commune lors d'un changement de décision |
// Mise à jour du flag created_by_commune lors d'un changement de décision |
5458 |
// par un utilisateur de commune sur un dossier instruit par la comcom |
// par un utilisateur de commune sur un dossier instruit par la comcom |
5459 |
if($this->f->isInstrCanChangeDecision($this->valF["dossier"])) { |
if ($this->isInstrCanChangeDecision($this->valF["dossier"])) { |
5460 |
$this->valF['created_by_commune'] = true; |
$this->valF['created_by_commune'] = true; |
5461 |
} |
} |
5462 |
} |
} |
5463 |
|
|
5464 |
|
|
5465 |
/** |
/** |
5466 |
* Récupère l'instance du dossier d'instruction |
* Récupère l'instance d'un événement de workflow. |
5467 |
* |
* |
5468 |
* @param mixed Identifiant du dossier d'instruction |
* @param mixed $evenement Identifiant de l'événement. |
5469 |
* |
* |
5470 |
* @return object |
* @return object |
5471 |
*/ |
*/ |
5472 |
function get_inst_dossier($dossier = null) { |
function get_inst_evenement($evenement = null) { |
5473 |
// |
// |
5474 |
return $this->get_inst_common("dossier", $dossier); |
return $this->get_inst_common("evenement", $evenement); |
5475 |
} |
} |
5476 |
|
|
5477 |
/** |
/** |
5478 |
* Logue l'action de l'instruction dans son DI |
* Logue l'action de l'instruction dans son DI. |
5479 |
* @param string $action ajouter/modifer/supprimer |
* |
5480 |
* @param string $id clé primaire de l'instruction |
* @param string $id Clé primaire de l'instruction. |
5481 |
* @param array $val valeurs de l'instruction |
* @param array $val Valeurs de l'instruction. |
5482 |
* @return bool vrai si traitement effectué avec succès |
* |
5483 |
|
* @return bool Vrai si traitement effectué avec succès |
5484 |
*/ |
*/ |
5485 |
private function add_log_to_dossier($action, $id, $val) { |
private function add_log_to_dossier($id, array $val) { |
5486 |
|
$maj = $this->getParameter("maj"); |
5487 |
|
// Action = Trace par défaut |
5488 |
|
$action = $this->get_backtrace(); |
5489 |
|
// Action = Identifant de l'action si contexte connu |
5490 |
|
if (empty($maj) === false |
5491 |
|
|| (empty($maj) === true && $maj === 0)) { |
5492 |
|
$action = $this->get_action_param($maj, 'identifier'); |
5493 |
|
if ($action === 'modifier_suivi') { |
5494 |
|
$action = "modifier (via l'action suivi des dates)"; |
5495 |
|
} |
5496 |
|
if ($action === 'notifier_commune' |
5497 |
|
&& isset($val['mails_destinataires']) === true) { |
5498 |
|
$action = "notification de la commune (courriels : "; |
5499 |
|
$action .= $val['mails_destinataires'].")"; |
5500 |
|
} |
5501 |
|
} |
5502 |
// Création du log |
// Création du log |
5503 |
$log = array( |
$log = array( |
5504 |
'date' => date('Y-m-d H:i:s'), |
'date' => date('Y-m-d H:i:s'), |
5510 |
'date_retour_signature' => $this->dateDB($val['date_retour_signature']), |
'date_retour_signature' => $this->dateDB($val['date_retour_signature']), |
5511 |
'evenement' => $val['evenement'], |
'evenement' => $val['evenement'], |
5512 |
'action' => $val['action'], |
'action' => $val['action'], |
5513 |
'instruction' => $id , |
'instruction' => $id, |
5514 |
'etat' => $val['etat'], |
'etat' => $val['etat'], |
5515 |
), |
), |
5516 |
); |
); |
5517 |
// Ajout du log |
// Ajout du log |
5518 |
require_once "../obj/dossier_instruction.class.php"; |
$di = $this->get_inst_dossier($val['dossier']); |
|
$di = new dossier_instruction($val['dossier'], $this->db, DEBUG); |
|
5519 |
$ret = $di->add_log_instructions($log); |
$ret = $di->add_log_instructions($log); |
5520 |
if ($ret === false) { |
if ($ret === false) { |
5521 |
$this->correct = false; |
$this->correct = false; |
5524 |
} |
} |
5525 |
return $ret; |
return $ret; |
5526 |
} |
} |
5527 |
|
|
5528 |
|
|
5529 |
|
/** |
5530 |
|
* Retourne le contexte de déboguage formaté en HTML. |
5531 |
|
* |
5532 |
|
* @return string Une ligne par trace |
5533 |
|
*/ |
5534 |
|
private function get_backtrace() { |
5535 |
|
$trace = debug_backtrace(); |
5536 |
|
$backtrace = ''; |
5537 |
|
$i = 1; |
5538 |
|
foreach ($trace as $key => $value) { |
5539 |
|
$func = $trace[$key]['function']; |
5540 |
|
// On ne s'autolog pas |
5541 |
|
if ($func === 'get_backtrace' |
5542 |
|
|| $func === 'add_log_to_dossier') { |
5543 |
|
continue; |
5544 |
|
} |
5545 |
|
$backtrace .= $i.') '; |
5546 |
|
// Si dans une classe |
5547 |
|
if (isset($trace[$key]['class']) === true |
5548 |
|
&& empty($trace[$key]['class']) === false) { |
5549 |
|
$backtrace .= $trace[$key]['class'].'->'.$func; |
5550 |
|
} |
5551 |
|
// Si procédural |
5552 |
|
else { |
5553 |
|
$file = $trace[$key]['file']; |
5554 |
|
$line = $trace[$key]['line']; |
5555 |
|
$truncated_file = $this->f->get_relative_path($file); |
5556 |
|
if ($truncated_file !== false) { |
5557 |
|
$file = $truncated_file; |
5558 |
|
} |
5559 |
|
$backtrace .= $func.' IN<br/> '.$file.':'.$line; |
5560 |
|
} |
5561 |
|
$backtrace .= '<br/>'; |
5562 |
|
$i++; |
5563 |
|
} |
5564 |
|
return $backtrace; |
5565 |
|
} |
5566 |
|
|
5567 |
|
/** |
5568 |
|
* CONDITION - is_notifiable. |
5569 |
|
* |
5570 |
|
* Condition pour afficher l'action notifier_commune. |
5571 |
|
* |
5572 |
|
* @return boolean |
5573 |
|
*/ |
5574 |
|
public function is_notifiable() { |
5575 |
|
// L'instruction doit être finalisée, ce qui revient à dire |
5576 |
|
// définalisable sans bypass |
5577 |
|
if ($this->is_unfinalizable_without_bypass() === false) { |
5578 |
|
return false; |
5579 |
|
} |
5580 |
|
// La collectivité de l'utilisateur doit être de niveau multi |
5581 |
|
if ($this->f->has_collectivite_multi() === false) { |
5582 |
|
return false; |
5583 |
|
} |
5584 |
|
// Le paramètre multi de l'objet du courriel doit exister |
5585 |
|
if ($this->f->getParameter('param_courriel_de_notification_commune_objet_depuis_instruction') === NULL) { |
5586 |
|
return false; |
5587 |
|
} |
5588 |
|
// Le paramètre multi du modèle du courriel doit exister |
5589 |
|
if ($this->f->getParameter('param_courriel_de_notification_commune_modele_depuis_instruction') === NULL) { |
5590 |
|
return false; |
5591 |
|
} |
5592 |
|
// A ce stade toutes les conditions sont satisfaites |
5593 |
|
return true; |
5594 |
|
} |
5595 |
|
|
5596 |
|
/** |
5597 |
|
* TREATMENT - notifier_commune. |
5598 |
|
* |
5599 |
|
* Notifie aux communes et par courriel la finalisation d'une instruction. |
5600 |
|
* |
5601 |
|
* @return boolean |
5602 |
|
*/ |
5603 |
|
public function notifier_commune() { |
5604 |
|
// Cette méthode permet d'exécuter une routine en début des méthodes |
5605 |
|
// dites de TREATMENT. |
5606 |
|
$this->begin_treatment(__METHOD__); |
5607 |
|
// Définition des paramètres |
5608 |
|
$p_objet = 'param_courriel_de_notification_commune_objet_depuis_instruction'; |
5609 |
|
$p_modele = 'param_courriel_de_notification_commune_modele_depuis_instruction'; |
5610 |
|
$p_courriel = 'param_courriel_de_notification_commune'; |
5611 |
|
// Définition des variables de substitution |
5612 |
|
$id_di = $this->getVal('dossier'); |
5613 |
|
$id_inst = $this->getVal($this->clePrimaire); |
5614 |
|
// Instanciation du DI |
5615 |
|
$di = $this->get_inst_dossier($id_di); |
5616 |
|
// Récupération du paramétrage de la collectivité du dossier |
5617 |
|
$collectivite_di = $di->getVal('om_collectivite'); |
5618 |
|
$params_mono = $this->f->getCollectivite($collectivite_di); |
5619 |
|
// Récupération du paramétrage de la collectivité multi |
5620 |
|
$collectivite_multi = $this->f->get_idx_collectivite_multi(); |
5621 |
|
$params_multi = $this->f->getCollectivite($collectivite_multi); |
5622 |
|
// Vérification de l'objet (obligatoirement multi) |
5623 |
|
$objet = null; |
5624 |
|
if (isset($params_multi[$p_objet]) === true |
5625 |
|
&& $params_multi[$p_objet] !== '') { |
5626 |
|
$objet = $params_multi[$p_objet]; |
5627 |
|
} |
5628 |
|
// Vérification du modèle mono en priorité |
5629 |
|
$modele = null; |
5630 |
|
if (isset($params_mono[$p_modele]) === true |
5631 |
|
&& $params_mono[$p_modele] !== '') { |
5632 |
|
$modele = $params_mono[$p_modele]; |
5633 |
|
|
5634 |
|
} |
5635 |
|
// Sinon vérification du modèle multi |
5636 |
|
if ($modele === null |
5637 |
|
&& isset($params_multi[$p_modele]) === true |
5638 |
|
&& $params_multi[$p_modele] !== '') { |
5639 |
|
$modele = $params_multi[$p_modele]; |
5640 |
|
} |
5641 |
|
// Vérification des adresses de courriel mono |
5642 |
|
$courriels_valides = array(); |
5643 |
|
$courriels_invalides = array(); |
5644 |
|
if (isset($params_mono[$p_courriel]) === true |
5645 |
|
&& $params_mono[$p_courriel] !== '') { |
5646 |
|
// Un mail par ligne |
5647 |
|
$adresses = explode("\n", $params_mono[$p_courriel]); |
5648 |
|
// Vérification de la validité de chaque mail avec preg_match |
5649 |
|
foreach ($adresses as $adresse) { |
5650 |
|
$adresse = trim($adresse); |
5651 |
|
if ($this->f->checkValidEmailAddress($adresse) === 1) { |
5652 |
|
$courriels_valides[] = $adresse; |
5653 |
|
} else { |
5654 |
|
$courriels_invalides[] = $adresse; |
5655 |
|
} |
5656 |
|
} |
5657 |
|
} |
5658 |
|
// Vérification du paramétrage global : |
5659 |
|
// on stoppe le traitement si au moins un paramètre est incorrect |
5660 |
|
if ($objet === null |
5661 |
|
|| $modele === null |
5662 |
|
|| count($courriels_valides) === 0 |
5663 |
|
|| count($courriels_invalides) > 0) { |
5664 |
|
// On construit le message d'erreur adéquat |
5665 |
|
$this->addToMessage(_('Erreur de paramétrage :')); |
5666 |
|
if ($objet === null) { |
5667 |
|
$this->addToMessage(_("* l'objet du courriel envoyé aux communes est vide")); |
5668 |
|
} |
5669 |
|
if ($modele === null) { |
5670 |
|
$this->addToMessage(_("* le modèle du courriel envoyé aux communes est vide")); |
5671 |
|
} |
5672 |
|
if (count($courriels_valides) === 0) { |
5673 |
|
$this->addToMessage(_("* aucun courriel valide de destinataire de la commune")); |
5674 |
|
} |
5675 |
|
if (count($courriels_invalides) > 0) { |
5676 |
|
$courriels_invalides = implode(', ', $courriels_invalides); |
5677 |
|
$this->addToMessage(_("* un ou plusieurs courriels des destinataires de la commune sont invalides : ").$courriels_invalides); |
5678 |
|
} |
5679 |
|
$this->addToMessage(_("Veuillez contacter votre administrateur.")); |
5680 |
|
return $this->end_treatment(__METHOD__, false); |
5681 |
|
} |
5682 |
|
// Remplacement des variables de substitution |
5683 |
|
$objet = str_replace('<DOSSIER_INSTRUCTION>', $id_di, $objet); |
5684 |
|
$modele = $this->formater_modele($modele, $id_di, $id_inst); |
5685 |
|
// Exécution du traitement d'envoi du/des mail(s) |
5686 |
|
$fails = array(); |
5687 |
|
foreach ($courriels_valides as $email) { |
5688 |
|
if ($this->f->sendMail( |
5689 |
|
iconv("UTF-8", "CP1252", $objet), |
5690 |
|
iconv("UTF-8", "CP1252", $modele), |
5691 |
|
iconv("UTF-8", "CP1252", $email)) === false) { |
5692 |
|
$fails[] = $email; |
5693 |
|
} |
5694 |
|
} |
5695 |
|
// Si échec message d'erreur et arrêt du traitement |
5696 |
|
if (count($fails) > 0) { |
5697 |
|
$fails = implode(', ', $fails); |
5698 |
|
$this->addToMessage(_("Erreur lors de l'envoi du courriel aux destinataires : ").$fails); |
5699 |
|
$this->addToMessage(_("Veuillez contacter votre administrateur.")); |
5700 |
|
return $this->end_treatment(__METHOD__, false); |
5701 |
|
} |
5702 |
|
// Ajout du log |
5703 |
|
$this->setValFFromVal(); |
5704 |
|
$val_inst = $this->valF; |
5705 |
|
$val_inst['mails_destinataires'] = implode(', ', $courriels_valides); |
5706 |
|
if ($this->add_log_to_dossier($id_inst, $val_inst) === false) { |
5707 |
|
$this->addToMessage(_("Erreur lors de la notification.")); |
5708 |
|
$this->addToMessage(_("Veuillez contacter votre administrateur.")); |
5709 |
|
return $this->end_treatment(__METHOD__, false); |
5710 |
|
} |
5711 |
|
// Message de validation |
5712 |
|
$this->addToMessage(_('La commune a été notifiée.')); |
5713 |
|
return $this->end_treatment(__METHOD__, true); |
5714 |
|
} |
5715 |
|
|
5716 |
|
/** |
5717 |
|
* Formatte le corps du courriel notifié aux communes |
5718 |
|
* |
5719 |
|
* @param string $modele template du modèle du courriel |
5720 |
|
* @param string $id_di clé primaire du DI |
5721 |
|
* @param string $id_inst clé primaire de l'instruction |
5722 |
|
* @return string corps du mail au format HTML |
5723 |
|
*/ |
5724 |
|
public function formater_modele($modele, $id_di, $id_inst) { |
5725 |
|
// Création du lien d'accès direct à l'instruction |
5726 |
|
$url_inst = PATH_BASE_URL.'spg/direct_link.php?obj=dossier_instruction&action=3'. |
5727 |
|
'&direct_field=dossier&direct_form=instruction&direct_action=3&direct_idx='.$id_inst; |
5728 |
|
$url_inst = '<a href="'.$url_inst.'">'.$url_inst.'</a>'; |
5729 |
|
// Remplacement des champs de fusion |
5730 |
|
$modele = str_replace('<DOSSIER_INSTRUCTION>', $id_di, $modele); |
5731 |
|
$modele = str_replace('<URL_INSTRUCTION>', $url_inst, $modele); |
5732 |
|
$modele = str_replace('<ID_INSTRUCTION>', $id_inst, $modele); |
5733 |
|
// Encodage HTML des sauts de ligne |
5734 |
|
$modele = preg_replace("/\r\n|\r|\n/",'<br/>',$modele); |
5735 |
|
// |
5736 |
|
return $modele; |
5737 |
|
} |
5738 |
|
|
5739 |
|
|
5740 |
|
/** |
5741 |
|
* Récupère l'instance de l'instructeur |
5742 |
|
* |
5743 |
|
* @param integer $instructeur Identifiant de l'instructeur. |
5744 |
|
* |
5745 |
|
* @return object |
5746 |
|
*/ |
5747 |
|
protected function get_inst_instructeur($instructeur) { |
5748 |
|
// |
5749 |
|
return $this->get_inst_common("instructeur", $instructeur); |
5750 |
|
} |
5751 |
|
|
5752 |
|
|
5753 |
|
/** |
5754 |
|
* Récupère l'instance de l'utilisateur |
5755 |
|
* |
5756 |
|
* @param integer $om_utilisateur Identifiant de l'utilisateur. |
5757 |
|
* |
5758 |
|
* @return object |
5759 |
|
*/ |
5760 |
|
protected function get_inst_om_utilisateur($om_utilisateur) { |
5761 |
|
// |
5762 |
|
return $this->get_inst_common("om_utilisateur", $om_utilisateur); |
5763 |
|
} |
5764 |
|
|
5765 |
|
|
5766 |
|
/** |
5767 |
|
* Récupère l'instance de la division. |
5768 |
|
* |
5769 |
|
* @param integer $division Identifiant de la division. |
5770 |
|
* |
5771 |
|
* @return object |
5772 |
|
*/ |
5773 |
|
protected function get_inst_division($division) { |
5774 |
|
// |
5775 |
|
return $this->get_inst_common("division", $division); |
5776 |
|
} |
5777 |
|
|
5778 |
|
|
5779 |
|
/** |
5780 |
|
* Récupère l'instance de la direction. |
5781 |
|
* |
5782 |
|
* @param integer $direction Identifiant de la direction. |
5783 |
|
* |
5784 |
|
* @return object |
5785 |
|
*/ |
5786 |
|
protected function get_inst_direction($direction) { |
5787 |
|
// |
5788 |
|
return $this->get_inst_common("direction", $direction); |
5789 |
|
} |
5790 |
|
|
5791 |
|
|
5792 |
|
/** |
5793 |
|
* Récupère la collectivité d'un instructeur en passant par sa division puis |
5794 |
|
* par sa direction. |
5795 |
|
* |
5796 |
|
* @param integer $instructeur Identifiant de l'instructeur. |
5797 |
|
* |
5798 |
|
* @return integer |
5799 |
|
*/ |
5800 |
|
protected function get_instructeur_om_collectivite($instructeur) { |
5801 |
|
// Chemin vers la collectivité d'un instructeur |
5802 |
|
$inst_instr = $this->get_inst_instructeur($instructeur); |
5803 |
|
$inst_division = $this->get_inst_division($inst_instr->getVal('division')); |
5804 |
|
$inst_direction = $this->get_inst_direction($inst_division->getVal('direction')); |
5805 |
|
|
5806 |
|
// Collectivité |
5807 |
|
$om_collectivite = $inst_direction->getVal('om_collectivite'); |
5808 |
|
|
5809 |
|
// |
5810 |
|
return $om_collectivite; |
5811 |
|
} |
5812 |
|
|
5813 |
|
/* |
5814 |
|
* CONDITION - can_user_access_dossier_contexte_ajout |
5815 |
|
* |
5816 |
|
* Vérifie que l'utilisateur a bien accès au dossier d'instruction passé dans le |
5817 |
|
* formulaire d'ajout. |
5818 |
|
* Cette méthode vérifie que l'utilisateur est lié au groupe du dossier, et si le |
5819 |
|
* dossier est confidentiel qu'il a accès aux confidentiels de ce groupe. |
5820 |
|
* |
5821 |
|
*/ |
5822 |
|
function can_user_access_dossier_contexte_ajout() { |
5823 |
|
|
5824 |
|
($this->f->get_submitted_get_value('idxformulaire') !== null ? $id_dossier = |
5825 |
|
$this->f->get_submitted_get_value('idxformulaire') : $id_dossier = ""); |
5826 |
|
// |
5827 |
|
if ($id_dossier !== "") { |
5828 |
|
require_once "../obj/dossier_instruction.class.php"; |
5829 |
|
$dossier = new dossier_instruction($id_dossier, $f->db, DEBUG); |
5830 |
|
// |
5831 |
|
return $dossier->can_user_access_dossier(); |
5832 |
|
} |
5833 |
|
return false; |
5834 |
|
} |
5835 |
|
|
5836 |
|
/* |
5837 |
|
* CONDITION - can_user_access_dossier |
5838 |
|
* |
5839 |
|
* Vérifie que l'utilisateur a bien accès au dossier lié à l'instruction instanciée. |
5840 |
|
* Cette méthode vérifie que l'utilisateur est lié au groupe du dossier, et si le |
5841 |
|
* dossier est confidentiel qu'il a accès aux confidentiels de ce groupe. |
5842 |
|
* |
5843 |
|
*/ |
5844 |
|
function can_user_access_dossier_contexte_modification() { |
5845 |
|
|
5846 |
|
$id_dossier = $this->getVal('dossier'); |
5847 |
|
// |
5848 |
|
if ($id_dossier !== "" && $id_dossier !== null) { |
5849 |
|
require_once "../obj/dossier_instruction.class.php"; |
5850 |
|
$dossier = new dossier_instruction($id_dossier, $f->db, DEBUG); |
5851 |
|
// |
5852 |
|
return $dossier->can_user_access_dossier(); |
5853 |
|
} |
5854 |
|
return false; |
5855 |
|
} |
5856 |
|
|
5857 |
}// fin classe |
}// fin classe |
5858 |
|
|
5859 |
?> |
?> |