1 |
<?php |
<?php |
2 |
/** |
/** |
3 |
|
* DBFORM - 'instruction' - Surcharge gen. |
4 |
|
* |
5 |
* specific : |
* specific : |
6 |
* - cle secondaire |
* - cle secondaire |
7 |
* destruction autorisée que pour le dernier evenement |
* destruction autorisée que pour le dernier evenement |
14 |
* - function mois_date : pour ajouter des mois a une date |
* - function mois_date : pour ajouter des mois a une date |
15 |
* [add months (delay) and calculation final date] |
* [add months (delay) and calculation final date] |
16 |
* - voir script_lang.js : bible ... |
* - voir script_lang.js : bible ... |
17 |
* |
* |
18 |
* @package openfoncier |
* @package openfoncier |
19 |
* @version SVN : $Id$ |
* @version SVN : $Id$ |
20 |
*/ |
*/ |
29 |
var $abstract_type = array( |
var $abstract_type = array( |
30 |
"om_fichier_instruction" => "file", |
"om_fichier_instruction" => "file", |
31 |
); |
); |
32 |
|
|
|
var $retourformulaire; // specific |
|
|
var $idxformulaire; // specific |
|
33 |
var $valEvenement; |
var $valEvenement; |
34 |
var $restriction_valid = null; |
var $restriction_valid = null; |
35 |
// Tableau contenant une partie des métadonnées arrêtés |
// Tableau contenant une partie des métadonnées arrêtés |
69 |
"groupeInstruction" => 'getGroupeInstruction', |
"groupeInstruction" => 'getGroupeInstruction', |
70 |
"title" => 'getTitle', |
"title" => 'getTitle', |
71 |
'concerneERP' => 'get_concerne_erp', |
'concerneERP' => 'get_concerne_erp', |
72 |
|
|
73 |
|
'date_cloture_metier' => 'getDossierDateDecision', |
74 |
|
'type' => 'getDocumentType', |
75 |
|
'dossier_autorisation_type_detaille' => 'getDossierAutorisationTypeDetaille', |
76 |
|
'dossier_instruction_type' => 'getDossierInstructionTypeLibelle', |
77 |
|
'region' => 'getDossierRegion', |
78 |
|
'departement' => 'getDossierDepartement', |
79 |
|
'commune' => 'getDossierCommune', |
80 |
|
'annee' => 'getDossierAnnee', |
81 |
|
'division' => 'getDossierDivision', |
82 |
|
'collectivite' => 'getDossierServiceOrCollectivite', |
83 |
), |
), |
84 |
"arrete" => array( |
"arrete" => array( |
85 |
"numArrete" => "getNumArrete", |
"numArrete" => "getNumArrete", |
96 |
"ap_ville" => "getAp_ville", |
"ap_ville" => "getAp_ville", |
97 |
"activite" => "getActivite", |
"activite" => "getActivite", |
98 |
"dateControleLegalite" => "getDateControleLegalite", |
"dateControleLegalite" => "getDateControleLegalite", |
99 |
), |
) |
100 |
); |
); |
101 |
|
|
102 |
function __construct($id, &$db, $debug) { |
/** |
103 |
$this->constructeur($id, $db, $debug); |
* Flag pour identifier la reprise de l'instruction d'un dossier. |
104 |
} |
* Le statut de l'état passe de "cloture" à "encours". |
105 |
|
* |
106 |
|
* @var boolean |
107 |
|
*/ |
108 |
|
var $di_reopened = null; |
109 |
|
|
110 |
// {{{ Gestion de la confidentialité des données spécifiques |
// {{{ Gestion de la confidentialité des données spécifiques |
111 |
|
|
128 |
"is_editable", |
"is_editable", |
129 |
"is_finalizable_without_bypass", |
"is_finalizable_without_bypass", |
130 |
"can_user_access_dossier_contexte_modification", |
"can_user_access_dossier_contexte_modification", |
131 |
|
"is_evenement_modifiable", |
132 |
); |
); |
133 |
$this->class_actions[1]["portlet"]["libelle"] = _("Modifier"); |
$this->class_actions[1]["portlet"]["libelle"] = _("Modifier"); |
134 |
|
|
137 |
$this->class_actions[2]["condition"] = array( |
$this->class_actions[2]["condition"] = array( |
138 |
"is_deletable", |
"is_deletable", |
139 |
"is_finalizable_without_bypass", |
"is_finalizable_without_bypass", |
140 |
"can_user_access_dossier_contexte_modification" |
"can_user_access_dossier_contexte_modification", |
141 |
|
"is_evenement_supprimable", |
142 |
); |
); |
143 |
$this->class_actions[2]["portlet"]["libelle"] = _("Supprimer"); |
$this->class_actions[2]["portlet"]["libelle"] = _("Supprimer"); |
144 |
|
|
186 |
"is_unfinalizable", |
"is_unfinalizable", |
187 |
"is_unfinalizable_without_bypass", |
"is_unfinalizable_without_bypass", |
188 |
"can_user_access_dossier_contexte_modification", |
"can_user_access_dossier_contexte_modification", |
189 |
|
"is_not_sent_for_signature", |
190 |
), |
), |
191 |
); |
); |
192 |
|
|
261 |
); |
); |
262 |
|
|
263 |
// ACTION - 180 - pdf_lettre_rar |
// ACTION - 180 - pdf_lettre_rar |
264 |
// Génère PDF sur bordereaux de lettres RAR |
// Génère PDF sur bordereaux de lettres AR |
265 |
$this->class_actions[180] = array( |
$this->class_actions[180] = array( |
266 |
"identifier" => "pdf_lettre_rar", |
"identifier" => "pdf_lettre_rar", |
267 |
"view" => "view_pdf_lettre_rar", |
"view" => "view_pdf_lettre_rar", |
317 |
"permission_suffix" => "modifier", |
"permission_suffix" => "modifier", |
318 |
"condition" => array("can_user_access_dossier_contexte_modification"), |
"condition" => array("can_user_access_dossier_contexte_modification"), |
319 |
); |
); |
320 |
|
|
321 |
|
// ACTION - 701 |
322 |
|
$this->class_actions[701] = array( |
323 |
|
"identifier" => "enable-edition-integrale", |
324 |
|
"portlet" => array( |
325 |
|
"type" => "action-direct-with-confirmation", |
326 |
|
"libelle" => _("Rédaction libre"), |
327 |
|
"order" => 50, |
328 |
|
"class" => "redac-libre-16", |
329 |
|
), |
330 |
|
"view" => "formulaire", |
331 |
|
"method" => "enable_edition_integrale", |
332 |
|
"permission_suffix" => "modifier", |
333 |
|
"condition" => array( |
334 |
|
"is_editable", |
335 |
|
"is_finalizable_without_bypass", |
336 |
|
"can_user_access_dossier_contexte_modification", |
337 |
|
"is_edition_integrale_not_enabled", |
338 |
|
"is_option_redaction_libre_enabled", |
339 |
|
"has_an_edition", |
340 |
|
), |
341 |
|
); |
342 |
|
// ACTION - 702 |
343 |
|
$this->class_actions[702] = array( |
344 |
|
"identifier" => "disable-edition-integrale", |
345 |
|
"portlet" => array( |
346 |
|
"type" => "action-direct-with-confirmation", |
347 |
|
"libelle" => _("Rédaction par compléments"), |
348 |
|
"order" => 50, |
349 |
|
"class" => "redac-complement-16", |
350 |
|
), |
351 |
|
"view" => "formulaire", |
352 |
|
"method" => "disable_edition_integrale", |
353 |
|
"permission_suffix" => "modifier", |
354 |
|
"condition" => array( |
355 |
|
"is_editable", |
356 |
|
"is_finalizable_without_bypass", |
357 |
|
"can_user_access_dossier_contexte_modification", |
358 |
|
"is_edition_integrale_enabled", |
359 |
|
"is_option_redaction_libre_enabled", |
360 |
|
"has_an_edition", |
361 |
|
), |
362 |
|
); |
363 |
|
// ACTION - 300 - evenement_has_an_edition_json |
364 |
|
// |
365 |
|
$this->class_actions[300] = array( |
366 |
|
"identifier" => "evenement_has_an_edition_json", |
367 |
|
"view" => "view_evenement_has_an_edition_json", |
368 |
|
"permission_suffix" => "consulter", |
369 |
|
); |
370 |
|
|
371 |
|
// ACTION - 301 - evenement_has_a_commentaire |
372 |
|
// |
373 |
|
$this->class_actions[301] = array( |
374 |
|
"identifier" => "evenement_has_a_commentaire_json", |
375 |
|
"view" => "view_evenement_has_a_commentaire_json", |
376 |
|
"permission_suffix" => "consulter", |
377 |
|
); |
378 |
|
|
379 |
|
// ACTION - 400 - Envoyer en signature |
380 |
|
// Cet évenement permet d'envoyer le document au parapheur pour signature |
381 |
|
$this->class_actions[400] = array( |
382 |
|
"identifier" => "envoyer_a_signature", |
383 |
|
"portlet" => array( |
384 |
|
"libelle" => _("Envoyer à signature"), |
385 |
|
"type" => "action-direct-with-confirmation", |
386 |
|
"class" => "envoyer_a_signature-16", |
387 |
|
), |
388 |
|
"view" => "formulaire", |
389 |
|
"method" => "envoyer_a_signature_sans_relecture", |
390 |
|
"condition" => array( |
391 |
|
"can_be_signed", |
392 |
|
), |
393 |
|
"permission_suffix" => "envoyer_a_signature", |
394 |
|
); |
395 |
|
|
396 |
|
// ACTION - 402 - Envoyer en signature avec relecture |
397 |
|
// Cet évenement permet d'envoyer le document au parapheur pour signature |
398 |
|
$this->class_actions[402] = array( |
399 |
|
"identifier" => "envoyer_a_signature_relecture", |
400 |
|
"portlet" => array( |
401 |
|
"libelle" => __("Envoyer à signature avec relecture"), |
402 |
|
"type" => "action-direct-with-confirmation", |
403 |
|
"class" => "envoyer_a_signature-16", |
404 |
|
), |
405 |
|
"view" => "formulaire", |
406 |
|
"method" => "envoyer_a_signature_avec_relecture", |
407 |
|
"condition" => array( |
408 |
|
"can_be_signed", |
409 |
|
"is_parapheur_relecture_parameter_enabled" |
410 |
|
), |
411 |
|
"permission_suffix" => "envoyer_a_signature", |
412 |
|
); |
413 |
|
|
414 |
|
// |
415 |
|
$this->class_actions[401] = array( |
416 |
|
"identifier" => "preview_edition", |
417 |
|
"view" => "formulaire", |
418 |
|
"permission_suffix" => "tab", |
419 |
|
); |
420 |
|
|
421 |
|
// ACTION - 410 - Notifier les pétitionnaires (mail ou autre) |
422 |
|
$this->class_actions[410] = array( |
423 |
|
"identifier" => "overlay_notification_manuelle", |
424 |
|
"portlet" => array( |
425 |
|
"libelle" => __("Notifier les pétitionnaires"), |
426 |
|
"type" => "action-self", |
427 |
|
"class" => "notifier_commune-16", |
428 |
|
), |
429 |
|
"condition" => array( |
430 |
|
"is_notifiable_by_task_manual", |
431 |
|
"is_not_portail_notification_sans_annexe" |
432 |
|
), |
433 |
|
"view" => "view_overlay_notification_manuelle", |
434 |
|
"permission_suffix" => "modifier", |
435 |
|
); |
436 |
|
|
437 |
|
// ACTION - 411 - Notifier les pétitionnaires (portail citoyen) |
438 |
|
$this->class_actions[411] = array( |
439 |
|
"identifier" => "notification_manuelle_portal", |
440 |
|
"portlet" => array( |
441 |
|
"libelle" => __("Notifier les pétitionnaires"), |
442 |
|
"type" => "action-direct-with-confirmation", |
443 |
|
"class" => "notifier_commune-16", |
444 |
|
), |
445 |
|
"condition" => array( |
446 |
|
"is_notifiable_by_task_manual", |
447 |
|
"is_portail_notification_sans_annexe" |
448 |
|
), |
449 |
|
"method" => "notifier_demandeur_principal", |
450 |
|
"permission_suffix" => "modifier", |
451 |
|
); |
452 |
|
|
453 |
|
// ACTION - 420 - Notifier les services consultés (mail) |
454 |
|
$this->class_actions[420] = array( |
455 |
|
"identifier" => "overlay_notification_service_consulte", |
456 |
|
"portlet" => array( |
457 |
|
"libelle" => __("Notifier les services consultés"), |
458 |
|
"type" => "action-self", |
459 |
|
"class" => "notifier_commune-16", |
460 |
|
), |
461 |
|
"condition" => array( |
462 |
|
"is_service_notifiable" |
463 |
|
), |
464 |
|
"view" => "view_overlay_notification_service_consulte", |
465 |
|
"permission_suffix" => "tab", |
466 |
|
); |
467 |
|
|
468 |
|
// ACTION - 430 - Notifier les tiers consultés (mail) |
469 |
|
$this->class_actions[430] = array( |
470 |
|
"identifier" => "overlay_notification_tiers_consulte", |
471 |
|
"portlet" => array( |
472 |
|
"libelle" => __("Notifier les tiers consultés"), |
473 |
|
"type" => "action-self", |
474 |
|
"class" => "notifier_commune-16", |
475 |
|
), |
476 |
|
"condition" => array( |
477 |
|
"is_tiers_notifiable" |
478 |
|
), |
479 |
|
"view" => "view_overlay_notification_tiers_consulte", |
480 |
|
"permission_suffix" => "tab", |
481 |
|
); |
482 |
|
|
483 |
|
// |
484 |
|
$this->class_actions[403] = array( |
485 |
|
"identifier" => "envoyer_au_controle_de_legalite", |
486 |
|
"portlet" => array( |
487 |
|
"libelle" => __("Envoyer au contrôle de légalité"), |
488 |
|
"type" => "action-direct-with-confirmation", |
489 |
|
"class" => "envoyer_au_controle_de_legalite-16", |
490 |
|
), |
491 |
|
"view" => "formulaire", |
492 |
|
"method" => "envoyer_au_controle_de_legalite", |
493 |
|
"condition" => array( |
494 |
|
"can_be_sended_to_cl" |
495 |
|
), |
496 |
|
"permission_suffix" => "envoyer_au_controle_de_legalite", |
497 |
|
); |
498 |
|
|
499 |
|
// |
500 |
|
$this->class_actions[998] = array( |
501 |
|
"identifier" => "json_data", |
502 |
|
"view" => "view_json_data", |
503 |
|
"permission_suffix" => "consulter", |
504 |
|
); |
505 |
|
} |
506 |
|
|
507 |
|
/** |
508 |
|
* Clause select pour la requête de sélection des données de l'enregistrement. |
509 |
|
* |
510 |
|
* @return array |
511 |
|
*/ |
512 |
|
function get_var_sql_forminc__champs() { |
513 |
|
return array( |
514 |
|
"instruction", |
515 |
|
"destinataire", |
516 |
|
"instruction.evenement", |
517 |
|
"instruction.commentaire", |
518 |
|
"date_evenement", |
519 |
|
"instruction.lettretype", |
520 |
|
"signataire_arrete", |
521 |
|
"flag_edition_integrale", |
522 |
|
"om_final_instruction_utilisateur", |
523 |
|
"date_finalisation_courrier", |
524 |
|
"date_envoi_signature", |
525 |
|
"date_envoi_rar", |
526 |
|
"date_envoi_controle_legalite", |
527 |
|
|
528 |
|
"date_retour_signature", |
529 |
|
"date_retour_rar", |
530 |
|
"date_retour_controle_legalite", |
531 |
|
|
532 |
|
"numero_arrete", |
533 |
|
|
534 |
|
"complement_om_html", |
535 |
|
"'' as bible_auto", |
536 |
|
"'' as bible", |
537 |
|
"complement2_om_html", |
538 |
|
"'' as bible2", |
539 |
|
"complement3_om_html", |
540 |
|
"'' as bible3", |
541 |
|
"complement4_om_html", |
542 |
|
"'' as bible4", |
543 |
|
|
544 |
|
"titre_om_htmletat", |
545 |
|
"corps_om_htmletatex", |
546 |
|
|
547 |
|
"'' as btn_preview", |
548 |
|
"'' as btn_redaction", |
549 |
|
|
550 |
|
"'' as btn_refresh", |
551 |
|
"'' as live_preview", |
552 |
|
|
553 |
|
"dossier", |
554 |
|
"instruction.action", |
555 |
|
"instruction.delai", |
556 |
|
"instruction.etat", |
557 |
|
"instruction.autorite_competente", |
558 |
|
"instruction.accord_tacite", |
559 |
|
"instruction.delai_notification", |
560 |
|
"instruction.avis_decision", |
561 |
|
"archive_delai", |
562 |
|
"archive_accord_tacite", |
563 |
|
"archive_etat", |
564 |
|
"archive_avis", |
565 |
|
"archive_date_complet", |
566 |
|
"archive_date_rejet", |
567 |
|
"archive_date_limite", |
568 |
|
"archive_date_notification_delai", |
569 |
|
"archive_date_decision", |
570 |
|
"archive_date_validite", |
571 |
|
"archive_date_achevement", |
572 |
|
"archive_date_conformite", |
573 |
|
"archive_date_chantier", |
574 |
|
"archive_date_dernier_depot", |
575 |
|
"date_depot", |
576 |
|
"date_depot_mairie", |
577 |
|
"complement5_om_html", |
578 |
|
"'' as bible5", |
579 |
|
"complement6_om_html", |
580 |
|
"'' as bible6", |
581 |
|
"complement7_om_html", |
582 |
|
"'' as bible7", |
583 |
|
"complement8_om_html", |
584 |
|
"'' as bible8", |
585 |
|
"complement9_om_html", |
586 |
|
"'' as bible9", |
587 |
|
"complement10_om_html", |
588 |
|
"'' as bible10", |
589 |
|
"complement11_om_html", |
590 |
|
"'' as bible11", |
591 |
|
"complement12_om_html", |
592 |
|
"complement13_om_html", |
593 |
|
"complement14_om_html", |
594 |
|
"complement15_om_html", |
595 |
|
"archive_incompletude", |
596 |
|
"archive_incomplet_notifie", |
597 |
|
"archive_evenement_suivant_tacite", |
598 |
|
"archive_evenement_suivant_tacite_incompletude", |
599 |
|
"archive_etat_pendant_incompletude", |
600 |
|
"archive_date_limite_incompletude", |
601 |
|
"archive_delai_incompletude", |
602 |
|
"archive_autorite_competente", |
603 |
|
"code_barres", |
604 |
|
"om_fichier_instruction", |
605 |
|
"om_final_instruction", |
606 |
|
"om_fichier_instruction_dossier_final", |
607 |
|
"document_numerise", |
608 |
|
"duree_validite_parametrage", |
609 |
|
"duree_validite", |
610 |
|
"created_by_commune", |
611 |
|
"archive_date_cloture_instruction", |
612 |
|
"archive_date_premiere_visite", |
613 |
|
"archive_date_derniere_visite", |
614 |
|
"archive_date_contradictoire", |
615 |
|
"archive_date_retour_contradictoire", |
616 |
|
"archive_date_ait", |
617 |
|
"archive_date_transmission_parquet", |
618 |
|
"archive_dossier_instruction_type", |
619 |
|
"archive_date_affichage", |
620 |
|
"pec_metier", |
621 |
|
"archive_pec_metier", |
622 |
|
"archive_a_qualifier", |
623 |
|
"id_parapheur_signature", |
624 |
|
"statut_signature", |
625 |
|
"commentaire_signature", |
626 |
|
"historique_signature", |
627 |
|
"'' as suivi_notification", |
628 |
|
"'' as suivi_notification_service", |
629 |
|
"'' as suivi_notification_tiers", |
630 |
|
|
631 |
|
"'' as preview_edition", |
632 |
|
"envoye_cl_platau", |
633 |
|
); |
634 |
|
} |
635 |
|
|
636 |
|
/** |
637 |
|
* CONDITION - is_edition_integrale_enabled |
638 |
|
* |
639 |
|
* Vérifie que la rédaction libre est activée sur l'instruction en cours. |
640 |
|
* |
641 |
|
* @return boolean |
642 |
|
*/ |
643 |
|
function is_edition_integrale_enabled() { |
644 |
|
if ($this->getVal("flag_edition_integrale") == 't') { |
645 |
|
return true; |
646 |
|
} |
647 |
|
return false; |
648 |
|
} |
649 |
|
|
650 |
|
/** |
651 |
|
* CONDITION - is_edition_integrale_not_enabled |
652 |
|
* |
653 |
|
* Vérifie que la rédaction libre est désactivée sur l'instruction en cours. |
654 |
|
* |
655 |
|
* @return boolean |
656 |
|
*/ |
657 |
|
function is_edition_integrale_not_enabled() { |
658 |
|
return !$this->is_edition_integrale_enabled(); |
659 |
|
} |
660 |
|
|
661 |
|
/** |
662 |
|
* CONDITION - is_option_redaction_libre_enabled |
663 |
|
* |
664 |
|
* Vérifie que l'option de rédaction libre est activée. |
665 |
|
* |
666 |
|
* @return boolean |
667 |
|
*/ |
668 |
|
function is_option_redaction_libre_enabled() { |
669 |
|
$collectivite_di = $this->get_dossier_instruction_om_collectivite(); |
670 |
|
return $this->f->is_option_redaction_libre_enabled($collectivite_di); |
671 |
} |
} |
672 |
|
|
673 |
|
/** |
674 |
|
* CONDITION - is_option_parapheur_relecture_enabled |
675 |
|
* |
676 |
|
* Vérifie que l'option de relecture lors de l'envoi en signature est activée. |
677 |
|
* |
678 |
|
* @return boolean |
679 |
|
*/ |
680 |
|
function is_parapheur_relecture_parameter_enabled() { |
681 |
|
//Instanciation de la classe electronicsignature |
682 |
|
$inst_es = $this->get_electronicsignature_instance(); |
683 |
|
if ($inst_es === false) { |
684 |
|
return false; |
685 |
|
} |
686 |
|
|
687 |
|
if ($inst_es->get_conf('is_forced_view_files') !== 'true' && $inst_es->get_conf('is_forced_view_files') !== true) { |
688 |
|
return false; |
689 |
|
} |
690 |
|
|
691 |
|
return true; |
692 |
|
} |
693 |
|
|
694 |
|
|
695 |
|
/** |
696 |
|
* CONDITION - is_sent_for_signature |
697 |
|
* |
698 |
|
* Vérifie que l'instruction a été envoyé à signature |
699 |
|
* |
700 |
|
* @return boolean |
701 |
|
*/ |
702 |
|
function is_sent_for_signature() { |
703 |
|
// Si un parapheur a été configuré |
704 |
|
// et que le champ id_parapheur_signature n'est pas vide |
705 |
|
// que le status est différent de "canceled" ou "expired" |
706 |
|
// alors l'évènement a été envoyé en signature |
707 |
|
if ($this->has_connector_electronicsignature() === true |
708 |
|
&& empty($this->getVal("id_parapheur_signature")) === false |
709 |
|
&& ($this->getVal("statut_signature") != "canceled" |
710 |
|
|| $this->getVal("statut_signature") != "expired" |
711 |
|
|| $this->getVal("statut_signature") != "finished")) { |
712 |
|
// |
713 |
|
return true; |
714 |
|
} |
715 |
|
|
716 |
|
return false; |
717 |
|
} |
718 |
|
|
719 |
|
/** |
720 |
|
* CONDITION - is_not_sent_for_signature |
721 |
|
* |
722 |
|
* Vérifie que l'instruction n'a pas été envoyé à signature |
723 |
|
* |
724 |
|
* @return boolean |
725 |
|
*/ |
726 |
|
function is_not_sent_for_signature() { |
727 |
|
// Contrôle si l'utilisateur possède un bypass |
728 |
|
$bypass = $this->f->isAccredited($this->get_absolute_class_name()."_definaliser_bypass"); |
729 |
|
if ($bypass == true) { |
730 |
|
return true; |
731 |
|
} |
732 |
|
|
733 |
|
return !$this->is_sent_for_signature(); |
734 |
|
} |
735 |
|
|
736 |
|
|
737 |
|
/** |
738 |
|
* CONDITION - is_signed |
739 |
|
* |
740 |
|
* Vérifie que l'instruction a été signé |
741 |
|
* |
742 |
|
* @return boolean |
743 |
|
*/ |
744 |
|
function is_signed() { |
745 |
|
// Si un parapheur a été configuré |
746 |
|
// et que le champ id_parapheur_signature n'est pas vide |
747 |
|
// et que le statut est égal à "finished" |
748 |
|
// alors le document de l'instruciton à été signé |
749 |
|
if ($this->has_connector_electronicsignature() === true |
750 |
|
&& empty($this->getVal("id_parapheur_signature")) === false |
751 |
|
&& $this->getVal("statut_signature") == "finished") { |
752 |
|
// |
753 |
|
return true; |
754 |
|
} |
755 |
|
|
756 |
|
return false; |
757 |
|
} |
758 |
|
|
759 |
|
function is_sent_to_cl() { |
760 |
|
// Si l'instruction a une édition |
761 |
|
// et que l'événement est paramétré pour envoyer le contrôle de légalité |
762 |
|
// par Plat'AU |
763 |
|
// et que la date de retour signature est renseignée |
764 |
|
// et que la date d'envoi au contrôle légalité n'est pas renseignée |
765 |
|
// et qu'il n'existe pas de task envoi_CL en cours (!= done ou canceled) |
766 |
|
if ($this->has_an_edition() === true) { |
767 |
|
$inst_evenement = $this->get_inst_evenement($this->getVal('evenement')); |
768 |
|
if ($inst_evenement->getVal('envoi_cl_platau') === 't' |
769 |
|
|| $this->getVal('envoye_cl_platau') === 't') { |
770 |
|
// |
771 |
|
return true; |
772 |
|
} |
773 |
|
} |
774 |
|
// |
775 |
|
return false; |
776 |
|
} |
777 |
|
|
778 |
|
/** |
779 |
|
* CONDITION - is_portail_notification |
780 |
|
* |
781 |
|
* Vérifie si la notification est une notification de catégorie portail |
782 |
|
* |
783 |
|
* @return boolean |
784 |
|
*/ |
785 |
|
function is_portail_notification_sans_annexe() { |
786 |
|
$collectiviteDi = $this->get_dossier_instruction_om_collectivite(); |
787 |
|
$ev = $this->get_inst_evenement($this->getVal('evenement')); |
788 |
|
if (($this->f->get_param_option_notification($collectiviteDi) === null || |
789 |
|
$this->f->get_param_option_notification($collectiviteDi) === 'portal') |
790 |
|
&& $ev->getVal('notification') != 'notification_manuelle_annexe' |
791 |
|
&& $ev->getVal('notification') != 'notification_manuelle_annexe_signature_requise' |
792 |
|
) { |
793 |
|
return true; |
794 |
|
} |
795 |
|
return false; |
796 |
|
} |
797 |
|
|
798 |
|
/** |
799 |
|
* CONDITION - is_not_portail_notification |
800 |
|
* |
801 |
|
* Vérifie si la notification n'est pas une notification de catégorie portail |
802 |
|
* |
803 |
|
* @return boolean |
804 |
|
*/ |
805 |
|
function is_not_portail_notification_sans_annexe() { |
806 |
|
return (! $this->is_portail_notification_sans_annexe()); |
807 |
|
} |
808 |
|
|
809 |
|
/** |
810 |
|
* CONDITION - can_be_signed |
811 |
|
* |
812 |
|
* Vérifie que le document de l'instruction peut être envoyé au parapheur pour signature |
813 |
|
* |
814 |
|
* @return boolean |
815 |
|
*/ |
816 |
|
function can_be_signed() { |
817 |
|
// Instanciation de l'objet signataire_arrete |
818 |
|
$inst_signataire_arrete = $this->f->get_inst__om_dbform(array( |
819 |
|
"obj" => "signataire_arrete", |
820 |
|
"idx" => $this->getVal("signataire_arrete"), |
821 |
|
)); |
822 |
|
// Si un parapheur a été configuré, que le document est finalisé, que le signataire |
823 |
|
// possède une adresse email, on vérifie le champ id_parapheur_signature |
824 |
|
// S'il est vide l'évènement peut être envoyé en signature |
825 |
|
// S'il ne l'est pas, alors on vérifie le champ statut_signature |
826 |
|
// Si la valeur de ce champ est égal à "canceled" ou "expired" |
827 |
|
// alors l'évènement peut être envoyé en signature |
828 |
|
if ($this->has_connector_electronicsignature() === true |
829 |
|
&& $this->getVal("om_final_instruction") == 't' |
830 |
|
&& empty($inst_signataire_arrete->getVal('email')) === false) { |
831 |
|
// |
832 |
|
if (empty($this->getVal("id_parapheur_signature")) === true |
833 |
|
|| $this->getVal("statut_signature") == "canceled" |
834 |
|
|| $this->getVal("statut_signature") == "expired") { |
835 |
|
// |
836 |
|
return true; |
837 |
|
} |
838 |
|
} |
839 |
|
|
840 |
|
$this->addToLog(__METHOD__."() has_connector_electronicsignature: ".var_export($this->has_connector_electronicsignature(), true), EXTRA_VERBOSE_MODE); |
841 |
|
$this->addToLog(__METHOD__."() om_final_instruction: ".var_export($this->getVal("om_final_instruction"), true), EXTRA_VERBOSE_MODE); |
842 |
|
$this->addToLog(__METHOD__."() email: ".var_export($inst_signataire_arrete->getVal('email'), true), EXTRA_VERBOSE_MODE); |
843 |
|
$this->addToLog(__METHOD__."() id_parapheur_signature: ".var_export($this->getVal("id_parapheur_signature"), true), EXTRA_VERBOSE_MODE); |
844 |
|
$this->addToLog(__METHOD__."() statut_signature: ".var_export($this->getVal("statut_signature"), true), EXTRA_VERBOSE_MODE); |
845 |
|
|
846 |
|
return false; |
847 |
|
} |
848 |
|
|
849 |
|
/** |
850 |
|
* CONDITION - has_connector_electronicsignature |
851 |
|
* |
852 |
|
* Vérifie qu'un parapheur est paramétré |
853 |
|
* |
854 |
|
* @return boolean |
855 |
|
*/ |
856 |
|
function has_connector_electronicsignature() { |
857 |
|
$inst_es = $this->get_electronicsignature_instance(false); |
858 |
|
if ($inst_es === false) { |
859 |
|
return false; |
860 |
|
} |
861 |
|
return true; |
862 |
|
} |
863 |
|
|
864 |
|
/** |
865 |
|
* CONDITION - can_display_parapheur |
866 |
|
* |
867 |
|
* Vérifie que le fieldset "Suivi Parapheur" soit affichable |
868 |
|
* |
869 |
|
* @return boolean |
870 |
|
*/ |
871 |
|
function can_display_parapheur() { |
872 |
|
$evenement_id = $this->getVal("evenement"); |
873 |
|
$inst_evenement = $this->get_inst_evenement($evenement_id); |
874 |
|
if ($this->has_connector_electronicsignature() === true |
875 |
|
&& $inst_evenement->getVal('lettretype') !== '' |
876 |
|
&& $inst_evenement->getVal('lettretype') !== null |
877 |
|
&& (empty($this->getVal("id_parapheur_signature")) === false |
878 |
|
|| empty($this->getVal("historique_signature")) === false)) { |
879 |
|
// |
880 |
|
return true; |
881 |
|
} |
882 |
|
|
883 |
|
return false; |
884 |
|
} |
885 |
|
|
886 |
|
/** |
887 |
|
* CONDITION - can_display_notification |
888 |
|
* |
889 |
|
* Vérifie que le champs "Suivi notification" est affichable |
890 |
|
* |
891 |
|
* @return boolean |
892 |
|
*/ |
893 |
|
function can_display_notification_demandeur() { |
894 |
|
// Le suivi des notification est affiché si l'événement est notifiable |
895 |
|
// et si des notifications ont été envoyées |
896 |
|
$evenement_id = $this->getVal("evenement"); |
897 |
|
$inst_evenement = $this->get_inst_evenement($evenement_id); |
898 |
|
if ($inst_evenement->getVal('notification') != null && |
899 |
|
$inst_evenement->getVal('notification') != '') { |
900 |
|
// Des notifications ont été envoyé si il existe au moins une notification |
901 |
|
// liées à l'instruction |
902 |
|
$idsNotifs = $this->get_instruction_notification( |
903 |
|
$this->getVal($this->clePrimaire), |
904 |
|
array( |
905 |
|
'notification_recepisse', |
906 |
|
'notification_instruction', |
907 |
|
'notification_decision', |
908 |
|
) |
909 |
|
); |
910 |
|
if (isset($idsNotifs) && $idsNotifs !== array()) { |
911 |
|
return true; |
912 |
|
} |
913 |
|
} |
914 |
|
return false; |
915 |
|
} |
916 |
|
|
917 |
|
/** |
918 |
|
* CONDITION - can_display_notification |
919 |
|
* |
920 |
|
* Vérifie que le champs "suivi_notification_service" est affichable |
921 |
|
* |
922 |
|
* @return boolean |
923 |
|
*/ |
924 |
|
function can_display_notification_service() { |
925 |
|
// Le suivi des notification est affiché si l'événement est notifiable |
926 |
|
// et si des notifications ont été envoyées |
927 |
|
$evenement_id = $this->getVal("evenement"); |
928 |
|
$inst_evenement = $this->get_inst_evenement($evenement_id); |
929 |
|
if ($this->get_boolean_from_pgsql_value($inst_evenement->getVal('notification_service')) == true) { |
930 |
|
// Des notifications ont été envoyé si il existe au moins une notification |
931 |
|
// de type notification_service_consulte liées à l'instruction |
932 |
|
$idsNotifs = $this->get_instruction_notification( |
933 |
|
$this->getVal($this->clePrimaire), |
934 |
|
'notification_service_consulte' |
935 |
|
); |
936 |
|
if (isset($idsNotifs) && $idsNotifs !== array()) { |
937 |
|
return true; |
938 |
|
} |
939 |
|
} |
940 |
|
return false; |
941 |
|
} |
942 |
|
|
943 |
|
|
944 |
|
/** |
945 |
|
* CONDITION - can_display_notification_tiers |
946 |
|
* |
947 |
|
* Vérifie que le champs "suivi_notification_tiers" est affichable |
948 |
|
* |
949 |
|
* @return boolean |
950 |
|
*/ |
951 |
|
function can_display_notification_tiers() { |
952 |
|
// Le suivi des notification est affiché si l'événement est notifiable |
953 |
|
// et si des notifications ont été envoyées |
954 |
|
$evenement_id = $this->getVal("evenement"); |
955 |
|
$inst_evenement = $this->get_inst_evenement($evenement_id); |
956 |
|
if ($this->get_boolean_from_pgsql_value($inst_evenement->getVal('notification_tiers')) == true) { |
957 |
|
// Des notifications ont été envoyé si il existe au moins une notification |
958 |
|
// de type notification_tiers_consulte liées à l'instruction |
959 |
|
$idsNotifs = $this->get_instruction_notification( |
960 |
|
$this->getVal($this->clePrimaire), |
961 |
|
'notification_tiers_consulte' |
962 |
|
); |
963 |
|
if (isset($idsNotifs) && $idsNotifs !== array()) { |
964 |
|
return true; |
965 |
|
} |
966 |
|
} |
967 |
|
return false; |
968 |
|
} |
969 |
|
|
970 |
|
/** |
971 |
|
* TREATMENT - disable_edition_integrale. |
972 |
|
* |
973 |
|
* Cette methode permet de passer la consultation en "lu" |
974 |
|
* |
975 |
|
* @return boolean true si maj effectué false sinon |
976 |
|
*/ |
977 |
|
function disable_edition_integrale() { |
978 |
|
// Cette méthode permet d'exécuter une routine en début des méthodes |
979 |
|
// dites de TREATMENT. |
980 |
|
$this->begin_treatment(__METHOD__); |
981 |
|
$this->correct = true; |
982 |
|
$valF = array( |
983 |
|
"flag_edition_integrale" => false, |
984 |
|
"titre_om_htmletat" => null, |
985 |
|
"corps_om_htmletatex" => null, |
986 |
|
); |
987 |
|
$res = $this->f->db->autoExecute( |
988 |
|
DB_PREFIXE.$this->table, |
989 |
|
$valF, |
990 |
|
DB_AUTOQUERY_UPDATE, |
991 |
|
$this->clePrimaire."=".$this->getVal($this->clePrimaire) |
992 |
|
); |
993 |
|
if ($this->f->isDatabaseError($res, true)) { |
994 |
|
// Appel de la methode de recuperation des erreurs |
995 |
|
$this->erreur_db($res->getDebugInfo(), $res->getMessage(), ''); |
996 |
|
$this->correct = false; |
997 |
|
// Termine le traitement |
998 |
|
return $this->end_treatment(__METHOD__, false); |
999 |
|
} else { |
1000 |
|
$this->addToMessage(_("Rédaction par compléments activé.")); |
1001 |
|
return $this->end_treatment(__METHOD__, true); |
1002 |
|
} |
1003 |
|
|
1004 |
|
// Termine le traitement |
1005 |
|
return $this->end_treatment(__METHOD__, false); |
1006 |
|
} |
1007 |
|
|
1008 |
|
/** |
1009 |
|
* TREATMENT - enable_edition_integrale. |
1010 |
|
* |
1011 |
|
* Cette methode permet de passer la consultation en "lu" |
1012 |
|
* |
1013 |
|
* @return boolean true si maj effectué false sinon |
1014 |
|
*/ |
1015 |
|
function enable_edition_integrale() { |
1016 |
|
// Cette méthode permet d'exécuter une routine en début des méthodes |
1017 |
|
// dites de TREATMENT. |
1018 |
|
$this->begin_treatment(__METHOD__); |
1019 |
|
$this->correct = true; |
1020 |
|
|
1021 |
|
// Récupère la collectivite du dossier d'instruction |
1022 |
|
$dossier_instruction_om_collectivite = $this->get_dossier_instruction_om_collectivite(); |
1023 |
|
$collectivite = $this->f->getCollectivite($dossier_instruction_om_collectivite); |
1024 |
|
// |
1025 |
|
$params = array( |
1026 |
|
"specific" => array( |
1027 |
|
"corps" => array( |
1028 |
|
"mode" => "get", |
1029 |
|
) |
1030 |
|
), |
1031 |
|
); |
1032 |
|
$result = $this->compute_pdf_output('lettretype', $this->getVal('lettretype'), $collectivite, null, $params); |
1033 |
|
$corps = $result['pdf_output']; |
1034 |
|
// |
1035 |
|
$params = array( |
1036 |
|
"specific" => array( |
1037 |
|
"titre" => array( |
1038 |
|
"mode" => "get", |
1039 |
|
) |
1040 |
|
), |
1041 |
|
); |
1042 |
|
$result = $this->compute_pdf_output('lettretype', $this->getVal('lettretype'), $collectivite, null, $params); |
1043 |
|
$titre = $result['pdf_output']; |
1044 |
|
// |
1045 |
|
$valF = array( |
1046 |
|
"flag_edition_integrale" => true, |
1047 |
|
"titre_om_htmletat" => $titre, |
1048 |
|
"corps_om_htmletatex" => $corps, |
1049 |
|
); |
1050 |
|
$res = $this->f->db->autoExecute( |
1051 |
|
DB_PREFIXE.$this->table, |
1052 |
|
$valF, |
1053 |
|
DB_AUTOQUERY_UPDATE, |
1054 |
|
$this->clePrimaire."=".$this->getVal($this->clePrimaire) |
1055 |
|
); |
1056 |
|
if ($this->f->isDatabaseError($res, true)) { |
1057 |
|
// Appel de la methode de recuperation des erreurs |
1058 |
|
$this->erreur_db($res->getDebugInfo(), $res->getMessage(), ''); |
1059 |
|
$this->correct = false; |
1060 |
|
// Termine le traitement |
1061 |
|
return $this->end_treatment(__METHOD__, false); |
1062 |
|
} else { |
1063 |
|
$this->addToMessage(_("Rédaction libre activé.")); |
1064 |
|
return $this->end_treatment(__METHOD__, true); |
1065 |
|
} |
1066 |
|
|
1067 |
|
// Termine le traitement |
1068 |
|
return $this->end_treatment(__METHOD__, false); |
1069 |
|
} |
1070 |
|
|
1071 |
/** |
/** |
1072 |
* 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 |
1080 |
$sql = "select dossier_autorisation from ".DB_PREFIXE."dossier "; |
$sql = "select dossier_autorisation from ".DB_PREFIXE."dossier "; |
1081 |
$sql .= " where dossier='".$id."'"; |
$sql .= " where dossier='".$id."'"; |
1082 |
// |
// |
1083 |
$dossier_autorisation = $this->db->getOne($sql); |
$dossier_autorisation = $this->f->db->getOne($sql); |
1084 |
$this->addToLog("getNumDemandeAutorFromDossier(): db->getone(\"".$sql."\")", VERBOSE_MODE); |
$this->addToLog("getNumDemandeAutorFromDossier(): db->getone(\"".$sql."\")", VERBOSE_MODE); |
1085 |
database::isError($dossier_autorisation); |
database::isError($dossier_autorisation); |
1086 |
// |
// |
1090 |
// }}} |
// }}} |
1091 |
|
|
1092 |
function setType(&$form, $maj) { |
function setType(&$form, $maj) { |
1093 |
// |
// Récupération du mode de l'action |
1094 |
parent::setType($form, $maj); |
$crud = $this->get_action_crud($maj); |
1095 |
// On cache tous les champs |
// Récupère la collectivité du dossier d'instruction |
1096 |
// XXX |
$collectivite_di = $this->get_dossier_instruction_om_collectivite(); |
|
$form->setType('complement5_om_html', 'hidden'); |
|
|
$form->setType('bible5', 'hidden'); |
|
|
$form->setType('complement6_om_html', 'hidden'); |
|
|
$form->setType('bible6', 'hidden'); |
|
|
$form->setType('complement7_om_html', 'hidden'); |
|
|
$form->setType('bible7', 'hidden'); |
|
|
$form->setType('complement8_om_html', 'hidden'); |
|
|
$form->setType('bible8', 'hidden'); |
|
|
$form->setType('complement9_om_html', 'hidden'); |
|
|
$form->setType('bible9', 'hidden'); |
|
|
$form->setType('complement10_om_html', 'hidden'); |
|
|
$form->setType('bible10', 'hidden'); |
|
|
$form->setType('complement11_om_html', 'hidden'); |
|
|
$form->setType('bible11', 'hidden'); |
|
|
$form->setType('complement12_om_html', 'hidden'); |
|
|
$form->setType('bible12', 'hidden'); |
|
|
$form->setType('complement13_om_html', 'hidden'); |
|
|
$form->setType('bible13', 'hidden'); |
|
|
$form->setType('complement14_om_html', 'hidden'); |
|
|
$form->setType('bible14', 'hidden'); |
|
|
$form->setType('complement15_om_html', 'hidden'); |
|
|
$form->setType('bible15', 'hidden'); |
|
|
// |
|
|
$form->setType('delai', 'hidden'); |
|
|
$form->setType('etat', 'hidden'); |
|
|
$form->setType('accord_tacite', 'hidden'); |
|
|
$form->setType('action', 'hidden'); |
|
|
$form->setType('delai_notification', 'hidden'); |
|
|
$form->setType('avis_decision', 'hidden'); |
|
|
$form->setType('autorite_competente', 'hidden'); |
|
|
// |
|
|
$form->setType('archive_delai', 'hidden'); |
|
|
$form->setType('archive_etat', 'hidden'); |
|
|
$form->setType('archive_accord_tacite', 'hidden'); |
|
|
$form->setType('archive_avis', 'hidden'); |
|
|
$form->setType('archive_date_complet', 'hiddendate'); |
|
|
$form->setType('archive_date_dernier_depot', 'hiddendate'); |
|
|
$form->setType('archive_date_rejet', 'hiddendate'); |
|
|
$form->setType('archive_date_limite', 'hiddendate'); |
|
|
$form->setType('archive_date_notification_delai', 'hiddendate'); |
|
|
$form->setType('archive_date_decision', 'hiddendate'); |
|
|
$form->setType('archive_date_validite', 'hiddendate'); |
|
|
$form->setType('archive_date_achevement', 'hiddendate'); |
|
|
$form->setType('archive_date_conformite', 'hiddendate'); |
|
|
$form->setType('archive_date_chantier', 'hiddendate'); |
|
|
$form->setType('archive_autorite_competente','hidden'); |
|
|
$form->setType('date_depot','hidden'); |
|
|
// |
|
|
$form->setType('numero_arrete', 'hidden'); |
|
|
// |
|
|
$form->setType('code_barres', 'hidden'); |
|
|
|
|
|
// |
|
|
$form->setType('archive_incompletude','hidden'); |
|
|
$form->setType('archive_incomplet_notifie','hidden'); |
|
|
$form->setType('archive_evenement_suivant_tacite','hidden'); |
|
|
$form->setType('archive_evenement_suivant_tacite_incompletude','hidden'); |
|
|
$form->setType('archive_etat_pendant_incompletude','hidden'); |
|
|
$form->setType('archive_date_limite_incompletude','hiddendate'); |
|
|
$form->setType('archive_delai_incompletude','hidden'); |
|
1097 |
|
|
1098 |
// |
// Cache tous les champs |
1099 |
$form->setType('archive_date_cloture_instruction','hidden'); |
foreach ($this->champs as $value) { |
1100 |
$form->setType('archive_date_premiere_visite','hidden'); |
$form->setType($value, 'hidden'); |
1101 |
$form->setType('archive_date_derniere_visite','hidden'); |
} |
|
$form->setType('archive_date_contradictoire','hidden'); |
|
|
$form->setType('archive_date_retour_contradictoire','hidden'); |
|
|
$form->setType('archive_date_ait','hiddendate'); |
|
|
$form->setType('archive_date_transmission_parquet','hidden'); |
|
1102 |
|
|
1103 |
// |
// Les champs historique_signature et statut_signature ne sont pas saisissable dans tous les cas |
1104 |
$form->setType('duree_validite','hidden'); |
if ($this->can_display_parapheur() === true && $maj == 3) { |
1105 |
$form->setType('duree_validite_parametrage','hidden'); |
$form->setType('statut_signature', 'selectstatic'); |
1106 |
|
$form->setType('historique_signature', 'jsontotab'); |
1107 |
|
if ($this->getVal('commentaire_signature') == null) { |
1108 |
|
$form->setType('commentaire_signature', 'hidden'); |
1109 |
|
} else { |
1110 |
|
$form->setType('commentaire_signature', 'hiddenstatic'); |
1111 |
|
} |
1112 |
|
} |
1113 |
|
|
1114 |
// |
// Le champ de suivi des notifications des demandeurs n'est pas affichable dans tous les cas |
1115 |
$form->setType('created_by_commune','hidden'); |
if ($this->can_display_notification_demandeur() === true && $maj == 3) { |
1116 |
// |
$form->setType('suivi_notification', 'jsontotab'); |
1117 |
// gestion du champ "finalisé par" |
} |
1118 |
if ($this->getVal("om_final_instruction") == 't') { |
// Le champ de suivi des notifications des services n'est pas affichable dans tous les cas |
1119 |
$form->setType('om_final_instruction_utilisateur', 'static'); |
if ($this->can_display_notification_service() === true && $maj == 3) { |
1120 |
} else { |
$form->setType('suivi_notification_service', 'jsontotab'); |
1121 |
$form->setType('om_final_instruction_utilisateur', 'hidden'); |
} |
1122 |
|
// Le champ de suivi des notifications des tiers n'est pas affichable dans tous les cas |
1123 |
|
if ($this->can_display_notification_tiers() === true && $maj == 3) { |
1124 |
|
$form->setType('suivi_notification_tiers', 'jsontotab'); |
1125 |
} |
} |
|
// |
|
|
if ($maj < 2 || $maj == 125) { //ajouter, modifier et suivi des dates |
|
|
$form->setType('destinataire', 'hidden'); |
|
|
$form->setType('lettretype', 'hiddenstatic'); |
|
|
$form->setType('complement_om_html', 'html'); |
|
|
$form->setType('complement2_om_html', 'html'); |
|
|
$form->setType('complement3_om_html', 'html'); |
|
|
$form->setType('complement4_om_html', 'html'); |
|
|
$form->setType('bible_auto', 'httpclick'); |
|
|
$form->setType('bible', 'httpclick'); |
|
|
$form->setType('bible2', 'httpclick'); |
|
|
$form->setType('bible3', 'httpclick'); |
|
|
$form->setType('bible4', 'httpclick'); |
|
|
$form->setType('btn_refresh', 'hidden'); |
|
|
$form->setType('live_preview', 'hidden'); |
|
|
$form->setType('dossier', 'hidden'); |
|
|
$form->setType('libelle', 'hiddenstatic'); |
|
|
$form->setType('signataire_arrete','select'); |
|
|
$form->setType('date_envoi_signature','datedisabled'); |
|
|
$form->setType('date_retour_signature','datedisabled'); |
|
|
$form->setType('date_envoi_rar','datedisabled'); |
|
|
$form->setType('date_retour_rar','datedisabled'); |
|
|
$form->setType('date_envoi_controle_legalite','datedisabled'); |
|
|
$form->setType('date_retour_controle_legalite','datedisabled'); |
|
|
$form->setType('date_finalisation_courrier','datedisabled'); |
|
|
|
|
|
if($maj==0){ // ajouter |
|
|
$form->setType('instruction', 'hidden'); |
|
|
$form->setType('lettretype', 'hidden'); |
|
|
$form->setType('evenement', 'select'); |
|
|
$form->setType('date_evenement', 'date2'); |
|
|
}else{ // modifier et suivi des dates |
|
|
$form->setType('instruction', 'hiddenstatic'); |
|
|
$form->setType('evenement', 'selecthiddenstatic'); |
|
|
//$form->setType('date_evenement', 'hiddenstaticdate'); |
|
|
$form->setType('date_evenement', 'date2'); |
|
1126 |
|
|
1127 |
// Récupère la collectivité du dossier d'instruction |
// MODE AJOUTER |
1128 |
$collectivite_di = $this->get_dossier_instruction_om_collectivite(); |
if ($this->getParameter('maj') == 0) { |
1129 |
|
$form->setType('commentaire', 'textareahidden'); |
1130 |
|
// Si l'option est active passage du champ date en lecture seule |
1131 |
|
if ($this->f->is_option_date_evenement_instruction_lecture_seule($collectivite_di) === true) { |
1132 |
|
$form->setType("date_evenement", "hiddenstaticdate"); |
1133 |
|
} else { |
1134 |
|
$form->setType("date_evenement", "date"); |
1135 |
|
} |
1136 |
|
if ($this->is_in_context_of_foreign_key("evenement", $this->getParameter("retourformulaire"))) { |
1137 |
|
$form->setType("evenement", "selecthiddenstatic"); |
1138 |
|
} else { |
1139 |
|
$form->setType("evenement", "select"); |
1140 |
|
} |
1141 |
|
if ($this->is_in_context_of_foreign_key("signataire_arrete", $this->getParameter("retourformulaire"))) { |
1142 |
|
$form->setType("signataire_arrete", "selecthiddenstatic"); |
1143 |
|
} else { |
1144 |
|
$form->setType("signataire_arrete", "select"); |
1145 |
|
} |
1146 |
|
if ($this->is_option_redaction_libre_enabled() === true) { |
1147 |
|
$form->setType("flag_edition_integrale", "select"); |
1148 |
|
} |
1149 |
|
} |
1150 |
|
|
1151 |
// |
// MODE MODIFIER |
1152 |
if ($this->f->is_option_preview_pdf_enabled($collectivite_di) === true |
if ($this->getParameter('maj') == 1) { |
1153 |
&& $this->has_an_edition() === true) { |
// Si l'option est active passage du champ date en lecture seule |
1154 |
$form->setType('btn_refresh', 'httpclick'); |
if ($this->f->is_option_date_evenement_instruction_lecture_seule($collectivite_di) === true) { |
1155 |
$form->setType('live_preview', 'pdf'); |
$form->setType("date_evenement", "hiddenstaticdate"); |
1156 |
|
} else { |
1157 |
|
$form->setType("date_evenement", "date"); |
1158 |
|
} |
1159 |
|
$form->setType("evenement", "selecthiddenstatic"); |
1160 |
|
if ($this->has_an_edition() === true) { |
1161 |
|
$form->setType('lettretype', 'hiddenstatic'); |
1162 |
|
if ($this->is_in_context_of_foreign_key("signataire_arrete", $this->getParameter("retourformulaire"))) { |
1163 |
|
$form->setType("signataire_arrete", "selecthiddenstatic"); |
1164 |
|
} else { |
1165 |
|
$form->setType("signataire_arrete", "select"); |
1166 |
|
} |
1167 |
|
if ($this->getVal("flag_edition_integrale") == "t") { |
1168 |
|
$form->setType("titre_om_htmletat", "htmlEtat"); |
1169 |
|
$form->setType("corps_om_htmletatex", "htmlEtatEx"); |
1170 |
|
} else { |
1171 |
|
$form->setType("complement_om_html", "html"); |
1172 |
|
$form->setType("complement2_om_html", "html"); |
1173 |
|
$form->setType("complement3_om_html", "html"); |
1174 |
|
$form->setType("complement4_om_html", "html"); |
1175 |
|
$form->setType('bible_auto', 'httpclick'); |
1176 |
|
$form->setType('bible', 'httpclick'); |
1177 |
|
$form->setType('bible2', 'httpclick'); |
1178 |
|
$form->setType('bible3', 'httpclick'); |
1179 |
|
$form->setType('bible4', 'httpclick'); |
1180 |
|
} |
1181 |
|
if ($this->f->is_option_preview_pdf_enabled($collectivite_di) === true) { |
1182 |
|
// |
1183 |
|
$form->setType('btn_refresh', 'httpclickbutton'); |
1184 |
|
$form->setType('btn_preview', 'httpclickbutton'); |
1185 |
|
$form->setType('btn_redaction', 'httpclickbutton'); |
1186 |
|
$form->setType('live_preview', 'previsualiser_pdf'); |
1187 |
} |
} |
1188 |
|
|
1189 |
// necessaire pour calcul de date en modification |
// necessaire pour calcul de date en modification |
1190 |
//$form->setType('delai', 'hiddenstatic'); |
//$form->setType('delai', 'hiddenstatic'); |
1191 |
// les administrateurs technique et fonctionnel peuvent |
// les administrateurs technique et fonctionnel peuvent |
1192 |
// modifier tous les champs de date |
// modifier tous les champs de date |
1193 |
// 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 |
1194 |
if (($this->f->isAccredited(array(get_class($this), get_class($this)."modification_dates"), "OR") |
if (($this->f->isAccredited(array($this->get_absolute_class_name(), $this->get_absolute_class_name()."modification_dates"), "OR") |
1195 |
|| $this->f->isAccredited(array('instruction', 'instruction_modification_dates'), "OR")) |
|| $this->f->isAccredited(array('instruction', 'instruction_modification_dates'), "OR")) |
1196 |
&& $this->getVal("date_finalisation_courrier") != '') { |
&& $this->getVal("date_finalisation_courrier") != '') { |
1197 |
|
// |
1198 |
$form->setType('date_envoi_signature', 'date'); |
$form->setType('date_envoi_signature', 'date'); |
1199 |
$form->setType('date_retour_signature', 'date'); |
$form->setType('date_retour_signature', 'date'); |
1200 |
|
if ($this->is_sent_for_signature() === true |
1201 |
|
&& $this->is_signed() === true) { |
1202 |
|
// |
1203 |
|
$form->setType("date_envoi_signature", "datereadonly"); |
1204 |
|
$form->setType("date_retour_signature", "datereadonly"); |
1205 |
|
} |
1206 |
$form->setType('date_envoi_rar', 'date'); |
$form->setType('date_envoi_rar', 'date'); |
1207 |
$form->setType('date_retour_rar', 'date'); |
$form->setType('date_retour_rar', 'date'); |
1208 |
$form->setType('date_envoi_controle_legalite', 'date'); |
$form->setType('date_envoi_controle_legalite', 'date'); |
1209 |
|
if ($this->is_sent_to_cl() === true) { |
1210 |
|
$form->setType("date_envoi_controle_legalite", "datereadonly"); |
1211 |
|
} |
1212 |
$form->setType('date_retour_controle_legalite', 'date'); |
$form->setType('date_retour_controle_legalite', 'date'); |
1213 |
$form->setType('date_finalisation_courrier', 'date'); |
$form->setType('date_finalisation_courrier', 'date'); |
|
// suivi des dates |
|
|
if ($maj == 125) { |
|
|
$form->setType('date_evenement', 'hiddenstaticdate'); |
|
|
$form->setType('complement_om_html', 'hiddenstatic'); |
|
|
$form->setType('complement2_om_html', 'hiddenstatic'); |
|
|
$form->setType('complement3_om_html', 'hiddenstatic'); |
|
|
$form->setType('complement4_om_html', 'hiddenstatic'); |
|
|
$form->setType('bible_auto', 'hidden'); |
|
|
$form->setType('bible', 'hidden'); |
|
|
$form->setType('bible2', 'hidden'); |
|
|
$form->setType('bible3', 'hidden'); |
|
|
$form->setType('bible4', 'hidden'); |
|
|
$form->setType('live_preview', 'hidden'); |
|
|
$form->setType('signataire_arrete','selecthiddenstatic'); |
|
|
$form->setType('om_final_instruction_utilisateur', 'hiddenstatic'); |
|
|
} |
|
1214 |
} |
} |
1215 |
} |
} |
|
} elseif($maj==2){ |
|
|
$form->setType('dossier', 'hidden'); |
|
|
$form->setType('bible_auto', 'hidden'); |
|
|
$form->setType('bible', 'hidden'); |
|
|
$form->setType('bible2', 'hidden'); |
|
|
$form->setType('bible3', 'hidden'); |
|
|
$form->setType('bible4', 'hidden'); |
|
|
$form->setType('btn_refresh', 'hidden'); |
|
|
$form->setType('live_preview', 'hidden'); |
|
|
}else { |
|
|
$form->setType('destinataire', 'hidden'); |
|
|
$form->setType('dossier', 'hidden'); |
|
|
$form->setType('bible_auto', 'hidden'); |
|
|
$form->setType('bible', 'hidden'); |
|
|
$form->setType('bible2', 'hidden'); |
|
|
$form->setType('bible3', 'hidden'); |
|
|
$form->setType('bible4', 'hidden'); |
|
|
$form->setType('btn_refresh', 'hidden'); |
|
|
$form->setType('live_preview', 'hidden'); |
|
|
} |
|
|
|
|
|
//Cache les champs pour la finalisation |
|
|
$form->setType('om_fichier_instruction', 'hidden'); |
|
|
$form->setType('om_final_instruction', 'hidden'); |
|
|
// Cache le document arrêté |
|
|
$form->setType('document_numerise', 'hidden'); |
|
|
|
|
|
//Masquer les champs date_envoi_controle_legalite et |
|
|
//date_retour_controle_legalite si ce n'est pas un arrêté et si ce n'est |
|
|
//pas un utilisateur ayant le droit spécifique |
|
|
if ( !is_numeric($this->getVal("avis_decision"))&& |
|
|
!$this->f->isAccredited(array("instruction", "instruction_modification_dates"), "OR")){ |
|
|
|
|
|
$form->setType("date_envoi_controle_legalite", "hiddendate"); |
|
|
$form->setType("date_retour_controle_legalite", "hiddendate"); |
|
1216 |
} |
} |
1217 |
|
|
1218 |
// Pour les actions finalize, unfinalize et notifier_commune |
// MODE CONSULTER + SUPPRIMER + SUIVI DES DATES 125 + NOTIFICATION MANUELLE |
1219 |
if($maj == 100 || $maj == 110 || $maj == 210) { |
if ($this->getParameter('maj') == 3 |
1220 |
// |
|| $this->getParameter('maj') == 2 |
1221 |
foreach ($this->champs as $value) { |
|| $this->getParameter('maj') == 125 |
1222 |
// Cache tous les champs |
|| $this->getParameter('maj') == 410) { |
1223 |
$form->setType($value, 'hidden'); |
// |
1224 |
|
$form->setType("date_evenement", "datestatic"); |
1225 |
|
$form->setType("evenement", "selecthiddenstatic"); |
1226 |
|
if ($this->has_an_edition() === true) { |
1227 |
|
$form->setType('lettretype', 'hiddenstatic'); |
1228 |
|
$form->setType("signataire_arrete", "selecthiddenstatic"); |
1229 |
|
if ($this->getVal("om_final_instruction") == 't') { |
1230 |
|
$form->setType('om_final_instruction_utilisateur', 'textareastatic'); |
1231 |
|
} else { |
1232 |
|
$form->setType('om_final_instruction_utilisateur', 'hidden'); |
1233 |
|
} |
1234 |
|
} |
1235 |
|
if ($this->evenement_has_a_commentaire($this->getVal('evenement')) === true ) { |
1236 |
|
$form->setType('commentaire', 'textareastatic'); |
1237 |
|
} |
1238 |
|
} |
1239 |
|
|
1240 |
|
// MODE CONSULTER + SUPPRIMER + NOTIFICATION MANUELLE |
1241 |
|
if ($this->getParameter('maj') == 3 |
1242 |
|
|| $this->getParameter('maj') == 2 |
1243 |
|
|| $this->getParameter('maj') == 410) { |
1244 |
|
// Si il n'y a pas de lettre type (edition) associé à l'événement |
1245 |
|
// les dates de suivi ne sont pas affichée |
1246 |
|
if ($this->has_an_edition() === true) { |
1247 |
|
$form->setType('date_envoi_signature', 'datestatic'); |
1248 |
|
$form->setType('date_retour_signature', 'datestatic'); |
1249 |
|
$form->setType('date_envoi_rar', 'datestatic'); |
1250 |
|
$form->setType('date_retour_rar', 'datestatic'); |
1251 |
|
$form->setType('date_envoi_controle_legalite', 'datestatic'); |
1252 |
|
$form->setType('date_retour_controle_legalite', 'datestatic'); |
1253 |
|
$form->setType('date_finalisation_courrier', 'datestatic'); |
1254 |
|
if ($this->getVal("flag_edition_integrale") == "t") { |
1255 |
|
$form->setType("titre_om_htmletat", "htmlstatic"); |
1256 |
|
$form->setType("corps_om_htmletatex", "htmlstatic"); |
1257 |
|
} else { |
1258 |
|
$form->setType("complement_om_html", "htmlstatic"); |
1259 |
|
$form->setType("complement2_om_html", "htmlstatic"); |
1260 |
|
$form->setType("complement3_om_html", "htmlstatic"); |
1261 |
|
$form->setType("complement4_om_html", "htmlstatic"); |
1262 |
|
} |
1263 |
|
} |
1264 |
|
} |
1265 |
|
|
1266 |
|
// MODE SUIVI DES DATES 125 |
1267 |
|
if ($this->getParameter('maj') == 125) { |
1268 |
|
$form->setType("date_evenement", "hiddenstaticdate"); |
1269 |
|
$form->setType('om_final_instruction_utilisateur', 'hiddenstatic'); |
1270 |
|
$form->setType('date_envoi_signature', 'date'); |
1271 |
|
$form->setType('date_retour_signature', 'date'); |
1272 |
|
if ($this->is_sent_for_signature() === true |
1273 |
|
|| $this->is_signed() === true) { |
1274 |
|
// |
1275 |
|
$form->setType("date_envoi_signature", "datereadonly"); |
1276 |
|
$form->setType("date_retour_signature", "datereadonly"); |
1277 |
|
} |
1278 |
|
$form->setType('date_envoi_rar', 'date'); |
1279 |
|
$form->setType('date_retour_rar', 'date'); |
1280 |
|
$form->setType('date_envoi_controle_legalite', 'date'); |
1281 |
|
if ($this->is_sent_to_cl() === true) { |
1282 |
|
$form->setType("date_envoi_controle_legalite", "datereadonly"); |
1283 |
|
} |
1284 |
|
$form->setType('date_retour_controle_legalite', 'date'); |
1285 |
|
$form->setType('date_finalisation_courrier', 'date'); |
1286 |
|
} |
1287 |
|
|
1288 |
|
if ($maj == 401) { |
1289 |
|
foreach ($this->champs as $champ) { |
1290 |
|
$form->setType($champ, 'hidden'); |
1291 |
|
} |
1292 |
|
$form->setType('preview_edition', 'previsualiser'); |
1293 |
|
} |
1294 |
|
} |
1295 |
|
|
1296 |
|
function setOnchange(&$form,$maj){ |
1297 |
|
parent::setOnchange($form,$maj); |
1298 |
|
|
1299 |
|
// MODE AJOUTER |
1300 |
|
if ($this->getParameter('maj') == 0) { |
1301 |
|
$form->setOnchange( |
1302 |
|
"evenement", |
1303 |
|
"manage_instruction_evenement_lettretype(this.value, '".addslashes($this->getParameter('idxformulaire'))."'); |
1304 |
|
manage_instruction_evenement_commentaire(this.value, '".addslashes($this->getParameter('idxformulaire'))."');" |
1305 |
|
); |
1306 |
|
} |
1307 |
|
} |
1308 |
|
|
1309 |
|
function evenement_has_an_edition($evenement_id) { |
1310 |
|
$evenement = $this->get_inst_evenement($evenement_id); |
1311 |
|
$lettretype = $evenement->getVal('lettretype'); |
1312 |
|
if ($lettretype !== '' && $lettretype !== null) { |
1313 |
|
return true; |
1314 |
|
} |
1315 |
|
return false; |
1316 |
|
} |
1317 |
|
|
1318 |
|
function view_evenement_has_an_edition_json() { |
1319 |
|
$json_return = array( |
1320 |
|
"lettretype" => $this->evenement_has_an_edition($this->f->get_submitted_get_value('evenement_id')), |
1321 |
|
"option_redaction_libre_enabled" => $this->is_option_redaction_libre_enabled(), |
1322 |
|
); |
1323 |
|
echo json_encode($json_return); |
1324 |
|
} |
1325 |
|
|
1326 |
|
function evenement_has_a_commentaire($evenement_id) { |
1327 |
|
$evenement = $this->get_inst_evenement($evenement_id); |
1328 |
|
return $this->get_boolean_from_pgsql_value($evenement->getVal('commentaire')); |
1329 |
|
} |
1330 |
|
|
1331 |
|
function view_evenement_has_a_commentaire_json() { |
1332 |
|
$json_return = array( |
1333 |
|
"commentaire" => $this->evenement_has_a_commentaire($this->f->get_submitted_get_value('evenement_id')) |
1334 |
|
); |
1335 |
|
echo json_encode($json_return); |
1336 |
|
} |
1337 |
|
|
1338 |
|
|
1339 |
|
/** |
1340 |
|
* CONDITION - can_be_sended_to_cl |
1341 |
|
* |
1342 |
|
* Vérifie que le contrôle de légalité est disponible |
1343 |
|
* |
1344 |
|
* @return boolean |
1345 |
|
*/ |
1346 |
|
function can_be_sended_to_cl() { |
1347 |
|
// Si l'instruction a une édition |
1348 |
|
// et que l'événement est paramétré pour envoyer le contrôle de légalité |
1349 |
|
// par Plat'AU |
1350 |
|
// et que la date de retour signature est renseignée |
1351 |
|
// et que la date d'envoi au contrôle légalité n'est pas renseignée |
1352 |
|
// et qu'il n'existe pas de task envoi_CL en cours (!= done ou canceled) |
1353 |
|
if ($this->has_an_edition() === true) { |
1354 |
|
$inst_di = $this->get_inst_dossier($this->getVal('dossier')); |
1355 |
|
$inst_evenement = $this->get_inst_evenement($this->getVal('evenement')); |
1356 |
|
if ($inst_evenement->getVal('envoi_cl_platau') === 't' |
1357 |
|
&& empty($this->getVal('date_retour_signature')) === false |
1358 |
|
&& empty($this->getVal('date_envoi_controle_legalite')) === true |
1359 |
|
&& $this->getVal('envoye_cl_platau') === 'f' |
1360 |
|
&& $this->f->is_type_dossier_platau($inst_di->getVal('dossier_autorisation')) === true |
1361 |
|
&& $inst_di->getVal('etat_transmission_platau') !== 'jamais_transmissible') { |
1362 |
|
// |
1363 |
|
return true; |
1364 |
} |
} |
1365 |
} |
} |
1366 |
|
// |
1367 |
|
return false; |
1368 |
|
} |
1369 |
|
|
1370 |
|
/** |
1371 |
|
* |
1372 |
|
* @return string |
1373 |
|
*/ |
1374 |
|
function get_var_sql_forminc__sql_signataire_arrete() { |
1375 |
|
return sprintf( |
1376 |
|
"SELECT |
1377 |
|
signataire_arrete.signataire_arrete, |
1378 |
|
CONCAT_WS( |
1379 |
|
' - ', |
1380 |
|
CONCAT_WS(' ', signataire_arrete.prenom, signataire_arrete.nom), |
1381 |
|
signataire_habilitation.libelle, |
1382 |
|
signataire_arrete.description |
1383 |
|
) |
1384 |
|
FROM |
1385 |
|
%1\$ssignataire_arrete |
1386 |
|
LEFT JOIN %1\$ssignataire_habilitation |
1387 |
|
ON signataire_arrete.signataire_habilitation = signataire_habilitation.signataire_habilitation |
1388 |
|
WHERE |
1389 |
|
((signataire_arrete.om_validite_debut IS NULL |
1390 |
|
AND (signataire_arrete.om_validite_fin IS NULL |
1391 |
|
OR signataire_arrete.om_validite_fin > CURRENT_DATE)) |
1392 |
|
OR (signataire_arrete.om_validite_debut <= CURRENT_DATE |
1393 |
|
AND (signataire_arrete.om_validite_fin IS NULL |
1394 |
|
OR signataire_arrete.om_validite_fin > CURRENT_DATE))) |
1395 |
|
ORDER BY |
1396 |
|
signataire_arrete.prenom, |
1397 |
|
signataire_arrete.nom", |
1398 |
|
DB_PREFIXE |
1399 |
|
); |
1400 |
|
} |
1401 |
|
|
1402 |
|
/** |
1403 |
|
* |
1404 |
|
* @return string |
1405 |
|
*/ |
1406 |
|
function get_var_sql_forminc__sql_signataire_arrete_by_id() { |
1407 |
|
return sprintf( |
1408 |
|
"SELECT |
1409 |
|
signataire_arrete.signataire_arrete, |
1410 |
|
CONCAT_WS( |
1411 |
|
' - ', |
1412 |
|
CONCAT_WS(' ', signataire_arrete.prenom, signataire_arrete.nom), |
1413 |
|
signataire_habilitation.libelle, |
1414 |
|
signataire_arrete.description |
1415 |
|
) |
1416 |
|
FROM |
1417 |
|
%1\$ssignataire_arrete |
1418 |
|
LEFT JOIN %1\$ssignataire_habilitation |
1419 |
|
ON signataire_arrete.signataire_habilitation = signataire_habilitation.signataire_habilitation |
1420 |
|
WHERE |
1421 |
|
signataire_arrete.signataire_arrete = <idx>", |
1422 |
|
DB_PREFIXE |
1423 |
|
); |
1424 |
|
} |
1425 |
|
|
1426 |
|
/** |
1427 |
|
* |
1428 |
|
* @return string |
1429 |
|
*/ |
1430 |
|
function get_var_sql_forminc__sql_signataire_arrete_by_di() { |
1431 |
|
return sprintf( |
1432 |
|
"SELECT |
1433 |
|
signataire_arrete.signataire_arrete, |
1434 |
|
CONCAT_WS( |
1435 |
|
' - ', |
1436 |
|
CONCAT_WS(' ', signataire_arrete.prenom, signataire_arrete.nom), |
1437 |
|
signataire_habilitation.libelle, |
1438 |
|
signataire_arrete.description |
1439 |
|
) |
1440 |
|
FROM |
1441 |
|
%1\$ssignataire_arrete |
1442 |
|
LEFT JOIN %1\$som_collectivite |
1443 |
|
ON signataire_arrete.om_collectivite = om_collectivite.om_collectivite |
1444 |
|
LEFT JOIN %1\$ssignataire_habilitation |
1445 |
|
ON signataire_arrete.signataire_habilitation = signataire_habilitation.signataire_habilitation |
1446 |
|
WHERE |
1447 |
|
((signataire_arrete.om_validite_debut IS NULL |
1448 |
|
AND (signataire_arrete.om_validite_fin IS NULL |
1449 |
|
OR signataire_arrete.om_validite_fin > CURRENT_DATE)) |
1450 |
|
OR (signataire_arrete.om_validite_debut <= CURRENT_DATE |
1451 |
|
AND (signataire_arrete.om_validite_fin IS NULL |
1452 |
|
OR signataire_arrete.om_validite_fin > CURRENT_DATE))) |
1453 |
|
AND (om_collectivite.niveau = '2' |
1454 |
|
OR signataire_arrete.om_collectivite = <collectivite_di>) |
1455 |
|
ORDER BY |
1456 |
|
signataire_arrete.prenom, signataire_arrete.nom", |
1457 |
|
DB_PREFIXE |
1458 |
|
); |
1459 |
|
} |
1460 |
|
|
1461 |
|
/** |
1462 |
|
* |
1463 |
|
* @return string |
1464 |
|
*/ |
1465 |
|
function get_var_sql_forminc__sql_signataire_arrete_defaut() { |
1466 |
|
return sprintf( |
1467 |
|
"SELECT |
1468 |
|
signataire_arrete.signataire_arrete, |
1469 |
|
CONCAT_WS( |
1470 |
|
' - ', |
1471 |
|
CONCAT_WS(' ', signataire_arrete.prenom, signataire_arrete.nom), |
1472 |
|
signataire_habilitation.libelle, |
1473 |
|
signataire_arrete.description |
1474 |
|
) |
1475 |
|
FROM |
1476 |
|
%1\$ssignataire_arrete |
1477 |
|
LEFT JOIN %1\$ssignataire_habilitation |
1478 |
|
ON signataire_arrete.signataire_habilitation = signataire_habilitation.signataire_habilitation |
1479 |
|
WHERE |
1480 |
|
((signataire_arrete.om_validite_debut IS NULL |
1481 |
|
AND (signataire_arrete.om_validite_fin IS NULL |
1482 |
|
OR signataire_arrete.om_validite_fin > CURRENT_DATE)) |
1483 |
|
OR (signataire_arrete.om_validite_debut <= CURRENT_DATE |
1484 |
|
AND (signataire_arrete.om_validite_fin IS NULL |
1485 |
|
OR signataire_arrete.om_validite_fin > CURRENT_DATE))) |
1486 |
|
AND signataire_arrete.defaut IS TRUE |
1487 |
|
ORDER BY |
1488 |
|
signataire_arrete.prenom, signataire_arrete.nom", |
1489 |
|
DB_PREFIXE |
1490 |
|
); |
1491 |
} |
} |
1492 |
|
|
1493 |
function setSelect(&$form, $maj, &$db = null, $debug = null) { |
/** |
1494 |
|
* |
1495 |
|
* @return string |
1496 |
|
*/ |
1497 |
|
function get_var_sql_forminc__sql_signataire_arrete_defaut_by_di() { |
1498 |
|
return sprintf( |
1499 |
|
"SELECT |
1500 |
|
signataire_arrete.signataire_arrete, |
1501 |
|
CONCAT_WS( |
1502 |
|
' - ', |
1503 |
|
CONCAT_WS(' ', signataire_arrete.prenom, signataire_arrete.nom), |
1504 |
|
signataire_habilitation.libelle, |
1505 |
|
signataire_arrete.description |
1506 |
|
) |
1507 |
|
FROM |
1508 |
|
%1\$ssignataire_arrete |
1509 |
|
LEFT JOIN %1\$ssignataire_habilitation |
1510 |
|
ON signataire_arrete.signataire_habilitation = signataire_habilitation.signataire_habilitation |
1511 |
|
LEFT JOIN %1\$som_collectivite |
1512 |
|
ON signataire_arrete.om_collectivite = om_collectivite.om_collectivite |
1513 |
|
WHERE |
1514 |
|
((signataire_arrete.om_validite_debut IS NULL |
1515 |
|
AND (signataire_arrete.om_validite_fin IS NULL |
1516 |
|
OR signataire_arrete.om_validite_fin > CURRENT_DATE)) |
1517 |
|
OR (signataire_arrete.om_validite_debut <= CURRENT_DATE |
1518 |
|
AND (signataire_arrete.om_validite_fin IS NULL |
1519 |
|
OR signataire_arrete.om_validite_fin > CURRENT_DATE))) |
1520 |
|
AND signataire_arrete.defaut IS TRUE |
1521 |
|
AND (om_collectivite.niveau = '2' |
1522 |
|
OR signataire_arrete.om_collectivite = <collectivite_di>) |
1523 |
|
ORDER BY |
1524 |
|
signataire_arrete.prenom, |
1525 |
|
signataire_arrete.nom", |
1526 |
|
DB_PREFIXE |
1527 |
|
); |
1528 |
|
} |
1529 |
|
|
1530 |
|
/** |
1531 |
|
* SETTER_FORM - setSelect. |
1532 |
|
* |
1533 |
|
* @return void |
1534 |
|
*/ |
1535 |
|
function setSelect(&$form, $maj, &$dnu1 = null, $dnu2 = null) { |
1536 |
|
//parent::setSelect($form, $maj); |
1537 |
/** |
/** |
1538 |
* 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 |
1539 |
* dossier est mauvaise pour les performances, car la requête qui |
* dossier est mauvaise pour les performances, car la requête qui |
1541 |
* champs action, avis_decision et etat ne sont pas utilisés comme des |
* champs action, avis_decision et etat ne sont pas utilisés comme des |
1542 |
* select |
* select |
1543 |
*/ |
*/ |
|
if(file_exists ("../sql/".OM_DB_PHPTYPE."/".$this->table.".form.inc.php")) |
|
|
include ("../sql/".OM_DB_PHPTYPE."/".$this->table.".form.inc.php"); |
|
|
elseif(file_exists ("../sql/".OM_DB_PHPTYPE."/".$this->table.".form.inc")) |
|
|
include ("../sql/".OM_DB_PHPTYPE."/".$this->table.".form.inc"); |
|
|
|
|
1544 |
//// action |
//// action |
1545 |
//$this->init_select($form, $db, $maj, $debug, "action", |
//$this->init_select($form, $this->f->db, $maj, null, "action", |
1546 |
// $sql_action, $sql_action_by_id, false); |
// $sql_action, $sql_action_by_id, false); |
1547 |
|
|
1548 |
//// avis_decision |
//// avis_decision |
1549 |
//$this->init_select($form, $db, $maj, $debug, "avis_decision", |
//$this->init_select($form, $this->f->db, $maj, null, "avis_decision", |
1550 |
// $sql_avis_decision, $sql_avis_decision_by_id, false); |
// $sql_avis_decision, $sql_avis_decision_by_id, false); |
1551 |
|
|
1552 |
//// dossier |
//// dossier |
1553 |
//$this->init_select($form, $db, $maj, $debug, "dossier", |
//$this->init_select($form, $this->f->db, $maj, null, "dossier", |
1554 |
// $sql_dossier, $sql_dossier_by_id, false); |
// $sql_dossier, $sql_dossier_by_id, false); |
1555 |
|
|
1556 |
//// etat |
//// etat |
1557 |
//$this->init_select($form, $db, $maj, $debug, "etat", |
//$this->init_select($form, $this->f->db, $maj, null, "etat", |
1558 |
// $sql_etat, $sql_etat_by_id, false); |
// $sql_etat, $sql_etat_by_id, false); |
1559 |
|
|
1560 |
//// evenement |
//// evenement |
1561 |
//$this->init_select($form, $db, $maj, $debug, "evenement", |
//$this->init_select($form, $this->f->db, $maj, null, "evenement", |
1562 |
// $sql_evenement, $sql_evenement_by_id, false); |
// $sql_evenement, $sql_evenement_by_id, false); |
1563 |
|
|
1564 |
// signataire_arrete |
// signataire_arrete |
1574 |
|| $this->getParameter("retourformulaire") == "dossier_contentieux_mes_recours" |
|| $this->getParameter("retourformulaire") == "dossier_contentieux_mes_recours" |
1575 |
|| $this->getParameter("retourformulaire") == "dossier_contentieux_tous_recours") { |
|| $this->getParameter("retourformulaire") == "dossier_contentieux_tous_recours") { |
1576 |
// 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 |
1577 |
require_once "../obj/dossier_instruction.class.php"; |
$di = $this->f->get_inst__om_dbform(array( |
1578 |
$di = new dossier_instruction($this->getParameter('idxformulaire'), $db, $debug); |
"obj" => "dossier_instruction", |
1579 |
$sql_signataire_arrete_by_di = str_replace('<collectivite_di>', $di->getVal("om_collectivite"), $sql_signataire_arrete_by_di); |
"idx" => $this->getParameter('idxformulaire'), |
1580 |
$this->init_select($form, $db, $maj, $debug, "signataire_arrete", |
)); |
1581 |
$sql_signataire_arrete_by_di, $sql_signataire_arrete_by_id, true); |
$sql_signataire_arrete_by_di = str_replace( |
1582 |
|
'<collectivite_di>', |
1583 |
|
$di->getVal("om_collectivite"), |
1584 |
|
$this->get_var_sql_forminc__sql("signataire_arrete_by_di") |
1585 |
|
); |
1586 |
|
$this->init_select( |
1587 |
|
$form, |
1588 |
|
$this->f->db, |
1589 |
|
$maj, |
1590 |
|
null, |
1591 |
|
"signataire_arrete", |
1592 |
|
$sql_signataire_arrete_by_di, |
1593 |
|
$this->get_var_sql_forminc__sql("signataire_arrete_by_id"), |
1594 |
|
true |
1595 |
|
); |
1596 |
} else { |
} else { |
1597 |
$this->init_select($form, $db, $maj, $debug, "signataire_arrete", |
$this->init_select( |
1598 |
$sql_signataire_arrete, $sql_signataire_arrete_by_id, true); |
$form, |
1599 |
|
$this->f->db, |
1600 |
|
$maj, |
1601 |
|
null, |
1602 |
|
"signataire_arrete", |
1603 |
|
$this->get_var_sql_forminc__sql("signataire_arrete"), |
1604 |
|
$this->get_var_sql_forminc__sql("signataire_arrete_by_id"), |
1605 |
|
true |
1606 |
|
); |
1607 |
} |
} |
1608 |
|
|
1609 |
/** |
/** |
1628 |
INNER JOIN ".DB_PREFIXE."transition |
INNER JOIN ".DB_PREFIXE."transition |
1629 |
ON evenement.evenement = transition.evenement |
ON evenement.evenement = transition.evenement |
1630 |
AND dossier.etat=transition.etat |
AND dossier.etat=transition.etat |
1631 |
WHERE dossier.dossier='".$this->idxformulaire."' "; |
WHERE dossier.dossier='".$this->getParameter("idxformulaire")."' "; |
1632 |
|
|
1633 |
// Si changement de décision par instructeur commune |
// Si changement de décision par instructeur commune |
1634 |
if($this->f->isUserInstructeur() === true |
if($this->f->isUserInstructeur() === true |
1635 |
&& $this->getDivisionFromDossier($this->idxformulaire) != $_SESSION["division"] |
&& $this->getDivisionFromDossier($this->getParameter("idxformulaire")) != $_SESSION["division"] |
1636 |
&& $this->isInstrCanChangeDecision($this->idxformulaire) === true) { |
&& $this->isInstrCanChangeDecision($this->getParameter("idxformulaire")) === true) { |
1637 |
$sql .= "AND evenement.type IN ('arrete', 'changement_decision') "; |
$sql .= "AND evenement.type IN ('arrete', 'changement_decision') "; |
1638 |
} |
} |
1639 |
$sql .= "ORDER BY evenement.libelle, evenement.action"; |
$sql .= "ORDER BY evenement.libelle, evenement.action"; |
1640 |
$res = $db->query($sql); |
$res = $this->f->db->query($sql); |
1641 |
$this->addToLog("setSelect(): db->query(\"".$sql."\");", VERBOSE_MODE); |
$this->addToLog("setSelect(): db->query(\"".$sql."\");", VERBOSE_MODE); |
1642 |
if (database::isError($res)) { |
if (database::isError($res)) { |
1643 |
die($res->getMessage()); |
die($res->getMessage()); |
1652 |
$contenu[1][] = $row[1]; |
$contenu[1][] = $row[1]; |
1653 |
} |
} |
1654 |
$form->setSelect("evenement", $contenu); |
$form->setSelect("evenement", $contenu); |
1655 |
|
|
1656 |
} else { |
} else { |
1657 |
$sql = "SELECT |
$sql = "SELECT |
1658 |
evenement.libelle as lib |
evenement.libelle as lib |
1659 |
FROM ".DB_PREFIXE."evenement |
FROM ".DB_PREFIXE."evenement |
1660 |
WHERE evenement.evenement=".$this->getVal("evenement").""; |
WHERE evenement.evenement=".$this->getVal("evenement").""; |
1661 |
$res = $db->getone($sql); |
$res = $this->f->db->getone($sql); |
1662 |
$this->addToLog("setSelect(): db->getone(\"".$sql."\");", VERBOSE_MODE); |
$this->addToLog("setSelect(): db->getone(\"".$sql."\");", VERBOSE_MODE); |
1663 |
if (database::isError($res)) { |
if (database::isError($res)) { |
1664 |
die($res->getMessage()); |
die($res->getMessage()); |
1693 |
if ($maj == 1) { |
if ($maj == 1) { |
1694 |
$base64 = $this->init_pdf_temp(); |
$base64 = $this->init_pdf_temp(); |
1695 |
$form->setSelect('live_preview', array('base64'=>$base64)); |
$form->setSelect('live_preview', array('base64'=>$base64)); |
1696 |
$form->setSelect("btn_refresh", array(_('Actualiser'))); |
$form->setSelect("btn_refresh", array(_('Prévisualiser'))); |
1697 |
|
$form->setSelect("btn_preview", array(_('Prévisualiser >>'))); |
1698 |
|
$form->setSelect("btn_redaction", array(_('<< Rédiger'))); |
1699 |
|
} |
1700 |
|
|
1701 |
|
// Selection du type de rédaction à l'ajout |
1702 |
|
$content = array( |
1703 |
|
0 => array('f', 't', ), |
1704 |
|
1 => array(_('Rédaction par compléments'), _('Rédaction libre'), ), |
1705 |
|
); |
1706 |
|
$form->setSelect('flag_edition_integrale', $content); |
1707 |
|
|
1708 |
|
$contenu = array(); |
1709 |
|
foreach(array('waiting', 'in_progress', 'canceled', 'expired', 'finished') as $value) { |
1710 |
|
$contenu[0][] = $value; |
1711 |
|
$contenu[1][] = $this->get_trad_for_statut($value); |
1712 |
|
} |
1713 |
|
$form->setSelect('statut_signature', $contenu); |
1714 |
|
|
1715 |
|
|
1716 |
|
if ($maj == 401) { |
1717 |
|
$file = $this->f->storage->get($this->getVal('om_fichier_instruction')); |
1718 |
|
$form->setSelect('preview_edition', array( |
1719 |
|
'base64' => base64_encode($file['file_content']), |
1720 |
|
'mimetype' => $file['metadata']['mimetype'], |
1721 |
|
'label' => 'instruction_'.$this->getVal($this->clePrimaire), |
1722 |
|
'href' => sprintf( |
1723 |
|
'../app/index.php?module=form&snippet=file&obj=instruction&champ=om_fichier_instruction&id=%1$s', |
1724 |
|
$this->getVal($this->clePrimaire) |
1725 |
|
) |
1726 |
|
)); |
1727 |
} |
} |
1728 |
} |
} |
1729 |
|
|
1730 |
function cleSecondaire($id, &$db = null, $val = array(), $DEBUG = null) { |
function cleSecondaire($id, &$dnu1 = null, $val = array(), $dnu2 = null) { |
1731 |
// |
// |
1732 |
parent::cleSecondaire($id, $db, $val, $DEBUG); |
// Vérifie uniquementla cle secondaire : demande |
1733 |
|
$this->rechercheTable($this->f->db, "demande", "instruction_recepisse", $id); |
1734 |
|
|
1735 |
$id = $this->getVal($this->clePrimaire); |
$id = $this->getVal($this->clePrimaire); |
1736 |
|
|
1742 |
LEFT JOIN ".DB_PREFIXE."demande |
LEFT JOIN ".DB_PREFIXE."demande |
1743 |
ON demande.demande_type = demande_type.demande_type |
ON demande.demande_type = demande_type.demande_type |
1744 |
WHERE demande.instruction_recepisse = ".$id; |
WHERE demande.instruction_recepisse = ".$id; |
1745 |
$res = $this->db->getOne($sql); |
$res = $this->f->db->getOne($sql); |
1746 |
$this->addToLog("cleSecondaire(): db->getone(\"".$sql."\");", VERBOSE_MODE); |
$this->addToLog("cleSecondaire(): db->getone(\"".$sql."\");", VERBOSE_MODE); |
1747 |
if (database::isError($res)) { |
if (database::isError($res)) { |
1748 |
die($res->getMessage()); |
die($res->getMessage()); |
1758 |
$sql = "SELECT demande |
$sql = "SELECT demande |
1759 |
FROM ".DB_PREFIXE."demande |
FROM ".DB_PREFIXE."demande |
1760 |
WHERE instruction_recepisse = ".$id; |
WHERE instruction_recepisse = ".$id; |
1761 |
$res = $this->db->getOne($sql); |
$res = $this->f->db->getOne($sql); |
1762 |
$this->addToLog("cleSecondaire(): db->getone(\"".$sql."\");", VERBOSE_MODE); |
$this->addToLog("cleSecondaire(): db->getone(\"".$sql."\");", VERBOSE_MODE); |
1763 |
if (database::isError($res)) { |
if (database::isError($res)) { |
1764 |
die($res->getMessage()); |
die($res->getMessage()); |
1766 |
|
|
1767 |
//Si c'est un événement d'instruction lié à une demande |
//Si c'est un événement d'instruction lié à une demande |
1768 |
if ($res != null || $res != ""){ |
if ($res != null || $res != ""){ |
1769 |
|
$demande = $this->f->get_inst__om_dbform(array( |
1770 |
require_once "../obj/demande.class.php"; |
"obj" => "demande", |
1771 |
$demande = new demande($res, $this->db, DEBUG); |
"idx" => $res, |
1772 |
|
)); |
1773 |
|
|
1774 |
//On met à jour la demande en supprimant la liaison vers |
//On met à jour la demande en supprimant la liaison vers |
1775 |
//l'événement d'instruction |
//l'événement d'instruction |
1780 |
} |
} |
1781 |
$valF['date_demande']=$demande->dateDBToForm($valF['date_demande']); |
$valF['date_demande']=$demande->dateDBToForm($valF['date_demande']); |
1782 |
$valF['instruction_recepisse']=NULL; |
$valF['instruction_recepisse']=NULL; |
1783 |
$ret = $demande->modifier($valF, $this->db, DEBUG); |
$ret = $demande->modifier($valF); |
1784 |
} |
} |
1785 |
|
|
1786 |
/** |
/** |
1793 |
// concerne le dossier en cours |
// concerne le dossier en cours |
1794 |
$sql = "SELECT max(instruction) |
$sql = "SELECT max(instruction) |
1795 |
FROM ".DB_PREFIXE."instruction |
FROM ".DB_PREFIXE."instruction |
1796 |
WHERE dossier ='".$this->idxformulaire."'"; |
WHERE dossier ='".$this->getParameter("idxformulaire")."'"; |
1797 |
$dernierevenement = $db->getOne($sql); |
$dernierevenement = $this->f->db->getOne($sql); |
1798 |
$this->addToLog("setSelect(): db->getone(\"".$sql."\");", VERBOSE_MODE); |
$this->addToLog("setSelect(): db->getone(\"".$sql."\");", VERBOSE_MODE); |
1799 |
if (database::isError($dernierevenement)) { |
if (database::isError($dernierevenement)) { |
1800 |
die($dernierevenement->getMessage()); |
die($dernierevenement->getMessage()); |
1844 |
return true; |
return true; |
1845 |
} |
} |
1846 |
|
|
1847 |
/*Met des valeurs par défaut dans certains des sous-formulaire*/ |
/** |
1848 |
function setValsousformulaire(&$form, $maj, $validation, $idxformulaire, $retourformulaire, $typeformulaire, &$db = null, $DEBUG = null) { |
* SETTER_FORM - setValsousformulaire (setVal). |
1849 |
|
* |
1850 |
|
* @return void |
1851 |
|
*/ |
1852 |
|
function setValsousformulaire(&$form, $maj, $validation, $idxformulaire, $retourformulaire, $typeformulaire, &$dnu1 = null, $dnu2 = null) { |
1853 |
|
// parent::setValsousformulaire($form, $maj, $validation, $idxformulaire, $retourformulaire, $typeformulaire); |
1854 |
|
// |
1855 |
|
$this->retourformulaire = $retourformulaire; |
1856 |
// |
// |
|
$this->retourformulaire=$retourformulaire; |
|
|
$this->idxformulaire=$idxformulaire; |
|
|
// Ajout |
|
1857 |
if ($maj == 0) { |
if ($maj == 0) { |
1858 |
$form->setVal("destinataire", $idxformulaire); |
$form->setVal("destinataire", $this->getParameter("idxformulaire")); |
1859 |
$form->setVal("dossier", $idxformulaire); |
$form->setVal("dossier", $this->getParameter("idxformulaire")); |
1860 |
} |
} |
1861 |
// |
// |
1862 |
$this->set_form_default_values($form, $maj, $validation); |
$this->set_form_default_values($form, $maj, $validation); |
1863 |
} |
} |
1864 |
|
|
1865 |
/** |
/** |
1866 |
* Permet de pré-remplir les valeurs des formulaires. |
* SETTER_FORM - set_form_default_values (setVal). |
1867 |
* |
* |
1868 |
* @param [object] $form formulaire |
* @return void |
|
* @param [integer] $maj mode |
|
|
* @param [integer] $validation validation |
|
1869 |
*/ |
*/ |
1870 |
function set_form_default_values(&$form, $maj, $validation) { |
function set_form_default_values(&$form, $maj, $validation) { |
1871 |
|
// |
|
// Ajout |
|
1872 |
if ($maj == 0) { |
if ($maj == 0) { |
|
if(file_exists ("../sql/".OM_DB_PHPTYPE."/".$this->table.".form.inc.php")) |
|
|
include ("../sql/".OM_DB_PHPTYPE."/".$this->table.".form.inc.php"); |
|
|
elseif(file_exists ("../sql/".OM_DB_PHPTYPE."/".$this->table.".form.inc")) |
|
|
include ("../sql/".OM_DB_PHPTYPE."/".$this->table.".form.inc"); |
|
1873 |
// si contexte DI |
// si contexte DI |
1874 |
if ($this->getParameter("retourformulaire") == "dossier" |
if ($this->getParameter("retourformulaire") == "dossier" |
1875 |
|| $this->getParameter("retourformulaire") == "dossier_instruction" |
|| $this->getParameter("retourformulaire") == "dossier_instruction" |
1882 |
|| $this->getParameter("retourformulaire") == "dossier_contentieux_mes_recours" |
|| $this->getParameter("retourformulaire") == "dossier_contentieux_mes_recours" |
1883 |
|| $this->getParameter("retourformulaire") == "dossier_contentieux_tous_recours") { |
|| $this->getParameter("retourformulaire") == "dossier_contentieux_tous_recours") { |
1884 |
// 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 |
1885 |
require_once "../obj/dossier_instruction.class.php"; |
$di = $this->f->get_inst__om_dbform(array( |
1886 |
$di = new dossier_instruction($this->getParameter('idxformulaire'), $db, DEBUG); |
"obj" => "dossier_instruction", |
1887 |
$sql = str_replace('<collectivite_di>', $di->getVal("om_collectivite"), $sql_signataire_arrete_defaut_by_di); |
"idx" => $this->getParameter("idxformulaire"), |
1888 |
|
)); |
1889 |
|
$sql = str_replace( |
1890 |
|
"<collectivite_di>", |
1891 |
|
$di->getVal("om_collectivite"), |
1892 |
|
$this->get_var_sql_forminc__sql("signataire_arrete_defaut_by_di") |
1893 |
|
); |
1894 |
} else { |
} else { |
1895 |
$sql = $sql_signataire_arrete_defaut; |
$sql = $this->get_var_sql_forminc__sql("signataire_arrete_defaut"); |
1896 |
} |
} |
|
// Date du jour |
|
|
$form->setVal("date_evenement", date('Y-m-d')); |
|
|
|
|
|
// Exécution de la requête |
|
1897 |
$res = $this->f->db->query($sql); |
$res = $this->f->db->query($sql); |
1898 |
$this->f->addToLog("setVal(): db->query(\"".$sql."\");", VERBOSE_MODE); |
$this->f->addToLog(__METHOD__."(): db->query(\"".$sql."\")", VERBOSE_MODE); |
1899 |
if ( database::isError($res)){ |
$this->f->isDatabaseError($res); |
|
die(); |
|
|
} |
|
|
|
|
1900 |
$row = $res->fetchrow(DB_FETCHMODE_ASSOC); |
$row = $res->fetchrow(DB_FETCHMODE_ASSOC); |
1901 |
|
if (isset($row["signataire_arrete"]) |
1902 |
if (isset($row['signataire_arrete']) && is_numeric($row['signataire_arrete'])){ |
&& is_numeric($row["signataire_arrete"])) { |
1903 |
$form->setVal("signataire_arrete",$row['signataire_arrete']); |
// |
1904 |
|
$form->setVal("signataire_arrete", $row["signataire_arrete"]); |
1905 |
} |
} |
1906 |
|
// Date du jour |
1907 |
|
$form->setVal("date_evenement", date("Y-m-d")); |
1908 |
} |
} |
1909 |
|
// |
|
// Ajout et modification |
|
1910 |
if ($maj == 0 || $maj == 1 || $maj == 125) { |
if ($maj == 0 || $maj == 1 || $maj == 125) { |
1911 |
$form->setVal("bible_auto","bible_auto()"); |
$form->setVal("bible_auto", "bible_auto()"); |
1912 |
$form->setVal("bible","bible(1)"); |
$form->setVal("bible", "bible(1)"); |
1913 |
$form->setVal("bible2","bible(2)"); |
$form->setVal("bible2", "bible(2)"); |
1914 |
$form->setVal("bible3","bible(3)"); |
$form->setVal("bible3", "bible(3)"); |
1915 |
$form->setVal("bible4","bible(4)"); |
$form->setVal("bible4", "bible(4)"); |
1916 |
} |
} |
1917 |
|
// |
|
// Récupère la collectivité du dossier d'instruction |
|
1918 |
$collectivite_di = $this->get_dossier_instruction_om_collectivite(); |
$collectivite_di = $this->get_dossier_instruction_om_collectivite(); |
1919 |
|
if ($maj == 1 |
1920 |
// Modification |
&& $this->f->is_option_preview_pdf_enabled($collectivite_di) === true |
|
if ($maj == 1 && $this->f->is_option_preview_pdf_enabled($collectivite_di) === true |
|
1921 |
&& $this->has_an_edition() === true) { |
&& $this->has_an_edition() === true) { |
1922 |
$form->setVal("live_preview",$this->getVal($this->clePrimaire)); |
// |
1923 |
$form->setVal("btn_refresh","reload_pdf_viewer()"); |
$form->setVal("live_preview", $this->getVal($this->clePrimaire)); |
1924 |
|
$form->setVal("btn_refresh", "reload_pdf_viewer()"); |
1925 |
|
$form->setVal("btn_preview", "show_instr_preview()"); |
1926 |
|
$form->setVal("btn_redaction", "show_instr_redaction()"); |
1927 |
} |
} |
|
} |
|
1928 |
|
|
1929 |
|
if ($maj == 3 |
1930 |
|
&& $this->can_display_notification_demandeur() |
1931 |
|
) { |
1932 |
|
$typeNotification = array( |
1933 |
|
'notification_recepisse', |
1934 |
|
'notification_instruction', |
1935 |
|
'notification_decision', |
1936 |
|
); |
1937 |
|
$form->setVal("suivi_notification", $this->get_json_suivi_notification($typeNotification)); |
1938 |
|
} |
1939 |
|
if ($maj == 3 |
1940 |
|
&& $this->can_display_notification_service() |
1941 |
|
) { |
1942 |
|
$form->setVal("suivi_notification_service", $this->get_json_suivi_notification(array('notification_service_consulte'))); |
1943 |
|
} |
1944 |
|
if ($maj == 3 |
1945 |
|
&& $this->can_display_notification_tiers() |
1946 |
|
) { |
1947 |
|
$form->setVal("suivi_notification_tiers", $this->get_json_suivi_notification(array('notification_tiers_consulte'))); |
1948 |
|
} |
1949 |
|
} |
1950 |
|
|
1951 |
function setLayout(&$form, $maj){ |
function setLayout(&$form, $maj){ |
1952 |
if ( $maj < 2 OR $maj == 3 OR $maj == 125 ) { |
$form->setBloc('evenement','D',"","sousform-instruction-action-".$maj); |
|
/*Champ sur lequel s'ouvre le bloc 1 */ |
|
|
$form->setBloc('evenement','D',"","col_12"); |
|
1953 |
|
|
1954 |
$form->setFieldset('evenement','D',_('Evenement')); |
$form->setFieldset('evenement','D',_('Evenement')); |
1955 |
$form->setFieldset('om_final_instruction_utilisateur','F',''); |
$form->setFieldset('om_final_instruction_utilisateur','F',''); |
1956 |
|
|
1957 |
$form->setBloc('om_final_instruction_utilisateur','F'); |
$form->setBloc('om_final_instruction_utilisateur','F'); |
1958 |
|
|
1959 |
$form->setBloc('date_finalisation_courrier','D',"","col_12"); |
$form->setBloc('date_finalisation_courrier','D',"",""); |
1960 |
|
|
1961 |
$form->setFieldset('date_finalisation_courrier','D',_('Dates')); |
$form->setFieldset('date_finalisation_courrier','D',_('Dates')); |
1962 |
$form->setBloc('date_finalisation_courrier','D',"","col_6"); |
$form->setBloc('date_finalisation_courrier','D',"","col_6"); |
1963 |
$form->setBloc('date_envoi_controle_legalite','F'); |
$form->setBloc('date_envoi_controle_legalite','F'); |
1964 |
|
|
1965 |
$form->setBloc('signataire_arrete','D',"","col_6"); |
$form->setBloc('date_retour_signature','D',"","col_6"); |
1966 |
$form->setBloc('date_retour_controle_legalite','F'); |
$form->setBloc('date_retour_controle_legalite','F'); |
1967 |
$form->setFieldset('date_retour_controle_legalite','F',''); |
$form->setFieldset('date_retour_controle_legalite','F',''); |
1968 |
|
|
1969 |
$form->setBloc('date_retour_controle_legalite','F'); |
$form->setBloc('date_retour_controle_legalite','F'); |
1970 |
|
|
1971 |
if ($maj == 1) { |
$form->setBloc('statut_signature','D'); |
1972 |
// Récupère la collectivité du dossier d'instruction |
$form->setFieldset('statut_signature','D','Suivi Parapheur'); |
1973 |
$collectivite_di = $this->get_dossier_instruction_om_collectivite(); |
$form->setBloc('commentaire_signature','F'); |
1974 |
|
$form->setBloc('historique_signature','D'); |
1975 |
|
$form->setFieldset('historique_signature', 'DF', __("Historique"), "collapsible, startClosed"); |
1976 |
|
$form->setBloc('historique_signature','F'); |
1977 |
|
$form->setFieldset('historique_signature','F'); |
1978 |
|
|
1979 |
|
$form->setFieldset('suivi_notification', 'D', __("Suivi notification"), "collapsible"); |
1980 |
|
$form->setFieldset('suivi_notification','F'); |
1981 |
|
$form->setFieldset('suivi_notification_service', 'D', __("Suivi notification service"), "collapsible"); |
1982 |
|
$form->setFieldset('suivi_notification_service','F'); |
1983 |
|
$form->setFieldset('suivi_notification_tiers', 'D', __("Suivi notification tiers"), "collapsible"); |
1984 |
|
$form->setFieldset('suivi_notification_tiers','F'); |
1985 |
|
|
1986 |
|
if ($maj == 1) { |
1987 |
|
// Récupère la collectivité du dossier d'instruction |
1988 |
|
$collectivite_di = $this->get_dossier_instruction_om_collectivite(); |
1989 |
|
|
1990 |
|
// |
1991 |
|
if ($this->f->is_option_preview_pdf_enabled($collectivite_di) === true |
1992 |
|
&& $this->has_an_edition() === true) { |
1993 |
// |
// |
1994 |
if ($this->f->is_option_preview_pdf_enabled($collectivite_di) === true |
$form->setBloc('complement_om_html','D',"","container_instr_edition"); |
1995 |
&& $this->has_an_edition() === true) { |
$form->setBloc('complement_om_html','D',"","hidelabel box_instr_edition redaction_instr_edition"); |
1996 |
$form->setBloc('complement_om_html','D',"","col_12 container_preview_pdf"); |
$form->setBloc('complement_om_html','D',"","box_instr_edition_main"); |
1997 |
$form->setBloc('complement_om_html','D',"","col_6 hidelabel"); |
$form->setFieldset('complement_om_html','D',_('Complement')); |
1998 |
$form->setFieldset('complement_om_html','D',_('Complement')); |
$form->setFieldset('bible','F',''); |
1999 |
$form->setFieldset('bible','F',''); |
$form->setFieldset('complement2_om_html','D',_('Complement 2')); |
2000 |
$form->setFieldset('complement2_om_html','D',_('Complement 2')); |
$form->setFieldset('bible2','F',''); |
2001 |
$form->setFieldset('bible2','F',''); |
$form->setFieldset('complement3_om_html','D',_('Complement 3')); |
2002 |
$form->setFieldset('complement3_om_html','D',_('Complement 3')); |
$form->setFieldset('bible3','F',''); |
2003 |
$form->setFieldset('bible3','F',''); |
$form->setFieldset('complement4_om_html','D',_('Complement 4')); |
2004 |
$form->setFieldset('complement4_om_html','D',_('Complement 4')); |
$form->setFieldset('bible4','F',''); |
2005 |
$form->setFieldset('bible4','F',''); |
$form->setFieldset('titre_om_htmletat','DF',_('Titre'), 'startClosed'); |
2006 |
$form->setBloc('bible4','F'); |
$form->setFieldset('corps_om_htmletatex','DF',_('Corps')); |
2007 |
$form->setBloc('btn_refresh','D',"","col_6 hidelabel"); |
$form->setBloc('corps_om_htmletatex','F'); |
2008 |
$form->setFieldset('btn_refresh','D',_('Prévisualisation')); |
$form->setBloc('btn_preview','DF',"","box_instr_edition_btn"); |
2009 |
$form->setFieldset('live_preview','F'); |
$form->setBloc('btn_preview','F'); |
2010 |
$form->setBloc('live_preview','F'); |
$form->setBloc('btn_redaction','D', '',"hidelabel box_instr_edition preview_instr_edition"); |
2011 |
$form->setBloc('live_preview','F'); |
$form->setBloc('btn_redaction','DF',"","box_instr_edition_btn"); |
2012 |
} else { |
$form->setFieldset('btn_refresh','D',_('Prévisualisation'), "box_instr_edition_main"); |
2013 |
$form->setBloc('complement_om_html','D',"","col_12 hidelabel"); |
$form->setFieldset('live_preview','F'); |
2014 |
$form->setFieldset('complement_om_html','D',_('Complement')); |
$form->setBloc('live_preview','F'); |
2015 |
$form->setFieldset('bible','F',''); |
$form->setBloc('live_preview','F'); |
|
$form->setFieldset('complement2_om_html','D',_('Complement 2')); |
|
|
$form->setFieldset('bible2','F',''); |
|
|
$form->setFieldset('complement3_om_html','D',_('Complement 3')); |
|
|
$form->setFieldset('bible3','F',''); |
|
|
$form->setFieldset('complement4_om_html','D',_('Complement 4')); |
|
|
$form->setFieldset('bible4','F',''); |
|
|
$form->setBloc('bible4','F'); |
|
|
} |
|
2016 |
} else { |
} else { |
2017 |
$form->setBloc('complement_om_html','D',"","col_12 hidelabel"); |
$form->setBloc('complement_om_html','D',"","hidelabel"); |
2018 |
$form->setFieldset('complement_om_html','D',_('Complement')); |
$form->setFieldset('complement_om_html','D',_('Complement')); |
2019 |
$form->setFieldset('bible','F',''); |
$form->setFieldset('bible','F',''); |
2020 |
$form->setFieldset('complement2_om_html','D',_('Complement 2')); |
$form->setFieldset('complement2_om_html','D',_('Complement 2')); |
2023 |
$form->setFieldset('bible3','F',''); |
$form->setFieldset('bible3','F',''); |
2024 |
$form->setFieldset('complement4_om_html','D',_('Complement 4')); |
$form->setFieldset('complement4_om_html','D',_('Complement 4')); |
2025 |
$form->setFieldset('bible4','F',''); |
$form->setFieldset('bible4','F',''); |
2026 |
$form->setBloc('bible4','F'); |
$form->setFieldset('titre_om_htmletat','DF',_('Titre'), 'startClosed'); |
2027 |
|
$form->setFieldset('corps_om_htmletatex','DF',_('Corps')); |
2028 |
|
$form->setBloc('corps_om_htmletatex','F'); |
2029 |
} |
} |
2030 |
|
} else { |
2031 |
|
$form->setBloc('complement_om_html','D',"","hidelabel"); |
2032 |
|
$form->setFieldset('complement_om_html','D',_('Complement')); |
2033 |
|
$form->setFieldset('bible','F',''); |
2034 |
|
$form->setFieldset('complement2_om_html','D',_('Complement 2')); |
2035 |
|
$form->setFieldset('bible2','F',''); |
2036 |
|
$form->setFieldset('complement3_om_html','D',_('Complement 3')); |
2037 |
|
$form->setFieldset('bible3','F',''); |
2038 |
|
$form->setFieldset('complement4_om_html','D',_('Complement 4')); |
2039 |
|
$form->setFieldset('bible4','F',''); |
2040 |
|
$form->setFieldset('titre_om_htmletat','DF',_('Titre'), 'startClosed'); |
2041 |
|
$form->setFieldset('corps_om_htmletatex','DF',_('Corps')); |
2042 |
|
$form->setBloc('corps_om_htmletatex','F'); |
2043 |
} |
} |
2044 |
} |
} |
2045 |
|
|
2053 |
$form->setLib('bible3', ""); |
$form->setLib('bible3', ""); |
2054 |
$form->setLib('bible4', ""); |
$form->setLib('bible4', ""); |
2055 |
$form->setLib('btn_refresh', ""); |
$form->setLib('btn_refresh', ""); |
2056 |
|
$form->setLib('btn_preview', ""); |
2057 |
|
$form->setLib('btn_redaction', ""); |
2058 |
$form->setLib('live_preview', ""); |
$form->setLib('live_preview', ""); |
2059 |
$form->setLib('om_final_instruction_utilisateur', _("finalise par")); |
$form->setLib('om_final_instruction_utilisateur', _("finalise par")); |
2060 |
|
$form->setLib('date_envoi_rar', __("date_envoi_ar")); |
2061 |
|
$form->setLib('date_retour_rar', __("date_notification")); |
2062 |
|
$form->setLib('statut_signature', __("statut")); |
2063 |
|
$form->setLib('commentaire_signature', __("commentaire")); |
2064 |
|
$form->setLib('historique_signature', ''); |
2065 |
|
$form->setLib('suivi_notification', ''); |
2066 |
|
$form->setLib('suivi_notification_service', ''); |
2067 |
|
$form->setLib('suivi_notification_tiers', ''); |
2068 |
|
$form->setLib('preview_edition', ""); |
2069 |
|
|
2070 |
|
// Ajout d'une infobulle d'aide lorsque le formulaire est en mode |
2071 |
|
// ajout et que l'option de rédaction libre est activée sur la |
2072 |
|
// collectivité du dossier |
2073 |
|
if ($maj === '0' && $this->is_option_redaction_libre_enabled() === true) { |
2074 |
|
// |
2075 |
|
$help_text_template = '%s <span class="info-16" title="%s"></span>'; |
2076 |
|
$help_text = _("Attention: le passage du mode 'Rédaction libre' à celui de 'Rédaction par compléments' fait perdre toute la rédaction manuelle effectuée."); |
2077 |
|
$form->setLib('flag_edition_integrale', sprintf($help_text_template, _("Type de rédaction"), $help_text)); |
2078 |
|
} |
2079 |
|
else { |
2080 |
|
$form->setLib('flag_edition_integrale', _("Type de rédaction")); |
2081 |
|
} |
2082 |
|
|
2083 |
|
// Ajout d'une infobulle d'aide lorsque le formulaire est en mode |
2084 |
|
// modification et que l'option de prévisualisation de l'édition est |
2085 |
|
// activée sur la collectivité du dossier |
2086 |
|
if ($maj === '1' |
2087 |
|
&& $this->f->is_option_preview_pdf_enabled($this->get_dossier_instruction_om_collectivite()) === true) { |
2088 |
|
// |
2089 |
|
$help_text_template = '%s <span class="info-16" title="%s"></span>'; |
2090 |
|
$help_text = _("Attention la modification de la valeur de ce champ n'est pas prise en compte dans la prévisualisation. Pour que cette valeur soit mise à jour, il suffit de valider le formulaire."); |
2091 |
|
$form->setLib('date_evenement', sprintf($help_text_template, _('date_evenement'), $help_text)); |
2092 |
|
$form->setLib('signataire_arrete', sprintf($help_text_template, _('signataire_arrete'), $help_text)); |
2093 |
|
} |
2094 |
} |
} |
2095 |
|
|
2096 |
function triggerajouter($id, &$db = null, $val = array(), $DEBUG = null) { |
/** |
2097 |
|
* TRIGGER - triggerajouter. |
2098 |
|
* |
2099 |
|
* @return boolean |
2100 |
|
*/ |
2101 |
|
function triggerajouter($id, &$dnu1 = null, $val = array(), $dnu2 = null) { |
2102 |
|
$this->addToLog(__METHOD__."(): start", EXTRA_VERBOSE_MODE); |
2103 |
/** |
/** |
2104 |
* 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 |
2105 |
* et dossier pour les stocker dans l'instruction : |
* et dossier pour les stocker dans l'instruction : |
2112 |
* - delai_notification |
* - delai_notification |
2113 |
* - lettretype |
* - lettretype |
2114 |
* - autorite_competente |
* - autorite_competente |
2115 |
|
* - pec_metier |
2116 |
* - complement_om_html |
* - complement_om_html |
2117 |
* - complement2_om_html |
* - complement2_om_html |
2118 |
* - complement3_om_html |
* - complement3_om_html |
2137 |
// Récupération de tous les paramètres de l'événement sélectionné |
// Récupération de tous les paramètres de l'événement sélectionné |
2138 |
$sql = "SELECT * FROM ".DB_PREFIXE."evenement |
$sql = "SELECT * FROM ".DB_PREFIXE."evenement |
2139 |
WHERE evenement=".$this->valF['evenement']; |
WHERE evenement=".$this->valF['evenement']; |
2140 |
$res = $db->query($sql); |
$res = $this->f->db->query($sql); |
2141 |
$this->addToLog("triggerajouter(): db->query(\"".$sql."\");", VERBOSE_MODE); |
$this->addToLog(__METHOD__."(): db->query(\"".$sql."\");", VERBOSE_MODE); |
2142 |
if (database::isError($res)) { |
if (database::isError($res)) { |
2143 |
die($res->getMessage()); |
die($res->getMessage()); |
2144 |
} |
} |
2175 |
} |
} |
2176 |
// Récupération de la valeur de la lettre type |
// Récupération de la valeur de la lettre type |
2177 |
$this->valF['lettretype']=$row['lettretype']; |
$this->valF['lettretype']=$row['lettretype']; |
2178 |
|
// Récupération de la valeur de la prise en compte métier |
2179 |
|
// si la prise en compte métier est paramétrée dans l'événement |
2180 |
|
$this->valF['pec_metier'] = NULL; |
2181 |
|
if(isset($row['pec_metier']) === true and empty($row['pec_metier']) === false) { |
2182 |
|
$this->valF['pec_metier'] = $row['pec_metier']; |
2183 |
|
} |
2184 |
} |
} |
2185 |
// Récupération de toutes les valeurs du dossier d'instruction en cours |
// Récupération de toutes les valeurs du dossier d'instruction en cours |
2186 |
$sql = "SELECT * FROM ".DB_PREFIXE."dossier |
$sql = "SELECT * FROM ".DB_PREFIXE."dossier |
2187 |
WHERE dossier='".$this->valF['dossier']."'"; |
WHERE dossier='".$this->valF['dossier']."'"; |
2188 |
$res = $db->query($sql); |
$res = $this->f->db->query($sql); |
2189 |
$this->addToLog("triggerajouter(): db->query(\"".$sql."\");", VERBOSE_MODE); |
$this->addToLog(__METHOD__."(): db->query(\"".$sql."\");", VERBOSE_MODE); |
2190 |
if (database::isError($res)) { |
if (database::isError($res)) { |
2191 |
die($res->getMessage()); |
die($res->getMessage()); |
2192 |
} |
} |
2201 |
LEFT JOIN ".DB_PREFIXE."dossier |
LEFT JOIN ".DB_PREFIXE."dossier |
2202 |
ON dossier.dossier_autorisation = dossier_autorisation.dossier_autorisation |
ON dossier.dossier_autorisation = dossier_autorisation.dossier_autorisation |
2203 |
WHERE dossier.dossier='".$this->valF['dossier']."'"; |
WHERE dossier.dossier='".$this->valF['dossier']."'"; |
2204 |
$duree_validite_parametrage = $db->getOne($sql); |
$duree_validite_parametrage = $this->f->db->getOne($sql); |
2205 |
$this->addToLog("triggerajouter(): db->getOne(\"".$sql."\");", VERBOSE_MODE); |
$this->addToLog(__METHOD__."(): db->getOne(\"".$sql."\");", VERBOSE_MODE); |
2206 |
database::isError($duree_validite_parametrage); |
database::isError($duree_validite_parametrage); |
2207 |
if ($duree_validite_parametrage != '') { |
if ($duree_validite_parametrage != '') { |
2208 |
$this->valF['duree_validite_parametrage']= $duree_validite_parametrage; |
$this->valF['duree_validite_parametrage']= $duree_validite_parametrage; |
2401 |
$sql = "SELECT retour |
$sql = "SELECT retour |
2402 |
FROM ".DB_PREFIXE."evenement |
FROM ".DB_PREFIXE."evenement |
2403 |
WHERE evenement = ".$evenement; |
WHERE evenement = ".$evenement; |
2404 |
$retour = $this->db->getOne($sql); |
$retour = $this->f->db->getOne($sql); |
2405 |
$this->addToLog("verifier(): db->query(\"".$sql."\");", VERBOSE_MODE); |
$this->addToLog("verifier(): db->query(\"".$sql."\");", VERBOSE_MODE); |
2406 |
if (database::isError($retour)) { |
if (database::isError($retour)) { |
2407 |
die($retour->getMessage()); |
die($retour->getMessage()); |
2432 |
WHERE |
WHERE |
2433 |
evenement =".$evenement; |
evenement =".$evenement; |
2434 |
|
|
2435 |
$restriction = $this->db->getOne($sql); |
$restriction = $this->f->db->getOne($sql); |
2436 |
$this->addToLog("verifier(): db->query(\"".$sql."\");", VERBOSE_MODE); |
$this->addToLog("verifier(): db->query(\"".$sql."\");", VERBOSE_MODE); |
2437 |
if (database::isError($restriction)) { |
if (database::isError($restriction)) { |
2438 |
die($restriction->getMessage()); |
die($restriction->getMessage()); |
2518 |
"regle_date_retour_contradictoire", |
"regle_date_retour_contradictoire", |
2519 |
"regle_date_ait", |
"regle_date_ait", |
2520 |
"regle_date_transmission_parquet", |
"regle_date_transmission_parquet", |
2521 |
|
"regle_date_affichage", |
2522 |
); |
); |
2523 |
// Tableau des champs de type numérique |
// Tableau des champs de type numérique |
2524 |
$rule_type_numeric = array( |
$rule_type_numeric = array( |
2530 |
); |
); |
2531 |
// Tableau des champs de type booléen |
// Tableau des champs de type booléen |
2532 |
$rule_type_bool = array( |
$rule_type_bool = array( |
2533 |
|
"regle_a_qualifier", |
2534 |
|
"regle_incompletude", |
2535 |
|
"regle_incomplet_notifie", |
2536 |
|
"regle_evenement_suivant_tacite_incompletude", |
2537 |
); |
); |
2538 |
// Tableau des champs spécifiques |
// Tableau des champs spécifiques |
2539 |
$rule_type_specific = array( |
$rule_type_specific = array( |
2541 |
"regle_etat", |
"regle_etat", |
2542 |
"regle_accord_tacite", |
"regle_accord_tacite", |
2543 |
"regle_avis", |
"regle_avis", |
2544 |
|
"regle_pec_metier", |
2545 |
|
"regle_etat_pendant_incompletude", |
2546 |
); |
); |
2547 |
// Tableau des champs de données techniques |
// Tableau des champs de données techniques |
2548 |
$rule_type_technical_data = array( |
$rule_type_technical_data = array( |
2552 |
'regle_donnees_techniques4', |
'regle_donnees_techniques4', |
2553 |
'regle_donnees_techniques5', |
'regle_donnees_techniques5', |
2554 |
); |
); |
2555 |
|
// Tableau des champs simple |
2556 |
|
$rule_type_simple = array( |
2557 |
|
"regle_dossier_instruction_type", |
2558 |
|
); |
2559 |
|
|
2560 |
// Définit le type du champ |
// Définit le type du champ |
2561 |
if (in_array($rule_name, $rule_type_date) == true) { |
if (in_array($rule_name, $rule_type_date) == true) { |
2576 |
if (in_array($rule_name, $rule_type_technical_data) === true) { |
if (in_array($rule_name, $rule_type_technical_data) === true) { |
2577 |
$type = 'text'; |
$type = 'text'; |
2578 |
} |
} |
2579 |
|
if (in_array($rule_name, $rule_type_simple) === true) { |
2580 |
|
$type = 'simple'; |
2581 |
|
} |
2582 |
|
|
2583 |
// Si c'est un type spécifique ou booléen alors il n'a qu'un opérande |
// Si c'est un type spécifique ou booléen alors il n'a qu'un opérande |
2584 |
// Récupère directement la valeur de l'opérande |
// Récupère directement la valeur de l'opérande |
2585 |
if ($type === 'specific' || $type === 'bool') { |
if ($type === 'specific') { |
2586 |
// |
// |
2587 |
return $this->get_value_for_rule($rule); |
return $this->get_value_for_rule($rule); |
2588 |
} |
} |
2657 |
// Retourne la chaîne de caractère |
// Retourne la chaîne de caractère |
2658 |
return $res_text; |
return $res_text; |
2659 |
} |
} |
2660 |
|
if ($type === 'simple' || $type === 'bool') { |
2661 |
|
// Retourne la valeur du champs rule |
2662 |
|
return $rule; |
2663 |
|
} |
2664 |
} |
} |
2665 |
|
|
2666 |
|
|
2703 |
$donnees_techniques = $this->getDonneesTechniques(); |
$donnees_techniques = $this->getDonneesTechniques(); |
2704 |
} |
} |
2705 |
// |
// |
2706 |
require_once "../obj/donnees_techniques.class.php"; |
$this->inst_donnees_techniques = $this->f->get_inst__om_dbform(array( |
2707 |
$this->inst_donnees_techniques = new donnees_techniques($donnees_techniques); |
"obj" => "donnees_techniques", |
2708 |
|
"idx" => $donnees_techniques, |
2709 |
|
)); |
2710 |
} |
} |
2711 |
// |
// |
2712 |
return $this->inst_donnees_techniques; |
return $this->inst_donnees_techniques; |
2724 |
$sql = "SELECT donnees_techniques |
$sql = "SELECT donnees_techniques |
2725 |
FROM ".DB_PREFIXE."donnees_techniques |
FROM ".DB_PREFIXE."donnees_techniques |
2726 |
WHERE dossier_instruction ='".$this->valF["dossier"]."'"; |
WHERE dossier_instruction ='".$this->valF["dossier"]."'"; |
2727 |
$donnees_techniques = $this->db->getOne($sql); |
$donnees_techniques = $this->f->db->getOne($sql); |
2728 |
$this->f->addToLog("getStatut() : db->getOne(\"".$sql."\")", VERBOSE_MODE); |
$this->f->addToLog("getStatut() : db->getOne(\"".$sql."\")", VERBOSE_MODE); |
2729 |
if ( database::isError($donnees_techniques)){ |
if ( database::isError($donnees_techniques)){ |
2730 |
die(); |
die(); |
2733 |
return $donnees_techniques; |
return $donnees_techniques; |
2734 |
} |
} |
2735 |
|
|
|
|
|
2736 |
/** |
/** |
2737 |
* TRIGGER - triggerajouterapres. |
* TRIGGER - triggerajouterapres. |
2738 |
* |
* |
2743 |
* |
* |
2744 |
* @return boolean |
* @return boolean |
2745 |
*/ |
*/ |
2746 |
function triggerajouterapres($id, &$db = null, $val = array(), $DEBUG = null) { |
function triggerajouterapres($id, &$dnu1 = null, $val = array(), $dnu2 = null) { |
2747 |
|
$this->addToLog(__METHOD__."(): start", EXTRA_VERBOSE_MODE); |
2748 |
|
|
2749 |
// On a besoin de l'instance du dossier lié à l'événement d'instruction |
// On a besoin de l'instance du dossier lié à l'événement d'instruction |
2750 |
$inst_di = $this->get_inst_dossier($this->valF['dossier']); |
$inst_di = $this->get_inst_dossier($this->valF['dossier']); |
|
|
|
2751 |
// Instance de la classe evenement |
// Instance de la classe evenement |
2752 |
$inst_evenement = $this->get_inst_evenement($this->valF['evenement']); |
$inst_evenement = $this->get_inst_evenement($this->valF['evenement']); |
2753 |
|
// Instance de l'état courant du dossier d'instruction |
2754 |
|
$inst_current_etat = $this->f->get_inst__om_dbform(array( |
2755 |
|
"obj" => "etat", |
2756 |
|
"idx" => $inst_di->get_id_etat(), |
2757 |
|
)); |
2758 |
|
|
2759 |
/** |
/** |
2760 |
* Mise à jour des valeurs du dossier en fonction des valeurs calculées |
* Mise à jour des valeurs du dossier en fonction des valeurs calculées |
2762 |
*/ |
*/ |
2763 |
// état de complétude actuel du dossier |
// état de complétude actuel du dossier |
2764 |
$incompletude = ($inst_di->getVal('incompletude') == 't' ? true : false); |
$incompletude = ($inst_di->getVal('incompletude') == 't' ? true : false); |
2765 |
|
// L'événement suivant tacite paramétré est destiné à la gestion de l'incomplétude |
2766 |
|
$ev_suiv_tacite_incompletude = false; |
2767 |
// Initialisation |
// Initialisation |
2768 |
$valF = ""; |
$valF = array(); |
2769 |
$valF_dt = ""; |
$valF_dt = array(); |
2770 |
// |
// |
|
if($incompletude === FALSE) { |
|
|
// Si l'événement d'instruction est de type incompletude |
|
|
if($inst_evenement->getVal('type') == "incompletude") { |
|
|
// On marque le dossier en incomplétude pour application des actions |
|
|
$incompletude = TRUE; |
|
|
// Set du flag incomplétude de la table dossier |
|
|
$valF['incompletude'] = TRUE; |
|
|
// Enregistrement de l'état dans la variable provisoire |
|
|
$valF['etat_pendant_incompletude'] = $this->valF['archive_etat']; |
|
|
} |
|
|
} else { |
|
|
// Si l'evenement d'instruction est de type retour ou contient une |
|
|
// decision, on sort d'incomplétude |
|
|
if($inst_evenement->getVal('type') == "retour" OR |
|
|
$inst_evenement->getVal('avis_decision') != NULL) { |
|
|
// On enlève la marque d'incomplétude pour application des actions |
|
|
$incompletude = FALSE; |
|
|
// On enlève le flag d'incomplétude sur l'enregistrement de la table dossier |
|
|
$valF['incompletude'] = FALSE; |
|
|
$valF['incomplet_notifie'] = FALSE; |
|
|
// Restauration de l'état depuis l'état provisoire |
|
|
$valF['etat'] = $this->valF['archive_etat_pendant_incompletude']; |
|
|
// On vide la variable provisoire ainsi que le délai de complétude |
|
|
// et la date limite de complétude |
|
|
$valF['etat_pendant_incompletude'] = NULL; |
|
|
$valF['delai_incompletude'] = NULL; |
|
|
$valF['date_limite_incompletude'] = NULL; |
|
|
$valF['evenement_suivant_tacite_incompletude'] = NULL; |
|
|
} |
|
|
} |
|
2771 |
// Récupération des paramètres de l'action |
// Récupération des paramètres de l'action |
2772 |
$sql = "SELECT * FROM ".DB_PREFIXE."action |
$sql = "SELECT * FROM ".DB_PREFIXE."action |
2773 |
WHERE action='".$this->valF['action']."'"; |
WHERE action='".$this->valF['action']."'"; |
2774 |
$res = $db->query($sql); |
$res = $this->f->db->query($sql); |
2775 |
$this->addToLog("triggerajouterapres(): db->query(\"".$sql."\");", VERBOSE_MODE); |
$this->addToLog(__METHOD__."(): db->query(\"".$sql."\");", VERBOSE_MODE); |
2776 |
if (database::isError($res)) { |
if (database::isError($res)) { |
2777 |
die($res->getMessage()); |
die($res->getMessage()); |
2778 |
} |
} |
2828 |
$valF['autorite_competente'] = $this->regle($row['regle_autorite_competente'], 'regle_autorite_competente'); |
$valF['autorite_competente'] = $this->regle($row['regle_autorite_competente'], 'regle_autorite_competente'); |
2829 |
} |
} |
2830 |
if ($row['regle_etat'] != '') { |
if ($row['regle_etat'] != '') { |
2831 |
// Si on est dans le cas général ou qu'on est en incomplétude et |
$valF['etat'] = $this->regle($row['regle_etat'], 'regle_etat'); |
|
// qu'on a un événement de type incomplétude alors : on stocke |
|
|
// l'état dans la variable courante |
|
|
if ($incompletude == FALSE OR $inst_evenement->getVal('type') == "incompletude") { |
|
|
$valF['etat'] = $this->regle($row['regle_etat'], 'regle_etat'); |
|
|
} else { |
|
|
$valF['etat_pendant_incompletude'] = $this->regle($row['regle_etat'], 'regle_etat'); |
|
|
} |
|
2832 |
} |
} |
2833 |
if ($row['regle_date_cloture_instruction'] !== '') { |
if ($row['regle_date_cloture_instruction'] !== '') { |
2834 |
$valF['date_cloture_instruction'] = $this->regle($row['regle_date_cloture_instruction'], 'regle_date_cloture_instruction'); |
$valF['date_cloture_instruction'] = $this->regle($row['regle_date_cloture_instruction'], 'regle_date_cloture_instruction'); |
2866 |
if ($row['regle_date_transmission_parquet'] !== '') { |
if ($row['regle_date_transmission_parquet'] !== '') { |
2867 |
$valF['date_transmission_parquet'] = $this->regle($row['regle_date_transmission_parquet'], 'regle_date_transmission_parquet'); |
$valF['date_transmission_parquet'] = $this->regle($row['regle_date_transmission_parquet'], 'regle_date_transmission_parquet'); |
2868 |
} |
} |
2869 |
|
if ($row['regle_dossier_instruction_type'] !== '') { |
2870 |
|
$valF['dossier_instruction_type'] = $this->regle($row['regle_dossier_instruction_type'], 'regle_dossier_instruction_type'); |
2871 |
|
} |
2872 |
|
// La date d'affichage est modifiée seulement si le champ n'est pas |
2873 |
|
// renseigné |
2874 |
|
if ($row['regle_date_affichage'] !== '' |
2875 |
|
&& ($inst_di->getVal('date_affichage') === '' |
2876 |
|
|| $inst_di->getVal('date_affichage') === null)) { |
2877 |
|
// |
2878 |
|
$valF['date_affichage'] = $this->regle($row['regle_date_affichage'], 'regle_date_affichage'); |
2879 |
|
} |
2880 |
|
// |
2881 |
|
if ($row['regle_pec_metier'] != '') { |
2882 |
|
$valF['pec_metier'] = $this->regle($row['regle_pec_metier'], 'regle_pec_metier'); |
2883 |
|
} |
2884 |
|
if ($row['regle_a_qualifier'] != '') { |
2885 |
|
$valF['a_qualifier'] = $this->regle($row['regle_a_qualifier'], 'regle_a_qualifier'); |
2886 |
|
} |
2887 |
|
// |
2888 |
|
if ($row['regle_incompletude'] != '') { |
2889 |
|
$valF['incompletude'] = $this->regle($row['regle_incompletude'], 'regle_incompletude'); |
2890 |
|
} |
2891 |
|
if ($row['regle_incomplet_notifie'] != '') { |
2892 |
|
$valF['incomplet_notifie'] = $this->regle($row['regle_incomplet_notifie'], 'regle_incomplet_notifie'); |
2893 |
|
} |
2894 |
|
if ($row['regle_etat_pendant_incompletude'] != '') { |
2895 |
|
$valF['etat_pendant_incompletude'] = $this->regle($row['regle_etat_pendant_incompletude'], 'regle_etat_pendant_incompletude'); |
2896 |
|
} |
2897 |
|
if ($row['regle_evenement_suivant_tacite_incompletude'] != '') { |
2898 |
|
$resti = $this->regle($row['regle_evenement_suivant_tacite_incompletude'], 'regle_evenement_suivant_tacite_incompletude'); |
2899 |
|
if (strtolower($resti) === 't' || strtolower($resti) === 'true') { |
2900 |
|
$ev_suiv_tacite_incompletude = true; |
2901 |
|
} |
2902 |
|
} |
2903 |
} |
} |
2904 |
|
|
2905 |
// Si l'événement a un événement suivant tacite |
// Si l'événement a un événement suivant tacite |
2906 |
if($inst_evenement->getVal('evenement_suivant_tacite') != '') { |
if($inst_evenement->getVal('evenement_suivant_tacite') != '') { |
2907 |
// Si le DI n'est pas en incomplétude, l'événement tacite est stocké |
// En fonction de l'action de l'événement, l'événement suivant tacite ne sera |
2908 |
// dans le champ evenement_suivant_tacite du dossier |
// pas associé de le même façon au dossier d'instruction |
2909 |
if ($incompletude == false OR $inst_evenement->getVal('type') != "incompletude") { |
if ($ev_suiv_tacite_incompletude === false) { |
|
// |
|
2910 |
$valF['evenement_suivant_tacite'] = $inst_evenement->getVal('evenement_suivant_tacite'); |
$valF['evenement_suivant_tacite'] = $inst_evenement->getVal('evenement_suivant_tacite'); |
2911 |
} else { |
} |
2912 |
// Sinon l'événement tacite est stocké dans le champ |
if ($ev_suiv_tacite_incompletude === true) { |
|
// evenement_suivant_tacite_incompletude du dossier |
|
2913 |
$valF['evenement_suivant_tacite_incompletude'] = $inst_evenement->getVal('evenement_suivant_tacite'); |
$valF['evenement_suivant_tacite_incompletude'] = $inst_evenement->getVal('evenement_suivant_tacite'); |
2914 |
} |
} |
2915 |
} |
} |
2916 |
// Si des valeurs de données techniques ont été calculées alors on met à jour l'enregistrement |
// Si des valeurs de données techniques ont été calculées alors on met à jour l'enregistrement |
2917 |
if ($valF_dt != "") { |
if (count($valF_dt) > 0) { |
2918 |
$dt_id = $this->getDonneesTechniques(); |
$dt_id = $this->getDonneesTechniques(); |
2919 |
// On met à jour le dossier |
// On met à jour le dossier |
2920 |
$cle = " donnees_techniques='".$dt_id."'"; |
$cle = " donnees_techniques='".$dt_id."'"; |
2921 |
$res1 = $db->autoExecute(DB_PREFIXE.'donnees_techniques', $valF_dt, DB_AUTOQUERY_UPDATE, $cle); |
$res1 = $this->f->db->autoExecute(DB_PREFIXE.'donnees_techniques', $valF_dt, DB_AUTOQUERY_UPDATE, $cle); |
2922 |
$this->addToLog("triggerajouterapres(): db->autoexecute(\"".DB_PREFIXE."donnees_techniques\", ".print_r($valF_dt, true).", DB_AUTOQUERY_UPDATE, \"".$cle."\");", VERBOSE_MODE); |
$this->addToLog(__METHOD__."(): db->autoexecute(\"".DB_PREFIXE."donnees_techniques\", ".print_r($valF_dt, true).", DB_AUTOQUERY_UPDATE, \"".$cle."\");", VERBOSE_MODE); |
2923 |
if (database::isError($res1)) { |
if (database::isError($res1)) { |
2924 |
die($res->getMessage()); |
die($res->getMessage()); |
2925 |
} |
} |
2926 |
// Affichage d'informations à l'utilisateur |
// Affichage d'informations à l'utilisateur |
2927 |
$this->addToMessage(_('enregistrement')." ".$this->valF['dossier']." "._('table')." dossier [".$db->affectedRows()." "._('enregistrement')." "._('mis_a_jour')."]"); |
$this->addToMessage(_('enregistrement')." ".$this->valF['dossier']." "._('table')." dossier [".$this->f->db->affectedRows()." "._('enregistrement')." "._('mis_a_jour')."]"); |
2928 |
} |
} |
2929 |
// 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 |
2930 |
if ($valF != "") { |
if (count($valF) > 0) { |
2931 |
// On met à jour le dossier |
// |
2932 |
$cle = " dossier='".$this->valF['dossier']."'"; |
$inst_dossier = $this->f->get_inst__om_dbform(array( |
2933 |
$res1 = $db->autoExecute(DB_PREFIXE.'dossier', $valF, DB_AUTOQUERY_UPDATE, $cle); |
"obj" => "dossier", |
2934 |
$this->addToLog("triggerajouterapres(): db->autoexecute(\"".DB_PREFIXE."dossier\", ".print_r($valF, true).", DB_AUTOQUERY_UPDATE, \"".$cle."\");", VERBOSE_MODE); |
"idx" => $this->valF['dossier'], |
2935 |
if (database::isError($res1)) { |
)); |
2936 |
die($res->getMessage()); |
$valF['instruction'] = $id; |
2937 |
|
$valF['crud'] = 'create'; |
2938 |
|
$update_by_instruction = $inst_dossier->update_by_instruction($valF); |
2939 |
|
if ($update_by_instruction === false) { |
2940 |
|
$this->cleanMessage(); |
2941 |
|
$this->addToMessage(sprintf('%s %s', __("Une erreur s'est produite lors de la mise à jour du dossier d'instruction."), __("Veuillez contacter votre administrateur."))); |
2942 |
|
return false; |
2943 |
} |
} |
2944 |
// Affichage d'informations à l'utilisateur |
// Affichage d'informations à l'utilisateur |
2945 |
$this->addToMessage(_('enregistrement')." ".$this->valF['dossier']." "._('table')." dossier [".$db->affectedRows()." "._('enregistrement')." "._('mis_a_jour')."]"); |
$this->addToMessage(_('enregistrement')." ".$this->valF['dossier']." "._('table')." dossier [".$this->f->db->affectedRows()." "._('enregistrement')." "._('mis_a_jour')."]"); |
2946 |
} |
} |
2947 |
|
|
2948 |
/** |
/** |
2978 |
$this->addToMessage(_("Notification (105) du référentiel ERP OK.")); |
$this->addToMessage(_("Notification (105) du référentiel ERP OK.")); |
2979 |
} |
} |
2980 |
|
|
2981 |
|
// Si le mode en rédaction intégrale est activé |
2982 |
|
if (isset($this->valF['flag_edition_integrale']) === true |
2983 |
|
&& $this->valF['flag_edition_integrale'] === true) { |
2984 |
|
$redactionIntegraleValF = array(); |
2985 |
|
|
2986 |
|
// Récupère la collectivite du dossier d'instruction |
2987 |
|
$dossier_instruction_om_collectivite = $this->get_dossier_instruction_om_collectivite(); |
2988 |
|
$collectivite = $this->f->getCollectivite($dossier_instruction_om_collectivite); |
2989 |
|
// Récupère le corps de la lettre type |
2990 |
|
$params = array( |
2991 |
|
"specific" => array( |
2992 |
|
"corps" => array( |
2993 |
|
"mode" => "get", |
2994 |
|
) |
2995 |
|
), |
2996 |
|
); |
2997 |
|
$result = $this->compute_pdf_output('lettretype', $this->valF['lettretype'], $collectivite, $id, $params); |
2998 |
|
$redactionIntegraleValF['corps_om_htmletatex'] = $result['pdf_output']; |
2999 |
|
// Récupère le titre de la lettre type |
3000 |
|
$params = array( |
3001 |
|
"specific" => array( |
3002 |
|
"titre" => array( |
3003 |
|
"mode" => "get", |
3004 |
|
) |
3005 |
|
), |
3006 |
|
); |
3007 |
|
$result = $this->compute_pdf_output('lettretype', $this->valF['lettretype'], $collectivite, $id, $params); |
3008 |
|
$redactionIntegraleValF['titre_om_htmletat'] = $result['pdf_output']; |
3009 |
|
|
3010 |
|
// mise à jour en base de données |
3011 |
|
$res = $this->f->db->autoExecute( |
3012 |
|
DB_PREFIXE.$this->table, |
3013 |
|
$redactionIntegraleValF, |
3014 |
|
DB_AUTOQUERY_UPDATE, |
3015 |
|
$this->clePrimaire."=".$id |
3016 |
|
); |
3017 |
|
$this->addToLog(__METHOD__."(): db->autoexecute(\"".DB_PREFIXE.'.'.$this->table."\", ".print_r($redactionIntegraleValF, true).", DB_AUTOQUERY_UPDATE, \"".$this->clePrimaire."=".$id."\");", VERBOSE_MODE); |
3018 |
|
if ($this->f->isDatabaseError($res, true) === true) { |
3019 |
|
return false; |
3020 |
|
} |
3021 |
|
} |
3022 |
|
|
3023 |
/** |
/** |
3024 |
* Mise à jour des données du DA. |
* Finalisation automatique de l'instruction si le paramétrage de l'événement l'autorise |
3025 |
*/ |
*/ |
3026 |
// |
// Si la finalisation automatique de l'événement est activée |
3027 |
$inst_da = $inst_di->get_inst_dossier_autorisation(); |
// ET si l'instruction n'a pas déjà été finalisée |
3028 |
// |
// ET s'il existe une lettre type associée |
3029 |
if ($inst_da->majDossierAutorisation() === false) { |
if ($inst_evenement->getVal('finaliser_automatiquement') === 't' |
3030 |
$this->addToMessage(_("Erreur lors de la mise a jour des donnees du dossier d'autorisation. Contactez votre administrateur.")); |
&& $inst_evenement->getVal('om_final_instruction') !== 't' |
3031 |
$this->correct = false; |
&& $inst_evenement->getVal('lettretype') !== '' |
3032 |
return false; |
&& $inst_evenement->getVal('lettretype') !== null) { |
3033 |
|
|
3034 |
|
// On instancie l'instruction |
3035 |
|
$inst_instruction = $this->f->get_inst__om_dbform(array( |
3036 |
|
"obj" => "instruction", |
3037 |
|
"idx" => $this->valF[$this->clePrimaire], |
3038 |
|
)); |
3039 |
|
|
3040 |
|
// On finalise l'instruction dans le contexte de finalisation : action 100 |
3041 |
|
$inst_instruction->setParameter('maj', 100); |
3042 |
|
$finalize = $inst_instruction->finalize($inst_instruction->valF); |
3043 |
|
|
3044 |
|
// Une erreur de finalisation renvoie 'false' : ajout dans les logs |
3045 |
|
// et dans le message d'erreur |
3046 |
|
if ($finalize === false) { |
3047 |
|
$this->f->addToLog(__METHOD__."() : ERROR - Impossible de finaliser l'instruction.", DEBUG_MODE); |
3048 |
|
$this->addToMessage(_("Erreur lors de la finalisation de l'instruction. Contactez votre administrateur.")); |
3049 |
|
return false; |
3050 |
|
} |
3051 |
} |
} |
3052 |
|
|
3053 |
/** |
/** |
3068 |
// retour |
// retour |
3069 |
// OU l'événement d'instruction est l'événement suivant tacite du |
// OU l'événement d'instruction est l'événement suivant tacite du |
3070 |
// dossier d'instruction (incomplétude prise en compte) |
// dossier d'instruction (incomplétude prise en compte) |
3071 |
if ($inst_evenement->getVal("retour") === 't' |
// ET l'événement d'instruction n'a pas déjà été finalisé |
3072 |
|
if (($inst_evenement->getVal("retour") === 't' |
3073 |
|| ($inst_di->getVal('evenement_suivant_tacite_incompletude') === $evenement_id |
|| ($inst_di->getVal('evenement_suivant_tacite_incompletude') === $evenement_id |
3074 |
|| $inst_di->getVal('evenement_suivant_tacite') === $evenement_id)) { |
|| $inst_di->getVal('evenement_suivant_tacite') === $evenement_id)) |
3075 |
|
&& ($inst_evenement->getVal('om_final_instruction') !== 't')) { |
3076 |
|
|
3077 |
// Finalise l'instruction |
// Finalise l'instruction |
3078 |
$inst_instruction = new instruction($this->valF[$this->clePrimaire], $this->f->db, 0); |
$inst_instruction = $this->f->get_inst__om_dbform(array( |
3079 |
|
"obj" => "instruction", |
3080 |
|
"idx" => $this->valF[$this->clePrimaire], |
3081 |
|
)); |
3082 |
$inst_instruction->setParameter('maj', 100); |
$inst_instruction->setParameter('maj', 100); |
3083 |
$finalize = $inst_instruction->finalize($inst_instruction->valF); |
$finalize = $inst_instruction->finalize($inst_instruction->valF); |
3084 |
if ($finalize === false) { |
if ($finalize === false) { |
3089 |
} |
} |
3090 |
|
|
3091 |
/** |
/** |
3092 |
|
* Mise à jour de la version de clôture *version_clos* du dossier si et |
3093 |
|
* seulement si l'instruction met à jour l'état du dossier. |
3094 |
|
*/ |
3095 |
|
if (isset($valF['etat']) === true |
3096 |
|
&& $valF['etat'] !== null |
3097 |
|
&& $valF['etat'] !== '') { |
3098 |
|
// Instanciation de l'état appliqué sur le dossier par l'instruction |
3099 |
|
$inst_etat = $this->f->get_inst__om_dbform(array( |
3100 |
|
"obj" => "etat", |
3101 |
|
"idx" => $valF['etat'], |
3102 |
|
)); |
3103 |
|
// |
3104 |
|
$update_version_clos = null; |
3105 |
|
// En cas d'instruction qui clôture le dossier |
3106 |
|
if ($inst_etat->getVal('statut') === 'cloture') { |
3107 |
|
$update_version_clos = $inst_di->update_version_clos('up'); |
3108 |
|
} |
3109 |
|
// En cas d'instruction qui rouvre le dossier |
3110 |
|
if ($inst_current_etat->getVal('statut') === 'cloture' |
3111 |
|
&& $inst_etat->getVal('statut') !== 'cloture') { |
3112 |
|
// |
3113 |
|
$update_version_clos = $inst_di->update_version_clos('down'); |
3114 |
|
// |
3115 |
|
$params = array( |
3116 |
|
'di_reopened' => true, |
3117 |
|
); |
3118 |
|
} |
3119 |
|
// |
3120 |
|
if ($update_version_clos === false) { |
3121 |
|
$this->f->addToLog(sprintf( |
3122 |
|
"%s() : ERREUR - %s %s", |
3123 |
|
__METHOD__, |
3124 |
|
sprintf( |
3125 |
|
__("Impossible de mettre à jour la version de clôture du dossier d'instruction %s."), |
3126 |
|
$inst_di->getVal($inst_di->clePrimaire) |
3127 |
|
), |
3128 |
|
sprintf( |
3129 |
|
__("L'instruction tente d'appliquer l'état %s."), |
3130 |
|
$inst_etat->getVal($inst_etat->clePrimaire) |
3131 |
|
) |
3132 |
|
)); |
3133 |
|
$this->addToMessage(sprintf( |
3134 |
|
"%s %s", |
3135 |
|
__("Erreur lors de la mise à jour de la version de clôture du dossier d'instruction."), |
3136 |
|
__("Veuillez contacter votre administrateur.") |
3137 |
|
)); |
3138 |
|
return false; |
3139 |
|
} |
3140 |
|
} |
3141 |
|
|
3142 |
|
/** |
3143 |
|
* Notification automatique |
3144 |
|
*/ |
3145 |
|
// Notification automatique à l'ajout de l'instruction si la notification |
3146 |
|
// automatique est choisie et qu'il n'y a pas de lettretype associée à l'événement |
3147 |
|
if ($inst_evenement->getVal('notification') === 'notification_automatique' && |
3148 |
|
($inst_evenement->getVal('lettretype') === null || |
3149 |
|
$inst_evenement->getVal('lettretype') === '')) { |
3150 |
|
// Récupération de la liste des demandeurs à notifier et de la catégorie |
3151 |
|
$categorie = $this->f->get_param_option_notification($collectivite_di); |
3152 |
|
$isPortal = $categorie == null || $categorie == '' || $categorie == 'portal' ? true : false; |
3153 |
|
$demandeursANotifie = $this->get_demandeurs_notifiable( |
3154 |
|
$this->valF['dossier'], |
3155 |
|
$isPortal |
3156 |
|
); |
3157 |
|
|
3158 |
|
// Création d'une notification et d'une tâche pour chaque demandeur à notifier |
3159 |
|
foreach ($demandeursANotifie as $demandeur) { |
3160 |
|
// Ajout de la notif et récupération de son id |
3161 |
|
$idNotif = $this->ajouter_notification( |
3162 |
|
$this->valF[$this->clePrimaire], |
3163 |
|
$this->f->get_connected_user_login_name(), |
3164 |
|
$demandeur, |
3165 |
|
$collectivite_di, |
3166 |
|
true |
3167 |
|
); |
3168 |
|
if ($idNotif === false) { |
3169 |
|
return false; |
3170 |
|
} |
3171 |
|
// Création de la tache en lui donnant l'id de la notification |
3172 |
|
$notification_by_task = $this->notification_by_task( |
3173 |
|
$idNotif, |
3174 |
|
$this->valF['dossier'], |
3175 |
|
$categorie |
3176 |
|
); |
3177 |
|
if ($notification_by_task === false) { |
3178 |
|
$this->addToMessage( |
3179 |
|
__("Erreur lors de la génération de la notification au(x) pétitionnaire(s).") |
3180 |
|
); |
3181 |
|
return false; |
3182 |
|
} |
3183 |
|
} |
3184 |
|
$this->addToMessage($message = sprintf('%s<br/>%s', __("La notification a été générée."), __("Le suivi de la notification est disponible depuis l'instruction."))); |
3185 |
|
} |
3186 |
|
|
3187 |
|
/** |
3188 |
|
* Mise à jour de la date de dernière modification du dossier |
3189 |
|
*/ |
3190 |
|
$inst_di->update_last_modification_date(); |
3191 |
|
|
3192 |
|
/** |
3193 |
|
* Mise à jour des données du DA. |
3194 |
|
*/ |
3195 |
|
$inst_da = $inst_di->get_inst_dossier_autorisation(); |
3196 |
|
$params['di_id'] = $this->valF['dossier']; |
3197 |
|
if ($inst_da->majDossierAutorisation($params) === false) { |
3198 |
|
$this->addToMessage(_("Erreur lors de la mise a jour des donnees du dossier d'autorisation. Contactez votre administrateur.")); |
3199 |
|
$this->correct = false; |
3200 |
|
return false; |
3201 |
|
} |
3202 |
|
|
3203 |
|
/** |
3204 |
* Historisation de la vie du DI. |
* Historisation de la vie du DI. |
3205 |
*/ |
*/ |
3206 |
// |
// |
3207 |
return $this->add_log_to_dossier($id, array_merge($val, $this->valF)); |
return $this->add_log_to_dossier($id, array_merge($val, $this->valF)); |
3208 |
} |
} |
3209 |
|
|
3210 |
function triggermodifierapres($id, &$db = null, $val = array(), $DEBUG = null) { |
|
3211 |
|
public function is_service_notifiable() { |
3212 |
|
$evenement = $this->get_inst_evenement($this->getVal('evenement')); |
3213 |
|
|
3214 |
|
// Si l'instruction a une édition non finalisé quel que soit |
3215 |
|
// le type de notification, il n'est pas notifiable |
3216 |
|
if ($this->has_an_edition() === true) { |
3217 |
|
if ($this->is_unfinalizable_without_bypass() === false) { |
3218 |
|
return false; |
3219 |
|
} |
3220 |
|
} |
3221 |
|
// Vérifie si la notification des tiers est active pour l'évènement |
3222 |
|
return $this->get_boolean_from_pgsql_value($evenement->getVal('notification_service')); |
3223 |
|
} |
3224 |
|
|
3225 |
|
public function is_tiers_notifiable() { |
3226 |
|
$evenement = $this->get_inst_evenement($this->getVal('evenement')); |
3227 |
|
|
3228 |
|
// Si l'instruction a une édition non finalisé quel que soit |
3229 |
|
// le type de notification, il n'est pas notifiable |
3230 |
|
if ($this->has_an_edition() === true) { |
3231 |
|
if ($this->is_unfinalizable_without_bypass() === false) { |
3232 |
|
return false; |
3233 |
|
} |
3234 |
|
} |
3235 |
|
// Vérifie si la notification des tiers est active pour l'évènement |
3236 |
|
return $this->get_boolean_from_pgsql_value($evenement->getVal('notification_tiers')); |
3237 |
|
} |
3238 |
|
|
3239 |
|
public function is_notifiable_by_task_manual() { |
3240 |
|
$ev = $this->get_inst_evenement($this->getVal('evenement')); |
3241 |
|
|
3242 |
|
// Si l'instruction a une édition non finalisé quel que soit |
3243 |
|
// le type de notification, il n'est pas notifiable |
3244 |
|
if ($this->has_an_edition() === true) { |
3245 |
|
if ($this->is_unfinalizable_without_bypass() === false) { |
3246 |
|
return false; |
3247 |
|
} |
3248 |
|
} |
3249 |
|
|
3250 |
|
// Gestion des différents cas selon la valeur du champs notification |
3251 |
|
switch ($ev->getVal('notification')) { |
3252 |
|
case 'notification_manuelle': |
3253 |
|
return true; |
3254 |
|
case 'notification_manuelle_annexe': |
3255 |
|
return true; |
3256 |
|
case 'notification_automatique': |
3257 |
|
return false; |
3258 |
|
case 'notification_auto_signature_requise': |
3259 |
|
return false; |
3260 |
|
case 'notification_manuelle_signature_requise': |
3261 |
|
// Si il y a une date de retour de signature la notification est possible |
3262 |
|
if ($this->getVal('date_retour_signature') === null |
3263 |
|
|| $this->getVal('date_retour_signature') === '') { |
3264 |
|
return false; |
3265 |
|
} |
3266 |
|
return true; |
3267 |
|
case 'notification_manuelle_annexe_signature_requise': |
3268 |
|
// Si il y a une date de retour de signature la notification est possible |
3269 |
|
if ($this->getVal('date_retour_signature') === null |
3270 |
|
|| $this->getVal('date_retour_signature') === '') { |
3271 |
|
return false; |
3272 |
|
} |
3273 |
|
return true; |
3274 |
|
default: |
3275 |
|
return false; |
3276 |
|
} |
3277 |
|
} |
3278 |
|
|
3279 |
|
/** |
3280 |
|
* Crée une instance et une tache de notification pour le demandeur |
3281 |
|
* principal. |
3282 |
|
* |
3283 |
|
* @return boolean true si le traitement à réussi |
3284 |
|
*/ |
3285 |
|
protected function notifier_demandeur_principal() { |
3286 |
|
$this->begin_treatment(__METHOD__); |
3287 |
|
$message = ''; |
3288 |
|
// Récupération des informations concernant le demandeur |
3289 |
|
$dossier = $this->getVal('dossier'); |
3290 |
|
$collectivite_di = $this->get_dossier_instruction_om_collectivite($dossier); |
3291 |
|
$demandeur = $this->get_demandeurs_notifiable( |
3292 |
|
$dossier, |
3293 |
|
true |
3294 |
|
); |
3295 |
|
if ($demandeur !== array()) { |
3296 |
|
$destinataire = array_values($demandeur); |
3297 |
|
// Ajout de la notif et récupération de son id |
3298 |
|
$idNotification = $this->ajouter_notification( |
3299 |
|
$this->getVal($this->clePrimaire), |
3300 |
|
$this->f->get_connected_user_login_name(), |
3301 |
|
$destinataire[0], |
3302 |
|
$collectivite_di, |
3303 |
|
true |
3304 |
|
); |
3305 |
|
if ($idNotification === false) { |
3306 |
|
return $this->end_treatment(__METHOD__, false); |
3307 |
|
} |
3308 |
|
// Création de la tâche en lui donnant l'id de la notification |
3309 |
|
$notification_by_task = $this->notification_by_task($idNotification, $dossier); |
3310 |
|
if ($notification_by_task === false) { |
3311 |
|
$this->addToMessage( |
3312 |
|
__("Erreur lors de la génération de la notification au(x) pétitionnaire(s).") |
3313 |
|
); |
3314 |
|
return $this->end_treatment(__METHOD__, false); |
3315 |
|
} |
3316 |
|
$this->addToMessage($message .= sprintf('%s<br/>%s', __("La notification a été générée."), __("Le suivi de la notification est disponible depuis l'instruction."))); |
3317 |
|
return $this->end_treatment(__METHOD__, true); |
3318 |
|
} |
3319 |
|
$this->addToMessage( __("Le demandeur principal n'est pas notifiable.")); |
3320 |
|
return $this->end_treatment(__METHOD__, true); |
3321 |
|
} |
3322 |
|
|
3323 |
|
public function notification_by_task($object_id, $dossier, $category = null, $type = null) { |
3324 |
|
// Par défaut le type est portal |
3325 |
|
if ($category === null) { |
3326 |
|
$category = 'portal'; |
3327 |
|
} |
3328 |
|
// Si le type n'est pas correctement spécifié, alors il est calculé |
3329 |
|
if ($type !== 'notification_recepisse' |
3330 |
|
&& $type !== 'notification_instruction' |
3331 |
|
&& $type !== 'notification_decision' |
3332 |
|
&& $type !== 'notification_service_consulte' |
3333 |
|
&& $type !== 'notification_tiers_consulte') { |
3334 |
|
// |
3335 |
|
$type = 'notification_instruction'; |
3336 |
|
// Vérifie si l'instruction est un récépissé |
3337 |
|
$trace = debug_backtrace(); |
3338 |
|
foreach ($trace as $key => $value) { |
3339 |
|
if (isset($trace[$key]['class']) === true |
3340 |
|
&& empty($trace[$key]['class']) === false) { |
3341 |
|
// |
3342 |
|
if (strtolower($trace[$key]['class']) === 'demande') { |
3343 |
|
$type = 'notification_recepisse'; |
3344 |
|
} |
3345 |
|
} |
3346 |
|
} |
3347 |
|
// Vérifie si l'instruction est une décision |
3348 |
|
if ($type !== 'notification_recepisse') { |
3349 |
|
$avis_decision = $this->getVal('avis_decision') !== null ? $this->getVal('avis_decision') : $this->valF['avis_decision']; |
3350 |
|
if ($avis_decision !== null && $avis_decision !== '') { |
3351 |
|
$type = 'notification_decision'; |
3352 |
|
} |
3353 |
|
} |
3354 |
|
} |
3355 |
|
// Préparation de la tache de notification |
3356 |
|
$inst_task = $this->f->get_inst__om_dbform(array( |
3357 |
|
"obj" => "task", |
3358 |
|
"idx" => 0, |
3359 |
|
)); |
3360 |
|
$task_val = array( |
3361 |
|
'type' => $type, |
3362 |
|
'object_id' => $object_id, |
3363 |
|
'dossier' => $dossier, |
3364 |
|
'category' => $category, |
3365 |
|
); |
3366 |
|
|
3367 |
|
$add_task = $inst_task->add_task(array('val' => $task_val)); |
3368 |
|
if ($add_task === false) { |
3369 |
|
return false; |
3370 |
|
} |
3371 |
|
|
3372 |
|
return true; |
3373 |
|
} |
3374 |
|
|
3375 |
|
/** |
3376 |
|
* A partir des informations passée en argument ajoute un nouvel élément |
3377 |
|
* dans la table instruction_notification. |
3378 |
|
* Avant l'ajout vérifie en utilisant l'id de la collectivité passée en |
3379 |
|
* paramètre si le paramétrage attendus est ok. |
3380 |
|
* Ajoute également un nouvel élement dans instruction_notification_document |
3381 |
|
* si l'instruction possède une lettretype. |
3382 |
|
* Si un identifiant d'une instruction annexe est donnée ajoute un deuxième |
3383 |
|
* élement dans la table instruction_notification_document qui correspondra |
3384 |
|
* à l'annexe de la notification. |
3385 |
|
* |
3386 |
|
* @param integer identifiant de l'instruction notifiée |
3387 |
|
* @param string information concernant l'emetteur |
3388 |
|
* @param array tableau contenant 2 entrées |
3389 |
|
* - destinatire : nom, prenom ou raison sociale, dénomination et courriel |
3390 |
|
* - courriel : adresse mail de la personne à notifier |
3391 |
|
* @param integer identifiant de la collectivité permettant de récupèrer les |
3392 |
|
* paramètres à valider |
3393 |
|
* @param boolean indique si la notification est automatique ou manuelle |
3394 |
|
* @param integer identifiant d'une instruction dont l'édition sera annexé |
3395 |
|
* à la notification |
3396 |
|
* |
3397 |
|
* @return integer|boolean identifiant de la notification créée si le traitement |
3398 |
|
* a réussie, false sinon. |
3399 |
|
*/ |
3400 |
|
protected function ajouter_notification( |
3401 |
|
$idInstruction, |
3402 |
|
$emetteur, |
3403 |
|
$destinataire, |
3404 |
|
$collectiviteId, |
3405 |
|
$demandeAuto = false, |
3406 |
|
$idInstrDocAnnexe = null |
3407 |
|
) { |
3408 |
|
// Vérification que les paramètres nécessaires à l'envoi de la notification existe avant |
3409 |
|
// de créer la notification |
3410 |
|
if (! $this->is_parametrage_notification_correct($collectiviteId)) { |
3411 |
|
$this->addToMessage(__("Erreur de paramétrage. L'url d'accès au(x) document(s) notifié(s) n'est pas paramétrée.")); |
3412 |
|
return false; |
3413 |
|
} |
3414 |
|
// Préparation de la notification |
3415 |
|
$inst_notif = $this->f->get_inst__om_dbform(array( |
3416 |
|
"obj" => "instruction_notification", |
3417 |
|
"idx" => "]", |
3418 |
|
)); |
3419 |
|
$notif_val = array( |
3420 |
|
'instruction_notification' => null, |
3421 |
|
'instruction' => $idInstruction, |
3422 |
|
'automatique' => $demandeAuto, |
3423 |
|
'emetteur' => $emetteur, |
3424 |
|
'date_envoi' => null, |
3425 |
|
'destinataire' => $destinataire['destinataire'], |
3426 |
|
'courriel' => $destinataire['courriel'], |
3427 |
|
'date_premier_acces' => null, |
3428 |
|
'statut' => 'en cours d\'envoi', |
3429 |
|
'commentaire' => 'Notification en cours de traitement' |
3430 |
|
); |
3431 |
|
|
3432 |
|
// Création de la notification |
3433 |
|
$add_notif = $inst_notif->ajouter($notif_val); |
3434 |
|
if ($add_notif === false) { |
3435 |
|
$this->addToMessage(__("Erreur lors de la génération de la notification au(x) pétitionnaire(s).")); |
3436 |
|
return false; |
3437 |
|
} |
3438 |
|
|
3439 |
|
// Si il y a une lettretype finalisé stockage de la clé d'accès au documents |
3440 |
|
if ($this->evenement_has_an_edition($this->getVal('evenement')) === true) { |
3441 |
|
$add_notif_doc = $this->ajouter_notification_document_instruction( |
3442 |
|
$this->getVal($this->clePrimaire), |
3443 |
|
$inst_notif->getVal($inst_notif->clePrimaire) |
3444 |
|
); |
3445 |
|
if ($add_notif_doc === false) { |
3446 |
|
$this->addToMessage(__("Erreur lors de la génération de la notification du document.")); |
3447 |
|
return false; |
3448 |
|
} |
3449 |
|
} |
3450 |
|
// Si une annexe a été choisie stockage de la clé d'accès à l'annexe |
3451 |
|
if ($idInstrDocAnnexe != null || $idInstrDocAnnexe != '') { |
3452 |
|
$add_notif_annexe = $this->ajouter_notification_document_instruction( |
3453 |
|
$idInstrDocAnnexe, |
3454 |
|
$inst_notif->getVal($inst_notif->clePrimaire), |
3455 |
|
true |
3456 |
|
); |
3457 |
|
if ($add_notif_annexe === false) { |
3458 |
|
$this->addToMessage(__("Erreur lors de la génération de la notification de l'annexe.")); |
3459 |
|
return false; |
3460 |
|
} |
3461 |
|
} |
3462 |
|
|
3463 |
|
// Renvoie l'id de la nouvelle instance de instruction_notification |
3464 |
|
return $inst_notif->getVal($inst_notif->clePrimaire); |
3465 |
|
} |
3466 |
|
|
3467 |
|
/** |
3468 |
|
* A partir des informations passée en argument ajoute un nouvel élément |
3469 |
|
* dans la table instruction_notification. |
3470 |
|
* Ajoute également un nouvel élement dans instruction_notification_document |
3471 |
|
* si l'instruction possède une lettretype. |
3472 |
|
* |
3473 |
|
* @param integer identifiant de l'instruction notifiée |
3474 |
|
* @param string information concernant l'emetteur |
3475 |
|
* @param array tableau contenant 2 entrées |
3476 |
|
* - destinatire : nom, prenom ou raison sociale, dénomination et courriel |
3477 |
|
* - courriel : adresse mail de la personne à notifier |
3478 |
|
* @param boolean indique si la notification est automatique ou manuelle |
3479 |
|
* |
3480 |
|
* @return integer|boolean identifiant de la notification créée si le traitement |
3481 |
|
* a réussie, false sinon. |
3482 |
|
*/ |
3483 |
|
protected function ajouter_notification_sans_annexe( |
3484 |
|
$idInstruction, |
3485 |
|
$emetteur, |
3486 |
|
$destinataire, |
3487 |
|
$demandeAuto = false |
3488 |
|
) { |
3489 |
|
// Préparation de la notification |
3490 |
|
$inst_notif = $this->f->get_inst__om_dbform(array( |
3491 |
|
"obj" => "instruction_notification", |
3492 |
|
"idx" => "]", |
3493 |
|
)); |
3494 |
|
$notif_val = array( |
3495 |
|
'instruction_notification' => null, |
3496 |
|
'instruction' => $idInstruction, |
3497 |
|
'automatique' => $demandeAuto, |
3498 |
|
'emetteur' => $emetteur, |
3499 |
|
'date_envoi' => null, |
3500 |
|
'destinataire' => $destinataire['destinataire'], |
3501 |
|
'courriel' => $destinataire['courriel'], |
3502 |
|
'date_premier_acces' => null, |
3503 |
|
'statut' => 'en cours d\'envoi', |
3504 |
|
'commentaire' => 'Notification en cours de traitement' |
3505 |
|
); |
3506 |
|
|
3507 |
|
// Création de la notification |
3508 |
|
$add_notif = $inst_notif->ajouter($notif_val); |
3509 |
|
if ($add_notif === false) { |
3510 |
|
$this->addToMessage(__("Erreur lors de la génération de la notification au(x) pétitionnaire(s).")); |
3511 |
|
return false; |
3512 |
|
} |
3513 |
|
|
3514 |
|
// Si il y a une lettretype finalisé stockage de la clé d'accès au documents |
3515 |
|
if ($this->evenement_has_an_edition($this->getVal('evenement')) === true) { |
3516 |
|
$add_notif_doc = $this->ajouter_notification_document_instruction( |
3517 |
|
$this->getVal($this->clePrimaire), |
3518 |
|
$inst_notif->getVal($inst_notif->clePrimaire) |
3519 |
|
); |
3520 |
|
if ($add_notif_doc === false) { |
3521 |
|
$this->addToMessage(__("Erreur lors de la génération de la notification du document.")); |
3522 |
|
return false; |
3523 |
|
} |
3524 |
|
} |
3525 |
|
// Renvoie l'id de la nouvelle instance de instruction_notification |
3526 |
|
return $inst_notif->getVal($inst_notif->clePrimaire); |
3527 |
|
} |
3528 |
|
|
3529 |
|
/** |
3530 |
|
* Pour chaque élément du tableau passé en paramètre ajoute une nouvelle |
3531 |
|
* instance dans la table instruction_notification_document lié a la |
3532 |
|
* notification dont l'id est passé en paramètre. |
3533 |
|
* |
3534 |
|
* @param array tableau contenant les informations nécessaires pour créer les annexes |
3535 |
|
* |
3536 |
|
* @return integer|boolean identifiant de la notification créée si le traitement |
3537 |
|
* a réussie, false sinon. |
3538 |
|
*/ |
3539 |
|
protected function ajouter_notification_document_multiple($idNotification, $listeDocument) { |
3540 |
|
foreach ($listeDocument as $idDoc => $paramDoc) { |
3541 |
|
if (! $this->ajouter_notification_document($idNotification, $idDoc, $paramDoc['tableDocument'], $paramDoc['isAnnexe'])) { |
3542 |
|
$this->addToMessage(__("Erreur lors de la génération des documents à notifier.")); |
3543 |
|
return false; |
3544 |
|
} |
3545 |
|
} |
3546 |
|
return true; |
3547 |
|
} |
3548 |
|
|
3549 |
|
/** |
3550 |
|
* Ajoute un élément dans la table instruction_notification_document en utilisant |
3551 |
|
* les éléments fourni en paramètre |
3552 |
|
* |
3553 |
|
* @param integer $idNotification : id de la notification à laquelle on associe le document |
3554 |
|
* @param integer $idDocument : id de l'objet auquel est rattaché le document |
3555 |
|
* @param string $tableDocument : nom de la table a laquelle est rattaché le document |
3556 |
|
* @param boolean $isAnnexe : indique si le document est une annexe ou pas |
3557 |
|
* |
3558 |
|
* @return boolean indique si le traitement a réussi |
3559 |
|
*/ |
3560 |
|
protected function ajouter_notification_document($idNotification, $idDocument, $tableDocument, $isAnnexe = false) { |
3561 |
|
$inst_notif_doc = $this->f->get_inst__om_dbform(array( |
3562 |
|
"obj" => "instruction_notification_document", |
3563 |
|
"idx" => "]", |
3564 |
|
)); |
3565 |
|
// l'attribut instruction doit obligatoirement être renseigné |
3566 |
|
// pour éviter toutes confusion avec d'autres instruction l'id |
3567 |
|
// 0 est donné au document n'appartenant pas aux instructions |
3568 |
|
$notif_doc_val = array( |
3569 |
|
'instruction_notification_document' => null, |
3570 |
|
'instruction_notification' => $idNotification, |
3571 |
|
'instruction' => $tableDocument == 'instruction' ? $idDocument : 0, |
3572 |
|
'document_type' => $tableDocument, |
3573 |
|
'document_id' => $idDocument, |
3574 |
|
'cle' => $this->getCleAccesDocument(), |
3575 |
|
'annexe' => $isAnnexe |
3576 |
|
); |
3577 |
|
|
3578 |
|
$add_notif_doc = $inst_notif_doc->ajouter($notif_doc_val); |
3579 |
|
if ($add_notif_doc === false) { |
3580 |
|
return false; |
3581 |
|
} |
3582 |
|
return true; |
3583 |
|
} |
3584 |
|
|
3585 |
|
/** |
3586 |
|
* Vérifie si le paramétrage de la notification des demandeurs est correct. |
3587 |
|
* |
3588 |
|
* @param integer identifiant de la collectivité |
3589 |
|
* @return boolean |
3590 |
|
*/ |
3591 |
|
protected function is_parametrage_notification_correct($collectiviteId) { |
3592 |
|
$categorie = $this->f->get_param_option_notification($collectiviteId); |
3593 |
|
$urlAccesNotif = $this->f->get_parametre_notification_url_acces($collectiviteId); |
3594 |
|
if ($categorie == 'mail' && $urlAccesNotif == null) { |
3595 |
|
return false; |
3596 |
|
} |
3597 |
|
return true; |
3598 |
|
} |
3599 |
|
|
3600 |
|
/** |
3601 |
|
* Ajoute un élément dans la table instruction_notification_document. |
3602 |
|
* Ne permet d'ajouter que des documents de notification lié à la table instruction |
3603 |
|
* |
3604 |
|
* TODO : supprimer cette méthode pour en faire une générique a la place |
3605 |
|
* |
3606 |
|
* @param integer $idInstruction : id de l'instruction à laquelle est rattaché le document |
3607 |
|
* @param integer $idNotification : id de la notification à laquelle on associe le document |
3608 |
|
* @param boolean $isAnnexe : indique si le document est une annexe ou pas |
3609 |
|
* |
3610 |
|
* @return boolean indique si le traitement a réussi |
3611 |
|
*/ |
3612 |
|
protected function ajouter_notification_document_instruction($idInstruction, $idNotification, $isAnnexe = false) { |
3613 |
|
$inst_notif_doc = $this->f->get_inst__om_dbform(array( |
3614 |
|
"obj" => "instruction_notification_document", |
3615 |
|
"idx" => "]", |
3616 |
|
)); |
3617 |
|
$notif_doc_val = array( |
3618 |
|
'instruction_notification_document' => null, |
3619 |
|
'instruction_notification' => $idNotification, |
3620 |
|
'instruction' => $idInstruction, |
3621 |
|
'document_type' => 'instruction', |
3622 |
|
'document_id' => $idInstruction, |
3623 |
|
'cle' => $this->getCleAccesDocument(), |
3624 |
|
'annexe' => $isAnnexe |
3625 |
|
); |
3626 |
|
|
3627 |
|
$add_notif_doc = $inst_notif_doc->ajouter($notif_doc_val); |
3628 |
|
if ($add_notif_doc === false) { |
3629 |
|
return false; |
3630 |
|
} |
3631 |
|
return true; |
3632 |
|
} |
3633 |
|
|
3634 |
|
/** |
3635 |
|
* TRIGGER - triggermodifierapres. |
3636 |
|
* |
3637 |
|
* @return boolean |
3638 |
|
*/ |
3639 |
|
function triggermodifierapres($id, &$dnu1 = null, $val = array(), $dnu2 = null) { |
3640 |
|
$this->addToLog(__METHOD__."(): start", EXTRA_VERBOSE_MODE); |
3641 |
|
$collectivite_di = $this->get_dossier_instruction_om_collectivite($val['dossier']); |
3642 |
|
$message = ''; |
3643 |
/** |
/** |
3644 |
* 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 |
3645 |
* si la date de l'evenement est modifiee |
* si la date de l'evenement est modifiee |
3646 |
*/ |
*/ |
3647 |
// Initialisation |
// Initialisation |
3648 |
$valF = ""; |
$valF = array(); |
3649 |
$valF_dt = ""; |
$valF_dt = array(); |
3650 |
// Initialisation du type d'événement |
// Initialisation du type d'événement |
3651 |
$type_evmt = ""; |
$type_evmt = ""; |
3652 |
// Récupération de l'action correspondante à l'événement |
// Récupération de l'action correspondante à l'événement |
3653 |
$sql = "SELECT action |
$sql = "SELECT action |
3654 |
FROM ".DB_PREFIXE."evenement |
FROM ".DB_PREFIXE."evenement |
3655 |
WHERE evenement=".$this->valF['evenement']; |
WHERE evenement=".$this->valF['evenement']; |
3656 |
$action = $db->getOne($sql); |
$action = $this->f->db->getOne($sql); |
3657 |
$this->addToLog("triggermodifierapres(): db->getone(\"".$sql."\");", VERBOSE_MODE); |
$this->addToLog(__METHOD__."(): db->getone(\"".$sql."\");", VERBOSE_MODE); |
3658 |
if (database::isError($action)) { |
if (database::isError($action)) { |
3659 |
die($action->getMessage()); |
die($action->getMessage()); |
3660 |
} |
} |
3662 |
// Récupération des paramètres de l'action |
// Récupération des paramètres de l'action |
3663 |
$sql = "SELECT * FROM ".DB_PREFIXE."action |
$sql = "SELECT * FROM ".DB_PREFIXE."action |
3664 |
WHERE action='".$action."'"; |
WHERE action='".$action."'"; |
3665 |
$res = $db->query($sql); |
$res = $this->f->db->query($sql); |
3666 |
$this->addToLog("triggermodifierapres(): db->query(\"".$sql."\");", VERBOSE_MODE); |
$this->addToLog(__METHOD__."(): db->query(\"".$sql."\");", VERBOSE_MODE); |
3667 |
if (database::isError($res)) { |
if (database::isError($res)) { |
3668 |
die($res->getMessage()); |
die($res->getMessage()); |
3669 |
} |
} |
3735 |
if ($row['regle_donnees_techniques5'] !== '') { |
if ($row['regle_donnees_techniques5'] !== '') { |
3736 |
$valF_dt[$row['cible_regle_donnees_techniques5']] = $this->regle($row['regle_donnees_techniques5'], 'regle_donnees_techniques5'); |
$valF_dt[$row['cible_regle_donnees_techniques5']] = $this->regle($row['regle_donnees_techniques5'], 'regle_donnees_techniques5'); |
3737 |
} |
} |
3738 |
|
if ($row['regle_dossier_instruction_type'] !== '') { |
3739 |
|
$valF['dossier_instruction_type'] = $this->regle($row['regle_dossier_instruction_type'], 'regle_dossier_instruction_type'); |
3740 |
|
} |
3741 |
} |
} |
3742 |
// Si des valeurs de données techniques ont été calculées alors on met à jour l'enregistrement |
// Si des valeurs de données techniques ont été calculées alors on met à jour l'enregistrement |
3743 |
if ($valF_dt != "") { |
if (count($valF_dt) > 0) { |
3744 |
$dt_id = $this->getDonneesTechniques(); |
$dt_id = $this->getDonneesTechniques(); |
3745 |
// On met à jour le dossier |
// On met à jour le dossier |
3746 |
$cle = " donnees_techniques='".$dt_id."'"; |
$cle = " donnees_techniques='".$dt_id."'"; |
3747 |
$res1 = $db->autoExecute(DB_PREFIXE.'donnees_techniques', $valF_dt, DB_AUTOQUERY_UPDATE, $cle); |
$res1 = $this->f->db->autoExecute(DB_PREFIXE.'donnees_techniques', $valF_dt, DB_AUTOQUERY_UPDATE, $cle); |
3748 |
$this->addToLog("triggerajouterapres(): db->autoexecute(\"".DB_PREFIXE."donnees_techniques\", ".print_r($valF_dt, true).", DB_AUTOQUERY_UPDATE, \"".$cle."\");", VERBOSE_MODE); |
$this->addToLog(__METHOD__."(): db->autoexecute(\"".DB_PREFIXE."donnees_techniques\", ".print_r($valF_dt, true).", DB_AUTOQUERY_UPDATE, \"".$cle."\");", VERBOSE_MODE); |
3749 |
if (database::isError($res1)) { |
if (database::isError($res1)) { |
3750 |
die($res->getMessage()); |
die($res->getMessage()); |
3751 |
} |
} |
3752 |
// Affichage d'informations à l'utilisateur |
// Affichage d'informations à l'utilisateur |
3753 |
$this->addToMessage(_('enregistrement')." ".$this->valF['dossier']." "._('table')." dossier [".$db->affectedRows()." "._('enregistrement')." "._('mis_a_jour')."]"); |
$this->addToMessage(_('enregistrement')." ".$this->valF['dossier']." "._('table')." dossier [".$this->f->db->affectedRows()." "._('enregistrement')." "._('mis_a_jour')."]"); |
3754 |
} |
} |
3755 |
// 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 |
3756 |
if ($valF != "") { |
if (count($valF) > 0) { |
3757 |
// On met à jour le dossier |
// |
3758 |
$cle = " dossier='".$this->valF['dossier']."'"; |
$inst_dossier = $this->f->get_inst__om_dbform(array( |
3759 |
$res1 = $db->autoExecute(DB_PREFIXE.'dossier', $valF, DB_AUTOQUERY_UPDATE, $cle); |
"obj" => "dossier", |
3760 |
$this->addToLog("triggermodifierapres(): db->autoexecute(\"".DB_PREFIXE."dossier\", ".print_r($valF, true).", DB_AUTOQUERY_UPDATE, \"".$cle."\");", VERBOSE_MODE); |
"idx" => $this->valF['dossier'], |
3761 |
if (database::isError($res1)) { |
)); |
3762 |
die($res->getMessage()); |
$valF['instruction'] = $id; |
3763 |
|
$valF['crud'] = 'update'; |
3764 |
|
$update_by_instruction = $inst_dossier->update_by_instruction($valF); |
3765 |
|
if ($update_by_instruction === false) { |
3766 |
|
$this->cleanMessage(); |
3767 |
|
$this->addToMessage(sprintf('%s %s', __("Une erreur s'est produite lors de la mise à jour du dossier d'instruction."), __("Veuillez contacter votre administrateur."))); |
3768 |
|
return false; |
3769 |
} |
} |
3770 |
// Affichage d'informations à l'utilisateur |
// Affichage d'informations à l'utilisateur |
3771 |
$this->addToMessage(_('enregistrement')." ".$this->valF['dossier']." "._('table')." dossier [".$db->affectedRows()." "._('enregistrement')." "._('mis_a_jour')."]"); |
$this->addToMessage(_('enregistrement')." ".$this->valF['dossier']." "._('table')." dossier [".$this->f->db->affectedRows()." "._('enregistrement')." "._('mis_a_jour')."]"); |
3772 |
} |
} |
3773 |
|
|
3774 |
$restriction = $this->get_restriction($val['evenement']); |
$restriction = $this->get_restriction($val['evenement']); |
3778 |
// Récupération de tous les paramètres de l'événement sélectionné |
// Récupération de tous les paramètres de l'événement sélectionné |
3779 |
$sql = "SELECT * FROM ".DB_PREFIXE."evenement |
$sql = "SELECT * FROM ".DB_PREFIXE."evenement |
3780 |
WHERE evenement=".$this->valF['evenement']; |
WHERE evenement=".$this->valF['evenement']; |
3781 |
$res = $db->query($sql); |
$res = $this->f->db->query($sql); |
3782 |
$this->addToLog("triggermodifierapres(): db->query(\"".$sql."\");", VERBOSE_MODE); |
$this->addToLog(__METHOD__."(): db->query(\"".$sql."\");", VERBOSE_MODE); |
3783 |
if (database::isError($res)) { |
if (database::isError($res)) { |
3784 |
die($res->getMessage()); |
die($res->getMessage()); |
3785 |
} |
} |
3789 |
if ($this->getVal('date_retour_signature') == "" AND |
if ($this->getVal('date_retour_signature') == "" AND |
3790 |
$this->valF['date_retour_signature'] != "" AND |
$this->valF['date_retour_signature'] != "" AND |
3791 |
$row['evenement_retour_signature'] != "") { |
$row['evenement_retour_signature'] != "") { |
3792 |
$new_instruction = new instruction("]", $db, $DEBUG); |
$new_instruction = $this->f->get_inst__om_dbform(array( |
3793 |
|
"obj" => "instruction", |
3794 |
|
"idx" => "]", |
3795 |
|
)); |
3796 |
// Création d'un tableau avec la liste des champs de l'instruction |
// Création d'un tableau avec la liste des champs de l'instruction |
3797 |
foreach($new_instruction->champs as $champ) { |
foreach($new_instruction->champs as $champ) { |
3798 |
$valNewInstr[$champ] = ""; |
$valNewInstr[$champ] = ""; |
3811 |
$new_instruction->setParameter("maj", 0); |
$new_instruction->setParameter("maj", 0); |
3812 |
$new_instruction->class_actions[0]["identifier"] = |
$new_instruction->class_actions[0]["identifier"] = |
3813 |
"retour signature de l'instruction $current_id"; |
"retour signature de l'instruction $current_id"; |
3814 |
$retour = $new_instruction->ajouter($valNewInstr,$db, $DEBUG); |
$retour = $new_instruction->ajouter($valNewInstr); |
3815 |
|
|
3816 |
//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 |
3817 |
//de restriction |
//de restriction |
3818 |
if ($retour == false && !$new_instruction->restriction_valid){ |
if ($retour == false && !$new_instruction->restriction_valid){ |
3819 |
$error_message = $this->get_restriction_error_message($restriction); |
$error_message = $this->get_restriction_error_message($restriction); |
3820 |
$this->f->displayMessage("error", $error_message); |
$this->f->displayMessage("error", $error_message); |
3821 |
$this->addToLog("triggermodifierapres() : evenement retour ". |
$this->addToLog(__METHOD__."(): evenement retour ". |
3822 |
"instruction ".$this->valF[$this->clePrimaire]." : ". |
"instruction ".$this->valF[$this->clePrimaire]." : ". |
3823 |
$new_instruction->msg); |
$new_instruction->msg); |
3824 |
} |
} |
3834 |
$this->valF['date_retour_rar'] != "") { |
$this->valF['date_retour_rar'] != "") { |
3835 |
|
|
3836 |
if($row['evenement_retour_ar'] != "") { |
if($row['evenement_retour_ar'] != "") { |
3837 |
$new_instruction = new instruction("]", $db, $DEBUG); |
$new_instruction = $this->f->get_inst__om_dbform(array( |
3838 |
|
"obj" => "instruction", |
3839 |
|
"idx" => "]", |
3840 |
|
)); |
3841 |
// Création d'un tableau avec la liste des champs de l'instruction |
// Création d'un tableau avec la liste des champs de l'instruction |
3842 |
foreach($new_instruction->champs as $champ) { |
foreach($new_instruction->champs as $champ) { |
3843 |
$valNewInstr[$champ] = ""; |
$valNewInstr[$champ] = ""; |
3855 |
$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']); |
3856 |
$new_instruction->setParameter("maj", 0); |
$new_instruction->setParameter("maj", 0); |
3857 |
$new_instruction->class_actions[0]["identifier"] = |
$new_instruction->class_actions[0]["identifier"] = |
3858 |
"retour RAR de l'instruction $current_id"; |
"notification de l'instruction $current_id"; |
3859 |
$retour = $new_instruction->ajouter($valNewInstr,$db, $DEBUG); |
$retour = $new_instruction->ajouter($valNewInstr); |
3860 |
|
|
3861 |
//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 |
3862 |
//de restriction |
//de restriction |
3864 |
$error_message = $this->get_restriction_error_message($restriction); |
$error_message = $this->get_restriction_error_message($restriction); |
3865 |
$this->f->displayMessage("error", $error_message); |
$this->f->displayMessage("error", $error_message); |
3866 |
$this->addToLog( |
$this->addToLog( |
3867 |
"triggermodifierapres() : evenement retour instruction ". |
__METHOD__."(): evenement retour instruction ". |
3868 |
$this->valF[$this->clePrimaire]." : ". |
$this->valF[$this->clePrimaire]." : ". |
3869 |
$new_instruction->msg |
$new_instruction->msg |
3870 |
); |
); |
3876 |
return false; |
return false; |
3877 |
} |
} |
3878 |
} |
} |
|
// Mise à jour du flag incomplet_notifie dans dossier si la |
|
|
// date limite d'instruction n'est pas dépassée |
|
|
if($row['type']=='incompletude' && |
|
|
($this->valF['archive_date_notification_delai'] >= $this->valF['date_retour_rar'] || |
|
|
$this->valF['archive_date_notification_delai'] == "")) { |
|
|
$valFIncomp['incomplet_notifie'] = true; |
|
|
$cle = " dossier='".$val['dossier']."'"; |
|
|
$resIncomp = $db->autoExecute( |
|
|
DB_PREFIXE.'dossier', |
|
|
$valFIncomp, |
|
|
DB_AUTOQUERY_UPDATE, |
|
|
$cle |
|
|
); |
|
|
$this->addToLog( |
|
|
"triggersupprimer(): db->autoexecute(\"". |
|
|
DB_PREFIXE."dossier\", ".print_r($valFIncomp, true). |
|
|
", DB_AUTOQUERY_UPDATE, \"".$cle."\");", |
|
|
VERBOSE_MODE |
|
|
); |
|
|
if (database::isError($resIncomp)) { |
|
|
die($resIncomp->getMessage()); |
|
|
} |
|
|
} |
|
3879 |
} |
} |
3880 |
} |
} |
3881 |
} |
} |
3882 |
|
|
3883 |
|
/** |
3884 |
|
* Mise à jour de la date de dernière modification du dossier |
3885 |
|
* d'instruction |
3886 |
|
*/ |
3887 |
|
$inst_di = $this->get_inst_dossier($this->getVal('dossier')); |
3888 |
|
$inst_di->update_last_modification_date(); |
3889 |
|
|
3890 |
// Mise à jour des données du dossier d'autorisation |
// Mise à jour des données du dossier d'autorisation |
3891 |
require_once "../obj/dossier_autorisation.class.php"; |
$da = $this->f->get_inst__om_dbform(array( |
3892 |
$da = new dossier_autorisation($this->getNumDemandeAutorFromDossier($this->valF['dossier']), $this->db, DEBUG); |
"obj" => "dossier_autorisation", |
3893 |
if($da->majDossierAutorisation() === false) { |
"idx" => $this->getNumDemandeAutorFromDossier($this->valF['dossier']), |
3894 |
|
)); |
3895 |
|
$params = array( |
3896 |
|
'di_id' => $this->getVal('dossier'), |
3897 |
|
); |
3898 |
|
if($da->majDossierAutorisation($params) === false) { |
3899 |
$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.")); |
3900 |
$this->correct = false; |
$this->correct = false; |
3901 |
return false; |
return false; |
3902 |
} |
} |
3903 |
|
|
3904 |
|
// mise à jour des métadonnées issues des dates de suivi |
3905 |
|
$dateRetourSignatureModified = ($this->valF['date_retour_signature'] != $this->getVal('date_retour_signature')); |
3906 |
|
$dateRetourRARModified = ($this->valF['date_retour_rar'] != $this->getVal('date_retour_rar')); |
3907 |
|
if ($dateRetourSignatureModified || $dateRetourRARModified) { |
3908 |
|
|
3909 |
|
// Calculs des nouvelles métadonnées |
3910 |
|
$metadata = $this->getMetadata("om_fichier_instruction"); |
3911 |
|
|
3912 |
|
// On vérifie si l'instruction à finaliser a un événement de type arrete |
3913 |
|
$sql = "SELECT type FROM ".DB_PREFIXE."evenement WHERE evenement = ".$this->getVal("evenement"); |
3914 |
|
$typeEvenement = $this->f->db->getOne($sql); |
3915 |
|
$this->addToLog(__METHOD__."(): db->getOne(\"".$sql."\");", VERBOSE_MODE); |
3916 |
|
if ($this->f->isDatabaseError($typeEvenement, true) === true) { |
3917 |
|
$this->correct = false; |
3918 |
|
$this->addToMessage(__("Erreur de traitement de fichier.")); |
3919 |
|
$this->addToLog(__METHOD__."() erreur BDD: ".var_export($typeEvenement->getMessage(), true), DEBUG_MODE); |
3920 |
|
return false; |
3921 |
|
} |
3922 |
|
|
3923 |
|
// Si l'événement est de type arrete, on ajoute les métadonnées spécifiques |
3924 |
|
if ($typeEvenement == 'arrete'){ |
3925 |
|
$metadata = array_merge($metadata, $this->getMetadata("arrete")); |
3926 |
|
} |
3927 |
|
|
3928 |
|
// Filtre pour conserver uniquement les métadonnées liées aux dates |
3929 |
|
$metadataToKeep = array( |
3930 |
|
"statutAutorisation", |
3931 |
|
"dateEvenementDocument", |
3932 |
|
'date_cloture_metier', |
3933 |
|
"NotificationArrete", |
3934 |
|
"dateNotificationArrete", |
3935 |
|
"controleLegalite", |
3936 |
|
"dateSignature", |
3937 |
|
"nomSignataire", |
3938 |
|
"qualiteSignataire", |
3939 |
|
"dateControleLegalite", |
3940 |
|
); |
3941 |
|
$metadata = array_filter( |
3942 |
|
$metadata, |
3943 |
|
function($key) use ($metadataToKeep) { return in_array($key, $metadataToKeep); }, |
3944 |
|
ARRAY_FILTER_USE_KEY |
3945 |
|
); |
3946 |
|
|
3947 |
|
// Mise à jour des métadonnées du document en GED |
3948 |
|
$docUid = $this->getVal("om_fichier_instruction"); |
3949 |
|
$operationOrUID = $this->f->storage->update_metadata($docUid, $metadata); |
3950 |
|
if ($operationOrUID == 'OP_FAILURE') { |
3951 |
|
$this->correct = false; |
3952 |
|
$this->addToMessage(__("Erreur de traitement de fichier.")); |
3953 |
|
$this->addToLog(__METHOD__."() failed to update metadata: ".var_export($operationOrUID, true), DEBUG_MODE); |
3954 |
|
return false; |
3955 |
|
} |
3956 |
|
|
3957 |
|
// mise à jour de l'UID du document en BDD |
3958 |
|
else { |
3959 |
|
$valF = array('om_fichier_instruction' => $operationOrUID); |
3960 |
|
$res = $this->f->db->autoExecute(DB_PREFIXE.$this->table, $valF, DB_AUTOQUERY_UPDATE, $this->getCle($id)); |
3961 |
|
$this->addToLog(__METHOD__.'() : db->autoExecute("'.DB_PREFIXE.$this->table.'", '.print_r($valF, true).', DB_AUTOQUERY_UPDATE, "'.$this->getCle($id).'")', VERBOSE_MODE); |
3962 |
|
if ($this->f->isDatabaseError($res, true) === true) { |
3963 |
|
$this->correct = false; |
3964 |
|
$this->addToMessage(__("Erreur de traitement de fichier.")); |
3965 |
|
$this->addToLog(__METHOD__."() erreur BDD: ".var_export($res->getMessage(), true), DEBUG_MODE); |
3966 |
|
return false; |
3967 |
|
} |
3968 |
|
$this->addToMessage(__("La mise a jour du document s'est effectuee avec succes.")); |
3969 |
|
} |
3970 |
|
} |
3971 |
|
|
3972 |
|
// Notification auto des demandeurs |
3973 |
|
if ($dateRetourSignatureModified === true |
3974 |
|
&& $this->valF['date_retour_signature'] !== '' |
3975 |
|
&& $this->valF['date_retour_signature'] !== null) { |
3976 |
|
// |
3977 |
|
$ev = $this->get_inst_evenement($this->valF['evenement']); |
3978 |
|
if ($ev->getVal('notification') === 'notification_auto_signature_requise') { |
3979 |
|
// Récupération de la liste des demandeurs à notifier et de la catégorie |
3980 |
|
$categorie = $this->f->get_param_option_notification($collectivite_di); |
3981 |
|
$isPortal = $categorie == null || $categorie == '' || $categorie == 'portal' ? true : false; |
3982 |
|
$demandeursANotifie = $this->get_demandeurs_notifiable( |
3983 |
|
$this->valF['dossier'], |
3984 |
|
$isPortal |
3985 |
|
); |
3986 |
|
|
3987 |
|
// Création d'une notification et d'une tâche pour chaque demandeur à notifier |
3988 |
|
foreach ($demandeursANotifie as $demandeur) { |
3989 |
|
// Ajout de la notif et récupération de son id |
3990 |
|
$idNotif = $this->ajouter_notification( |
3991 |
|
$this->valF[$this->clePrimaire], |
3992 |
|
$this->f->get_connected_user_login_name(), |
3993 |
|
$demandeur, |
3994 |
|
$collectivite_di, |
3995 |
|
true |
3996 |
|
); |
3997 |
|
if ($idNotif === false) { |
3998 |
|
return false; |
3999 |
|
} |
4000 |
|
// Création de la tache en lui donnant l'id de la notification |
4001 |
|
$notification_by_task = $this->notification_by_task( |
4002 |
|
$idNotif, |
4003 |
|
$this->valF['dossier'], |
4004 |
|
$categorie |
4005 |
|
); |
4006 |
|
if ($notification_by_task === false) { |
4007 |
|
$this->addToMessage( |
4008 |
|
__("Erreur lors de la génération de la notification au(x) pétitionnaire(s).") |
4009 |
|
); |
4010 |
|
return false; |
4011 |
|
} |
4012 |
|
} |
4013 |
|
$this->addToMessage($message .= sprintf('%s<br/>%s', __("La notification a été générée."), __("Le suivi de la notification est disponible depuis l'instruction."))); |
4014 |
|
} |
4015 |
|
} |
4016 |
|
|
4017 |
return $this->add_log_to_dossier($id, $val); |
return $this->add_log_to_dossier($id, $val); |
4018 |
} |
} |
4019 |
|
|
4020 |
function triggersupprimer($id, &$db = null, $val = array(), $DEBUG = null) { |
/** |
4021 |
|
* TRIGGER - triggersupprimer. |
4022 |
|
* |
4023 |
|
* @return boolean |
4024 |
|
*/ |
4025 |
|
function triggersupprimer($id, &$dnu1 = null, $val = array(), $dnu2 = null) { |
4026 |
|
$this->addToLog(__METHOD__."(): start", EXTRA_VERBOSE_MODE); |
4027 |
/** |
/** |
4028 |
* 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 |
4029 |
* archive dans le dossier d'instruction avant de supprimer l'événement |
* archive dans le dossier d'instruction avant de supprimer l'événement |
4030 |
* d'instruction |
* d'instruction si les valeurs du dossier sont différentes |
4031 |
*/ |
*/ |
4032 |
|
$valF = array(); |
4033 |
// Mise à jour des 4 valeurs modifiées par l'action |
$inst_di = $this->get_inst_dossier($this->getVal('dossier')); |
4034 |
$valF['delai'] = $val['archive_delai']; |
foreach ($inst_di->champs as $key => $champ) { |
4035 |
$valF['accord_tacite'] = $val['archive_accord_tacite']; |
// Si le champ du DI à une archive dans l'instruction |
4036 |
$valF['etat'] = $val['archive_etat']; |
if (isset($val[sprintf('archive_%s', $champ)]) === true) { |
4037 |
if ($val['archive_avis'] != '') { |
// Si la valeur entre le champ du DI et son archive dans instruction |
4038 |
$valF['avis_decision'] = $val['archive_avis']; |
// est différente |
4039 |
} else { |
if ($inst_di->getVal($champ) !== $val[sprintf('archive_%s', $champ)]) { |
4040 |
$valF['avis_decision'] = null; |
$val[sprintf('archive_%s', $champ)] === '' ? $valF[$champ] = null : $valF[$champ] = $val[sprintf('archive_%s', $champ)]; |
4041 |
} |
} |
4042 |
// Mise à jour des dates avec la valeur présente dans le formulaire |
} |
|
// de suppression. Si la valeur de la date est vide alors on fixe |
|
|
// à la valeur null |
|
|
if ($val['archive_date_complet'] != '') { |
|
|
$valF['date_complet'] = $val['archive_date_complet']; |
|
|
} else { |
|
|
$valF['date_complet'] = null; |
|
|
} |
|
|
if ($val['archive_date_dernier_depot'] != '') { |
|
|
$valF['date_dernier_depot'] = $val['archive_date_dernier_depot']; |
|
|
} else { |
|
|
$valF['date_dernier_depot'] = null; |
|
|
} |
|
|
if ($val['archive_date_rejet'] != '') { |
|
|
$valF['date_rejet'] = $val['archive_date_rejet']; |
|
|
} else { |
|
|
$valF['date_rejet'] = null; |
|
|
} |
|
|
if ($val['archive_date_limite'] != '') { |
|
|
$valF['date_limite'] = $val['archive_date_limite']; |
|
|
} else { |
|
|
$valF['date_limite'] = null; |
|
|
} |
|
|
if ($val['archive_date_notification_delai'] != '') { |
|
|
$valF['date_notification_delai'] = $val['archive_date_notification_delai']; |
|
|
} else { |
|
|
$valF['date_notification_delai'] = null; |
|
|
} |
|
|
if ($val['archive_date_decision'] != '') { |
|
|
$valF['date_decision'] = $val['archive_date_decision']; |
|
|
} else { |
|
|
$valF['date_decision'] = null; |
|
|
} |
|
|
if ($val['archive_date_validite'] != '') { |
|
|
$valF['date_validite'] = $val['archive_date_validite']; |
|
|
} else { |
|
|
$valF['date_validite'] = null; |
|
|
} |
|
|
if ($val['archive_date_achevement'] != '') { |
|
|
$valF['date_achevement'] = $val['archive_date_achevement']; |
|
|
} else { |
|
|
$valF['date_achevement'] = null; |
|
|
} |
|
|
if ($val['archive_date_chantier'] != '') { |
|
|
$valF['date_chantier'] = $val['archive_date_chantier']; |
|
|
} else { |
|
|
$valF['date_chantier'] = null; |
|
|
} |
|
|
if ($val['archive_date_conformite'] != '') { |
|
|
$valF['date_conformite'] = $val['archive_date_conformite']; |
|
|
} else { |
|
|
$valF['date_conformite'] = null; |
|
|
} |
|
|
if ($val['archive_incompletude'] != '') { |
|
|
$valF['incompletude'] = $val['archive_incompletude']; |
|
|
} else { |
|
|
$valF['incompletude'] = null; |
|
|
} |
|
|
if ($val['archive_incomplet_notifie'] != '') { |
|
|
$valF['incomplet_notifie'] = $val['archive_incomplet_notifie']; |
|
|
} else { |
|
|
$valF['incomplet_notifie'] = null; |
|
|
} |
|
|
if ($val['archive_evenement_suivant_tacite'] != '') { |
|
|
$valF['evenement_suivant_tacite'] = $val['archive_evenement_suivant_tacite']; |
|
|
} else { |
|
|
$valF['evenement_suivant_tacite'] = null; |
|
|
} |
|
|
if ($val['archive_evenement_suivant_tacite_incompletude'] != '') { |
|
|
$valF['evenement_suivant_tacite_incompletude'] = $val['archive_evenement_suivant_tacite_incompletude']; |
|
|
} else { |
|
|
$valF['evenement_suivant_tacite_incompletude'] = null; |
|
|
} |
|
|
if ($val['archive_etat_pendant_incompletude'] != '') { |
|
|
$valF['etat_pendant_incompletude'] = $val['archive_etat_pendant_incompletude']; |
|
|
} else { |
|
|
$valF['etat_pendant_incompletude'] = null; |
|
|
} |
|
|
if ($val['archive_date_limite_incompletude'] != '') { |
|
|
$valF['date_limite_incompletude'] = $val['archive_date_limite_incompletude']; |
|
|
} else { |
|
|
$valF['date_limite_incompletude'] = null; |
|
|
} |
|
|
if ($val['archive_delai_incompletude'] != '') { |
|
|
$valF['delai_incompletude'] = $val['archive_delai_incompletude']; |
|
|
} else { |
|
|
$valF['delai_incompletude'] = null; |
|
|
} |
|
|
if ($val['archive_autorite_competente'] != '') { |
|
|
$valF['autorite_competente'] = $val['archive_autorite_competente']; |
|
|
} else { |
|
|
$valF['autorite_competente'] = null; |
|
4043 |
} |
} |
4044 |
$valF['date_cloture_instruction'] = null; |
// Spécificité du champ avis_decision dont le champ archive est nommé |
4045 |
if ($val['archive_date_cloture_instruction'] !== '') { |
// différemment |
4046 |
$valF['date_cloture_instruction'] = $val['archive_date_cloture_instruction']; |
if ($inst_di->getVal('avis_decision') !== $val['archive_avis']) { |
4047 |
|
$val['archive_avis'] === '' ? $valF['avis_decision'] = null : $valF['avis_decision'] = $val['archive_avis']; |
4048 |
|
} |
4049 |
|
// Spécificité de la date d'affichage dont la valeur n'ai jamais modifiée |
4050 |
|
// par l'archive |
4051 |
|
unset($valF['date_affichage']); |
4052 |
|
|
4053 |
|
/** |
4054 |
|
* Mise à jour de la version de clôture *version_clos* du dossier si et |
4055 |
|
* seulement si l'instruction met à jour l'état du dossier. |
4056 |
|
*/ |
4057 |
|
if (isset($valF['etat']) === true |
4058 |
|
&& $valF['etat'] !== null |
4059 |
|
&& $valF['etat'] !== '') { |
4060 |
|
// Récupère l'état actuel du dossier d'instruction |
4061 |
|
$inst_current_etat = $this->f->get_inst__om_dbform(array( |
4062 |
|
"obj" => "etat", |
4063 |
|
"idx" => $inst_di->get_id_etat(), |
4064 |
|
)); |
4065 |
|
// Instanciation de l'état archivé appliqué sur le dossier |
4066 |
|
$inst_etat = $this->f->get_inst__om_dbform(array( |
4067 |
|
"obj" => "etat", |
4068 |
|
"idx" => $valF['etat'], |
4069 |
|
)); |
4070 |
|
// |
4071 |
|
$update_version_clos = null; |
4072 |
|
// En cas de clôture du dossier par l'état archivé |
4073 |
|
if ($inst_etat->getVal('statut') === 'cloture') { |
4074 |
|
$update_version_clos = $inst_di->update_version_clos('up'); |
4075 |
|
} |
4076 |
|
// En cas de réouverture du dossier par l'état archivé |
4077 |
|
if ($inst_current_etat->getVal('statut') === 'cloture' |
4078 |
|
&& $inst_etat->getVal('statut') !== 'cloture') { |
4079 |
|
// |
4080 |
|
$update_version_clos = $inst_di->update_version_clos('down'); |
4081 |
|
// |
4082 |
|
$this->set_att_di_reopened(true); |
4083 |
|
} |
4084 |
|
// |
4085 |
|
if ($update_version_clos === false) { |
4086 |
|
$this->f->addToLog(sprintf( |
4087 |
|
"%s() : ERREUR - %s %s", |
4088 |
|
__METHOD__, |
4089 |
|
sprintf( |
4090 |
|
__("Impossible de mettre à jour la version de clôture du dossier d'instruction %s."), |
4091 |
|
$inst_di->getVal($inst_di->clePrimaire) |
4092 |
|
), |
4093 |
|
sprintf( |
4094 |
|
__("L'instruction tente d'appliquer l'état %s."), |
4095 |
|
$inst_etat->getVal($inst_etat->clePrimaire) |
4096 |
|
) |
4097 |
|
)); |
4098 |
|
$this->addToMessage(sprintf( |
4099 |
|
"%s %s", |
4100 |
|
__("Erreur lors de la mise à jour de la version de clôture du dossier d'instruction."), |
4101 |
|
__("Veuillez contacter votre administrateur.") |
4102 |
|
)); |
4103 |
|
return false; |
4104 |
|
} |
4105 |
} |
} |
4106 |
// Dates concernant les dossiers contentieux |
// On supprime toutes les notications liées à l'instruction |
4107 |
// Date de première visite |
$notifASupprimer = $this->get_instruction_notification($this->getVal($this->clePrimaire)); |
4108 |
$valF['date_premiere_visite'] = null; |
foreach ($notifASupprimer as $idNotif) { |
4109 |
if ($val['archive_date_premiere_visite'] !== '') { |
$inst_notif = $this->f->get_inst__om_dbform(array( |
4110 |
$valF['date_premiere_visite'] = $val['archive_date_premiere_visite']; |
"obj" => "instruction_notification", |
4111 |
} |
"idx" => $idNotif, |
4112 |
// Date de dernière visite |
)); |
4113 |
$valF['date_derniere_visite'] = null; |
$val_notif = array(); |
4114 |
if ($val['archive_date_derniere_visite'] !== '') { |
foreach ($inst_notif->champs as $champ) { |
4115 |
$valF['date_derniere_visite'] = $val['archive_date_derniere_visite']; |
$val_notif[$champ] = $inst_notif->getVal($champ); |
4116 |
} |
} |
4117 |
// Date contradictoire |
// La suppression des notifications entrainera la suppression des tâches qui y sont |
4118 |
$valF['date_contradictoire'] = null; |
// liées |
4119 |
if ($val['archive_date_contradictoire'] !== '') { |
$supprNotif = $inst_notif->supprimer($val_notif); |
4120 |
$valF['date_contradictoire'] = $val['archive_date_contradictoire']; |
if ($supprNotif == false) { |
4121 |
} |
$this->addToMessage(sprintf( |
4122 |
// Date de retour contradictoire |
"%s %s", |
4123 |
$valF['date_retour_contradictoire'] = null; |
__("Erreur lors de la suppression des notifications de l'instruction."), |
4124 |
if ($val['archive_date_retour_contradictoire'] !== '') { |
__("Veuillez contacter votre administrateur.") |
4125 |
$valF['date_retour_contradictoire'] = $val['archive_date_retour_contradictoire']; |
)); |
4126 |
} |
return false; |
4127 |
// Date de l'AIT |
} |
|
$valF['date_ait'] = null; |
|
|
if ($val['archive_date_ait'] !== '') { |
|
|
$valF['date_ait'] = $val['archive_date_ait']; |
|
|
} |
|
|
// Date de transmission au parquet |
|
|
$valF['date_transmission_parquet'] = null; |
|
|
if ($val['archive_date_transmission_parquet'] !== '') { |
|
|
$valF['date_transmission_parquet'] = $val['archive_date_transmission_parquet']; |
|
4128 |
} |
} |
4129 |
|
|
4130 |
// On met à jour le dossier |
// On met à jour le dossier |
4131 |
$cle = " dossier='".$val['dossier']."'"; |
$valF['instruction'] = $id; |
4132 |
$res = $db->autoExecute(DB_PREFIXE.'dossier', $valF, DB_AUTOQUERY_UPDATE, $cle); |
$valF['crud'] = 'delete'; |
4133 |
$this->addToLog("triggersupprimer(): db->autoexecute(\"".DB_PREFIXE."dossier\", ".print_r($valF, true).", DB_AUTOQUERY_UPDATE, \"".$cle."\");", VERBOSE_MODE); |
$update_by_instruction = $inst_di->update_by_instruction($valF); |
4134 |
if (database::isError($res)) { |
if ($update_by_instruction === false) { |
4135 |
die($res->getMessage()); |
$this->cleanMessage(); |
4136 |
|
$this->addToMessage(sprintf('%s %s', __("Une erreur s'est produite lors de la mise à jour du dossier d'instruction."), __("Veuillez contacter votre administrateur."))); |
4137 |
|
return false; |
4138 |
} |
} |
4139 |
|
|
4140 |
// Affichage d'informations à l'utilisateur |
// Affichage d'informations à l'utilisateur |
4141 |
$this->addToMessage(_("Suppression de l'instruction")." [".$db->affectedRows()." "._('enregistrement')." "._('mis_a_jour')."]"); |
$this->addToMessage(_("Suppression de l'instruction")." [".$this->f->db->affectedRows()." "._('enregistrement')." "._('mis_a_jour')."]"); |
4142 |
|
|
4143 |
// Mise à jour de la demande si un récépissé d'instruction correspond à l'instruction à supprimer |
// Mise à jour de la demande si un récépissé d'instruction correspond à l'instruction à supprimer |
4144 |
} |
} |
4145 |
|
|
4146 |
function triggersupprimerapres($id, &$db = null, $val = array(), $DEBUG = null) { |
/** |
4147 |
|
* TRIGGER - triggersupprimerapres. |
4148 |
|
* |
4149 |
|
* @return boolean |
4150 |
|
*/ |
4151 |
|
function triggersupprimerapres($id, &$dnu1 = null, $val = array(), $dnu2 = null) { |
4152 |
|
$this->addToLog(__METHOD__."(): start", EXTRA_VERBOSE_MODE); |
4153 |
|
/** |
4154 |
|
* Mise à jour de la date de dernière modification du dossier |
4155 |
|
* d'instruction |
4156 |
|
*/ |
4157 |
|
$inst_di = $this->get_inst_dossier($this->getVal('dossier')); |
4158 |
|
$inst_di->update_last_modification_date(); |
4159 |
|
|
4160 |
// Mise à jour des données du dossier d'autorisation |
/** |
4161 |
require_once "../obj/dossier_autorisation.class.php"; |
* Mise à jour des données du dossier d'autorisation |
4162 |
$da = new dossier_autorisation($this->getNumDemandeAutorFromDossier($val["dossier"]), $this->db, DEBUG); |
*/ |
4163 |
if($da->majDossierAutorisation() === false) { |
$da = $this->f->get_inst__om_dbform(array( |
4164 |
|
"obj" => "dossier_autorisation", |
4165 |
|
"idx" => $this->getNumDemandeAutorFromDossier($val["dossier"]), |
4166 |
|
)); |
4167 |
|
$params = array( |
4168 |
|
'di_id' => $this->getVal('dossier'), |
4169 |
|
'di_reopened' => $this->get_att_di_reopened(), |
4170 |
|
); |
4171 |
|
if($da->majDossierAutorisation($params) === false) { |
4172 |
$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.")); |
4173 |
$this->correct = false; |
$this->correct = false; |
4174 |
return false; |
return false; |
4175 |
} |
} |
4176 |
|
|
4177 |
|
/** |
4178 |
|
* Gestion des tâches pour la dématérialisation |
4179 |
|
*/ |
4180 |
|
$inst_task_empty = $this->f->get_inst__om_dbform(array( |
4181 |
|
"obj" => "task", |
4182 |
|
"idx" => 0, |
4183 |
|
)); |
4184 |
|
foreach ($inst_di->task_types as $task_type) { |
4185 |
|
$task_exists = $inst_task_empty->task_exists($task_type, $id); |
4186 |
|
if ($task_exists !== false) { |
4187 |
|
$inst_task = $this->f->get_inst__om_dbform(array( |
4188 |
|
"obj" => "task", |
4189 |
|
"idx" => $task_exists, |
4190 |
|
)); |
4191 |
|
if ($inst_task->getVal('state') === $inst_task::STATUS_NEW || $inst_task->getVal('state') === $inst_task::STATUS_DRAFT) { |
4192 |
|
$task_val = array( |
4193 |
|
'state' => $inst_task::STATUS_CANCELED, |
4194 |
|
); |
4195 |
|
$update_task = $inst_task->update_task(array('val' => $task_val)); |
4196 |
|
if ($update_task === false) { |
4197 |
|
$this->addToMessage(sprintf('%s %s', |
4198 |
|
sprintf(__("Une erreur s'est produite lors de la modification de la tâche %."), $inst_task->getVal($inst_task->clePrimaire)), |
4199 |
|
__("Veuillez contacter votre administrateur.") |
4200 |
|
)); |
4201 |
|
$this->correct = false; |
4202 |
|
return false; |
4203 |
|
} |
4204 |
|
} |
4205 |
|
} |
4206 |
|
} |
4207 |
|
|
4208 |
|
// |
4209 |
$val['evenement'] = $this->getVal('evenement'); |
$val['evenement'] = $this->getVal('evenement'); |
4210 |
return $this->add_log_to_dossier($id, $val); |
return $this->add_log_to_dossier($id, $val); |
4211 |
} |
} |
4212 |
|
|
4213 |
/** |
/** |
4214 |
|
* Permet de mettre la valeur passée en paramètre dans l'attribut de classe |
4215 |
|
* "di_reopened". |
4216 |
|
* |
4217 |
|
* @param boolean $val |
4218 |
|
*/ |
4219 |
|
function set_att_di_reopened($val) { |
4220 |
|
$this->di_reopened = $val; |
4221 |
|
} |
4222 |
|
|
4223 |
|
/** |
4224 |
|
* Permet de récupérer la valeur de l'attribut de classe "di_reopened". |
4225 |
|
* |
4226 |
|
* @return boolean |
4227 |
|
*/ |
4228 |
|
function get_att_di_reopened() { |
4229 |
|
return $this->di_reopened; |
4230 |
|
} |
4231 |
|
|
4232 |
|
/** |
4233 |
* Permet de composer un message d'erreur sur restriction non valide en |
* Permet de composer un message d'erreur sur restriction non valide en |
4234 |
* fonction du contexte. |
* fonction du contexte. |
4235 |
* |
* |
4268 |
} |
} |
4269 |
|
|
4270 |
/** |
/** |
4271 |
* Vérifie la restriction sur l'événement. |
* @return void |
|
* |
|
|
* @param array $val valeurs du formulaire |
|
|
* @param database $db handler database |
|
|
* @param boolean $DEBUG NA |
|
|
* |
|
|
* @return [type] [description] |
|
4272 |
*/ |
*/ |
4273 |
function verifier($val = array(), &$db = null, $DEBUG = null) { |
function verifier($val = array(), &$dnu1 = null, $dnu2 = null) { |
4274 |
parent::verifier($val, $db, $DEBUG); |
parent::verifier($val); |
4275 |
|
// |
4276 |
if ( isset($val['evenement']) && is_numeric($val['evenement'])){ |
if ( isset($val['evenement']) && is_numeric($val['evenement'])){ |
4277 |
$restriction = $this->get_restriction($val['evenement']); |
$restriction = $this->get_restriction($val['evenement']); |
4278 |
|
|
4381 |
|
|
4382 |
// |
// |
4383 |
$collectivite = $this->f->getCollectivite($dossier_instruction_om_collectivite); |
$collectivite = $this->f->getCollectivite($dossier_instruction_om_collectivite); |
4384 |
|
|
4385 |
|
// |
4386 |
|
$params = array( |
4387 |
|
"specific" => array(), |
4388 |
|
); |
4389 |
|
// Si la rédaction libre est activée sur l'instruction |
4390 |
|
if ($this->getVal("flag_edition_integrale") == 't') { |
4391 |
|
$params["specific"]["corps"] = array( |
4392 |
|
"mode" => "set", |
4393 |
|
"value" => $this->getVal("corps_om_htmletatex"), |
4394 |
|
); |
4395 |
|
$params["specific"]["titre"] = array( |
4396 |
|
"mode" => "set", |
4397 |
|
"value" => $this->getVal("titre_om_htmletat"), |
4398 |
|
); |
4399 |
|
} |
4400 |
// Génération du PDF |
// Génération du PDF |
4401 |
$result = $this->compute_pdf_output('lettretype', $this->getVal('lettretype'), $collectivite); |
$result = $this->compute_pdf_output('lettretype', $this->getVal('lettretype'), $collectivite, null, $params); |
4402 |
$pdf_output = $result['pdf_output']; |
$pdf_output = $result['pdf_output']; |
4403 |
|
|
4404 |
//Métadonnées du document |
//Métadonnées du document |
4405 |
$metadata = array( |
$metadata = array( |
4406 |
'filename' => 'instruction_'.$id_inst.'.pdf', |
'filename' => 'instruction_'.$id_inst.'.pdf', |
4415 |
$sql = "SELECT type |
$sql = "SELECT type |
4416 |
FROM ".DB_PREFIXE."evenement |
FROM ".DB_PREFIXE."evenement |
4417 |
WHERE evenement = ".$this->getVal("evenement"); |
WHERE evenement = ".$this->getVal("evenement"); |
4418 |
$typeEvenement = $this->db->getOne($sql); |
$typeEvenement = $this->f->db->getOne($sql); |
4419 |
$this->addToLog(__METHOD__."(): db->getOne(\"".$sql."\");", VERBOSE_MODE); |
$this->addToLog(__METHOD__."(): db->getOne(\"".$sql."\");", VERBOSE_MODE); |
4420 |
if ($this->f->isDatabaseError($typeEvenement, true) === true) { |
if ($this->f->isDatabaseError($typeEvenement, true) === true) { |
4421 |
$this->correct = false; |
$this->correct = false; |
4432 |
|
|
4433 |
$metadata = array_merge($metadata, $spe_metadata, $arrete_metadata); |
$metadata = array_merge($metadata, $spe_metadata, $arrete_metadata); |
4434 |
|
|
4435 |
|
/* |
4436 |
|
// transforme le tableau de métadonnées en objet |
4437 |
|
$mdf = new MetadataFactory(); |
4438 |
|
$md = $mdf->build('Instruction', $metadata); |
4439 |
|
*/ |
4440 |
|
|
4441 |
// Si le document a déjà été finalisé on le met à jour |
// Si le document a déjà été finalisé on le met à jour |
4442 |
// en conservant son UID |
// en conservant son UID |
4443 |
if ($this->getVal("om_fichier_instruction") != ''){ |
if ($this->getVal("om_fichier_instruction") != ''){ |
4446 |
} |
} |
4447 |
// Sinon on crée un nouveau document et dont on récupère l'UID |
// Sinon on crée un nouveau document et dont on récupère l'UID |
4448 |
else { |
else { |
4449 |
$uid = $this->f->storage->create($pdf_output, $metadata); |
$uid = $this->f->storage->create($pdf_output, $metadata, "from_content", $this->table.".om_fichier_instruction"); |
4450 |
} |
} |
4451 |
} |
} |
4452 |
|
|
4463 |
if ($uid == '' || $uid == 'OP_FAILURE' ) { |
if ($uid == '' || $uid == 'OP_FAILURE' ) { |
4464 |
$this->correct = false; |
$this->correct = false; |
4465 |
$this->addToMessage($file_msg_error); |
$this->addToMessage($file_msg_error); |
4466 |
$this->addToLog(sprintf($log_msg_error, $id_inst, $uid)); |
$this->addToLog(sprintf($log_msg_error, $id_inst, $uid), DEBUG_MODE); |
4467 |
return $this->end_treatment(__METHOD__, false); |
return $this->end_treatment(__METHOD__, false); |
4468 |
} |
} |
4469 |
|
|
4500 |
$val['archive_date_retour_contradictoire'] = $this->dateDBToForm($val['archive_date_retour_contradictoire']); |
$val['archive_date_retour_contradictoire'] = $this->dateDBToForm($val['archive_date_retour_contradictoire']); |
4501 |
$val['archive_date_ait'] = $this->dateDBToForm($val['archive_date_ait']); |
$val['archive_date_ait'] = $this->dateDBToForm($val['archive_date_ait']); |
4502 |
$val['archive_date_transmission_parquet'] = $this->dateDBToForm($val['archive_date_transmission_parquet']); |
$val['archive_date_transmission_parquet'] = $this->dateDBToForm($val['archive_date_transmission_parquet']); |
4503 |
|
$val['archive_date_affichage'] = $this->dateDBToForm($val['archive_date_affichage']); |
4504 |
$this->setvalF($val); |
$this->setvalF($val); |
4505 |
|
|
4506 |
// Verification de la validite des donnees |
// Verification de la validite des donnees |
4507 |
$this->verifier($this->val, $this->db, DEBUG); |
$this->verifier($this->val); |
4508 |
// Si les verifications precedentes sont correctes, on procede a |
// Si les verifications precedentes sont correctes, on procede a |
4509 |
// la modification, sinon on ne fait rien et on retourne une erreur |
// la modification, sinon on ne fait rien et on retourne une erreur |
4510 |
if ($this->correct === true) { |
if ($this->correct === true) { |
4538 |
|
|
4539 |
// Execution de la requête de modification des donnees de l'attribut |
// Execution de la requête de modification des donnees de l'attribut |
4540 |
// valF de l'objet dans l'attribut table de l'objet |
// valF de l'objet dans l'attribut table de l'objet |
4541 |
$res = $this->db->autoExecute(DB_PREFIXE.$this->table, $valF, |
$res = $this->f->db->autoExecute(DB_PREFIXE.$this->table, $valF, |
4542 |
DB_AUTOQUERY_UPDATE, $this->getCle($id_inst)); |
DB_AUTOQUERY_UPDATE, $this->getCle($id_inst)); |
4543 |
$this->addToLog(__METHOD__."() : db->autoExecute(\"".DB_PREFIXE.$this->table."\", ".print_r($valF, true).", DB_AUTOQUERY_UPDATE, \"".$this->getCle($id_inst)."\")", VERBOSE_MODE); |
$this->addToLog(__METHOD__."() : db->autoExecute(\"".DB_PREFIXE.$this->table."\", ".print_r($valF, true).", DB_AUTOQUERY_UPDATE, \"".$this->getCle($id_inst)."\")", VERBOSE_MODE); |
4544 |
// |
// |
4559 |
} |
} |
4560 |
// L'appel de verifier() a déjà positionné correct à false |
// L'appel de verifier() a déjà positionné correct à false |
4561 |
// et défini un message d'erreur. |
// et défini un message d'erreur. |
4562 |
$this->addToLog(sprintf($log_msg_error, $id_inst, $uid)); |
$this->addToLog(sprintf($log_msg_error, $id_inst, $uid), DEBUG_MODE); |
4563 |
return $this->end_treatment(__METHOD__, false); |
return $this->end_treatment(__METHOD__, false); |
4564 |
} |
} |
4565 |
|
|
4567 |
* Récupération du numéro de dossier d'instruction à ajouter aux métadonnées |
* Récupération du numéro de dossier d'instruction à ajouter aux métadonnées |
4568 |
* @return string numéro de dossier d'instruction |
* @return string numéro de dossier d'instruction |
4569 |
*/ |
*/ |
4570 |
protected function getDossier() { |
protected function getDossier($champ = null) { |
4571 |
if(empty($this->specificMetadata)) { |
if(empty($this->specificMetadata)) { |
4572 |
$this->getSpecificMetadata(); |
$this->getSpecificMetadata(); |
4573 |
} |
} |
4666 |
// Requête sql |
// Requête sql |
4667 |
$sql = "SELECT libelle FROM ".DB_PREFIXE."evenement |
$sql = "SELECT libelle FROM ".DB_PREFIXE."evenement |
4668 |
WHERE evenement=".$evenement; |
WHERE evenement=".$evenement; |
4669 |
$evenement_libelle = $this->db->getOne($sql); |
$evenement_libelle = $this->f->db->getOne($sql); |
4670 |
$this->addToLog("getTitle(): db->getOne(\"".$sql."\");", VERBOSE_MODE); |
$this->addToLog("getTitle(): db->getOne(\"".$sql."\");", VERBOSE_MODE); |
4671 |
if (database::isError($evenement_libelle)) { |
if (database::isError($evenement_libelle)) { |
4672 |
die(); |
die(); |
4728 |
LEFT JOIN ".DB_PREFIXE."groupe |
LEFT JOIN ".DB_PREFIXE."groupe |
4729 |
ON dossier_autorisation_type.groupe = groupe.groupe |
ON dossier_autorisation_type.groupe = groupe.groupe |
4730 |
WHERE dossier.dossier = '".$dossier."'"; |
WHERE dossier.dossier = '".$dossier."'"; |
4731 |
$res = $this->db->query($sql); |
$res = $this->f->db->query($sql); |
4732 |
$this->f->addToLog("getSpecificMetadata() : db->query(".$sql.")", VERBOSE_MODE); |
$this->f->addToLog("getSpecificMetadata() : db->query(".$sql.")", VERBOSE_MODE); |
4733 |
if ( database::isError($res)){ |
if ( database::isError($res)){ |
4734 |
die(); |
die(); |
4773 |
ON |
ON |
4774 |
dossier.etat = etat.etat |
dossier.etat = etat.etat |
4775 |
WHERE dossier ='".$idx."'"; |
WHERE dossier ='".$idx."'"; |
4776 |
$statut = $this->db->getOne($sql); |
$statut = $this->f->db->getOne($sql); |
4777 |
$this->f->addToLog("getStatutAutorisationDossier() : db->getOne(\"".$sql."\")", VERBOSE_MODE); |
$this->f->addToLog("getStatutAutorisationDossier() : db->getOne(\"".$sql."\")", VERBOSE_MODE); |
4778 |
if ( database::isError($statut)){ |
if ( database::isError($statut)){ |
4779 |
die(); |
die(); |
4794 |
// Récupération de toutes les valeurs du dossier d'instruction en cours |
// Récupération de toutes les valeurs du dossier d'instruction en cours |
4795 |
$sql = "SELECT * FROM ".DB_PREFIXE."dossier |
$sql = "SELECT * FROM ".DB_PREFIXE."dossier |
4796 |
WHERE dossier='".$this->valF['dossier']."'"; |
WHERE dossier='".$this->valF['dossier']."'"; |
4797 |
$res = $this->db->query($sql); |
$res = $this->f->db->query($sql); |
4798 |
$this->addToLog("get_dossier_actual(): db->query(\"".$sql."\");", VERBOSE_MODE); |
$this->addToLog("get_dossier_actual(): db->query(\"".$sql."\");", VERBOSE_MODE); |
4799 |
$this->f->isDatabaseError($res); |
$this->f->isDatabaseError($res); |
4800 |
|
|
4827 |
$return['archive_date_limite_incompletude'] = $row['date_limite_incompletude']; |
$return['archive_date_limite_incompletude'] = $row['date_limite_incompletude']; |
4828 |
$return['archive_delai_incompletude'] = $row['delai_incompletude']; |
$return['archive_delai_incompletude'] = $row['delai_incompletude']; |
4829 |
$return['archive_autorite_competente'] = $row['autorite_competente']; |
$return['archive_autorite_competente'] = $row['autorite_competente']; |
4830 |
|
$return['archive_dossier_instruction_type'] = $row['dossier_instruction_type']; |
4831 |
$return['duree_validite'] = $row['duree_validite']; |
$return['duree_validite'] = $row['duree_validite']; |
4832 |
$return['date_depot'] = $row['date_depot']; |
$return['date_depot'] = $row['date_depot']; |
4833 |
|
$return['date_depot_mairie'] = $row['date_depot_mairie']; |
4834 |
$return['archive_date_cloture_instruction'] = $row['date_cloture_instruction']; |
$return['archive_date_cloture_instruction'] = $row['date_cloture_instruction']; |
4835 |
$return['archive_date_premiere_visite'] = $row['date_premiere_visite']; |
$return['archive_date_premiere_visite'] = $row['date_premiere_visite']; |
4836 |
$return['archive_date_derniere_visite'] = $row['date_derniere_visite']; |
$return['archive_date_derniere_visite'] = $row['date_derniere_visite']; |
4838 |
$return['archive_date_retour_contradictoire'] = $row['date_retour_contradictoire']; |
$return['archive_date_retour_contradictoire'] = $row['date_retour_contradictoire']; |
4839 |
$return['archive_date_ait'] = $row['date_ait']; |
$return['archive_date_ait'] = $row['date_ait']; |
4840 |
$return['archive_date_transmission_parquet'] = $row['date_transmission_parquet']; |
$return['archive_date_transmission_parquet'] = $row['date_transmission_parquet']; |
4841 |
|
$return['archive_date_affichage'] = $row['date_affichage']; |
4842 |
|
$return['archive_pec_metier'] = $row['pec_metier']; |
4843 |
|
$return['archive_a_qualifier'] = $row['a_qualifier']; |
4844 |
} |
} |
4845 |
|
|
4846 |
// Retour de la fonction |
// Retour de la fonction |
4868 |
ON instruction.evenement = evenement.evenement |
ON instruction.evenement = evenement.evenement |
4869 |
WHERE instruction.instruction = $idx"; |
WHERE instruction.instruction = $idx"; |
4870 |
$this->f->addToLog("checkEvenementNonVerrouillable() : db->getOne(\"".$sql."\")", VERBOSE_MODE); |
$this->f->addToLog("checkEvenementNonVerrouillable() : db->getOne(\"".$sql."\")", VERBOSE_MODE); |
4871 |
$res = $this->db->getOne($sql); |
$res = $this->f->db->getOne($sql); |
4872 |
$this->f->isDatabaseError($res); |
$this->f->isDatabaseError($res); |
4873 |
|
|
4874 |
// Si le retour de la requête est true |
// Si le retour de la requête est true |
4956 |
if ($row['date_depot'] != '') { |
if ($row['date_depot'] != '') { |
4957 |
$this->valF['date_depot']= $row['date_depot']; |
$this->valF['date_depot']= $row['date_depot']; |
4958 |
} |
} |
4959 |
|
if ($row['date_depot_mairie'] != '') { |
4960 |
|
$this->valF['date_depot_mairie']= $row['date_depot_mairie']; |
4961 |
|
} |
4962 |
// Dates concernant les dossiers contentieux |
// Dates concernant les dossiers contentieux |
4963 |
if ($row['date_cloture_instruction'] != '') { |
if ($row['date_cloture_instruction'] != '') { |
4964 |
$this->valF['archive_date_cloture_instruction']= $row['date_cloture_instruction']; |
$this->valF['archive_date_cloture_instruction']= $row['date_cloture_instruction']; |
4981 |
if ($row['date_transmission_parquet'] != '') { |
if ($row['date_transmission_parquet'] != '') { |
4982 |
$this->valF['archive_date_transmission_parquet']= $row['date_transmission_parquet']; |
$this->valF['archive_date_transmission_parquet']= $row['date_transmission_parquet']; |
4983 |
} |
} |
4984 |
|
// |
4985 |
|
if ($row['dossier_instruction_type'] != '') { |
4986 |
|
$this->valF['archive_dossier_instruction_type']= $row['dossier_instruction_type']; |
4987 |
|
} |
4988 |
|
if ($row['date_affichage'] != '') { |
4989 |
|
$this->valF['archive_date_affichage']= $row['date_affichage']; |
4990 |
|
} |
4991 |
|
if (isset($row['pec_metier']) === true && $row['pec_metier'] != '') { |
4992 |
|
$this->valF['archive_pec_metier']= $row['pec_metier']; |
4993 |
|
} |
4994 |
|
if (isset($row['a_qualifier']) === true && $row['a_qualifier'] != '') { |
4995 |
|
$this->valF['archive_a_qualifier']= $row['a_qualifier']; |
4996 |
|
} |
4997 |
} |
} |
4998 |
|
|
4999 |
// {{{ |
// {{{ |
5125 |
"datecontrolelegalite"=>"", "ap_numrue"=>"", "ap_nomdelavoie"=>"", |
"datecontrolelegalite"=>"", "ap_numrue"=>"", "ap_nomdelavoie"=>"", |
5126 |
"ap_codepostal"=>"", "ap_ville"=>""); |
"ap_codepostal"=>"", "ap_ville"=>""); |
5127 |
|
|
5128 |
$sqlArrete = "SELECT signataire_arrete.nom as \"nomsignataire\", |
$sqlArrete = "SELECT |
5129 |
|
signataire_arrete.prenom || ' ' ||signataire_arrete.nom as \"nomsignataire\", |
5130 |
signataire_arrete.qualite as \"qualitesignataire\", |
signataire_arrete.qualite as \"qualitesignataire\", |
5131 |
instruction.etat as \"decisionarrete\", |
instruction.etat as \"decisionarrete\", |
5132 |
instruction.date_retour_rar as \"datenotification\", |
instruction.date_retour_rar as \"datenotification\", |
5144 |
LEFT JOIN ".DB_PREFIXE."donnees_techniques ON |
LEFT JOIN ".DB_PREFIXE."donnees_techniques ON |
5145 |
donnees_techniques.dossier_instruction = dossier.dossier |
donnees_techniques.dossier_instruction = dossier.dossier |
5146 |
WHERE instruction.instruction = ".$this->getVal("instruction"); |
WHERE instruction.instruction = ".$this->getVal("instruction"); |
5147 |
$resArrete = $this->db->query($sqlArrete); |
$resArrete = $this->f->db->query($sqlArrete); |
5148 |
$this->f->addToLog("getArreteMetadata(): db->query(\"".$sqlArrete."\");", VERBOSE_MODE); |
$this->f->addToLog("getArreteMetadata(): db->query(\"".$sqlArrete."\");", VERBOSE_MODE); |
5149 |
if ( database::isError($resArrete)){ |
if ( database::isError($resArrete)){ |
5150 |
die(); |
die(); |
5174 |
} |
} |
5175 |
|
|
5176 |
/** |
/** |
5177 |
|
* CONDITION - is_modifiable. |
5178 |
|
* |
5179 |
|
* Controle si l'évenement est modifiable. |
5180 |
|
* |
5181 |
|
* @return boolean |
5182 |
|
*/ |
5183 |
|
function is_evenement_modifiable() { |
5184 |
|
$evenement = $this->get_inst_evenement($this->getVal('evenement')); |
5185 |
|
return ! $this->get_boolean_from_pgsql_value($evenement->getVal('non_modifiable')); |
5186 |
|
} |
5187 |
|
|
5188 |
|
/** |
5189 |
* CONDITION - is_editable. |
* CONDITION - is_editable. |
5190 |
* |
* |
5191 |
* Condition pour la modification. |
* Condition pour la modification. |
5193 |
* @return boolean |
* @return boolean |
5194 |
*/ |
*/ |
5195 |
function is_editable() { |
function is_editable() { |
5196 |
|
|
5197 |
|
// XXX |
5198 |
|
// Identifier si l'instruction est lié à une tâche depuis le champ object_id (mais aussi voir le log car object_id peut être modifié) |
5199 |
|
// Si cette tâche identifiée est DONE alors la suppression/modification de cette intruction est impossible |
5200 |
|
|
5201 |
// Contrôle si l'utilisateur possède un bypass |
// Contrôle si l'utilisateur possède un bypass |
5202 |
$bypass = $this->f->isAccredited(get_class($this)."_modifier_bypass"); |
$bypass = $this->f->isAccredited($this->get_absolute_class_name()."_modifier_bypass"); |
5203 |
// |
// |
5204 |
if ($bypass == true) { |
if ($bypass == true) { |
5205 |
// |
// |
5222 |
return true; |
return true; |
5223 |
} |
} |
5224 |
|
|
|
// Si l'utilisateur est instructeur de la commune du dossier et que la |
|
|
// décision peut être changée par la commune. |
|
|
if ($this->is_instructeur_from_collectivite_dossier() === true and |
|
|
$this->isInstrCanChangeDecision($this->getVal('dossier')) === true) { |
|
|
return true; |
|
|
} |
|
|
|
|
5225 |
// Si l'utilisateur est instructeur de la commune du dossier et que |
// Si l'utilisateur est instructeur de la commune du dossier et que |
5226 |
// l'instruction est créée par un instructeur de la commune |
// l'instruction est créée par un instructeur de la commune |
5227 |
if ($this->is_instructeur_from_collectivite_dossier() === true and |
if ($this->is_instructeur_from_collectivite_dossier() === true and |
5234 |
} |
} |
5235 |
|
|
5236 |
/** |
/** |
5237 |
|
* Vérifie si l'événement est supprimable ou pas. |
5238 |
|
* |
5239 |
|
* @return boolean |
5240 |
|
*/ |
5241 |
|
function is_evenement_supprimable() { |
5242 |
|
// Controle si l'évenement est supprimable |
5243 |
|
$evenement = $this->get_inst_evenement($this->getVal('evenement')); |
5244 |
|
return ! $this->get_boolean_from_pgsql_value($evenement->getVal('non_supprimable')); |
5245 |
|
} |
5246 |
|
|
5247 |
|
/** |
5248 |
* CONDITION - is_deletable. |
* CONDITION - is_deletable. |
5249 |
* |
* |
5250 |
* Condition pour la suppression. |
* Condition pour la suppression. |
5252 |
* @return boolean |
* @return boolean |
5253 |
*/ |
*/ |
5254 |
function is_deletable() { |
function is_deletable() { |
5255 |
|
|
5256 |
|
// XXX |
5257 |
|
// Identifier si l'instruction est lié à une tâche depuis le champ object_id (mais aussi voir le log car object_id peut être modifié) |
5258 |
|
// Si cette tâche identifiée est DONE alors la suppression/modification de cette intruction est impossible |
5259 |
|
|
5260 |
// Contrôle si l'utilisateur possède un bypass intégral |
// Contrôle si l'utilisateur possède un bypass intégral |
5261 |
$bypass = $this->f->isAccredited(get_class($this)."_supprimer_bypass"); |
$bypass = $this->f->isAccredited($this->get_absolute_class_name()."_supprimer_bypass"); |
5262 |
// |
// |
5263 |
if ($bypass == true) { |
if ($bypass == true) { |
5264 |
|
|
5270 |
// division du dossier et si l'utilisateur n'a pas la permission bypass |
// division du dossier et si l'utilisateur n'a pas la permission bypass |
5271 |
// de la division |
// de la division |
5272 |
if ($this->is_instructeur_from_division_dossier() === false |
if ($this->is_instructeur_from_division_dossier() === false |
5273 |
&& $this->f->isAccredited(get_class()."_supprimer_bypass_division") === false) { |
&& $this->f->isAccredited($this->get_absolute_class_name()."_supprimer_bypass_division") === false) { |
5274 |
|
|
5275 |
// |
// |
5276 |
return false; |
return false; |
5279 |
// l'événement est-il le dernier ? |
// l'événement est-il le dernier ? |
5280 |
$dernier_evenement = false; |
$dernier_evenement = false; |
5281 |
// instanciation dossier |
// instanciation dossier |
5282 |
require_once "../obj/dossier.class.php"; |
$dossier = $this->f->get_inst__om_dbform(array( |
5283 |
$dossier = new dossier($this->getVal('dossier'), $this->db, DEBUG); |
"obj" => "dossier", |
5284 |
|
"idx" => $this->getVal('dossier'), |
5285 |
|
)); |
5286 |
// récupération dernier événement |
// récupération dernier événement |
5287 |
$id_dernier_evenement = $dossier->get_dernier_evenement(); |
$id_dernier_evenement = $dossier->get_dernier_evenement(); |
5288 |
if ($id_dernier_evenement == $this->getVal($this->clePrimaire)) { |
if ($id_dernier_evenement == $this->getVal($this->clePrimaire)) { |
5333 |
*/ |
*/ |
5334 |
function is_addable() { |
function is_addable() { |
5335 |
// Contrôle si l'utilisateur possède un bypass |
// Contrôle si l'utilisateur possède un bypass |
5336 |
$bypass = $this->f->isAccredited(get_class($this)."_ajouter_bypass"); |
$bypass = $this->f->isAccredited($this->get_absolute_class_name()."_ajouter_bypass"); |
5337 |
// |
// |
5338 |
if ($bypass == true) { |
if ($bypass == true) { |
5339 |
|
|
5361 |
*/ |
*/ |
5362 |
function is_finalizable() { |
function is_finalizable() { |
5363 |
// Contrôle si l'utilisateur possède un bypass |
// Contrôle si l'utilisateur possède un bypass |
5364 |
$bypass = $this->f->isAccredited(get_class($this)."_finaliser_bypass"); |
$bypass = $this->f->isAccredited($this->get_absolute_class_name()."_finaliser_bypass"); |
5365 |
// |
// |
5366 |
if ($bypass == true) { |
if ($bypass == true) { |
5367 |
// |
// |
5384 |
return true; |
return true; |
5385 |
} |
} |
5386 |
|
|
|
// Si l'utilisateur est instructeur de la commune du dossier et que la |
|
|
// décision peut être changée par la commune. |
|
|
if ($this->is_instructeur_from_collectivite_dossier() === true and |
|
|
$this->isInstrCanChangeDecision($this->getVal('dossier')) === true) { |
|
|
return true; |
|
|
} |
|
|
|
|
5387 |
// Si l'utilisateur est instructeur de la commune du dossier et que |
// Si l'utilisateur est instructeur de la commune du dossier et que |
5388 |
// l'instruction est créée par un instructeur de la commune |
// l'instruction est créée par un instructeur de la commune |
5389 |
if ($this->is_instructeur_from_collectivite_dossier() === true and |
if ($this->is_instructeur_from_collectivite_dossier() === true and |
5426 |
*/ |
*/ |
5427 |
function is_unfinalizable(){ |
function is_unfinalizable(){ |
5428 |
// Contrôle si l'utilisateur possède un bypass |
// Contrôle si l'utilisateur possède un bypass |
5429 |
$bypass = $this->f->isAccredited(get_class($this)."_definaliser_bypass"); |
$bypass = $this->f->isAccredited($this->get_absolute_class_name()."_definaliser_bypass"); |
5430 |
// |
// |
5431 |
if ($bypass == true) { |
if ($bypass == true) { |
5432 |
// |
// |
5449 |
return true; |
return true; |
5450 |
} |
} |
5451 |
|
|
|
// Si l'utilisateur est instructeur de la commune du dossier et que la |
|
|
// décision peut être changée par la commune. |
|
|
if ($this->is_instructeur_from_collectivite_dossier() === true and |
|
|
$this->isInstrCanChangeDecision($this->getVal('dossier')) === true) { |
|
|
return true; |
|
|
} |
|
|
|
|
5452 |
// Si l'utilisateur est instructeur de la commune du dossier et que |
// Si l'utilisateur est instructeur de la commune du dossier et que |
5453 |
// l'instruction est créée par un instructeur de la commune |
// l'instruction est créée par un instructeur de la commune |
5454 |
if ($this->is_instructeur_from_collectivite_dossier() === true and |
if ($this->is_instructeur_from_collectivite_dossier() === true and |
5542 |
if ($this->f->isCollectiviteMono($_SESSION['collectivite']) === true) { |
if ($this->f->isCollectiviteMono($_SESSION['collectivite']) === true) { |
5543 |
$sql .= " AND dossier.om_collectivite=".$_SESSION['collectivite']; |
$sql .= " AND dossier.om_collectivite=".$_SESSION['collectivite']; |
5544 |
} |
} |
5545 |
$res = $this->db->getone($sql); |
$res = $this->f->db->getone($sql); |
5546 |
if (database::isError($res)) { |
if (database::isError($res)) { |
5547 |
die(); |
die(); |
5548 |
} |
} |
5572 |
} |
} |
5573 |
|
|
5574 |
// Contrôle si l'utilisateur possède un bypass |
// Contrôle si l'utilisateur possède un bypass |
5575 |
$bypass = $this->f->isAccredited(get_class($this)."_modification_dates_bypass"); |
$bypass = $this->f->isAccredited($this->get_absolute_class_name()."_modification_dates_bypass"); |
5576 |
if ($bypass === true) { |
if ($bypass === true) { |
5577 |
return true; |
return true; |
5578 |
} |
} |
5579 |
|
|
5580 |
// On vérifie en premier lieu que le DI n'est pas clôturé |
// Permission de modifier le suivi des dates sur un dossier cloturé pour |
5581 |
|
// un utilisateur lié à un instructeur |
5582 |
|
$perm_moni_dates_d_closed = $this->f->isAccredited($this->get_absolute_class_name()."_modification_dates_cloture"); |
5583 |
|
|
5584 |
|
// On vérifie en premier lieu que le DI n'est pas clôturé et que |
5585 |
|
// l'utilisateur ne possède pas la permission de modifier le suivi des |
5586 |
|
// dates sur un dossier clôturé |
5587 |
$inst_dossier = $this->get_inst_dossier(); |
$inst_dossier = $this->get_inst_dossier(); |
5588 |
if ($inst_dossier->getStatut() === 'cloture') { |
if ($inst_dossier->getStatut() === 'cloture' |
5589 |
|
&& $perm_moni_dates_d_closed === false) { |
5590 |
// |
// |
5591 |
return false; |
return false; |
5592 |
} |
} |
5648 |
// Cette méthode permet d'exécuter une routine en début des méthodes |
// Cette méthode permet d'exécuter une routine en début des méthodes |
5649 |
// dites de TREATMENT. |
// dites de TREATMENT. |
5650 |
$this->begin_treatment(__METHOD__); |
$this->begin_treatment(__METHOD__); |
5651 |
|
$message = ''; |
5652 |
|
$ev = $this->get_inst_evenement($this->getVal('evenement')); |
5653 |
|
|
5654 |
|
// Controle du signataire |
5655 |
|
if (! $this->controle_signataire($ev)) { |
5656 |
|
$this->addToMessage(__("Le document ne peut pas être finalisé car aucun signataire n'a été sélectionné.")); |
5657 |
|
// Termine le traitement |
5658 |
|
return $this->end_treatment(__METHOD__, false); |
5659 |
|
} |
5660 |
|
|
5661 |
// Traitement de la finalisation |
// Traitement de la finalisation |
5662 |
$ret = $this->manage_finalizing("finalize", $val); |
$ret = $this->manage_finalizing("finalize", $val); |
5668 |
return $this->end_treatment(__METHOD__, false); |
return $this->end_treatment(__METHOD__, false); |
5669 |
} |
} |
5670 |
|
|
5671 |
|
// Envoi des notifications aux demandeurs si la notification est automatique |
5672 |
|
// et que la signature n'est pas requise |
5673 |
|
if ($ev->getVal('notification') === 'notification_automatique') { |
5674 |
|
// Récupération de la catégorie et envoie des notifications au(x) demandeur(s) |
5675 |
|
$collectivite_di = $this->get_dossier_instruction_om_collectivite($this->getVal('dossier')); |
5676 |
|
// Récupération de la liste des demandeurs à notifier et de la catégorie |
5677 |
|
$categorie = $this->f->get_param_option_notification($collectivite_di); |
5678 |
|
$isPortal = $categorie == null || $categorie == '' || $categorie == 'portal' ? true : false; |
5679 |
|
$demandeursANotifie = $this->get_demandeurs_notifiable( |
5680 |
|
$this->getVal('dossier'), |
5681 |
|
$isPortal |
5682 |
|
); |
5683 |
|
|
5684 |
|
// Création d'une notification et d'une tâche pour chaque demandeur à notifier |
5685 |
|
if (count($demandeursANotifie) > 0) { |
5686 |
|
foreach ($demandeursANotifie as $demandeur) { |
5687 |
|
// Ajout de la notif et récupération de son id |
5688 |
|
$idNotif = $this->ajouter_notification( |
5689 |
|
$this->getVal($this->clePrimaire), |
5690 |
|
$this->f->get_connected_user_login_name(), |
5691 |
|
$demandeur, |
5692 |
|
$collectivite_di, |
5693 |
|
true |
5694 |
|
); |
5695 |
|
if ($idNotif === false) { |
5696 |
|
// Termine le traitement |
5697 |
|
return $this->end_treatment(__METHOD__, false); |
5698 |
|
} |
5699 |
|
$notification_by_task = $this->notification_by_task( |
5700 |
|
$idNotif, |
5701 |
|
$this->getVal('dossier'), |
5702 |
|
$categorie |
5703 |
|
); |
5704 |
|
if ($notification_by_task === false) { |
5705 |
|
$this->addToMessage( |
5706 |
|
__("Erreur lors de la génération de la notification au(x) pétitionnaire(s).") |
5707 |
|
); |
5708 |
|
// Termine le traitement |
5709 |
|
return $this->end_treatment(__METHOD__, false); |
5710 |
|
} |
5711 |
|
} |
5712 |
|
$this->addToMessage($message .= sprintf('%s<br/>%s', __("La notification a été générée."), __("Le suivi de la notification est disponible depuis l'instruction."))); |
5713 |
|
} |
5714 |
|
} |
5715 |
|
|
5716 |
// Termine le traitement |
// Termine le traitement |
5717 |
return $this->end_treatment(__METHOD__, true); |
return $this->end_treatment(__METHOD__, true); |
5718 |
} |
} |
5719 |
|
|
5720 |
/** |
/** |
5721 |
|
* Vérifie si le signataire est obligatoire pour finaliser |
5722 |
|
* le document apartir du paramétrage de l'événement. |
5723 |
|
* Si c'est le cas, vérifie si il y a bien un signataire |
5724 |
|
* renseigné. |
5725 |
|
* Si c'est le cas renvoie true, sinon renvoie false. |
5726 |
|
* |
5727 |
|
* @param evenement évenement de l'instruction permettant de |
5728 |
|
* récupérer le paramétrage |
5729 |
|
* @return boolean |
5730 |
|
*/ |
5731 |
|
protected function controle_signataire($evenement) { |
5732 |
|
// Vérifie si le signataire est obligatoire et si c'est le cas |
5733 |
|
// vérifie si il y a bien un signataire pour le document |
5734 |
|
if ($evenement->is_signataire_obligatoire() && |
5735 |
|
($this->getVal('signataire_arrete') === null || |
5736 |
|
$this->getVal('signataire_arrete') === '')) { |
5737 |
|
return false; |
5738 |
|
} |
5739 |
|
return true; |
5740 |
|
} |
5741 |
|
|
5742 |
|
/** |
5743 |
* TREATMENT - unfinalize. |
* TREATMENT - unfinalize. |
5744 |
* |
* |
5745 |
* Permet de définaliser un enregistrement. |
* Permet de définaliser un enregistrement. |
5782 |
&& $this->getVal("om_final_instruction") != null) { |
&& $this->getVal("om_final_instruction") != null) { |
5783 |
|
|
5784 |
// Ouvre le document |
// Ouvre le document |
5785 |
$lien = '../spg/file.php?obj='.$this->table.'&'. |
$lien = '../app/index.php?module=form&snippet=file&obj='.$this->table.'&'. |
5786 |
'champ=om_fichier_instruction&id='.$this->getVal($this->clePrimaire); |
'champ=om_fichier_instruction&id='.$this->getVal($this->clePrimaire); |
5787 |
// |
// |
5788 |
header("Location: ".$lien); |
header("Location: ".$lien); |
5801 |
"mode" => "previsualisation", |
"mode" => "previsualisation", |
5802 |
), |
), |
5803 |
); |
); |
5804 |
|
// Si la rédaction libre est activée sur l'instruction |
5805 |
|
if ($this->getVal("flag_edition_integrale") == 't') { |
5806 |
|
$params["specific"]["corps"] = array( |
5807 |
|
"mode" => "set", |
5808 |
|
"value" => $this->getVal("corps_om_htmletatex"), |
5809 |
|
); |
5810 |
|
$params["specific"]["titre"] = array( |
5811 |
|
"mode" => "set", |
5812 |
|
"value" => $this->getVal("titre_om_htmletat"), |
5813 |
|
); |
5814 |
|
} |
5815 |
|
|
5816 |
// Génération du PDF |
// Génération du PDF |
5817 |
$result = $this->compute_pdf_output('lettretype', $this->getVal("lettretype"), $collectivite, null, $params); |
$result = $this->compute_pdf_output('lettretype', $this->getVal("lettretype"), $collectivite, null, $params); |
5834 |
|
|
5835 |
// Si l'identifiant n'est pas renseigné |
// Si l'identifiant n'est pas renseigné |
5836 |
if ($dossier_instruction_id === null) { |
if ($dossier_instruction_id === null) { |
5837 |
// Récupère la valeur en base de données |
// Récupère la valeur |
5838 |
$dossier_instruction_id = $this->getVal('dossier'); |
if ($this->getVal('dossier') !== null && $this->getVal('dossier') !== '') { |
5839 |
|
$dossier_instruction_id = $this->getVal('dossier'); |
5840 |
|
} elseif ($this->getParameter('idxformulaire') !== null |
5841 |
|
&& $this->getParameter('idxformulaire') !== '') { |
5842 |
|
// |
5843 |
|
$dossier_instruction_id = $this->getParameter('idxformulaire'); |
5844 |
|
} elseif ($this->f->get_submitted_get_value('idxformulaire') !== null |
5845 |
|
&& $this->f->get_submitted_get_value('idxformulaire') !== '') { |
5846 |
|
// |
5847 |
|
$dossier_instruction_id = $this->f->get_submitted_get_value('idxformulaire'); |
5848 |
|
} |
5849 |
} |
} |
5850 |
|
|
5851 |
// |
// |
5852 |
require_once "../obj/dossier_instruction.class.php"; |
$dossier_instruction = $this->f->get_inst__om_dbform(array( |
5853 |
$dossier_instruction = new dossier_instruction($dossier_instruction_id, $this->f->db, false); |
"obj" => "dossier_instruction", |
5854 |
|
"idx" => $dossier_instruction_id, |
5855 |
|
)); |
5856 |
|
|
5857 |
// |
// |
5858 |
return $dossier_instruction->getVal('om_collectivite'); |
return $dossier_instruction->getVal('om_collectivite'); |
5869 |
// Vérification de l'accessibilité sur l'élément |
// Vérification de l'accessibilité sur l'élément |
5870 |
$this->checkAccessibility(); |
$this->checkAccessibility(); |
5871 |
|
|
|
// XXX APP |
|
|
|
|
|
$f = $this->f; |
|
|
|
|
5872 |
/** |
/** |
5873 |
* Affichage de la structure HTML |
* Affichage de la structure HTML |
5874 |
*/ |
*/ |
5875 |
// |
// |
5876 |
if ($f->isAjaxRequest()) { |
if ($this->f->isAjaxRequest()) { |
5877 |
// |
// |
5878 |
header("Content-type: text/html; charset=".HTTPCHARSET.""); |
header("Content-type: text/html; charset=".HTTPCHARSET.""); |
5879 |
} else { |
} else { |
5880 |
// |
// |
5881 |
$f->setFlag("htmlonly"); |
$this->f->setFlag("htmlonly"); |
5882 |
$f->display(); |
$this->f->display(); |
5883 |
} |
} |
5884 |
// |
// |
5885 |
$f->displayStartContent(); |
$this->f->displayStartContent(); |
5886 |
// |
// |
5887 |
$f->setTitle(_("Liste des éléments de la bible en lien avec un evenement")); |
$this->f->setTitle(_("Liste des éléments de la bible en lien avec un evenement")); |
5888 |
$f->displayTitle(); |
$this->f->displayTitle(); |
5889 |
|
|
5890 |
/** |
/** |
5891 |
* |
* |
5892 |
*/ |
*/ |
5893 |
// |
// |
5894 |
($f->get_submitted_get_value("ev") ? $evenement = $f->get_submitted_get_value("ev") : $evenement = ""); |
($this->f->get_submitted_get_value("ev") ? $evenement = $this->f->get_submitted_get_value("ev") : $evenement = ""); |
5895 |
$evenement = intval($evenement); |
$evenement = intval($evenement); |
5896 |
// |
// |
5897 |
($f->get_submitted_get_value("idx") ? $idx = $f->get_submitted_get_value("idx") : $idx = ""); |
($this->f->get_submitted_get_value("idx") ? $idx = $this->f->get_submitted_get_value("idx") : $idx = ""); |
5898 |
// Récupération du code du type de DA |
// Récupération du code du type de DA |
5899 |
$code_da_type = ''; |
$code_da_type = ''; |
5900 |
if (preg_match('/[A-Za-z]{2,3}/', $idx, $matches) !== false) { |
if (preg_match('/[A-Za-z]{2,3}/', $idx, $matches) !== false) { |
5901 |
$code_da_type = $matches[0]; |
$code_da_type = $matches[0]; |
5902 |
} |
} |
5903 |
// |
// |
5904 |
($f->get_submitted_get_value("complement") ? $complement = $f->get_submitted_get_value("complement") : $complement = "1"); |
($this->f->get_submitted_get_value("complement") ? $complement = $this->f->get_submitted_get_value("complement") : $complement = "1"); |
5905 |
|
|
5906 |
// Récupération de la collectivité du dossier |
// Récupération de la collectivité du dossier |
5907 |
require_once "../obj/dossier.class.php"; |
$dossier = $this->f->get_inst__om_dbform(array( |
5908 |
$dossier = new dossier($idx, $f->db, DEBUG); |
"obj" => "dossier", |
5909 |
|
"idx" => $idx, |
5910 |
|
)); |
5911 |
|
|
5912 |
/** |
/** |
5913 |
* |
* |
5920 |
LEFT JOIN ".DB_PREFIXE."om_collectivite |
LEFT JOIN ".DB_PREFIXE."om_collectivite |
5921 |
ON bible.om_collectivite = om_collectivite.om_collectivite |
ON bible.om_collectivite = om_collectivite.om_collectivite |
5922 |
WHERE (evenement=".$evenement." OR evenement IS NULL) |
WHERE (evenement=".$evenement." OR evenement IS NULL) |
5923 |
AND complement=".$complement." |
AND (complement=".$complement." OR complement IS NULL) |
5924 |
AND (bible.dossier_autorisation_type IS NULL |
AND (bible.dossier_autorisation_type IS NULL |
5925 |
OR dossier_autorisation_type.code ='".$code_da_type."') |
OR dossier_autorisation_type.code ='".$code_da_type."') |
5926 |
AND (om_collectivite.niveau = '2' |
AND (om_collectivite.niveau = '2' |
5927 |
OR bible.om_collectivite = ".$dossier->getVal("om_collectivite").") |
OR bible.om_collectivite = ".$dossier->getVal("om_collectivite").") |
5928 |
ORDER BY bible_lib ASC"; |
ORDER BY bible_lib ASC"; |
5929 |
$res = $f->db->query($sql); |
$res = $this->f->db->query($sql); |
5930 |
$f->addToLog(__METHOD__.": db->query(\"".$sql."\");", VERBOSE_MODE); |
$this->f->addToLog(__METHOD__.": db->query(\"".$sql."\");", VERBOSE_MODE); |
5931 |
$f->isDatabaseError($res); |
$this->f->isDatabaseError($res); |
5932 |
// |
// |
5933 |
echo "<form method=\"post\" name=\"f3\" action=\"#\">\n"; |
echo "<form method=\"post\" name=\"f3\" action=\"#\">\n"; |
5934 |
// |
// |
5960 |
echo "\t</table>\n"; |
echo "\t</table>\n"; |
5961 |
// |
// |
5962 |
echo "<div class=\"formControls\">\n"; |
echo "<div class=\"formControls\">\n"; |
5963 |
$f->layout->display_form_button(array( |
$this->f->layout->display_form_button(array( |
5964 |
"value" => _("Valider"), |
"value" => _("Valider"), |
5965 |
"onclick" => "bible_return('f2', 'complement".($complement == "1" ? "" : $complement)."_om_html'); return false;", |
"onclick" => "bible_return('f2', 'complement".($complement == "1" ? "" : $complement)."_om_html'); return false;", |
5966 |
)); |
)); |
5967 |
$f->displayLinkJsCloseWindow(); |
$this->f->displayLinkJsCloseWindow(); |
5968 |
echo "</div>\n"; |
echo "</div>\n"; |
5969 |
|
|
5970 |
} else { |
} else { |
5971 |
// |
// |
5972 |
$message_class = "error"; |
$message_class = "error"; |
5973 |
$message = _("Aucun element dans la bible pour l'evenement")." : ".$evenement; |
$message = _("Aucun element dans la bible pour l'evenement")." : ".$evenement; |
5974 |
$f->displayMessage($message_class, $message); |
$this->f->displayMessage($message_class, $message); |
5975 |
// |
// |
5976 |
echo "<div class=\"formControls\">\n"; |
echo "<div class=\"formControls\">\n"; |
5977 |
$f->displayLinkJsCloseWindow(); |
$this->f->displayLinkJsCloseWindow(); |
5978 |
echo "</div>\n"; |
echo "</div>\n"; |
5979 |
} |
} |
5980 |
// |
// |
5984 |
* Affichage de la structure HTML |
* Affichage de la structure HTML |
5985 |
*/ |
*/ |
5986 |
// |
// |
5987 |
$f->displayEndContent(); |
$this->f->displayEndContent(); |
5988 |
} |
} |
5989 |
|
|
5990 |
/** |
/** |
5997 |
function view_bible_auto() { |
function view_bible_auto() { |
5998 |
// Vérification de l'accessibilité sur l'élément |
// Vérification de l'accessibilité sur l'élément |
5999 |
$this->checkAccessibility(); |
$this->checkAccessibility(); |
|
|
|
|
// XXX APP |
|
|
|
|
|
$f = $this->f; |
|
|
|
|
6000 |
// |
// |
6001 |
$f->disableLog(); |
$this->f->disableLog(); |
6002 |
|
|
6003 |
$formatDate="AAAA-MM-JJ"; |
$formatDate="AAAA-MM-JJ"; |
6004 |
|
|
6005 |
// Récupération des paramètres |
// Récupération des paramètres |
6006 |
$idx = $f->get_submitted_get_value('idx'); |
$idx = $this->f->get_submitted_get_value('idx'); |
6007 |
$evenement = $f->get_submitted_get_value('ev'); |
$evenement = $this->f->get_submitted_get_value('ev'); |
6008 |
|
|
6009 |
// Initialisation de la variable de retour |
// Initialisation de la variable de retour |
6010 |
$retour['complement_om_html'] = ''; |
$retour['complement_om_html'] = ''; |
6012 |
$retour['complement3_om_html'] = ''; |
$retour['complement3_om_html'] = ''; |
6013 |
$retour['complement4_om_html'] = ''; |
$retour['complement4_om_html'] = ''; |
6014 |
// Vérification d'une consultation liée à l'événement |
// Vérification d'une consultation liée à l'événement |
6015 |
$consultation = $f->db->getOne( |
$consultation = $this->f->db->getOne( |
6016 |
"select consultation from ".DB_PREFIXE."evenement where evenement=".$evenement |
"select consultation from ".DB_PREFIXE."evenement where evenement=".$evenement |
6017 |
); |
); |
6018 |
$f->isDatabaseError($consultation); |
$this->f->isDatabaseError($consultation); |
6019 |
// Si consultation liée, récupération du retour d'avis |
// Si consultation liée, récupération du retour d'avis |
6020 |
if($consultation=='Oui'){ |
if($consultation=='Oui'){ |
6021 |
$sql="select date_retour,avis_consultation.libelle as avis_consultation, |
$sql="select date_retour,avis_consultation.libelle as avis_consultation, |
6024 |
on consultation.service =service.service |
on consultation.service =service.service |
6025 |
left join ".DB_PREFIXE."avis_consultation on |
left join ".DB_PREFIXE."avis_consultation on |
6026 |
consultation.avis_consultation = avis_consultation.avis_consultation |
consultation.avis_consultation = avis_consultation.avis_consultation |
6027 |
where dossier ='".$idx."'"; |
where dossier ='".$idx."' and consultation.visible"; |
6028 |
$res = $f->db->query($sql); |
$res = $this->f->db->query($sql); |
6029 |
$f->isDatabaseError($res); |
$this->f->isDatabaseError($res); |
6030 |
// Récupération des consultations |
// Récupération des consultations |
6031 |
while ($row=& $res->fetchRow(DB_FETCHMODE_ASSOC)){ |
while ($row=& $res->fetchRow(DB_FETCHMODE_ASSOC)){ |
6032 |
$correct=false; |
$correct=false; |
6056 |
|
|
6057 |
} // consultation |
} // consultation |
6058 |
// Récupération des bibles automatiques pour le champ complement_om_html |
// Récupération des bibles automatiques pour le champ complement_om_html |
6059 |
$retour['complement_om_html'] .= $this->getBible($f, $evenement, $idx, '1'); |
$retour['complement_om_html'] .= $this->getBible($evenement, $idx, '1'); |
6060 |
// Récupération des bibles automatiques pour le champ complement2_om_html |
// Récupération des bibles automatiques pour le champ complement2_om_html |
6061 |
$retour['complement2_om_html'] .= $this->getBible($f, $evenement, $idx, '2'); |
$retour['complement2_om_html'] .= $this->getBible($evenement, $idx, '2'); |
6062 |
// Récupération des bibles automatiques pour le champ complement3_om_html |
// Récupération des bibles automatiques pour le champ complement3_om_html |
6063 |
$retour['complement3_om_html'] .= $this->getBible($f, $evenement, $idx, '3'); |
$retour['complement3_om_html'] .= $this->getBible($evenement, $idx, '3'); |
6064 |
// Récupération des bibles automatiques pour le champ complement4_om_html |
// Récupération des bibles automatiques pour le champ complement4_om_html |
6065 |
$retour['complement4_om_html'] .= $this->getBible($f, $evenement, $idx, '4'); |
$retour['complement4_om_html'] .= $this->getBible($evenement, $idx, '4'); |
6066 |
|
|
6067 |
|
|
6068 |
|
|
6076 |
*/ |
*/ |
6077 |
function view_pdf_temp() { |
function view_pdf_temp() { |
6078 |
$this->checkAccessibility(); |
$this->checkAccessibility(); |
6079 |
|
// Utilisation de $_POST pour ne pas que les textes soient altérés. |
6080 |
$this->f->set_submitted_value(); |
$this->f->set_submitted_value(); |
6081 |
$merge_fields = array( |
$merge_fields = array(); |
6082 |
'[complement_instruction]' => urldecode($_POST['c1']), |
// |
6083 |
'[complement1_instruction]' => urldecode($_POST['c1']), |
if (array_key_exists('c1', $_POST) === true) { |
6084 |
'[complement2_instruction]' => urldecode($_POST['c2']), |
$merge_fields['[complement_instruction]'] = urldecode($_POST['c1']); |
6085 |
'[complement3_instruction]' => urldecode($_POST['c3']), |
$merge_fields['[complement1_instruction]'] = urldecode($_POST['c1']); |
6086 |
'[complement4_instruction]' => urldecode($_POST['c4']), |
} |
6087 |
); |
if (array_key_exists('c2', $_POST) === true) { |
6088 |
|
$merge_fields['[complement2_instruction]'] = urldecode($_POST['c2']); |
6089 |
|
} |
6090 |
|
if (array_key_exists('c3', $_POST) === true) { |
6091 |
|
$merge_fields['[complement3_instruction]'] = urldecode($_POST['c3']); |
6092 |
|
} |
6093 |
|
if (array_key_exists('c4', $_POST) === true) { |
6094 |
|
$merge_fields['[complement4_instruction]'] = urldecode($_POST['c4']); |
6095 |
|
} |
6096 |
$params = array( |
$params = array( |
6097 |
"watermark" => true, |
"watermark" => true, |
6098 |
"specific" => array( |
"specific" => array( |
6099 |
"merge_fields" => $merge_fields, |
"merge_fields" => $merge_fields, |
6100 |
), |
), |
6101 |
); |
); |
6102 |
|
// |
6103 |
|
if (array_key_exists('corps', $_POST) === true) { |
6104 |
|
$params["specific"]["corps"] = array( |
6105 |
|
"mode" => "set", |
6106 |
|
"value" => urldecode($_POST['corps']), |
6107 |
|
); |
6108 |
|
} |
6109 |
|
if (array_key_exists('titre', $_POST) === true) { |
6110 |
|
$params["specific"]["titre"] = array( |
6111 |
|
"mode" => "set", |
6112 |
|
"value" => urldecode($_POST['titre']), |
6113 |
|
); |
6114 |
|
} |
6115 |
$dossier_instruction_om_collectivite = $this->get_dossier_instruction_om_collectivite(); |
$dossier_instruction_om_collectivite = $this->get_dossier_instruction_om_collectivite(); |
6116 |
$collectivite = $this->f->getCollectivite($dossier_instruction_om_collectivite); |
$collectivite = $this->f->getCollectivite($dossier_instruction_om_collectivite); |
6117 |
$result = $this->compute_pdf_output('lettretype', $this->getVal('lettretype'), $collectivite, null, $params); |
$result = $this->compute_pdf_output('lettretype', $this->getVal('lettretype'), $collectivite, null, $params); |
6132 |
$params = array( |
$params = array( |
6133 |
"watermark" => true, |
"watermark" => true, |
6134 |
); |
); |
6135 |
|
// Si la rédaction libre est activée sur l'instruction |
6136 |
|
if ($this->getVal("flag_edition_integrale") == 't') { |
6137 |
|
$params["specific"]["corps"] = array( |
6138 |
|
"mode" => "set", |
6139 |
|
"value" => $this->getVal("corps_om_htmletatex"), |
6140 |
|
); |
6141 |
|
$params["specific"]["titre"] = array( |
6142 |
|
"mode" => "set", |
6143 |
|
"value" => $this->getVal("titre_om_htmletat"), |
6144 |
|
); |
6145 |
|
} |
6146 |
$dossier_instruction_om_collectivite = $this->get_dossier_instruction_om_collectivite(); |
$dossier_instruction_om_collectivite = $this->get_dossier_instruction_om_collectivite(); |
6147 |
$collectivite = $this->f->getCollectivite($dossier_instruction_om_collectivite); |
$collectivite = $this->f->getCollectivite($dossier_instruction_om_collectivite); |
6148 |
$result = $this->compute_pdf_output('lettretype', $this->getVal('lettretype'), $collectivite, null, $params); |
$result = $this->compute_pdf_output('lettretype', $this->getVal('lettretype'), $collectivite, null, $params); |
6153 |
/** |
/** |
6154 |
* Récupération des éléments de bible. |
* Récupération des éléments de bible. |
6155 |
* |
* |
|
* @param utils $f handler de om_application |
|
6156 |
* @param integer $event id de l'événement |
* @param integer $event id de l'événement |
6157 |
* @param string $idx id du dossier |
* @param string $idx id du dossier |
6158 |
* @param integer $compnb numéro du champ complement |
* @param integer $compnb numéro du champ complement |
6159 |
* |
* |
6160 |
* @return string Chaîne de texte à insérer dans le champ complement |
* @return string Chaîne de texte à insérer dans le champ complement |
6161 |
*/ |
*/ |
6162 |
function getBible($f, $event, $idx, $compnb) { |
function getBible($event, $idx, $compnb) { |
6163 |
// Récupération de la collectivité du dossier |
// Récupération de la collectivité du dossier |
6164 |
require_once "../obj/dossier.class.php"; |
$dossier = $this->f->get_inst__om_dbform(array( |
6165 |
$dossier = new dossier($idx, $f->db, DEBUG); |
"obj" => "dossier", |
6166 |
|
"idx" => $idx, |
6167 |
|
)); |
6168 |
// Récupération du code du type de DA |
// Récupération du code du type de DA |
6169 |
$code_da_type = ''; |
$code_da_type = ''; |
6170 |
if (preg_match('/[A-Za-z]{2,3}/', $idx, $matches) !== false) { |
if (preg_match('/[A-Za-z]{2,3}/', $idx, $matches) !== false) { |
6179 |
".DB_PREFIXE."om_collectivite |
".DB_PREFIXE."om_collectivite |
6180 |
ON bible.om_collectivite = om_collectivite.om_collectivite |
ON bible.om_collectivite = om_collectivite.om_collectivite |
6181 |
WHERE (evenement =".$event." or evenement IS NULL) and |
WHERE (evenement =".$event." or evenement IS NULL) and |
6182 |
complement=".$compnb." and |
(complement=".$compnb." OR complement IS NULL) and |
6183 |
automatique='Oui' and |
automatique='Oui' and |
6184 |
(dossier_autorisation_type.code ='".$code_da_type."' or |
(dossier_autorisation_type.code ='".$code_da_type."' or |
6185 |
bible.dossier_autorisation_type IS NULL) and |
bible.dossier_autorisation_type IS NULL) and |
6186 |
(om_collectivite.niveau = '2' OR bible.om_collectivite = ".$dossier->getVal("om_collectivite").")"; |
(om_collectivite.niveau = '2' OR bible.om_collectivite = ".$dossier->getVal("om_collectivite").")"; |
6187 |
|
|
6188 |
$res = $f->db->query($sql); |
$res = $this->f->db->query($sql); |
6189 |
$f->isDatabaseError($res); |
$this->f->isDatabaseError($res); |
6190 |
$temp = ""; |
$temp = ""; |
6191 |
while ($row=& $res->fetchRow(DB_FETCHMODE_ASSOC)){ |
while ($row=& $res->fetchRow(DB_FETCHMODE_ASSOC)){ |
6192 |
// Remplacement des retours à la ligne par des br |
// Remplacement des retours à la ligne par des br |
6212 |
// Vérification de l'accessibilité sur l'élément |
// Vérification de l'accessibilité sur l'élément |
6213 |
$this->checkAccessibility(); |
$this->checkAccessibility(); |
6214 |
|
|
|
// XXX APP |
|
|
|
|
|
$f = $this->f; |
|
|
|
|
6215 |
/** |
/** |
6216 |
* Validation du formulaire |
* Validation du formulaire |
6217 |
*/ |
*/ |
6218 |
// Si le formulaire a été validé |
// Si le formulaire a été validé |
6219 |
if ($f->get_submitted_post_value("validation") !== null) { |
if ($this->f->get_submitted_post_value("validation") !== null) { |
6220 |
// Si un bordereau à été sélectionné |
// Si un bordereau à été sélectionné |
6221 |
if ($f->get_submitted_post_value("bordereau") !== null && $f->get_submitted_post_value("bordereau") == "" ) { |
if ($this->f->get_submitted_post_value("bordereau") !== null && $this->f->get_submitted_post_value("bordereau") == "" ) { |
6222 |
// Si aucun bordereau n'a été sélectionné |
// Si aucun bordereau n'a été sélectionné |
6223 |
$message_class = "error"; |
$message_class = "error"; |
6224 |
$message = _("Veuillez selectionner un bordereau."); |
$message = _("Veuillez selectionner un bordereau."); |
6225 |
} |
} |
6226 |
// Sinon si les dates ne sont pas valide |
// Sinon si les dates ne sont pas valide |
6227 |
elseif (($f->get_submitted_post_value("date_bordereau_debut") !== null |
elseif (($this->f->get_submitted_post_value("date_bordereau_debut") !== null |
6228 |
&& $f->get_submitted_post_value("date_bordereau_debut") == "") |
&& $this->f->get_submitted_post_value("date_bordereau_debut") == "") |
6229 |
|| ($f->get_submitted_post_value("date_bordereau_fin") !== null |
|| ($this->f->get_submitted_post_value("date_bordereau_fin") !== null |
6230 |
&& $f->get_submitted_post_value("date_bordereau_fin") == "")) { |
&& $this->f->get_submitted_post_value("date_bordereau_fin") == "")) { |
6231 |
// Si aucune date n'a été saisie |
// Si aucune date n'a été saisie |
6232 |
$message_class = "error"; |
$message_class = "error"; |
6233 |
$message = _("Veuillez saisir une date valide."); |
$message = _("Veuillez saisir une date valide."); |
6234 |
} |
} |
6235 |
// Sinon si les dates ne sont pas valides |
// Sinon si les dates ne sont pas valides |
6236 |
elseif ($f->get_submitted_post_value("bordereau") === "bordereau_avis_maire_prefet" |
elseif ($this->f->get_submitted_post_value("bordereau") === "bordereau_avis_maire_prefet" |
6237 |
&& $f->getParameter("id_evenement_bordereau_avis_maire_prefet") == null) { |
&& $this->f->getParameter("id_evenement_bordereau_avis_maire_prefet") == null) { |
6238 |
// Si aucune date n'a été saisie |
// Si aucune date n'a été saisie |
6239 |
$message_class = "error"; |
$message_class = "error"; |
6240 |
$message = _("Erreur de parametrage. Contactez votre administrateur."); |
$message = _("Erreur de parametrage. Contactez votre administrateur."); |
6244 |
// 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 |
6245 |
$sql = "SELECT om_etat.libelle |
$sql = "SELECT om_etat.libelle |
6246 |
FROM ".DB_PREFIXE."om_etat |
FROM ".DB_PREFIXE."om_etat |
6247 |
WHERE om_etat.id = '".$f->get_submitted_post_value("bordereau")."'"; |
WHERE om_etat.id = '".$this->f->get_submitted_post_value("bordereau")."'"; |
6248 |
$res = $f->db->getone($sql); |
$res = $this->f->db->getone($sql); |
6249 |
$f->addToLog(__METHOD__.": db->getone(\"".$sql."\")", VERBOSE_MODE); |
$this->f->addToLog(__METHOD__.": db->getone(\"".$sql."\")", VERBOSE_MODE); |
6250 |
$f->isDatabaseError($res); |
$this->f->isDatabaseError($res); |
6251 |
// |
// |
6252 |
$message_class = "valid"; |
$message_class = "valid"; |
6253 |
$message = _("Cliquez sur le lien ci-dessous pour telecharger votre bordereau"); |
$message = _("Cliquez sur le lien ci-dessous pour telecharger votre bordereau"); |
6254 |
$message .= " : <br/><br/>"; |
$message .= " : <br/><br/>"; |
6255 |
$message .= "<a class='om-prev-icon pdf-16'"; |
$message .= "<a class='om-prev-icon pdf-16'"; |
6256 |
$message .= " title=\""._("Bordereau")."\""; |
$message .= " title=\""._("Bordereau")."\""; |
6257 |
$message .= "href='../scr/form.php?obj=instruction"; |
$message .= "href='".OM_ROUTE_FORM."&obj=instruction"; |
6258 |
$message .= "&action=220"; |
$message .= "&action=220"; |
6259 |
$message .= "&idx=0"; |
$message .= "&idx=0"; |
6260 |
$message .= "&type_bordereau=".$f->get_submitted_post_value("bordereau"); |
$message .= "&type_bordereau=".$this->f->get_submitted_post_value("bordereau"); |
6261 |
$message .= "&date_bordereau_debut=".$f->get_submitted_post_value("date_bordereau_debut"); |
$message .= "&date_bordereau_debut=".$this->f->get_submitted_post_value("date_bordereau_debut"); |
6262 |
$message .= "&date_bordereau_fin=".$f->get_submitted_post_value("date_bordereau_fin"); |
$message .= "&date_bordereau_fin=".$this->f->get_submitted_post_value("date_bordereau_fin"); |
6263 |
// Si l'utilisateur est MULTI alors on ajoute le paramètre collectivite |
// Si l'utilisateur est MULTI alors on ajoute le paramètre collectivite |
6264 |
if ($f->get_submitted_post_value("om_collectivite") !== null) { |
if ($this->f->get_submitted_post_value("om_collectivite") !== null) { |
6265 |
$message .= "&collectivite=".$f->get_submitted_post_value("om_collectivite"); |
$message .= "&collectivite=".$this->f->get_submitted_post_value("om_collectivite"); |
6266 |
} |
} |
6267 |
$message .= "'"." target='_blank'>"; |
$message .= "'"." target='_blank'>"; |
6268 |
$message .= $res." "._("du")." ".$f->get_submitted_post_value("date_bordereau_debut") |
$message .= $res." "._("du")." ".$this->f->get_submitted_post_value("date_bordereau_debut") |
6269 |
." "._("au")." ".$f->get_submitted_post_value("date_bordereau_fin"); |
." "._("au")." ".$this->f->get_submitted_post_value("date_bordereau_fin"); |
6270 |
$message .= "</a>"; |
$message .= "</a>"; |
6271 |
} |
} |
6272 |
} |
} |
6276 |
*/ |
*/ |
6277 |
// Affichage du message de validation ou d'erreur |
// Affichage du message de validation ou d'erreur |
6278 |
if (isset($message) && isset($message_class) && $message != "") { |
if (isset($message) && isset($message_class) && $message != "") { |
6279 |
$f->displayMessage($message_class, $message); |
$this->f->displayMessage($message_class, $message); |
6280 |
} |
} |
|
// Inclusion de la classe de gestion des formulaires |
|
|
require_once "../obj/om_formulaire.class.php"; |
|
6281 |
// Ouverture du formulaire |
// Ouverture du formulaire |
6282 |
printf("\t<form"); |
printf("\t<form"); |
6283 |
printf(" method=\"post\""); |
printf(" method=\"post\""); |
6286 |
printf(">\n"); |
printf(">\n"); |
6287 |
// Paramétrage des champs du formulaire |
// Paramétrage des champs du formulaire |
6288 |
$champs = array("date_bordereau_debut", "date_bordereau_fin", "bordereau"); |
$champs = array("date_bordereau_debut", "date_bordereau_fin", "bordereau"); |
6289 |
// Si l'utilisateur est d'une collectivité de niveau 2 on affiche un select |
// Si l'utilisateur est d'une collectivité de niveau 2 on affiche un select |
6290 |
// collectivité dans le formulaire |
// collectivité dans le formulaire |
6291 |
if($_SESSION["niveau"] == 2) { |
if ($_SESSION["niveau"] == 2) { |
6292 |
array_push($champs, "om_collectivite"); |
array_push($champs, "om_collectivite"); |
6293 |
} |
} |
6294 |
// Création d'un nouvel objet de type formulaire |
// Création d'un nouvel objet de type formulaire |
6295 |
$form = new formulaire(NULL, 0, 0, $champs); |
$form = $this->f->get_inst__om_formulaire(array( |
6296 |
|
"validation" => 0, |
6297 |
|
"maj" => 0, |
6298 |
|
"champs" => $champs, |
6299 |
|
)); |
6300 |
// Paramétrage du champ date_bordereau_debut |
// Paramétrage du champ date_bordereau_debut |
6301 |
$form->setLib("date_bordereau_debut", _("date_bordereau_debut")); |
$form->setLib("date_bordereau_debut", _("date_bordereau_debut")); |
6302 |
$form->setType("date_bordereau_debut", "date"); |
$form->setType("date_bordereau_debut", "date"); |
6318 |
$form->setType("bordereau", "select"); |
$form->setType("bordereau", "select"); |
6319 |
$form->setRequired("bordereau"); |
$form->setRequired("bordereau"); |
6320 |
// Valeurs des champs |
// Valeurs des champs |
6321 |
if ($f->get_submitted_post_value("validation") !== null) { |
if ($this->f->get_submitted_post_value("validation") !== null) { |
6322 |
$form->setVal("date_bordereau_debut", $f->get_submitted_post_value("date_bordereau_debut")); |
$form->setVal("date_bordereau_debut", $this->f->get_submitted_post_value("date_bordereau_debut")); |
6323 |
$form->setVal("date_bordereau_fin", $f->get_submitted_post_value("date_bordereau_fin")); |
$form->setVal("date_bordereau_fin", $this->f->get_submitted_post_value("date_bordereau_fin")); |
6324 |
$form->setVal("bordereau", $f->get_submitted_post_value("bordereau")); |
$form->setVal("bordereau", $this->f->get_submitted_post_value("bordereau")); |
6325 |
$form->setVal("om_collectivite", $f->get_submitted_post_value("om_collectivite")); |
$form->setVal("om_collectivite", $this->f->get_submitted_post_value("om_collectivite")); |
6326 |
} |
} |
6327 |
// Données du select - On récupère ici la liste de tous les états disponibles |
// Données du select - On récupère ici la liste de tous les états disponibles |
6328 |
// dans la table om_etat qui ont un id qui commence par la cahine de caractères |
// dans la table om_etat qui ont un id qui commence par la cahine de caractères |
6331 |
FROM ".DB_PREFIXE."om_etat |
FROM ".DB_PREFIXE."om_etat |
6332 |
WHERE om_etat.id LIKE 'bordereau_%' |
WHERE om_etat.id LIKE 'bordereau_%' |
6333 |
ORDER BY om_etat.id"; |
ORDER BY om_etat.id"; |
6334 |
$res = $f->db->query($sql); |
$res = $this->f->db->query($sql); |
6335 |
$f->addToLog(__METHOD__.": db->query(\"".$sql."\")", VERBOSE_MODE); |
$this->f->addToLog(__METHOD__.": db->query(\"".$sql."\")", VERBOSE_MODE); |
6336 |
$f->isDatabaseError($res); |
$this->f->isDatabaseError($res); |
6337 |
// Données du select |
// Données du select |
6338 |
$contenu = array( |
$contenu = array( |
6339 |
0 => array("", ), |
0 => array("", ), |
6344 |
$contenu[1][] = $row['libelle']; |
$contenu[1][] = $row['libelle']; |
6345 |
} |
} |
6346 |
$form->setSelect("bordereau", $contenu); |
$form->setSelect("bordereau", $contenu); |
6347 |
// |
// |
6348 |
if($_SESSION["niveau"] == 2) { |
if ($_SESSION["niveau"] == 2) { |
6349 |
$form->setLib("om_collectivite", _("collectivite")); |
$form->setLib("om_collectivite", _("collectivite")); |
6350 |
$form->setType("om_collectivite", "select"); |
$form->setType("om_collectivite", "select"); |
6351 |
|
|
6352 |
// Données du select - On récupère ici la liste de tous toutes les collectivités |
// Données du select - On récupère ici la liste de tous toutes les collectivités |
6353 |
// de niveau 1 |
// de niveau 1 |
6354 |
$sql = "SELECT om_collectivite, libelle |
$sql = "SELECT om_collectivite, libelle |
6355 |
FROM ".DB_PREFIXE."om_collectivite |
FROM ".DB_PREFIXE."om_collectivite |
6356 |
WHERE niveau = '1' ORDER BY libelle"; |
WHERE niveau = '1' ORDER BY libelle"; |
6357 |
$res = $f->db->query($sql); |
$res = $this->f->db->query($sql); |
6358 |
$f->addToLog(__METHOD__.": db->query(\"".$sql."\")", VERBOSE_MODE); |
$this->f->addToLog(__METHOD__.": db->query(\"".$sql."\")", VERBOSE_MODE); |
6359 |
$f->isDatabaseError($res); |
$this->f->isDatabaseError($res); |
6360 |
// La valeur par défaut du select est Toutes |
// La valeur par défaut du select est Toutes |
6361 |
$list_collectivites = array( |
$list_collectivites = array( |
6362 |
0 => array("", ), |
0 => array("", ), |
6363 |
1 => array(_("toutes")) |
1 => array(_("toutes")) |
6364 |
); |
); |
|
|
|
|
$id_colls = ""; |
|
|
// On stocke dans $id_colls l'id de toutes les collectivités de niveau 1 séparées |
|
|
// par des virgules, pour un traitement plus facile dans la requête de sous-état |
|
|
while ($row =& $res->fetchRow(DB_FETCHMODE_ASSOC)) { |
|
|
if ($id_colls != "") { |
|
|
$id_colls .= ","; |
|
|
} |
|
|
$id_colls .= $row['om_collectivite']; |
|
|
$list_collectivites[0][] = $row['om_collectivite']; |
|
|
$list_collectivites[1][] = $row['libelle']; |
|
|
} |
|
|
// On affecte la liste d'identifiants à l'option Toutes |
|
|
$list_collectivites[0][0] = $id_colls ; |
|
|
$form->setSelect("om_collectivite", $list_collectivites); |
|
|
} |
|
6365 |
|
|
6366 |
|
$id_colls = ""; |
6367 |
|
// On stocke dans $id_colls l'id de toutes les collectivités de niveau 1 séparées |
6368 |
|
// par des virgules, pour un traitement plus facile dans la requête de sous-état |
6369 |
|
while ($row =& $res->fetchRow(DB_FETCHMODE_ASSOC)) { |
6370 |
|
if ($id_colls != "") { |
6371 |
|
$id_colls .= ","; |
6372 |
|
} |
6373 |
|
$id_colls .= $row['om_collectivite']; |
6374 |
|
$list_collectivites[0][] = $row['om_collectivite']; |
6375 |
|
$list_collectivites[1][] = $row['libelle']; |
6376 |
|
} |
6377 |
|
// On affecte la liste d'identifiants à l'option Toutes |
6378 |
|
$list_collectivites[0][0] = $id_colls ; |
6379 |
|
$form->setSelect("om_collectivite", $list_collectivites); |
6380 |
|
} |
6381 |
// Affichage du formulaire |
// Affichage du formulaire |
6382 |
$form->entete(); |
$form->entete(); |
6383 |
$form->afficher($champs, 0, false, false); |
$form->afficher($champs, 0, false, false); |
6384 |
$form->enpied(); |
$form->enpied(); |
6385 |
// Affichage du bouton |
// Affichage du bouton |
6386 |
printf("\t<div class=\"formControls\">\n"); |
printf("\t<div class=\"formControls\">\n"); |
6387 |
$f->layout->display_form_button(array("value" => _("Valider"), "name" => "validation")); |
$this->f->layout->display_form_button(array("value" => _("Valider"), "name" => "validation")); |
6388 |
printf("\t</div>\n"); |
printf("\t</div>\n"); |
6389 |
// Fermeture du formulaire |
// Fermeture du formulaire |
6390 |
printf("\t</form>\n"); |
printf("\t</form>\n"); |
|
|
|
6391 |
} |
} |
6392 |
|
|
6393 |
|
|
6416 |
/** |
/** |
6417 |
* VIEW - view_suivi_envoi_lettre_rar. |
* VIEW - view_suivi_envoi_lettre_rar. |
6418 |
* |
* |
6419 |
* Vu pour imprimer les RAR. |
* Vue pour imprimer les AR. |
6420 |
* |
* |
6421 |
* @return void |
* @return void |
6422 |
*/ |
*/ |
6424 |
// Vérification de l'accessibilité sur l'élément |
// Vérification de l'accessibilité sur l'élément |
6425 |
$this->checkAccessibility(); |
$this->checkAccessibility(); |
6426 |
|
|
|
// XXX APP |
|
|
|
|
|
$f = $this->f; |
|
|
|
|
6427 |
// |
// |
6428 |
if ($f->get_submitted_post_value("date") !== null) { |
if ($this->f->get_submitted_post_value("date") !== null) { |
6429 |
$date = $f->get_submitted_post_value("date"); |
$date = $this->f->get_submitted_post_value("date"); |
6430 |
} else { |
} else { |
6431 |
$date = ""; |
$date = ""; |
6432 |
} |
} |
6433 |
// |
// |
6434 |
if ($f->get_submitted_post_value("liste_code_barres_instruction") !== null) { |
if ($this->f->get_submitted_post_value("liste_code_barres_instruction") !== null) { |
6435 |
$liste_code_barres_instruction = $f->get_submitted_post_value("liste_code_barres_instruction"); |
$liste_code_barres_instruction = $this->f->get_submitted_post_value("liste_code_barres_instruction"); |
6436 |
} else { |
} else { |
6437 |
$liste_code_barres_instruction = ""; |
$liste_code_barres_instruction = ""; |
6438 |
} |
} |
6458 |
* Validation du formulaire |
* Validation du formulaire |
6459 |
*/ |
*/ |
6460 |
// Si le formulaire a été validé |
// Si le formulaire a été validé |
6461 |
if ($f->get_submitted_post_value('validation') !== null) { |
if ($this->f->get_submitted_post_value('validation') !== null) { |
6462 |
// |
// |
6463 |
if (empty($date) || empty($liste_code_barres_instruction)) { |
if (empty($date) || empty($liste_code_barres_instruction)) { |
6464 |
// |
// |
6466 |
$message = _("Tous les champs doivent etre remplis."); |
$message = _("Tous les champs doivent etre remplis."); |
6467 |
} else { |
} else { |
6468 |
// Création d'un tableau d'instruction |
// Création d'un tableau d'instruction |
6469 |
$liste = explode("\r\n", $f->get_submitted_post_value("liste_code_barres_instruction")); |
$liste = explode("\r\n", $this->f->get_submitted_post_value("liste_code_barres_instruction")); |
6470 |
// |
// |
6471 |
foreach ($liste as $code_barres) { |
foreach ($liste as $code_barres) { |
6472 |
// On enlève les éventuels espaces saisis |
// On enlève les éventuels espaces saisis |
6502 |
$conditions = implode(" OR ", $group_clause); |
$conditions = implode(" OR ", $group_clause); |
6503 |
$sql .= " AND (" . $conditions . ")"; |
$sql .= " AND (" . $conditions . ")"; |
6504 |
|
|
6505 |
$nbInstr = $f->db->getone($sql); |
$nbInstr = $this->f->db->getone($sql); |
6506 |
$f->addToLog(__METHOD__.": db->getone(\"".$sql."\")", VERBOSE_MODE); |
$this->f->addToLog(__METHOD__.": db->getone(\"".$sql."\")", VERBOSE_MODE); |
6507 |
$f->isDatabaseError($nbInstr); |
$this->f->isDatabaseError($nbInstr); |
6508 |
// |
// |
6509 |
if ($nbInstr == "1") { |
if ($nbInstr == "1") { |
6510 |
// Récupération de la date d'envoi de l'instruction bippé |
// Récupération de la date d'envoi de l'instruction bippé |
6511 |
$sql = "SELECT to_char(date_envoi_rar,'DD/MM/YYYY') as date_envoi_rar, instruction FROM ".DB_PREFIXE."instruction WHERE code_barres='".$code_barres."'"; |
$sql = "SELECT to_char(date_envoi_rar,'DD/MM/YYYY') as date_envoi_rar, instruction FROM ".DB_PREFIXE."instruction WHERE code_barres='".$code_barres."'"; |
6512 |
$res = $f->db->query($sql); |
$res = $this->f->db->query($sql); |
6513 |
$f->addToLog(__METHOD__.": db->query(\"".$sql."\")", VERBOSE_MODE); |
$this->f->addToLog(__METHOD__.": db->query(\"".$sql."\")", VERBOSE_MODE); |
6514 |
$f->isDatabaseError($res); |
$this->f->isDatabaseError($res); |
6515 |
$row =& $res->fetchRow(DB_FETCHMODE_ASSOC); |
$row =& $res->fetchRow(DB_FETCHMODE_ASSOC); |
6516 |
// Si pas de date ou correspond à la date du formulaire on |
// Si pas de date ou correspond à la date du formulaire on |
6517 |
// effectue le traitement |
// effectue le traitement |
6518 |
if ($row["date_envoi_rar"] == "" || $row["date_envoi_rar"] == $date) { |
if ($row["date_envoi_rar"] == "" || $row["date_envoi_rar"] == $date) { |
6519 |
|
$instr = $this->f->get_inst__om_dbform(array( |
6520 |
require_once '../obj/instruction.class.php'; |
"obj" => "instruction", |
6521 |
require_once '../obj/dossier.class.php'; |
"idx" => $row['instruction'], |
6522 |
|
)); |
|
$instr = new instruction($row['instruction'], $f->db, DEBUG); |
|
6523 |
$valF = array(); |
$valF = array(); |
6524 |
foreach($instr->champs as $id => $champ) { |
foreach($instr->champs as $id => $champ) { |
6525 |
$valF[$champ] = $instr->val[$id]; |
$valF[$champ] = $instr->val[$id]; |
6528 |
# Si on peut consulter les dossiers et que le dossier n'existe pas déjà dans la liste |
# Si on peut consulter les dossiers et que le dossier n'existe pas déjà dans la liste |
6529 |
if ($isAccredited === true |
if ($isAccredited === true |
6530 |
&& array_key_exists($instr->getVal("dossier"), $dossierTab) === false) { |
&& array_key_exists($instr->getVal("dossier"), $dossierTab) === false) { |
6531 |
$dossier = new dossier($instr->getVal("dossier")); |
$dossier = $this->f->get_inst__om_dbform(array( |
6532 |
|
"obj" => "dossier", |
6533 |
|
"idx" => $instr->getVal("dossier"), |
6534 |
|
)); |
6535 |
if ($dossier->is_user_from_allowed_collectivite()){ |
if ($dossier->is_user_from_allowed_collectivite()){ |
6536 |
$dossierTab[$instr->getVal("dossier")] = $dossier; |
$dossierTab[$instr->getVal("dossier")] = $dossier; |
6537 |
} else { |
} else { |
6585 |
$instr->setParameter('maj', 1); |
$instr->setParameter('maj', 1); |
6586 |
$instr->class_actions[1]["identifier"] = |
$instr->class_actions[1]["identifier"] = |
6587 |
"envoi lettre RAR (depuis le menu suivi des pièces)"; |
"envoi lettre RAR (depuis le menu suivi des pièces)"; |
6588 |
if ($instr->modifier($valF, $f->db, DEBUG) == true) { |
if ($instr->modifier($valF) == true) { |
6589 |
$id4Gen[] = $code_barres; |
$id4Gen[] = $code_barres; |
6590 |
$nbLettres ++; |
$nbLettres ++; |
6591 |
} else { |
} else { |
6640 |
*/ |
*/ |
6641 |
// Affichage du message de validation ou d'erreur |
// Affichage du message de validation ou d'erreur |
6642 |
if (isset($message) && isset($message_class) && $message != "") { |
if (isset($message) && isset($message_class) && $message != "") { |
6643 |
$f->displayMessage($message_class, $message); |
$this->f->displayMessage($message_class, $message); |
6644 |
} |
} |
6645 |
// Affichage du message d'erreur |
// Affichage du message d'erreur |
6646 |
if(!empty($error)) { |
if(!empty($error)) { |
6647 |
$f->displayMessage("error", $error); |
$this->f->displayMessage("error", $error); |
6648 |
} |
} |
6649 |
// Affichage du message de validation de la saisie |
// Affichage du message de validation de la saisie |
6650 |
if ($nbLettres > 0) { |
if ($nbLettres > 0) { |
6656 |
echo _("Cliquez sur le lien ci-dessous pour telecharger votre document"); |
echo _("Cliquez sur le lien ci-dessous pour telecharger votre document"); |
6657 |
echo " : \n<br/><br/>"; |
echo " : \n<br/><br/>"; |
6658 |
echo "\n<a class='om-prev-icon pdf-16'"; |
echo "\n<a class='om-prev-icon pdf-16'"; |
6659 |
echo "\n title=\""._("imprimer les RAR")."\""; |
echo "\n title=\""._("imprimer les AR")."\""; |
6660 |
echo "\n href=\"../scr/form.php?obj=instruction&action=180&idx=0&liste=".implode(",",$id4Gen)."\""; |
echo "\n href=\"".OM_ROUTE_FORM."&obj=instruction&action=180&idx=0&liste=".implode(",",$id4Gen)."\""; |
6661 |
echo "\n target='_blank'>"; |
echo "\n target='_blank'>"; |
6662 |
echo _("Telecharger le document pour")." ".$nbLettres." "._("RAR"); |
echo _("Telecharger le document pour")." ".$nbLettres." "._("AR"); |
6663 |
echo "\n</a>"; |
echo "\n</a>"; |
6664 |
echo "\n</span>"; |
echo "\n</span>"; |
6665 |
echo "\n</p>"; |
echo "\n</p>"; |
6700 |
echo "\n<p>"; |
echo "\n<p>"; |
6701 |
echo "\n<span class='text'>"; |
echo "\n<span class='text'>"; |
6702 |
echo "\n<a class=\"om-icon om-icon-16 consult-16\" title=\"" . _('Consulter') . "\""; |
echo "\n<a class=\"om-icon om-icon-16 consult-16\" title=\"" . _('Consulter') . "\""; |
6703 |
echo "\n href=\"../scr/form.php?obj=dossier_instruction&action=3&idx="; |
echo "\n href=\"".OM_ROUTE_FORM."&obj=dossier_instruction&action=3&idx="; |
6704 |
echo $dossier->getVal("dossier"); |
echo $dossier->getVal("dossier"); |
6705 |
echo "\">"; |
echo "\">"; |
6706 |
echo "\n</a>"; |
echo "\n</a>"; |
6707 |
|
|
6708 |
echo "\n<a title=\""._("Consulter")."\" style=\"vertical-align:middle;\""; |
echo "\n<a title=\""._("Consulter")."\" style=\"vertical-align:middle;\""; |
6709 |
echo " href=\"../scr/form.php?obj="; |
echo " href=\"".OM_ROUTE_FORM."&obj="; |
6710 |
echo $obj; |
echo $obj; |
6711 |
echo "&action=3&idx="; |
echo "&action=3&idx="; |
6712 |
echo $dossier->getVal("dossier"); |
echo $dossier->getVal("dossier"); |
6725 |
echo "\n</div>"; |
echo "\n</div>"; |
6726 |
echo "\n</div>"; |
echo "\n</div>"; |
6727 |
} |
} |
|
// Inclusion de la classe de gestion des formulaires |
|
|
require_once "../obj/om_formulaire.class.php"; |
|
6728 |
// Ouverture du formulaire |
// Ouverture du formulaire |
6729 |
echo "\t<form"; |
echo "\t<form"; |
6730 |
echo " method=\"post\""; |
echo " method=\"post\""; |
6734 |
// Paramétrage des champs du formulaire |
// Paramétrage des champs du formulaire |
6735 |
$champs = array("date", "liste_code_barres_instruction"); |
$champs = array("date", "liste_code_barres_instruction"); |
6736 |
// Création d'un nouvel objet de type formulaire |
// Création d'un nouvel objet de type formulaire |
6737 |
$form = new formulaire(NULL, 0, 0, $champs); |
$form = $this->f->get_inst__om_formulaire(array( |
6738 |
|
"validation" => 0, |
6739 |
|
"maj" => 0, |
6740 |
|
"champs" => $champs, |
6741 |
|
)); |
6742 |
// Paramétrage du champ date du formulaire |
// Paramétrage du champ date du formulaire |
6743 |
$form->setLib("date", _("Date")."* :"); |
$form->setLib("date", _("Date")."* :"); |
6744 |
$form->setType("date", "date"); |
$form->setType("date", "date"); |
6758 |
$form->enpied(); |
$form->enpied(); |
6759 |
// Affichage du bouton |
// Affichage du bouton |
6760 |
echo "\t<div class=\"formControls\">\n"; |
echo "\t<div class=\"formControls\">\n"; |
6761 |
$f->layout->display_form_button(array("value" => _("Valider"), "name" => "validation")); |
$this->f->layout->display_form_button(array("value" => _("Valider"), "name" => "validation")); |
6762 |
echo "\t</div>\n"; |
echo "\t</div>\n"; |
6763 |
// Fermeture du formulaire |
// Fermeture du formulaire |
6764 |
echo "\t</form>\n"; |
echo "\t</form>\n"; |
6775 |
// Vérification de l'accessibilité sur l'élément |
// Vérification de l'accessibilité sur l'élément |
6776 |
$this->checkAccessibility(); |
$this->checkAccessibility(); |
6777 |
|
|
|
// XXX APP |
|
|
|
|
|
$f = $this->f; |
|
|
|
|
6778 |
// Récupération des valeur passées en POST ou GET |
// Récupération des valeur passées en POST ou GET |
6779 |
if($f->get_submitted_post_value("type_mise_a_jour") !== null) { |
if($this->f->get_submitted_post_value("type_mise_a_jour") !== null) { |
6780 |
$type_mise_a_jour = $f->get_submitted_post_value("type_mise_a_jour"); |
$type_mise_a_jour = $this->f->get_submitted_post_value("type_mise_a_jour"); |
6781 |
} elseif($f->get_submitted_get_value('type_mise_a_jour') !== null) { |
} elseif($this->f->get_submitted_get_value('type_mise_a_jour') !== null) { |
6782 |
$type_mise_a_jour = $f->get_submitted_get_value('type_mise_a_jour'); |
$type_mise_a_jour = $this->f->get_submitted_get_value('type_mise_a_jour'); |
6783 |
} else { |
} else { |
6784 |
$type_mise_a_jour = ""; |
$type_mise_a_jour = ""; |
6785 |
} |
} |
6786 |
if($f->get_submitted_post_value('date') !== null) { |
if($this->f->get_submitted_post_value('date') !== null) { |
6787 |
$date = $f->get_submitted_post_value('date'); |
$date = $this->f->get_submitted_post_value('date'); |
6788 |
} elseif($f->get_submitted_get_value('date') !== null) { |
} elseif($this->f->get_submitted_get_value('date') !== null) { |
6789 |
$date = $f->get_submitted_get_value('date'); |
$date = $this->f->get_submitted_get_value('date'); |
6790 |
} else { |
} else { |
6791 |
$date = ""; |
$date = ""; |
6792 |
} |
} |
6793 |
if($f->get_submitted_post_value('code_barres') !== null) { |
if($this->f->get_submitted_post_value('code_barres') !== null) { |
6794 |
$code_barres = $f->get_submitted_post_value('code_barres'); |
$code_barres = $this->f->get_submitted_post_value('code_barres'); |
6795 |
} elseif($f->get_submitted_get_value('code_barres') !== null) { |
} elseif($this->f->get_submitted_get_value('code_barres') !== null) { |
6796 |
$code_barres = $f->get_submitted_get_value('code_barres'); |
$code_barres = $this->f->get_submitted_get_value('code_barres'); |
6797 |
} else { |
} else { |
6798 |
$code_barres = ""; |
$code_barres = ""; |
6799 |
} |
} |
6805 |
$liste_champs=array(); |
$liste_champs=array(); |
6806 |
|
|
6807 |
// Si le formulaire a été validé |
// Si le formulaire a été validé |
6808 |
if ($f->get_submitted_post_value('validation') !== null) { |
if ($this->f->get_submitted_post_value('validation') !== null) { |
6809 |
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)) { |
6810 |
|
|
6811 |
// Vérification de l'existence de l'instruction |
// Vérification de l'existence de l'instruction |
6836 |
$sql .= " AND (" . $conditions . ")"; |
$sql .= " AND (" . $conditions . ")"; |
6837 |
|
|
6838 |
|
|
6839 |
$res = $f->db->query($sql); |
$res = $this->f->db->query($sql); |
6840 |
$f->addToLog(__METHOD__.": db->query(\"".$sql."\")", VERBOSE_MODE); |
$this->f->addToLog(__METHOD__.": db->query(\"".$sql."\")", VERBOSE_MODE); |
6841 |
$f->isDatabaseError($res); |
$this->f->isDatabaseError($res); |
6842 |
|
|
6843 |
if($res->numrows() == 1) { |
if($res->numrows() == 1) { |
6844 |
$liste_champs = explode(";", $type_mise_a_jour); |
$liste_champs = explode(";", $type_mise_a_jour); |
6845 |
|
$row =& $res->fetchRow(DB_FETCHMODE_ASSOC); |
6846 |
|
$instr = $this->f->get_inst__om_dbform(array( |
6847 |
|
"obj" => "instruction", |
6848 |
|
"idx" => $row['instruction'], |
6849 |
|
)); |
6850 |
// Mise à jour des dates après l'écran de verification |
// Mise à jour des dates après l'écran de verification |
6851 |
if($f->get_submitted_post_value('is_valid') !== null and $f->get_submitted_post_value('is_valid') == "true") { |
if($this->f->get_submitted_post_value('is_valid') !== null and $this->f->get_submitted_post_value('is_valid') == "true") { |
|
require_once '../obj/instruction.class.php'; |
|
|
$row =& $res->fetchRow(DB_FETCHMODE_ASSOC); |
|
|
$instr = new instruction($row['instruction'], $f->db, DEBUG); |
|
6852 |
$valF = array(); |
$valF = array(); |
6853 |
foreach($instr->champs as $id => $champ) { |
foreach($instr->champs as $id => $champ) { |
6854 |
$valF[$champ] = $instr->val[$id]; |
$valF[$champ] = $instr->val[$id]; |
6891 |
$code_barres = ""; |
$code_barres = ""; |
6892 |
|
|
6893 |
//Désactivation de l'autocommit |
//Désactivation de l'autocommit |
6894 |
$f->db->autoCommit(false); |
$this->f->db->autoCommit(false); |
6895 |
|
|
6896 |
//On modifie les valeurs de l'instruction |
//On modifie les valeurs de l'instruction |
6897 |
$instr->setParameter('maj', 170); |
$instr->setParameter('maj', 170); |
6898 |
$instr->class_actions[170]["identifier"] = |
$instr->class_actions[170]["identifier"] = |
6899 |
"mise à jour des dates (depuis le menu suivi des pièces)"; |
"mise à jour des dates (depuis le menu suivi des pièces)"; |
6900 |
$retour = $instr->modifier($valF, $f->db, DEBUG); |
$retour = $instr->modifier($valF); |
6901 |
|
|
6902 |
//Si une erreur s'est produite, on défait les modifications |
//Si une erreur s'est produite, on défait les modifications |
6903 |
//qui ont été faites |
//qui ont été faites |
6906 |
} |
} |
6907 |
//Sinon, on valide en base de données les modifications |
//Sinon, on valide en base de données les modifications |
6908 |
else { |
else { |
6909 |
$f->db->commit(); |
$this->f->db->commit(); |
6910 |
} |
} |
6911 |
|
|
6912 |
// Variable correct retourné depuis la classe instruction |
// Variable correct retourné depuis la classe instruction |
6947 |
INNER JOIN ".DB_PREFIXE."evenement ON |
INNER JOIN ".DB_PREFIXE."evenement ON |
6948 |
instruction.evenement=evenement.evenement |
instruction.evenement=evenement.evenement |
6949 |
WHERE code_barres='".$code_barres."'"; |
WHERE code_barres='".$code_barres."'"; |
6950 |
$resInfo = $f->db->query($sqlInfo); |
$resInfo = $this->f->db->query($sqlInfo); |
6951 |
$f->isDatabaseError($resInfo); |
$this->f->isDatabaseError($resInfo); |
6952 |
$infos = $resInfo->fetchRow(DB_FETCHMODE_ASSOC); |
$infos = $resInfo->fetchRow(DB_FETCHMODE_ASSOC); |
6953 |
|
|
6954 |
// Vérification de la non modification des dates de suivi |
// Vérification de la non modification des dates de suivi |
6955 |
foreach(explode(";", $type_mise_a_jour) as $champ) { |
foreach(explode(";", $type_mise_a_jour) as $champ) { |
6956 |
|
if ($champ === 'date_envoi_controle_legalite') { |
6957 |
|
if ($instr->is_sent_to_cl() === true) { |
6958 |
|
$error = __("Les dates de suivis ne peuvent etre modifiees"); |
6959 |
|
$date_error = true; |
6960 |
|
break; |
6961 |
|
} |
6962 |
|
} |
6963 |
if($infos[$champ] != "" AND $infos[$champ] != $date) { |
if($infos[$champ] != "" AND $infos[$champ] != $date) { |
6964 |
$error = _("Les dates de suivis ne peuvent etre modifiees"); |
$error = _("Les dates de suivis ne peuvent etre modifiees"); |
6965 |
$date_error = true; |
$date_error = true; |
6966 |
|
break; |
6967 |
} |
} |
6968 |
} |
} |
6969 |
} |
} |
6981 |
*/ |
*/ |
6982 |
// Affichage du message de validation ou d'erreur |
// Affichage du message de validation ou d'erreur |
6983 |
if (isset($message) && isset($message_class) && $message != "") { |
if (isset($message) && isset($message_class) && $message != "") { |
6984 |
$f->displayMessage($message_class, $message); |
$this->f->displayMessage($message_class, $message); |
6985 |
} |
} |
6986 |
// Affichage du message d'erreur |
// Affichage du message d'erreur |
6987 |
if(!empty($error)) { |
if(!empty($error)) { |
6988 |
$f->displayMessage("error", $error); |
$this->f->displayMessage("error", $error); |
6989 |
} |
} |
6990 |
|
|
6991 |
// Affichage du message de validation de la saisie |
// Affichage du message de validation de la saisie |
6992 |
if($correct === true) { |
if($correct === true) { |
6993 |
$f->displayMessage("ok", _("Saisie enregistree")); |
$this->f->displayMessage("ok", _("Saisie enregistree")); |
6994 |
} |
} |
|
// Inclusion de la classe de gestion des formulaires |
|
|
require_once "../obj/om_formulaire.class.php"; |
|
6995 |
// Ouverture du formulaire |
// Ouverture du formulaire |
6996 |
echo "\t<form"; |
echo "\t<form"; |
6997 |
echo " method=\"post\""; |
echo " method=\"post\""; |
7009 |
$champs = array("type_mise_a_jour", "date", "code_barres"); |
$champs = array("type_mise_a_jour", "date", "code_barres"); |
7010 |
} |
} |
7011 |
// Création d'un nouvel objet de type formulaire |
// Création d'un nouvel objet de type formulaire |
7012 |
$form = new formulaire(NULL, 0, 0, $champs); |
$form = $this->f->get_inst__om_formulaire(array( |
7013 |
|
"validation" => 0, |
7014 |
|
"maj" => 0, |
7015 |
|
"champs" => $champs, |
7016 |
|
)); |
7017 |
// Paramétrage des champs du formulaire |
// Paramétrage des champs du formulaire |
7018 |
// Parametrage du champ type_mise_a_jour |
// Parametrage du champ type_mise_a_jour |
7019 |
$form->setLib("type_mise_a_jour", _("Date a mettre a jour")."* :"); |
$form->setLib("type_mise_a_jour", _("Date a mettre a jour")."* :"); |
7043 |
$contenu[1][4] = _("date de retour de controle de legalite"); |
$contenu[1][4] = _("date de retour de controle de legalite"); |
7044 |
|
|
7045 |
$contenu[0][5] = "date_retour_rar"; |
$contenu[0][5] = "date_retour_rar"; |
7046 |
$contenu[1][5] = _("date de retour de l'AR"); |
$contenu[1][5] = __("date de notification du correspondant"); |
7047 |
|
|
7048 |
$form->setSelect("type_mise_a_jour", $contenu); |
$form->setSelect("type_mise_a_jour", $contenu); |
7049 |
|
|
7103 |
$form->setType("autorite_competente", "static"); |
$form->setType("autorite_competente", "static"); |
7104 |
$form->setVal("autorite_competente", $infos['autorite_competente']); |
$form->setVal("autorite_competente", $infos['autorite_competente']); |
7105 |
|
|
7106 |
// Parametrage des libellés d'envoi avec RAR |
// Parametrage des libellés d'envoi avec AR |
7107 |
$form->setLib("date_envoi_rar", _("date_envoi_rar")." :"); |
$form->setLib("date_envoi_rar", __("date_envoi_ar")." :"); |
7108 |
$form->setLib("date_retour_rar", _("date_retour_rar")." :"); |
$form->setLib("date_retour_rar", __("date_notification")." :"); |
7109 |
|
|
7110 |
$form->setLib("date_envoi_signature", _("date_envoi_signature")." :"); |
$form->setLib("date_envoi_signature", _("date_envoi_signature")." :"); |
7111 |
$form->setLib("date_retour_signature", _("date_retour_signature")." :"); |
$form->setLib("date_retour_signature", _("date_retour_signature")." :"); |
7139 |
echo "\t<div class=\"formControls\">\n"; |
echo "\t<div class=\"formControls\">\n"; |
7140 |
// |
// |
7141 |
if(!$date_error) { |
if(!$date_error) { |
7142 |
$f->layout->display_form_button(array("value" => _("Valider"), "name" => "validation")); |
$this->f->layout->display_form_button(array("value" => _("Valider"), "name" => "validation")); |
7143 |
} |
} |
7144 |
// Si pas sur l'écran de validation |
// Si pas sur l'écran de validation |
7145 |
if(isset($infos)) { |
if(isset($infos)) { |
7146 |
echo "<a class=\"retour\" href=\"../scr/form.php?obj=instruction_suivi_mise_a_jour_des_dates&action=170&idx=0"; |
echo "<a class=\"retour\" href=\"".OM_ROUTE_FORM."&obj=instruction_suivi_mise_a_jour_des_dates&action=170&idx=0"; |
7147 |
echo "&type_mise_a_jour=".$type_mise_a_jour."&date=".$date."&code_barres=".$code_barres; |
echo "&type_mise_a_jour=".$type_mise_a_jour."&date=".$date."&code_barres=".$code_barres; |
7148 |
echo "\">Retour</a>"; |
echo "\">Retour</a>"; |
7149 |
} |
} |
7160 |
function view_pdf_lettre_rar() { |
function view_pdf_lettre_rar() { |
7161 |
// Vérification de l'accessibilité sur l'élément |
// Vérification de l'accessibilité sur l'élément |
7162 |
$this->checkAccessibility(); |
$this->checkAccessibility(); |
7163 |
|
// |
7164 |
|
$this->f->disableLog(); |
7165 |
|
|
7166 |
// XXX APP |
if($this->f->get_submitted_get_value('liste') != null) { |
7167 |
|
$listeCodeBarres = explode(',',$this->f->get_submitted_get_value('liste')); |
|
$f = $this->f; |
|
|
|
|
|
$f->disableLog(); |
|
|
|
|
|
if($f->get_submitted_get_value('liste') != null) { |
|
|
$listeCodeBarres = explode(',',$f->get_submitted_get_value('liste')); |
|
7168 |
|
|
7169 |
// Classe permettant la mise en page de l'édition pdf |
// Classe permettant la mise en page de l'édition pdf |
7170 |
require_once "../obj/pdf_lettre_rar.class.php"; |
require_once "../obj/pdf_lettre_rar.class.php"; |
7171 |
$pdf_lettre_rar = new pdf_lettre_rar('P', 'mm', 'A4'); |
$pdf_lettre_rar = new pdf_lettre_rar('P', 'mm', 'A4'); |
7172 |
// Initialisation de la mise en page |
// Initialisation de la mise en page |
7173 |
$pdf_lettre_rar->init($f); |
$pdf_lettre_rar->init($this->f); |
|
|
|
|
require_once "../obj/dossier.class.php"; |
|
7174 |
|
|
7175 |
foreach ($listeCodeBarres as $code_barres) { |
foreach ($listeCodeBarres as $code_barres) { |
7176 |
|
|
7178 |
$sql = "SELECT dossier |
$sql = "SELECT dossier |
7179 |
FROM " . DB_PREFIXE . "instruction |
FROM " . DB_PREFIXE . "instruction |
7180 |
WHERE code_barres = '" . $code_barres . "'"; |
WHERE code_barres = '" . $code_barres . "'"; |
7181 |
$dossier = $this->db->getOne($sql); |
$dossier = $this->f->db->getOne($sql); |
7182 |
$this->f->addToLog(__METHOD__."(): db->getOne(\"".$sql."\")", VERBOSE_MODE); |
$this->f->addToLog(__METHOD__."(): db->getOne(\"".$sql."\")", VERBOSE_MODE); |
7183 |
$this->f->isDatabaseError($dossier); |
$this->f->isDatabaseError($dossier); |
7184 |
$inst_dossier = new dossier($dossier); |
$inst_dossier = $this->f->get_inst__om_dbform(array( |
7185 |
|
"obj" => "dossier", |
7186 |
|
"idx" => $dossier, |
7187 |
|
)); |
7188 |
|
|
7189 |
// En fonction du type de dossier, on récupère un demandeur différent dans les requêtes |
// En fonction du type de dossier, on récupère un demandeur différent dans les requêtes |
7190 |
$groupe = $inst_dossier->get_type_affichage_formulaire(); |
$groupe = $inst_dossier->get_type_affichage_formulaire(); |
7197 |
break; |
break; |
7198 |
case 'ADS': |
case 'ADS': |
7199 |
case 'DPC': |
case 'DPC': |
7200 |
|
case 'CONSULTATION ENTRANTE': |
7201 |
default: |
default: |
7202 |
$sql_demandeur = "((lien_dossier_demandeur.petitionnaire_principal IS TRUE AND demandeur.type_demandeur='petitionnaire') OR demandeur.type_demandeur='delegataire')"; |
$sql_demandeur = "((lien_dossier_demandeur.petitionnaire_principal IS TRUE AND demandeur.type_demandeur='petitionnaire') OR demandeur.type_demandeur='delegataire')"; |
7203 |
break; |
break; |
7231 |
AND " . $sql_demandeur . " |
AND " . $sql_demandeur . " |
7232 |
GROUP BY dossier.dossier_libelle, evenement.type, phase.code, division.libelle"; |
GROUP BY dossier.dossier_libelle, evenement.type, phase.code, division.libelle"; |
7233 |
|
|
7234 |
$res = $f->db->query($sql); |
$res = $this->f->db->query($sql); |
7235 |
$f->addToLog(__METHOD__.": db->query(\"".$sql."\")", VERBOSE_MODE); |
$this->f->addToLog(__METHOD__.": db->query(\"".$sql."\")", VERBOSE_MODE); |
7236 |
$f->isDatabaseError($res); |
$this->f->isDatabaseError($res); |
7237 |
$testDemandeur = $res->fetchrow(DB_FETCHMODE_ASSOC); |
$testDemandeur = $res->fetchrow(DB_FETCHMODE_ASSOC); |
7238 |
|
|
7239 |
|
|
7282 |
if($testDemandeur['type'] != 'arrete' AND $testDemandeur['nbdemandeur'] > 1) { |
if($testDemandeur['type'] != 'arrete' AND $testDemandeur['nbdemandeur'] > 1) { |
7283 |
$sqlAdresse .= " AND demandeur.type_demandeur='delegataire'"; |
$sqlAdresse .= " AND demandeur.type_demandeur='delegataire'"; |
7284 |
} else { |
} else { |
7285 |
$sqlAdresse .= " AND " . $sql_demandeur; |
$sqlAdresse .= " AND demandeur.type_demandeur='petitionnaire' AND lien_dossier_demandeur.petitionnaire_principal IS TRUE"; |
7286 |
} |
} |
7287 |
|
|
7288 |
$resAdresse = $f->db->query($sqlAdresse); |
$resAdresse = $this->f->db->query($sqlAdresse); |
7289 |
$adresse_dest = $resAdresse->fetchrow(DB_FETCHMODE_ASSOC); |
$adresse_dest = $resAdresse->fetchrow(DB_FETCHMODE_ASSOC); |
7290 |
$f->addToLog(__METHOD__.": db->query(\"".$sqlAdresse."\")", VERBOSE_MODE); |
$this->f->addToLog(__METHOD__.": db->query(\"".$sqlAdresse."\")", VERBOSE_MODE); |
7291 |
$f->isDatabaseError($resAdresse); |
$this->f->isDatabaseError($resAdresse); |
7292 |
|
|
7293 |
// Création adresse destinataire sans ligne vide |
// Création adresse destinataire sans ligne vide |
7294 |
$adresse_destinataire = array(); |
$adresse_destinataire = array(); |
7386 |
$message .= "<a class='om-prev-icon pdf-16'"; |
$message .= "<a class='om-prev-icon pdf-16'"; |
7387 |
$message .= " id=\"generer_bordereau_envoi_maire\""; |
$message .= " id=\"generer_bordereau_envoi_maire\""; |
7388 |
$message .= " title=\""._("Bordereau")."\""; |
$message .= " title=\""._("Bordereau")."\""; |
7389 |
$message .= " href='../scr/form.php?obj=instruction"; |
$message .= " href='".OM_ROUTE_FORM."&obj=instruction"; |
7390 |
$message .= "&action=200"; |
$message .= "&action=200"; |
7391 |
$message .= "&idx=".$id_instruction."'"; |
$message .= "&idx=".$id_instruction."'"; |
7392 |
$message .= " target='_blank'>"; |
$message .= " target='_blank'>"; |
7427 |
$this->f->displayMessage($message_class, $message); |
$this->f->displayMessage($message_class, $message); |
7428 |
} |
} |
7429 |
|
|
|
// Inclusion de la classe de gestion des formulaires |
|
|
require_once "../obj/om_formulaire.class.php"; |
|
7430 |
// Ouverture du formulaire |
// Ouverture du formulaire |
7431 |
$datasubmit = $this->getDataSubmit(); |
$datasubmit = $this->getDataSubmit(); |
7432 |
echo "\n<!-- ########## START DBFORM ########## -->\n"; |
echo "\n<!-- ########## START DBFORM ########## -->\n"; |
7443 |
$champs = array("code_barres","date"); |
$champs = array("code_barres","date"); |
7444 |
|
|
7445 |
// Création d'un nouvel objet de type formulaire |
// Création d'un nouvel objet de type formulaire |
7446 |
$form = new formulaire(NULL, 0, 0, $champs); |
$form = $this->f->get_inst__om_formulaire(array( |
7447 |
|
"validation" => 0, |
7448 |
|
"maj" => 0, |
7449 |
|
"champs" => $champs, |
7450 |
|
)); |
7451 |
|
|
7452 |
$template_required_label = '%s *'; |
$template_required_label = '%s *'; |
7453 |
// Parametrage du champ code_barres |
// Parametrage du champ code_barres |
7506 |
} |
} |
7507 |
|
|
7508 |
/** |
/** |
7509 |
|
* VIEW - view_rapport_instruction. |
7510 |
|
* |
7511 |
|
* Ouvre le sous-formulaire en ajaxIt dans un overlay. |
7512 |
|
* Cette action est bindée pour utiliser la fonction popUpIt. |
7513 |
|
* |
7514 |
|
* @return void |
7515 |
|
*/ |
7516 |
|
function view_overlay_notification_manuelle() { |
7517 |
|
|
7518 |
|
// Vérification de l'accessibilité sur l'élément |
7519 |
|
$this->checkAccessibility(); |
7520 |
|
|
7521 |
|
printf( |
7522 |
|
'<script type="text/javascript" > |
7523 |
|
overlayIt(\'%1$s\',\'%2$s&objsf=%1$s&idxformulaire=%4$s&retourformulaire=dossier_instruction&obj=%1$s&action=411&idx=%3$s\', 1); |
7524 |
|
</script>', |
7525 |
|
'instruction_notification_manuelle', |
7526 |
|
OM_ROUTE_SOUSFORM, |
7527 |
|
$this->getVal($this->clePrimaire), |
7528 |
|
$this->getVal('dossier') |
7529 |
|
); |
7530 |
|
} |
7531 |
|
|
7532 |
|
/** |
7533 |
|
* VIEW - view_overlay_notification_service_consulte. |
7534 |
|
* |
7535 |
|
* Ouvre le sous-formulaire de notification des services consulte |
7536 |
|
* en ajaxIt dans un overlay. |
7537 |
|
* Cette action est bindée pour utiliser la fonction popUpIt. |
7538 |
|
* |
7539 |
|
* @return void |
7540 |
|
*/ |
7541 |
|
function view_overlay_notification_service_consulte() { |
7542 |
|
|
7543 |
|
// Vérification de l'accessibilité sur l'élément |
7544 |
|
$this->checkAccessibility(); |
7545 |
|
|
7546 |
|
printf( |
7547 |
|
'<script type="text/javascript" > |
7548 |
|
overlayIt(\'%1$s\',\'%2$s&objsf=%1$s&idxformulaire=%4$s&retourformulaire=dossier_instruction&obj=%1$s&action=420&idx=%3$s\', 1); |
7549 |
|
</script>', |
7550 |
|
'instruction_notification_manuelle', |
7551 |
|
OM_ROUTE_SOUSFORM, |
7552 |
|
$this->getVal($this->clePrimaire), |
7553 |
|
$this->getVal('dossier') |
7554 |
|
); |
7555 |
|
} |
7556 |
|
|
7557 |
|
/** |
7558 |
|
* VIEW - overlay_notification_tiers_consulte. |
7559 |
|
* |
7560 |
|
* Ouvre le sous-formulaire de notification des tiers consulte |
7561 |
|
* en ajaxIt dans un overlay. |
7562 |
|
* Cette action est bindée pour utiliser la fonction popUpIt. |
7563 |
|
* |
7564 |
|
* @return void |
7565 |
|
*/ |
7566 |
|
function view_overlay_notification_tiers_consulte() { |
7567 |
|
|
7568 |
|
// Vérification de l'accessibilité sur l'élément |
7569 |
|
$this->checkAccessibility(); |
7570 |
|
|
7571 |
|
printf( |
7572 |
|
'<script type="text/javascript" > |
7573 |
|
overlayIt(\'%1$s\',\'%2$s&objsf=%1$s&idxformulaire=%4$s&retourformulaire=dossier_instruction&obj=%1$s&action=430&idx=%3$s\', 1); |
7574 |
|
</script>', |
7575 |
|
'instruction_notification_manuelle', |
7576 |
|
OM_ROUTE_SOUSFORM, |
7577 |
|
$this->getVal($this->clePrimaire), |
7578 |
|
$this->getVal('dossier') |
7579 |
|
); |
7580 |
|
} |
7581 |
|
/** |
7582 |
* Retourne l'événement d'instruction dont on donne le code-barres, avec un filtre |
* Retourne l'événement d'instruction dont on donne le code-barres, avec un filtre |
7583 |
* pour exclure les dossiers du groupe contentieux. |
* pour exclure les dossiers du groupe contentieux. |
7584 |
* |
* |
7626 |
// Begin |
// Begin |
7627 |
$this->begin_treatment(__METHOD__); |
$this->begin_treatment(__METHOD__); |
7628 |
// Requête |
// Requête |
7629 |
$res = $this->db->autoExecute( |
$res = $this->f->db->autoExecute( |
7630 |
DB_PREFIXE.$this->table, |
DB_PREFIXE.$this->table, |
7631 |
$valF, |
$valF, |
7632 |
DB_AUTOQUERY_UPDATE, |
DB_AUTOQUERY_UPDATE, |
7651 |
if ($this->isInstrCanChangeDecision($this->valF["dossier"])) { |
if ($this->isInstrCanChangeDecision($this->valF["dossier"])) { |
7652 |
$this->valF['created_by_commune'] = true; |
$this->valF['created_by_commune'] = true; |
7653 |
} |
} |
7654 |
|
|
7655 |
|
// |
7656 |
|
if ($this->evenement_has_an_edition($this->valF['evenement']) === false) { |
7657 |
|
if (isset($this->valF['flag_edition_integrale']) === true) { |
7658 |
|
unset($this->valF['flag_edition_integrale']); |
7659 |
|
} |
7660 |
|
if (isset($this->valF['signataire_arrete']) === true) { |
7661 |
|
unset($this->valF['signataire_arrete']); |
7662 |
|
} |
7663 |
|
} |
7664 |
} |
} |
7665 |
|
|
7666 |
|
|
7925 |
*/ |
*/ |
7926 |
public function formater_modele($modele, $id_di, $id_inst) { |
public function formater_modele($modele, $id_di, $id_inst) { |
7927 |
// Création du lien d'accès direct à l'instruction |
// Création du lien d'accès direct à l'instruction |
7928 |
$url_inst = PATH_BASE_URL.'spg/direct_link.php?obj=dossier_instruction&action=3'. |
$url_inst = PATH_BASE_URL.'app/index.php?module=form&direct_link=true&obj=dossier_instruction&action=3'. |
7929 |
'&direct_field=dossier&direct_form=instruction&direct_action=3&direct_idx='.$id_inst; |
'&direct_field=dossier&direct_form=instruction&direct_action=3&direct_idx='.$id_inst; |
7930 |
$url_inst = '<a href="'.$url_inst.'">'.$url_inst.'</a>'; |
$url_inst = '<a href="'.$url_inst.'">'.$url_inst.'</a>'; |
7931 |
// Remplacement des champs de fusion |
// Remplacement des champs de fusion |
8027 |
$this->f->get_submitted_get_value('idxformulaire') : $id_dossier = ""); |
$this->f->get_submitted_get_value('idxformulaire') : $id_dossier = ""); |
8028 |
// |
// |
8029 |
if ($id_dossier !== "") { |
if ($id_dossier !== "") { |
8030 |
require_once "../obj/dossier_instruction.class.php"; |
$dossier = $this->f->get_inst__om_dbform(array( |
8031 |
$dossier = new dossier_instruction($id_dossier, $f->db, DEBUG); |
"obj" => "dossier_instruction", |
8032 |
|
"idx" => $id_dossier, |
8033 |
|
)); |
8034 |
// |
// |
8035 |
return $dossier->can_user_access_dossier(); |
return $dossier->can_user_access_dossier(); |
8036 |
} |
} |
8050 |
$id_dossier = $this->getVal('dossier'); |
$id_dossier = $this->getVal('dossier'); |
8051 |
// |
// |
8052 |
if ($id_dossier !== "" && $id_dossier !== null) { |
if ($id_dossier !== "" && $id_dossier !== null) { |
8053 |
require_once "../obj/dossier_instruction.class.php"; |
$dossier = $this->f->get_inst__om_dbform(array( |
8054 |
$dossier = new dossier_instruction($id_dossier, $f->db, DEBUG); |
"obj" => "dossier_instruction", |
8055 |
|
"idx" => $id_dossier, |
8056 |
|
)); |
8057 |
// |
// |
8058 |
return $dossier->can_user_access_dossier(); |
return $dossier->can_user_access_dossier(); |
8059 |
} |
} |
8060 |
return false; |
return false; |
8061 |
} |
} |
8062 |
|
|
8063 |
}// fin classe |
/** |
8064 |
|
* TREATMENT - envoyer_a_signature_sans_relecture |
8065 |
|
* |
8066 |
|
* Permet d'envoyer le document de l'instruction au parapheur pour signature sans relecture |
8067 |
|
* |
8068 |
|
* @return boolean true si l'envoi a été effectué avec succès false sinon |
8069 |
|
*/ |
8070 |
|
function envoyer_a_signature_sans_relecture() { |
8071 |
|
return $this->envoyer_a_signature(); |
8072 |
|
} |
8073 |
|
|
8074 |
|
/** |
8075 |
|
* TREATMENT - envoyer_a_signature_avec_relecture |
8076 |
|
* |
8077 |
|
* Permet d'envoyer le document de l'instruction au parapheur pour signature avec relecture |
8078 |
|
* |
8079 |
|
* @return boolean true si l'envoi a été effectué avec succès false sinon |
8080 |
|
*/ |
8081 |
|
function envoyer_a_signature_avec_relecture() { |
8082 |
|
$is_forced_view_files = true; |
8083 |
|
return $this->envoyer_a_signature($is_forced_view_files); |
8084 |
|
} |
8085 |
|
|
8086 |
|
/** |
8087 |
|
* TREATMENT - envoyer_a_signature |
8088 |
|
* |
8089 |
|
* Permet d'envoyer le document de l'instruction au parapheur pour signature |
8090 |
|
* |
8091 |
|
* @param boolean $is_forced_view_files Indique si il y a une relecture (true) ou non (false) |
8092 |
|
* |
8093 |
|
* @return boolean true si l'envoi a été effectué avec succès false sinon |
8094 |
|
*/ |
8095 |
|
function envoyer_a_signature($is_forced_view_files = false) { |
8096 |
|
$this->begin_treatment(__METHOD__); |
8097 |
|
$this->correct = true; |
8098 |
|
|
8099 |
|
// Instanciation de l'objet signataire_arrete |
8100 |
|
$inst_signataire_arrete = $this->f->get_inst__om_dbform(array( |
8101 |
|
'obj' => 'signataire_arrete', |
8102 |
|
'idx' => $this->getVal('signataire_arrete'), |
8103 |
|
)); |
8104 |
|
|
8105 |
|
// Instanciation de l'objet dossier |
8106 |
|
$inst_dossier = $this->f->get_inst__om_dbform(array( |
8107 |
|
'obj' => 'dossier', |
8108 |
|
'idx' => $this->getVal('dossier'), |
8109 |
|
)); |
8110 |
|
|
8111 |
|
// Récupération du document à signer |
8112 |
|
$file = $this->f->storage->get($this->getVal('om_fichier_instruction')); |
8113 |
|
if ($file === OP_FAILURE) { |
8114 |
|
$this->correct = false; |
8115 |
|
$this->addToMessage(__("Une erreur est survenue lors de la récupération du contenu du document de l'instruction.")); |
8116 |
|
// Termine le traitement |
8117 |
|
return $this->end_treatment(__METHOD__, false); |
8118 |
|
} |
8119 |
|
|
8120 |
|
// Initialisation des paramètre à passer pour l'envoi en signature |
8121 |
|
$data = array( |
8122 |
|
"om_utilisateur_email" => $this->f->om_utilisateur['email'], |
8123 |
|
"om_utilisateur_nom" => $this->f->om_utilisateur['nom'], |
8124 |
|
"signataire_arrete_email" => $inst_signataire_arrete->getVal('email'), |
8125 |
|
"signataire_arrete_nom" => $inst_signataire_arrete->getVal('nom'), |
8126 |
|
"signataire_arrete_prenom" => $inst_signataire_arrete->getVal('prenom'), |
8127 |
|
"date_limite_instruction" => $inst_dossier->getVal('incomplet_notifie') === 't' ? $inst_dossier->getVal('date_limite_incompletude') : $inst_dossier->getVal('date_limite'), |
8128 |
|
"dossier" => $this->getVal('dossier'), |
8129 |
|
"is_forced_view_files" => $is_forced_view_files, |
8130 |
|
'commentaire_signature' => $is_forced_view_files === true ? __('relecture demandee.') : null |
8131 |
|
); |
8132 |
|
|
8133 |
|
// Initialisation des métadonnées |
8134 |
|
$metadonnee_dossier = $file['metadata']; |
8135 |
|
// récupération de l'extension du fichier |
8136 |
|
$extension = substr($metadonnee_dossier['filename'], strrpos($metadonnee_dossier['filename'], '.')); |
8137 |
|
// Modification du libellé du document transmis au parapheur |
8138 |
|
// pour le mettre sous la forme : instruction_xxx_libelle_lettretype.extension |
8139 |
|
$metadonnee_dossier['filename'] = $this->getDocumentLibelle().$extension; |
8140 |
|
$metadonnee_dossier['titre_document'] = $this->getDocumentTitre(); |
8141 |
|
|
8142 |
|
$metadonnee_dossier['url_di'] = sprintf( |
8143 |
|
'%sapp/index.php?module=form&direct_link=true&obj=dossier_instruction&action=3&direct_field=dossier&direct_form=instruction&direct_action=3&direct_idx=%s', |
8144 |
|
$this->f->get_param_base_path_metadata_url_di() !== null ? $this->f->get_param_base_path_metadata_url_di() : PATH_BASE_URL, |
8145 |
|
$this->getVal($this->clePrimaire) |
8146 |
|
); |
8147 |
|
|
8148 |
|
$optional_data = null; |
8149 |
|
// Si il y a des paramètres supplémentaire spécifié dans le signataire alors on les récupère |
8150 |
|
if ($inst_signataire_arrete->getVal('parametre_parapheur') !== null && $inst_signataire_arrete->getVal('parametre_parapheur') !== '') { |
8151 |
|
$optional_data = json_decode($inst_signataire_arrete->getVal('parametre_parapheur'), true); |
8152 |
|
if (json_last_error() !== JSON_ERROR_NONE) { |
8153 |
|
$this->correct = false; |
8154 |
|
$this->addToMessage(__("Les paramètres supplémentaires envoyés au parapheur ne sont pas au bon format.")); |
8155 |
|
$this->addToLog(__METHOD__."(): ". |
8156 |
|
__("Erreur lors du décodage du format json des paramètres supplémentaires envoyé au parapheur. |
8157 |
|
Tableau : ").var_export($inst_signataire_arrete->getVal('parametre_parapheur'), true) |
8158 |
|
); |
8159 |
|
// Termine le traitement |
8160 |
|
return $this->end_treatment(__METHOD__, false); |
8161 |
|
} |
8162 |
|
} |
8163 |
|
|
8164 |
|
//Instanciation de la classe electronicsignature |
8165 |
|
$inst_es = $this->get_electronicsignature_instance(); |
8166 |
|
if ($inst_es === false) { |
8167 |
|
$this->correct = false; |
8168 |
|
return $this->end_treatment(__METHOD__, false); |
8169 |
|
} |
8170 |
|
|
8171 |
|
// Appel de la méthode de l'abstracteur send_for_signature() |
8172 |
|
// Cette méthode doit retourner un tableau de valeur |
8173 |
|
try { |
8174 |
|
$result = $inst_es->send_for_signature($data, $file['file_content'], $metadonnee_dossier, $optional_data); |
8175 |
|
} catch (electronicsignature_exception $e) { |
8176 |
|
$this->handle_electronicsignature_exception($e); |
8177 |
|
return $this->end_treatment(__METHOD__, false); |
8178 |
|
} |
8179 |
|
|
8180 |
|
// Après avoir reçu le résultat du parapheur, il faut mettre à jour les champs |
8181 |
|
$valF = array(); |
8182 |
|
|
8183 |
|
// Pour appeler la fonction modifier il faut traiter tous les champs de l'objet |
8184 |
|
foreach($this->champs as $identifiant => $champ) { |
8185 |
|
$valF[$champ] = $this->val[$identifiant]; |
8186 |
|
} |
8187 |
|
// On fait ensuite nos modifications spécifiques |
8188 |
|
$valF['id_parapheur_signature'] = $result['id_parapheur_signature']; |
8189 |
|
$valF['statut_signature'] = $result['statut']; |
8190 |
|
$valF['commentaire_signature'] = isset($result['commentaire_signature']) == true ? $result['commentaire_signature'] : null; |
8191 |
|
$valF['date_envoi_signature'] = date("Y-m-d", strtotime($result['date_envoi_signature'])); |
8192 |
|
$valF['historique_signature'] = $this->get_updated_historique_signature($result); |
8193 |
|
|
8194 |
|
$ret = $this->modifier($valF); |
8195 |
|
|
8196 |
|
if ($ret === false) { |
8197 |
|
$this->correct = false; |
8198 |
|
$this->addToMessage(__("Une erreur est survenue lors de la mise à jour des champs.")); |
8199 |
|
// Termine le traitement |
8200 |
|
return $this->end_treatment(__METHOD__, false); |
8201 |
|
} |
8202 |
|
|
8203 |
|
// Message |
8204 |
|
$this->addToMessage(__("Le document a été envoyé pour signature dans le parapheur.")); |
8205 |
|
if (array_key_exists('signature_page_url', $result) === true) { |
8206 |
|
$this->addToMessage(sprintf( |
8207 |
|
'<br> > <a href="%1$s" title="%2$s" target="_blank">%2$s</a>', |
8208 |
|
$result['signature_page_url'], |
8209 |
|
__("Signez directement le document") |
8210 |
|
)); |
8211 |
|
} |
8212 |
|
|
8213 |
|
// Tout s'est bien passé, on termine le traitement |
8214 |
|
return $this->end_treatment(__METHOD__, true); |
8215 |
|
} |
8216 |
|
|
8217 |
|
/** |
8218 |
|
* Permet de récupérer la traduction de la valeur de statut_signature |
8219 |
|
* |
8220 |
|
* @return string la valeur de statut_signature traduite | false |
8221 |
|
*/ |
8222 |
|
function get_trad_for_statut($value_to_trad){ |
8223 |
|
$statut_signature_tab = array( |
8224 |
|
'waiting' => __('en préparation'), |
8225 |
|
'in_progress' => __('en cours de signature'), |
8226 |
|
'canceled' => __('signature annulée'), |
8227 |
|
'expired' => __('délai de signature expiré'), |
8228 |
|
'finished' => __('signé') |
8229 |
|
); |
8230 |
|
if (array_key_exists($value_to_trad, $statut_signature_tab) === true) { |
8231 |
|
return $statut_signature_tab[$value_to_trad]; |
8232 |
|
} |
8233 |
|
|
8234 |
|
return false; |
8235 |
|
} |
8236 |
|
|
8237 |
|
/** |
8238 |
|
* Permet de mettre à jour le tableau json sotcké dans le champ historique_signature |
8239 |
|
* |
8240 |
|
* @return string (json) la valeur de historique_signature mis à jour | false |
8241 |
|
*/ |
8242 |
|
function get_updated_historique_signature($historique_signature_values) { |
8243 |
|
|
8244 |
|
$historique_signature_value_tab = $this->get_historique_signature_decoded(); |
8245 |
|
|
8246 |
|
if ($historique_signature_value_tab === false) { |
8247 |
|
$this->addToLog(__METHOD__."(): erreur historique signature", DEBUG_MODE); |
8248 |
|
return false; |
8249 |
|
} |
8250 |
|
|
8251 |
|
$last_val_historique_signature = array(); |
8252 |
|
|
8253 |
|
// Si la tableau récupéré n'est pas vide alors |
8254 |
|
// on récupère la dernière ligne du tableau |
8255 |
|
if (empty($historique_signature_value_tab) === false) { |
8256 |
|
$last_val_historique_signature = end($historique_signature_value_tab); |
8257 |
|
} |
8258 |
|
|
8259 |
|
$format_date = ''; |
8260 |
|
$format_date_hour = ''; |
8261 |
|
$date_converted=array(); |
8262 |
|
|
8263 |
|
$date_to_convert = array( |
8264 |
|
'date_envoi_signature' => $historique_signature_values['date_envoi_signature'], |
8265 |
|
'date_limite_instruction' => $historique_signature_values['date_limite_instruction'], |
8266 |
|
'date_retour_signature' => $historique_signature_values['date_retour_signature'] |
8267 |
|
); |
8268 |
|
|
8269 |
|
// Conversion des dates en fonction de leur format |
8270 |
|
foreach ($date_to_convert as $key => $value) { |
8271 |
|
$date_converted[$key] = null; |
8272 |
|
if ($value != null) { |
8273 |
|
$format_date = 'd/m/Y'; |
8274 |
|
$format_date_hour = 'd/m/Y H:i:s'; |
8275 |
|
$date_converted[$key] = empty(date_parse($value)['hour']) === false ? date($format_date_hour, strtotime($value)) : date($format_date, strtotime($value)); |
8276 |
|
} |
8277 |
|
} |
8278 |
|
|
8279 |
|
// Ce tableau permet de lister les colonnes de historique_signature et de les rendre traduisibles. |
8280 |
|
// Il faut en effet mettre les gettext avec l'intitulé explicite au moins |
8281 |
|
// une fois afin qu'il puisse être reconnu par le logiciel de traduction. |
8282 |
|
$tab_for_columns_trad = array( |
8283 |
|
__('entry_date'), |
8284 |
|
__('id_parapheur_signature'), |
8285 |
|
__('emetteur'), |
8286 |
|
__('signataire'), |
8287 |
|
__('date_envoi'), |
8288 |
|
__('date_limite'), |
8289 |
|
__('date_retour'), |
8290 |
|
__('statut_signature'), |
8291 |
|
__('commentaire_signature') |
8292 |
|
); |
8293 |
|
|
8294 |
|
array_push($historique_signature_value_tab, array( |
8295 |
|
'entry_date' => date('d/m/Y H:i:s'), |
8296 |
|
'id_parapheur_signature' => $historique_signature_values['id_parapheur_signature'] == null ? (isset($last_val_historique_signature['id_parapheur_signature']) === true ? $last_val_historique_signature['id_parapheur_signature'] : null) : $historique_signature_values['id_parapheur_signature'], |
8297 |
|
'emetteur' => $historique_signature_values['om_utilisateur_email'] == null ? (isset($last_val_historique_signature['emetteur']) === true ? $last_val_historique_signature['emetteur'] : null) : $historique_signature_values['om_utilisateur_email'], |
8298 |
|
'signataire' => $historique_signature_values['signataire_arrete_email'] == null ? (isset($last_val_historique_signature['signataire']) === true ? $last_val_historique_signature['signataire'] : null) : $historique_signature_values['signataire_arrete_email'], |
8299 |
|
'date_envoi' => $historique_signature_values['date_envoi_signature'] == null ? (isset($last_val_historique_signature['date_envoi']) === true ? $last_val_historique_signature['date_envoi'] : null) : $date_converted['date_envoi_signature'], |
8300 |
|
'date_limite' => $historique_signature_values['date_limite_instruction'] == null ? (isset($last_val_historique_signature['date_limite']) === true ? $last_val_historique_signature['date_limite'] : null) : $date_converted['date_limite_instruction'], |
8301 |
|
'date_retour' => $historique_signature_values['date_retour_signature'] == null ? (isset($last_val_historique_signature['date_retour']) === true ? $last_val_historique_signature['date_retour'] : null) : $date_converted['date_retour_signature'], |
8302 |
|
'statut_signature' => $historique_signature_values['statut'] == null ? (isset($last_val_historique_signature['statut_signature']) === true ? $last_val_historique_signature['statut_signature'] : null) : $this->get_trad_for_statut($historique_signature_values['statut']), |
8303 |
|
'commentaire_signature' => isset($historique_signature_values['commentaire_signature']) === false || $historique_signature_values['commentaire_signature'] == null ? null : $historique_signature_values['commentaire_signature'], |
8304 |
|
)); |
8305 |
|
|
8306 |
|
return json_encode($historique_signature_value_tab, JSON_HEX_APOS); |
8307 |
|
} |
8308 |
|
|
8309 |
|
|
8310 |
|
/** |
8311 |
|
* Récupère le contenu du champ historique_signature et le converti en tableau |
8312 |
|
* |
8313 |
|
* @return array sinon false en cas d'erreur |
8314 |
|
*/ |
8315 |
|
protected function get_historique_signature_decoded() { |
8316 |
|
$val = $this->getVal('historique_signature'); |
8317 |
|
if ($val === '') { |
8318 |
|
$val = json_encode(array()); |
8319 |
|
} |
8320 |
|
if($this->isJson($val) === false) { |
8321 |
|
return false; |
8322 |
|
} |
8323 |
|
return json_decode($val, true); |
8324 |
|
} |
8325 |
|
|
8326 |
|
/** |
8327 |
|
* Récupère les informations à afficher dans le tableau de suivi à l'aide |
8328 |
|
* d'une requête sql. Stocke ces informations dans un tableau. |
8329 |
|
* Converti le tableau au format json et renvoi le json obtenu |
8330 |
|
* |
8331 |
|
* @return json |
8332 |
|
*/ |
8333 |
|
protected function get_json_suivi_notification($typeTache) { |
8334 |
|
$whereTypeTache = ''; |
8335 |
|
if ($typeTache != null) { |
8336 |
|
if (is_array($typeTache)) { |
8337 |
|
$whereTypeTache = sprintf( |
8338 |
|
'AND task.type IN (%1$s)', |
8339 |
|
"'".implode("', '", $typeTache)."'" |
8340 |
|
); |
8341 |
|
} else { |
8342 |
|
$whereTypeTache = sprintf( |
8343 |
|
'AND task.type = \'%1$s\'', |
8344 |
|
$typeTache |
8345 |
|
); |
8346 |
|
} |
8347 |
|
} |
8348 |
|
$valSuivi = array(); |
8349 |
|
// Liste des champs à afficher. Permet également la traduction des noms de colonnes. |
8350 |
|
$listeChampsTrad = array( |
8351 |
|
__('emetteur'), |
8352 |
|
__('date_envoi'), |
8353 |
|
__('destinataire'), |
8354 |
|
__('date_premier_acces'), |
8355 |
|
__('instruction'), |
8356 |
|
__('statut'), |
8357 |
|
__('commentaire') |
8358 |
|
); |
8359 |
|
$listeChamps = array( |
8360 |
|
'emetteur', |
8361 |
|
'date_envoi', |
8362 |
|
'destinataire', |
8363 |
|
'date_premier_acces', |
8364 |
|
'instruction', |
8365 |
|
'statut', |
8366 |
|
'commentaire' |
8367 |
|
); |
8368 |
|
|
8369 |
|
// Récupération des infos nécessaires à l'affichage du tableau |
8370 |
|
// Les annexes sont |
8371 |
|
$sql = sprintf( |
8372 |
|
'SELECT DISTINCT |
8373 |
|
instruction_notification.instruction_notification, |
8374 |
|
CASE WHEN instruction_notification.automatique = TRUE |
8375 |
|
THEN TRIM(CONCAT(instruction_notification.emetteur, \' \', \'(automatique)\')) |
8376 |
|
ELSE instruction_notification.emetteur |
8377 |
|
END as emetteur, |
8378 |
|
date_envoi, |
8379 |
|
instruction_notification.destinataire, |
8380 |
|
instruction_notification.date_premier_acces, |
8381 |
|
evenement.libelle as instruction, |
8382 |
|
instruction_notification.statut, |
8383 |
|
instruction_notification.commentaire, |
8384 |
|
annexes.instruction_annexe |
8385 |
|
FROM |
8386 |
|
%1$sinstruction_notification |
8387 |
|
LEFT JOIN %1$sinstruction |
8388 |
|
ON instruction.instruction = instruction_notification.instruction |
8389 |
|
LEFT JOIN %1$sevenement |
8390 |
|
ON instruction.evenement = evenement.evenement |
8391 |
|
LEFT JOIN %1$sinstruction_notification_document |
8392 |
|
ON instruction_notification.instruction_notification = instruction_notification_document.instruction_notification |
8393 |
|
AND instruction_notification_document.annexe = true |
8394 |
|
LEFT JOIN %1$stask |
8395 |
|
ON instruction_notification.instruction_notification::CHARACTER VARYING = task.object_id |
8396 |
|
LEFT JOIN ( |
8397 |
|
SELECT |
8398 |
|
instruction_notification, |
8399 |
|
ARRAY_TO_STRING(ARRAY_AGG( |
8400 |
|
CASE WHEN |
8401 |
|
instruction_notification_document.instruction != 0 |
8402 |
|
THEN |
8403 |
|
evenement.libelle |
8404 |
|
ELSE |
8405 |
|
CONCAT(\'Avis - \', service.libelle) |
8406 |
|
END), |
8407 |
|
\', \' |
8408 |
|
) AS instruction_annexe |
8409 |
|
FROM |
8410 |
|
%1$sinstruction_notification_document |
8411 |
|
LEFT JOIN %1$sinstruction |
8412 |
|
ON instruction_notification_document.instruction = instruction.instruction |
8413 |
|
LEFT JOIN %1$sevenement |
8414 |
|
ON instruction.evenement = evenement.evenement |
8415 |
|
LEFT JOIN %1$sconsultation |
8416 |
|
ON instruction_notification_document.document_id = consultation.consultation |
8417 |
|
LEFT JOIN %1$sservice |
8418 |
|
ON consultation.service = service.service |
8419 |
|
WHERE |
8420 |
|
instruction_notification_document.annexe = \'t\' |
8421 |
|
GROUP BY |
8422 |
|
instruction_notification |
8423 |
|
) AS annexes |
8424 |
|
ON |
8425 |
|
annexes.instruction_notification = instruction_notification.instruction_notification |
8426 |
|
WHERE |
8427 |
|
instruction.instruction = %2$s |
8428 |
|
%3$s |
8429 |
|
ORDER BY |
8430 |
|
date_envoi ASC, instruction_notification.destinataire ASC', |
8431 |
|
DB_PREFIXE, |
8432 |
|
$this->getVal('instruction'), |
8433 |
|
$whereTypeTache |
8434 |
|
); |
8435 |
|
$res = $this->f->db->query($sql); |
8436 |
|
$this->f->addToLog(__METHOD__."(): db->query(\"".$sql."\")", VERBOSE_MODE); |
8437 |
|
$this->f->isDatabaseError($res); |
8438 |
|
// Stockage des infos de chaque notification dans un tableau |
8439 |
|
while( $row =& $res->fetchrow(DB_FETCHMODE_ASSOC) ) { |
8440 |
|
$valNotif = array(); |
8441 |
|
foreach($listeChamps as $champ) { |
8442 |
|
$valNotif[$champ] = $row[$champ]; |
8443 |
|
if (($champ === 'date_envoi' |
8444 |
|
|| $champ === 'date_premier_acces') |
8445 |
|
&& $row[$champ] !== null |
8446 |
|
&& $row[$champ] !== '') { |
8447 |
|
// |
8448 |
|
$valNotif[$champ] = date('d/m/Y H:i:s', strtotime($row[$champ])); |
8449 |
|
} |
8450 |
|
} |
8451 |
|
if ($row['instruction_annexe'] !== null && $row['instruction_annexe'] !== '') { |
8452 |
|
$lienAnnexe = ' ('.$row['instruction_annexe'].')'; |
8453 |
|
$valNotif['instruction'] .= $lienAnnexe; |
8454 |
|
} |
8455 |
|
array_push($valSuivi, $valNotif); |
8456 |
|
} |
8457 |
|
|
8458 |
|
// Passage du tableau au format json |
8459 |
|
return json_encode($valSuivi, JSON_HEX_APOS); |
8460 |
|
} |
8461 |
|
|
8462 |
|
/** |
8463 |
|
* Traitement des erreurs retournées par l'abstracteur electronicsignature. |
8464 |
|
* |
8465 |
|
* @param electronicsignature_exception $exception Exception retournée par l'abstracteur. |
8466 |
|
* |
8467 |
|
* @return void |
8468 |
|
*/ |
8469 |
|
public function handle_electronicsignature_exception(electronicsignature_exception $exception) { |
8470 |
|
$this->f->displayMessage('error', $exception->getMessage()); |
8471 |
|
} |
8472 |
|
|
8473 |
|
|
8474 |
|
/** |
8475 |
|
* Retourne une instance du connecteur electronicsignature, et la créer si elle n'existe pas. |
8476 |
|
* |
8477 |
|
* @param boolean $with_handle_error Flag pour afficher ou non le message d'erreur à l'utilisateur. |
8478 |
|
* @return electronicsignature Instance de l'abstracteur. |
8479 |
|
*/ |
8480 |
|
public function get_electronicsignature_instance($with_handle_error = true) { |
8481 |
|
if(isset($this->electronicsignature_instance)) { |
8482 |
|
return $this->electronicsignature_instance; |
8483 |
|
} |
8484 |
|
// Instanciation du connecteur electronicsignature |
8485 |
|
try { |
8486 |
|
require_once "electronicsignature.class.php"; |
8487 |
|
$collectivites = array("collectivite_idx" => $this->get_dossier_instruction_om_collectivite(), "collectivite_multi_idx" => $this->f->get_idx_collectivite_multi()); |
8488 |
|
$this->electronicsignature_instance = new electronicsignature($collectivites); |
8489 |
|
} catch (electronicsignature_exception $e) { |
8490 |
|
if ($with_handle_error === true) { |
8491 |
|
$this->handle_electronicsignature_exception($e); |
8492 |
|
} |
8493 |
|
return false; |
8494 |
|
} |
8495 |
|
return $this->electronicsignature_instance; |
8496 |
|
} |
8497 |
|
|
8498 |
|
/** |
8499 |
|
* TREATMENT - envoyer_au_controle_de_legalite |
8500 |
|
* |
8501 |
|
* Ajoute la tâche envoi_CL. |
8502 |
|
* C'est le traitement de la tâche qui mettra à jour la date d'envoi au contrôle de légalité. |
8503 |
|
* |
8504 |
|
* @return [type] [description] |
8505 |
|
*/ |
8506 |
|
function envoyer_au_controle_de_legalite() { |
8507 |
|
$this->begin_treatment(__METHOD__); |
8508 |
|
$this->correct = true; |
8509 |
|
|
8510 |
|
// |
8511 |
|
if ($this->can_be_sended_to_cl() === true) { |
8512 |
|
// Création de la task 'envoi_CL' |
8513 |
|
$inst_task = $this->f->get_inst__om_dbform(array( |
8514 |
|
"obj" => "task", |
8515 |
|
"idx" => 0, |
8516 |
|
)); |
8517 |
|
$task_val = array( |
8518 |
|
'type' => 'envoi_CL', |
8519 |
|
'object_id' => $this->getVal('instruction'), |
8520 |
|
'dossier' => $this->getVal('dossier'), |
8521 |
|
); |
8522 |
|
// Change l'état de la tâche de notification en fonction de l'état de |
8523 |
|
// transmission du dossier d'instruction |
8524 |
|
$inst_di = $this->get_inst_dossier($this->getVal('dossier')); |
8525 |
|
if ($this->f->is_option_mode_service_consulte_enabled() === false |
8526 |
|
&& ($inst_di->getVal('etat_transmission_platau') == 'non_transmissible' |
8527 |
|
|| $inst_di->getVal('etat_transmission_platau') == 'transmis_mais_non_transmissible')) { |
8528 |
|
// |
8529 |
|
$task_val['state'] = $inst_task::STATUS_DRAFT; |
8530 |
|
} |
8531 |
|
$add_task = $inst_task->add_task(array('val' => $task_val)); |
8532 |
|
if ($add_task === false) { |
8533 |
|
$this->addToMessage(sprintf('%s %s', |
8534 |
|
__("Une erreur s'est produite lors de la création tâche."), |
8535 |
|
__("Veuillez contacter votre administrateur.") |
8536 |
|
)); |
8537 |
|
$this->correct = false; |
8538 |
|
return $this->end_treatment(__METHOD__, false); |
8539 |
|
} |
8540 |
|
// Mise à jour du champs 'envoye_cl_platau' |
8541 |
|
$instr_val = array( |
8542 |
|
'envoye_cl_platau' => 't', |
8543 |
|
); |
8544 |
|
$res = $this->f->db->autoExecute( |
8545 |
|
DB_PREFIXE.$this->table, |
8546 |
|
$instr_val, |
8547 |
|
DB_AUTOQUERY_UPDATE, |
8548 |
|
$this->getCle($this->getVal($this->clePrimaire)) |
8549 |
|
); |
8550 |
|
$this->addToLog(__METHOD__."(): db->autoexecute(\"".DB_PREFIXE.'.'.$this->table."\", ".print_r($instr_val, true).", DB_AUTOQUERY_UPDATE, \"".$this->getCle($this->clePrimaire)."\");", DEBUG_MODE); |
8551 |
|
if ($this->f->isDatabaseError($res, true) === true) { |
8552 |
|
$this->addToMessage(sprintf('%s %s', |
8553 |
|
__("Une erreur s'est produite lors de la mise à jour de l'instruction."), |
8554 |
|
__("Veuillez contacter votre administrateur.") |
8555 |
|
)); |
8556 |
|
$this->correct = false; |
8557 |
|
return $this->end_treatment(__METHOD__, false); |
8558 |
|
} |
8559 |
|
// Message de validation à l'utilisateur |
8560 |
|
$this->addToMessage(__('Votre demande de transfert au contrôle de légalité à bien été prise en compte.')); |
8561 |
|
$this->addToMessage(__("La date d'envoi au contrôle de légalité sera mise à jour ultérieurement.")); |
8562 |
|
} |
8563 |
|
// |
8564 |
|
return $this->end_treatment(__METHOD__, true); |
8565 |
|
} |
8566 |
|
|
8567 |
|
|
8568 |
|
/** |
8569 |
|
* Retourne le lien de retour (VIEW formulaire et VIEW sousformulaire). |
8570 |
|
* |
8571 |
|
* @param string $view Appel dans le contexte de la vue 'formulaire' ou de |
8572 |
|
* la vue 'sousformulaire'. |
8573 |
|
* |
8574 |
|
* @return string |
8575 |
|
*/ |
8576 |
|
function get_back_link($view = "formulaire") { |
8577 |
|
// |
8578 |
|
$href = parent::get_back_link($view); |
8579 |
|
// |
8580 |
|
$crud = $this->get_action_crud(); |
8581 |
|
|
8582 |
|
// Redirection vers le formulaire de modification à la validation du |
8583 |
|
// formulaire d'ajout si l'événement associé possède une lettre type |
8584 |
|
if (($crud === 'create' |
8585 |
|
|| ($crud === null |
8586 |
|
&& $this->getParameter('maj') == 0)) |
8587 |
|
&& $this->correct == true |
8588 |
|
&& $this->evenement_has_an_edition($this->valF['evenement']) === true) { |
8589 |
|
|
8590 |
|
// On instancie l'instruction |
8591 |
|
$inst_instruction = $this->f->get_inst__om_dbform(array( |
8592 |
|
"obj" => "instruction", |
8593 |
|
"idx" => $this->valF[$this->clePrimaire], |
8594 |
|
)); |
8595 |
|
|
8596 |
|
// Si l'instruction n'est pas finalisée automatiquement |
8597 |
|
if ($inst_instruction->getVal('om_final_instruction') !== 't') { |
8598 |
|
$href = str_replace("&action=3", "&action=1", $href); |
8599 |
|
// |
8600 |
|
if (strpos($href, "&retour=tab") !== false) { |
8601 |
|
$href = str_replace("&retour=tab", "&retour= form", $href); |
8602 |
|
} else { |
8603 |
|
$href .= "&retour=form"; |
8604 |
|
} |
8605 |
|
} |
8606 |
|
} |
8607 |
|
|
8608 |
|
// |
8609 |
|
return $href; |
8610 |
|
} |
8611 |
|
|
8612 |
|
public function view_json_data() { |
8613 |
|
$this->checkAccessibility(); |
8614 |
|
$this->f->disableLog(); |
8615 |
|
$view = $this->get_json_data(); |
8616 |
|
printf(json_encode($view)); |
8617 |
|
} |
8618 |
|
|
8619 |
|
public function get_json_data() { |
8620 |
|
$val = array_combine($this->champs, $this->val); |
8621 |
|
foreach ($val as $key => $value) { |
8622 |
|
$val[$key] = strip_tags($value); |
8623 |
|
} |
8624 |
|
$val['tacite'] = 'f'; |
8625 |
|
$inst_ad = $this->f->get_inst__om_dbform(array( |
8626 |
|
"obj" => "avis_decision", |
8627 |
|
"idx" => $val['avis_decision'], |
8628 |
|
)); |
8629 |
|
if (preg_match('/[tT]acite/', $inst_ad->getVal('libelle')) === 1) { |
8630 |
|
$val['tacite'] = 't'; |
8631 |
|
} |
8632 |
|
return $val; |
8633 |
|
} |
8634 |
|
|
8635 |
|
public function get_related_instructions_next($next_type = 'retour_signature', $instruction = null) { |
8636 |
|
if (in_array($next_type, array('retour_signature', 'retour_ar', 'suivant_tacite', )) === false) { |
8637 |
|
return false; |
8638 |
|
} |
8639 |
|
$result = array(); |
8640 |
|
$evenements = array(); |
8641 |
|
if ($instruction === null) { |
8642 |
|
$instruction = $this->getVal($this->clePrimaire); |
8643 |
|
$evenement = $this->getVal('evenement'); |
8644 |
|
$dossier = $this->getVal('dossier'); |
8645 |
|
} else { |
8646 |
|
$inst = $this->f->get_inst__om_dbform(array( |
8647 |
|
"obj" => "instruction", |
8648 |
|
"idx" => $instruction, |
8649 |
|
)); |
8650 |
|
$evenement = $inst->getVal('evenement'); |
8651 |
|
$dossier = $inst->getVal('dossier'); |
8652 |
|
} |
8653 |
|
// |
8654 |
|
$query = sprintf(' |
8655 |
|
SELECT evenement_%3$s |
8656 |
|
FROM %1$sevenement |
8657 |
|
WHERE evenement = %2$s |
8658 |
|
', |
8659 |
|
DB_PREFIXE, |
8660 |
|
$evenement, |
8661 |
|
$next_type |
8662 |
|
); |
8663 |
|
$res = $this->f->get_one_result_from_db_query($query, true); |
8664 |
|
if ($res['code'] === 'KO') { |
8665 |
|
return false; |
8666 |
|
} |
8667 |
|
$ev_next = $res['result']; |
8668 |
|
// |
8669 |
|
$query = sprintf(' |
8670 |
|
SELECT MAX(instruction.instruction) as instruction |
8671 |
|
FROM %1$sinstruction |
8672 |
|
WHERE dossier = \'%3$s\' |
8673 |
|
AND evenement = %2$s |
8674 |
|
', |
8675 |
|
DB_PREFIXE, |
8676 |
|
$ev_next, |
8677 |
|
$dossier |
8678 |
|
); |
8679 |
|
$res = $this->f->get_one_result_from_db_query($query, true); |
8680 |
|
if ($res['code'] === 'KO') { |
8681 |
|
return false; |
8682 |
|
} |
8683 |
|
// |
8684 |
|
return $res['result']; |
8685 |
|
} |
8686 |
|
|
8687 |
|
public function get_related_instructions($instruction = null) { |
8688 |
|
$result = array(); |
8689 |
|
$evenements = array(); |
8690 |
|
if ($instruction === null) { |
8691 |
|
$instruction = $this->getVal($this->clePrimaire); |
8692 |
|
$evenement = $this->getVal('evenement'); |
8693 |
|
$dossier = $this->getVal('dossier'); |
8694 |
|
} else { |
8695 |
|
$inst = $this->f->get_inst__om_dbform(array( |
8696 |
|
"obj" => "instruction", |
8697 |
|
"idx" => $instruction, |
8698 |
|
)); |
8699 |
|
$evenement = $inst->getVal('evenement'); |
8700 |
|
$dossier = $inst->getVal('dossier'); |
8701 |
|
} |
8702 |
|
// |
8703 |
|
$query = sprintf(' |
8704 |
|
SELECT evenement |
8705 |
|
FROM %1$sevenement |
8706 |
|
WHERE evenement_retour_ar = %2$s |
8707 |
|
OR evenement_retour_signature = %2$s |
8708 |
|
', |
8709 |
|
DB_PREFIXE, |
8710 |
|
$evenement |
8711 |
|
); |
8712 |
|
$res = $this->f->get_one_result_from_db_query($query, true); |
8713 |
|
if ($res['code'] === 'KO') { |
8714 |
|
return false; |
8715 |
|
} |
8716 |
|
$ev_parent = $res['result']; |
8717 |
|
// |
8718 |
|
$query = sprintf(' |
8719 |
|
SELECT MAX(instruction.instruction) as instruction |
8720 |
|
FROM %1$sinstruction |
8721 |
|
WHERE dossier = \'%3$s\' |
8722 |
|
AND evenement = %2$s |
8723 |
|
', |
8724 |
|
DB_PREFIXE, |
8725 |
|
$ev_parent, |
8726 |
|
$dossier |
8727 |
|
); |
8728 |
|
$res = $this->f->get_one_result_from_db_query($query, true); |
8729 |
|
if ($res['code'] === 'KO') { |
8730 |
|
return false; |
8731 |
|
} |
8732 |
|
$result[] = $res['result']; |
8733 |
|
// |
8734 |
|
$query = sprintf(' |
8735 |
|
SELECT evenement_retour_ar |
8736 |
|
FROM %1$sevenement |
8737 |
|
WHERE evenement = %2$s |
8738 |
|
AND evenement_retour_ar != %3$s |
8739 |
|
', |
8740 |
|
DB_PREFIXE, |
8741 |
|
$ev_parent, |
8742 |
|
$evenement |
8743 |
|
); |
8744 |
|
$res = $this->f->get_one_result_from_db_query($query, true); |
8745 |
|
if ($res['code'] === 'KO') { |
8746 |
|
return false; |
8747 |
|
} |
8748 |
|
$evenements[] = $res['result']; |
8749 |
|
// |
8750 |
|
$query = sprintf(' |
8751 |
|
SELECT evenement_retour_signature |
8752 |
|
FROM %1$sevenement |
8753 |
|
WHERE evenement = %2$s |
8754 |
|
AND evenement_retour_signature != %3$s |
8755 |
|
', |
8756 |
|
DB_PREFIXE, |
8757 |
|
$ev_parent, |
8758 |
|
$evenement |
8759 |
|
); |
8760 |
|
$res = $this->f->get_one_result_from_db_query($query, true); |
8761 |
|
if ($res['code'] === 'KO') { |
8762 |
|
return false; |
8763 |
|
} |
8764 |
|
$evenements[] = $res['result']; |
8765 |
|
foreach ($evenements as $value) { |
8766 |
|
if ($value !== null) { |
8767 |
|
$query = sprintf(' |
8768 |
|
SELECT MAX(instruction.instruction) as instruction |
8769 |
|
FROM %1$sinstruction |
8770 |
|
WHERE dossier = \'%3$s\' |
8771 |
|
AND evenement = %2$s |
8772 |
|
', |
8773 |
|
DB_PREFIXE, |
8774 |
|
$value, |
8775 |
|
$dossier |
8776 |
|
); |
8777 |
|
$res = $this->f->get_one_result_from_db_query($query, true); |
8778 |
|
if ($res['code'] === 'KO') { |
8779 |
|
return false; |
8780 |
|
} |
8781 |
|
$result[] = $res['result']; |
8782 |
|
} |
8783 |
|
} |
8784 |
|
return $result; |
8785 |
|
} |
8786 |
|
|
8787 |
|
protected function getDocumentType($champ = null) { |
8788 |
|
$evenementId = $this->getVal('evenement'); |
8789 |
|
if (! empty($evenementId)) { |
8790 |
|
$evenement = $this->f->findObjectById('evenement', $evenementId); |
8791 |
|
if (! empty($evenement)) { |
8792 |
|
return __("Instruction").':'.$evenement->getVal('libelle'); |
8793 |
|
} |
8794 |
|
} |
8795 |
|
return parent::getDocumentType(); |
8796 |
|
} |
8797 |
|
|
8798 |
?> |
/** |
8799 |
|
* Récupère à l'aide d'une requête sql la liste des demandeurs |
8800 |
|
* pouvant être notifié. C'est à dire les demandeurs acceptant |
8801 |
|
* les notifications et pour lesquels une adresse mail existe. |
8802 |
|
* |
8803 |
|
* Dans le cas, d'une notification pour le portail citoyen, seul |
8804 |
|
* le pétitionnaire principal doit être notifier et uniquement si |
8805 |
|
* il a une adress mail et qu'il accepte les notifications. |
8806 |
|
* |
8807 |
|
* @param string identifiant du dossier |
8808 |
|
* @param boolean true si il faut récupérer la liste des demandeurs notifiable |
8809 |
|
* pour une notification de categorie portail |
8810 |
|
* @return array liste des demandeurs pouvant être notifié |
8811 |
|
*/ |
8812 |
|
protected function get_demandeurs_notifiable($idDossier = null, $portail = false) { |
8813 |
|
if ($idDossier === null) { |
8814 |
|
$idDossier = $this->getVal('dossier'); |
8815 |
|
} |
8816 |
|
// Ajoute une condition sur le where pour ne récupérer que le pétitionnaire principal |
8817 |
|
// pour une notification depuis le portail citoyen |
8818 |
|
$sqlPetitionnairePrincipal = ''; |
8819 |
|
if ($portail === true) { |
8820 |
|
$sqlPetitionnairePrincipal = 'AND lien_dossier_demandeur.petitionnaire_principal = true'; |
8821 |
|
} |
8822 |
|
|
8823 |
|
$listeDemandeursNotifiable = array(); |
8824 |
|
|
8825 |
|
// Requête de récupération des demandeurs |
8826 |
|
$sql = sprintf( |
8827 |
|
'SELECT |
8828 |
|
demandeur.demandeur, |
8829 |
|
CASE |
8830 |
|
WHEN demandeur.qualite=\'particulier\' |
8831 |
|
THEN TRIM(CONCAT(demandeur.particulier_nom, \' \', demandeur.particulier_prenom, \' \', demandeur.courriel)) |
8832 |
|
ELSE |
8833 |
|
TRIM(CONCAT(demandeur.personne_morale_raison_sociale, \' \', demandeur.personne_morale_denomination, \' \', demandeur.courriel)) |
8834 |
|
END AS destinataire, |
8835 |
|
demandeur.courriel |
8836 |
|
FROM |
8837 |
|
%1$sdossier |
8838 |
|
INNER JOIN %1$slien_dossier_demandeur |
8839 |
|
ON dossier.dossier = lien_dossier_demandeur.dossier |
8840 |
|
INNER JOIN %1$sdemandeur |
8841 |
|
ON lien_dossier_demandeur.demandeur = demandeur.demandeur |
8842 |
|
WHERE |
8843 |
|
dossier.dossier = \'%2$s\' AND |
8844 |
|
notification = \'t\' AND |
8845 |
|
courriel IS NOT NULL |
8846 |
|
%3$s', |
8847 |
|
DB_PREFIXE, |
8848 |
|
$idDossier, |
8849 |
|
$sqlPetitionnairePrincipal |
8850 |
|
); |
8851 |
|
$res = $this->f->db->query($sql); |
8852 |
|
$this->f->addToLog(__METHOD__."(): db->query(\"".$sql."\")", VERBOSE_MODE); |
8853 |
|
$this->f->isDatabaseError($res); |
8854 |
|
// Récupération des infos des demandeurs et stockage dans un tableau |
8855 |
|
// ayant pour clé les id des demandeurs |
8856 |
|
while($row = $res->fetchrow(DB_FETCHMODE_ASSOC)) { |
8857 |
|
$listeDemandeursNotifiable[$row['demandeur']] = $row; |
8858 |
|
} |
8859 |
|
|
8860 |
|
return $listeDemandeursNotifiable; |
8861 |
|
} |
8862 |
|
|
8863 |
|
/** |
8864 |
|
* Renvoie la liste des notifications liées à l'instruction |
8865 |
|
* |
8866 |
|
* @param integer id de l'instruction dont on cherche les notifications |
8867 |
|
* @return array liste des instruction_notification liés à l'instruction |
8868 |
|
*/ |
8869 |
|
public function get_instruction_notification($id_instruction, $typeNotification = null) { |
8870 |
|
$whereTypeTache = ''; |
8871 |
|
if ($typeNotification != null) { |
8872 |
|
if (is_array($typeNotification)) { |
8873 |
|
$whereTypeTache = sprintf( |
8874 |
|
'AND task.type IN (%1$s)', |
8875 |
|
"'".implode("', '", $typeNotification)."'" |
8876 |
|
); |
8877 |
|
} else { |
8878 |
|
$whereTypeTache = sprintf( |
8879 |
|
'AND task.type = \'%1$s\'', |
8880 |
|
$typeNotification |
8881 |
|
); |
8882 |
|
} |
8883 |
|
} |
8884 |
|
$listeInstrNotif = array(); |
8885 |
|
$sql = sprintf(' |
8886 |
|
SELECT |
8887 |
|
instruction_notification.instruction_notification |
8888 |
|
FROM |
8889 |
|
%1$sinstruction_notification |
8890 |
|
LEFT JOIN %1$stask |
8891 |
|
ON instruction_notification.instruction_notification::CHARACTER VARYING = task.object_id |
8892 |
|
WHERE |
8893 |
|
instruction = %2$s |
8894 |
|
%3$s', |
8895 |
|
DB_PREFIXE, |
8896 |
|
$id_instruction, |
8897 |
|
$whereTypeTache |
8898 |
|
); |
8899 |
|
$res = $this->f->db->query($sql); |
8900 |
|
$this->f->addToLog(__METHOD__."(): db->query(\"".$sql."\")", VERBOSE_MODE); |
8901 |
|
$this->f->isDatabaseError($res); |
8902 |
|
while ($row = $res->fetchrow(DB_FETCHMODE_ASSOC)) { |
8903 |
|
$listeInstrNotif[] = $row['instruction_notification']; |
8904 |
|
} |
8905 |
|
return $listeInstrNotif; |
8906 |
|
} |
8907 |
|
|
8908 |
|
/** |
8909 |
|
* Crée une clé d'accès unique permettant à un utilisateur |
8910 |
|
* anonyme de récupérer le document. |
8911 |
|
* |
8912 |
|
* @return string clé d'accès du document |
8913 |
|
*/ |
8914 |
|
protected function getCleAccesDocument() { |
8915 |
|
// Initialisation d'un tableau |
8916 |
|
$number_list = array(); |
8917 |
|
|
8918 |
|
// Génération aléatoire d'un nombre sur 4 caractères, 4 fois |
8919 |
|
for ($i = 0; $i < 4; $i++) { |
8920 |
|
$number_list[] = str_pad(mt_rand(0, 9999), 4, 0, STR_PAD_LEFT); |
8921 |
|
} |
8922 |
|
|
8923 |
|
// Transformation en chaîne tout en séparant les nombres par un "-" |
8924 |
|
$result = implode('-', $number_list); |
8925 |
|
|
8926 |
|
// Vérifie si la clé existe déjà et si c'est le cas génére une nouvelle clé |
8927 |
|
if ($this->getUidDocumentInstructionWithKey($result) != null) { |
8928 |
|
return $this->getCleAccesDocument(); |
8929 |
|
} |
8930 |
|
|
8931 |
|
// |
8932 |
|
return $result; |
8933 |
|
} |
8934 |
|
|
8935 |
|
/** |
8936 |
|
* Récupère une clé et renvoie l'uid du document liée à cette |
8937 |
|
* clé. Si la clé n'existe pas renvoie null. |
8938 |
|
* |
8939 |
|
* @param string $cleGen clé dont on cherche l'instruction |
8940 |
|
* @return integer|null |
8941 |
|
*/ |
8942 |
|
protected function getUidDocumentInstructionWithKey($cleGen) { |
8943 |
|
$query = sprintf( |
8944 |
|
'SELECT |
8945 |
|
instruction.om_fichier_instruction |
8946 |
|
FROM |
8947 |
|
%1$sinstruction_notification_document |
8948 |
|
LEFT JOIN %1$sinstruction ON instruction_notification_document.instruction = instruction.instruction |
8949 |
|
WHERE |
8950 |
|
instruction_notification_document.cle = \'%2$s\'', |
8951 |
|
DB_PREFIXE, |
8952 |
|
$this->f->db->escapeSimple($cleGen) |
8953 |
|
); |
8954 |
|
|
8955 |
|
$res = $this->f->db->getOne($query); |
8956 |
|
$this->addToLog(__METHOD__.": db->getOne(\"".$query."\");", VERBOSE_MODE); |
8957 |
|
$this->f->isDatabaseError($res); |
8958 |
|
return $res; |
8959 |
|
} |
8960 |
|
|
8961 |
|
/** |
8962 |
|
* Récupère une clé, fait une requête pour récupérer l'id de la notification liée a cette clé. |
8963 |
|
* Récupère l'instance de instruction_notification dont l'id a été récupéré et la renvoie. |
8964 |
|
* |
8965 |
|
* @param string $cleGen |
8966 |
|
* @return instruction_notification |
8967 |
|
*/ |
8968 |
|
protected function getInstanceNotificationWithKey($key) { |
8969 |
|
$sql = sprintf( |
8970 |
|
"SELECT |
8971 |
|
instruction_notification |
8972 |
|
FROM |
8973 |
|
%1\$sinstruction_notification_document |
8974 |
|
WHERE |
8975 |
|
cle = '%2\$s'", |
8976 |
|
DB_PREFIXE, |
8977 |
|
$this->f->db->escapeSimple($key) |
8978 |
|
); |
8979 |
|
$res = $this->f->db->getOne($sql); |
8980 |
|
$this->addToLog(__METHOD__.": db->getOne(\"".$sql."\");", VERBOSE_MODE); |
8981 |
|
$this->f->isDatabaseError($res); |
8982 |
|
|
8983 |
|
// Récupération de l'instance de notification |
8984 |
|
$instNotif = $this->f->get_inst__om_dbform(array( |
8985 |
|
"obj" => "instruction_notification", |
8986 |
|
"idx" => $res, |
8987 |
|
)); |
8988 |
|
return $instNotif; |
8989 |
|
} |
8990 |
|
|
8991 |
|
|
8992 |
|
/** |
8993 |
|
* Affiche la page de téléchargement du document de la notification. |
8994 |
|
* |
8995 |
|
* @param boolean $content_only Affiche le contenu seulement. |
8996 |
|
* |
8997 |
|
* @return void |
8998 |
|
*/ |
8999 |
|
public function view_telecharger_document_anonym() { |
9000 |
|
// Par défaut on considère qu'on va afficher le formulaire |
9001 |
|
$idx = 0; |
9002 |
|
// Flag d'erreur |
9003 |
|
$error = false; |
9004 |
|
// Message d'erreur |
9005 |
|
$message = ''; |
9006 |
|
|
9007 |
|
// Paramètres GET : récupération de la clé d'accès |
9008 |
|
$cle_acces_document = $this->f->get_submitted_get_value('key'); |
9009 |
|
$cle_acces_document = $this->f->db->escapeSimple($cle_acces_document); |
9010 |
|
// Vérification de l'existence de la clé et récupération de l'uid du fichier |
9011 |
|
$uidFichier = $this->getUidDocumentInstructionWithKey($cle_acces_document); |
9012 |
|
if ($uidFichier != null) { |
9013 |
|
// Récupération du document |
9014 |
|
$file = $this->f->storage->get($uidFichier); |
9015 |
|
|
9016 |
|
// Headers |
9017 |
|
header("Cache-Control: no-cache, must-revalidate"); // HTTP/1.1 |
9018 |
|
header("Expires: Sat, 26 Jul 1997 05:00:00 GMT"); // Date dans le passé |
9019 |
|
header("Content-Type: ".$file['metadata']['mimetype']); |
9020 |
|
header("Accept-Ranges: bytes"); |
9021 |
|
header("Content-Disposition: inline; filename=\"".$file['metadata']['filename']."\";" ); |
9022 |
|
// Affichage du document |
9023 |
|
echo $file['file_content']; |
9024 |
|
|
9025 |
|
// Récupération de la date de premier accès et maj du suivi uniquement |
9026 |
|
// si la date de 1er accès n'a pas encore été remplis |
9027 |
|
$inst_notif = $this->getInstanceNotificationWithKey($cle_acces_document); |
9028 |
|
if ($inst_notif->getVal('date_premier_acces') == null || |
9029 |
|
$inst_notif->getVal('date_premier_acces') == '') { |
9030 |
|
$notif_val = array(); |
9031 |
|
foreach ($inst_notif->champs as $champ) { |
9032 |
|
$notif_val[$champ] = $inst_notif->getVal($champ); |
9033 |
|
} |
9034 |
|
$notif_val['date_premier_acces'] = date("d/m/Y H:i:s"); |
9035 |
|
$notif_val['statut'] = 'vu'; |
9036 |
|
$notif_val['commentaire'] = 'Le document a été vu'; |
9037 |
|
$suivi_notif = $inst_notif->modifier($notif_val); |
9038 |
|
} |
9039 |
|
|
9040 |
|
} else { |
9041 |
|
// Page vide 404 |
9042 |
|
printf('Ressource inexistante'); |
9043 |
|
header('HTTP/1.0 404 Not Found'); |
9044 |
|
} |
9045 |
|
} |
9046 |
|
|
9047 |
|
/** |
9048 |
|
* Récupère le titre du document envoyé au parapheur |
9049 |
|
*/ |
9050 |
|
protected function getDocumentTitre($champ = null) { |
9051 |
|
$title = $this->getTitle(); |
9052 |
|
$dossier = $this->getDossier(); |
9053 |
|
return $dossier.' '.$title; |
9054 |
|
} |
9055 |
|
|
9056 |
|
/** |
9057 |
|
* Compose le nom du document à transmettre au parapheur. |
9058 |
|
* Le nom ets composé de cette manière : |
9059 |
|
* instruction_xxx_libelle_de_la_lettre_type_associee |
9060 |
|
* ou xxx correspond au numéro de l'instruction |
9061 |
|
*/ |
9062 |
|
protected function getDocumentLibelle() { |
9063 |
|
// Récupère le champ instruction |
9064 |
|
$instruction = $this->getVal("instruction"); |
9065 |
|
|
9066 |
|
// Requête sql servant à récupérer le titre du document |
9067 |
|
// TO_CHAR() introduit un espace avant l'affichage du nombre |
9068 |
|
// comme les espaces sont remplacé par des '_' dans le retour de la fonction |
9069 |
|
// il n'est pas nécessaire de mettre un '_' après le mot instruction. |
9070 |
|
$sql = sprintf( |
9071 |
|
'SELECT |
9072 |
|
CONCAT( |
9073 |
|
\'instruction\', |
9074 |
|
TO_CHAR(instruction.instruction, \'000\'), |
9075 |
|
\'_\', |
9076 |
|
LOWER(om_lettretype.libelle) |
9077 |
|
) as nom_fichier |
9078 |
|
FROM |
9079 |
|
%1$sinstruction |
9080 |
|
LEFT JOIN %1$som_lettretype ON om_lettretype.id = instruction.lettretype |
9081 |
|
WHERE |
9082 |
|
instruction = %2$s', |
9083 |
|
DB_PREFIXE, |
9084 |
|
$instruction |
9085 |
|
); |
9086 |
|
$documentLibelle = $this->f->db->getOne($sql); |
9087 |
|
$this->addToLog("getDocumentTitre(): db->getOne(\"".$sql."\");", VERBOSE_MODE); |
9088 |
|
if (database::isError($documentLibelle)) { |
9089 |
|
die(); |
9090 |
|
} |
9091 |
|
|
9092 |
|
// Transforamtion des ' ' en '_', des accents en lettres sans accents et des |
9093 |
|
// caractères spéciaux en '_' |
9094 |
|
// La méthode normalize_string est utilisé pour gérer les accents |
9095 |
|
$documentLibelle = $this->f->normalize_string($documentLibelle); |
9096 |
|
// TODO : comparer cette liste et celle de la méthode normalize_string |
9097 |
|
// pour éviter les doublons + vérifier qu'il n'y a pas de doublons dans cette |
9098 |
|
// liste |
9099 |
|
$invalid = array('Œ'=>'oe', 'œ'=>'oe', 'Ÿ'=>'y', 'ü'=>'u', |
9100 |
|
'¢' => '_', 'ß' => '_', '¥' => '_', '£' => '_', '™' => '_', '©' => '_', |
9101 |
|
'®' => '_', 'ª' => '_', '×' => '_', '÷' => '_', '±' => '_', '²' => '_', |
9102 |
|
'³' => '_', '¼' => '_', '½' => '_', '¾' => '_', 'µ' => '_', '¿' => '_', |
9103 |
|
'¶' => '_', '·' => '_', '¸' => '_', 'º' => '_', '°' => '_', '¯' => '_', |
9104 |
|
'§' => '_', '…' => '_', '¤' => '_', '¦' => '_', '≠' => '_', '¬' => '_', |
9105 |
|
'ˆ' => '_', '¨' => '_', '‰' => '_', '¤' => '_', '€' => '_', '$' => '_', |
9106 |
|
'«' => '_', '»' => '_', '‹' => '_', '›' => '_', 'ƒ' => '_', '¥' => '_', |
9107 |
|
'‘‘' => '_', '‚' => '_', '!' => '_', '¡' => '_', '¢' => '_', '£' => '_', |
9108 |
|
'?' => '_', '[' => '_', ']' => '_', '´' => '_', '`' => '_', '^' => '_', |
9109 |
|
'~' => '_', '˜' => '_', '#' => '_', '*' => '_', '.' => '_', ':' => '_', |
9110 |
|
';' => '_', '•' => '_', '¯' => '_', '‾' => '_', '–' => '_', '–' => '_', |
9111 |
|
'—' => '_', '_' => '_', '|' => '_', '¦' => '_', '‡' => '_', '§' => '_', |
9112 |
|
'¶' => '_', '©' => '_', '®' => '_', '™' => '_', '&' => '_', '@' => '_', |
9113 |
|
'/' => '_', '\\' => '_', '◊' => '_', '♠' => '_', '♣' => '_', '♥' => '_', |
9114 |
|
'♦' => '_', '←' => '_', '↑' => '_', '→' => '_', '↓' => '_', '↔' => '_', |
9115 |
|
'°' => '_', 'µ' => '_', '<' => '_', '>' => '_', '≤' => '_', '≥' => '_', |
9116 |
|
'=' => '_', '≈' => '_', '≠' => '_', '≡' => '_', '±' => '_', '−' => '_', |
9117 |
|
'+' => '_', '×' => '_', '÷' => '_', '⁄' => '_', '%' => '_', '‰' => '_', |
9118 |
|
'¼' => '_', '½' => '_', '¾' => '_', '¹' => '_', '²' => '_', '³' => '_', |
9119 |
|
'' => '_', 'º' => '_', 'ª' => '_', 'ƒ' => '_', '′' => '_', '″' => '_', |
9120 |
|
'∂' => '_', '∏' => '_', '∑' => '_', '√' => '_', '∞' => '_', '¬' => '_', |
9121 |
|
'∩' => '_', '∫' => '_', 'α' => '_', 'Α' => '_', 'β' => '_', 'Β' => '_', |
9122 |
|
'γ' => '_', 'Γ' => '_', 'δ' => '_', 'Δ' => '_', 'ε' => '_', 'Ε' => '_', |
9123 |
|
'ζ' => '_', 'Ζ' => '_', 'η' => '_', 'Η' => '_', 'θ' => '_', 'Θ' => '_', |
9124 |
|
'ι' => '_', 'Ι' => '_', 'κ' => '_', 'Κ' => '_', 'λ' => '_', 'Λ' => '_', |
9125 |
|
'μ' => '_', 'Μ' => '_', 'ν' => '_', 'Ν' => '_', 'ξ' => '_', 'Ξ' => '_', |
9126 |
|
'ο' => '_', 'Ο' => '_', 'π' => '_', 'Π' => '_', 'ρ' => '_', 'Ρ' => '_', |
9127 |
|
'σ' => '_', 'ς' => '_', 'Σ' => '_', 'τ' => '_', 'Τ' => '_', 'υ' => '_', |
9128 |
|
'Υ' => '_', 'φ' => '_', 'Φ' => '_', 'χ' => '_', 'Χ' => '_', 'ψ' => '_', |
9129 |
|
'Ψ' => '_', 'ω' => '_', 'Ω' => '_', ',' => '_', ' ' => '_' |
9130 |
|
); |
9131 |
|
|
9132 |
|
return str_replace(array_keys($invalid), array_values($invalid), $documentLibelle); |
9133 |
|
} |
9134 |
|
|
9135 |
|
/** |
9136 |
|
* Surcharge permettant de ne pas afficher le fil d'Ariane dans |
9137 |
|
* l'overlay de notification des demandeurs. |
9138 |
|
*/ |
9139 |
|
function getSubFormTitle($ent) { |
9140 |
|
if ($this->getParameter('maj') == '411') { |
9141 |
|
return ''; |
9142 |
|
} |
9143 |
|
return parent::getSubFormTitle($ent); |
9144 |
|
} |
9145 |
|
}// fin classe |