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", |
308 |
"view" => "view_generate_suivi_bordereaux", |
"view" => "view_generate_suivi_bordereaux", |
309 |
"permission_suffix" => "consulter", |
"permission_suffix" => "consulter", |
310 |
); |
); |
311 |
|
|
312 |
|
// ACTION - 777 - pdf_temp |
313 |
|
// Crée un PDF temporaire et affiche son contenu en base64 |
314 |
|
$this->class_actions[777] = array( |
315 |
|
"identifier" => "pdf_temp", |
316 |
|
"view" => "view_pdf_temp", |
317 |
|
"permission_suffix" => "modifier", |
318 |
|
"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 |
|
// ACTION - 404 - Annuler l'envoi en signature |
415 |
|
// Cet évenement permet d'annuler l'envoi en signature du document au parapheur |
416 |
|
$this->class_actions[404] = array( |
417 |
|
"identifier" => "annuler_envoi_signature", |
418 |
|
"portlet" => array( |
419 |
|
"libelle" => __("Annuler l'envoi en signature"), |
420 |
|
"type" => "action-direct-with-confirmation", |
421 |
|
"class" => "annuler_envoi_signature-16", |
422 |
|
), |
423 |
|
"view" => "formulaire", |
424 |
|
"method" => "annuler_envoi_en_signature", |
425 |
|
"condition" => array( |
426 |
|
"is_sent_for_signature_or_has_been_signed", |
427 |
|
"is_parapheur_annulation_parameter_enabled" |
428 |
|
), |
429 |
|
"permission_suffix" => "envoyer_a_signature", |
430 |
|
); |
431 |
|
|
432 |
|
// |
433 |
|
$this->class_actions[401] = array( |
434 |
|
"identifier" => "preview_edition", |
435 |
|
"view" => "formulaire", |
436 |
|
"permission_suffix" => "tab", |
437 |
|
); |
438 |
|
|
439 |
|
// ACTION - 410 - Notifier les pétitionnaires (mail ou autre) |
440 |
|
$this->class_actions[410] = array( |
441 |
|
"identifier" => "overlay_notification_manuelle", |
442 |
|
"portlet" => array( |
443 |
|
"libelle" => __("Notifier les pétitionnaires"), |
444 |
|
"type" => "action-self", |
445 |
|
"class" => "notifier_commune-16", |
446 |
|
), |
447 |
|
"condition" => array( |
448 |
|
"is_notifiable_by_task_manual", |
449 |
|
"is_not_portail_notification_sans_annexe" |
450 |
|
), |
451 |
|
"view" => "view_overlay_notification_manuelle", |
452 |
|
"permission_suffix" => "modifier", |
453 |
|
); |
454 |
|
|
455 |
|
// ACTION - 411 - Notifier les pétitionnaires (portail citoyen) |
456 |
|
$this->class_actions[411] = array( |
457 |
|
"identifier" => "notification_manuelle_portal", |
458 |
|
"portlet" => array( |
459 |
|
"libelle" => __("Notifier les pétitionnaires"), |
460 |
|
"type" => "action-direct-with-confirmation", |
461 |
|
"class" => "notifier_commune-16", |
462 |
|
), |
463 |
|
"condition" => array( |
464 |
|
"is_notifiable_by_task_manual", |
465 |
|
"is_portail_notification_sans_annexe" |
466 |
|
), |
467 |
|
"method" => "notifier_demandeur_principal", |
468 |
|
"permission_suffix" => "modifier", |
469 |
|
); |
470 |
|
|
471 |
|
// ACTION - 420 - Notifier les services consultés (mail) |
472 |
|
$this->class_actions[420] = array( |
473 |
|
"identifier" => "overlay_notification_service_consulte", |
474 |
|
"portlet" => array( |
475 |
|
"libelle" => __("Notifier les services consultés"), |
476 |
|
"type" => "action-self", |
477 |
|
"class" => "notifier_commune-16", |
478 |
|
), |
479 |
|
"condition" => array( |
480 |
|
"is_service_notifiable" |
481 |
|
), |
482 |
|
"view" => "view_overlay_notification_service_consulte", |
483 |
|
"permission_suffix" => "tab", |
484 |
|
); |
485 |
|
|
486 |
|
// ACTION - 430 - Notifier les tiers consultés (mail) |
487 |
|
$this->class_actions[430] = array( |
488 |
|
"identifier" => "overlay_notification_tiers_consulte", |
489 |
|
"portlet" => array( |
490 |
|
"libelle" => __("Notifier les tiers consultés"), |
491 |
|
"type" => "action-self", |
492 |
|
"class" => "notifier_commune-16", |
493 |
|
), |
494 |
|
"condition" => array( |
495 |
|
"is_tiers_notifiable" |
496 |
|
), |
497 |
|
"view" => "view_overlay_notification_tiers_consulte", |
498 |
|
"permission_suffix" => "tab", |
499 |
|
); |
500 |
|
|
501 |
|
// |
502 |
|
$this->class_actions[403] = array( |
503 |
|
"identifier" => "envoyer_au_controle_de_legalite", |
504 |
|
"portlet" => array( |
505 |
|
"libelle" => __("Envoyer au contrôle de légalité"), |
506 |
|
"type" => "action-direct-with-confirmation", |
507 |
|
"class" => "envoyer_au_controle_de_legalite-16", |
508 |
|
), |
509 |
|
"view" => "formulaire", |
510 |
|
"method" => "envoyer_au_controle_de_legalite", |
511 |
|
"condition" => array( |
512 |
|
"can_be_sended_to_cl" |
513 |
|
), |
514 |
|
"permission_suffix" => "envoyer_au_controle_de_legalite", |
515 |
|
); |
516 |
|
|
517 |
|
// |
518 |
|
$this->class_actions[998] = array( |
519 |
|
"identifier" => "json_data", |
520 |
|
"view" => "view_json_data", |
521 |
|
"permission_suffix" => "consulter", |
522 |
|
); |
523 |
|
} |
524 |
|
|
525 |
|
/** |
526 |
|
* Clause select pour la requête de sélection des données de l'enregistrement. |
527 |
|
* |
528 |
|
* @return array |
529 |
|
*/ |
530 |
|
function get_var_sql_forminc__champs() { |
531 |
|
return array( |
532 |
|
"instruction", |
533 |
|
"destinataire", |
534 |
|
"instruction.evenement", |
535 |
|
"instruction.commentaire", |
536 |
|
"date_evenement", |
537 |
|
"instruction.lettretype", |
538 |
|
"signataire_arrete", |
539 |
|
"flag_edition_integrale", |
540 |
|
"om_final_instruction_utilisateur", |
541 |
|
"date_finalisation_courrier", |
542 |
|
"date_envoi_signature", |
543 |
|
"date_envoi_rar", |
544 |
|
"date_envoi_controle_legalite", |
545 |
|
|
546 |
|
"date_retour_signature", |
547 |
|
"date_retour_rar", |
548 |
|
"date_retour_controle_legalite", |
549 |
|
|
550 |
|
"numero_arrete", |
551 |
|
|
552 |
|
"complement_om_html", |
553 |
|
"'' as bible_auto", |
554 |
|
"'' as bible", |
555 |
|
"complement2_om_html", |
556 |
|
"'' as bible2", |
557 |
|
"complement3_om_html", |
558 |
|
"'' as bible3", |
559 |
|
"complement4_om_html", |
560 |
|
"'' as bible4", |
561 |
|
|
562 |
|
"titre_om_htmletat", |
563 |
|
"corps_om_htmletatex", |
564 |
|
|
565 |
|
"'' as btn_preview", |
566 |
|
"'' as btn_redaction", |
567 |
|
|
568 |
|
"'' as btn_refresh", |
569 |
|
"'' as live_preview", |
570 |
|
|
571 |
|
"dossier", |
572 |
|
"instruction.action", |
573 |
|
"instruction.delai", |
574 |
|
"instruction.etat", |
575 |
|
"instruction.autorite_competente", |
576 |
|
"instruction.accord_tacite", |
577 |
|
"instruction.delai_notification", |
578 |
|
"instruction.avis_decision", |
579 |
|
"archive_delai", |
580 |
|
"archive_accord_tacite", |
581 |
|
"archive_etat", |
582 |
|
"archive_avis", |
583 |
|
"archive_date_complet", |
584 |
|
"archive_date_rejet", |
585 |
|
"archive_date_limite", |
586 |
|
"archive_date_notification_delai", |
587 |
|
"archive_date_decision", |
588 |
|
"archive_date_validite", |
589 |
|
"archive_date_achevement", |
590 |
|
"archive_date_conformite", |
591 |
|
"archive_date_chantier", |
592 |
|
"archive_date_dernier_depot", |
593 |
|
"date_depot", |
594 |
|
"date_depot_mairie", |
595 |
|
"complement5_om_html", |
596 |
|
"'' as bible5", |
597 |
|
"complement6_om_html", |
598 |
|
"'' as bible6", |
599 |
|
"complement7_om_html", |
600 |
|
"'' as bible7", |
601 |
|
"complement8_om_html", |
602 |
|
"'' as bible8", |
603 |
|
"complement9_om_html", |
604 |
|
"'' as bible9", |
605 |
|
"complement10_om_html", |
606 |
|
"'' as bible10", |
607 |
|
"complement11_om_html", |
608 |
|
"'' as bible11", |
609 |
|
"complement12_om_html", |
610 |
|
"complement13_om_html", |
611 |
|
"complement14_om_html", |
612 |
|
"complement15_om_html", |
613 |
|
"archive_incompletude", |
614 |
|
"archive_incomplet_notifie", |
615 |
|
"archive_evenement_suivant_tacite", |
616 |
|
"archive_evenement_suivant_tacite_incompletude", |
617 |
|
"archive_etat_pendant_incompletude", |
618 |
|
"archive_date_limite_incompletude", |
619 |
|
"archive_delai_incompletude", |
620 |
|
"archive_autorite_competente", |
621 |
|
"code_barres", |
622 |
|
"om_fichier_instruction", |
623 |
|
"om_final_instruction", |
624 |
|
"om_fichier_instruction_dossier_final", |
625 |
|
"document_numerise", |
626 |
|
"duree_validite_parametrage", |
627 |
|
"duree_validite", |
628 |
|
"created_by_commune", |
629 |
|
"archive_date_cloture_instruction", |
630 |
|
"archive_date_premiere_visite", |
631 |
|
"archive_date_derniere_visite", |
632 |
|
"archive_date_contradictoire", |
633 |
|
"archive_date_retour_contradictoire", |
634 |
|
"archive_date_ait", |
635 |
|
"archive_date_transmission_parquet", |
636 |
|
"archive_dossier_instruction_type", |
637 |
|
"archive_date_affichage", |
638 |
|
"pec_metier", |
639 |
|
"archive_pec_metier", |
640 |
|
"archive_a_qualifier", |
641 |
|
"id_parapheur_signature", |
642 |
|
"statut_signature", |
643 |
|
"commentaire_signature", |
644 |
|
"historique_signature", |
645 |
|
"'' as suivi_notification", |
646 |
|
"'' as suivi_notification_service", |
647 |
|
"'' as suivi_notification_tiers", |
648 |
|
|
649 |
|
"'' as preview_edition", |
650 |
|
"envoye_cl_platau", |
651 |
|
); |
652 |
|
} |
653 |
|
|
654 |
|
/** |
655 |
|
* CONDITION - is_edition_integrale_enabled |
656 |
|
* |
657 |
|
* Vérifie que la rédaction libre est activée sur l'instruction en cours. |
658 |
|
* |
659 |
|
* @return boolean |
660 |
|
*/ |
661 |
|
function is_edition_integrale_enabled() { |
662 |
|
if ($this->getVal("flag_edition_integrale") == 't') { |
663 |
|
return true; |
664 |
|
} |
665 |
|
return false; |
666 |
|
} |
667 |
|
|
668 |
|
/** |
669 |
|
* CONDITION - is_edition_integrale_not_enabled |
670 |
|
* |
671 |
|
* Vérifie que la rédaction libre est désactivée sur l'instruction en cours. |
672 |
|
* |
673 |
|
* @return boolean |
674 |
|
*/ |
675 |
|
function is_edition_integrale_not_enabled() { |
676 |
|
return !$this->is_edition_integrale_enabled(); |
677 |
|
} |
678 |
|
|
679 |
|
/** |
680 |
|
* CONDITION - is_option_redaction_libre_enabled |
681 |
|
* |
682 |
|
* Vérifie que l'option de rédaction libre est activée. |
683 |
|
* |
684 |
|
* @return boolean |
685 |
|
*/ |
686 |
|
function is_option_redaction_libre_enabled() { |
687 |
|
$collectivite_di = $this->get_dossier_instruction_om_collectivite(); |
688 |
|
return $this->f->is_option_redaction_libre_enabled($collectivite_di); |
689 |
} |
} |
690 |
|
|
691 |
|
/** |
692 |
|
* CONDITION - is_option_parapheur_relecture_enabled |
693 |
|
* |
694 |
|
* Vérifie que l'option de relecture lors de l'envoi en signature est activée. |
695 |
|
* |
696 |
|
* @return boolean |
697 |
|
*/ |
698 |
|
function is_parapheur_relecture_parameter_enabled() { |
699 |
|
//Instanciation de la classe electronicsignature |
700 |
|
$inst_es = $this->get_electronicsignature_instance(); |
701 |
|
if ($inst_es === false) { |
702 |
|
return false; |
703 |
|
} |
704 |
|
|
705 |
|
if ($inst_es->get_conf('is_forced_view_files') !== 'true' && $inst_es->get_conf('is_forced_view_files') !== true) { |
706 |
|
return false; |
707 |
|
} |
708 |
|
|
709 |
|
return true; |
710 |
|
} |
711 |
|
|
712 |
|
/** |
713 |
|
* CONDITION - is_parapheur_annulation_parameter_enabled |
714 |
|
* |
715 |
|
* Vérifie que l'option d'annulation de l'envoi en signature est activée. |
716 |
|
* |
717 |
|
* @return boolean |
718 |
|
*/ |
719 |
|
function is_parapheur_annulation_parameter_enabled() { |
720 |
|
//Instanciation de la classe electronicsignature |
721 |
|
$inst_es = $this->get_electronicsignature_instance(); |
722 |
|
if ($inst_es === false) { |
723 |
|
return false; |
724 |
|
} |
725 |
|
|
726 |
|
if ($inst_es->get_conf('cancel_send') !== 'true' && $inst_es->get_conf('cancel_send') !== true) { |
727 |
|
return false; |
728 |
|
} |
729 |
|
|
730 |
|
return true; |
731 |
|
} |
732 |
|
|
733 |
|
|
734 |
|
/** |
735 |
|
* CONDITION - is_sent_for_signature |
736 |
|
* |
737 |
|
* Vérifie que l'instruction a été envoyé à signature |
738 |
|
* |
739 |
|
* @return boolean |
740 |
|
*/ |
741 |
|
function is_sent_for_signature() { |
742 |
|
// Si un parapheur a été configuré |
743 |
|
// et que le champ id_parapheur_signature n'est pas vide |
744 |
|
// que le status est différent de "canceled" ou "expired" |
745 |
|
// alors l'évènement a été envoyé en signature |
746 |
|
if ($this->has_connector_electronicsignature() === true |
747 |
|
&& empty($this->getVal("id_parapheur_signature")) === false |
748 |
|
&& ($this->getVal("statut_signature") != "canceled" |
749 |
|
|| $this->getVal("statut_signature") != "expired" |
750 |
|
|| $this->getVal("statut_signature") != "finished")) { |
751 |
|
// |
752 |
|
return true; |
753 |
|
} |
754 |
|
|
755 |
|
return false; |
756 |
|
} |
757 |
|
|
758 |
|
/** |
759 |
|
* CONDITION - is_not_sent_for_signature |
760 |
|
* |
761 |
|
* Vérifie que l'instruction n'a pas été envoyé à signature |
762 |
|
* |
763 |
|
* @return boolean |
764 |
|
*/ |
765 |
|
function is_not_sent_for_signature() { |
766 |
|
// Contrôle si l'utilisateur possède un bypass |
767 |
|
$bypass = $this->f->isAccredited($this->get_absolute_class_name()."_definaliser_bypass"); |
768 |
|
if ($bypass == true) { |
769 |
|
return true; |
770 |
|
} |
771 |
|
|
772 |
|
return !$this->is_sent_for_signature(); |
773 |
|
} |
774 |
|
|
775 |
|
|
776 |
|
/** |
777 |
|
* CONDITION - is_signed |
778 |
|
* |
779 |
|
* Vérifie que l'instruction a été signé |
780 |
|
* |
781 |
|
* @return boolean |
782 |
|
*/ |
783 |
|
function is_signed() { |
784 |
|
// Si un parapheur a été configuré |
785 |
|
// et que le champ id_parapheur_signature n'est pas vide |
786 |
|
// et que le statut est égal à "finished" |
787 |
|
// alors le document de l'instruciton à été signé |
788 |
|
if ($this->has_connector_electronicsignature() === true |
789 |
|
&& empty($this->getVal("id_parapheur_signature")) === false |
790 |
|
&& $this->getVal("statut_signature") == "finished") { |
791 |
|
// |
792 |
|
return true; |
793 |
|
} |
794 |
|
|
795 |
|
return false; |
796 |
|
} |
797 |
|
|
798 |
|
/** |
799 |
|
* CONDITION - is_sent_for_signature_or_has_been_signed |
800 |
|
* |
801 |
|
* Vérifie que l'instruction a été envoyé à signature ou a été signé |
802 |
|
* |
803 |
|
* @return boolean |
804 |
|
*/ |
805 |
|
function is_sent_for_signature_or_has_been_signed() { |
806 |
|
if ($this->is_sent_for_signature() || $this->is_signed()) { |
807 |
|
// |
808 |
|
return true; |
809 |
|
} |
810 |
|
|
811 |
|
return false; |
812 |
|
} |
813 |
|
|
814 |
|
|
815 |
|
function is_sent_to_cl() { |
816 |
|
// Si l'instruction a une édition |
817 |
|
// et que l'événement est paramétré pour envoyer le contrôle de légalité |
818 |
|
// par Plat'AU |
819 |
|
// et que la date de retour signature est renseignée |
820 |
|
// et que la date d'envoi au contrôle légalité n'est pas renseignée |
821 |
|
// et qu'il n'existe pas de task envoi_CL en cours (!= done ou canceled) |
822 |
|
if ($this->has_an_edition() === true) { |
823 |
|
$inst_evenement = $this->get_inst_evenement($this->getVal('evenement')); |
824 |
|
if ($inst_evenement->getVal('envoi_cl_platau') === 't' |
825 |
|
|| $this->getVal('envoye_cl_platau') === 't') { |
826 |
|
// |
827 |
|
return true; |
828 |
|
} |
829 |
|
} |
830 |
|
// |
831 |
|
return false; |
832 |
|
} |
833 |
|
|
834 |
|
/** |
835 |
|
* CONDITION - is_portail_notification |
836 |
|
* |
837 |
|
* Vérifie si la notification est une notification de catégorie portail |
838 |
|
* |
839 |
|
* @return boolean |
840 |
|
*/ |
841 |
|
function is_portail_notification_sans_annexe() { |
842 |
|
$collectiviteDi = $this->get_dossier_instruction_om_collectivite(); |
843 |
|
$ev = $this->get_inst_evenement($this->getVal('evenement')); |
844 |
|
if (($this->f->get_param_option_notification($collectiviteDi) === null || |
845 |
|
$this->f->get_param_option_notification($collectiviteDi) === 'portal') |
846 |
|
&& $ev->getVal('notification') != 'notification_manuelle_annexe' |
847 |
|
&& $ev->getVal('notification') != 'notification_manuelle_annexe_signature_requise' |
848 |
|
) { |
849 |
|
return true; |
850 |
|
} |
851 |
|
return false; |
852 |
|
} |
853 |
|
|
854 |
|
/** |
855 |
|
* CONDITION - is_not_portail_notification |
856 |
|
* |
857 |
|
* Vérifie si la notification n'est pas une notification de catégorie portail |
858 |
|
* |
859 |
|
* @return boolean |
860 |
|
*/ |
861 |
|
function is_not_portail_notification_sans_annexe() { |
862 |
|
return (! $this->is_portail_notification_sans_annexe()); |
863 |
|
} |
864 |
|
|
865 |
|
/** |
866 |
|
* CONDITION - can_be_signed |
867 |
|
* |
868 |
|
* Vérifie que le document de l'instruction peut être envoyé au parapheur pour signature |
869 |
|
* |
870 |
|
* @return boolean |
871 |
|
*/ |
872 |
|
function can_be_signed() { |
873 |
|
// Instanciation de l'objet signataire_arrete |
874 |
|
$inst_signataire_arrete = $this->f->get_inst__om_dbform(array( |
875 |
|
"obj" => "signataire_arrete", |
876 |
|
"idx" => $this->getVal("signataire_arrete"), |
877 |
|
)); |
878 |
|
// Si un parapheur a été configuré, que le document est finalisé, que le signataire |
879 |
|
// possède une adresse email, on vérifie le champ id_parapheur_signature |
880 |
|
// S'il est vide l'évènement peut être envoyé en signature |
881 |
|
// S'il ne l'est pas, alors on vérifie le champ statut_signature |
882 |
|
// Si la valeur de ce champ est égal à "canceled" ou "expired" |
883 |
|
// alors l'évènement peut être envoyé en signature |
884 |
|
if ($this->has_connector_electronicsignature() === true |
885 |
|
&& $this->getVal("om_final_instruction") == 't' |
886 |
|
&& empty($inst_signataire_arrete->getVal('email')) === false) { |
887 |
|
// |
888 |
|
if (empty($this->getVal("id_parapheur_signature")) === true |
889 |
|
|| $this->getVal("statut_signature") == "canceled" |
890 |
|
|| $this->getVal("statut_signature") == "expired") { |
891 |
|
// |
892 |
|
return true; |
893 |
|
} |
894 |
|
} |
895 |
|
|
896 |
|
$this->addToLog(__METHOD__."() has_connector_electronicsignature: ".var_export($this->has_connector_electronicsignature(), true), EXTRA_VERBOSE_MODE); |
897 |
|
$this->addToLog(__METHOD__."() om_final_instruction: ".var_export($this->getVal("om_final_instruction"), true), EXTRA_VERBOSE_MODE); |
898 |
|
$this->addToLog(__METHOD__."() email: ".var_export($inst_signataire_arrete->getVal('email'), true), EXTRA_VERBOSE_MODE); |
899 |
|
$this->addToLog(__METHOD__."() id_parapheur_signature: ".var_export($this->getVal("id_parapheur_signature"), true), EXTRA_VERBOSE_MODE); |
900 |
|
$this->addToLog(__METHOD__."() statut_signature: ".var_export($this->getVal("statut_signature"), true), EXTRA_VERBOSE_MODE); |
901 |
|
|
902 |
|
return false; |
903 |
|
} |
904 |
|
|
905 |
|
/** |
906 |
|
* CONDITION - has_connector_electronicsignature |
907 |
|
* |
908 |
|
* Vérifie qu'un parapheur est paramétré |
909 |
|
* |
910 |
|
* @return boolean |
911 |
|
*/ |
912 |
|
function has_connector_electronicsignature() { |
913 |
|
$inst_es = $this->get_electronicsignature_instance(false); |
914 |
|
if ($inst_es === false) { |
915 |
|
return false; |
916 |
|
} |
917 |
|
return true; |
918 |
|
} |
919 |
|
|
920 |
|
/** |
921 |
|
* CONDITION - can_display_parapheur |
922 |
|
* |
923 |
|
* Vérifie que le fieldset "Suivi Parapheur" soit affichable |
924 |
|
* |
925 |
|
* @return boolean |
926 |
|
*/ |
927 |
|
function can_display_parapheur() { |
928 |
|
$evenement_id = $this->getVal("evenement"); |
929 |
|
$inst_evenement = $this->get_inst_evenement($evenement_id); |
930 |
|
if ($this->has_connector_electronicsignature() === true |
931 |
|
&& $inst_evenement->getVal('lettretype') !== '' |
932 |
|
&& $inst_evenement->getVal('lettretype') !== null |
933 |
|
&& (empty($this->getVal("id_parapheur_signature")) === false |
934 |
|
|| empty($this->getVal("historique_signature")) === false)) { |
935 |
|
// |
936 |
|
return true; |
937 |
|
} |
938 |
|
|
939 |
|
return false; |
940 |
|
} |
941 |
|
|
942 |
|
/** |
943 |
|
* CONDITION - can_display_notification |
944 |
|
* |
945 |
|
* Vérifie que le champs "Suivi notification" est affichable |
946 |
|
* |
947 |
|
* @return boolean |
948 |
|
*/ |
949 |
|
function can_display_notification_demandeur() { |
950 |
|
// Le suivi des notification est affiché si l'événement est notifiable |
951 |
|
// et si des notifications ont été envoyées |
952 |
|
$evenement_id = $this->getVal("evenement"); |
953 |
|
$inst_evenement = $this->get_inst_evenement($evenement_id); |
954 |
|
if ($inst_evenement->getVal('notification') != null && |
955 |
|
$inst_evenement->getVal('notification') != '') { |
956 |
|
// Des notifications ont été envoyé si il existe au moins une notification |
957 |
|
// liées à l'instruction |
958 |
|
$idsNotifs = $this->get_instruction_notification( |
959 |
|
$this->getVal($this->clePrimaire), |
960 |
|
array( |
961 |
|
'notification_recepisse', |
962 |
|
'notification_instruction', |
963 |
|
'notification_decision', |
964 |
|
) |
965 |
|
); |
966 |
|
if (isset($idsNotifs) && $idsNotifs !== array()) { |
967 |
|
return true; |
968 |
|
} |
969 |
|
} |
970 |
|
return false; |
971 |
|
} |
972 |
|
|
973 |
|
/** |
974 |
|
* CONDITION - can_display_notification |
975 |
|
* |
976 |
|
* Vérifie que le champs "suivi_notification_service" est affichable |
977 |
|
* |
978 |
|
* @return boolean |
979 |
|
*/ |
980 |
|
function can_display_notification_service() { |
981 |
|
// Le suivi des notification est affiché si l'événement est notifiable |
982 |
|
// et si des notifications ont été envoyées |
983 |
|
$evenement_id = $this->getVal("evenement"); |
984 |
|
$inst_evenement = $this->get_inst_evenement($evenement_id); |
985 |
|
if ($this->get_boolean_from_pgsql_value($inst_evenement->getVal('notification_service')) == true) { |
986 |
|
// Des notifications ont été envoyé si il existe au moins une notification |
987 |
|
// de type notification_service_consulte liées à l'instruction |
988 |
|
$idsNotifs = $this->get_instruction_notification( |
989 |
|
$this->getVal($this->clePrimaire), |
990 |
|
'notification_service_consulte' |
991 |
|
); |
992 |
|
if (isset($idsNotifs) && $idsNotifs !== array()) { |
993 |
|
return true; |
994 |
|
} |
995 |
|
} |
996 |
|
return false; |
997 |
|
} |
998 |
|
|
999 |
|
|
1000 |
|
/** |
1001 |
|
* CONDITION - can_display_notification_tiers |
1002 |
|
* |
1003 |
|
* Vérifie que le champs "suivi_notification_tiers" est affichable |
1004 |
|
* |
1005 |
|
* @return boolean |
1006 |
|
*/ |
1007 |
|
function can_display_notification_tiers() { |
1008 |
|
// Le suivi des notification est affiché si l'événement est notifiable |
1009 |
|
// et si des notifications ont été envoyées |
1010 |
|
$evenement_id = $this->getVal("evenement"); |
1011 |
|
$inst_evenement = $this->get_inst_evenement($evenement_id); |
1012 |
|
if ($this->get_boolean_from_pgsql_value($inst_evenement->getVal('notification_tiers')) == true) { |
1013 |
|
// Des notifications ont été envoyé si il existe au moins une notification |
1014 |
|
// de type notification_tiers_consulte liées à l'instruction |
1015 |
|
$idsNotifs = $this->get_instruction_notification( |
1016 |
|
$this->getVal($this->clePrimaire), |
1017 |
|
'notification_tiers_consulte' |
1018 |
|
); |
1019 |
|
if (isset($idsNotifs) && $idsNotifs !== array()) { |
1020 |
|
return true; |
1021 |
|
} |
1022 |
|
} |
1023 |
|
return false; |
1024 |
|
} |
1025 |
|
|
1026 |
|
/** |
1027 |
|
* TREATMENT - disable_edition_integrale. |
1028 |
|
* |
1029 |
|
* Cette methode permet de passer la consultation en "lu" |
1030 |
|
* |
1031 |
|
* @return boolean true si maj effectué false sinon |
1032 |
|
*/ |
1033 |
|
function disable_edition_integrale() { |
1034 |
|
// Cette méthode permet d'exécuter une routine en début des méthodes |
1035 |
|
// dites de TREATMENT. |
1036 |
|
$this->begin_treatment(__METHOD__); |
1037 |
|
$this->correct = true; |
1038 |
|
$valF = array( |
1039 |
|
"flag_edition_integrale" => false, |
1040 |
|
"titre_om_htmletat" => null, |
1041 |
|
"corps_om_htmletatex" => null, |
1042 |
|
); |
1043 |
|
$res = $this->f->db->autoExecute( |
1044 |
|
DB_PREFIXE.$this->table, |
1045 |
|
$valF, |
1046 |
|
DB_AUTOQUERY_UPDATE, |
1047 |
|
$this->clePrimaire."=".$this->getVal($this->clePrimaire) |
1048 |
|
); |
1049 |
|
if ($this->f->isDatabaseError($res, true)) { |
1050 |
|
// Appel de la methode de recuperation des erreurs |
1051 |
|
$this->erreur_db($res->getDebugInfo(), $res->getMessage(), ''); |
1052 |
|
$this->correct = false; |
1053 |
|
// Termine le traitement |
1054 |
|
return $this->end_treatment(__METHOD__, false); |
1055 |
|
} else { |
1056 |
|
$this->addToMessage(_("Rédaction par compléments activé.")); |
1057 |
|
return $this->end_treatment(__METHOD__, true); |
1058 |
|
} |
1059 |
|
|
1060 |
|
// Termine le traitement |
1061 |
|
return $this->end_treatment(__METHOD__, false); |
1062 |
|
} |
1063 |
|
|
1064 |
|
/** |
1065 |
|
* TREATMENT - enable_edition_integrale. |
1066 |
|
* |
1067 |
|
* Cette methode permet de passer la consultation en "lu" |
1068 |
|
* |
1069 |
|
* @return boolean true si maj effectué false sinon |
1070 |
|
*/ |
1071 |
|
function enable_edition_integrale() { |
1072 |
|
// Cette méthode permet d'exécuter une routine en début des méthodes |
1073 |
|
// dites de TREATMENT. |
1074 |
|
$this->begin_treatment(__METHOD__); |
1075 |
|
$this->correct = true; |
1076 |
|
|
1077 |
|
// Récupère la collectivite du dossier d'instruction |
1078 |
|
$dossier_instruction_om_collectivite = $this->get_dossier_instruction_om_collectivite(); |
1079 |
|
$collectivite = $this->f->getCollectivite($dossier_instruction_om_collectivite); |
1080 |
|
// |
1081 |
|
$params = array( |
1082 |
|
"specific" => array( |
1083 |
|
"corps" => array( |
1084 |
|
"mode" => "get", |
1085 |
|
) |
1086 |
|
), |
1087 |
|
); |
1088 |
|
$result = $this->compute_pdf_output('lettretype', $this->getVal('lettretype'), $collectivite, null, $params); |
1089 |
|
$corps = $result['pdf_output']; |
1090 |
|
// |
1091 |
|
$params = array( |
1092 |
|
"specific" => array( |
1093 |
|
"titre" => array( |
1094 |
|
"mode" => "get", |
1095 |
|
) |
1096 |
|
), |
1097 |
|
); |
1098 |
|
$result = $this->compute_pdf_output('lettretype', $this->getVal('lettretype'), $collectivite, null, $params); |
1099 |
|
$titre = $result['pdf_output']; |
1100 |
|
// |
1101 |
|
$valF = array( |
1102 |
|
"flag_edition_integrale" => true, |
1103 |
|
"titre_om_htmletat" => $titre, |
1104 |
|
"corps_om_htmletatex" => $corps, |
1105 |
|
); |
1106 |
|
$res = $this->f->db->autoExecute( |
1107 |
|
DB_PREFIXE.$this->table, |
1108 |
|
$valF, |
1109 |
|
DB_AUTOQUERY_UPDATE, |
1110 |
|
$this->clePrimaire."=".$this->getVal($this->clePrimaire) |
1111 |
|
); |
1112 |
|
if ($this->f->isDatabaseError($res, true)) { |
1113 |
|
// Appel de la methode de recuperation des erreurs |
1114 |
|
$this->erreur_db($res->getDebugInfo(), $res->getMessage(), ''); |
1115 |
|
$this->correct = false; |
1116 |
|
// Termine le traitement |
1117 |
|
return $this->end_treatment(__METHOD__, false); |
1118 |
|
} else { |
1119 |
|
$this->addToMessage(_("Rédaction libre activé.")); |
1120 |
|
return $this->end_treatment(__METHOD__, true); |
1121 |
|
} |
1122 |
|
|
1123 |
|
// Termine le traitement |
1124 |
|
return $this->end_treatment(__METHOD__, false); |
1125 |
|
} |
1126 |
|
|
1127 |
/** |
/** |
1128 |
* 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 |
1136 |
$sql = "select dossier_autorisation from ".DB_PREFIXE."dossier "; |
$sql = "select dossier_autorisation from ".DB_PREFIXE."dossier "; |
1137 |
$sql .= " where dossier='".$id."'"; |
$sql .= " where dossier='".$id."'"; |
1138 |
// |
// |
1139 |
$dossier_autorisation = $this->db->getOne($sql); |
$dossier_autorisation = $this->f->db->getOne($sql); |
1140 |
$this->addToLog("getNumDemandeAutorFromDossier(): db->getone(\"".$sql."\")", VERBOSE_MODE); |
$this->addToLog("getNumDemandeAutorFromDossier(): db->getone(\"".$sql."\")", VERBOSE_MODE); |
1141 |
database::isError($dossier_autorisation); |
database::isError($dossier_autorisation); |
1142 |
// |
// |
1146 |
// }}} |
// }}} |
1147 |
|
|
1148 |
function setType(&$form, $maj) { |
function setType(&$form, $maj) { |
1149 |
// |
// Récupération du mode de l'action |
1150 |
parent::setType($form, $maj); |
$crud = $this->get_action_crud($maj); |
1151 |
// On cache tous les champs |
// Récupère la collectivité du dossier d'instruction |
1152 |
// 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'); |
|
1153 |
|
|
1154 |
// |
// Cache tous les champs |
1155 |
$form->setType('archive_date_cloture_instruction','hidden'); |
foreach ($this->champs as $value) { |
1156 |
$form->setType('archive_date_premiere_visite','hidden'); |
$form->setType($value, 'hidden'); |
1157 |
$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'); |
|
1158 |
|
|
1159 |
// |
// Les champs historique_signature et statut_signature ne sont pas saisissable dans tous les cas |
1160 |
$form->setType('duree_validite','hidden'); |
if ($this->can_display_parapheur() === true && $maj == 3) { |
1161 |
$form->setType('duree_validite_parametrage','hidden'); |
$form->setType('statut_signature', 'selectstatic'); |
1162 |
|
$form->setType('historique_signature', 'jsontotab'); |
1163 |
|
if ($this->getVal('commentaire_signature') == null) { |
1164 |
|
$form->setType('commentaire_signature', 'hidden'); |
1165 |
|
} else { |
1166 |
|
$form->setType('commentaire_signature', 'hiddenstatic'); |
1167 |
|
} |
1168 |
|
} |
1169 |
|
|
1170 |
// |
// Le champ de suivi des notifications des demandeurs n'est pas affichable dans tous les cas |
1171 |
$form->setType('created_by_commune','hidden'); |
if ($this->can_display_notification_demandeur() === true && $maj == 3) { |
1172 |
// |
$form->setType('suivi_notification', 'jsontotab'); |
|
// gestion du champ "finalisé par" |
|
|
if ($this->getVal("om_final_instruction") == 't') { |
|
|
$form->setType('om_final_instruction_utilisateur', 'static'); |
|
|
} else { |
|
|
$form->setType('om_final_instruction_utilisateur', 'hidden'); |
|
1173 |
} |
} |
1174 |
// |
// Le champ de suivi des notifications des services n'est pas affichable dans tous les cas |
1175 |
if ($maj < 2 || $maj == 125) { //ajouter, modifier et suivi des dates |
if ($this->can_display_notification_service() === true && $maj == 3) { |
1176 |
$form->setType('destinataire', 'hidden'); |
$form->setType('suivi_notification_service', 'jsontotab'); |
1177 |
$form->setType('lettretype', 'hiddenstatic'); |
} |
1178 |
$form->setType('complement_om_html', 'html'); |
// Le champ de suivi des notifications des tiers n'est pas affichable dans tous les cas |
1179 |
$form->setType('complement2_om_html', 'html'); |
if ($this->can_display_notification_tiers() === true && $maj == 3) { |
1180 |
$form->setType('complement3_om_html', 'html'); |
$form->setType('suivi_notification_tiers', 'jsontotab'); |
1181 |
$form->setType('complement4_om_html', 'html'); |
} |
1182 |
$form->setType('bible_auto', 'httpclick'); |
|
1183 |
$form->setType('bible', 'httpclick'); |
// MODE AJOUTER |
1184 |
$form->setType('bible2', 'httpclick'); |
if ($this->getParameter('maj') == 0) { |
1185 |
$form->setType('bible3', 'httpclick'); |
$form->setType('commentaire', 'textareahidden'); |
1186 |
$form->setType('bible4', 'httpclick'); |
// Si l'option est active passage du champ date en lecture seule |
1187 |
$form->setType('dossier', 'hidden'); |
if ($this->f->is_option_date_evenement_instruction_lecture_seule($collectivite_di) === true) { |
1188 |
$form->setType('libelle', 'hiddenstatic'); |
$form->setType("date_evenement", "hiddenstaticdate"); |
1189 |
$form->setType('signataire_arrete','select'); |
} else { |
1190 |
$form->setType('date_envoi_signature','datedisabled'); |
$form->setType("date_evenement", "date"); |
1191 |
$form->setType('date_retour_signature','datedisabled'); |
} |
1192 |
$form->setType('date_envoi_rar','datedisabled'); |
if ($this->is_in_context_of_foreign_key("evenement", $this->getParameter("retourformulaire"))) { |
1193 |
$form->setType('date_retour_rar','datedisabled'); |
$form->setType("evenement", "selecthiddenstatic"); |
1194 |
$form->setType('date_envoi_controle_legalite','datedisabled'); |
} else { |
1195 |
$form->setType('date_retour_controle_legalite','datedisabled'); |
$form->setType("evenement", "select"); |
1196 |
$form->setType('date_finalisation_courrier','datedisabled'); |
} |
1197 |
|
if ($this->is_in_context_of_foreign_key("signataire_arrete", $this->getParameter("retourformulaire"))) { |
1198 |
if($maj==0){ // ajouter |
$form->setType("signataire_arrete", "selecthiddenstatic"); |
1199 |
$form->setType('instruction', 'hidden'); |
} else { |
1200 |
$form->setType('lettretype', 'hidden'); |
$form->setType("signataire_arrete", "select"); |
1201 |
$form->setType('evenement', 'select'); |
} |
1202 |
$form->setType('date_evenement', 'date2'); |
if ($this->is_option_redaction_libre_enabled() === true) { |
1203 |
}else{ // modifier et suivi des dates |
$form->setType("flag_edition_integrale", "select"); |
1204 |
$form->setType('instruction', 'hiddenstatic'); |
} |
1205 |
$form->setType('evenement', 'selecthiddenstatic'); |
} |
1206 |
//$form->setType('date_evenement', 'hiddenstaticdate'); |
|
1207 |
$form->setType('date_evenement', 'date2'); |
// MODE MODIFIER |
1208 |
|
if ($this->getParameter('maj') == 1) { |
1209 |
|
// Si l'option est active passage du champ date en lecture seule |
1210 |
|
if ($this->f->is_option_date_evenement_instruction_lecture_seule($collectivite_di) === true) { |
1211 |
|
$form->setType("date_evenement", "hiddenstaticdate"); |
1212 |
|
} else { |
1213 |
|
$form->setType("date_evenement", "date"); |
1214 |
|
} |
1215 |
|
$form->setType("evenement", "selecthiddenstatic"); |
1216 |
|
if ($this->has_an_edition() === true) { |
1217 |
|
$form->setType('lettretype', 'hiddenstatic'); |
1218 |
|
if ($this->is_in_context_of_foreign_key("signataire_arrete", $this->getParameter("retourformulaire"))) { |
1219 |
|
$form->setType("signataire_arrete", "selecthiddenstatic"); |
1220 |
|
} else { |
1221 |
|
$form->setType("signataire_arrete", "select"); |
1222 |
|
} |
1223 |
|
if ($this->getVal("flag_edition_integrale") == "t") { |
1224 |
|
$form->setType("titre_om_htmletat", "htmlEtat"); |
1225 |
|
$form->setType("corps_om_htmletatex", "htmlEtatEx"); |
1226 |
|
} else { |
1227 |
|
$form->setType("complement_om_html", "html"); |
1228 |
|
$form->setType("complement2_om_html", "html"); |
1229 |
|
$form->setType("complement3_om_html", "html"); |
1230 |
|
$form->setType("complement4_om_html", "html"); |
1231 |
|
$form->setType('bible_auto', 'httpclick'); |
1232 |
|
$form->setType('bible', 'httpclick'); |
1233 |
|
$form->setType('bible2', 'httpclick'); |
1234 |
|
$form->setType('bible3', 'httpclick'); |
1235 |
|
$form->setType('bible4', 'httpclick'); |
1236 |
|
} |
1237 |
|
if ($this->f->is_option_preview_pdf_enabled($collectivite_di) === true) { |
1238 |
|
// |
1239 |
|
$form->setType('btn_refresh', 'httpclickbutton'); |
1240 |
|
$form->setType('btn_preview', 'httpclickbutton'); |
1241 |
|
$form->setType('btn_redaction', 'httpclickbutton'); |
1242 |
|
// /!\ le type du champs est utilisé dans un selecteur dans le jscript.js |
1243 |
|
// pour identifiant le champ de prévisualisation et régler sa taille à |
1244 |
|
// l'affichage du champ. En cas de modification, le selecteur doit également |
1245 |
|
// être mis à jour |
1246 |
|
$form->setType('live_preview', 'previsualiser_pdf'); |
1247 |
|
} |
1248 |
|
|
1249 |
// necessaire pour calcul de date en modification |
// necessaire pour calcul de date en modification |
1250 |
//$form->setType('delai', 'hiddenstatic'); |
//$form->setType('delai', 'hiddenstatic'); |
1251 |
// les administrateurs technique et fonctionnel peuvent |
// les administrateurs technique et fonctionnel peuvent |
1252 |
// modifier tous les champs de date |
// modifier tous les champs de date |
1253 |
// 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 |
1254 |
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") |
1255 |
|| $this->f->isAccredited(array('instruction', 'instruction_modification_dates'), "OR")) |
|| $this->f->isAccredited(array('instruction', 'instruction_modification_dates'), "OR")) |
1256 |
&& $this->getVal("date_finalisation_courrier") != '') { |
&& $this->getVal("date_finalisation_courrier") != '') { |
1257 |
|
// |
1258 |
$form->setType('date_envoi_signature', 'date'); |
$form->setType('date_envoi_signature', 'date'); |
1259 |
$form->setType('date_retour_signature', 'date'); |
$form->setType('date_retour_signature', 'date'); |
1260 |
|
if ($this->is_sent_for_signature() === true |
1261 |
|
&& $this->is_signed() === true) { |
1262 |
|
// |
1263 |
|
$form->setType("date_envoi_signature", "datereadonly"); |
1264 |
|
$form->setType("date_retour_signature", "datereadonly"); |
1265 |
|
} |
1266 |
$form->setType('date_envoi_rar', 'date'); |
$form->setType('date_envoi_rar', 'date'); |
1267 |
$form->setType('date_retour_rar', 'date'); |
$form->setType('date_retour_rar', 'date'); |
1268 |
$form->setType('date_envoi_controle_legalite', 'date'); |
$form->setType('date_envoi_controle_legalite', 'date'); |
1269 |
|
if ($this->is_sent_to_cl() === true) { |
1270 |
|
$form->setType("date_envoi_controle_legalite", "datereadonly"); |
1271 |
|
} |
1272 |
$form->setType('date_retour_controle_legalite', 'date'); |
$form->setType('date_retour_controle_legalite', 'date'); |
1273 |
$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('signataire_arrete','selecthiddenstatic'); |
|
|
$form->setType('om_final_instruction_utilisateur', 'hiddenstatic'); |
|
|
} |
|
1274 |
} |
} |
1275 |
} |
} |
|
} 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'); |
|
|
}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'); |
|
|
} |
|
|
|
|
|
//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"); |
|
1276 |
} |
} |
1277 |
|
|
1278 |
// Pour les actions finalize, unfinalize et notifier_commune |
// MODE CONSULTER + SUPPRIMER + SUIVI DES DATES 125 + NOTIFICATION MANUELLE |
1279 |
if($maj == 100 || $maj == 110 || $maj == 210) { |
if ($this->getParameter('maj') == 3 |
1280 |
// |
|| $this->getParameter('maj') == 2 |
1281 |
foreach ($this->champs as $value) { |
|| $this->getParameter('maj') == 125 |
1282 |
// Cache tous les champs |
|| $this->getParameter('maj') == 410) { |
1283 |
$form->setType($value, 'hidden'); |
// |
1284 |
|
$form->setType("date_evenement", "datestatic"); |
1285 |
|
$form->setType("evenement", "selecthiddenstatic"); |
1286 |
|
if ($this->has_an_edition() === true) { |
1287 |
|
$form->setType('lettretype', 'hiddenstatic'); |
1288 |
|
$form->setType("signataire_arrete", "selecthiddenstatic"); |
1289 |
|
if ($this->getVal("om_final_instruction") == 't') { |
1290 |
|
$form->setType('om_final_instruction_utilisateur', 'textareastatic'); |
1291 |
|
} else { |
1292 |
|
$form->setType('om_final_instruction_utilisateur', 'hidden'); |
1293 |
|
} |
1294 |
|
} |
1295 |
|
if ($this->evenement_has_a_commentaire($this->getVal('evenement')) === true ) { |
1296 |
|
$form->setType('commentaire', 'textareastatic'); |
1297 |
|
} |
1298 |
|
} |
1299 |
|
|
1300 |
|
// MODE CONSULTER + SUPPRIMER + NOTIFICATION MANUELLE |
1301 |
|
if ($this->getParameter('maj') == 3 |
1302 |
|
|| $this->getParameter('maj') == 2 |
1303 |
|
|| $this->getParameter('maj') == 410) { |
1304 |
|
// Si il n'y a pas de lettre type (edition) associé à l'événement |
1305 |
|
// les dates de suivi ne sont pas affichée |
1306 |
|
if ($this->has_an_edition() === true) { |
1307 |
|
$form->setType('date_envoi_signature', 'datestatic'); |
1308 |
|
$form->setType('date_retour_signature', 'datestatic'); |
1309 |
|
$form->setType('date_envoi_rar', 'datestatic'); |
1310 |
|
$form->setType('date_retour_rar', 'datestatic'); |
1311 |
|
$form->setType('date_envoi_controle_legalite', 'datestatic'); |
1312 |
|
$form->setType('date_retour_controle_legalite', 'datestatic'); |
1313 |
|
$form->setType('date_finalisation_courrier', 'datestatic'); |
1314 |
|
if ($this->getVal("flag_edition_integrale") == "t") { |
1315 |
|
$form->setType("titre_om_htmletat", "htmlstatic"); |
1316 |
|
$form->setType("corps_om_htmletatex", "htmlstatic"); |
1317 |
|
} else { |
1318 |
|
$form->setType("complement_om_html", "htmlstatic"); |
1319 |
|
$form->setType("complement2_om_html", "htmlstatic"); |
1320 |
|
$form->setType("complement3_om_html", "htmlstatic"); |
1321 |
|
$form->setType("complement4_om_html", "htmlstatic"); |
1322 |
|
} |
1323 |
|
} |
1324 |
|
} |
1325 |
|
|
1326 |
|
// MODE SUIVI DES DATES 125 |
1327 |
|
if ($this->getParameter('maj') == 125) { |
1328 |
|
$form->setType("date_evenement", "hiddenstaticdate"); |
1329 |
|
$form->setType('om_final_instruction_utilisateur', 'hiddenstatic'); |
1330 |
|
$form->setType('date_envoi_signature', 'date'); |
1331 |
|
$form->setType('date_retour_signature', 'date'); |
1332 |
|
if ($this->is_sent_for_signature() === true |
1333 |
|
|| $this->is_signed() === true) { |
1334 |
|
// |
1335 |
|
$form->setType("date_envoi_signature", "datereadonly"); |
1336 |
|
$form->setType("date_retour_signature", "datereadonly"); |
1337 |
|
} |
1338 |
|
$form->setType('date_envoi_rar', 'date'); |
1339 |
|
$form->setType('date_retour_rar', 'date'); |
1340 |
|
$form->setType('date_envoi_controle_legalite', 'date'); |
1341 |
|
if ($this->is_sent_to_cl() === true) { |
1342 |
|
$form->setType("date_envoi_controle_legalite", "datereadonly"); |
1343 |
|
} |
1344 |
|
$form->setType('date_retour_controle_legalite', 'date'); |
1345 |
|
$form->setType('date_finalisation_courrier', 'date'); |
1346 |
|
} |
1347 |
|
|
1348 |
|
if ($maj == 401) { |
1349 |
|
foreach ($this->champs as $champ) { |
1350 |
|
$form->setType($champ, 'hidden'); |
1351 |
|
} |
1352 |
|
$form->setType('preview_edition', 'previsualiser'); |
1353 |
|
} |
1354 |
|
} |
1355 |
|
|
1356 |
|
function setOnchange(&$form,$maj){ |
1357 |
|
parent::setOnchange($form,$maj); |
1358 |
|
|
1359 |
|
// MODE AJOUTER |
1360 |
|
if ($this->getParameter('maj') == 0) { |
1361 |
|
$form->setOnchange( |
1362 |
|
"evenement", |
1363 |
|
"manage_instruction_evenement_lettretype(this.value, '".addslashes($this->getParameter('idxformulaire'))."'); |
1364 |
|
manage_instruction_evenement_commentaire(this.value, '".addslashes($this->getParameter('idxformulaire'))."');" |
1365 |
|
); |
1366 |
|
} |
1367 |
|
} |
1368 |
|
|
1369 |
|
function evenement_has_an_edition($evenement_id) { |
1370 |
|
$evenement = $this->get_inst_evenement($evenement_id); |
1371 |
|
$lettretype = $evenement->getVal('lettretype'); |
1372 |
|
if ($lettretype !== '' && $lettretype !== null) { |
1373 |
|
return true; |
1374 |
|
} |
1375 |
|
return false; |
1376 |
|
} |
1377 |
|
|
1378 |
|
function view_evenement_has_an_edition_json() { |
1379 |
|
$json_return = array( |
1380 |
|
"lettretype" => $this->evenement_has_an_edition($this->f->get_submitted_get_value('evenement_id')), |
1381 |
|
"option_redaction_libre_enabled" => $this->is_option_redaction_libre_enabled(), |
1382 |
|
); |
1383 |
|
echo json_encode($json_return); |
1384 |
|
} |
1385 |
|
|
1386 |
|
function evenement_has_a_commentaire($evenement_id) { |
1387 |
|
$evenement = $this->get_inst_evenement($evenement_id); |
1388 |
|
return $this->get_boolean_from_pgsql_value($evenement->getVal('commentaire')); |
1389 |
|
} |
1390 |
|
|
1391 |
|
function view_evenement_has_a_commentaire_json() { |
1392 |
|
$json_return = array( |
1393 |
|
"commentaire" => $this->evenement_has_a_commentaire($this->f->get_submitted_get_value('evenement_id')) |
1394 |
|
); |
1395 |
|
echo json_encode($json_return); |
1396 |
|
} |
1397 |
|
|
1398 |
|
|
1399 |
|
/** |
1400 |
|
* CONDITION - can_be_sended_to_cl |
1401 |
|
* |
1402 |
|
* Vérifie que le contrôle de légalité est disponible |
1403 |
|
* |
1404 |
|
* @return boolean |
1405 |
|
*/ |
1406 |
|
function can_be_sended_to_cl() { |
1407 |
|
// Si l'instruction a une édition |
1408 |
|
// et que l'événement est paramétré pour envoyer le contrôle de légalité |
1409 |
|
// par Plat'AU |
1410 |
|
// et que la date de retour signature est renseignée |
1411 |
|
// et que la date d'envoi au contrôle légalité n'est pas renseignée |
1412 |
|
// et qu'il n'existe pas de task envoi_CL en cours (!= done ou canceled) |
1413 |
|
if ($this->has_an_edition() === true) { |
1414 |
|
$inst_di = $this->get_inst_dossier($this->getVal('dossier')); |
1415 |
|
$inst_evenement = $this->get_inst_evenement($this->getVal('evenement')); |
1416 |
|
if ($inst_evenement->getVal('envoi_cl_platau') === 't' |
1417 |
|
&& empty($this->getVal('date_retour_signature')) === false |
1418 |
|
&& empty($this->getVal('date_envoi_controle_legalite')) === true |
1419 |
|
&& $this->getVal('envoye_cl_platau') === 'f' |
1420 |
|
&& $this->f->is_type_dossier_platau($inst_di->getVal('dossier_autorisation')) === true |
1421 |
|
&& $inst_di->getVal('etat_transmission_platau') !== 'jamais_transmissible') { |
1422 |
|
// |
1423 |
|
return true; |
1424 |
} |
} |
1425 |
} |
} |
1426 |
|
// |
1427 |
|
return false; |
1428 |
|
} |
1429 |
|
|
1430 |
|
/** |
1431 |
|
* |
1432 |
|
* @return string |
1433 |
|
*/ |
1434 |
|
function get_var_sql_forminc__sql_signataire_arrete() { |
1435 |
|
return sprintf( |
1436 |
|
"SELECT |
1437 |
|
signataire_arrete.signataire_arrete, |
1438 |
|
CONCAT_WS( |
1439 |
|
' - ', |
1440 |
|
CONCAT_WS(' ', signataire_arrete.prenom, signataire_arrete.nom), |
1441 |
|
signataire_habilitation.libelle, |
1442 |
|
signataire_arrete.description |
1443 |
|
) |
1444 |
|
FROM |
1445 |
|
%1\$ssignataire_arrete |
1446 |
|
LEFT JOIN %1\$ssignataire_habilitation |
1447 |
|
ON signataire_arrete.signataire_habilitation = signataire_habilitation.signataire_habilitation |
1448 |
|
WHERE |
1449 |
|
((signataire_arrete.om_validite_debut IS NULL |
1450 |
|
AND (signataire_arrete.om_validite_fin IS NULL |
1451 |
|
OR signataire_arrete.om_validite_fin > CURRENT_DATE)) |
1452 |
|
OR (signataire_arrete.om_validite_debut <= CURRENT_DATE |
1453 |
|
AND (signataire_arrete.om_validite_fin IS NULL |
1454 |
|
OR signataire_arrete.om_validite_fin > CURRENT_DATE))) |
1455 |
|
ORDER BY |
1456 |
|
signataire_arrete.prenom, |
1457 |
|
signataire_arrete.nom", |
1458 |
|
DB_PREFIXE |
1459 |
|
); |
1460 |
|
} |
1461 |
|
|
1462 |
|
/** |
1463 |
|
* |
1464 |
|
* @return string |
1465 |
|
*/ |
1466 |
|
function get_var_sql_forminc__sql_signataire_arrete_by_id() { |
1467 |
|
return sprintf( |
1468 |
|
"SELECT |
1469 |
|
signataire_arrete.signataire_arrete, |
1470 |
|
CONCAT_WS( |
1471 |
|
' - ', |
1472 |
|
CONCAT_WS(' ', signataire_arrete.prenom, signataire_arrete.nom), |
1473 |
|
signataire_habilitation.libelle, |
1474 |
|
signataire_arrete.description |
1475 |
|
) |
1476 |
|
FROM |
1477 |
|
%1\$ssignataire_arrete |
1478 |
|
LEFT JOIN %1\$ssignataire_habilitation |
1479 |
|
ON signataire_arrete.signataire_habilitation = signataire_habilitation.signataire_habilitation |
1480 |
|
WHERE |
1481 |
|
signataire_arrete.signataire_arrete = <idx>", |
1482 |
|
DB_PREFIXE |
1483 |
|
); |
1484 |
|
} |
1485 |
|
|
1486 |
|
/** |
1487 |
|
* |
1488 |
|
* @return string |
1489 |
|
*/ |
1490 |
|
function get_var_sql_forminc__sql_signataire_arrete_by_di() { |
1491 |
|
return sprintf( |
1492 |
|
"SELECT |
1493 |
|
signataire_arrete.signataire_arrete, |
1494 |
|
CONCAT_WS( |
1495 |
|
' - ', |
1496 |
|
CONCAT_WS(' ', signataire_arrete.prenom, signataire_arrete.nom), |
1497 |
|
signataire_habilitation.libelle, |
1498 |
|
signataire_arrete.description |
1499 |
|
) |
1500 |
|
FROM |
1501 |
|
%1\$ssignataire_arrete |
1502 |
|
LEFT JOIN %1\$som_collectivite |
1503 |
|
ON signataire_arrete.om_collectivite = om_collectivite.om_collectivite |
1504 |
|
LEFT JOIN %1\$ssignataire_habilitation |
1505 |
|
ON signataire_arrete.signataire_habilitation = signataire_habilitation.signataire_habilitation |
1506 |
|
WHERE |
1507 |
|
((signataire_arrete.om_validite_debut IS NULL |
1508 |
|
AND (signataire_arrete.om_validite_fin IS NULL |
1509 |
|
OR signataire_arrete.om_validite_fin > CURRENT_DATE)) |
1510 |
|
OR (signataire_arrete.om_validite_debut <= CURRENT_DATE |
1511 |
|
AND (signataire_arrete.om_validite_fin IS NULL |
1512 |
|
OR signataire_arrete.om_validite_fin > CURRENT_DATE))) |
1513 |
|
AND (om_collectivite.niveau = '2' |
1514 |
|
OR signataire_arrete.om_collectivite = <collectivite_di>) |
1515 |
|
ORDER BY |
1516 |
|
signataire_arrete.prenom, signataire_arrete.nom", |
1517 |
|
DB_PREFIXE |
1518 |
|
); |
1519 |
} |
} |
1520 |
|
|
1521 |
function setSelect(&$form, $maj,&$db,$debug) { |
/** |
1522 |
|
* |
1523 |
|
* @return string |
1524 |
|
*/ |
1525 |
|
function get_var_sql_forminc__sql_signataire_arrete_defaut() { |
1526 |
|
return sprintf( |
1527 |
|
"SELECT |
1528 |
|
signataire_arrete.signataire_arrete, |
1529 |
|
CONCAT_WS( |
1530 |
|
' - ', |
1531 |
|
CONCAT_WS(' ', signataire_arrete.prenom, signataire_arrete.nom), |
1532 |
|
signataire_habilitation.libelle, |
1533 |
|
signataire_arrete.description |
1534 |
|
) |
1535 |
|
FROM |
1536 |
|
%1\$ssignataire_arrete |
1537 |
|
LEFT JOIN %1\$ssignataire_habilitation |
1538 |
|
ON signataire_arrete.signataire_habilitation = signataire_habilitation.signataire_habilitation |
1539 |
|
WHERE |
1540 |
|
((signataire_arrete.om_validite_debut IS NULL |
1541 |
|
AND (signataire_arrete.om_validite_fin IS NULL |
1542 |
|
OR signataire_arrete.om_validite_fin > CURRENT_DATE)) |
1543 |
|
OR (signataire_arrete.om_validite_debut <= CURRENT_DATE |
1544 |
|
AND (signataire_arrete.om_validite_fin IS NULL |
1545 |
|
OR signataire_arrete.om_validite_fin > CURRENT_DATE))) |
1546 |
|
AND signataire_arrete.defaut IS TRUE |
1547 |
|
ORDER BY |
1548 |
|
signataire_arrete.prenom, signataire_arrete.nom", |
1549 |
|
DB_PREFIXE |
1550 |
|
); |
1551 |
|
} |
1552 |
|
|
1553 |
|
/** |
1554 |
|
* |
1555 |
|
* @return string |
1556 |
|
*/ |
1557 |
|
function get_var_sql_forminc__sql_signataire_arrete_defaut_by_di() { |
1558 |
|
return sprintf( |
1559 |
|
"SELECT |
1560 |
|
signataire_arrete.signataire_arrete, |
1561 |
|
CONCAT_WS( |
1562 |
|
' - ', |
1563 |
|
CONCAT_WS(' ', signataire_arrete.prenom, signataire_arrete.nom), |
1564 |
|
signataire_habilitation.libelle, |
1565 |
|
signataire_arrete.description |
1566 |
|
) |
1567 |
|
FROM |
1568 |
|
%1\$ssignataire_arrete |
1569 |
|
LEFT JOIN %1\$ssignataire_habilitation |
1570 |
|
ON signataire_arrete.signataire_habilitation = signataire_habilitation.signataire_habilitation |
1571 |
|
LEFT JOIN %1\$som_collectivite |
1572 |
|
ON signataire_arrete.om_collectivite = om_collectivite.om_collectivite |
1573 |
|
WHERE |
1574 |
|
((signataire_arrete.om_validite_debut IS NULL |
1575 |
|
AND (signataire_arrete.om_validite_fin IS NULL |
1576 |
|
OR signataire_arrete.om_validite_fin > CURRENT_DATE)) |
1577 |
|
OR (signataire_arrete.om_validite_debut <= CURRENT_DATE |
1578 |
|
AND (signataire_arrete.om_validite_fin IS NULL |
1579 |
|
OR signataire_arrete.om_validite_fin > CURRENT_DATE))) |
1580 |
|
AND signataire_arrete.defaut IS TRUE |
1581 |
|
AND (om_collectivite.niveau = '2' |
1582 |
|
OR signataire_arrete.om_collectivite = <collectivite_di>) |
1583 |
|
ORDER BY |
1584 |
|
signataire_arrete.prenom, |
1585 |
|
signataire_arrete.nom", |
1586 |
|
DB_PREFIXE |
1587 |
|
); |
1588 |
|
} |
1589 |
|
|
1590 |
|
/** |
1591 |
|
* SETTER_FORM - setSelect. |
1592 |
|
* |
1593 |
|
* @return void |
1594 |
|
*/ |
1595 |
|
function setSelect(&$form, $maj, &$dnu1 = null, $dnu2 = null) { |
1596 |
|
//parent::setSelect($form, $maj); |
1597 |
/** |
/** |
1598 |
* 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 |
1599 |
* dossier est mauvaise pour les performances, car la requête qui |
* dossier est mauvaise pour les performances, car la requête qui |
1601 |
* 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 |
1602 |
* select |
* select |
1603 |
*/ |
*/ |
|
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"); |
|
|
|
|
1604 |
//// action |
//// action |
1605 |
//$this->init_select($form, $db, $maj, $debug, "action", |
//$this->init_select($form, $this->f->db, $maj, null, "action", |
1606 |
// $sql_action, $sql_action_by_id, false); |
// $sql_action, $sql_action_by_id, false); |
1607 |
|
|
1608 |
//// avis_decision |
//// avis_decision |
1609 |
//$this->init_select($form, $db, $maj, $debug, "avis_decision", |
//$this->init_select($form, $this->f->db, $maj, null, "avis_decision", |
1610 |
// $sql_avis_decision, $sql_avis_decision_by_id, false); |
// $sql_avis_decision, $sql_avis_decision_by_id, false); |
1611 |
|
|
1612 |
//// dossier |
//// dossier |
1613 |
//$this->init_select($form, $db, $maj, $debug, "dossier", |
//$this->init_select($form, $this->f->db, $maj, null, "dossier", |
1614 |
// $sql_dossier, $sql_dossier_by_id, false); |
// $sql_dossier, $sql_dossier_by_id, false); |
1615 |
|
|
1616 |
//// etat |
//// etat |
1617 |
//$this->init_select($form, $db, $maj, $debug, "etat", |
//$this->init_select($form, $this->f->db, $maj, null, "etat", |
1618 |
// $sql_etat, $sql_etat_by_id, false); |
// $sql_etat, $sql_etat_by_id, false); |
1619 |
|
|
1620 |
//// evenement |
//// evenement |
1621 |
//$this->init_select($form, $db, $maj, $debug, "evenement", |
//$this->init_select($form, $this->f->db, $maj, null, "evenement", |
1622 |
// $sql_evenement, $sql_evenement_by_id, false); |
// $sql_evenement, $sql_evenement_by_id, false); |
1623 |
|
|
1624 |
// signataire_arrete |
// signataire_arrete |
1634 |
|| $this->getParameter("retourformulaire") == "dossier_contentieux_mes_recours" |
|| $this->getParameter("retourformulaire") == "dossier_contentieux_mes_recours" |
1635 |
|| $this->getParameter("retourformulaire") == "dossier_contentieux_tous_recours") { |
|| $this->getParameter("retourformulaire") == "dossier_contentieux_tous_recours") { |
1636 |
// 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 |
1637 |
require_once "../obj/dossier_instruction.class.php"; |
$di = $this->f->get_inst__om_dbform(array( |
1638 |
$di = new dossier_instruction($this->getParameter('idxformulaire'), $db, $debug); |
"obj" => "dossier_instruction", |
1639 |
$sql_signataire_arrete_by_di = str_replace('<collectivite_di>', $di->getVal("om_collectivite"), $sql_signataire_arrete_by_di); |
"idx" => $this->getParameter('idxformulaire'), |
1640 |
$this->init_select($form, $db, $maj, $debug, "signataire_arrete", |
)); |
1641 |
$sql_signataire_arrete_by_di, $sql_signataire_arrete_by_id, true); |
$sql_signataire_arrete_by_di = str_replace( |
1642 |
|
'<collectivite_di>', |
1643 |
|
$di->getVal("om_collectivite"), |
1644 |
|
$this->get_var_sql_forminc__sql("signataire_arrete_by_di") |
1645 |
|
); |
1646 |
|
$this->init_select( |
1647 |
|
$form, |
1648 |
|
$this->f->db, |
1649 |
|
$maj, |
1650 |
|
null, |
1651 |
|
"signataire_arrete", |
1652 |
|
$sql_signataire_arrete_by_di, |
1653 |
|
$this->get_var_sql_forminc__sql("signataire_arrete_by_id"), |
1654 |
|
true |
1655 |
|
); |
1656 |
} else { |
} else { |
1657 |
$this->init_select($form, $db, $maj, $debug, "signataire_arrete", |
$this->init_select( |
1658 |
$sql_signataire_arrete, $sql_signataire_arrete_by_id, true); |
$form, |
1659 |
|
$this->f->db, |
1660 |
|
$maj, |
1661 |
|
null, |
1662 |
|
"signataire_arrete", |
1663 |
|
$this->get_var_sql_forminc__sql("signataire_arrete"), |
1664 |
|
$this->get_var_sql_forminc__sql("signataire_arrete_by_id"), |
1665 |
|
true |
1666 |
|
); |
1667 |
} |
} |
1668 |
|
|
1669 |
/** |
/** |
1688 |
INNER JOIN ".DB_PREFIXE."transition |
INNER JOIN ".DB_PREFIXE."transition |
1689 |
ON evenement.evenement = transition.evenement |
ON evenement.evenement = transition.evenement |
1690 |
AND dossier.etat=transition.etat |
AND dossier.etat=transition.etat |
1691 |
WHERE dossier.dossier='".$this->idxformulaire."' "; |
WHERE dossier.dossier='".$this->getParameter("idxformulaire")."' "; |
1692 |
|
|
1693 |
// Si changement de décision par instructeur commune |
// Si changement de décision par instructeur commune |
1694 |
if($this->f->isUserInstructeur() === true |
if($this->f->isUserInstructeur() === true |
1695 |
&& $this->getDivisionFromDossier($this->idxformulaire) != $_SESSION["division"] |
&& $this->getDivisionFromDossier($this->getParameter("idxformulaire")) != $_SESSION["division"] |
1696 |
&& $this->isInstrCanChangeDecision($this->idxformulaire) === true) { |
&& $this->isInstrCanChangeDecision($this->getParameter("idxformulaire")) === true) { |
1697 |
$sql .= "AND evenement.type IN ('arrete', 'changement_decision') "; |
$sql .= "AND evenement.type IN ('arrete', 'changement_decision') "; |
1698 |
} |
} |
1699 |
$sql .= "ORDER BY evenement.libelle, evenement.action"; |
$sql .= "ORDER BY evenement.libelle, evenement.action"; |
1700 |
$res = $db->query($sql); |
$res = $this->f->db->query($sql); |
1701 |
$this->addToLog("setSelect(): db->query(\"".$sql."\");", VERBOSE_MODE); |
$this->addToLog("setSelect(): db->query(\"".$sql."\");", VERBOSE_MODE); |
1702 |
if (database::isError($res)) { |
if (database::isError($res)) { |
1703 |
die($res->getMessage()); |
die($res->getMessage()); |
1712 |
$contenu[1][] = $row[1]; |
$contenu[1][] = $row[1]; |
1713 |
} |
} |
1714 |
$form->setSelect("evenement", $contenu); |
$form->setSelect("evenement", $contenu); |
1715 |
|
|
1716 |
} else { |
} else { |
1717 |
$sql = "SELECT |
$sql = "SELECT |
1718 |
evenement.libelle as lib |
evenement.libelle as lib |
1719 |
FROM ".DB_PREFIXE."evenement |
FROM ".DB_PREFIXE."evenement |
1720 |
WHERE evenement.evenement=".$this->getVal("evenement").""; |
WHERE evenement.evenement=".$this->getVal("evenement").""; |
1721 |
$res = $db->getone($sql); |
$res = $this->f->db->getone($sql); |
1722 |
$this->addToLog("setSelect(): db->getone(\"".$sql."\");", VERBOSE_MODE); |
$this->addToLog("setSelect(): db->getone(\"".$sql."\");", VERBOSE_MODE); |
1723 |
if (database::isError($res)) { |
if (database::isError($res)) { |
1724 |
die($res->getMessage()); |
die($res->getMessage()); |
1749 |
// lien bible4 |
// lien bible4 |
1750 |
$contenu = array(_("bible")); |
$contenu = array(_("bible")); |
1751 |
$form->setSelect("bible4",$contenu); |
$form->setSelect("bible4",$contenu); |
1752 |
|
|
1753 |
|
if ($maj == 1) { |
1754 |
|
$base64 = $this->init_pdf_temp(); |
1755 |
|
$form->setSelect('live_preview', array('base64'=>$base64)); |
1756 |
|
$form->setSelect("btn_refresh", array(_('Prévisualiser'))); |
1757 |
|
$form->setSelect("btn_preview", array(_('Prévisualiser >>'))); |
1758 |
|
$form->setSelect("btn_redaction", array(_('<< Rédiger'))); |
1759 |
|
} |
1760 |
|
|
1761 |
|
// Selection du type de rédaction à l'ajout |
1762 |
|
$content = array( |
1763 |
|
0 => array('f', 't', ), |
1764 |
|
1 => array(_('Rédaction par compléments'), _('Rédaction libre'), ), |
1765 |
|
); |
1766 |
|
$form->setSelect('flag_edition_integrale', $content); |
1767 |
|
|
1768 |
|
$contenu = array(); |
1769 |
|
foreach(array('waiting', 'in_progress', 'canceled', 'expired', 'finished') as $value) { |
1770 |
|
$contenu[0][] = $value; |
1771 |
|
$contenu[1][] = $this->get_trad_for_statut($value); |
1772 |
|
} |
1773 |
|
$form->setSelect('statut_signature', $contenu); |
1774 |
|
|
1775 |
|
|
1776 |
|
if ($maj == 401) { |
1777 |
|
$file = $this->f->storage->get($this->getVal('om_fichier_instruction')); |
1778 |
|
$form->setSelect('preview_edition', array( |
1779 |
|
'base64' => base64_encode($file['file_content']), |
1780 |
|
'mimetype' => $file['metadata']['mimetype'], |
1781 |
|
'label' => 'instruction_'.$this->getVal($this->clePrimaire), |
1782 |
|
'href' => sprintf( |
1783 |
|
'../app/index.php?module=form&snippet=file&obj=instruction&champ=om_fichier_instruction&id=%1$s', |
1784 |
|
$this->getVal($this->clePrimaire) |
1785 |
|
) |
1786 |
|
)); |
1787 |
|
} |
1788 |
} |
} |
1789 |
|
|
1790 |
function cleSecondaire($id, &$db, $val, $DEBUG) { |
function cleSecondaire($id, &$dnu1 = null, $val = array(), $dnu2 = null) { |
1791 |
// |
// |
1792 |
parent::cleSecondaire($id, $db, $val, $DEBUG); |
// Vérifie uniquementla cle secondaire : demande |
1793 |
|
$this->rechercheTable($this->f->db, "demande", "instruction_recepisse", $id); |
1794 |
|
|
1795 |
$id = $this->getVal($this->clePrimaire); |
$id = $this->getVal($this->clePrimaire); |
1796 |
|
|
1802 |
LEFT JOIN ".DB_PREFIXE."demande |
LEFT JOIN ".DB_PREFIXE."demande |
1803 |
ON demande.demande_type = demande_type.demande_type |
ON demande.demande_type = demande_type.demande_type |
1804 |
WHERE demande.instruction_recepisse = ".$id; |
WHERE demande.instruction_recepisse = ".$id; |
1805 |
$res = $this->db->getOne($sql); |
$res = $this->f->db->getOne($sql); |
1806 |
$this->addToLog("cleSecondaire(): db->getone(\"".$sql."\");", VERBOSE_MODE); |
$this->addToLog("cleSecondaire(): db->getone(\"".$sql."\");", VERBOSE_MODE); |
1807 |
if (database::isError($res)) { |
if (database::isError($res)) { |
1808 |
die($res->getMessage()); |
die($res->getMessage()); |
1818 |
$sql = "SELECT demande |
$sql = "SELECT demande |
1819 |
FROM ".DB_PREFIXE."demande |
FROM ".DB_PREFIXE."demande |
1820 |
WHERE instruction_recepisse = ".$id; |
WHERE instruction_recepisse = ".$id; |
1821 |
$res = $this->db->getOne($sql); |
$res = $this->f->db->getOne($sql); |
1822 |
$this->addToLog("cleSecondaire(): db->getone(\"".$sql."\");", VERBOSE_MODE); |
$this->addToLog("cleSecondaire(): db->getone(\"".$sql."\");", VERBOSE_MODE); |
1823 |
if (database::isError($res)) { |
if (database::isError($res)) { |
1824 |
die($res->getMessage()); |
die($res->getMessage()); |
1826 |
|
|
1827 |
//Si c'est un événement d'instruction lié à une demande |
//Si c'est un événement d'instruction lié à une demande |
1828 |
if ($res != null || $res != ""){ |
if ($res != null || $res != ""){ |
1829 |
|
$demande = $this->f->get_inst__om_dbform(array( |
1830 |
require_once "../obj/demande.class.php"; |
"obj" => "demande", |
1831 |
$demande = new demande($res, $this->db, DEBUG); |
"idx" => $res, |
1832 |
|
)); |
1833 |
|
|
1834 |
//On met à jour la demande en supprimant la liaison vers |
//On met à jour la demande en supprimant la liaison vers |
1835 |
//l'événement d'instruction |
//l'événement d'instruction |
1840 |
} |
} |
1841 |
$valF['date_demande']=$demande->dateDBToForm($valF['date_demande']); |
$valF['date_demande']=$demande->dateDBToForm($valF['date_demande']); |
1842 |
$valF['instruction_recepisse']=NULL; |
$valF['instruction_recepisse']=NULL; |
1843 |
$ret = $demande->modifier($valF, $this->db, DEBUG); |
$ret = $demande->modifier($valF); |
1844 |
} |
} |
1845 |
|
|
1846 |
/** |
/** |
1853 |
// concerne le dossier en cours |
// concerne le dossier en cours |
1854 |
$sql = "SELECT max(instruction) |
$sql = "SELECT max(instruction) |
1855 |
FROM ".DB_PREFIXE."instruction |
FROM ".DB_PREFIXE."instruction |
1856 |
WHERE dossier ='".$this->idxformulaire."'"; |
WHERE dossier ='".$this->getParameter("idxformulaire")."'"; |
1857 |
$dernierevenement = $db->getOne($sql); |
$dernierevenement = $this->f->db->getOne($sql); |
1858 |
$this->addToLog("setSelect(): db->getone(\"".$sql."\");", VERBOSE_MODE); |
$this->addToLog("setSelect(): db->getone(\"".$sql."\");", VERBOSE_MODE); |
1859 |
if (database::isError($dernierevenement)) { |
if (database::isError($dernierevenement)) { |
1860 |
die($dernierevenement->getMessage()); |
die($dernierevenement->getMessage()); |
1904 |
return true; |
return true; |
1905 |
} |
} |
1906 |
|
|
1907 |
/*Met des valeurs par défaut dans certains des sous-formulaire*/ |
/** |
1908 |
function setValsousformulaire(&$form,$maj,$validation,$idxformulaire,$retourformulaire,$typeformulaire){ |
* SETTER_FORM - setValsousformulaire (setVal). |
1909 |
|
* |
1910 |
|
* @return void |
1911 |
|
*/ |
1912 |
|
function setValsousformulaire(&$form, $maj, $validation, $idxformulaire, $retourformulaire, $typeformulaire, &$dnu1 = null, $dnu2 = null) { |
1913 |
|
// parent::setValsousformulaire($form, $maj, $validation, $idxformulaire, $retourformulaire, $typeformulaire); |
1914 |
|
// |
1915 |
|
$this->retourformulaire = $retourformulaire; |
1916 |
// |
// |
|
$this->retourformulaire=$retourformulaire; |
|
|
$this->idxformulaire=$idxformulaire; |
|
|
// Ajout |
|
1917 |
if ($maj == 0) { |
if ($maj == 0) { |
1918 |
$form->setVal("destinataire", $idxformulaire); |
$form->setVal("destinataire", $this->getParameter("idxformulaire")); |
1919 |
$form->setVal("dossier", $idxformulaire); |
$form->setVal("dossier", $this->getParameter("idxformulaire")); |
1920 |
} |
} |
1921 |
// |
// |
1922 |
$this->set_form_default_values($form, $maj, $validation); |
$this->set_form_default_values($form, $maj, $validation); |
1923 |
} |
} |
1924 |
|
|
1925 |
/** |
/** |
1926 |
* Permet de pré-remplir les valeurs des formulaires. |
* SETTER_FORM - set_form_default_values (setVal). |
1927 |
* |
* |
1928 |
* @param [object] $form formulaire |
* @return void |
|
* @param [integer] $maj mode |
|
|
* @param [integer] $validation validation |
|
1929 |
*/ |
*/ |
1930 |
function set_form_default_values(&$form, $maj, $validation) { |
function set_form_default_values(&$form, $maj, $validation) { |
1931 |
|
// |
|
// Ajout |
|
1932 |
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"); |
|
1933 |
// si contexte DI |
// si contexte DI |
1934 |
if ($this->getParameter("retourformulaire") == "dossier" |
if ($this->getParameter("retourformulaire") == "dossier" |
1935 |
|| $this->getParameter("retourformulaire") == "dossier_instruction" |
|| $this->getParameter("retourformulaire") == "dossier_instruction" |
1942 |
|| $this->getParameter("retourformulaire") == "dossier_contentieux_mes_recours" |
|| $this->getParameter("retourformulaire") == "dossier_contentieux_mes_recours" |
1943 |
|| $this->getParameter("retourformulaire") == "dossier_contentieux_tous_recours") { |
|| $this->getParameter("retourformulaire") == "dossier_contentieux_tous_recours") { |
1944 |
// 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 |
1945 |
require_once "../obj/dossier_instruction.class.php"; |
$di = $this->f->get_inst__om_dbform(array( |
1946 |
$di = new dossier_instruction($this->getParameter('idxformulaire'), $db, DEBUG); |
"obj" => "dossier_instruction", |
1947 |
$sql = str_replace('<collectivite_di>', $di->getVal("om_collectivite"), $sql_signataire_arrete_defaut_by_di); |
"idx" => $this->getParameter("idxformulaire"), |
1948 |
|
)); |
1949 |
|
$sql = str_replace( |
1950 |
|
"<collectivite_di>", |
1951 |
|
$di->getVal("om_collectivite"), |
1952 |
|
$this->get_var_sql_forminc__sql("signataire_arrete_defaut_by_di") |
1953 |
|
); |
1954 |
} else { |
} else { |
1955 |
$sql = $sql_signataire_arrete_defaut; |
$sql = $this->get_var_sql_forminc__sql("signataire_arrete_defaut"); |
1956 |
} |
} |
|
// Date du jour |
|
|
$form->setVal("date_evenement", date('Y-m-d')); |
|
|
|
|
|
// Exécution de la requête |
|
1957 |
$res = $this->f->db->query($sql); |
$res = $this->f->db->query($sql); |
1958 |
$this->f->addToLog("setVal(): db->query(\"".$sql."\");", VERBOSE_MODE); |
$this->f->addToLog(__METHOD__."(): db->query(\"".$sql."\")", VERBOSE_MODE); |
1959 |
if ( database::isError($res)){ |
$this->f->isDatabaseError($res); |
|
die(); |
|
|
} |
|
|
|
|
1960 |
$row = $res->fetchrow(DB_FETCHMODE_ASSOC); |
$row = $res->fetchrow(DB_FETCHMODE_ASSOC); |
1961 |
|
if (isset($row["signataire_arrete"]) |
1962 |
if (isset($row['signataire_arrete']) && is_numeric($row['signataire_arrete'])){ |
&& is_numeric($row["signataire_arrete"])) { |
1963 |
$form->setVal("signataire_arrete",$row['signataire_arrete']); |
// |
1964 |
|
$form->setVal("signataire_arrete", $row["signataire_arrete"]); |
1965 |
} |
} |
1966 |
|
// Date du jour |
1967 |
|
$form->setVal("date_evenement", date("Y-m-d")); |
1968 |
} |
} |
1969 |
|
// |
|
// Ajout et modification |
|
1970 |
if ($maj == 0 || $maj == 1 || $maj == 125) { |
if ($maj == 0 || $maj == 1 || $maj == 125) { |
1971 |
$form->setVal("bible_auto","bible_auto()"); |
$form->setVal("bible_auto", "bible_auto()"); |
1972 |
$form->setVal("bible","bible(1)"); |
$form->setVal("bible", "bible(1)"); |
1973 |
$form->setVal("bible2","bible(2)"); |
$form->setVal("bible2", "bible(2)"); |
1974 |
$form->setVal("bible3","bible(3)"); |
$form->setVal("bible3", "bible(3)"); |
1975 |
$form->setVal("bible4","bible(4)"); |
$form->setVal("bible4", "bible(4)"); |
1976 |
|
} |
1977 |
|
// |
1978 |
|
$collectivite_di = $this->get_dossier_instruction_om_collectivite(); |
1979 |
|
if ($maj == 1 |
1980 |
|
&& $this->f->is_option_preview_pdf_enabled($collectivite_di) === true |
1981 |
|
&& $this->has_an_edition() === true) { |
1982 |
|
// |
1983 |
|
$form->setVal("live_preview", $this->getVal($this->clePrimaire)); |
1984 |
|
$form->setVal("btn_refresh", "reload_pdf_viewer()"); |
1985 |
|
$form->setVal("btn_preview", "show_instr_preview()"); |
1986 |
|
$form->setVal("btn_redaction", "show_instr_redaction()"); |
1987 |
|
} |
1988 |
|
|
1989 |
|
if ($maj == 3 |
1990 |
|
&& $this->can_display_notification_demandeur() |
1991 |
|
) { |
1992 |
|
$typeNotification = array( |
1993 |
|
'notification_recepisse', |
1994 |
|
'notification_instruction', |
1995 |
|
'notification_decision', |
1996 |
|
); |
1997 |
|
$form->setVal("suivi_notification", $this->get_json_suivi_notification($typeNotification)); |
1998 |
|
} |
1999 |
|
if ($maj == 3 |
2000 |
|
&& $this->can_display_notification_service() |
2001 |
|
) { |
2002 |
|
$form->setVal("suivi_notification_service", $this->get_json_suivi_notification(array('notification_service_consulte'))); |
2003 |
|
} |
2004 |
|
if ($maj == 3 |
2005 |
|
&& $this->can_display_notification_tiers() |
2006 |
|
) { |
2007 |
|
$form->setVal("suivi_notification_tiers", $this->get_json_suivi_notification(array('notification_tiers_consulte'))); |
2008 |
} |
} |
2009 |
} |
} |
2010 |
|
|
|
|
|
2011 |
function setLayout(&$form, $maj){ |
function setLayout(&$form, $maj){ |
2012 |
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"); |
|
2013 |
|
|
2014 |
$form->setFieldset('evenement','D',_('Evenement')); |
$form->setFieldset('evenement','D',_('Evenement')); |
2015 |
$form->setFieldset('om_final_instruction_utilisateur','F',''); |
$form->setFieldset('om_final_instruction_utilisateur','F',''); |
2016 |
|
|
2017 |
$form->setBloc('om_final_instruction_utilisateur','F'); |
$form->setBloc('om_final_instruction_utilisateur','F'); |
2018 |
|
|
2019 |
$form->setBloc('date_finalisation_courrier','D',"","col_12"); |
$form->setBloc('date_finalisation_courrier','D',"",""); |
2020 |
|
|
2021 |
$form->setFieldset('date_finalisation_courrier','D',_('Dates')); |
$form->setFieldset('date_finalisation_courrier','D',_('Dates')); |
2022 |
$form->setBloc('date_finalisation_courrier','D',"","col_6"); |
$form->setBloc('date_finalisation_courrier','D',"","col_6"); |
2023 |
$form->setBloc('date_envoi_controle_legalite','F'); |
$form->setBloc('date_envoi_controle_legalite','F'); |
2024 |
|
|
2025 |
$form->setBloc('signataire_arrete','D',"","col_6"); |
$form->setBloc('date_retour_signature','D',"","col_6"); |
2026 |
$form->setBloc('date_retour_controle_legalite','F'); |
$form->setBloc('date_retour_controle_legalite','F'); |
2027 |
$form->setFieldset('date_retour_controle_legalite','F',''); |
$form->setFieldset('date_retour_controle_legalite','F',''); |
2028 |
|
|
2029 |
$form->setBloc('date_retour_controle_legalite','F'); |
$form->setBloc('date_retour_controle_legalite','F'); |
2030 |
|
|
2031 |
$form->setBloc('complement_om_html','D',"","col_12"); |
$form->setBloc('statut_signature','D'); |
2032 |
|
$form->setFieldset('statut_signature','D','Suivi Parapheur'); |
2033 |
|
$form->setBloc('commentaire_signature','F'); |
2034 |
|
$form->setBloc('historique_signature','D'); |
2035 |
|
$form->setFieldset('historique_signature', 'DF', __("Historique"), "collapsible, startClosed"); |
2036 |
|
$form->setBloc('historique_signature','F'); |
2037 |
|
$form->setFieldset('historique_signature','F'); |
2038 |
|
|
2039 |
|
$form->setFieldset('suivi_notification', 'D', __("Suivi notification"), "collapsible"); |
2040 |
|
$form->setFieldset('suivi_notification','F'); |
2041 |
|
$form->setFieldset('suivi_notification_service', 'D', __("Suivi notification service"), "collapsible"); |
2042 |
|
$form->setFieldset('suivi_notification_service','F'); |
2043 |
|
$form->setFieldset('suivi_notification_tiers', 'D', __("Suivi notification tiers"), "collapsible"); |
2044 |
|
$form->setFieldset('suivi_notification_tiers','F'); |
2045 |
|
|
2046 |
|
if ($maj == 1) { |
2047 |
|
// Récupère la collectivité du dossier d'instruction |
2048 |
|
$collectivite_di = $this->get_dossier_instruction_om_collectivite(); |
2049 |
|
|
2050 |
|
// |
2051 |
|
if ($this->f->is_option_preview_pdf_enabled($collectivite_di) === true |
2052 |
|
&& $this->has_an_edition() === true) { |
2053 |
|
// |
2054 |
|
$form->setBloc('complement_om_html','D',"","container_instr_edition"); |
2055 |
|
$form->setBloc('complement_om_html','D',"","hidelabel box_instr_edition redaction_instr_edition"); |
2056 |
|
$form->setBloc('complement_om_html','D',"","box_instr_edition_main"); |
2057 |
|
$form->setFieldset('complement_om_html','D',_('Complement')); |
2058 |
|
$form->setFieldset('bible','F',''); |
2059 |
|
$form->setFieldset('complement2_om_html','D',_('Complement 2')); |
2060 |
|
$form->setFieldset('bible2','F',''); |
2061 |
|
$form->setFieldset('complement3_om_html','D',_('Complement 3')); |
2062 |
|
$form->setFieldset('bible3','F',''); |
2063 |
|
$form->setFieldset('complement4_om_html','D',_('Complement 4')); |
2064 |
|
$form->setFieldset('bible4','F',''); |
2065 |
|
$form->setFieldset('titre_om_htmletat','DF',_('Titre'), 'startClosed'); |
2066 |
|
$form->setFieldset('corps_om_htmletatex','DF',_('Corps')); |
2067 |
|
$form->setBloc('corps_om_htmletatex','F'); |
2068 |
|
$form->setBloc('btn_preview','DF',"","box_instr_edition_btn"); |
2069 |
|
$form->setBloc('btn_preview','F'); |
2070 |
|
$form->setBloc('btn_redaction','D', '',"hidelabel box_instr_edition preview_instr_edition"); |
2071 |
|
$form->setBloc('btn_redaction','DF',"","box_instr_edition_btn"); |
2072 |
|
$form->setFieldset('btn_refresh','D',_('Prévisualisation'), "box_instr_edition_main"); |
2073 |
|
$form->setFieldset('live_preview','F'); |
2074 |
|
$form->setBloc('live_preview','F'); |
2075 |
|
$form->setBloc('live_preview','F'); |
2076 |
|
} else { |
2077 |
|
$form->setBloc('complement_om_html','D',"","hidelabel"); |
2078 |
|
$form->setFieldset('complement_om_html','D',_('Complement')); |
2079 |
|
$form->setFieldset('bible','F',''); |
2080 |
|
$form->setFieldset('complement2_om_html','D',_('Complement 2')); |
2081 |
|
$form->setFieldset('bible2','F',''); |
2082 |
|
$form->setFieldset('complement3_om_html','D',_('Complement 3')); |
2083 |
|
$form->setFieldset('bible3','F',''); |
2084 |
|
$form->setFieldset('complement4_om_html','D',_('Complement 4')); |
2085 |
|
$form->setFieldset('bible4','F',''); |
2086 |
|
$form->setFieldset('titre_om_htmletat','DF',_('Titre'), 'startClosed'); |
2087 |
|
$form->setFieldset('corps_om_htmletatex','DF',_('Corps')); |
2088 |
|
$form->setBloc('corps_om_htmletatex','F'); |
2089 |
|
} |
2090 |
|
} else { |
2091 |
|
$form->setBloc('complement_om_html','D',"","hidelabel"); |
2092 |
$form->setFieldset('complement_om_html','D',_('Complement')); |
$form->setFieldset('complement_om_html','D',_('Complement')); |
2093 |
$form->setFieldset('bible','F',''); |
$form->setFieldset('bible','F',''); |
|
$form->setBloc('bible','F'); |
|
|
|
|
|
$form->setBloc('complement2_om_html','D',"","col_12"); |
|
2094 |
$form->setFieldset('complement2_om_html','D',_('Complement 2')); |
$form->setFieldset('complement2_om_html','D',_('Complement 2')); |
2095 |
$form->setFieldset('bible2','F',''); |
$form->setFieldset('bible2','F',''); |
|
$form->setBloc('bible2','F'); |
|
|
|
|
|
$form->setBloc('complement3_om_html','D',"","col_12"); |
|
2096 |
$form->setFieldset('complement3_om_html','D',_('Complement 3')); |
$form->setFieldset('complement3_om_html','D',_('Complement 3')); |
2097 |
$form->setFieldset('bible3','F',''); |
$form->setFieldset('bible3','F',''); |
|
$form->setBloc('bible3','F'); |
|
|
|
|
|
$form->setBloc('complement4_om_html','D',"","col_12"); |
|
2098 |
$form->setFieldset('complement4_om_html','D',_('Complement 4')); |
$form->setFieldset('complement4_om_html','D',_('Complement 4')); |
2099 |
$form->setFieldset('bible4','F',''); |
$form->setFieldset('bible4','F',''); |
2100 |
$form->setBloc('bible4','F'); |
$form->setFieldset('titre_om_htmletat','DF',_('Titre'), 'startClosed'); |
2101 |
|
$form->setFieldset('corps_om_htmletatex','DF',_('Corps')); |
2102 |
|
$form->setBloc('corps_om_htmletatex','F'); |
2103 |
} |
} |
2104 |
} |
} |
2105 |
|
|
2112 |
$form->setLib('bible2', ""); |
$form->setLib('bible2', ""); |
2113 |
$form->setLib('bible3', ""); |
$form->setLib('bible3', ""); |
2114 |
$form->setLib('bible4', ""); |
$form->setLib('bible4', ""); |
2115 |
|
$form->setLib('btn_refresh', ""); |
2116 |
|
$form->setLib('btn_preview', ""); |
2117 |
|
$form->setLib('btn_redaction', ""); |
2118 |
|
$form->setLib('live_preview', ""); |
2119 |
$form->setLib('om_final_instruction_utilisateur', _("finalise par")); |
$form->setLib('om_final_instruction_utilisateur', _("finalise par")); |
2120 |
|
$form->setLib('date_envoi_rar', __("date_envoi_ar")); |
2121 |
|
$form->setLib('date_retour_rar', __("date_notification")); |
2122 |
|
$form->setLib('statut_signature', __("statut")); |
2123 |
|
$form->setLib('commentaire_signature', __("commentaire")); |
2124 |
|
$form->setLib('historique_signature', ''); |
2125 |
|
$form->setLib('suivi_notification', ''); |
2126 |
|
$form->setLib('suivi_notification_service', ''); |
2127 |
|
$form->setLib('suivi_notification_tiers', ''); |
2128 |
|
$form->setLib('preview_edition', ""); |
2129 |
|
|
2130 |
|
// Ajout d'une infobulle d'aide lorsque le formulaire est en mode |
2131 |
|
// ajout et que l'option de rédaction libre est activée sur la |
2132 |
|
// collectivité du dossier |
2133 |
|
if ($maj === '0' && $this->is_option_redaction_libre_enabled() === true) { |
2134 |
|
// |
2135 |
|
$help_text_template = '%s <span class="info-16" title="%s"></span>'; |
2136 |
|
$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."); |
2137 |
|
$form->setLib('flag_edition_integrale', sprintf($help_text_template, _("Type de rédaction"), $help_text)); |
2138 |
|
} |
2139 |
|
else { |
2140 |
|
$form->setLib('flag_edition_integrale', _("Type de rédaction")); |
2141 |
|
} |
2142 |
|
|
2143 |
|
// Ajout d'une infobulle d'aide lorsque le formulaire est en mode |
2144 |
|
// modification et que l'option de prévisualisation de l'édition est |
2145 |
|
// activée sur la collectivité du dossier |
2146 |
|
if ($maj === '1' |
2147 |
|
&& $this->f->is_option_preview_pdf_enabled($this->get_dossier_instruction_om_collectivite()) === true) { |
2148 |
|
// |
2149 |
|
$help_text_template = '%s <span class="info-16" title="%s"></span>'; |
2150 |
|
$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."); |
2151 |
|
$form->setLib('date_evenement', sprintf($help_text_template, _('date_evenement'), $help_text)); |
2152 |
|
$form->setLib('signataire_arrete', sprintf($help_text_template, _('signataire_arrete'), $help_text)); |
2153 |
|
} |
2154 |
} |
} |
2155 |
|
|
2156 |
function triggerajouter($id, &$db, $val, $DEBUG) { |
/** |
2157 |
|
* TRIGGER - triggerajouter. |
2158 |
|
* |
2159 |
|
* @return boolean |
2160 |
|
*/ |
2161 |
|
function triggerajouter($id, &$dnu1 = null, $val = array(), $dnu2 = null) { |
2162 |
|
$this->addToLog(__METHOD__."(): start", EXTRA_VERBOSE_MODE); |
2163 |
/** |
/** |
2164 |
* 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 |
2165 |
* et dossier pour les stocker dans l'instruction : |
* et dossier pour les stocker dans l'instruction : |
2172 |
* - delai_notification |
* - delai_notification |
2173 |
* - lettretype |
* - lettretype |
2174 |
* - autorite_competente |
* - autorite_competente |
2175 |
|
* - pec_metier |
2176 |
* - complement_om_html |
* - complement_om_html |
2177 |
* - complement2_om_html |
* - complement2_om_html |
2178 |
* - complement3_om_html |
* - complement3_om_html |
2197 |
// 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é |
2198 |
$sql = "SELECT * FROM ".DB_PREFIXE."evenement |
$sql = "SELECT * FROM ".DB_PREFIXE."evenement |
2199 |
WHERE evenement=".$this->valF['evenement']; |
WHERE evenement=".$this->valF['evenement']; |
2200 |
$res = $db->query($sql); |
$res = $this->f->db->query($sql); |
2201 |
$this->addToLog("triggerajouter(): db->query(\"".$sql."\");", VERBOSE_MODE); |
$this->addToLog(__METHOD__."(): db->query(\"".$sql."\");", VERBOSE_MODE); |
2202 |
if (database::isError($res)) { |
if (database::isError($res)) { |
2203 |
die($res->getMessage()); |
die($res->getMessage()); |
2204 |
} |
} |
2235 |
} |
} |
2236 |
// Récupération de la valeur de la lettre type |
// Récupération de la valeur de la lettre type |
2237 |
$this->valF['lettretype']=$row['lettretype']; |
$this->valF['lettretype']=$row['lettretype']; |
2238 |
|
// Récupération de la valeur de la prise en compte métier |
2239 |
|
// si la prise en compte métier est paramétrée dans l'événement |
2240 |
|
$this->valF['pec_metier'] = NULL; |
2241 |
|
if(isset($row['pec_metier']) === true and empty($row['pec_metier']) === false) { |
2242 |
|
$this->valF['pec_metier'] = $row['pec_metier']; |
2243 |
|
} |
2244 |
} |
} |
2245 |
// 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 |
2246 |
$sql = "SELECT * FROM ".DB_PREFIXE."dossier |
$sql = "SELECT * FROM ".DB_PREFIXE."dossier |
2247 |
WHERE dossier='".$this->valF['dossier']."'"; |
WHERE dossier='".$this->valF['dossier']."'"; |
2248 |
$res = $db->query($sql); |
$res = $this->f->db->query($sql); |
2249 |
$this->addToLog("triggerajouter(): db->query(\"".$sql."\");", VERBOSE_MODE); |
$this->addToLog(__METHOD__."(): db->query(\"".$sql."\");", VERBOSE_MODE); |
2250 |
if (database::isError($res)) { |
if (database::isError($res)) { |
2251 |
die($res->getMessage()); |
die($res->getMessage()); |
2252 |
} |
} |
2261 |
LEFT JOIN ".DB_PREFIXE."dossier |
LEFT JOIN ".DB_PREFIXE."dossier |
2262 |
ON dossier.dossier_autorisation = dossier_autorisation.dossier_autorisation |
ON dossier.dossier_autorisation = dossier_autorisation.dossier_autorisation |
2263 |
WHERE dossier.dossier='".$this->valF['dossier']."'"; |
WHERE dossier.dossier='".$this->valF['dossier']."'"; |
2264 |
$duree_validite_parametrage = $db->getOne($sql); |
$duree_validite_parametrage = $this->f->db->getOne($sql); |
2265 |
$this->addToLog("triggerajouter(): db->getOne(\"".$sql."\");", VERBOSE_MODE); |
$this->addToLog(__METHOD__."(): db->getOne(\"".$sql."\");", VERBOSE_MODE); |
2266 |
database::isError($duree_validite_parametrage); |
database::isError($duree_validite_parametrage); |
2267 |
if ($duree_validite_parametrage != '') { |
if ($duree_validite_parametrage != '') { |
2268 |
$this->valF['duree_validite_parametrage']= $duree_validite_parametrage; |
$this->valF['duree_validite_parametrage']= $duree_validite_parametrage; |
2461 |
$sql = "SELECT retour |
$sql = "SELECT retour |
2462 |
FROM ".DB_PREFIXE."evenement |
FROM ".DB_PREFIXE."evenement |
2463 |
WHERE evenement = ".$evenement; |
WHERE evenement = ".$evenement; |
2464 |
$retour = $this->db->getOne($sql); |
$retour = $this->f->db->getOne($sql); |
2465 |
$this->addToLog("verifier(): db->query(\"".$sql."\");", VERBOSE_MODE); |
$this->addToLog("verifier(): db->query(\"".$sql."\");", VERBOSE_MODE); |
2466 |
if (database::isError($retour)) { |
if (database::isError($retour)) { |
2467 |
die($retour->getMessage()); |
die($retour->getMessage()); |
2492 |
WHERE |
WHERE |
2493 |
evenement =".$evenement; |
evenement =".$evenement; |
2494 |
|
|
2495 |
$restriction = $this->db->getOne($sql); |
$restriction = $this->f->db->getOne($sql); |
2496 |
$this->addToLog("verifier(): db->query(\"".$sql."\");", VERBOSE_MODE); |
$this->addToLog("verifier(): db->query(\"".$sql."\");", VERBOSE_MODE); |
2497 |
if (database::isError($restriction)) { |
if (database::isError($restriction)) { |
2498 |
die($restriction->getMessage()); |
die($restriction->getMessage()); |
2578 |
"regle_date_retour_contradictoire", |
"regle_date_retour_contradictoire", |
2579 |
"regle_date_ait", |
"regle_date_ait", |
2580 |
"regle_date_transmission_parquet", |
"regle_date_transmission_parquet", |
2581 |
|
"regle_date_affichage", |
2582 |
); |
); |
2583 |
// Tableau des champs de type numérique |
// Tableau des champs de type numérique |
2584 |
$rule_type_numeric = array( |
$rule_type_numeric = array( |
2590 |
); |
); |
2591 |
// Tableau des champs de type booléen |
// Tableau des champs de type booléen |
2592 |
$rule_type_bool = array( |
$rule_type_bool = array( |
2593 |
|
"regle_a_qualifier", |
2594 |
|
"regle_incompletude", |
2595 |
|
"regle_incomplet_notifie", |
2596 |
|
"regle_evenement_suivant_tacite_incompletude", |
2597 |
); |
); |
2598 |
// Tableau des champs spécifiques |
// Tableau des champs spécifiques |
2599 |
$rule_type_specific = array( |
$rule_type_specific = array( |
2601 |
"regle_etat", |
"regle_etat", |
2602 |
"regle_accord_tacite", |
"regle_accord_tacite", |
2603 |
"regle_avis", |
"regle_avis", |
2604 |
|
"regle_pec_metier", |
2605 |
|
"regle_etat_pendant_incompletude", |
2606 |
); |
); |
2607 |
// Tableau des champs de données techniques |
// Tableau des champs de données techniques |
2608 |
$rule_type_technical_data = array( |
$rule_type_technical_data = array( |
2612 |
'regle_donnees_techniques4', |
'regle_donnees_techniques4', |
2613 |
'regle_donnees_techniques5', |
'regle_donnees_techniques5', |
2614 |
); |
); |
2615 |
|
// Tableau des champs simple |
2616 |
|
$rule_type_simple = array( |
2617 |
|
"regle_dossier_instruction_type", |
2618 |
|
); |
2619 |
|
|
2620 |
// Définit le type du champ |
// Définit le type du champ |
2621 |
if (in_array($rule_name, $rule_type_date) == true) { |
if (in_array($rule_name, $rule_type_date) == true) { |
2636 |
if (in_array($rule_name, $rule_type_technical_data) === true) { |
if (in_array($rule_name, $rule_type_technical_data) === true) { |
2637 |
$type = 'text'; |
$type = 'text'; |
2638 |
} |
} |
2639 |
|
if (in_array($rule_name, $rule_type_simple) === true) { |
2640 |
|
$type = 'simple'; |
2641 |
|
} |
2642 |
|
|
2643 |
// 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 |
2644 |
// Récupère directement la valeur de l'opérande |
// Récupère directement la valeur de l'opérande |
2645 |
if ($type === 'specific' || $type === 'bool') { |
if ($type === 'specific') { |
2646 |
// |
// |
2647 |
return $this->get_value_for_rule($rule); |
return $this->get_value_for_rule($rule); |
2648 |
} |
} |
2717 |
// Retourne la chaîne de caractère |
// Retourne la chaîne de caractère |
2718 |
return $res_text; |
return $res_text; |
2719 |
} |
} |
2720 |
|
if ($type === 'simple' || $type === 'bool') { |
2721 |
|
// Retourne la valeur du champs rule |
2722 |
|
return $rule; |
2723 |
|
} |
2724 |
} |
} |
2725 |
|
|
2726 |
|
|
2763 |
$donnees_techniques = $this->getDonneesTechniques(); |
$donnees_techniques = $this->getDonneesTechniques(); |
2764 |
} |
} |
2765 |
// |
// |
2766 |
require_once "../obj/donnees_techniques.class.php"; |
$this->inst_donnees_techniques = $this->f->get_inst__om_dbform(array( |
2767 |
$this->inst_donnees_techniques = new donnees_techniques($donnees_techniques); |
"obj" => "donnees_techniques", |
2768 |
|
"idx" => $donnees_techniques, |
2769 |
|
)); |
2770 |
} |
} |
2771 |
// |
// |
2772 |
return $this->inst_donnees_techniques; |
return $this->inst_donnees_techniques; |
2784 |
$sql = "SELECT donnees_techniques |
$sql = "SELECT donnees_techniques |
2785 |
FROM ".DB_PREFIXE."donnees_techniques |
FROM ".DB_PREFIXE."donnees_techniques |
2786 |
WHERE dossier_instruction ='".$this->valF["dossier"]."'"; |
WHERE dossier_instruction ='".$this->valF["dossier"]."'"; |
2787 |
$donnees_techniques = $this->db->getOne($sql); |
$donnees_techniques = $this->f->db->getOne($sql); |
2788 |
$this->f->addToLog("getStatut() : db->getOne(\"".$sql."\")", VERBOSE_MODE); |
$this->f->addToLog("getStatut() : db->getOne(\"".$sql."\")", VERBOSE_MODE); |
2789 |
if ( database::isError($donnees_techniques)){ |
if ( database::isError($donnees_techniques)){ |
2790 |
die(); |
die(); |
2793 |
return $donnees_techniques; |
return $donnees_techniques; |
2794 |
} |
} |
2795 |
|
|
|
|
|
2796 |
/** |
/** |
2797 |
* TRIGGER - triggerajouterapres. |
* TRIGGER - triggerajouterapres. |
2798 |
* |
* |
2803 |
* |
* |
2804 |
* @return boolean |
* @return boolean |
2805 |
*/ |
*/ |
2806 |
function triggerajouterapres($id, &$db, $val, $DEBUG) { |
function triggerajouterapres($id, &$dnu1 = null, $val = array(), $dnu2 = null) { |
2807 |
|
$this->addToLog(__METHOD__."(): start", EXTRA_VERBOSE_MODE); |
2808 |
|
|
2809 |
// 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 |
2810 |
$inst_di = $this->get_inst_dossier($this->valF['dossier']); |
$inst_di = $this->get_inst_dossier($this->valF['dossier']); |
|
|
|
2811 |
// Instance de la classe evenement |
// Instance de la classe evenement |
2812 |
$inst_evenement = $this->get_inst_evenement($this->valF['evenement']); |
$inst_evenement = $this->get_inst_evenement($this->valF['evenement']); |
2813 |
|
// Instance de l'état courant du dossier d'instruction |
2814 |
|
$inst_current_etat = $this->f->get_inst__om_dbform(array( |
2815 |
|
"obj" => "etat", |
2816 |
|
"idx" => $inst_di->get_id_etat(), |
2817 |
|
)); |
2818 |
|
|
2819 |
/** |
/** |
2820 |
* Mise à jour des valeurs du dossier en fonction des valeurs calculées |
* Mise à jour des valeurs du dossier en fonction des valeurs calculées |
2822 |
*/ |
*/ |
2823 |
// état de complétude actuel du dossier |
// état de complétude actuel du dossier |
2824 |
$incompletude = ($inst_di->getVal('incompletude') == 't' ? true : false); |
$incompletude = ($inst_di->getVal('incompletude') == 't' ? true : false); |
2825 |
|
// L'événement suivant tacite paramétré est destiné à la gestion de l'incomplétude |
2826 |
|
$ev_suiv_tacite_incompletude = false; |
2827 |
// Initialisation |
// Initialisation |
2828 |
$valF = ""; |
$valF = array(); |
2829 |
$valF_dt = ""; |
$valF_dt = array(); |
2830 |
// |
// |
|
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; |
|
|
} |
|
|
} |
|
2831 |
// Récupération des paramètres de l'action |
// Récupération des paramètres de l'action |
2832 |
$sql = "SELECT * FROM ".DB_PREFIXE."action |
$sql = "SELECT * FROM ".DB_PREFIXE."action |
2833 |
WHERE action='".$this->valF['action']."'"; |
WHERE action='".$this->valF['action']."'"; |
2834 |
$res = $db->query($sql); |
$res = $this->f->db->query($sql); |
2835 |
$this->addToLog("triggerajouterapres(): db->query(\"".$sql."\");", VERBOSE_MODE); |
$this->addToLog(__METHOD__."(): db->query(\"".$sql."\");", VERBOSE_MODE); |
2836 |
if (database::isError($res)) { |
if (database::isError($res)) { |
2837 |
die($res->getMessage()); |
die($res->getMessage()); |
2838 |
} |
} |
2888 |
$valF['autorite_competente'] = $this->regle($row['regle_autorite_competente'], 'regle_autorite_competente'); |
$valF['autorite_competente'] = $this->regle($row['regle_autorite_competente'], 'regle_autorite_competente'); |
2889 |
} |
} |
2890 |
if ($row['regle_etat'] != '') { |
if ($row['regle_etat'] != '') { |
2891 |
// 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'); |
|
|
} |
|
2892 |
} |
} |
2893 |
if ($row['regle_date_cloture_instruction'] !== '') { |
if ($row['regle_date_cloture_instruction'] !== '') { |
2894 |
$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'); |
2926 |
if ($row['regle_date_transmission_parquet'] !== '') { |
if ($row['regle_date_transmission_parquet'] !== '') { |
2927 |
$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'); |
2928 |
} |
} |
2929 |
|
if ($row['regle_dossier_instruction_type'] !== '') { |
2930 |
|
$valF['dossier_instruction_type'] = $this->regle($row['regle_dossier_instruction_type'], 'regle_dossier_instruction_type'); |
2931 |
|
} |
2932 |
|
// La date d'affichage est modifiée seulement si le champ n'est pas |
2933 |
|
// renseigné |
2934 |
|
if ($row['regle_date_affichage'] !== '' |
2935 |
|
&& ($inst_di->getVal('date_affichage') === '' |
2936 |
|
|| $inst_di->getVal('date_affichage') === null)) { |
2937 |
|
// |
2938 |
|
$valF['date_affichage'] = $this->regle($row['regle_date_affichage'], 'regle_date_affichage'); |
2939 |
|
} |
2940 |
|
// |
2941 |
|
if ($row['regle_pec_metier'] != '') { |
2942 |
|
$valF['pec_metier'] = $this->regle($row['regle_pec_metier'], 'regle_pec_metier'); |
2943 |
|
} |
2944 |
|
if ($row['regle_a_qualifier'] != '') { |
2945 |
|
$valF['a_qualifier'] = $this->regle($row['regle_a_qualifier'], 'regle_a_qualifier'); |
2946 |
|
} |
2947 |
|
// |
2948 |
|
if ($row['regle_incompletude'] != '') { |
2949 |
|
$valF['incompletude'] = $this->regle($row['regle_incompletude'], 'regle_incompletude'); |
2950 |
|
} |
2951 |
|
if ($row['regle_incomplet_notifie'] != '') { |
2952 |
|
$valF['incomplet_notifie'] = $this->regle($row['regle_incomplet_notifie'], 'regle_incomplet_notifie'); |
2953 |
|
} |
2954 |
|
if ($row['regle_etat_pendant_incompletude'] != '') { |
2955 |
|
$valF['etat_pendant_incompletude'] = $this->regle($row['regle_etat_pendant_incompletude'], 'regle_etat_pendant_incompletude'); |
2956 |
|
} |
2957 |
|
if ($row['regle_evenement_suivant_tacite_incompletude'] != '') { |
2958 |
|
$resti = $this->regle($row['regle_evenement_suivant_tacite_incompletude'], 'regle_evenement_suivant_tacite_incompletude'); |
2959 |
|
if (strtolower($resti) === 't' || strtolower($resti) === 'true') { |
2960 |
|
$ev_suiv_tacite_incompletude = true; |
2961 |
|
} |
2962 |
|
} |
2963 |
} |
} |
2964 |
|
|
2965 |
// Si l'événement a un événement suivant tacite |
// Si l'événement a un événement suivant tacite |
2966 |
if($inst_evenement->getVal('evenement_suivant_tacite') != '') { |
if($inst_evenement->getVal('evenement_suivant_tacite') != '') { |
2967 |
// 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 |
2968 |
// dans le champ evenement_suivant_tacite du dossier |
// pas associé de le même façon au dossier d'instruction |
2969 |
if ($incompletude == false OR $inst_evenement->getVal('type') != "incompletude") { |
if ($ev_suiv_tacite_incompletude === false) { |
|
// |
|
2970 |
$valF['evenement_suivant_tacite'] = $inst_evenement->getVal('evenement_suivant_tacite'); |
$valF['evenement_suivant_tacite'] = $inst_evenement->getVal('evenement_suivant_tacite'); |
2971 |
} else { |
} |
2972 |
// Sinon l'événement tacite est stocké dans le champ |
if ($ev_suiv_tacite_incompletude === true) { |
|
// evenement_suivant_tacite_incompletude du dossier |
|
2973 |
$valF['evenement_suivant_tacite_incompletude'] = $inst_evenement->getVal('evenement_suivant_tacite'); |
$valF['evenement_suivant_tacite_incompletude'] = $inst_evenement->getVal('evenement_suivant_tacite'); |
2974 |
} |
} |
2975 |
} |
} |
2976 |
// 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 |
2977 |
if ($valF_dt != "") { |
if (count($valF_dt) > 0) { |
2978 |
$dt_id = $this->getDonneesTechniques(); |
$dt_id = $this->getDonneesTechniques(); |
2979 |
// On met à jour le dossier |
// On met à jour le dossier |
2980 |
$cle = " donnees_techniques='".$dt_id."'"; |
$cle = " donnees_techniques='".$dt_id."'"; |
2981 |
$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); |
2982 |
$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); |
2983 |
if (database::isError($res1)) { |
if (database::isError($res1)) { |
2984 |
die($res->getMessage()); |
die($res->getMessage()); |
2985 |
} |
} |
2986 |
// Affichage d'informations à l'utilisateur |
// Affichage d'informations à l'utilisateur |
2987 |
$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')."]"); |
2988 |
} |
} |
2989 |
// 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 |
2990 |
if ($valF != "") { |
if (count($valF) > 0) { |
2991 |
// On met à jour le dossier |
// |
2992 |
$cle = " dossier='".$this->valF['dossier']."'"; |
$inst_dossier = $this->f->get_inst__om_dbform(array( |
2993 |
$res1 = $db->autoExecute(DB_PREFIXE.'dossier', $valF, DB_AUTOQUERY_UPDATE, $cle); |
"obj" => "dossier", |
2994 |
$this->addToLog("triggerajouterapres(): db->autoexecute(\"".DB_PREFIXE."dossier\", ".print_r($valF, true).", DB_AUTOQUERY_UPDATE, \"".$cle."\");", VERBOSE_MODE); |
"idx" => $this->valF['dossier'], |
2995 |
if (database::isError($res1)) { |
)); |
2996 |
die($res->getMessage()); |
$valF['instruction'] = $id; |
2997 |
|
$valF['crud'] = 'create'; |
2998 |
|
$update_by_instruction = $inst_dossier->update_by_instruction($valF); |
2999 |
|
if ($update_by_instruction === false) { |
3000 |
|
$this->cleanMessage(); |
3001 |
|
$this->addToMessage(sprintf('%s %s', __("Une erreur s'est produite lors de la mise à jour du dossier d'instruction."), __("Veuillez contacter votre administrateur."))); |
3002 |
|
return false; |
3003 |
} |
} |
3004 |
// Affichage d'informations à l'utilisateur |
// Affichage d'informations à l'utilisateur |
3005 |
$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')."]"); |
3006 |
} |
} |
3007 |
|
|
3008 |
/** |
/** |
3038 |
$this->addToMessage(_("Notification (105) du référentiel ERP OK.")); |
$this->addToMessage(_("Notification (105) du référentiel ERP OK.")); |
3039 |
} |
} |
3040 |
|
|
3041 |
|
// Si le mode en rédaction intégrale est activé |
3042 |
|
if (isset($this->valF['flag_edition_integrale']) === true |
3043 |
|
&& $this->valF['flag_edition_integrale'] === true) { |
3044 |
|
$redactionIntegraleValF = array(); |
3045 |
|
|
3046 |
|
// Récupère la collectivite du dossier d'instruction |
3047 |
|
$dossier_instruction_om_collectivite = $this->get_dossier_instruction_om_collectivite(); |
3048 |
|
$collectivite = $this->f->getCollectivite($dossier_instruction_om_collectivite); |
3049 |
|
// Récupère le corps de la lettre type |
3050 |
|
$params = array( |
3051 |
|
"specific" => array( |
3052 |
|
"corps" => array( |
3053 |
|
"mode" => "get", |
3054 |
|
) |
3055 |
|
), |
3056 |
|
); |
3057 |
|
$result = $this->compute_pdf_output('lettretype', $this->valF['lettretype'], $collectivite, $id, $params); |
3058 |
|
$redactionIntegraleValF['corps_om_htmletatex'] = $result['pdf_output']; |
3059 |
|
// Récupère le titre de la lettre type |
3060 |
|
$params = array( |
3061 |
|
"specific" => array( |
3062 |
|
"titre" => array( |
3063 |
|
"mode" => "get", |
3064 |
|
) |
3065 |
|
), |
3066 |
|
); |
3067 |
|
$result = $this->compute_pdf_output('lettretype', $this->valF['lettretype'], $collectivite, $id, $params); |
3068 |
|
$redactionIntegraleValF['titre_om_htmletat'] = $result['pdf_output']; |
3069 |
|
|
3070 |
|
// mise à jour en base de données |
3071 |
|
$res = $this->f->db->autoExecute( |
3072 |
|
DB_PREFIXE.$this->table, |
3073 |
|
$redactionIntegraleValF, |
3074 |
|
DB_AUTOQUERY_UPDATE, |
3075 |
|
$this->clePrimaire."=".$id |
3076 |
|
); |
3077 |
|
$this->addToLog(__METHOD__."(): db->autoexecute(\"".DB_PREFIXE.'.'.$this->table."\", ".print_r($redactionIntegraleValF, true).", DB_AUTOQUERY_UPDATE, \"".$this->clePrimaire."=".$id."\");", VERBOSE_MODE); |
3078 |
|
if ($this->f->isDatabaseError($res, true) === true) { |
3079 |
|
return false; |
3080 |
|
} |
3081 |
|
} |
3082 |
|
|
3083 |
|
/** |
3084 |
|
* Finalisation automatique de l'instruction si le paramétrage de l'événement l'autorise |
3085 |
|
*/ |
3086 |
|
// Si la finalisation automatique de l'événement est activée |
3087 |
|
// ET si l'instruction n'a pas déjà été finalisée |
3088 |
|
// ET s'il existe une lettre type associée |
3089 |
|
if ($inst_evenement->getVal('finaliser_automatiquement') === 't' |
3090 |
|
&& $inst_evenement->getVal('om_final_instruction') !== 't' |
3091 |
|
&& $inst_evenement->getVal('lettretype') !== '' |
3092 |
|
&& $inst_evenement->getVal('lettretype') !== null) { |
3093 |
|
|
3094 |
|
// On instancie l'instruction |
3095 |
|
$inst_instruction = $this->f->get_inst__om_dbform(array( |
3096 |
|
"obj" => "instruction", |
3097 |
|
"idx" => $this->valF[$this->clePrimaire], |
3098 |
|
)); |
3099 |
|
|
3100 |
|
// On finalise l'instruction dans le contexte de finalisation : action 100 |
3101 |
|
$inst_instruction->setParameter('maj', 100); |
3102 |
|
$finalize = $inst_instruction->finalize($inst_instruction->valF); |
3103 |
|
|
3104 |
|
// Une erreur de finalisation renvoie 'false' : ajout dans les logs |
3105 |
|
// et dans le message d'erreur |
3106 |
|
if ($finalize === false) { |
3107 |
|
$this->f->addToLog(__METHOD__."() : ERROR - Impossible de finaliser l'instruction.", DEBUG_MODE); |
3108 |
|
$this->addToMessage(_("Erreur lors de la finalisation de l'instruction. Contactez votre administrateur.")); |
3109 |
|
return false; |
3110 |
|
} |
3111 |
|
} |
3112 |
|
|
3113 |
|
/** |
3114 |
|
* Finalisation automatique des instructions tacites ou retours. |
3115 |
|
*/ |
3116 |
|
// Si l'option de finalisation automatique des instructions tacites ou |
3117 |
|
// retours est activée et l'événement d'instruction a une lettre type |
3118 |
|
// associée |
3119 |
|
$collectivite_di = $this->get_dossier_instruction_om_collectivite($val['dossier']); |
3120 |
|
if ($this->f->is_option_finalisation_auto_enabled($collectivite_di) === true |
3121 |
|
&& $inst_evenement->getVal('lettretype') !== '' |
3122 |
|
&& $inst_evenement->getVal('lettretype') !== null) { |
3123 |
|
|
3124 |
|
// Rècupère l'identifiant de l'événement |
3125 |
|
$evenement_id = $inst_evenement->getVal($inst_evenement->clePrimaire); |
3126 |
|
|
3127 |
|
// Si l'événement d'instruction est identifié comme un événement |
3128 |
|
// retour |
3129 |
|
// OU l'événement d'instruction est l'événement suivant tacite du |
3130 |
|
// dossier d'instruction (incomplétude prise en compte) |
3131 |
|
// ET l'événement d'instruction n'a pas déjà été finalisé |
3132 |
|
if (($inst_evenement->getVal("retour") === 't' |
3133 |
|
|| ($inst_di->getVal('evenement_suivant_tacite_incompletude') === $evenement_id |
3134 |
|
|| $inst_di->getVal('evenement_suivant_tacite') === $evenement_id)) |
3135 |
|
&& ($inst_evenement->getVal('om_final_instruction') !== 't')) { |
3136 |
|
|
3137 |
|
// Finalise l'instruction |
3138 |
|
$inst_instruction = $this->f->get_inst__om_dbform(array( |
3139 |
|
"obj" => "instruction", |
3140 |
|
"idx" => $this->valF[$this->clePrimaire], |
3141 |
|
)); |
3142 |
|
$inst_instruction->setParameter('maj', 100); |
3143 |
|
$finalize = $inst_instruction->finalize($inst_instruction->valF); |
3144 |
|
if ($finalize === false) { |
3145 |
|
// |
3146 |
|
return false; |
3147 |
|
} |
3148 |
|
} |
3149 |
|
} |
3150 |
|
|
3151 |
|
/** |
3152 |
|
* Mise à jour de la version de clôture *version_clos* du dossier si et |
3153 |
|
* seulement si l'instruction met à jour l'état du dossier. |
3154 |
|
*/ |
3155 |
|
if (isset($valF['etat']) === true |
3156 |
|
&& $valF['etat'] !== null |
3157 |
|
&& $valF['etat'] !== '') { |
3158 |
|
// Instanciation de l'état appliqué sur le dossier par l'instruction |
3159 |
|
$inst_etat = $this->f->get_inst__om_dbform(array( |
3160 |
|
"obj" => "etat", |
3161 |
|
"idx" => $valF['etat'], |
3162 |
|
)); |
3163 |
|
// |
3164 |
|
$update_version_clos = null; |
3165 |
|
// En cas d'instruction qui clôture le dossier |
3166 |
|
if ($inst_etat->getVal('statut') === 'cloture') { |
3167 |
|
$update_version_clos = $inst_di->update_version_clos('up'); |
3168 |
|
} |
3169 |
|
// En cas d'instruction qui rouvre le dossier |
3170 |
|
if ($inst_current_etat->getVal('statut') === 'cloture' |
3171 |
|
&& $inst_etat->getVal('statut') !== 'cloture') { |
3172 |
|
// |
3173 |
|
$update_version_clos = $inst_di->update_version_clos('down'); |
3174 |
|
// |
3175 |
|
$params = array( |
3176 |
|
'di_reopened' => true, |
3177 |
|
); |
3178 |
|
} |
3179 |
|
// |
3180 |
|
if ($update_version_clos === false) { |
3181 |
|
$this->f->addToLog(sprintf( |
3182 |
|
"%s() : ERREUR - %s %s", |
3183 |
|
__METHOD__, |
3184 |
|
sprintf( |
3185 |
|
__("Impossible de mettre à jour la version de clôture du dossier d'instruction %s."), |
3186 |
|
$inst_di->getVal($inst_di->clePrimaire) |
3187 |
|
), |
3188 |
|
sprintf( |
3189 |
|
__("L'instruction tente d'appliquer l'état %s."), |
3190 |
|
$inst_etat->getVal($inst_etat->clePrimaire) |
3191 |
|
) |
3192 |
|
)); |
3193 |
|
$this->addToMessage(sprintf( |
3194 |
|
"%s %s", |
3195 |
|
__("Erreur lors de la mise à jour de la version de clôture du dossier d'instruction."), |
3196 |
|
__("Veuillez contacter votre administrateur.") |
3197 |
|
)); |
3198 |
|
return false; |
3199 |
|
} |
3200 |
|
} |
3201 |
|
|
3202 |
|
/** |
3203 |
|
* Notification automatique |
3204 |
|
*/ |
3205 |
|
// Notification automatique à l'ajout de l'instruction si la notification |
3206 |
|
// automatique est choisie et qu'il n'y a pas de lettretype associée à l'événement |
3207 |
|
if ($inst_evenement->getVal('notification') === 'notification_automatique' && |
3208 |
|
($inst_evenement->getVal('lettretype') === null || |
3209 |
|
$inst_evenement->getVal('lettretype') === '')) { |
3210 |
|
// Récupération de la liste des demandeurs à notifier et de la catégorie |
3211 |
|
$categorie = $this->f->get_param_option_notification($collectivite_di); |
3212 |
|
$isPortal = $categorie == null || $categorie == '' || $categorie == 'portal' ? true : false; |
3213 |
|
$demandeursANotifie = $this->get_demandeurs_notifiable( |
3214 |
|
$this->valF['dossier'], |
3215 |
|
$isPortal |
3216 |
|
); |
3217 |
|
|
3218 |
|
// Création d'une notification et d'une tâche pour chaque demandeur à notifier |
3219 |
|
foreach ($demandeursANotifie as $demandeur) { |
3220 |
|
// Ajout de la notif et récupération de son id |
3221 |
|
$idNotif = $this->ajouter_notification( |
3222 |
|
$this->valF[$this->clePrimaire], |
3223 |
|
$this->f->get_connected_user_login_name(), |
3224 |
|
$demandeur, |
3225 |
|
$collectivite_di, |
3226 |
|
true |
3227 |
|
); |
3228 |
|
if ($idNotif === false) { |
3229 |
|
return false; |
3230 |
|
} |
3231 |
|
// Création de la tache en lui donnant l'id de la notification |
3232 |
|
$notification_by_task = $this->notification_by_task( |
3233 |
|
$idNotif, |
3234 |
|
$this->valF['dossier'], |
3235 |
|
$categorie |
3236 |
|
); |
3237 |
|
if ($notification_by_task === false) { |
3238 |
|
$this->addToMessage( |
3239 |
|
__("Erreur lors de la génération de la notification au(x) pétitionnaire(s).") |
3240 |
|
); |
3241 |
|
return false; |
3242 |
|
} |
3243 |
|
} |
3244 |
|
$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."))); |
3245 |
|
} |
3246 |
|
|
3247 |
|
/** |
3248 |
|
* Mise à jour de la date de dernière modification du dossier |
3249 |
|
*/ |
3250 |
|
$inst_di->update_last_modification_date(); |
3251 |
|
|
3252 |
/** |
/** |
3253 |
* Mise à jour des données du DA. |
* Mise à jour des données du DA. |
3254 |
*/ |
*/ |
|
// |
|
3255 |
$inst_da = $inst_di->get_inst_dossier_autorisation(); |
$inst_da = $inst_di->get_inst_dossier_autorisation(); |
3256 |
// |
$params['di_id'] = $this->valF['dossier']; |
3257 |
if ($inst_da->majDossierAutorisation() === false) { |
if ($inst_da->majDossierAutorisation($params) === false) { |
3258 |
$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.")); |
3259 |
$this->correct = false; |
$this->correct = false; |
3260 |
return false; |
return false; |
3267 |
return $this->add_log_to_dossier($id, array_merge($val, $this->valF)); |
return $this->add_log_to_dossier($id, array_merge($val, $this->valF)); |
3268 |
} |
} |
3269 |
|
|
3270 |
function triggermodifierapres($id,&$db,$val,$DEBUG) { |
|
3271 |
|
public function is_service_notifiable() { |
3272 |
|
$evenement = $this->get_inst_evenement($this->getVal('evenement')); |
3273 |
|
|
3274 |
|
// Si l'instruction a une édition non finalisé quel que soit |
3275 |
|
// le type de notification, il n'est pas notifiable |
3276 |
|
if ($this->has_an_edition() === true) { |
3277 |
|
if ($this->is_unfinalizable_without_bypass() === false) { |
3278 |
|
return false; |
3279 |
|
} |
3280 |
|
} |
3281 |
|
// Vérifie si la notification des tiers est active pour l'évènement |
3282 |
|
return $this->get_boolean_from_pgsql_value($evenement->getVal('notification_service')); |
3283 |
|
} |
3284 |
|
|
3285 |
|
public function is_tiers_notifiable() { |
3286 |
|
$evenement = $this->get_inst_evenement($this->getVal('evenement')); |
3287 |
|
|
3288 |
|
// Si l'instruction a une édition non finalisé quel que soit |
3289 |
|
// le type de notification, il n'est pas notifiable |
3290 |
|
if ($this->has_an_edition() === true) { |
3291 |
|
if ($this->is_unfinalizable_without_bypass() === false) { |
3292 |
|
return false; |
3293 |
|
} |
3294 |
|
} |
3295 |
|
// Vérifie si la notification des tiers est active pour l'évènement |
3296 |
|
return $this->get_boolean_from_pgsql_value($evenement->getVal('notification_tiers')); |
3297 |
|
} |
3298 |
|
|
3299 |
|
public function is_notifiable_by_task_manual() { |
3300 |
|
$ev = $this->get_inst_evenement($this->getVal('evenement')); |
3301 |
|
|
3302 |
|
// Si l'instruction a une édition non finalisé quel que soit |
3303 |
|
// le type de notification, il n'est pas notifiable |
3304 |
|
if ($this->has_an_edition() === true) { |
3305 |
|
if ($this->is_unfinalizable_without_bypass() === false) { |
3306 |
|
return false; |
3307 |
|
} |
3308 |
|
} |
3309 |
|
|
3310 |
|
// Gestion des différents cas selon la valeur du champs notification |
3311 |
|
switch ($ev->getVal('notification')) { |
3312 |
|
case 'notification_manuelle': |
3313 |
|
return true; |
3314 |
|
case 'notification_manuelle_annexe': |
3315 |
|
return true; |
3316 |
|
case 'notification_automatique': |
3317 |
|
return false; |
3318 |
|
case 'notification_auto_signature_requise': |
3319 |
|
return false; |
3320 |
|
case 'notification_manuelle_signature_requise': |
3321 |
|
// Si il y a une date de retour de signature la notification est possible |
3322 |
|
if ($this->getVal('date_retour_signature') === null |
3323 |
|
|| $this->getVal('date_retour_signature') === '') { |
3324 |
|
return false; |
3325 |
|
} |
3326 |
|
return true; |
3327 |
|
case 'notification_manuelle_annexe_signature_requise': |
3328 |
|
// Si il y a une date de retour de signature la notification est possible |
3329 |
|
if ($this->getVal('date_retour_signature') === null |
3330 |
|
|| $this->getVal('date_retour_signature') === '') { |
3331 |
|
return false; |
3332 |
|
} |
3333 |
|
return true; |
3334 |
|
default: |
3335 |
|
return false; |
3336 |
|
} |
3337 |
|
} |
3338 |
|
|
3339 |
|
/** |
3340 |
|
* Crée une instance et une tache de notification pour le demandeur |
3341 |
|
* principal. |
3342 |
|
* |
3343 |
|
* @return boolean true si le traitement à réussi |
3344 |
|
*/ |
3345 |
|
protected function notifier_demandeur_principal() { |
3346 |
|
$this->begin_treatment(__METHOD__); |
3347 |
|
$message = ''; |
3348 |
|
// Récupération des informations concernant le demandeur |
3349 |
|
$dossier = $this->getVal('dossier'); |
3350 |
|
$collectivite_di = $this->get_dossier_instruction_om_collectivite($dossier); |
3351 |
|
$demandeur = $this->get_demandeurs_notifiable( |
3352 |
|
$dossier, |
3353 |
|
true |
3354 |
|
); |
3355 |
|
if ($demandeur !== array()) { |
3356 |
|
$destinataire = array_values($demandeur); |
3357 |
|
// Ajout de la notif et récupération de son id |
3358 |
|
$idNotification = $this->ajouter_notification( |
3359 |
|
$this->getVal($this->clePrimaire), |
3360 |
|
$this->f->get_connected_user_login_name(), |
3361 |
|
$destinataire[0], |
3362 |
|
$collectivite_di, |
3363 |
|
true |
3364 |
|
); |
3365 |
|
if ($idNotification === false) { |
3366 |
|
return $this->end_treatment(__METHOD__, false); |
3367 |
|
} |
3368 |
|
// Création de la tâche en lui donnant l'id de la notification |
3369 |
|
$notification_by_task = $this->notification_by_task($idNotification, $dossier); |
3370 |
|
if ($notification_by_task === false) { |
3371 |
|
$this->addToMessage( |
3372 |
|
__("Erreur lors de la génération de la notification au(x) pétitionnaire(s).") |
3373 |
|
); |
3374 |
|
return $this->end_treatment(__METHOD__, false); |
3375 |
|
} |
3376 |
|
$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."))); |
3377 |
|
return $this->end_treatment(__METHOD__, true); |
3378 |
|
} |
3379 |
|
$this->addToMessage( __("Le demandeur principal n'est pas notifiable.")); |
3380 |
|
return $this->end_treatment(__METHOD__, true); |
3381 |
|
} |
3382 |
|
|
3383 |
|
public function notification_by_task($object_id, $dossier, $category = null, $type = null) { |
3384 |
|
// Par défaut le type est portal |
3385 |
|
if ($category === null) { |
3386 |
|
$category = 'portal'; |
3387 |
|
} |
3388 |
|
// Si le type n'est pas correctement spécifié, alors il est calculé |
3389 |
|
if ($type !== 'notification_recepisse' |
3390 |
|
&& $type !== 'notification_instruction' |
3391 |
|
&& $type !== 'notification_decision' |
3392 |
|
&& $type !== 'notification_service_consulte' |
3393 |
|
&& $type !== 'notification_tiers_consulte') { |
3394 |
|
// |
3395 |
|
$type = 'notification_instruction'; |
3396 |
|
// Vérifie si l'instruction est un récépissé |
3397 |
|
$trace = debug_backtrace(); |
3398 |
|
foreach ($trace as $key => $value) { |
3399 |
|
if (isset($trace[$key]['class']) === true |
3400 |
|
&& empty($trace[$key]['class']) === false) { |
3401 |
|
// |
3402 |
|
if (strtolower($trace[$key]['class']) === 'demande') { |
3403 |
|
$type = 'notification_recepisse'; |
3404 |
|
} |
3405 |
|
} |
3406 |
|
} |
3407 |
|
// Vérifie si l'instruction est une décision |
3408 |
|
if ($type !== 'notification_recepisse') { |
3409 |
|
$avis_decision = $this->getVal('avis_decision') !== null ? $this->getVal('avis_decision') : $this->valF['avis_decision']; |
3410 |
|
if ($avis_decision !== null && $avis_decision !== '') { |
3411 |
|
$type = 'notification_decision'; |
3412 |
|
} |
3413 |
|
} |
3414 |
|
} |
3415 |
|
// Préparation de la tache de notification |
3416 |
|
$inst_task = $this->f->get_inst__om_dbform(array( |
3417 |
|
"obj" => "task", |
3418 |
|
"idx" => 0, |
3419 |
|
)); |
3420 |
|
$task_val = array( |
3421 |
|
'type' => $type, |
3422 |
|
'object_id' => $object_id, |
3423 |
|
'dossier' => $dossier, |
3424 |
|
'category' => $category, |
3425 |
|
); |
3426 |
|
|
3427 |
|
$add_task = $inst_task->add_task(array('val' => $task_val)); |
3428 |
|
if ($add_task === false) { |
3429 |
|
return false; |
3430 |
|
} |
3431 |
|
|
3432 |
|
return true; |
3433 |
|
} |
3434 |
|
|
3435 |
|
/** |
3436 |
|
* A partir des informations passée en argument ajoute un nouvel élément |
3437 |
|
* dans la table instruction_notification. |
3438 |
|
* Avant l'ajout vérifie en utilisant l'id de la collectivité passée en |
3439 |
|
* paramètre si le paramétrage attendus est ok. |
3440 |
|
* Ajoute également un nouvel élement dans instruction_notification_document |
3441 |
|
* si l'instruction possède une lettretype. |
3442 |
|
* Si un identifiant d'une instruction annexe est donnée ajoute un deuxième |
3443 |
|
* élement dans la table instruction_notification_document qui correspondra |
3444 |
|
* à l'annexe de la notification. |
3445 |
|
* |
3446 |
|
* @param integer identifiant de l'instruction notifiée |
3447 |
|
* @param string information concernant l'emetteur |
3448 |
|
* @param array tableau contenant 2 entrées |
3449 |
|
* - destinatire : nom, prenom ou raison sociale, dénomination et courriel |
3450 |
|
* - courriel : adresse mail de la personne à notifier |
3451 |
|
* @param integer identifiant de la collectivité permettant de récupèrer les |
3452 |
|
* paramètres à valider |
3453 |
|
* @param boolean indique si la notification est automatique ou manuelle |
3454 |
|
* @param integer identifiant d'une instruction dont l'édition sera annexé |
3455 |
|
* à la notification |
3456 |
|
* |
3457 |
|
* @return integer|boolean identifiant de la notification créée si le traitement |
3458 |
|
* a réussie, false sinon. |
3459 |
|
*/ |
3460 |
|
protected function ajouter_notification( |
3461 |
|
$idInstruction, |
3462 |
|
$emetteur, |
3463 |
|
$destinataire, |
3464 |
|
$collectiviteId, |
3465 |
|
$demandeAuto = false, |
3466 |
|
$idInstrDocAnnexe = null |
3467 |
|
) { |
3468 |
|
// Vérification que les paramètres nécessaires à l'envoi de la notification existe avant |
3469 |
|
// de créer la notification |
3470 |
|
if (! $this->is_parametrage_notification_correct($collectiviteId)) { |
3471 |
|
$this->addToMessage(__("Erreur de paramétrage. L'url d'accès au(x) document(s) notifié(s) n'est pas paramétrée.")); |
3472 |
|
return false; |
3473 |
|
} |
3474 |
|
// Préparation de la notification |
3475 |
|
$inst_notif = $this->f->get_inst__om_dbform(array( |
3476 |
|
"obj" => "instruction_notification", |
3477 |
|
"idx" => "]", |
3478 |
|
)); |
3479 |
|
$notif_val = array( |
3480 |
|
'instruction_notification' => null, |
3481 |
|
'instruction' => $idInstruction, |
3482 |
|
'automatique' => $demandeAuto, |
3483 |
|
'emetteur' => $emetteur, |
3484 |
|
'date_envoi' => null, |
3485 |
|
'destinataire' => $destinataire['destinataire'], |
3486 |
|
'courriel' => $destinataire['courriel'], |
3487 |
|
'date_premier_acces' => null, |
3488 |
|
'statut' => 'en cours d\'envoi', |
3489 |
|
'commentaire' => 'Notification en cours de traitement' |
3490 |
|
); |
3491 |
|
|
3492 |
|
// Création de la notification |
3493 |
|
$add_notif = $inst_notif->ajouter($notif_val); |
3494 |
|
if ($add_notif === false) { |
3495 |
|
$this->addToMessage(__("Erreur lors de la génération de la notification au(x) pétitionnaire(s).")); |
3496 |
|
return false; |
3497 |
|
} |
3498 |
|
|
3499 |
|
// Si il y a une lettretype finalisé stockage de la clé d'accès au documents |
3500 |
|
if ($this->evenement_has_an_edition($this->getVal('evenement')) === true) { |
3501 |
|
$add_notif_doc = $this->ajouter_notification_document_instruction( |
3502 |
|
$this->getVal($this->clePrimaire), |
3503 |
|
$inst_notif->getVal($inst_notif->clePrimaire) |
3504 |
|
); |
3505 |
|
if ($add_notif_doc === false) { |
3506 |
|
$this->addToMessage(__("Erreur lors de la génération de la notification du document.")); |
3507 |
|
return false; |
3508 |
|
} |
3509 |
|
} |
3510 |
|
// Si une annexe a été choisie stockage de la clé d'accès à l'annexe |
3511 |
|
if ($idInstrDocAnnexe != null || $idInstrDocAnnexe != '') { |
3512 |
|
$add_notif_annexe = $this->ajouter_notification_document_instruction( |
3513 |
|
$idInstrDocAnnexe, |
3514 |
|
$inst_notif->getVal($inst_notif->clePrimaire), |
3515 |
|
true |
3516 |
|
); |
3517 |
|
if ($add_notif_annexe === false) { |
3518 |
|
$this->addToMessage(__("Erreur lors de la génération de la notification de l'annexe.")); |
3519 |
|
return false; |
3520 |
|
} |
3521 |
|
} |
3522 |
|
|
3523 |
|
// Renvoie l'id de la nouvelle instance de instruction_notification |
3524 |
|
return $inst_notif->getVal($inst_notif->clePrimaire); |
3525 |
|
} |
3526 |
|
|
3527 |
|
/** |
3528 |
|
* A partir des informations passée en argument ajoute un nouvel élément |
3529 |
|
* dans la table instruction_notification. |
3530 |
|
* Ajoute également un nouvel élement dans instruction_notification_document |
3531 |
|
* si l'instruction possède une lettretype. |
3532 |
|
* |
3533 |
|
* @param integer identifiant de l'instruction notifiée |
3534 |
|
* @param string information concernant l'emetteur |
3535 |
|
* @param array tableau contenant 2 entrées |
3536 |
|
* - destinatire : nom, prenom ou raison sociale, dénomination et courriel |
3537 |
|
* - courriel : adresse mail de la personne à notifier |
3538 |
|
* @param boolean indique si la notification est automatique ou manuelle |
3539 |
|
* |
3540 |
|
* @return integer|boolean identifiant de la notification créée si le traitement |
3541 |
|
* a réussie, false sinon. |
3542 |
|
*/ |
3543 |
|
protected function ajouter_notification_sans_annexe( |
3544 |
|
$idInstruction, |
3545 |
|
$emetteur, |
3546 |
|
$destinataire, |
3547 |
|
$demandeAuto = false |
3548 |
|
) { |
3549 |
|
// Préparation de la notification |
3550 |
|
$inst_notif = $this->f->get_inst__om_dbform(array( |
3551 |
|
"obj" => "instruction_notification", |
3552 |
|
"idx" => "]", |
3553 |
|
)); |
3554 |
|
$notif_val = array( |
3555 |
|
'instruction_notification' => null, |
3556 |
|
'instruction' => $idInstruction, |
3557 |
|
'automatique' => $demandeAuto, |
3558 |
|
'emetteur' => $emetteur, |
3559 |
|
'date_envoi' => null, |
3560 |
|
'destinataire' => $destinataire['destinataire'], |
3561 |
|
'courriel' => $destinataire['courriel'], |
3562 |
|
'date_premier_acces' => null, |
3563 |
|
'statut' => 'en cours d\'envoi', |
3564 |
|
'commentaire' => 'Notification en cours de traitement' |
3565 |
|
); |
3566 |
|
|
3567 |
|
// Création de la notification |
3568 |
|
$add_notif = $inst_notif->ajouter($notif_val); |
3569 |
|
if ($add_notif === false) { |
3570 |
|
$this->addToMessage(__("Erreur lors de la génération de la notification au(x) pétitionnaire(s).")); |
3571 |
|
return false; |
3572 |
|
} |
3573 |
|
|
3574 |
|
// Si il y a une lettretype finalisé stockage de la clé d'accès au documents |
3575 |
|
if ($this->evenement_has_an_edition($this->getVal('evenement')) === true) { |
3576 |
|
$add_notif_doc = $this->ajouter_notification_document_instruction( |
3577 |
|
$this->getVal($this->clePrimaire), |
3578 |
|
$inst_notif->getVal($inst_notif->clePrimaire) |
3579 |
|
); |
3580 |
|
if ($add_notif_doc === false) { |
3581 |
|
$this->addToMessage(__("Erreur lors de la génération de la notification du document.")); |
3582 |
|
return false; |
3583 |
|
} |
3584 |
|
} |
3585 |
|
// Renvoie l'id de la nouvelle instance de instruction_notification |
3586 |
|
return $inst_notif->getVal($inst_notif->clePrimaire); |
3587 |
|
} |
3588 |
|
|
3589 |
|
/** |
3590 |
|
* Pour chaque élément du tableau passé en paramètre ajoute une nouvelle |
3591 |
|
* instance dans la table instruction_notification_document lié a la |
3592 |
|
* notification dont l'id est passé en paramètre. |
3593 |
|
* |
3594 |
|
* @param array tableau contenant les informations nécessaires pour créer les annexes |
3595 |
|
* |
3596 |
|
* @return integer|boolean identifiant de la notification créée si le traitement |
3597 |
|
* a réussie, false sinon. |
3598 |
|
*/ |
3599 |
|
protected function ajouter_notification_document_multiple($idNotification, $listeDocument) { |
3600 |
|
foreach ($listeDocument as $idDoc => $paramDoc) { |
3601 |
|
if (! $this->ajouter_notification_document($idNotification, $idDoc, $paramDoc['tableDocument'], $paramDoc['isAnnexe'])) { |
3602 |
|
$this->addToMessage(__("Erreur lors de la génération des documents à notifier.")); |
3603 |
|
return false; |
3604 |
|
} |
3605 |
|
} |
3606 |
|
return true; |
3607 |
|
} |
3608 |
|
|
3609 |
|
/** |
3610 |
|
* Ajoute un élément dans la table instruction_notification_document en utilisant |
3611 |
|
* les éléments fourni en paramètre |
3612 |
|
* |
3613 |
|
* @param integer $idNotification : id de la notification à laquelle on associe le document |
3614 |
|
* @param integer $idDocument : id de l'objet auquel est rattaché le document |
3615 |
|
* @param string $tableDocument : nom de la table a laquelle est rattaché le document |
3616 |
|
* @param boolean $isAnnexe : indique si le document est une annexe ou pas |
3617 |
|
* |
3618 |
|
* @return boolean indique si le traitement a réussi |
3619 |
|
*/ |
3620 |
|
protected function ajouter_notification_document($idNotification, $idDocument, $tableDocument, $isAnnexe = false) { |
3621 |
|
$inst_notif_doc = $this->f->get_inst__om_dbform(array( |
3622 |
|
"obj" => "instruction_notification_document", |
3623 |
|
"idx" => "]", |
3624 |
|
)); |
3625 |
|
// l'attribut instruction doit obligatoirement être renseigné |
3626 |
|
// pour éviter toutes confusion avec d'autres instruction l'id |
3627 |
|
// 0 est donné au document n'appartenant pas aux instructions |
3628 |
|
$notif_doc_val = array( |
3629 |
|
'instruction_notification_document' => null, |
3630 |
|
'instruction_notification' => $idNotification, |
3631 |
|
'instruction' => $tableDocument == 'instruction' ? $idDocument : 0, |
3632 |
|
'document_type' => $tableDocument, |
3633 |
|
'document_id' => $idDocument, |
3634 |
|
'cle' => $this->getCleAccesDocument(), |
3635 |
|
'annexe' => $isAnnexe |
3636 |
|
); |
3637 |
|
|
3638 |
|
$add_notif_doc = $inst_notif_doc->ajouter($notif_doc_val); |
3639 |
|
if ($add_notif_doc === false) { |
3640 |
|
return false; |
3641 |
|
} |
3642 |
|
return true; |
3643 |
|
} |
3644 |
|
|
3645 |
|
/** |
3646 |
|
* Vérifie si le paramétrage de la notification des demandeurs est correct. |
3647 |
|
* |
3648 |
|
* @param integer identifiant de la collectivité |
3649 |
|
* @return boolean |
3650 |
|
*/ |
3651 |
|
protected function is_parametrage_notification_correct($collectiviteId) { |
3652 |
|
$categorie = $this->f->get_param_option_notification($collectiviteId); |
3653 |
|
$urlAccesNotif = $this->f->get_parametre_notification_url_acces($collectiviteId); |
3654 |
|
if ($categorie == 'mail' && $urlAccesNotif == null) { |
3655 |
|
return false; |
3656 |
|
} |
3657 |
|
return true; |
3658 |
|
} |
3659 |
|
|
3660 |
|
/** |
3661 |
|
* Ajoute un élément dans la table instruction_notification_document. |
3662 |
|
* Ne permet d'ajouter que des documents de notification lié à la table instruction |
3663 |
|
* |
3664 |
|
* TODO : supprimer cette méthode pour en faire une générique a la place |
3665 |
|
* |
3666 |
|
* @param integer $idInstruction : id de l'instruction à laquelle est rattaché le document |
3667 |
|
* @param integer $idNotification : id de la notification à laquelle on associe le document |
3668 |
|
* @param boolean $isAnnexe : indique si le document est une annexe ou pas |
3669 |
|
* |
3670 |
|
* @return boolean indique si le traitement a réussi |
3671 |
|
*/ |
3672 |
|
protected function ajouter_notification_document_instruction($idInstruction, $idNotification, $isAnnexe = false) { |
3673 |
|
$inst_notif_doc = $this->f->get_inst__om_dbform(array( |
3674 |
|
"obj" => "instruction_notification_document", |
3675 |
|
"idx" => "]", |
3676 |
|
)); |
3677 |
|
$notif_doc_val = array( |
3678 |
|
'instruction_notification_document' => null, |
3679 |
|
'instruction_notification' => $idNotification, |
3680 |
|
'instruction' => $idInstruction, |
3681 |
|
'document_type' => 'instruction', |
3682 |
|
'document_id' => $idInstruction, |
3683 |
|
'cle' => $this->getCleAccesDocument(), |
3684 |
|
'annexe' => $isAnnexe |
3685 |
|
); |
3686 |
|
|
3687 |
|
$add_notif_doc = $inst_notif_doc->ajouter($notif_doc_val); |
3688 |
|
if ($add_notif_doc === false) { |
3689 |
|
return false; |
3690 |
|
} |
3691 |
|
return true; |
3692 |
|
} |
3693 |
|
|
3694 |
|
/** |
3695 |
|
* TRIGGER - triggermodifierapres. |
3696 |
|
* |
3697 |
|
* @return boolean |
3698 |
|
*/ |
3699 |
|
function triggermodifierapres($id, &$dnu1 = null, $val = array(), $dnu2 = null) { |
3700 |
|
$this->addToLog(__METHOD__."(): start", EXTRA_VERBOSE_MODE); |
3701 |
|
$collectivite_di = $this->get_dossier_instruction_om_collectivite($val['dossier']); |
3702 |
|
$message = ''; |
3703 |
/** |
/** |
3704 |
* 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 |
3705 |
* si la date de l'evenement est modifiee |
* si la date de l'evenement est modifiee |
3706 |
*/ |
*/ |
3707 |
// Initialisation |
// Initialisation |
3708 |
$valF = ""; |
$valF = array(); |
3709 |
$valF_dt = ""; |
$valF_dt = array(); |
3710 |
// Initialisation du type d'événement |
// Initialisation du type d'événement |
3711 |
$type_evmt = ""; |
$type_evmt = ""; |
3712 |
// Récupération de l'action correspondante à l'événement |
// Récupération de l'action correspondante à l'événement |
3713 |
$sql = "SELECT action |
$sql = "SELECT action |
3714 |
FROM ".DB_PREFIXE."evenement |
FROM ".DB_PREFIXE."evenement |
3715 |
WHERE evenement=".$this->valF['evenement']; |
WHERE evenement=".$this->valF['evenement']; |
3716 |
$action = $db->getOne($sql); |
$action = $this->f->db->getOne($sql); |
3717 |
$this->addToLog("triggermodifierapres(): db->getone(\"".$sql."\");", VERBOSE_MODE); |
$this->addToLog(__METHOD__."(): db->getone(\"".$sql."\");", VERBOSE_MODE); |
3718 |
if (database::isError($action)) { |
if (database::isError($action)) { |
3719 |
die($action->getMessage()); |
die($action->getMessage()); |
3720 |
} |
} |
3722 |
// Récupération des paramètres de l'action |
// Récupération des paramètres de l'action |
3723 |
$sql = "SELECT * FROM ".DB_PREFIXE."action |
$sql = "SELECT * FROM ".DB_PREFIXE."action |
3724 |
WHERE action='".$action."'"; |
WHERE action='".$action."'"; |
3725 |
$res = $db->query($sql); |
$res = $this->f->db->query($sql); |
3726 |
$this->addToLog("triggermodifierapres(): db->query(\"".$sql."\");", VERBOSE_MODE); |
$this->addToLog(__METHOD__."(): db->query(\"".$sql."\");", VERBOSE_MODE); |
3727 |
if (database::isError($res)) { |
if (database::isError($res)) { |
3728 |
die($res->getMessage()); |
die($res->getMessage()); |
3729 |
} |
} |
3795 |
if ($row['regle_donnees_techniques5'] !== '') { |
if ($row['regle_donnees_techniques5'] !== '') { |
3796 |
$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'); |
3797 |
} |
} |
3798 |
|
if ($row['regle_dossier_instruction_type'] !== '') { |
3799 |
|
$valF['dossier_instruction_type'] = $this->regle($row['regle_dossier_instruction_type'], 'regle_dossier_instruction_type'); |
3800 |
|
} |
3801 |
} |
} |
3802 |
// 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 |
3803 |
if ($valF_dt != "") { |
if (count($valF_dt) > 0) { |
3804 |
$dt_id = $this->getDonneesTechniques(); |
$dt_id = $this->getDonneesTechniques(); |
3805 |
// On met à jour le dossier |
// On met à jour le dossier |
3806 |
$cle = " donnees_techniques='".$dt_id."'"; |
$cle = " donnees_techniques='".$dt_id."'"; |
3807 |
$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); |
3808 |
$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); |
3809 |
if (database::isError($res1)) { |
if (database::isError($res1)) { |
3810 |
die($res->getMessage()); |
die($res->getMessage()); |
3811 |
} |
} |
3812 |
// Affichage d'informations à l'utilisateur |
// Affichage d'informations à l'utilisateur |
3813 |
$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')."]"); |
3814 |
} |
} |
3815 |
// 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 |
3816 |
if ($valF != "") { |
if (count($valF) > 0) { |
3817 |
// On met à jour le dossier |
// |
3818 |
$cle = " dossier='".$this->valF['dossier']."'"; |
$inst_dossier = $this->f->get_inst__om_dbform(array( |
3819 |
$res1 = $db->autoExecute(DB_PREFIXE.'dossier', $valF, DB_AUTOQUERY_UPDATE, $cle); |
"obj" => "dossier", |
3820 |
$this->addToLog("triggermodifierapres(): db->autoexecute(\"".DB_PREFIXE."dossier\", ".print_r($valF, true).", DB_AUTOQUERY_UPDATE, \"".$cle."\");", VERBOSE_MODE); |
"idx" => $this->valF['dossier'], |
3821 |
if (database::isError($res1)) { |
)); |
3822 |
die($res->getMessage()); |
$valF['instruction'] = $id; |
3823 |
|
$valF['crud'] = 'update'; |
3824 |
|
$update_by_instruction = $inst_dossier->update_by_instruction($valF); |
3825 |
|
if ($update_by_instruction === false) { |
3826 |
|
$this->cleanMessage(); |
3827 |
|
$this->addToMessage(sprintf('%s %s', __("Une erreur s'est produite lors de la mise à jour du dossier d'instruction."), __("Veuillez contacter votre administrateur."))); |
3828 |
|
return false; |
3829 |
} |
} |
3830 |
// Affichage d'informations à l'utilisateur |
// Affichage d'informations à l'utilisateur |
3831 |
$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')."]"); |
3832 |
} |
} |
3833 |
|
|
3834 |
$restriction = $this->get_restriction($val['evenement']); |
$restriction = $this->get_restriction($val['evenement']); |
3838 |
// 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é |
3839 |
$sql = "SELECT * FROM ".DB_PREFIXE."evenement |
$sql = "SELECT * FROM ".DB_PREFIXE."evenement |
3840 |
WHERE evenement=".$this->valF['evenement']; |
WHERE evenement=".$this->valF['evenement']; |
3841 |
$res = $db->query($sql); |
$res = $this->f->db->query($sql); |
3842 |
$this->addToLog("triggermodifierapres(): db->query(\"".$sql."\");", VERBOSE_MODE); |
$this->addToLog(__METHOD__."(): db->query(\"".$sql."\");", VERBOSE_MODE); |
3843 |
if (database::isError($res)) { |
if (database::isError($res)) { |
3844 |
die($res->getMessage()); |
die($res->getMessage()); |
3845 |
} |
} |
3849 |
if ($this->getVal('date_retour_signature') == "" AND |
if ($this->getVal('date_retour_signature') == "" AND |
3850 |
$this->valF['date_retour_signature'] != "" AND |
$this->valF['date_retour_signature'] != "" AND |
3851 |
$row['evenement_retour_signature'] != "") { |
$row['evenement_retour_signature'] != "") { |
3852 |
$new_instruction = new instruction("]", $db, $DEBUG); |
$new_instruction = $this->f->get_inst__om_dbform(array( |
3853 |
|
"obj" => "instruction", |
3854 |
|
"idx" => "]", |
3855 |
|
)); |
3856 |
// 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 |
3857 |
foreach($new_instruction->champs as $champ) { |
foreach($new_instruction->champs as $champ) { |
3858 |
$valNewInstr[$champ] = ""; |
$valNewInstr[$champ] = ""; |
3871 |
$new_instruction->setParameter("maj", 0); |
$new_instruction->setParameter("maj", 0); |
3872 |
$new_instruction->class_actions[0]["identifier"] = |
$new_instruction->class_actions[0]["identifier"] = |
3873 |
"retour signature de l'instruction $current_id"; |
"retour signature de l'instruction $current_id"; |
3874 |
$retour = $new_instruction->ajouter($valNewInstr,$db, $DEBUG); |
$retour = $new_instruction->ajouter($valNewInstr); |
3875 |
|
|
3876 |
//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 |
3877 |
//de restriction |
//de restriction |
3878 |
if ($retour == false && !$new_instruction->restriction_valid){ |
if ($retour == false && !$new_instruction->restriction_valid){ |
3879 |
$error_message = $this->get_restriction_error_message($restriction); |
$error_message = $this->get_restriction_error_message($restriction); |
3880 |
$this->f->displayMessage("error", $error_message); |
$this->f->displayMessage("error", $error_message); |
3881 |
$this->addToLog("triggermodifierapres() : evenement retour ". |
$this->addToLog(__METHOD__."(): evenement retour ". |
3882 |
"instruction ".$this->valF[$this->clePrimaire]." : ". |
"instruction ".$this->valF[$this->clePrimaire]." : ". |
3883 |
$new_instruction->msg); |
$new_instruction->msg); |
3884 |
} |
} |
3894 |
$this->valF['date_retour_rar'] != "") { |
$this->valF['date_retour_rar'] != "") { |
3895 |
|
|
3896 |
if($row['evenement_retour_ar'] != "") { |
if($row['evenement_retour_ar'] != "") { |
3897 |
$new_instruction = new instruction("]", $db, $DEBUG); |
$new_instruction = $this->f->get_inst__om_dbform(array( |
3898 |
|
"obj" => "instruction", |
3899 |
|
"idx" => "]", |
3900 |
|
)); |
3901 |
// 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 |
3902 |
foreach($new_instruction->champs as $champ) { |
foreach($new_instruction->champs as $champ) { |
3903 |
$valNewInstr[$champ] = ""; |
$valNewInstr[$champ] = ""; |
3915 |
$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']); |
3916 |
$new_instruction->setParameter("maj", 0); |
$new_instruction->setParameter("maj", 0); |
3917 |
$new_instruction->class_actions[0]["identifier"] = |
$new_instruction->class_actions[0]["identifier"] = |
3918 |
"retour RAR de l'instruction $current_id"; |
"notification de l'instruction $current_id"; |
3919 |
$retour = $new_instruction->ajouter($valNewInstr,$db, $DEBUG); |
$retour = $new_instruction->ajouter($valNewInstr); |
3920 |
|
|
3921 |
//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 |
3922 |
//de restriction |
//de restriction |
3924 |
$error_message = $this->get_restriction_error_message($restriction); |
$error_message = $this->get_restriction_error_message($restriction); |
3925 |
$this->f->displayMessage("error", $error_message); |
$this->f->displayMessage("error", $error_message); |
3926 |
$this->addToLog( |
$this->addToLog( |
3927 |
"triggermodifierapres() : evenement retour instruction ". |
__METHOD__."(): evenement retour instruction ". |
3928 |
$this->valF[$this->clePrimaire]." : ". |
$this->valF[$this->clePrimaire]." : ". |
3929 |
$new_instruction->msg |
$new_instruction->msg |
3930 |
); |
); |
3936 |
return false; |
return false; |
3937 |
} |
} |
3938 |
} |
} |
|
// 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()); |
|
|
} |
|
|
} |
|
3939 |
} |
} |
3940 |
} |
} |
3941 |
} |
} |
3942 |
|
|
3943 |
|
/** |
3944 |
|
* Mise à jour de la date de dernière modification du dossier |
3945 |
|
* d'instruction |
3946 |
|
*/ |
3947 |
|
$inst_di = $this->get_inst_dossier($this->getVal('dossier')); |
3948 |
|
$inst_di->update_last_modification_date(); |
3949 |
|
|
3950 |
// Mise à jour des données du dossier d'autorisation |
// Mise à jour des données du dossier d'autorisation |
3951 |
require_once "../obj/dossier_autorisation.class.php"; |
$da = $this->f->get_inst__om_dbform(array( |
3952 |
$da = new dossier_autorisation($this->getNumDemandeAutorFromDossier($this->valF['dossier']), $this->db, DEBUG); |
"obj" => "dossier_autorisation", |
3953 |
if($da->majDossierAutorisation() === false) { |
"idx" => $this->getNumDemandeAutorFromDossier($this->valF['dossier']), |
3954 |
|
)); |
3955 |
|
$params = array( |
3956 |
|
'di_id' => $this->getVal('dossier'), |
3957 |
|
); |
3958 |
|
if($da->majDossierAutorisation($params) === false) { |
3959 |
$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.")); |
3960 |
$this->correct = false; |
$this->correct = false; |
3961 |
return false; |
return false; |
3962 |
} |
} |
3963 |
|
|
3964 |
|
// mise à jour des métadonnées issues des dates de suivi |
3965 |
|
$dateRetourSignatureModified = ($this->valF['date_retour_signature'] != $this->getVal('date_retour_signature')); |
3966 |
|
$dateRetourRARModified = ($this->valF['date_retour_rar'] != $this->getVal('date_retour_rar')); |
3967 |
|
if ($dateRetourSignatureModified || $dateRetourRARModified) { |
3968 |
|
|
3969 |
|
// Calculs des nouvelles métadonnées |
3970 |
|
$metadata = $this->getMetadata("om_fichier_instruction"); |
3971 |
|
|
3972 |
|
// On vérifie si l'instruction à finaliser a un événement de type arrete |
3973 |
|
$sql = "SELECT type FROM ".DB_PREFIXE."evenement WHERE evenement = ".$this->getVal("evenement"); |
3974 |
|
$typeEvenement = $this->f->db->getOne($sql); |
3975 |
|
$this->addToLog(__METHOD__."(): db->getOne(\"".$sql."\");", VERBOSE_MODE); |
3976 |
|
if ($this->f->isDatabaseError($typeEvenement, true) === true) { |
3977 |
|
$this->correct = false; |
3978 |
|
$this->addToMessage(__("Erreur de traitement de fichier.")); |
3979 |
|
$this->addToLog(__METHOD__."() erreur BDD: ".var_export($typeEvenement->getMessage(), true), DEBUG_MODE); |
3980 |
|
return false; |
3981 |
|
} |
3982 |
|
|
3983 |
|
// Si l'événement est de type arrete, on ajoute les métadonnées spécifiques |
3984 |
|
if ($typeEvenement == 'arrete'){ |
3985 |
|
$metadata = array_merge($metadata, $this->getMetadata("arrete")); |
3986 |
|
} |
3987 |
|
|
3988 |
|
// Filtre pour conserver uniquement les métadonnées liées aux dates |
3989 |
|
$metadataToKeep = array( |
3990 |
|
"statutAutorisation", |
3991 |
|
"dateEvenementDocument", |
3992 |
|
'date_cloture_metier', |
3993 |
|
"NotificationArrete", |
3994 |
|
"dateNotificationArrete", |
3995 |
|
"controleLegalite", |
3996 |
|
"dateSignature", |
3997 |
|
"nomSignataire", |
3998 |
|
"qualiteSignataire", |
3999 |
|
"dateControleLegalite", |
4000 |
|
); |
4001 |
|
$metadata = array_filter( |
4002 |
|
$metadata, |
4003 |
|
function($key) use ($metadataToKeep) { return in_array($key, $metadataToKeep); }, |
4004 |
|
ARRAY_FILTER_USE_KEY |
4005 |
|
); |
4006 |
|
|
4007 |
|
// Mise à jour des métadonnées du document en GED |
4008 |
|
$docUid = $this->getVal("om_fichier_instruction"); |
4009 |
|
$operationOrUID = $this->f->storage->update_metadata($docUid, $metadata); |
4010 |
|
if ($operationOrUID == 'OP_FAILURE') { |
4011 |
|
$this->correct = false; |
4012 |
|
$this->addToMessage(__("Erreur de traitement de fichier.")); |
4013 |
|
$this->addToLog(__METHOD__."() failed to update metadata: ".var_export($operationOrUID, true), DEBUG_MODE); |
4014 |
|
return false; |
4015 |
|
} |
4016 |
|
|
4017 |
|
// mise à jour de l'UID du document en BDD |
4018 |
|
else { |
4019 |
|
$valF = array('om_fichier_instruction' => $operationOrUID); |
4020 |
|
$res = $this->f->db->autoExecute(DB_PREFIXE.$this->table, $valF, DB_AUTOQUERY_UPDATE, $this->getCle($id)); |
4021 |
|
$this->addToLog(__METHOD__.'() : db->autoExecute("'.DB_PREFIXE.$this->table.'", '.print_r($valF, true).', DB_AUTOQUERY_UPDATE, "'.$this->getCle($id).'")', VERBOSE_MODE); |
4022 |
|
if ($this->f->isDatabaseError($res, true) === true) { |
4023 |
|
$this->correct = false; |
4024 |
|
$this->addToMessage(__("Erreur de traitement de fichier.")); |
4025 |
|
$this->addToLog(__METHOD__."() erreur BDD: ".var_export($res->getMessage(), true), DEBUG_MODE); |
4026 |
|
return false; |
4027 |
|
} |
4028 |
|
$this->addToMessage(__("La mise a jour du document s'est effectuee avec succes.")); |
4029 |
|
} |
4030 |
|
} |
4031 |
|
|
4032 |
|
// Notification auto des demandeurs |
4033 |
|
if ($dateRetourSignatureModified === true |
4034 |
|
&& $this->valF['date_retour_signature'] !== '' |
4035 |
|
&& $this->valF['date_retour_signature'] !== null) { |
4036 |
|
// |
4037 |
|
$ev = $this->get_inst_evenement($this->valF['evenement']); |
4038 |
|
if ($ev->getVal('notification') === 'notification_auto_signature_requise') { |
4039 |
|
// Récupération de la liste des demandeurs à notifier et de la catégorie |
4040 |
|
$categorie = $this->f->get_param_option_notification($collectivite_di); |
4041 |
|
$isPortal = $categorie == null || $categorie == '' || $categorie == 'portal' ? true : false; |
4042 |
|
$demandeursANotifie = $this->get_demandeurs_notifiable( |
4043 |
|
$this->valF['dossier'], |
4044 |
|
$isPortal |
4045 |
|
); |
4046 |
|
|
4047 |
|
// Création d'une notification et d'une tâche pour chaque demandeur à notifier |
4048 |
|
foreach ($demandeursANotifie as $demandeur) { |
4049 |
|
// Ajout de la notif et récupération de son id |
4050 |
|
$idNotif = $this->ajouter_notification( |
4051 |
|
$this->valF[$this->clePrimaire], |
4052 |
|
$this->f->get_connected_user_login_name(), |
4053 |
|
$demandeur, |
4054 |
|
$collectivite_di, |
4055 |
|
true |
4056 |
|
); |
4057 |
|
if ($idNotif === false) { |
4058 |
|
return false; |
4059 |
|
} |
4060 |
|
// Création de la tache en lui donnant l'id de la notification |
4061 |
|
$notification_by_task = $this->notification_by_task( |
4062 |
|
$idNotif, |
4063 |
|
$this->valF['dossier'], |
4064 |
|
$categorie |
4065 |
|
); |
4066 |
|
if ($notification_by_task === false) { |
4067 |
|
$this->addToMessage( |
4068 |
|
__("Erreur lors de la génération de la notification au(x) pétitionnaire(s).") |
4069 |
|
); |
4070 |
|
return false; |
4071 |
|
} |
4072 |
|
} |
4073 |
|
$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."))); |
4074 |
|
} |
4075 |
|
} |
4076 |
|
|
4077 |
return $this->add_log_to_dossier($id, $val); |
return $this->add_log_to_dossier($id, $val); |
4078 |
} |
} |
4079 |
|
|
4080 |
function triggersupprimer($id,&$db,$val,$DEBUG) { |
/** |
4081 |
|
* TRIGGER - triggersupprimer. |
4082 |
|
* |
4083 |
|
* @return boolean |
4084 |
|
*/ |
4085 |
|
function triggersupprimer($id, &$dnu1 = null, $val = array(), $dnu2 = null) { |
4086 |
|
$this->addToLog(__METHOD__."(): start", EXTRA_VERBOSE_MODE); |
4087 |
/** |
/** |
4088 |
* 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 |
4089 |
* archive dans le dossier d'instruction avant de supprimer l'événement |
* archive dans le dossier d'instruction avant de supprimer l'événement |
4090 |
* d'instruction |
* d'instruction si les valeurs du dossier sont différentes |
4091 |
*/ |
*/ |
4092 |
|
$valF = array(); |
4093 |
// Mise à jour des 4 valeurs modifiées par l'action |
$inst_di = $this->get_inst_dossier($this->getVal('dossier')); |
4094 |
$valF['delai'] = $val['archive_delai']; |
foreach ($inst_di->champs as $key => $champ) { |
4095 |
$valF['accord_tacite'] = $val['archive_accord_tacite']; |
// Si le champ du DI à une archive dans l'instruction |
4096 |
$valF['etat'] = $val['archive_etat']; |
if (isset($val[sprintf('archive_%s', $champ)]) === true) { |
4097 |
if ($val['archive_avis'] != '') { |
// Si la valeur entre le champ du DI et son archive dans instruction |
4098 |
$valF['avis_decision'] = $val['archive_avis']; |
// est différente |
4099 |
} else { |
if ($inst_di->getVal($champ) !== $val[sprintf('archive_%s', $champ)]) { |
4100 |
$valF['avis_decision'] = null; |
$val[sprintf('archive_%s', $champ)] === '' ? $valF[$champ] = null : $valF[$champ] = $val[sprintf('archive_%s', $champ)]; |
4101 |
} |
} |
4102 |
// 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; |
|
4103 |
} |
} |
4104 |
$valF['date_cloture_instruction'] = null; |
// Spécificité du champ avis_decision dont le champ archive est nommé |
4105 |
if ($val['archive_date_cloture_instruction'] !== '') { |
// différemment |
4106 |
$valF['date_cloture_instruction'] = $val['archive_date_cloture_instruction']; |
if ($inst_di->getVal('avis_decision') !== $val['archive_avis']) { |
4107 |
|
$val['archive_avis'] === '' ? $valF['avis_decision'] = null : $valF['avis_decision'] = $val['archive_avis']; |
4108 |
|
} |
4109 |
|
// Spécificité de la date d'affichage dont la valeur n'ai jamais modifiée |
4110 |
|
// par l'archive |
4111 |
|
unset($valF['date_affichage']); |
4112 |
|
|
4113 |
|
/** |
4114 |
|
* Mise à jour de la version de clôture *version_clos* du dossier si et |
4115 |
|
* seulement si l'instruction met à jour l'état du dossier. |
4116 |
|
*/ |
4117 |
|
if (isset($valF['etat']) === true |
4118 |
|
&& $valF['etat'] !== null |
4119 |
|
&& $valF['etat'] !== '') { |
4120 |
|
// Récupère l'état actuel du dossier d'instruction |
4121 |
|
$inst_current_etat = $this->f->get_inst__om_dbform(array( |
4122 |
|
"obj" => "etat", |
4123 |
|
"idx" => $inst_di->get_id_etat(), |
4124 |
|
)); |
4125 |
|
// Instanciation de l'état archivé appliqué sur le dossier |
4126 |
|
$inst_etat = $this->f->get_inst__om_dbform(array( |
4127 |
|
"obj" => "etat", |
4128 |
|
"idx" => $valF['etat'], |
4129 |
|
)); |
4130 |
|
// |
4131 |
|
$update_version_clos = null; |
4132 |
|
// En cas de clôture du dossier par l'état archivé |
4133 |
|
if ($inst_etat->getVal('statut') === 'cloture') { |
4134 |
|
$update_version_clos = $inst_di->update_version_clos('up'); |
4135 |
|
} |
4136 |
|
// En cas de réouverture du dossier par l'état archivé |
4137 |
|
if ($inst_current_etat->getVal('statut') === 'cloture' |
4138 |
|
&& $inst_etat->getVal('statut') !== 'cloture') { |
4139 |
|
// |
4140 |
|
$update_version_clos = $inst_di->update_version_clos('down'); |
4141 |
|
// |
4142 |
|
$this->set_att_di_reopened(true); |
4143 |
|
} |
4144 |
|
// |
4145 |
|
if ($update_version_clos === false) { |
4146 |
|
$this->f->addToLog(sprintf( |
4147 |
|
"%s() : ERREUR - %s %s", |
4148 |
|
__METHOD__, |
4149 |
|
sprintf( |
4150 |
|
__("Impossible de mettre à jour la version de clôture du dossier d'instruction %s."), |
4151 |
|
$inst_di->getVal($inst_di->clePrimaire) |
4152 |
|
), |
4153 |
|
sprintf( |
4154 |
|
__("L'instruction tente d'appliquer l'état %s."), |
4155 |
|
$inst_etat->getVal($inst_etat->clePrimaire) |
4156 |
|
) |
4157 |
|
)); |
4158 |
|
$this->addToMessage(sprintf( |
4159 |
|
"%s %s", |
4160 |
|
__("Erreur lors de la mise à jour de la version de clôture du dossier d'instruction."), |
4161 |
|
__("Veuillez contacter votre administrateur.") |
4162 |
|
)); |
4163 |
|
return false; |
4164 |
|
} |
4165 |
} |
} |
4166 |
// Dates concernant les dossiers contentieux |
// On supprime toutes les notications liées à l'instruction |
4167 |
// Date de première visite |
$notifASupprimer = $this->get_instruction_notification($this->getVal($this->clePrimaire)); |
4168 |
$valF['date_premiere_visite'] = null; |
foreach ($notifASupprimer as $idNotif) { |
4169 |
if ($val['archive_date_premiere_visite'] !== '') { |
$inst_notif = $this->f->get_inst__om_dbform(array( |
4170 |
$valF['date_premiere_visite'] = $val['archive_date_premiere_visite']; |
"obj" => "instruction_notification", |
4171 |
} |
"idx" => $idNotif, |
4172 |
// Date de dernière visite |
)); |
4173 |
$valF['date_derniere_visite'] = null; |
$val_notif = array(); |
4174 |
if ($val['archive_date_derniere_visite'] !== '') { |
foreach ($inst_notif->champs as $champ) { |
4175 |
$valF['date_derniere_visite'] = $val['archive_date_derniere_visite']; |
$val_notif[$champ] = $inst_notif->getVal($champ); |
4176 |
} |
} |
4177 |
// Date contradictoire |
// La suppression des notifications entrainera la suppression des tâches qui y sont |
4178 |
$valF['date_contradictoire'] = null; |
// liées |
4179 |
if ($val['archive_date_contradictoire'] !== '') { |
$supprNotif = $inst_notif->supprimer($val_notif); |
4180 |
$valF['date_contradictoire'] = $val['archive_date_contradictoire']; |
if ($supprNotif == false) { |
4181 |
} |
$this->addToMessage(sprintf( |
4182 |
// Date de retour contradictoire |
"%s %s", |
4183 |
$valF['date_retour_contradictoire'] = null; |
__("Erreur lors de la suppression des notifications de l'instruction."), |
4184 |
if ($val['archive_date_retour_contradictoire'] !== '') { |
__("Veuillez contacter votre administrateur.") |
4185 |
$valF['date_retour_contradictoire'] = $val['archive_date_retour_contradictoire']; |
)); |
4186 |
} |
return false; |
4187 |
// 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']; |
|
4188 |
} |
} |
4189 |
|
|
4190 |
// On met à jour le dossier |
// On met à jour le dossier |
4191 |
$cle = " dossier='".$val['dossier']."'"; |
$valF['instruction'] = $id; |
4192 |
$res = $db->autoExecute(DB_PREFIXE.'dossier', $valF, DB_AUTOQUERY_UPDATE, $cle); |
$valF['crud'] = 'delete'; |
4193 |
$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); |
4194 |
if (database::isError($res)) { |
if ($update_by_instruction === false) { |
4195 |
die($res->getMessage()); |
$this->cleanMessage(); |
4196 |
|
$this->addToMessage(sprintf('%s %s', __("Une erreur s'est produite lors de la mise à jour du dossier d'instruction."), __("Veuillez contacter votre administrateur."))); |
4197 |
|
return false; |
4198 |
} |
} |
4199 |
|
|
4200 |
// Affichage d'informations à l'utilisateur |
// Affichage d'informations à l'utilisateur |
4201 |
$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')."]"); |
4202 |
|
|
4203 |
// 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 |
4204 |
} |
} |
4205 |
|
|
4206 |
function triggersupprimerapres($id,&$db,$val,$DEBUG) { |
/** |
4207 |
|
* TRIGGER - triggersupprimerapres. |
4208 |
|
* |
4209 |
|
* @return boolean |
4210 |
|
*/ |
4211 |
|
function triggersupprimerapres($id, &$dnu1 = null, $val = array(), $dnu2 = null) { |
4212 |
|
$this->addToLog(__METHOD__."(): start", EXTRA_VERBOSE_MODE); |
4213 |
|
/** |
4214 |
|
* Mise à jour de la date de dernière modification du dossier |
4215 |
|
* d'instruction |
4216 |
|
*/ |
4217 |
|
$inst_di = $this->get_inst_dossier($this->getVal('dossier')); |
4218 |
|
$inst_di->update_last_modification_date(); |
4219 |
|
|
4220 |
// Mise à jour des données du dossier d'autorisation |
/** |
4221 |
require_once "../obj/dossier_autorisation.class.php"; |
* Mise à jour des données du dossier d'autorisation |
4222 |
$da = new dossier_autorisation($this->getNumDemandeAutorFromDossier($val["dossier"]), $this->db, DEBUG); |
*/ |
4223 |
if($da->majDossierAutorisation() === false) { |
$da = $this->f->get_inst__om_dbform(array( |
4224 |
|
"obj" => "dossier_autorisation", |
4225 |
|
"idx" => $this->getNumDemandeAutorFromDossier($val["dossier"]), |
4226 |
|
)); |
4227 |
|
$params = array( |
4228 |
|
'di_id' => $this->getVal('dossier'), |
4229 |
|
'di_reopened' => $this->get_att_di_reopened(), |
4230 |
|
); |
4231 |
|
if($da->majDossierAutorisation($params) === false) { |
4232 |
$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.")); |
4233 |
$this->correct = false; |
$this->correct = false; |
4234 |
return false; |
return false; |
4235 |
} |
} |
4236 |
|
|
4237 |
|
/** |
4238 |
|
* Gestion des tâches pour la dématérialisation |
4239 |
|
*/ |
4240 |
|
$inst_task_empty = $this->f->get_inst__om_dbform(array( |
4241 |
|
"obj" => "task", |
4242 |
|
"idx" => 0, |
4243 |
|
)); |
4244 |
|
foreach ($inst_di->task_types as $task_type) { |
4245 |
|
$task_exists = $inst_task_empty->task_exists($task_type, $id); |
4246 |
|
if ($task_exists !== false) { |
4247 |
|
$inst_task = $this->f->get_inst__om_dbform(array( |
4248 |
|
"obj" => "task", |
4249 |
|
"idx" => $task_exists, |
4250 |
|
)); |
4251 |
|
if ($inst_task->getVal('state') === $inst_task::STATUS_NEW || $inst_task->getVal('state') === $inst_task::STATUS_DRAFT) { |
4252 |
|
$task_val = array( |
4253 |
|
'state' => $inst_task::STATUS_CANCELED, |
4254 |
|
); |
4255 |
|
$update_task = $inst_task->update_task(array('val' => $task_val)); |
4256 |
|
if ($update_task === false) { |
4257 |
|
$this->addToMessage(sprintf('%s %s', |
4258 |
|
sprintf(__("Une erreur s'est produite lors de la modification de la tâche %."), $inst_task->getVal($inst_task->clePrimaire)), |
4259 |
|
__("Veuillez contacter votre administrateur.") |
4260 |
|
)); |
4261 |
|
$this->correct = false; |
4262 |
|
return false; |
4263 |
|
} |
4264 |
|
} |
4265 |
|
} |
4266 |
|
} |
4267 |
|
|
4268 |
|
// |
4269 |
$val['evenement'] = $this->getVal('evenement'); |
$val['evenement'] = $this->getVal('evenement'); |
4270 |
return $this->add_log_to_dossier($id, $val); |
return $this->add_log_to_dossier($id, $val); |
4271 |
} |
} |
4272 |
|
|
4273 |
/** |
/** |
4274 |
|
* Permet de mettre la valeur passée en paramètre dans l'attribut de classe |
4275 |
|
* "di_reopened". |
4276 |
|
* |
4277 |
|
* @param boolean $val |
4278 |
|
*/ |
4279 |
|
function set_att_di_reopened($val) { |
4280 |
|
$this->di_reopened = $val; |
4281 |
|
} |
4282 |
|
|
4283 |
|
/** |
4284 |
|
* Permet de récupérer la valeur de l'attribut de classe "di_reopened". |
4285 |
|
* |
4286 |
|
* @return boolean |
4287 |
|
*/ |
4288 |
|
function get_att_di_reopened() { |
4289 |
|
return $this->di_reopened; |
4290 |
|
} |
4291 |
|
|
4292 |
|
/** |
4293 |
* Permet de composer un message d'erreur sur restriction non valide en |
* Permet de composer un message d'erreur sur restriction non valide en |
4294 |
* fonction du contexte. |
* fonction du contexte. |
4295 |
* |
* |
4328 |
} |
} |
4329 |
|
|
4330 |
/** |
/** |
4331 |
* 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] |
|
4332 |
*/ |
*/ |
4333 |
function verifier($val = array(), &$db, $DEBUG) { |
function verifier($val = array(), &$dnu1 = null, $dnu2 = null) { |
4334 |
parent::verifier($val, $db, $DEBUG); |
parent::verifier($val); |
4335 |
|
// |
4336 |
if ( isset($val['evenement']) && is_numeric($val['evenement'])){ |
if ( isset($val['evenement']) && is_numeric($val['evenement'])){ |
4337 |
$restriction = $this->get_restriction($val['evenement']); |
$restriction = $this->get_restriction($val['evenement']); |
4338 |
|
|
4441 |
|
|
4442 |
// |
// |
4443 |
$collectivite = $this->f->getCollectivite($dossier_instruction_om_collectivite); |
$collectivite = $this->f->getCollectivite($dossier_instruction_om_collectivite); |
4444 |
|
|
4445 |
|
// |
4446 |
|
$params = array( |
4447 |
|
"specific" => array(), |
4448 |
|
); |
4449 |
|
// Si la rédaction libre est activée sur l'instruction |
4450 |
|
if ($this->getVal("flag_edition_integrale") == 't') { |
4451 |
|
$params["specific"]["corps"] = array( |
4452 |
|
"mode" => "set", |
4453 |
|
"value" => $this->getVal("corps_om_htmletatex"), |
4454 |
|
); |
4455 |
|
$params["specific"]["titre"] = array( |
4456 |
|
"mode" => "set", |
4457 |
|
"value" => $this->getVal("titre_om_htmletat"), |
4458 |
|
); |
4459 |
|
} |
4460 |
// Génération du PDF |
// Génération du PDF |
4461 |
$result = $this->compute_pdf_output('lettretype', $this->getVal('lettretype'), $collectivite); |
$result = $this->compute_pdf_output('lettretype', $this->getVal('lettretype'), $collectivite, null, $params); |
4462 |
$pdf_output = $result['pdf_output']; |
$pdf_output = $result['pdf_output']; |
4463 |
|
|
4464 |
//Métadonnées du document |
//Métadonnées du document |
4465 |
$metadata = array( |
$metadata = array( |
4466 |
'filename' => 'instruction_'.$id_inst.'.pdf', |
'filename' => 'instruction_'.$id_inst.'.pdf', |
4475 |
$sql = "SELECT type |
$sql = "SELECT type |
4476 |
FROM ".DB_PREFIXE."evenement |
FROM ".DB_PREFIXE."evenement |
4477 |
WHERE evenement = ".$this->getVal("evenement"); |
WHERE evenement = ".$this->getVal("evenement"); |
4478 |
$typeEvenement = $this->db->getOne($sql); |
$typeEvenement = $this->f->db->getOne($sql); |
4479 |
$this->addToLog(__METHOD__."(): db->getOne(\"".$sql."\");", VERBOSE_MODE); |
$this->addToLog(__METHOD__."(): db->getOne(\"".$sql."\");", VERBOSE_MODE); |
4480 |
if ($this->f->isDatabaseError($typeEvenement, true) === true) { |
if ($this->f->isDatabaseError($typeEvenement, true) === true) { |
4481 |
$this->correct = false; |
$this->correct = false; |
4492 |
|
|
4493 |
$metadata = array_merge($metadata, $spe_metadata, $arrete_metadata); |
$metadata = array_merge($metadata, $spe_metadata, $arrete_metadata); |
4494 |
|
|
4495 |
|
/* |
4496 |
|
// transforme le tableau de métadonnées en objet |
4497 |
|
$mdf = new MetadataFactory(); |
4498 |
|
$md = $mdf->build('Instruction', $metadata); |
4499 |
|
*/ |
4500 |
|
|
4501 |
// Si le document a déjà été finalisé on le met à jour |
// Si le document a déjà été finalisé on le met à jour |
4502 |
// en conservant son UID |
// en conservant son UID |
4503 |
if ($this->getVal("om_fichier_instruction") != ''){ |
if ($this->getVal("om_fichier_instruction") != ''){ |
4506 |
} |
} |
4507 |
// 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 |
4508 |
else { |
else { |
4509 |
$uid = $this->f->storage->create($pdf_output, $metadata); |
$uid = $this->f->storage->create($pdf_output, $metadata, "from_content", $this->table.".om_fichier_instruction"); |
4510 |
} |
} |
4511 |
} |
} |
4512 |
|
|
4523 |
if ($uid == '' || $uid == 'OP_FAILURE' ) { |
if ($uid == '' || $uid == 'OP_FAILURE' ) { |
4524 |
$this->correct = false; |
$this->correct = false; |
4525 |
$this->addToMessage($file_msg_error); |
$this->addToMessage($file_msg_error); |
4526 |
$this->addToLog(sprintf($log_msg_error, $id_inst, $uid)); |
$this->addToLog(sprintf($log_msg_error, $id_inst, $uid), DEBUG_MODE); |
4527 |
return $this->end_treatment(__METHOD__, false); |
return $this->end_treatment(__METHOD__, false); |
4528 |
} |
} |
4529 |
|
|
4560 |
$val['archive_date_retour_contradictoire'] = $this->dateDBToForm($val['archive_date_retour_contradictoire']); |
$val['archive_date_retour_contradictoire'] = $this->dateDBToForm($val['archive_date_retour_contradictoire']); |
4561 |
$val['archive_date_ait'] = $this->dateDBToForm($val['archive_date_ait']); |
$val['archive_date_ait'] = $this->dateDBToForm($val['archive_date_ait']); |
4562 |
$val['archive_date_transmission_parquet'] = $this->dateDBToForm($val['archive_date_transmission_parquet']); |
$val['archive_date_transmission_parquet'] = $this->dateDBToForm($val['archive_date_transmission_parquet']); |
4563 |
|
$val['archive_date_affichage'] = $this->dateDBToForm($val['archive_date_affichage']); |
4564 |
$this->setvalF($val); |
$this->setvalF($val); |
4565 |
|
|
4566 |
// Verification de la validite des donnees |
// Verification de la validite des donnees |
4567 |
$this->verifier($this->val, $this->db, DEBUG); |
$this->verifier($this->val); |
4568 |
// Si les verifications precedentes sont correctes, on procede a |
// Si les verifications precedentes sont correctes, on procede a |
4569 |
// la modification, sinon on ne fait rien et on retourne une erreur |
// la modification, sinon on ne fait rien et on retourne une erreur |
4570 |
if ($this->correct === true) { |
if ($this->correct === true) { |
4598 |
|
|
4599 |
// Execution de la requête de modification des donnees de l'attribut |
// Execution de la requête de modification des donnees de l'attribut |
4600 |
// valF de l'objet dans l'attribut table de l'objet |
// valF de l'objet dans l'attribut table de l'objet |
4601 |
$res = $this->db->autoExecute(DB_PREFIXE.$this->table, $valF, |
$res = $this->f->db->autoExecute(DB_PREFIXE.$this->table, $valF, |
4602 |
DB_AUTOQUERY_UPDATE, $this->getCle($id_inst)); |
DB_AUTOQUERY_UPDATE, $this->getCle($id_inst)); |
4603 |
$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); |
4604 |
// |
// |
4619 |
} |
} |
4620 |
// L'appel de verifier() a déjà positionné correct à false |
// L'appel de verifier() a déjà positionné correct à false |
4621 |
// et défini un message d'erreur. |
// et défini un message d'erreur. |
4622 |
$this->addToLog(sprintf($log_msg_error, $id_inst, $uid)); |
$this->addToLog(sprintf($log_msg_error, $id_inst, $uid), DEBUG_MODE); |
4623 |
return $this->end_treatment(__METHOD__, false); |
return $this->end_treatment(__METHOD__, false); |
4624 |
} |
} |
4625 |
|
|
4627 |
* 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 |
4628 |
* @return string numéro de dossier d'instruction |
* @return string numéro de dossier d'instruction |
4629 |
*/ |
*/ |
4630 |
protected function getDossier() { |
protected function getDossier($champ = null) { |
4631 |
if(empty($this->specificMetadata)) { |
if(empty($this->specificMetadata)) { |
4632 |
$this->getSpecificMetadata(); |
$this->getSpecificMetadata(); |
4633 |
} |
} |
4726 |
// Requête sql |
// Requête sql |
4727 |
$sql = "SELECT libelle FROM ".DB_PREFIXE."evenement |
$sql = "SELECT libelle FROM ".DB_PREFIXE."evenement |
4728 |
WHERE evenement=".$evenement; |
WHERE evenement=".$evenement; |
4729 |
$evenement_libelle = $this->db->getOne($sql); |
$evenement_libelle = $this->f->db->getOne($sql); |
4730 |
$this->addToLog("getTitle(): db->getOne(\"".$sql."\");", VERBOSE_MODE); |
$this->addToLog("getTitle(): db->getOne(\"".$sql."\");", VERBOSE_MODE); |
4731 |
if (database::isError($evenement_libelle)) { |
if (database::isError($evenement_libelle)) { |
4732 |
die(); |
die(); |
4788 |
LEFT JOIN ".DB_PREFIXE."groupe |
LEFT JOIN ".DB_PREFIXE."groupe |
4789 |
ON dossier_autorisation_type.groupe = groupe.groupe |
ON dossier_autorisation_type.groupe = groupe.groupe |
4790 |
WHERE dossier.dossier = '".$dossier."'"; |
WHERE dossier.dossier = '".$dossier."'"; |
4791 |
$res = $this->db->query($sql); |
$res = $this->f->db->query($sql); |
4792 |
$this->f->addToLog("getSpecificMetadata() : db->query(".$sql.")", VERBOSE_MODE); |
$this->f->addToLog("getSpecificMetadata() : db->query(".$sql.")", VERBOSE_MODE); |
4793 |
if ( database::isError($res)){ |
if ( database::isError($res)){ |
4794 |
die(); |
die(); |
4833 |
ON |
ON |
4834 |
dossier.etat = etat.etat |
dossier.etat = etat.etat |
4835 |
WHERE dossier ='".$idx."'"; |
WHERE dossier ='".$idx."'"; |
4836 |
$statut = $this->db->getOne($sql); |
$statut = $this->f->db->getOne($sql); |
4837 |
$this->f->addToLog("getStatutAutorisationDossier() : db->getOne(\"".$sql."\")", VERBOSE_MODE); |
$this->f->addToLog("getStatutAutorisationDossier() : db->getOne(\"".$sql."\")", VERBOSE_MODE); |
4838 |
if ( database::isError($statut)){ |
if ( database::isError($statut)){ |
4839 |
die(); |
die(); |
4854 |
// 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 |
4855 |
$sql = "SELECT * FROM ".DB_PREFIXE."dossier |
$sql = "SELECT * FROM ".DB_PREFIXE."dossier |
4856 |
WHERE dossier='".$this->valF['dossier']."'"; |
WHERE dossier='".$this->valF['dossier']."'"; |
4857 |
$res = $this->db->query($sql); |
$res = $this->f->db->query($sql); |
4858 |
$this->addToLog("get_dossier_actual(): db->query(\"".$sql."\");", VERBOSE_MODE); |
$this->addToLog("get_dossier_actual(): db->query(\"".$sql."\");", VERBOSE_MODE); |
4859 |
$this->f->isDatabaseError($res); |
$this->f->isDatabaseError($res); |
4860 |
|
|
4887 |
$return['archive_date_limite_incompletude'] = $row['date_limite_incompletude']; |
$return['archive_date_limite_incompletude'] = $row['date_limite_incompletude']; |
4888 |
$return['archive_delai_incompletude'] = $row['delai_incompletude']; |
$return['archive_delai_incompletude'] = $row['delai_incompletude']; |
4889 |
$return['archive_autorite_competente'] = $row['autorite_competente']; |
$return['archive_autorite_competente'] = $row['autorite_competente']; |
4890 |
|
$return['archive_dossier_instruction_type'] = $row['dossier_instruction_type']; |
4891 |
$return['duree_validite'] = $row['duree_validite']; |
$return['duree_validite'] = $row['duree_validite']; |
4892 |
$return['date_depot'] = $row['date_depot']; |
$return['date_depot'] = $row['date_depot']; |
4893 |
|
$return['date_depot_mairie'] = $row['date_depot_mairie']; |
4894 |
$return['archive_date_cloture_instruction'] = $row['date_cloture_instruction']; |
$return['archive_date_cloture_instruction'] = $row['date_cloture_instruction']; |
4895 |
$return['archive_date_premiere_visite'] = $row['date_premiere_visite']; |
$return['archive_date_premiere_visite'] = $row['date_premiere_visite']; |
4896 |
$return['archive_date_derniere_visite'] = $row['date_derniere_visite']; |
$return['archive_date_derniere_visite'] = $row['date_derniere_visite']; |
4898 |
$return['archive_date_retour_contradictoire'] = $row['date_retour_contradictoire']; |
$return['archive_date_retour_contradictoire'] = $row['date_retour_contradictoire']; |
4899 |
$return['archive_date_ait'] = $row['date_ait']; |
$return['archive_date_ait'] = $row['date_ait']; |
4900 |
$return['archive_date_transmission_parquet'] = $row['date_transmission_parquet']; |
$return['archive_date_transmission_parquet'] = $row['date_transmission_parquet']; |
4901 |
|
$return['archive_date_affichage'] = $row['date_affichage']; |
4902 |
|
$return['archive_pec_metier'] = $row['pec_metier']; |
4903 |
|
$return['archive_a_qualifier'] = $row['a_qualifier']; |
4904 |
} |
} |
4905 |
|
|
4906 |
// Retour de la fonction |
// Retour de la fonction |
4928 |
ON instruction.evenement = evenement.evenement |
ON instruction.evenement = evenement.evenement |
4929 |
WHERE instruction.instruction = $idx"; |
WHERE instruction.instruction = $idx"; |
4930 |
$this->f->addToLog("checkEvenementNonVerrouillable() : db->getOne(\"".$sql."\")", VERBOSE_MODE); |
$this->f->addToLog("checkEvenementNonVerrouillable() : db->getOne(\"".$sql."\")", VERBOSE_MODE); |
4931 |
$res = $this->db->getOne($sql); |
$res = $this->f->db->getOne($sql); |
4932 |
$this->f->isDatabaseError($res); |
$this->f->isDatabaseError($res); |
4933 |
|
|
4934 |
// Si le retour de la requête est true |
// Si le retour de la requête est true |
5016 |
if ($row['date_depot'] != '') { |
if ($row['date_depot'] != '') { |
5017 |
$this->valF['date_depot']= $row['date_depot']; |
$this->valF['date_depot']= $row['date_depot']; |
5018 |
} |
} |
5019 |
|
if ($row['date_depot_mairie'] != '') { |
5020 |
|
$this->valF['date_depot_mairie']= $row['date_depot_mairie']; |
5021 |
|
} |
5022 |
// Dates concernant les dossiers contentieux |
// Dates concernant les dossiers contentieux |
5023 |
if ($row['date_cloture_instruction'] != '') { |
if ($row['date_cloture_instruction'] != '') { |
5024 |
$this->valF['archive_date_cloture_instruction']= $row['date_cloture_instruction']; |
$this->valF['archive_date_cloture_instruction']= $row['date_cloture_instruction']; |
5041 |
if ($row['date_transmission_parquet'] != '') { |
if ($row['date_transmission_parquet'] != '') { |
5042 |
$this->valF['archive_date_transmission_parquet']= $row['date_transmission_parquet']; |
$this->valF['archive_date_transmission_parquet']= $row['date_transmission_parquet']; |
5043 |
} |
} |
5044 |
|
// |
5045 |
|
if ($row['dossier_instruction_type'] != '') { |
5046 |
|
$this->valF['archive_dossier_instruction_type']= $row['dossier_instruction_type']; |
5047 |
|
} |
5048 |
|
if ($row['date_affichage'] != '') { |
5049 |
|
$this->valF['archive_date_affichage']= $row['date_affichage']; |
5050 |
|
} |
5051 |
|
if (isset($row['pec_metier']) === true && $row['pec_metier'] != '') { |
5052 |
|
$this->valF['archive_pec_metier']= $row['pec_metier']; |
5053 |
|
} |
5054 |
|
if (isset($row['a_qualifier']) === true && $row['a_qualifier'] != '') { |
5055 |
|
$this->valF['archive_a_qualifier']= $row['a_qualifier']; |
5056 |
|
} |
5057 |
} |
} |
5058 |
|
|
5059 |
// {{{ |
// {{{ |
5185 |
"datecontrolelegalite"=>"", "ap_numrue"=>"", "ap_nomdelavoie"=>"", |
"datecontrolelegalite"=>"", "ap_numrue"=>"", "ap_nomdelavoie"=>"", |
5186 |
"ap_codepostal"=>"", "ap_ville"=>""); |
"ap_codepostal"=>"", "ap_ville"=>""); |
5187 |
|
|
5188 |
$sqlArrete = "SELECT signataire_arrete.nom as \"nomsignataire\", |
$sqlArrete = "SELECT |
5189 |
|
signataire_arrete.prenom || ' ' ||signataire_arrete.nom as \"nomsignataire\", |
5190 |
signataire_arrete.qualite as \"qualitesignataire\", |
signataire_arrete.qualite as \"qualitesignataire\", |
5191 |
instruction.etat as \"decisionarrete\", |
instruction.etat as \"decisionarrete\", |
5192 |
instruction.date_retour_rar as \"datenotification\", |
instruction.date_retour_rar as \"datenotification\", |
5204 |
LEFT JOIN ".DB_PREFIXE."donnees_techniques ON |
LEFT JOIN ".DB_PREFIXE."donnees_techniques ON |
5205 |
donnees_techniques.dossier_instruction = dossier.dossier |
donnees_techniques.dossier_instruction = dossier.dossier |
5206 |
WHERE instruction.instruction = ".$this->getVal("instruction"); |
WHERE instruction.instruction = ".$this->getVal("instruction"); |
5207 |
$resArrete = $this->db->query($sqlArrete); |
$resArrete = $this->f->db->query($sqlArrete); |
5208 |
$this->f->addToLog("getArreteMetadata(): db->query(\"".$sqlArrete."\");", VERBOSE_MODE); |
$this->f->addToLog("getArreteMetadata(): db->query(\"".$sqlArrete."\");", VERBOSE_MODE); |
5209 |
if ( database::isError($resArrete)){ |
if ( database::isError($resArrete)){ |
5210 |
die(); |
die(); |
5224 |
// Récupère la valeur du champ lettretype |
// Récupère la valeur du champ lettretype |
5225 |
$lettretype = $this->getVal("lettretype"); |
$lettretype = $this->getVal("lettretype"); |
5226 |
// Si le champ est vide |
// Si le champ est vide |
5227 |
if (empty($lettretype)) { |
if ($lettretype !== '' && $lettretype !== null) { |
5228 |
// |
// |
5229 |
return false; |
return true; |
5230 |
} |
} |
5231 |
|
|
5232 |
// |
// |
5233 |
return true; |
return false; |
5234 |
|
} |
5235 |
|
|
5236 |
|
/** |
5237 |
|
* CONDITION - is_modifiable. |
5238 |
|
* |
5239 |
|
* Controle si l'évenement est modifiable. |
5240 |
|
* |
5241 |
|
* @return boolean |
5242 |
|
*/ |
5243 |
|
function is_evenement_modifiable() { |
5244 |
|
$evenement = $this->get_inst_evenement($this->getVal('evenement')); |
5245 |
|
return ! $this->get_boolean_from_pgsql_value($evenement->getVal('non_modifiable')); |
5246 |
} |
} |
5247 |
|
|
5248 |
/** |
/** |
5253 |
* @return boolean |
* @return boolean |
5254 |
*/ |
*/ |
5255 |
function is_editable() { |
function is_editable() { |
5256 |
|
|
5257 |
|
// XXX |
5258 |
|
// 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é) |
5259 |
|
// Si cette tâche identifiée est DONE alors la suppression/modification de cette intruction est impossible |
5260 |
|
|
5261 |
// Contrôle si l'utilisateur possède un bypass |
// Contrôle si l'utilisateur possède un bypass |
5262 |
$bypass = $this->f->isAccredited(get_class($this)."_modifier_bypass"); |
$bypass = $this->f->isAccredited($this->get_absolute_class_name()."_modifier_bypass"); |
5263 |
// |
// |
5264 |
if ($bypass == true) { |
if ($bypass == true) { |
5265 |
// |
// |
5282 |
return true; |
return true; |
5283 |
} |
} |
5284 |
|
|
|
// 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; |
|
|
} |
|
|
|
|
5285 |
// Si l'utilisateur est instructeur de la commune du dossier et que |
// Si l'utilisateur est instructeur de la commune du dossier et que |
5286 |
// l'instruction est créée par un instructeur de la commune |
// l'instruction est créée par un instructeur de la commune |
5287 |
if ($this->is_instructeur_from_collectivite_dossier() === true and |
if ($this->is_instructeur_from_collectivite_dossier() === true and |
5294 |
} |
} |
5295 |
|
|
5296 |
/** |
/** |
5297 |
|
* Vérifie si l'événement est supprimable ou pas. |
5298 |
|
* |
5299 |
|
* @return boolean |
5300 |
|
*/ |
5301 |
|
function is_evenement_supprimable() { |
5302 |
|
// Controle si l'évenement est supprimable |
5303 |
|
$evenement = $this->get_inst_evenement($this->getVal('evenement')); |
5304 |
|
return ! $this->get_boolean_from_pgsql_value($evenement->getVal('non_supprimable')); |
5305 |
|
} |
5306 |
|
|
5307 |
|
/** |
5308 |
* CONDITION - is_deletable. |
* CONDITION - is_deletable. |
5309 |
* |
* |
5310 |
* Condition pour lma modification. |
* Condition pour la suppression. |
5311 |
* |
* |
5312 |
* @return boolean |
* @return boolean |
5313 |
*/ |
*/ |
5314 |
function is_deletable() { |
function is_deletable() { |
5315 |
// Contrôle si l'utilisateur possède un bypass |
|
5316 |
$bypass = $this->f->isAccredited(get_class($this)."_supprimer_bypass"); |
// XXX |
5317 |
|
// 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é) |
5318 |
|
// Si cette tâche identifiée est DONE alors la suppression/modification de cette intruction est impossible |
5319 |
|
|
5320 |
|
// Contrôle si l'utilisateur possède un bypass intégral |
5321 |
|
$bypass = $this->f->isAccredited($this->get_absolute_class_name()."_supprimer_bypass"); |
5322 |
// |
// |
5323 |
if ($bypass == true) { |
if ($bypass == true) { |
5324 |
|
|
5327 |
} |
} |
5328 |
|
|
5329 |
// Si l'utilisateur est un intructeur qui ne correspond pas à la |
// Si l'utilisateur est un intructeur qui ne correspond pas à la |
5330 |
// division du dossier |
// division du dossier et si l'utilisateur n'a pas la permission bypass |
5331 |
if ($this->is_instructeur_from_division_dossier() !== true) { |
// de la division |
5332 |
|
if ($this->is_instructeur_from_division_dossier() === false |
5333 |
|
&& $this->f->isAccredited($this->get_absolute_class_name()."_supprimer_bypass_division") === false) { |
5334 |
|
|
5335 |
// |
// |
5336 |
return false; |
return false; |
5339 |
// l'événement est-il le dernier ? |
// l'événement est-il le dernier ? |
5340 |
$dernier_evenement = false; |
$dernier_evenement = false; |
5341 |
// instanciation dossier |
// instanciation dossier |
5342 |
require_once "../obj/dossier.class.php"; |
$dossier = $this->f->get_inst__om_dbform(array( |
5343 |
$dossier = new dossier($this->getVal('dossier'), $this->db, DEBUG); |
"obj" => "dossier", |
5344 |
|
"idx" => $this->getVal('dossier'), |
5345 |
|
)); |
5346 |
// récupération dernier événement |
// récupération dernier événement |
5347 |
$id_dernier_evenement = $dossier->get_dernier_evenement(); |
$id_dernier_evenement = $dossier->get_dernier_evenement(); |
5348 |
if ($id_dernier_evenement == $this->getVal($this->clePrimaire)) { |
if ($id_dernier_evenement == $this->getVal($this->clePrimaire)) { |
5393 |
*/ |
*/ |
5394 |
function is_addable() { |
function is_addable() { |
5395 |
// Contrôle si l'utilisateur possède un bypass |
// Contrôle si l'utilisateur possède un bypass |
5396 |
$bypass = $this->f->isAccredited(get_class($this)."_ajouter_bypass"); |
$bypass = $this->f->isAccredited($this->get_absolute_class_name()."_ajouter_bypass"); |
5397 |
// |
// |
5398 |
if ($bypass == true) { |
if ($bypass == true) { |
5399 |
|
|
5421 |
*/ |
*/ |
5422 |
function is_finalizable() { |
function is_finalizable() { |
5423 |
// Contrôle si l'utilisateur possède un bypass |
// Contrôle si l'utilisateur possède un bypass |
5424 |
$bypass = $this->f->isAccredited(get_class($this)."_finaliser_bypass"); |
$bypass = $this->f->isAccredited($this->get_absolute_class_name()."_finaliser_bypass"); |
5425 |
// |
// |
5426 |
if ($bypass == true) { |
if ($bypass == true) { |
5427 |
// |
// |
5444 |
return true; |
return true; |
5445 |
} |
} |
5446 |
|
|
|
// 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; |
|
|
} |
|
|
|
|
5447 |
// Si l'utilisateur est instructeur de la commune du dossier et que |
// Si l'utilisateur est instructeur de la commune du dossier et que |
5448 |
// l'instruction est créée par un instructeur de la commune |
// l'instruction est créée par un instructeur de la commune |
5449 |
if ($this->is_instructeur_from_collectivite_dossier() === true and |
if ($this->is_instructeur_from_collectivite_dossier() === true and |
5486 |
*/ |
*/ |
5487 |
function is_unfinalizable(){ |
function is_unfinalizable(){ |
5488 |
// Contrôle si l'utilisateur possède un bypass |
// Contrôle si l'utilisateur possède un bypass |
5489 |
$bypass = $this->f->isAccredited(get_class($this)."_definaliser_bypass"); |
$bypass = $this->f->isAccredited($this->get_absolute_class_name()."_definaliser_bypass"); |
5490 |
// |
// |
5491 |
if ($bypass == true) { |
if ($bypass == true) { |
5492 |
// |
// |
5509 |
return true; |
return true; |
5510 |
} |
} |
5511 |
|
|
|
// 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; |
|
|
} |
|
|
|
|
5512 |
// Si l'utilisateur est instructeur de la commune du dossier et que |
// Si l'utilisateur est instructeur de la commune du dossier et que |
5513 |
// l'instruction est créée par un instructeur de la commune |
// l'instruction est créée par un instructeur de la commune |
5514 |
if ($this->is_instructeur_from_collectivite_dossier() === true and |
if ($this->is_instructeur_from_collectivite_dossier() === true and |
5557 |
|
|
5558 |
|
|
5559 |
// Sinon on vérifie l'éligibilité du dossier au changement de décision |
// Sinon on vérifie l'éligibilité du dossier au changement de décision |
5560 |
$sql = |
// /!\ Requête lié à celles du widget indiquant les dossiers éligible au changement |
5561 |
"SELECT |
// de décision : |
5562 |
|
// * dossier_instruction.class.php : view_widget_dossiers_evenement_retour_finalise() |
5563 |
|
// * dossier_instruction.inc.php : si le paramètre filtre_decision = true |
5564 |
|
$sql = sprintf( |
5565 |
|
'SELECT |
5566 |
dossier.dossier |
dossier.dossier |
5567 |
FROM |
FROM |
5568 |
".DB_PREFIXE."dossier |
%1$sdossier |
5569 |
JOIN ".DB_PREFIXE."instruction ON instruction.instruction = ( |
JOIN %1$setat |
5570 |
SELECT instruction |
ON dossier.etat = etat.etat AND etat.statut = \'encours\' |
5571 |
FROM ".DB_PREFIXE."instruction |
JOIN %1$slien_dossier_demandeur |
5572 |
JOIN ".DB_PREFIXE."evenement on instruction.evenement=evenement.evenement |
ON dossier.dossier = lien_dossier_demandeur.dossier AND lien_dossier_demandeur.petitionnaire_principal IS TRUE |
5573 |
WHERE instruction.dossier = dossier.dossier |
JOIN %1$sdossier_instruction_type |
5574 |
AND evenement.retour IS FALSE |
ON dossier.dossier_instruction_type=dossier_instruction_type.dossier_instruction_type |
5575 |
ORDER BY date_evenement DESC, instruction DESC |
JOIN %1$sinstruction |
5576 |
LIMIT 1 |
-- Recherche de la dernière instruction qui ne soit pas liée à un événement retour |
5577 |
) |
ON instruction.instruction = ( |
5578 |
JOIN ".DB_PREFIXE."evenement ON instruction.evenement=evenement.evenement |
SELECT instruction |
5579 |
JOIN ".DB_PREFIXE."instructeur ON dossier.instructeur=instructeur.instructeur |
FROM %1$sinstruction |
5580 |
JOIN ".DB_PREFIXE."om_utilisateur ON instructeur.om_utilisateur=om_utilisateur.om_utilisateur |
JOIN %1$sevenement ON instruction.evenement=evenement.evenement |
5581 |
JOIN ".DB_PREFIXE."om_collectivite ON om_collectivite.om_collectivite=om_utilisateur.om_collectivite |
AND evenement.retour IS FALSE |
5582 |
JOIN ".DB_PREFIXE."etat ON dossier.etat = etat.etat |
WHERE instruction.dossier = dossier.dossier |
5583 |
|
ORDER BY date_evenement DESC, instruction DESC |
5584 |
|
LIMIT 1 |
5585 |
|
) |
5586 |
|
-- On ne garde que les dossiers pour lesquels la dernière instruction est finalisée |
5587 |
|
-- ou alors pour laquelle l instruction a été ajouté par la commune et est |
5588 |
|
-- non signée, non notifié, etc. |
5589 |
|
AND (instruction.om_final_instruction IS TRUE |
5590 |
|
OR instruction.created_by_commune IS TRUE) |
5591 |
|
AND instruction.date_retour_signature IS NULL |
5592 |
|
AND instruction.date_envoi_rar IS NULL |
5593 |
|
AND instruction.date_retour_rar IS NULL |
5594 |
|
AND instruction.date_envoi_controle_legalite IS NULL |
5595 |
|
AND instruction.date_retour_controle_legalite IS NULL |
5596 |
|
-- On vérifie que l instruction soit un arrêté ou un changement de décision |
5597 |
|
JOIN %1$sevenement |
5598 |
|
ON instruction.evenement=evenement.evenement |
5599 |
|
AND (evenement.type = \'arrete\' |
5600 |
|
OR evenement.type = \'changement_decision\') |
5601 |
|
-- Recherche les informations du pétitionnaire principal pour l affichage |
5602 |
|
JOIN %1$sdemandeur |
5603 |
|
ON lien_dossier_demandeur.demandeur = demandeur.demandeur |
5604 |
|
-- Recherche la collectivité rattachée à l instructeur |
5605 |
|
JOIN %1$sinstructeur |
5606 |
|
ON dossier.instructeur=instructeur.instructeur |
5607 |
|
JOIN %1$sdivision |
5608 |
|
ON instructeur.division=division.division |
5609 |
|
JOIN %1$sdirection |
5610 |
|
ON division.direction=direction.direction |
5611 |
|
JOIN %1$som_collectivite |
5612 |
|
ON direction.om_collectivite=om_collectivite.om_collectivite |
5613 |
WHERE |
WHERE |
5614 |
|
-- Vérification que la décision a été prise par l agglo |
5615 |
( |
om_collectivite.niveau = \'2\' |
5616 |
evenement.type = 'arrete' AND |
AND dossier.dossier = \'%2$s\' |
5617 |
( |
', |
5618 |
instruction.om_final_instruction IS TRUE |
DB_PREFIXE, |
5619 |
OR instruction.created_by_commune IS TRUE |
$idx |
5620 |
) OR |
); |
|
evenement.type = 'changement_decision' |
|
|
) |
|
|
AND evenement.retour IS FALSE |
|
|
AND instruction.date_retour_signature IS NULL |
|
|
AND instruction.date_envoi_rar IS NULL |
|
|
AND instruction.date_retour_rar IS NULL |
|
|
AND instruction.date_envoi_controle_legalite IS NULL |
|
|
AND instruction.date_retour_controle_legalite IS NULL |
|
|
AND etat.statut = 'encours' |
|
|
AND dossier.dossier = '".$idx."' |
|
|
AND om_collectivite.niveau = '2' |
|
|
"; |
|
5621 |
|
|
5622 |
|
|
5623 |
// Si collectivité de l'utilisateur niveau mono alors filtre sur celle-ci |
// Si collectivité de l'utilisateur niveau mono alors filtre sur celle-ci |
5624 |
if ($this->f->isCollectiviteMono($_SESSION['collectivite']) === true) { |
if ($this->f->isCollectiviteMono($_SESSION['collectivite']) === true) { |
5625 |
$sql .= " AND dossier.om_collectivite=".$_SESSION['collectivite']; |
$sql .= sprintf( |
5626 |
|
' AND dossier.om_collectivite=%1$s', |
5627 |
|
$_SESSION['collectivite'] |
5628 |
|
); |
5629 |
} |
} |
5630 |
$res = $this->db->getone($sql); |
$res = $this->f->db->getone($sql); |
5631 |
if (database::isError($res)) { |
if (database::isError($res)) { |
5632 |
die(); |
die(); |
5633 |
} |
} |
5657 |
} |
} |
5658 |
|
|
5659 |
// Contrôle si l'utilisateur possède un bypass |
// Contrôle si l'utilisateur possède un bypass |
5660 |
$bypass = $this->f->isAccredited(get_class($this)."_modification_dates_bypass"); |
$bypass = $this->f->isAccredited($this->get_absolute_class_name()."_modification_dates_bypass"); |
5661 |
if ($bypass === true) { |
if ($bypass === true) { |
5662 |
return true; |
return true; |
5663 |
} |
} |
5664 |
|
|
5665 |
// 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 |
5666 |
|
// un utilisateur lié à un instructeur |
5667 |
|
$perm_moni_dates_d_closed = $this->f->isAccredited($this->get_absolute_class_name()."_modification_dates_cloture"); |
5668 |
|
|
5669 |
|
// On vérifie en premier lieu que le DI n'est pas clôturé et que |
5670 |
|
// l'utilisateur ne possède pas la permission de modifier le suivi des |
5671 |
|
// dates sur un dossier clôturé |
5672 |
$inst_dossier = $this->get_inst_dossier(); |
$inst_dossier = $this->get_inst_dossier(); |
5673 |
if ($inst_dossier->getStatut() === 'cloture') { |
if ($inst_dossier->getStatut() === 'cloture' |
5674 |
|
&& $perm_moni_dates_d_closed === false) { |
5675 |
// |
// |
5676 |
return false; |
return false; |
5677 |
} |
} |
5733 |
// 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 |
5734 |
// dites de TREATMENT. |
// dites de TREATMENT. |
5735 |
$this->begin_treatment(__METHOD__); |
$this->begin_treatment(__METHOD__); |
5736 |
|
$message = ''; |
5737 |
|
$ev = $this->get_inst_evenement($this->getVal('evenement')); |
5738 |
|
|
5739 |
|
// Controle du signataire |
5740 |
|
if (! $this->controle_signataire($ev)) { |
5741 |
|
$this->addToMessage(__("Le document ne peut pas être finalisé car aucun signataire n'a été sélectionné.")); |
5742 |
|
// Termine le traitement |
5743 |
|
return $this->end_treatment(__METHOD__, false); |
5744 |
|
} |
5745 |
|
|
5746 |
// Traitement de la finalisation |
// Traitement de la finalisation |
5747 |
$ret = $this->manage_finalizing("finalize", $val); |
$ret = $this->manage_finalizing("finalize", $val); |
5753 |
return $this->end_treatment(__METHOD__, false); |
return $this->end_treatment(__METHOD__, false); |
5754 |
} |
} |
5755 |
|
|
5756 |
|
// Envoi des notifications aux demandeurs si la notification est automatique |
5757 |
|
// et que la signature n'est pas requise |
5758 |
|
if ($ev->getVal('notification') === 'notification_automatique') { |
5759 |
|
// Récupération de la catégorie et envoie des notifications au(x) demandeur(s) |
5760 |
|
$collectivite_di = $this->get_dossier_instruction_om_collectivite($this->getVal('dossier')); |
5761 |
|
// Récupération de la liste des demandeurs à notifier et de la catégorie |
5762 |
|
$categorie = $this->f->get_param_option_notification($collectivite_di); |
5763 |
|
$isPortal = $categorie == null || $categorie == '' || $categorie == 'portal' ? true : false; |
5764 |
|
$demandeursANotifie = $this->get_demandeurs_notifiable( |
5765 |
|
$this->getVal('dossier'), |
5766 |
|
$isPortal |
5767 |
|
); |
5768 |
|
|
5769 |
|
// Création d'une notification et d'une tâche pour chaque demandeur à notifier |
5770 |
|
if (count($demandeursANotifie) > 0) { |
5771 |
|
foreach ($demandeursANotifie as $demandeur) { |
5772 |
|
// Ajout de la notif et récupération de son id |
5773 |
|
$idNotif = $this->ajouter_notification( |
5774 |
|
$this->getVal($this->clePrimaire), |
5775 |
|
$this->f->get_connected_user_login_name(), |
5776 |
|
$demandeur, |
5777 |
|
$collectivite_di, |
5778 |
|
true |
5779 |
|
); |
5780 |
|
if ($idNotif === false) { |
5781 |
|
// Termine le traitement |
5782 |
|
return $this->end_treatment(__METHOD__, false); |
5783 |
|
} |
5784 |
|
$notification_by_task = $this->notification_by_task( |
5785 |
|
$idNotif, |
5786 |
|
$this->getVal('dossier'), |
5787 |
|
$categorie |
5788 |
|
); |
5789 |
|
if ($notification_by_task === false) { |
5790 |
|
$this->addToMessage( |
5791 |
|
__("Erreur lors de la génération de la notification au(x) pétitionnaire(s).") |
5792 |
|
); |
5793 |
|
// Termine le traitement |
5794 |
|
return $this->end_treatment(__METHOD__, false); |
5795 |
|
} |
5796 |
|
} |
5797 |
|
$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."))); |
5798 |
|
} |
5799 |
|
} |
5800 |
|
|
5801 |
// Termine le traitement |
// Termine le traitement |
5802 |
return $this->end_treatment(__METHOD__, true); |
return $this->end_treatment(__METHOD__, true); |
5803 |
} |
} |
5804 |
|
|
5805 |
/** |
/** |
5806 |
|
* Vérifie si le signataire est obligatoire pour finaliser |
5807 |
|
* le document apartir du paramétrage de l'événement. |
5808 |
|
* Si c'est le cas, vérifie si il y a bien un signataire |
5809 |
|
* renseigné. |
5810 |
|
* Si c'est le cas renvoie true, sinon renvoie false. |
5811 |
|
* |
5812 |
|
* @param evenement évenement de l'instruction permettant de |
5813 |
|
* récupérer le paramétrage |
5814 |
|
* @return boolean |
5815 |
|
*/ |
5816 |
|
protected function controle_signataire($evenement) { |
5817 |
|
// Vérifie si le signataire est obligatoire et si c'est le cas |
5818 |
|
// vérifie si il y a bien un signataire pour le document |
5819 |
|
if ($evenement->is_signataire_obligatoire() && |
5820 |
|
($this->getVal('signataire_arrete') === null || |
5821 |
|
$this->getVal('signataire_arrete') === '')) { |
5822 |
|
return false; |
5823 |
|
} |
5824 |
|
return true; |
5825 |
|
} |
5826 |
|
|
5827 |
|
/** |
5828 |
* TREATMENT - unfinalize. |
* TREATMENT - unfinalize. |
5829 |
* |
* |
5830 |
* Permet de définaliser un enregistrement. |
* Permet de définaliser un enregistrement. |
5867 |
&& $this->getVal("om_final_instruction") != null) { |
&& $this->getVal("om_final_instruction") != null) { |
5868 |
|
|
5869 |
// Ouvre le document |
// Ouvre le document |
5870 |
$lien = '../spg/file.php?obj='.$this->table.'&'. |
$lien = '../app/index.php?module=form&snippet=file&obj='.$this->table.'&'. |
5871 |
'champ=om_fichier_instruction&id='.$this->getVal($this->clePrimaire); |
'champ=om_fichier_instruction&id='.$this->getVal($this->clePrimaire); |
5872 |
// |
// |
5873 |
header("Location: ".$lien); |
header("Location: ".$lien); |
5886 |
"mode" => "previsualisation", |
"mode" => "previsualisation", |
5887 |
), |
), |
5888 |
); |
); |
5889 |
|
// Si la rédaction libre est activée sur l'instruction |
5890 |
|
if ($this->getVal("flag_edition_integrale") == 't') { |
5891 |
|
$params["specific"]["corps"] = array( |
5892 |
|
"mode" => "set", |
5893 |
|
"value" => $this->getVal("corps_om_htmletatex"), |
5894 |
|
); |
5895 |
|
$params["specific"]["titre"] = array( |
5896 |
|
"mode" => "set", |
5897 |
|
"value" => $this->getVal("titre_om_htmletat"), |
5898 |
|
); |
5899 |
|
} |
5900 |
|
|
5901 |
// Génération du PDF |
// Génération du PDF |
5902 |
$result = $this->compute_pdf_output('lettretype', $this->getVal("lettretype"), $collectivite, null, $params); |
$result = $this->compute_pdf_output('lettretype', $this->getVal("lettretype"), $collectivite, null, $params); |
5911 |
/** |
/** |
5912 |
* Récupère la collectivité du dossier d'instruction. |
* Récupère la collectivité du dossier d'instruction. |
5913 |
* |
* |
5914 |
|
* @param string $dossier_instruction_id Identifiant du DI. |
5915 |
|
* |
5916 |
* @return integer |
* @return integer |
5917 |
*/ |
*/ |
5918 |
function get_dossier_instruction_om_collectivite() { |
function get_dossier_instruction_om_collectivite($dossier_instruction_id = null) { |
5919 |
|
|
5920 |
|
// Si l'identifiant n'est pas renseigné |
5921 |
|
if ($dossier_instruction_id === null) { |
5922 |
|
// Récupère la valeur |
5923 |
|
if ($this->getVal('dossier') !== null && $this->getVal('dossier') !== '') { |
5924 |
|
$dossier_instruction_id = $this->getVal('dossier'); |
5925 |
|
} elseif ($this->getParameter('idxformulaire') !== null |
5926 |
|
&& $this->getParameter('idxformulaire') !== '') { |
5927 |
|
// |
5928 |
|
$dossier_instruction_id = $this->getParameter('idxformulaire'); |
5929 |
|
} elseif ($this->f->get_submitted_get_value('idxformulaire') !== null |
5930 |
|
&& $this->f->get_submitted_get_value('idxformulaire') !== '') { |
5931 |
|
// |
5932 |
|
$dossier_instruction_id = $this->f->get_submitted_get_value('idxformulaire'); |
5933 |
|
} |
5934 |
|
} |
5935 |
|
|
5936 |
// |
// |
5937 |
require_once "../obj/dossier_instruction.class.php"; |
$dossier_instruction = $this->f->get_inst__om_dbform(array( |
5938 |
$dossier_instruction = new dossier_instruction($this->getVal('dossier'), $this->f->db, false); |
"obj" => "dossier_instruction", |
5939 |
|
"idx" => $dossier_instruction_id, |
5940 |
|
)); |
5941 |
|
|
5942 |
// |
// |
5943 |
return $dossier_instruction->getVal('om_collectivite'); |
return $dossier_instruction->getVal('om_collectivite'); |
5954 |
// Vérification de l'accessibilité sur l'élément |
// Vérification de l'accessibilité sur l'élément |
5955 |
$this->checkAccessibility(); |
$this->checkAccessibility(); |
5956 |
|
|
|
// XXX APP |
|
|
|
|
|
$f = $this->f; |
|
|
|
|
5957 |
/** |
/** |
5958 |
* Affichage de la structure HTML |
* Affichage de la structure HTML |
5959 |
*/ |
*/ |
5960 |
// |
// |
5961 |
if ($f->isAjaxRequest()) { |
if ($this->f->isAjaxRequest()) { |
5962 |
// |
// |
5963 |
header("Content-type: text/html; charset=".HTTPCHARSET.""); |
header("Content-type: text/html; charset=".HTTPCHARSET.""); |
5964 |
} else { |
} else { |
5965 |
// |
// |
5966 |
$f->setFlag("htmlonly"); |
$this->f->setFlag("htmlonly"); |
5967 |
$f->display(); |
$this->f->display(); |
5968 |
} |
} |
5969 |
// |
// |
5970 |
$f->displayStartContent(); |
$this->f->displayStartContent(); |
5971 |
// |
// |
5972 |
$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")); |
5973 |
$f->displayTitle(); |
$this->f->displayTitle(); |
5974 |
|
|
5975 |
/** |
/** |
5976 |
* |
* |
5977 |
*/ |
*/ |
5978 |
// |
// |
5979 |
($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 = ""); |
5980 |
$evenement = intval($evenement); |
$evenement = intval($evenement); |
5981 |
// |
// |
5982 |
($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 = ""); |
5983 |
// Récupération du code du type de DA |
// Récupération du code du type de DA |
5984 |
$code_da_type = ''; |
$code_da_type = ''; |
5985 |
if (preg_match('/[A-Za-z]{2,3}/', $idx, $matches) !== false) { |
if (preg_match('/[A-Za-z]{2,3}/', $idx, $matches) !== false) { |
5986 |
$code_da_type = $matches[0]; |
$code_da_type = $matches[0]; |
5987 |
} |
} |
5988 |
// |
// |
5989 |
($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"); |
5990 |
|
|
5991 |
// Récupération de la collectivité du dossier |
// Récupération de la collectivité du dossier |
5992 |
require_once "../obj/dossier.class.php"; |
$dossier = $this->f->get_inst__om_dbform(array( |
5993 |
$dossier = new dossier($idx, $f->db, DEBUG); |
"obj" => "dossier", |
5994 |
|
"idx" => $idx, |
5995 |
|
)); |
5996 |
|
|
5997 |
/** |
/** |
5998 |
* |
* |
6004 |
ON bible.dossier_autorisation_type=dossier_autorisation_type.dossier_autorisation_type |
ON bible.dossier_autorisation_type=dossier_autorisation_type.dossier_autorisation_type |
6005 |
LEFT JOIN ".DB_PREFIXE."om_collectivite |
LEFT JOIN ".DB_PREFIXE."om_collectivite |
6006 |
ON bible.om_collectivite = om_collectivite.om_collectivite |
ON bible.om_collectivite = om_collectivite.om_collectivite |
6007 |
WHERE evenement=".$evenement." |
WHERE (evenement=".$evenement." OR evenement IS NULL) |
6008 |
AND complement=".$complement." |
AND (complement=".$complement." OR complement IS NULL) |
6009 |
AND (bible.dossier_autorisation_type IS NULL |
AND (bible.dossier_autorisation_type IS NULL |
6010 |
OR dossier_autorisation_type.code ='".$code_da_type."') |
OR dossier_autorisation_type.code ='".$code_da_type."') |
6011 |
AND (om_collectivite.niveau = '2' |
AND (om_collectivite.niveau = '2' |
6012 |
OR bible.om_collectivite = ".$dossier->getVal("om_collectivite").") |
OR bible.om_collectivite = ".$dossier->getVal("om_collectivite").") |
6013 |
ORDER BY bible_lib ASC"; |
ORDER BY bible_lib ASC"; |
6014 |
$res = $f->db->query($sql); |
$res = $this->f->db->query($sql); |
6015 |
$f->addToLog(__METHOD__.": db->query(\"".$sql."\");", VERBOSE_MODE); |
$this->f->addToLog(__METHOD__.": db->query(\"".$sql."\");", VERBOSE_MODE); |
6016 |
$f->isDatabaseError($res); |
$this->f->isDatabaseError($res); |
6017 |
// |
// |
6018 |
echo "<form method=\"post\" name=\"f3\" action=\"#\">\n"; |
echo "<form method=\"post\" name=\"f3\" action=\"#\">\n"; |
6019 |
// |
// |
6045 |
echo "\t</table>\n"; |
echo "\t</table>\n"; |
6046 |
// |
// |
6047 |
echo "<div class=\"formControls\">\n"; |
echo "<div class=\"formControls\">\n"; |
6048 |
$f->layout->display_form_button(array( |
$this->f->layout->display_form_button(array( |
6049 |
"value" => _("Valider"), |
"value" => _("Valider"), |
6050 |
"onclick" => "bible_return('f2', 'complement".($complement == "1" ? "" : $complement)."_om_html'); return false;", |
"onclick" => "bible_return('f2', 'complement".($complement == "1" ? "" : $complement)."_om_html'); return false;", |
6051 |
)); |
)); |
6052 |
$f->displayLinkJsCloseWindow(); |
$this->f->displayLinkJsCloseWindow(); |
6053 |
echo "</div>\n"; |
echo "</div>\n"; |
6054 |
|
|
6055 |
} else { |
} else { |
6056 |
// |
// |
6057 |
$message_class = "error"; |
$message_class = "error"; |
6058 |
$message = _("Aucun element dans la bible pour l'evenement")." : ".$evenement; |
$message = _("Aucun element dans la bible pour l'evenement")." : ".$evenement; |
6059 |
$f->displayMessage($message_class, $message); |
$this->f->displayMessage($message_class, $message); |
6060 |
// |
// |
6061 |
echo "<div class=\"formControls\">\n"; |
echo "<div class=\"formControls\">\n"; |
6062 |
$f->displayLinkJsCloseWindow(); |
$this->f->displayLinkJsCloseWindow(); |
6063 |
echo "</div>\n"; |
echo "</div>\n"; |
6064 |
} |
} |
6065 |
// |
// |
6069 |
* Affichage de la structure HTML |
* Affichage de la structure HTML |
6070 |
*/ |
*/ |
6071 |
// |
// |
6072 |
$f->displayEndContent(); |
$this->f->displayEndContent(); |
6073 |
} |
} |
6074 |
|
|
6075 |
/** |
/** |
6082 |
function view_bible_auto() { |
function view_bible_auto() { |
6083 |
// Vérification de l'accessibilité sur l'élément |
// Vérification de l'accessibilité sur l'élément |
6084 |
$this->checkAccessibility(); |
$this->checkAccessibility(); |
|
|
|
|
// XXX APP |
|
|
|
|
|
$f = $this->f; |
|
|
|
|
6085 |
// |
// |
6086 |
$f->disableLog(); |
$this->f->disableLog(); |
6087 |
|
|
6088 |
$formatDate="AAAA-MM-JJ"; |
$formatDate="AAAA-MM-JJ"; |
6089 |
|
|
6090 |
// Récupération des paramètres |
// Récupération des paramètres |
6091 |
$idx = $f->get_submitted_get_value('idx'); |
$idx = $this->f->get_submitted_get_value('idx'); |
6092 |
$evenement = $f->get_submitted_get_value('ev'); |
$evenement = $this->f->get_submitted_get_value('ev'); |
6093 |
|
|
6094 |
// Initialisation de la variable de retour |
// Initialisation de la variable de retour |
6095 |
$retour['complement_om_html'] = ''; |
$retour['complement_om_html'] = ''; |
6097 |
$retour['complement3_om_html'] = ''; |
$retour['complement3_om_html'] = ''; |
6098 |
$retour['complement4_om_html'] = ''; |
$retour['complement4_om_html'] = ''; |
6099 |
// Vérification d'une consultation liée à l'événement |
// Vérification d'une consultation liée à l'événement |
6100 |
$consultation = $f->db->getOne( |
$consultation = $this->f->db->getOne( |
6101 |
"select consultation from ".DB_PREFIXE."evenement where evenement=".$evenement |
"select consultation from ".DB_PREFIXE."evenement where evenement=".$evenement |
6102 |
); |
); |
6103 |
$f->isDatabaseError($consultation); |
$this->f->isDatabaseError($consultation); |
6104 |
// Si consultation liée, récupération du retour d'avis |
// Si consultation liée, récupération du retour d'avis |
6105 |
if($consultation=='Oui'){ |
if($consultation=='Oui'){ |
6106 |
$sql="select date_retour,avis_consultation.libelle as avis_consultation, |
$sql = sprintf( |
6107 |
service.libelle as service |
'(SELECT |
6108 |
from ".DB_PREFIXE."consultation inner join ".DB_PREFIXE."service |
date_retour, |
6109 |
on consultation.service =service.service |
avis_consultation.libelle as avis_consultation, |
6110 |
left join ".DB_PREFIXE."avis_consultation on |
COALESCE(service.libelle, tiers_consulte.libelle) as service |
6111 |
consultation.avis_consultation = avis_consultation.avis_consultation |
FROM |
6112 |
where dossier ='".$idx."'"; |
%1$sconsultation |
6113 |
$res = $f->db->query($sql); |
LEFT JOIN %1$stiers_consulte ON consultation.tiers_consulte = tiers_consulte.tiers_consulte |
6114 |
$f->isDatabaseError($res); |
LEFT JOIN %1$sservice ON consultation.service = service.service |
6115 |
|
LEFT JOIN %1$savis_consultation ON consultation.avis_consultation = avis_consultation.avis_consultation |
6116 |
|
WHERE |
6117 |
|
dossier = \'%2$s\' |
6118 |
|
AND consultation.visible)', |
6119 |
|
DB_PREFIXE, |
6120 |
|
$this->f->db->escapeSimple($idx) |
6121 |
|
); |
6122 |
|
$res = $this->f->db->query($sql); |
6123 |
|
$this->f->isDatabaseError($res); |
6124 |
// Récupération des consultations |
// Récupération des consultations |
6125 |
while ($row=& $res->fetchRow(DB_FETCHMODE_ASSOC)){ |
while ($row=& $res->fetchRow(DB_FETCHMODE_ASSOC)){ |
6126 |
$correct=false; |
$correct=false; |
6145 |
$temp=$temp." du ".$date_retour_f; |
$temp=$temp." du ".$date_retour_f; |
6146 |
} |
} |
6147 |
// Concaténation des retours d'avis de consultation |
// Concaténation des retours d'avis de consultation |
6148 |
$retour['complement_om_html'] .= $temp; |
$retour['complement_om_html'] .= $temp . "<br/><br/>"; |
6149 |
} // while |
} // while |
6150 |
|
|
6151 |
} // consultation |
} // consultation |
6152 |
// Récupération des bibles automatiques pour le champ complement_om_html |
// Récupération des bibles automatiques pour le champ complement_om_html |
6153 |
$retour['complement_om_html'] .= $this->getBible($f, $evenement, $idx, '1'); |
$retour['complement_om_html'] .= $this->getBible($evenement, $idx, '1'); |
6154 |
// Récupération des bibles automatiques pour le champ complement2_om_html |
// Récupération des bibles automatiques pour le champ complement2_om_html |
6155 |
$retour['complement2_om_html'] .= $this->getBible($f, $evenement, $idx, '2'); |
$retour['complement2_om_html'] .= $this->getBible($evenement, $idx, '2'); |
6156 |
// Récupération des bibles automatiques pour le champ complement3_om_html |
// Récupération des bibles automatiques pour le champ complement3_om_html |
6157 |
$retour['complement3_om_html'] .= $this->getBible($f, $evenement, $idx, '3'); |
$retour['complement3_om_html'] .= $this->getBible($evenement, $idx, '3'); |
6158 |
// Récupération des bibles automatiques pour le champ complement4_om_html |
// Récupération des bibles automatiques pour le champ complement4_om_html |
6159 |
$retour['complement4_om_html'] .= $this->getBible($f, $evenement, $idx, '4'); |
$retour['complement4_om_html'] .= $this->getBible($evenement, $idx, '4'); |
6160 |
|
|
6161 |
|
|
6162 |
|
|
6164 |
} |
} |
6165 |
|
|
6166 |
/** |
/** |
6167 |
|
* VIEW - view_pdf_temp |
6168 |
|
* |
6169 |
|
* @return void |
6170 |
|
*/ |
6171 |
|
function view_pdf_temp() { |
6172 |
|
$this->checkAccessibility(); |
6173 |
|
// Utilisation de $_POST pour ne pas que les textes soient altérés. |
6174 |
|
$this->f->set_submitted_value(); |
6175 |
|
$merge_fields = array(); |
6176 |
|
// |
6177 |
|
if (array_key_exists('c1', $_POST) === true) { |
6178 |
|
$merge_fields['[complement_instruction]'] = $_POST['c1']; |
6179 |
|
$merge_fields['[complement1_instruction]'] = $_POST['c1']; |
6180 |
|
} |
6181 |
|
if (array_key_exists('c2', $_POST) === true) { |
6182 |
|
$merge_fields['[complement2_instruction]'] = $_POST['c2']; |
6183 |
|
} |
6184 |
|
if (array_key_exists('c3', $_POST) === true) { |
6185 |
|
$merge_fields['[complement3_instruction]'] = $_POST['c3']; |
6186 |
|
} |
6187 |
|
if (array_key_exists('c4', $_POST) === true) { |
6188 |
|
$merge_fields['[complement4_instruction]'] = $_POST['c4']; |
6189 |
|
} |
6190 |
|
$params = array( |
6191 |
|
"watermark" => true, |
6192 |
|
"specific" => array( |
6193 |
|
"merge_fields" => $merge_fields, |
6194 |
|
), |
6195 |
|
); |
6196 |
|
// |
6197 |
|
if (array_key_exists('corps', $_POST) === true) { |
6198 |
|
$params["specific"]["corps"] = array( |
6199 |
|
"mode" => "set", |
6200 |
|
"value" => $_POST['corps'], |
6201 |
|
); |
6202 |
|
} |
6203 |
|
if (array_key_exists('titre', $_POST) === true) { |
6204 |
|
$params["specific"]["titre"] = array( |
6205 |
|
"mode" => "set", |
6206 |
|
"value" => $_POST['titre'], |
6207 |
|
); |
6208 |
|
} |
6209 |
|
$dossier_instruction_om_collectivite = $this->get_dossier_instruction_om_collectivite(); |
6210 |
|
$collectivite = $this->f->getCollectivite($dossier_instruction_om_collectivite); |
6211 |
|
$result = $this->compute_pdf_output('lettretype', $this->getVal('lettretype'), $collectivite, null, $params); |
6212 |
|
$retour = array( |
6213 |
|
'base' => base64_encode($result['pdf_output']), |
6214 |
|
); |
6215 |
|
echo json_encode($retour); |
6216 |
|
} |
6217 |
|
|
6218 |
|
/** |
6219 |
|
* Dans le contexte de prévisualisation des éditions, génère le rendu du |
6220 |
|
* PDF sans prise en compte de la valeur des compléments et le retourne en |
6221 |
|
* base 64. |
6222 |
|
* |
6223 |
|
* @return string Rendu PDF converti en base 64. |
6224 |
|
*/ |
6225 |
|
function init_pdf_temp() { |
6226 |
|
$params = array( |
6227 |
|
"watermark" => true, |
6228 |
|
); |
6229 |
|
// Si la rédaction libre est activée sur l'instruction |
6230 |
|
if ($this->getVal("flag_edition_integrale") == 't') { |
6231 |
|
$params["specific"]["corps"] = array( |
6232 |
|
"mode" => "set", |
6233 |
|
"value" => $this->getVal("corps_om_htmletatex"), |
6234 |
|
); |
6235 |
|
$params["specific"]["titre"] = array( |
6236 |
|
"mode" => "set", |
6237 |
|
"value" => $this->getVal("titre_om_htmletat"), |
6238 |
|
); |
6239 |
|
} |
6240 |
|
$dossier_instruction_om_collectivite = $this->get_dossier_instruction_om_collectivite(); |
6241 |
|
$collectivite = $this->f->getCollectivite($dossier_instruction_om_collectivite); |
6242 |
|
$result = $this->compute_pdf_output('lettretype', $this->getVal('lettretype'), $collectivite, null, $params); |
6243 |
|
|
6244 |
|
return base64_encode($result['pdf_output']); |
6245 |
|
} |
6246 |
|
|
6247 |
|
/** |
6248 |
* Récupération des éléments de bible. |
* Récupération des éléments de bible. |
6249 |
* |
* |
|
* @param utils $f handler de om_application |
|
6250 |
* @param integer $event id de l'événement |
* @param integer $event id de l'événement |
6251 |
* @param string $idx id du dossier |
* @param string $idx id du dossier |
6252 |
* @param integer $compnb numéro du champ complement |
* @param integer $compnb numéro du champ complement |
6253 |
* |
* |
6254 |
* @return string Chaîne de texte à insérer dans le champ complement |
* @return string Chaîne de texte à insérer dans le champ complement |
6255 |
*/ |
*/ |
6256 |
function getBible($f, $event, $idx, $compnb) { |
function getBible($event, $idx, $compnb) { |
6257 |
// Récupération de la collectivité du dossier |
// Récupération de la collectivité du dossier |
6258 |
require_once "../obj/dossier.class.php"; |
$dossier = $this->f->get_inst__om_dbform(array( |
6259 |
$dossier = new dossier($idx, $f->db, DEBUG); |
"obj" => "dossier", |
6260 |
|
"idx" => $idx, |
6261 |
|
)); |
6262 |
// Récupération du code du type de DA |
// Récupération du code du type de DA |
6263 |
$code_da_type = ''; |
$code_da_type = ''; |
6264 |
if (preg_match('/[A-Za-z]{2,3}/', $idx, $matches) !== false) { |
if (preg_match('/[A-Za-z]{2,3}/', $idx, $matches) !== false) { |
6272 |
LEFT JOIN |
LEFT JOIN |
6273 |
".DB_PREFIXE."om_collectivite |
".DB_PREFIXE."om_collectivite |
6274 |
ON bible.om_collectivite = om_collectivite.om_collectivite |
ON bible.om_collectivite = om_collectivite.om_collectivite |
6275 |
WHERE evenement =".$event." and |
WHERE (evenement =".$event." or evenement IS NULL) and |
6276 |
complement=".$compnb." and |
(complement=".$compnb." OR complement IS NULL) and |
6277 |
automatique='Oui' and |
automatique='Oui' and |
6278 |
(dossier_autorisation_type.code ='".$code_da_type."' or |
(dossier_autorisation_type.code ='".$code_da_type."' or |
6279 |
bible.dossier_autorisation_type IS NULL) and |
bible.dossier_autorisation_type IS NULL) and |
6280 |
(om_collectivite.niveau = '2' OR bible.om_collectivite = ".$dossier->getVal("om_collectivite").")"; |
(om_collectivite.niveau = '2' OR bible.om_collectivite = ".$dossier->getVal("om_collectivite").")"; |
6281 |
|
|
6282 |
$res = $f->db->query($sql); |
$res = $this->f->db->query($sql); |
6283 |
$f->isDatabaseError($res); |
$this->f->isDatabaseError($res); |
6284 |
$temp = ""; |
$temp = ""; |
6285 |
while ($row=& $res->fetchRow(DB_FETCHMODE_ASSOC)){ |
while ($row=& $res->fetchRow(DB_FETCHMODE_ASSOC)){ |
6286 |
// Remplacement des retours à la ligne par des br |
// Remplacement des retours à la ligne par des br |
6287 |
$temp .= preg_replace( |
$temp .= preg_replace( |
6288 |
'#(\\\r|\\\r\\\n|\\\n)#', '<br/>', $row['contenu'] |
'#(\\\r|\\\r\\\n|\\\n)#', '<br/>', $row['contenu'] |
6289 |
); |
); |
6290 |
|
// Ajout d'un saut de ligne entre chaque bible. |
6291 |
|
$temp .= '<br/>'; |
6292 |
} // fin while |
} // fin while |
6293 |
return $temp; |
return $temp; |
6294 |
} |
} |
6306 |
// Vérification de l'accessibilité sur l'élément |
// Vérification de l'accessibilité sur l'élément |
6307 |
$this->checkAccessibility(); |
$this->checkAccessibility(); |
6308 |
|
|
|
// XXX APP |
|
|
|
|
|
$f = $this->f; |
|
|
|
|
6309 |
/** |
/** |
6310 |
* Validation du formulaire |
* Validation du formulaire |
6311 |
*/ |
*/ |
6312 |
// Si le formulaire a été validé |
// Si le formulaire a été validé |
6313 |
if ($f->get_submitted_post_value("validation") !== null) { |
if ($this->f->get_submitted_post_value("validation") !== null) { |
6314 |
// Si un bordereau à été sélectionné |
// Si un bordereau à été sélectionné |
6315 |
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") == "" ) { |
6316 |
// Si aucun bordereau n'a été sélectionné |
// Si aucun bordereau n'a été sélectionné |
6317 |
$message_class = "error"; |
$message_class = "error"; |
6318 |
$message = _("Veuillez selectionner un bordereau."); |
$message = _("Veuillez selectionner un bordereau."); |
6319 |
} |
} |
6320 |
// Sinon si les dates ne sont pas valide |
// Sinon si les dates ne sont pas valide |
6321 |
elseif (($f->get_submitted_post_value("date_bordereau_debut") !== null |
elseif (($this->f->get_submitted_post_value("date_bordereau_debut") !== null |
6322 |
&& $f->get_submitted_post_value("date_bordereau_debut") == "") |
&& $this->f->get_submitted_post_value("date_bordereau_debut") == "") |
6323 |
|| ($f->get_submitted_post_value("date_bordereau_fin") !== null |
|| ($this->f->get_submitted_post_value("date_bordereau_fin") !== null |
6324 |
&& $f->get_submitted_post_value("date_bordereau_fin") == "")) { |
&& $this->f->get_submitted_post_value("date_bordereau_fin") == "")) { |
6325 |
// Si aucune date n'a été saisie |
// Si aucune date n'a été saisie |
6326 |
$message_class = "error"; |
$message_class = "error"; |
6327 |
$message = _("Veuillez saisir une date valide."); |
$message = _("Veuillez saisir une date valide."); |
6328 |
} |
} |
6329 |
|
// Sinon si les dates ne sont pas valides |
6330 |
|
elseif ($this->f->get_submitted_post_value("bordereau") === "bordereau_avis_maire_prefet" |
6331 |
|
&& $this->f->getParameter("id_evenement_bordereau_avis_maire_prefet") == null) { |
6332 |
|
// Si aucune date n'a été saisie |
6333 |
|
$message_class = "error"; |
6334 |
|
$message = _("Erreur de parametrage. Contactez votre administrateur."); |
6335 |
|
} |
6336 |
// Affiche le message de validation |
// Affiche le message de validation |
6337 |
else { |
else { |
6338 |
// 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 |
6339 |
$sql = "SELECT om_etat.libelle |
$sql = "SELECT om_etat.libelle |
6340 |
FROM ".DB_PREFIXE."om_etat |
FROM ".DB_PREFIXE."om_etat |
6341 |
WHERE om_etat.id = '".$f->get_submitted_post_value("bordereau")."'"; |
WHERE om_etat.id = '".$this->f->get_submitted_post_value("bordereau")."'"; |
6342 |
$res = $f->db->getone($sql); |
$res = $this->f->db->getone($sql); |
6343 |
$f->addToLog(__METHOD__.": db->getone(\"".$sql."\")", VERBOSE_MODE); |
$this->f->addToLog(__METHOD__.": db->getone(\"".$sql."\")", VERBOSE_MODE); |
6344 |
$f->isDatabaseError($res); |
$this->f->isDatabaseError($res); |
6345 |
// |
// |
6346 |
$message_class = "valid"; |
$message_class = "valid"; |
6347 |
$message = _("Cliquez sur le lien ci-dessous pour telecharger votre bordereau"); |
$message = _("Cliquez sur le lien ci-dessous pour telecharger votre bordereau"); |
6348 |
$message .= " : <br/><br/>"; |
$message .= " : <br/><br/>"; |
6349 |
$message .= "<a class='om-prev-icon pdf-16'"; |
$message .= "<a class='om-prev-icon pdf-16'"; |
6350 |
$message .= " title=\""._("Bordereau")."\""; |
$message .= " title=\""._("Bordereau")."\""; |
6351 |
$message .= "href='../scr/form.php?obj=instruction"; |
$message .= "href='".OM_ROUTE_FORM."&obj=instruction"; |
6352 |
$message .= "&action=220"; |
$message .= "&action=220"; |
6353 |
$message .= "&idx=0"; |
$message .= "&idx=0"; |
6354 |
$message .= "&type_bordereau=".$f->get_submitted_post_value("bordereau"); |
$message .= "&type_bordereau=".$this->f->get_submitted_post_value("bordereau"); |
6355 |
$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"); |
6356 |
$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"); |
6357 |
// Si l'utilisateur est MULTI alors on ajoute le paramètre collectivite |
// Si l'utilisateur est MULTI alors on ajoute le paramètre collectivite |
6358 |
if ($f->get_submitted_post_value("om_collectivite") !== null) { |
if ($this->f->get_submitted_post_value("om_collectivite") !== null) { |
6359 |
$message .= "&collectivite=".$f->get_submitted_post_value("om_collectivite"); |
$message .= "&collectivite=".$this->f->get_submitted_post_value("om_collectivite"); |
6360 |
} |
} |
6361 |
$message .= "'"." target='_blank'>"; |
$message .= "'"." target='_blank'>"; |
6362 |
$message .= $res." "._("du")." ".$f->get_submitted_post_value("date_bordereau_debut") |
$message .= $res." "._("du")." ".$this->f->get_submitted_post_value("date_bordereau_debut") |
6363 |
." "._("au")." ".$f->get_submitted_post_value("date_bordereau_fin"); |
." "._("au")." ".$this->f->get_submitted_post_value("date_bordereau_fin"); |
6364 |
$message .= "</a>"; |
$message .= "</a>"; |
6365 |
} |
} |
6366 |
} |
} |
6370 |
*/ |
*/ |
6371 |
// Affichage du message de validation ou d'erreur |
// Affichage du message de validation ou d'erreur |
6372 |
if (isset($message) && isset($message_class) && $message != "") { |
if (isset($message) && isset($message_class) && $message != "") { |
6373 |
$f->displayMessage($message_class, $message); |
$this->f->displayMessage($message_class, $message); |
6374 |
} |
} |
|
// Inclusion de la classe de gestion des formulaires |
|
|
require_once "../obj/om_formulaire.class.php"; |
|
6375 |
// Ouverture du formulaire |
// Ouverture du formulaire |
6376 |
printf("\t<form"); |
printf("\t<form"); |
6377 |
printf(" method=\"post\""); |
printf(" method=\"post\""); |
6380 |
printf(">\n"); |
printf(">\n"); |
6381 |
// Paramétrage des champs du formulaire |
// Paramétrage des champs du formulaire |
6382 |
$champs = array("date_bordereau_debut", "date_bordereau_fin", "bordereau"); |
$champs = array("date_bordereau_debut", "date_bordereau_fin", "bordereau"); |
6383 |
// 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 |
6384 |
// collectivité dans le formulaire |
// collectivité dans le formulaire |
6385 |
if($_SESSION["niveau"] == 2) { |
if ($_SESSION["niveau"] == 2) { |
6386 |
array_push($champs, "om_collectivite"); |
array_push($champs, "om_collectivite"); |
6387 |
} |
} |
6388 |
// Création d'un nouvel objet de type formulaire |
// Création d'un nouvel objet de type formulaire |
6389 |
$form = new formulaire(NULL, 0, 0, $champs); |
$form = $this->f->get_inst__om_formulaire(array( |
6390 |
|
"validation" => 0, |
6391 |
|
"maj" => 0, |
6392 |
|
"champs" => $champs, |
6393 |
|
)); |
6394 |
// Paramétrage du champ date_bordereau_debut |
// Paramétrage du champ date_bordereau_debut |
6395 |
$form->setLib("date_bordereau_debut", _("date_bordereau_debut")); |
$form->setLib("date_bordereau_debut", _("date_bordereau_debut")); |
6396 |
$form->setType("date_bordereau_debut", "date"); |
$form->setType("date_bordereau_debut", "date"); |
6412 |
$form->setType("bordereau", "select"); |
$form->setType("bordereau", "select"); |
6413 |
$form->setRequired("bordereau"); |
$form->setRequired("bordereau"); |
6414 |
// Valeurs des champs |
// Valeurs des champs |
6415 |
if ($f->get_submitted_post_value("validation") !== null) { |
if ($this->f->get_submitted_post_value("validation") !== null) { |
6416 |
$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")); |
6417 |
$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")); |
6418 |
$form->setVal("bordereau", $f->get_submitted_post_value("bordereau")); |
$form->setVal("bordereau", $this->f->get_submitted_post_value("bordereau")); |
6419 |
$form->setVal("om_collectivite", $f->get_submitted_post_value("om_collectivite")); |
$form->setVal("om_collectivite", $this->f->get_submitted_post_value("om_collectivite")); |
6420 |
} |
} |
6421 |
// 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 |
6422 |
// 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 |
6425 |
FROM ".DB_PREFIXE."om_etat |
FROM ".DB_PREFIXE."om_etat |
6426 |
WHERE om_etat.id LIKE 'bordereau_%' |
WHERE om_etat.id LIKE 'bordereau_%' |
6427 |
ORDER BY om_etat.id"; |
ORDER BY om_etat.id"; |
6428 |
$res = $f->db->query($sql); |
$res = $this->f->db->query($sql); |
6429 |
$f->addToLog(__METHOD__.": db->query(\"".$sql."\")", VERBOSE_MODE); |
$this->f->addToLog(__METHOD__.": db->query(\"".$sql."\")", VERBOSE_MODE); |
6430 |
$f->isDatabaseError($res); |
$this->f->isDatabaseError($res); |
6431 |
// Données du select |
// Données du select |
6432 |
$contenu = array( |
$contenu = array( |
6433 |
0 => array("", ), |
0 => array("", ), |
6438 |
$contenu[1][] = $row['libelle']; |
$contenu[1][] = $row['libelle']; |
6439 |
} |
} |
6440 |
$form->setSelect("bordereau", $contenu); |
$form->setSelect("bordereau", $contenu); |
6441 |
// |
// |
6442 |
if($_SESSION["niveau"] == 2) { |
if ($_SESSION["niveau"] == 2) { |
6443 |
$form->setLib("om_collectivite", _("collectivite")); |
$form->setLib("om_collectivite", _("collectivite")); |
6444 |
$form->setType("om_collectivite", "select"); |
$form->setType("om_collectivite", "select"); |
6445 |
|
|
6446 |
// 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 |
6447 |
// de niveau 1 |
// de niveau 1 |
6448 |
$sql = "SELECT om_collectivite, libelle |
$sql = "SELECT om_collectivite, libelle |
6449 |
FROM ".DB_PREFIXE."om_collectivite |
FROM ".DB_PREFIXE."om_collectivite |
6450 |
WHERE niveau = '1' ORDER BY libelle"; |
WHERE niveau = '1' ORDER BY libelle"; |
6451 |
$res = $f->db->query($sql); |
$res = $this->f->db->query($sql); |
6452 |
$f->addToLog(__METHOD__.": db->query(\"".$sql."\")", VERBOSE_MODE); |
$this->f->addToLog(__METHOD__.": db->query(\"".$sql."\")", VERBOSE_MODE); |
6453 |
$f->isDatabaseError($res); |
$this->f->isDatabaseError($res); |
6454 |
// La valeur par défaut du select est Toutes |
// La valeur par défaut du select est Toutes |
6455 |
$list_collectivites = array( |
$list_collectivites = array( |
6456 |
0 => array("", ), |
0 => array("", ), |
6457 |
1 => array(_("toutes")) |
1 => array(_("toutes")) |
6458 |
); |
); |
|
|
|
|
$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); |
|
|
} |
|
6459 |
|
|
6460 |
|
$id_colls = ""; |
6461 |
|
// On stocke dans $id_colls l'id de toutes les collectivités de niveau 1 séparées |
6462 |
|
// par des virgules, pour un traitement plus facile dans la requête de sous-état |
6463 |
|
while ($row =& $res->fetchRow(DB_FETCHMODE_ASSOC)) { |
6464 |
|
if ($id_colls != "") { |
6465 |
|
$id_colls .= ","; |
6466 |
|
} |
6467 |
|
$id_colls .= $row['om_collectivite']; |
6468 |
|
$list_collectivites[0][] = $row['om_collectivite']; |
6469 |
|
$list_collectivites[1][] = $row['libelle']; |
6470 |
|
} |
6471 |
|
// On affecte la liste d'identifiants à l'option Toutes |
6472 |
|
$list_collectivites[0][0] = $id_colls ; |
6473 |
|
$form->setSelect("om_collectivite", $list_collectivites); |
6474 |
|
} |
6475 |
// Affichage du formulaire |
// Affichage du formulaire |
6476 |
$form->entete(); |
$form->entete(); |
6477 |
$form->afficher($champs, 0, false, false); |
$form->afficher($champs, 0, false, false); |
6478 |
$form->enpied(); |
$form->enpied(); |
6479 |
// Affichage du bouton |
// Affichage du bouton |
6480 |
printf("\t<div class=\"formControls\">\n"); |
printf("\t<div class=\"formControls\">\n"); |
6481 |
$f->layout->display_form_button(array("value" => _("Valider"), "name" => "validation")); |
$this->f->layout->display_form_button(array("value" => _("Valider"), "name" => "validation")); |
6482 |
printf("\t</div>\n"); |
printf("\t</div>\n"); |
6483 |
// Fermeture du formulaire |
// Fermeture du formulaire |
6484 |
printf("\t</form>\n"); |
printf("\t</form>\n"); |
|
|
|
6485 |
} |
} |
6486 |
|
|
6487 |
|
|
6510 |
/** |
/** |
6511 |
* VIEW - view_suivi_envoi_lettre_rar. |
* VIEW - view_suivi_envoi_lettre_rar. |
6512 |
* |
* |
6513 |
* Vu pour imprimer les RAR. |
* Vue pour imprimer les AR. |
6514 |
* |
* |
6515 |
* @return void |
* @return void |
6516 |
*/ |
*/ |
6518 |
// Vérification de l'accessibilité sur l'élément |
// Vérification de l'accessibilité sur l'élément |
6519 |
$this->checkAccessibility(); |
$this->checkAccessibility(); |
6520 |
|
|
|
// XXX APP |
|
|
|
|
|
$f = $this->f; |
|
|
|
|
6521 |
// |
// |
6522 |
if ($f->get_submitted_post_value("date") !== null) { |
if ($this->f->get_submitted_post_value("date") !== null) { |
6523 |
$date = $f->get_submitted_post_value("date"); |
$date = $this->f->get_submitted_post_value("date"); |
6524 |
} else { |
} else { |
6525 |
$date = ""; |
$date = ""; |
6526 |
} |
} |
6527 |
// |
// |
6528 |
if ($f->get_submitted_post_value("liste_code_barres_instruction") !== null) { |
if ($this->f->get_submitted_post_value("liste_code_barres_instruction") !== null) { |
6529 |
$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"); |
6530 |
} else { |
} else { |
6531 |
$liste_code_barres_instruction = ""; |
$liste_code_barres_instruction = ""; |
6532 |
} |
} |
6552 |
* Validation du formulaire |
* Validation du formulaire |
6553 |
*/ |
*/ |
6554 |
// Si le formulaire a été validé |
// Si le formulaire a été validé |
6555 |
if ($f->get_submitted_post_value('validation') !== null) { |
if ($this->f->get_submitted_post_value('validation') !== null) { |
6556 |
// |
// |
6557 |
if (empty($date) || empty($liste_code_barres_instruction)) { |
if (empty($date) || empty($liste_code_barres_instruction)) { |
6558 |
// |
// |
6560 |
$message = _("Tous les champs doivent etre remplis."); |
$message = _("Tous les champs doivent etre remplis."); |
6561 |
} else { |
} else { |
6562 |
// Création d'un tableau d'instruction |
// Création d'un tableau d'instruction |
6563 |
$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")); |
6564 |
// |
// |
6565 |
foreach ($liste as $code_barres) { |
foreach ($liste as $code_barres) { |
6566 |
// On enlève les éventuels espaces saisis |
// On enlève les éventuels espaces saisis |
6582 |
ON dossier_autorisation_type_detaille.dossier_autorisation_type = dossier_autorisation_type.dossier_autorisation_type |
ON dossier_autorisation_type_detaille.dossier_autorisation_type = dossier_autorisation_type.dossier_autorisation_type |
6583 |
INNER JOIN ".DB_PREFIXE."groupe |
INNER JOIN ".DB_PREFIXE."groupe |
6584 |
ON dossier_autorisation_type.groupe = groupe.groupe |
ON dossier_autorisation_type.groupe = groupe.groupe |
|
AND groupe.code != 'CTX' |
|
6585 |
WHERE code_barres='".$this->f->db->escapesimple($code_barres)."'"; |
WHERE code_barres='".$this->f->db->escapesimple($code_barres)."'"; |
6586 |
$nbInstr = $f->db->getone($sql); |
|
6587 |
$f->addToLog(__METHOD__.": db->getone(\"".$sql."\")", VERBOSE_MODE); |
// Ajout d'un filtre sur les groupes auxquels l'utilisateur a accès |
6588 |
$f->isDatabaseError($nbInstr); |
$group_clause = array(); |
6589 |
|
foreach ($_SESSION["groupe"] as $key => $value) { |
6590 |
|
$group_clause[$key] = "(groupe.code = '".$key."'"; |
6591 |
|
if($value["confidentiel"] !== true) { |
6592 |
|
$group_clause[$key] .= " AND dossier_autorisation_type.confidentiel IS NOT TRUE"; |
6593 |
|
} |
6594 |
|
$group_clause[$key] .= ")"; |
6595 |
|
} |
6596 |
|
$conditions = implode(" OR ", $group_clause); |
6597 |
|
$sql .= " AND (" . $conditions . ")"; |
6598 |
|
|
6599 |
|
$nbInstr = $this->f->db->getone($sql); |
6600 |
|
$this->f->addToLog(__METHOD__.": db->getone(\"".$sql."\")", VERBOSE_MODE); |
6601 |
|
$this->f->isDatabaseError($nbInstr); |
6602 |
// |
// |
6603 |
if ($nbInstr == "1") { |
if ($nbInstr == "1") { |
6604 |
// Récupération de la date d'envoi de l'instruction bippé |
// Récupération de la date d'envoi de l'instruction bippé |
6605 |
$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."'"; |
6606 |
$res = $f->db->query($sql); |
$res = $this->f->db->query($sql); |
6607 |
$f->addToLog(__METHOD__.": db->query(\"".$sql."\")", VERBOSE_MODE); |
$this->f->addToLog(__METHOD__.": db->query(\"".$sql."\")", VERBOSE_MODE); |
6608 |
$f->isDatabaseError($res); |
$this->f->isDatabaseError($res); |
6609 |
$row =& $res->fetchRow(DB_FETCHMODE_ASSOC); |
$row =& $res->fetchRow(DB_FETCHMODE_ASSOC); |
6610 |
// Si pas de date ou correspond à la date du formulaire on |
// Si pas de date ou correspond à la date du formulaire on |
6611 |
// effectue le traitement |
// effectue le traitement |
6612 |
if ($row["date_envoi_rar"] == "" || $row["date_envoi_rar"] == $date) { |
if ($row["date_envoi_rar"] == "" || $row["date_envoi_rar"] == $date) { |
6613 |
|
$instr = $this->f->get_inst__om_dbform(array( |
6614 |
require_once '../obj/instruction.class.php'; |
"obj" => "instruction", |
6615 |
require_once '../obj/dossier.class.php'; |
"idx" => $row['instruction'], |
6616 |
|
)); |
|
$instr = new instruction($row['instruction'], $f->db, DEBUG); |
|
6617 |
$valF = array(); |
$valF = array(); |
6618 |
foreach($instr->champs as $id => $champ) { |
foreach($instr->champs as $id => $champ) { |
6619 |
$valF[$champ] = $instr->val[$id]; |
$valF[$champ] = $instr->val[$id]; |
6622 |
# 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 |
6623 |
if ($isAccredited === true |
if ($isAccredited === true |
6624 |
&& array_key_exists($instr->getVal("dossier"), $dossierTab) === false) { |
&& array_key_exists($instr->getVal("dossier"), $dossierTab) === false) { |
6625 |
$dossier = new dossier($instr->getVal("dossier")); |
$dossier = $this->f->get_inst__om_dbform(array( |
6626 |
|
"obj" => "dossier", |
6627 |
|
"idx" => $instr->getVal("dossier"), |
6628 |
|
)); |
6629 |
if ($dossier->is_user_from_allowed_collectivite()){ |
if ($dossier->is_user_from_allowed_collectivite()){ |
6630 |
$dossierTab[$instr->getVal("dossier")] = $dossier; |
$dossierTab[$instr->getVal("dossier")] = $dossier; |
6631 |
} else { |
} else { |
6679 |
$instr->setParameter('maj', 1); |
$instr->setParameter('maj', 1); |
6680 |
$instr->class_actions[1]["identifier"] = |
$instr->class_actions[1]["identifier"] = |
6681 |
"envoi lettre RAR (depuis le menu suivi des pièces)"; |
"envoi lettre RAR (depuis le menu suivi des pièces)"; |
6682 |
if ($instr->modifier($valF, $f->db, DEBUG) == true) { |
if ($instr->modifier($valF) == true) { |
6683 |
$id4Gen[] = $code_barres; |
$id4Gen[] = $code_barres; |
6684 |
$nbLettres ++; |
$nbLettres ++; |
6685 |
} else { |
} else { |
6734 |
*/ |
*/ |
6735 |
// Affichage du message de validation ou d'erreur |
// Affichage du message de validation ou d'erreur |
6736 |
if (isset($message) && isset($message_class) && $message != "") { |
if (isset($message) && isset($message_class) && $message != "") { |
6737 |
$f->displayMessage($message_class, $message); |
$this->f->displayMessage($message_class, $message); |
6738 |
} |
} |
6739 |
// Affichage du message d'erreur |
// Affichage du message d'erreur |
6740 |
if(!empty($error)) { |
if(!empty($error)) { |
6741 |
$f->displayMessage("error", $error); |
$this->f->displayMessage("error", $error); |
6742 |
} |
} |
6743 |
// Affichage du message de validation de la saisie |
// Affichage du message de validation de la saisie |
6744 |
if ($nbLettres > 0) { |
if ($nbLettres > 0) { |
6750 |
echo _("Cliquez sur le lien ci-dessous pour telecharger votre document"); |
echo _("Cliquez sur le lien ci-dessous pour telecharger votre document"); |
6751 |
echo " : \n<br/><br/>"; |
echo " : \n<br/><br/>"; |
6752 |
echo "\n<a class='om-prev-icon pdf-16'"; |
echo "\n<a class='om-prev-icon pdf-16'"; |
6753 |
echo "\n title=\""._("imprimer les RAR")."\""; |
echo "\n title=\""._("imprimer les AR")."\""; |
6754 |
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)."\""; |
6755 |
echo "\n target='_blank'>"; |
echo "\n target='_blank'>"; |
6756 |
echo _("Telecharger le document pour")." ".$nbLettres." "._("RAR"); |
echo _("Telecharger le document pour")." ".$nbLettres." "._("AR"); |
6757 |
echo "\n</a>"; |
echo "\n</a>"; |
6758 |
echo "\n</span>"; |
echo "\n</span>"; |
6759 |
echo "\n</p>"; |
echo "\n</p>"; |
6775 |
echo "\n<br/>"; |
echo "\n<br/>"; |
6776 |
} |
} |
6777 |
foreach ($dossierTab as $dossier) { |
foreach ($dossierTab as $dossier) { |
6778 |
|
|
6779 |
|
$inst_da = $this->get_inst_common("dossier_autorisation", $dossier->getVal('dossier_autorisation')); |
6780 |
|
$inst_datd = $this->get_inst_common("dossier_autorisation_type_detaille", $inst_da->getVal('dossier_autorisation_type_detaille')); |
6781 |
|
$code_datd = $inst_datd->getVal('code'); |
6782 |
|
|
6783 |
|
$obj = "dossier_instruction"; |
6784 |
|
if ($code_datd === 'REC' OR $code_datd === 'REG') { |
6785 |
|
$obj = "dossier_contentieux_tous_recours"; |
6786 |
|
} |
6787 |
|
if ($code_datd === 'IN') { |
6788 |
|
$obj = "dossier_contentieux_toutes_infractions"; |
6789 |
|
} |
6790 |
|
|
6791 |
echo "\n<div class=\"bloc group\">"; |
echo "\n<div class=\"bloc group\">"; |
6792 |
echo "\n<div class=\"field field-type-text\">"; |
echo "\n<div class=\"field field-type-text\">"; |
6793 |
|
|
6794 |
echo "\n<p>"; |
echo "\n<p>"; |
6795 |
echo "\n<span class='text'>"; |
echo "\n<span class='text'>"; |
6796 |
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') . "\""; |
6797 |
echo "\n href=\"../scr/form.php?obj=dossier_instruction&action=3&idx="; |
echo "\n href=\"".OM_ROUTE_FORM."&obj=dossier_instruction&action=3&idx="; |
6798 |
echo $dossier->getVal("dossier"); |
echo $dossier->getVal("dossier"); |
6799 |
echo "\">"; |
echo "\">"; |
6800 |
echo "\n</a>"; |
echo "\n</a>"; |
6801 |
|
|
6802 |
echo "\n<a title=\""._("Consulter")."\" style=\"vertical-align:middle;\""; |
echo "\n<a title=\""._("Consulter")."\" style=\"vertical-align:middle;\""; |
6803 |
echo " href=\"../scr/form.php?obj=dossier_instruction&action=3&idx="; |
echo " href=\"".OM_ROUTE_FORM."&obj="; |
6804 |
|
echo $obj; |
6805 |
|
echo "&action=3&idx="; |
6806 |
echo $dossier->getVal("dossier"); |
echo $dossier->getVal("dossier"); |
6807 |
echo "\">"; |
echo "\">"; |
6808 |
echo $dossier->getVal("dossier_libelle"); |
echo $dossier->getVal("dossier_libelle"); |
6819 |
echo "\n</div>"; |
echo "\n</div>"; |
6820 |
echo "\n</div>"; |
echo "\n</div>"; |
6821 |
} |
} |
|
// Inclusion de la classe de gestion des formulaires |
|
|
require_once "../obj/om_formulaire.class.php"; |
|
6822 |
// Ouverture du formulaire |
// Ouverture du formulaire |
6823 |
echo "\t<form"; |
echo "\t<form"; |
6824 |
echo " method=\"post\""; |
echo " method=\"post\""; |
6828 |
// Paramétrage des champs du formulaire |
// Paramétrage des champs du formulaire |
6829 |
$champs = array("date", "liste_code_barres_instruction"); |
$champs = array("date", "liste_code_barres_instruction"); |
6830 |
// Création d'un nouvel objet de type formulaire |
// Création d'un nouvel objet de type formulaire |
6831 |
$form = new formulaire(NULL, 0, 0, $champs); |
$form = $this->f->get_inst__om_formulaire(array( |
6832 |
|
"validation" => 0, |
6833 |
|
"maj" => 0, |
6834 |
|
"champs" => $champs, |
6835 |
|
)); |
6836 |
// Paramétrage du champ date du formulaire |
// Paramétrage du champ date du formulaire |
6837 |
$form->setLib("date", _("Date")."* :"); |
$form->setLib("date", _("Date")."* :"); |
6838 |
$form->setType("date", "date"); |
$form->setType("date", "date"); |
6852 |
$form->enpied(); |
$form->enpied(); |
6853 |
// Affichage du bouton |
// Affichage du bouton |
6854 |
echo "\t<div class=\"formControls\">\n"; |
echo "\t<div class=\"formControls\">\n"; |
6855 |
$f->layout->display_form_button(array("value" => _("Valider"), "name" => "validation")); |
$this->f->layout->display_form_button(array("value" => _("Valider"), "name" => "validation")); |
6856 |
echo "\t</div>\n"; |
echo "\t</div>\n"; |
6857 |
// Fermeture du formulaire |
// Fermeture du formulaire |
6858 |
echo "\t</form>\n"; |
echo "\t</form>\n"; |
6869 |
// Vérification de l'accessibilité sur l'élément |
// Vérification de l'accessibilité sur l'élément |
6870 |
$this->checkAccessibility(); |
$this->checkAccessibility(); |
6871 |
|
|
|
// XXX APP |
|
|
|
|
|
$f = $this->f; |
|
|
|
|
6872 |
// Récupération des valeur passées en POST ou GET |
// Récupération des valeur passées en POST ou GET |
6873 |
if($f->get_submitted_post_value("type_mise_a_jour") !== null) { |
if($this->f->get_submitted_post_value("type_mise_a_jour") !== null) { |
6874 |
$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"); |
6875 |
} elseif($f->get_submitted_get_value('type_mise_a_jour') !== null) { |
} elseif($this->f->get_submitted_get_value('type_mise_a_jour') !== null) { |
6876 |
$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'); |
6877 |
} else { |
} else { |
6878 |
$type_mise_a_jour = ""; |
$type_mise_a_jour = ""; |
6879 |
} |
} |
6880 |
if($f->get_submitted_post_value('date') !== null) { |
if($this->f->get_submitted_post_value('date') !== null) { |
6881 |
$date = $f->get_submitted_post_value('date'); |
$date = $this->f->get_submitted_post_value('date'); |
6882 |
} elseif($f->get_submitted_get_value('date') !== null) { |
} elseif($this->f->get_submitted_get_value('date') !== null) { |
6883 |
$date = $f->get_submitted_get_value('date'); |
$date = $this->f->get_submitted_get_value('date'); |
6884 |
} else { |
} else { |
6885 |
$date = ""; |
$date = ""; |
6886 |
} |
} |
6887 |
if($f->get_submitted_post_value('code_barres') !== null) { |
if($this->f->get_submitted_post_value('code_barres') !== null) { |
6888 |
$code_barres = $f->get_submitted_post_value('code_barres'); |
$code_barres = $this->f->get_submitted_post_value('code_barres'); |
6889 |
} elseif($f->get_submitted_get_value('code_barres') !== null) { |
} elseif($this->f->get_submitted_get_value('code_barres') !== null) { |
6890 |
$code_barres = $f->get_submitted_get_value('code_barres'); |
$code_barres = $this->f->get_submitted_get_value('code_barres'); |
6891 |
} else { |
} else { |
6892 |
$code_barres = ""; |
$code_barres = ""; |
6893 |
} |
} |
6899 |
$liste_champs=array(); |
$liste_champs=array(); |
6900 |
|
|
6901 |
// Si le formulaire a été validé |
// Si le formulaire a été validé |
6902 |
if ($f->get_submitted_post_value('validation') !== null) { |
if ($this->f->get_submitted_post_value('validation') !== null) { |
6903 |
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)) { |
6904 |
|
|
6905 |
// Vérification de l'existence de l'instruction |
// Vérification de l'existence de l'instruction |
6915 |
ON dossier_autorisation_type_detaille.dossier_autorisation_type = dossier_autorisation_type.dossier_autorisation_type |
ON dossier_autorisation_type_detaille.dossier_autorisation_type = dossier_autorisation_type.dossier_autorisation_type |
6916 |
INNER JOIN ".DB_PREFIXE."groupe |
INNER JOIN ".DB_PREFIXE."groupe |
6917 |
ON dossier_autorisation_type.groupe = groupe.groupe |
ON dossier_autorisation_type.groupe = groupe.groupe |
|
AND groupe.code != 'CTX' |
|
6918 |
WHERE code_barres='".$this->f->db->escapesimple($code_barres)."'"; |
WHERE code_barres='".$this->f->db->escapesimple($code_barres)."'"; |
6919 |
$res = $f->db->query($sql); |
|
6920 |
$f->addToLog(__METHOD__.": db->query(\"".$sql."\")", VERBOSE_MODE); |
// Ajout d'un filtre sur les groupes auxquels l'utilisateur a accès |
6921 |
$f->isDatabaseError($res); |
$group_clause = array(); |
6922 |
|
foreach ($_SESSION["groupe"] as $key => $value) { |
6923 |
|
$group_clause[$key] = "(groupe.code = '".$key."'"; |
6924 |
|
if($value["confidentiel"] !== true) { |
6925 |
|
$group_clause[$key] .= " AND dossier_autorisation_type.confidentiel IS NOT TRUE"; |
6926 |
|
} |
6927 |
|
$group_clause[$key] .= ")"; |
6928 |
|
} |
6929 |
|
$conditions = implode(" OR ", $group_clause); |
6930 |
|
$sql .= " AND (" . $conditions . ")"; |
6931 |
|
|
6932 |
|
|
6933 |
|
$res = $this->f->db->query($sql); |
6934 |
|
$this->f->addToLog(__METHOD__.": db->query(\"".$sql."\")", VERBOSE_MODE); |
6935 |
|
$this->f->isDatabaseError($res); |
6936 |
|
|
6937 |
if($res->numrows() == 1) { |
if($res->numrows() == 1) { |
6938 |
$liste_champs = explode(";", $type_mise_a_jour); |
$liste_champs = explode(";", $type_mise_a_jour); |
6939 |
|
$row =& $res->fetchRow(DB_FETCHMODE_ASSOC); |
6940 |
|
$instr = $this->f->get_inst__om_dbform(array( |
6941 |
|
"obj" => "instruction", |
6942 |
|
"idx" => $row['instruction'], |
6943 |
|
)); |
6944 |
// Mise à jour des dates après l'écran de verification |
// Mise à jour des dates après l'écran de verification |
6945 |
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); |
|
6946 |
$valF = array(); |
$valF = array(); |
6947 |
foreach($instr->champs as $id => $champ) { |
foreach($instr->champs as $id => $champ) { |
6948 |
$valF[$champ] = $instr->val[$id]; |
$valF[$champ] = $instr->val[$id]; |
6985 |
$code_barres = ""; |
$code_barres = ""; |
6986 |
|
|
6987 |
//Désactivation de l'autocommit |
//Désactivation de l'autocommit |
6988 |
$f->db->autoCommit(false); |
$this->f->db->autoCommit(false); |
6989 |
|
|
6990 |
//On modifie les valeurs de l'instruction |
//On modifie les valeurs de l'instruction |
6991 |
$instr->setParameter('maj', 170); |
$instr->setParameter('maj', 170); |
6992 |
$instr->class_actions[170]["identifier"] = |
$instr->class_actions[170]["identifier"] = |
6993 |
"mise à jour des dates (depuis le menu suivi des pièces)"; |
"mise à jour des dates (depuis le menu suivi des pièces)"; |
6994 |
$retour = $instr->modifier($valF, $f->db, DEBUG); |
$retour = $instr->modifier($valF); |
6995 |
|
|
6996 |
//Si une erreur s'est produite, on défait les modifications |
//Si une erreur s'est produite, on défait les modifications |
6997 |
//qui ont été faites |
//qui ont été faites |
7000 |
} |
} |
7001 |
//Sinon, on valide en base de données les modifications |
//Sinon, on valide en base de données les modifications |
7002 |
else { |
else { |
7003 |
$f->db->commit(); |
$this->f->db->commit(); |
7004 |
} |
} |
7005 |
|
|
7006 |
// Variable correct retourné depuis la classe instruction |
// Variable correct retourné depuis la classe instruction |
7041 |
INNER JOIN ".DB_PREFIXE."evenement ON |
INNER JOIN ".DB_PREFIXE."evenement ON |
7042 |
instruction.evenement=evenement.evenement |
instruction.evenement=evenement.evenement |
7043 |
WHERE code_barres='".$code_barres."'"; |
WHERE code_barres='".$code_barres."'"; |
7044 |
$resInfo = $f->db->query($sqlInfo); |
$resInfo = $this->f->db->query($sqlInfo); |
7045 |
$f->isDatabaseError($resInfo); |
$this->f->isDatabaseError($resInfo); |
7046 |
$infos = $resInfo->fetchRow(DB_FETCHMODE_ASSOC); |
$infos = $resInfo->fetchRow(DB_FETCHMODE_ASSOC); |
7047 |
|
|
7048 |
// Vérification de la non modification des dates de suivi |
// Vérification de la non modification des dates de suivi |
7049 |
foreach(explode(";", $type_mise_a_jour) as $champ) { |
foreach(explode(";", $type_mise_a_jour) as $champ) { |
7050 |
|
if ($champ === 'date_envoi_controle_legalite') { |
7051 |
|
if ($instr->is_sent_to_cl() === true) { |
7052 |
|
$error = __("Les dates de suivis ne peuvent etre modifiees"); |
7053 |
|
$date_error = true; |
7054 |
|
break; |
7055 |
|
} |
7056 |
|
} |
7057 |
if($infos[$champ] != "" AND $infos[$champ] != $date) { |
if($infos[$champ] != "" AND $infos[$champ] != $date) { |
7058 |
$error = _("Les dates de suivis ne peuvent etre modifiees"); |
$error = _("Les dates de suivis ne peuvent etre modifiees"); |
7059 |
$date_error = true; |
$date_error = true; |
7060 |
|
break; |
7061 |
} |
} |
7062 |
} |
} |
7063 |
} |
} |
7075 |
*/ |
*/ |
7076 |
// Affichage du message de validation ou d'erreur |
// Affichage du message de validation ou d'erreur |
7077 |
if (isset($message) && isset($message_class) && $message != "") { |
if (isset($message) && isset($message_class) && $message != "") { |
7078 |
$f->displayMessage($message_class, $message); |
$this->f->displayMessage($message_class, $message); |
7079 |
} |
} |
7080 |
// Affichage du message d'erreur |
// Affichage du message d'erreur |
7081 |
if(!empty($error)) { |
if(!empty($error)) { |
7082 |
$f->displayMessage("error", $error); |
$this->f->displayMessage("error", $error); |
7083 |
} |
} |
7084 |
|
|
7085 |
// Affichage du message de validation de la saisie |
// Affichage du message de validation de la saisie |
7086 |
if($correct === true) { |
if($correct === true) { |
7087 |
$f->displayMessage("ok", _("Saisie enregistree")); |
$this->f->displayMessage("ok", _("Saisie enregistree")); |
7088 |
} |
} |
|
// Inclusion de la classe de gestion des formulaires |
|
|
require_once "../obj/om_formulaire.class.php"; |
|
7089 |
// Ouverture du formulaire |
// Ouverture du formulaire |
7090 |
echo "\t<form"; |
echo "\t<form"; |
7091 |
echo " method=\"post\""; |
echo " method=\"post\""; |
7103 |
$champs = array("type_mise_a_jour", "date", "code_barres"); |
$champs = array("type_mise_a_jour", "date", "code_barres"); |
7104 |
} |
} |
7105 |
// Création d'un nouvel objet de type formulaire |
// Création d'un nouvel objet de type formulaire |
7106 |
$form = new formulaire(NULL, 0, 0, $champs); |
$form = $this->f->get_inst__om_formulaire(array( |
7107 |
|
"validation" => 0, |
7108 |
|
"maj" => 0, |
7109 |
|
"champs" => $champs, |
7110 |
|
)); |
7111 |
// Paramétrage des champs du formulaire |
// Paramétrage des champs du formulaire |
7112 |
// Parametrage du champ type_mise_a_jour |
// Parametrage du champ type_mise_a_jour |
7113 |
$form->setLib("type_mise_a_jour", _("Date a mettre a jour")."* :"); |
$form->setLib("type_mise_a_jour", _("Date a mettre a jour")."* :"); |
7137 |
$contenu[1][4] = _("date de retour de controle de legalite"); |
$contenu[1][4] = _("date de retour de controle de legalite"); |
7138 |
|
|
7139 |
$contenu[0][5] = "date_retour_rar"; |
$contenu[0][5] = "date_retour_rar"; |
7140 |
$contenu[1][5] = _("date de retour de l'AR"); |
$contenu[1][5] = __("date de notification du correspondant"); |
7141 |
|
|
7142 |
$form->setSelect("type_mise_a_jour", $contenu); |
$form->setSelect("type_mise_a_jour", $contenu); |
7143 |
|
|
7197 |
$form->setType("autorite_competente", "static"); |
$form->setType("autorite_competente", "static"); |
7198 |
$form->setVal("autorite_competente", $infos['autorite_competente']); |
$form->setVal("autorite_competente", $infos['autorite_competente']); |
7199 |
|
|
7200 |
// Parametrage des libellés d'envoi avec RAR |
// Parametrage des libellés d'envoi avec AR |
7201 |
$form->setLib("date_envoi_rar", _("date_envoi_rar")." :"); |
$form->setLib("date_envoi_rar", __("date_envoi_ar")." :"); |
7202 |
$form->setLib("date_retour_rar", _("date_retour_rar")." :"); |
$form->setLib("date_retour_rar", __("date_notification")." :"); |
7203 |
|
|
7204 |
$form->setLib("date_envoi_signature", _("date_envoi_signature")." :"); |
$form->setLib("date_envoi_signature", _("date_envoi_signature")." :"); |
7205 |
$form->setLib("date_retour_signature", _("date_retour_signature")." :"); |
$form->setLib("date_retour_signature", _("date_retour_signature")." :"); |
7233 |
echo "\t<div class=\"formControls\">\n"; |
echo "\t<div class=\"formControls\">\n"; |
7234 |
// |
// |
7235 |
if(!$date_error) { |
if(!$date_error) { |
7236 |
$f->layout->display_form_button(array("value" => _("Valider"), "name" => "validation")); |
$this->f->layout->display_form_button(array("value" => _("Valider"), "name" => "validation")); |
7237 |
} |
} |
7238 |
// Si pas sur l'écran de validation |
// Si pas sur l'écran de validation |
7239 |
if(isset($infos)) { |
if(isset($infos)) { |
7240 |
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"; |
7241 |
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; |
7242 |
echo "\">Retour</a>"; |
echo "\">Retour</a>"; |
7243 |
} |
} |
7254 |
function view_pdf_lettre_rar() { |
function view_pdf_lettre_rar() { |
7255 |
// Vérification de l'accessibilité sur l'élément |
// Vérification de l'accessibilité sur l'élément |
7256 |
$this->checkAccessibility(); |
$this->checkAccessibility(); |
7257 |
|
// |
7258 |
|
$this->f->disableLog(); |
7259 |
|
|
7260 |
// XXX APP |
if($this->f->get_submitted_get_value('liste') != null) { |
7261 |
|
$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')); |
|
7262 |
|
|
7263 |
// Classe permettant la mise en page de l'édition pdf |
// Classe permettant la mise en page de l'édition pdf |
7264 |
require_once "../obj/pdf_lettre_rar.class.php"; |
require_once "../obj/pdf_lettre_rar.class.php"; |
7265 |
$pdf_lettre_rar = new pdf_lettre_rar('P', 'mm', 'A4'); |
$pdf_lettre_rar = new pdf_lettre_rar('P', 'mm', 'A4'); |
7266 |
// Initialisation de la mise en page |
// Initialisation de la mise en page |
7267 |
$pdf_lettre_rar->init($f); |
$pdf_lettre_rar->init($this->f); |
7268 |
|
|
7269 |
foreach ($listeCodeBarres as $code_barres) { |
foreach ($listeCodeBarres as $code_barres) { |
7270 |
|
|
7271 |
|
// On récupère le dossier |
7272 |
|
$sql = "SELECT dossier |
7273 |
|
FROM " . DB_PREFIXE . "instruction |
7274 |
|
WHERE code_barres = '" . $code_barres . "'"; |
7275 |
|
$dossier = $this->f->db->getOne($sql); |
7276 |
|
$this->f->addToLog(__METHOD__."(): db->getOne(\"".$sql."\")", VERBOSE_MODE); |
7277 |
|
$this->f->isDatabaseError($dossier); |
7278 |
|
$inst_dossier = $this->f->get_inst__om_dbform(array( |
7279 |
|
"obj" => "dossier", |
7280 |
|
"idx" => $dossier, |
7281 |
|
)); |
7282 |
|
|
7283 |
|
// En fonction du type de dossier, on récupère un demandeur différent dans les requêtes |
7284 |
|
$groupe = $inst_dossier->get_type_affichage_formulaire(); |
7285 |
|
switch ($groupe) { |
7286 |
|
case 'CTX IN': |
7287 |
|
$sql_demandeur = "(lien_dossier_demandeur.petitionnaire_principal IS TRUE AND demandeur.type_demandeur='plaignant')"; |
7288 |
|
break; |
7289 |
|
case 'CTX RE': |
7290 |
|
$sql_demandeur = "(lien_dossier_demandeur.petitionnaire_principal IS TRUE AND demandeur.type_demandeur='requerant')"; |
7291 |
|
break; |
7292 |
|
case 'ADS': |
7293 |
|
case 'DPC': |
7294 |
|
case 'CONSULTATION ENTRANTE': |
7295 |
|
default: |
7296 |
|
$sql_demandeur = "((lien_dossier_demandeur.petitionnaire_principal IS TRUE AND demandeur.type_demandeur='petitionnaire') OR demandeur.type_demandeur='delegataire')"; |
7297 |
|
break; |
7298 |
|
} |
7299 |
|
|
7300 |
// Test si l'evenement est de type arrete et si un délégataire a été nommé |
// Test si l'evenement est de type arrete et si un délégataire a été nommé |
7301 |
$sql = "SELECT |
$sql = "SELECT |
7302 |
dossier.dossier_libelle, |
dossier.dossier_libelle, |
7322 |
inner join ".DB_PREFIXE."demandeur on |
inner join ".DB_PREFIXE."demandeur on |
7323 |
demandeur.demandeur=lien_dossier_demandeur.demandeur |
demandeur.demandeur=lien_dossier_demandeur.demandeur |
7324 |
WHERE code_barres='".$code_barres."' |
WHERE code_barres='".$code_barres."' |
7325 |
AND ((lien_dossier_demandeur.petitionnaire_principal IS TRUE AND demandeur.type_demandeur='petitionnaire') |
AND " . $sql_demandeur . " |
|
OR demandeur.type_demandeur='delegataire') |
|
7326 |
GROUP BY dossier.dossier_libelle, evenement.type, phase.code, division.libelle"; |
GROUP BY dossier.dossier_libelle, evenement.type, phase.code, division.libelle"; |
7327 |
|
|
7328 |
$res = $f->db->query($sql); |
$res = $this->f->db->query($sql); |
7329 |
$f->addToLog(__METHOD__.": db->query(\"".$sql."\")", VERBOSE_MODE); |
$this->f->addToLog(__METHOD__.": db->query(\"".$sql."\")", VERBOSE_MODE); |
7330 |
$f->isDatabaseError($res); |
$this->f->isDatabaseError($res); |
7331 |
$testDemandeur = $res->fetchrow(DB_FETCHMODE_ASSOC); |
$testDemandeur = $res->fetchrow(DB_FETCHMODE_ASSOC); |
7332 |
|
|
7333 |
|
|
7376 |
if($testDemandeur['type'] != 'arrete' AND $testDemandeur['nbdemandeur'] > 1) { |
if($testDemandeur['type'] != 'arrete' AND $testDemandeur['nbdemandeur'] > 1) { |
7377 |
$sqlAdresse .= " AND demandeur.type_demandeur='delegataire'"; |
$sqlAdresse .= " AND demandeur.type_demandeur='delegataire'"; |
7378 |
} else { |
} else { |
7379 |
$sqlAdresse .= " AND lien_dossier_demandeur.petitionnaire_principal IS TRUE AND demandeur.type_demandeur='petitionnaire'"; |
$sqlAdresse .= " AND demandeur.type_demandeur='petitionnaire' AND lien_dossier_demandeur.petitionnaire_principal IS TRUE"; |
7380 |
} |
} |
7381 |
|
|
7382 |
$resAdresse = $f->db->query($sqlAdresse); |
$resAdresse = $this->f->db->query($sqlAdresse); |
7383 |
$adresse_dest = $resAdresse->fetchrow(DB_FETCHMODE_ASSOC); |
$adresse_dest = $resAdresse->fetchrow(DB_FETCHMODE_ASSOC); |
7384 |
$f->addToLog(__METHOD__.": db->query(\"".$sqlAdresse."\")", VERBOSE_MODE); |
$this->f->addToLog(__METHOD__.": db->query(\"".$sqlAdresse."\")", VERBOSE_MODE); |
7385 |
$f->isDatabaseError($resAdresse); |
$this->f->isDatabaseError($resAdresse); |
7386 |
|
|
7387 |
// Création adresse destinataire sans ligne vide |
// Création adresse destinataire sans ligne vide |
7388 |
$adresse_destinataire = array(); |
$adresse_destinataire = array(); |
7412 |
$specifique_content[] = $testDemandeur['dossier_libelle']; |
$specifique_content[] = $testDemandeur['dossier_libelle']; |
7413 |
$specifique_content[] = "|||||".$adresse_dest['code_barres']."|||||"; |
$specifique_content[] = "|||||".$adresse_dest['code_barres']."|||||"; |
7414 |
unset($adresse_dest['code_barres']); |
unset($adresse_dest['code_barres']); |
|
|
|
7415 |
// Ajout d'une page aux pdf |
// Ajout d'une page aux pdf |
7416 |
$pdf_lettre_rar->addLetter($adresse_destinataire, $specifique_content, $testDemandeur['code_phase']); |
$pdf_lettre_rar->addLetter($adresse_destinataire, $specifique_content, $testDemandeur['code_phase']); |
7417 |
|
|
7418 |
} |
} |
7419 |
$pdf_output = $pdf_lettre_rar->output("lettre_rar".date("dmYHis").".pdf","S"); |
$pdf_output = $pdf_lettre_rar->output("lettre_rar".date("dmYHis").".pdf","S"); |
7420 |
require_once PATH_OPENMAIRIE."om_edition.class.php"; |
$om_edition = $this->f->get_inst__om_edition(); |
|
$om_edition = new edition(); |
|
7421 |
$om_edition->expose_pdf_output($pdf_output, "lettre_rar".date("dmYHis").".pdf"); |
$om_edition->expose_pdf_output($pdf_output, "lettre_rar".date("dmYHis").".pdf"); |
7422 |
} |
} |
7423 |
} |
} |
7480 |
$message .= "<a class='om-prev-icon pdf-16'"; |
$message .= "<a class='om-prev-icon pdf-16'"; |
7481 |
$message .= " id=\"generer_bordereau_envoi_maire\""; |
$message .= " id=\"generer_bordereau_envoi_maire\""; |
7482 |
$message .= " title=\""._("Bordereau")."\""; |
$message .= " title=\""._("Bordereau")."\""; |
7483 |
$message .= " href='../scr/form.php?obj=instruction"; |
$message .= " href='".OM_ROUTE_FORM."&obj=instruction"; |
7484 |
$message .= "&action=200"; |
$message .= "&action=200"; |
7485 |
$message .= "&idx=".$id_instruction."'"; |
$message .= "&idx=".$id_instruction."'"; |
7486 |
$message .= " target='_blank'>"; |
$message .= " target='_blank'>"; |
7521 |
$this->f->displayMessage($message_class, $message); |
$this->f->displayMessage($message_class, $message); |
7522 |
} |
} |
7523 |
|
|
|
// Inclusion de la classe de gestion des formulaires |
|
|
require_once "../obj/om_formulaire.class.php"; |
|
7524 |
// Ouverture du formulaire |
// Ouverture du formulaire |
7525 |
$datasubmit = $this->getDataSubmit(); |
$datasubmit = $this->getDataSubmit(); |
7526 |
echo "\n<!-- ########## START DBFORM ########## -->\n"; |
echo "\n<!-- ########## START DBFORM ########## -->\n"; |
7537 |
$champs = array("code_barres","date"); |
$champs = array("code_barres","date"); |
7538 |
|
|
7539 |
// Création d'un nouvel objet de type formulaire |
// Création d'un nouvel objet de type formulaire |
7540 |
$form = new formulaire(NULL, 0, 0, $champs); |
$form = $this->f->get_inst__om_formulaire(array( |
7541 |
|
"validation" => 0, |
7542 |
|
"maj" => 0, |
7543 |
|
"champs" => $champs, |
7544 |
|
)); |
7545 |
|
|
7546 |
$template_required_label = '%s *'; |
$template_required_label = '%s *'; |
7547 |
// Parametrage du champ code_barres |
// Parametrage du champ code_barres |
7600 |
} |
} |
7601 |
|
|
7602 |
/** |
/** |
7603 |
|
* VIEW - view_rapport_instruction. |
7604 |
|
* |
7605 |
|
* Ouvre le sous-formulaire en ajaxIt dans un overlay. |
7606 |
|
* Cette action est bindée pour utiliser la fonction popUpIt. |
7607 |
|
* |
7608 |
|
* @return void |
7609 |
|
*/ |
7610 |
|
function view_overlay_notification_manuelle() { |
7611 |
|
|
7612 |
|
// Vérification de l'accessibilité sur l'élément |
7613 |
|
$this->checkAccessibility(); |
7614 |
|
|
7615 |
|
printf( |
7616 |
|
'<script type="text/javascript" > |
7617 |
|
overlayIt(\'%1$s\',\'%2$s&objsf=%1$s&idxformulaire=%4$s&retourformulaire=dossier_instruction&obj=%1$s&action=411&idx=%3$s\', 1); |
7618 |
|
</script>', |
7619 |
|
'instruction_notification_manuelle', |
7620 |
|
OM_ROUTE_SOUSFORM, |
7621 |
|
$this->getVal($this->clePrimaire), |
7622 |
|
$this->getVal('dossier') |
7623 |
|
); |
7624 |
|
} |
7625 |
|
|
7626 |
|
/** |
7627 |
|
* VIEW - view_overlay_notification_service_consulte. |
7628 |
|
* |
7629 |
|
* Ouvre le sous-formulaire de notification des services consulte |
7630 |
|
* en ajaxIt dans un overlay. |
7631 |
|
* Cette action est bindée pour utiliser la fonction popUpIt. |
7632 |
|
* |
7633 |
|
* @return void |
7634 |
|
*/ |
7635 |
|
function view_overlay_notification_service_consulte() { |
7636 |
|
|
7637 |
|
// Vérification de l'accessibilité sur l'élément |
7638 |
|
$this->checkAccessibility(); |
7639 |
|
|
7640 |
|
printf( |
7641 |
|
'<script type="text/javascript" > |
7642 |
|
overlayIt(\'%1$s\',\'%2$s&objsf=%1$s&idxformulaire=%4$s&retourformulaire=dossier_instruction&obj=%1$s&action=420&idx=%3$s\', 1); |
7643 |
|
</script>', |
7644 |
|
'instruction_notification_manuelle', |
7645 |
|
OM_ROUTE_SOUSFORM, |
7646 |
|
$this->getVal($this->clePrimaire), |
7647 |
|
$this->getVal('dossier') |
7648 |
|
); |
7649 |
|
} |
7650 |
|
|
7651 |
|
/** |
7652 |
|
* VIEW - overlay_notification_tiers_consulte. |
7653 |
|
* |
7654 |
|
* Ouvre le sous-formulaire de notification des tiers consulte |
7655 |
|
* en ajaxIt dans un overlay. |
7656 |
|
* Cette action est bindée pour utiliser la fonction popUpIt. |
7657 |
|
* |
7658 |
|
* @return void |
7659 |
|
*/ |
7660 |
|
function view_overlay_notification_tiers_consulte() { |
7661 |
|
|
7662 |
|
// Vérification de l'accessibilité sur l'élément |
7663 |
|
$this->checkAccessibility(); |
7664 |
|
|
7665 |
|
printf( |
7666 |
|
'<script type="text/javascript" > |
7667 |
|
overlayIt(\'%1$s\',\'%2$s&objsf=%1$s&idxformulaire=%4$s&retourformulaire=dossier_instruction&obj=%1$s&action=430&idx=%3$s\', 1); |
7668 |
|
</script>', |
7669 |
|
'instruction_notification_manuelle', |
7670 |
|
OM_ROUTE_SOUSFORM, |
7671 |
|
$this->getVal($this->clePrimaire), |
7672 |
|
$this->getVal('dossier') |
7673 |
|
); |
7674 |
|
} |
7675 |
|
/** |
7676 |
* 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 |
7677 |
* pour exclure les dossiers du groupe contentieux. |
* pour exclure les dossiers du groupe contentieux. |
7678 |
* |
* |
7720 |
// Begin |
// Begin |
7721 |
$this->begin_treatment(__METHOD__); |
$this->begin_treatment(__METHOD__); |
7722 |
// Requête |
// Requête |
7723 |
$res = $this->db->autoExecute( |
$res = $this->f->db->autoExecute( |
7724 |
DB_PREFIXE.$this->table, |
DB_PREFIXE.$this->table, |
7725 |
$valF, |
$valF, |
7726 |
DB_AUTOQUERY_UPDATE, |
DB_AUTOQUERY_UPDATE, |
7739 |
* validation du formulaire d'ajout. |
* validation du formulaire d'ajout. |
7740 |
* @param array $val tableau des valeurs retournées par le formulaire |
* @param array $val tableau des valeurs retournées par le formulaire |
7741 |
*/ |
*/ |
7742 |
function setValFAjout($val) { |
function setValFAjout($val = array()) { |
7743 |
// Mise à jour du flag created_by_commune lors d'un changement de décision |
// Mise à jour du flag created_by_commune lors d'un changement de décision |
7744 |
// par un utilisateur de commune sur un dossier instruit par la comcom |
// par un utilisateur de commune sur un dossier instruit par la comcom |
7745 |
if ($this->isInstrCanChangeDecision($this->valF["dossier"])) { |
if ($this->isInstrCanChangeDecision($this->valF["dossier"])) { |
7746 |
$this->valF['created_by_commune'] = true; |
$this->valF['created_by_commune'] = true; |
7747 |
} |
} |
7748 |
|
|
7749 |
|
// |
7750 |
|
if ($this->evenement_has_an_edition($this->valF['evenement']) === false) { |
7751 |
|
if (isset($this->valF['flag_edition_integrale']) === true) { |
7752 |
|
unset($this->valF['flag_edition_integrale']); |
7753 |
|
} |
7754 |
|
if (isset($this->valF['signataire_arrete']) === true) { |
7755 |
|
unset($this->valF['signataire_arrete']); |
7756 |
|
} |
7757 |
|
} |
7758 |
} |
} |
7759 |
|
|
7760 |
|
|
8019 |
*/ |
*/ |
8020 |
public function formater_modele($modele, $id_di, $id_inst) { |
public function formater_modele($modele, $id_di, $id_inst) { |
8021 |
// Création du lien d'accès direct à l'instruction |
// Création du lien d'accès direct à l'instruction |
8022 |
$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'. |
8023 |
'&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; |
8024 |
$url_inst = '<a href="'.$url_inst.'">'.$url_inst.'</a>'; |
$url_inst = '<a href="'.$url_inst.'">'.$url_inst.'</a>'; |
8025 |
// Remplacement des champs de fusion |
// Remplacement des champs de fusion |
8121 |
$this->f->get_submitted_get_value('idxformulaire') : $id_dossier = ""); |
$this->f->get_submitted_get_value('idxformulaire') : $id_dossier = ""); |
8122 |
// |
// |
8123 |
if ($id_dossier !== "") { |
if ($id_dossier !== "") { |
8124 |
require_once "../obj/dossier_instruction.class.php"; |
$dossier = $this->f->get_inst__om_dbform(array( |
8125 |
$dossier = new dossier_instruction($id_dossier, $f->db, DEBUG); |
"obj" => "dossier_instruction", |
8126 |
|
"idx" => $id_dossier, |
8127 |
|
)); |
8128 |
// |
// |
8129 |
return $dossier->can_user_access_dossier(); |
return $dossier->can_user_access_dossier(); |
8130 |
} |
} |
8144 |
$id_dossier = $this->getVal('dossier'); |
$id_dossier = $this->getVal('dossier'); |
8145 |
// |
// |
8146 |
if ($id_dossier !== "" && $id_dossier !== null) { |
if ($id_dossier !== "" && $id_dossier !== null) { |
8147 |
require_once "../obj/dossier_instruction.class.php"; |
$dossier = $this->f->get_inst__om_dbform(array( |
8148 |
$dossier = new dossier_instruction($id_dossier, $f->db, DEBUG); |
"obj" => "dossier_instruction", |
8149 |
|
"idx" => $id_dossier, |
8150 |
|
)); |
8151 |
// |
// |
8152 |
return $dossier->can_user_access_dossier(); |
return $dossier->can_user_access_dossier(); |
8153 |
} |
} |
8154 |
return false; |
return false; |
8155 |
} |
} |
8156 |
|
|
8157 |
}// fin classe |
/** |
8158 |
|
* TREATMENT - envoyer_a_signature_sans_relecture |
8159 |
|
* |
8160 |
|
* Permet d'envoyer le document de l'instruction au parapheur pour signature sans relecture |
8161 |
|
* |
8162 |
|
* @return boolean true si l'envoi a été effectué avec succès false sinon |
8163 |
|
*/ |
8164 |
|
function envoyer_a_signature_sans_relecture() { |
8165 |
|
return $this->envoyer_a_signature(); |
8166 |
|
} |
8167 |
|
|
8168 |
|
/** |
8169 |
|
* TREATMENT - envoyer_a_signature_avec_relecture |
8170 |
|
* |
8171 |
|
* Permet d'envoyer le document de l'instruction au parapheur pour signature avec relecture |
8172 |
|
* |
8173 |
|
* @return boolean true si l'envoi a été effectué avec succès false sinon |
8174 |
|
*/ |
8175 |
|
function envoyer_a_signature_avec_relecture() { |
8176 |
|
$is_forced_view_files = true; |
8177 |
|
return $this->envoyer_a_signature($is_forced_view_files); |
8178 |
|
} |
8179 |
|
|
8180 |
|
/** |
8181 |
|
* TREATMENT - envoyer_a_signature |
8182 |
|
* |
8183 |
|
* Permet d'envoyer le document de l'instruction au parapheur pour signature |
8184 |
|
* |
8185 |
|
* @param boolean $is_forced_view_files Indique si il y a une relecture (true) ou non (false) |
8186 |
|
* |
8187 |
|
* @return boolean true si l'envoi a été effectué avec succès false sinon |
8188 |
|
*/ |
8189 |
|
function envoyer_a_signature($is_forced_view_files = false) { |
8190 |
|
$this->begin_treatment(__METHOD__); |
8191 |
|
$this->correct = true; |
8192 |
|
|
8193 |
|
// Instanciation de l'objet signataire_arrete |
8194 |
|
$inst_signataire_arrete = $this->f->get_inst__om_dbform(array( |
8195 |
|
'obj' => 'signataire_arrete', |
8196 |
|
'idx' => $this->getVal('signataire_arrete'), |
8197 |
|
)); |
8198 |
|
|
8199 |
|
// Instanciation de l'objet dossier |
8200 |
|
$inst_dossier = $this->f->get_inst__om_dbform(array( |
8201 |
|
'obj' => 'dossier', |
8202 |
|
'idx' => $this->getVal('dossier'), |
8203 |
|
)); |
8204 |
|
|
8205 |
|
// Récupération du document à signer |
8206 |
|
$file = $this->f->storage->get($this->getVal('om_fichier_instruction')); |
8207 |
|
if ($file === OP_FAILURE) { |
8208 |
|
$this->correct = false; |
8209 |
|
$this->addToMessage(__("Une erreur est survenue lors de la récupération du contenu du document de l'instruction.")); |
8210 |
|
// Termine le traitement |
8211 |
|
return $this->end_treatment(__METHOD__, false); |
8212 |
|
} |
8213 |
|
|
8214 |
|
// Initialisation des paramètre à passer pour l'envoi en signature |
8215 |
|
$data = array( |
8216 |
|
"om_utilisateur_email" => $this->f->om_utilisateur['email'], |
8217 |
|
"om_utilisateur_nom" => $this->f->om_utilisateur['nom'], |
8218 |
|
"signataire_arrete_email" => $inst_signataire_arrete->getVal('email'), |
8219 |
|
"signataire_arrete_nom" => $inst_signataire_arrete->getVal('nom'), |
8220 |
|
"signataire_arrete_prenom" => $inst_signataire_arrete->getVal('prenom'), |
8221 |
|
// Permet d'envoyer en signature l'instruction le jour de la date limite |
8222 |
|
"date_limite_instruction" => $this->compute_date_limite(1), |
8223 |
|
"dossier" => $this->getVal('dossier'), |
8224 |
|
"is_forced_view_files" => $is_forced_view_files, |
8225 |
|
'commentaire_signature' => $is_forced_view_files === true ? __('relecture demandee.') : null |
8226 |
|
); |
8227 |
|
|
8228 |
|
// Initialisation des métadonnées |
8229 |
|
$metadonnee_dossier = $file['metadata']; |
8230 |
|
// récupération de l'extension du fichier |
8231 |
|
$extension = substr($metadonnee_dossier['filename'], strrpos($metadonnee_dossier['filename'], '.')); |
8232 |
|
// Modification du libellé du document transmis au parapheur |
8233 |
|
// pour le mettre sous la forme : instruction_xxx_libelle_lettretype.extension |
8234 |
|
$metadonnee_dossier['filename'] = $this->getDocumentLibelle().$extension; |
8235 |
|
$metadonnee_dossier['titre_document'] = $this->getDocumentTitre(); |
8236 |
|
|
8237 |
|
$metadonnee_dossier['url_di'] = sprintf( |
8238 |
|
'%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', |
8239 |
|
$this->f->get_param_base_path_metadata_url_di() !== null ? $this->f->get_param_base_path_metadata_url_di() : PATH_BASE_URL, |
8240 |
|
$this->getVal($this->clePrimaire) |
8241 |
|
); |
8242 |
|
|
8243 |
|
$optional_data = null; |
8244 |
|
// Si il y a des paramètres supplémentaire spécifié dans le signataire alors on les récupère |
8245 |
|
if ($inst_signataire_arrete->getVal('parametre_parapheur') !== null && $inst_signataire_arrete->getVal('parametre_parapheur') !== '') { |
8246 |
|
$optional_data = json_decode($inst_signataire_arrete->getVal('parametre_parapheur'), true); |
8247 |
|
if (json_last_error() !== JSON_ERROR_NONE) { |
8248 |
|
$this->correct = false; |
8249 |
|
$this->addToMessage(__("Les paramètres supplémentaires envoyés au parapheur ne sont pas au bon format.")); |
8250 |
|
$this->addToLog(__METHOD__."(): ". |
8251 |
|
__("Erreur lors du décodage du format json des paramètres supplémentaires envoyé au parapheur. |
8252 |
|
Tableau : ").var_export($inst_signataire_arrete->getVal('parametre_parapheur'), true) |
8253 |
|
); |
8254 |
|
// Termine le traitement |
8255 |
|
return $this->end_treatment(__METHOD__, false); |
8256 |
|
} |
8257 |
|
} |
8258 |
|
|
8259 |
|
//Instanciation de la classe electronicsignature |
8260 |
|
$inst_es = $this->get_electronicsignature_instance(); |
8261 |
|
if ($inst_es === false) { |
8262 |
|
$this->correct = false; |
8263 |
|
return $this->end_treatment(__METHOD__, false); |
8264 |
|
} |
8265 |
|
|
8266 |
|
// Appel de la méthode de l'abstracteur send_for_signature() |
8267 |
|
// Cette méthode doit retourner un tableau de valeur |
8268 |
|
try { |
8269 |
|
$result = $inst_es->send_for_signature($data, $file['file_content'], $metadonnee_dossier, $optional_data); |
8270 |
|
} catch (electronicsignature_exception $e) { |
8271 |
|
$this->handle_electronicsignature_exception($e); |
8272 |
|
return $this->end_treatment(__METHOD__, false); |
8273 |
|
} |
8274 |
|
|
8275 |
|
// Après avoir reçu le résultat du parapheur, il faut mettre à jour les champs |
8276 |
|
$valF = array(); |
8277 |
|
|
8278 |
|
// Pour appeler la fonction modifier il faut traiter tous les champs de l'objet |
8279 |
|
foreach($this->champs as $identifiant => $champ) { |
8280 |
|
$valF[$champ] = $this->val[$identifiant]; |
8281 |
|
} |
8282 |
|
// On fait ensuite nos modifications spécifiques |
8283 |
|
$valF['id_parapheur_signature'] = $result['id_parapheur_signature']; |
8284 |
|
$valF['statut_signature'] = $result['statut']; |
8285 |
|
$valF['commentaire_signature'] = isset($result['commentaire_signature']) == true ? $result['commentaire_signature'] : null; |
8286 |
|
$valF['date_envoi_signature'] = date("Y-m-d", strtotime($result['date_envoi_signature'])); |
8287 |
|
$valF['historique_signature'] = $this->get_updated_historique_signature($result); |
8288 |
|
|
8289 |
|
$ret = $this->modifier($valF); |
8290 |
|
|
8291 |
|
if ($ret === false) { |
8292 |
|
$this->correct = false; |
8293 |
|
$this->addToMessage(__("Une erreur est survenue lors de la mise à jour des champs.")); |
8294 |
|
// Termine le traitement |
8295 |
|
return $this->end_treatment(__METHOD__, false); |
8296 |
|
} |
8297 |
|
|
8298 |
|
// Message |
8299 |
|
$this->addToMessage(__("Le document a été envoyé pour signature dans le parapheur.")); |
8300 |
|
if (array_key_exists('signature_page_url', $result) === true) { |
8301 |
|
$this->addToMessage(sprintf( |
8302 |
|
'<br> > <a href="%1$s" title="%2$s" target="_blank">%2$s</a>', |
8303 |
|
$result['signature_page_url'], |
8304 |
|
__("Signez directement le document") |
8305 |
|
)); |
8306 |
|
} |
8307 |
|
|
8308 |
|
// Tout s'est bien passé, on termine le traitement |
8309 |
|
return $this->end_treatment(__METHOD__, true); |
8310 |
|
} |
8311 |
|
|
8312 |
|
/** |
8313 |
|
* Permet de récupérer la bonne date limite en fonction de si l'instruction |
8314 |
|
* est en incomplet notifié ou non. |
8315 |
|
* On peut ajouter des jours à cette date grâce au paramètre "delay". |
8316 |
|
* Cette fonction est utilisée dans un cas spécifique où on veut envoyer |
8317 |
|
* l'instruction en signature le jour de la date limite. |
8318 |
|
* |
8319 |
|
* @param int $delay Le nombre de jour à ajouter à la date limite. |
8320 |
|
* |
8321 |
|
* @return string $date_limite la date limite calculé ou false |
8322 |
|
*/ |
8323 |
|
private function compute_date_limite($delay) { |
8324 |
|
// Instanciation de l'objet dossier |
8325 |
|
$inst_dossier = $this->f->get_inst__om_dbform(array( |
8326 |
|
'obj' => 'dossier', |
8327 |
|
'idx' => $this->getVal('dossier'), |
8328 |
|
)); |
8329 |
|
|
8330 |
|
$date_to_compute = null; |
8331 |
|
if ($inst_dossier->getVal('incomplet_notifie') === 't') { |
8332 |
|
$date_to_compute = $inst_dossier->getVal('date_limite_incompletude'); |
8333 |
|
} else { |
8334 |
|
$date_to_compute = $inst_dossier->getVal('date_limite'); |
8335 |
|
} |
8336 |
|
|
8337 |
|
$date_limite = date("Y-m-d", strtotime($date_to_compute."+ $delay days")); |
8338 |
|
|
8339 |
|
return $date_limite; |
8340 |
|
} |
8341 |
|
|
8342 |
|
/** |
8343 |
|
* Permet de récupérer la traduction de la valeur de statut_signature |
8344 |
|
* |
8345 |
|
* @return string la valeur de statut_signature traduite | false |
8346 |
|
*/ |
8347 |
|
function get_trad_for_statut($value_to_trad){ |
8348 |
|
$statut_signature_tab = array( |
8349 |
|
'waiting' => __('en préparation'), |
8350 |
|
'in_progress' => __('en cours de signature'), |
8351 |
|
'canceled' => __('signature annulée'), |
8352 |
|
'expired' => __('délai de signature expiré'), |
8353 |
|
'finished' => __('signé') |
8354 |
|
); |
8355 |
|
if (array_key_exists($value_to_trad, $statut_signature_tab) === true) { |
8356 |
|
return $statut_signature_tab[$value_to_trad]; |
8357 |
|
} |
8358 |
|
|
8359 |
|
return false; |
8360 |
|
} |
8361 |
|
|
8362 |
|
/** |
8363 |
|
* Permet de mettre à jour le tableau json sotcké dans le champ historique_signature |
8364 |
|
* |
8365 |
|
* @return string (json) la valeur de historique_signature mis à jour | false |
8366 |
|
*/ |
8367 |
|
function get_updated_historique_signature($historique_signature_values) { |
8368 |
|
|
8369 |
|
$historique_signature_value_tab = $this->get_historique_signature_decoded(); |
8370 |
|
|
8371 |
|
if ($historique_signature_value_tab === false) { |
8372 |
|
$this->addToLog(__METHOD__."(): erreur historique signature", DEBUG_MODE); |
8373 |
|
return false; |
8374 |
|
} |
8375 |
|
|
8376 |
|
$last_val_historique_signature = array(); |
8377 |
|
|
8378 |
|
// Si la tableau récupéré n'est pas vide alors |
8379 |
|
// on récupère la dernière ligne du tableau |
8380 |
|
if (empty($historique_signature_value_tab) === false) { |
8381 |
|
$last_val_historique_signature = end($historique_signature_value_tab); |
8382 |
|
} |
8383 |
|
|
8384 |
|
$format_date = ''; |
8385 |
|
$format_date_hour = ''; |
8386 |
|
$date_converted=array(); |
8387 |
|
|
8388 |
|
$date_to_convert = array( |
8389 |
|
'date_envoi_signature' => $historique_signature_values['date_envoi_signature'], |
8390 |
|
'date_limite_instruction' => $this->compute_date_limite(0), |
8391 |
|
'date_retour_signature' => $historique_signature_values['date_retour_signature'] |
8392 |
|
); |
8393 |
|
|
8394 |
|
// Conversion des dates en fonction de leur format |
8395 |
|
foreach ($date_to_convert as $key => $value) { |
8396 |
|
$date_converted[$key] = null; |
8397 |
|
if ($value != null) { |
8398 |
|
$format_date = 'd/m/Y'; |
8399 |
|
$format_date_hour = 'd/m/Y H:i:s'; |
8400 |
|
$date_converted[$key] = empty(date_parse($value)['hour']) === false ? date($format_date_hour, strtotime($value)) : date($format_date, strtotime($value)); |
8401 |
|
} |
8402 |
|
} |
8403 |
|
|
8404 |
|
// Ce tableau permet de lister les colonnes de historique_signature et de les rendre traduisibles. |
8405 |
|
// Il faut en effet mettre les gettext avec l'intitulé explicite au moins |
8406 |
|
// une fois afin qu'il puisse être reconnu par le logiciel de traduction. |
8407 |
|
$tab_for_columns_trad = array( |
8408 |
|
__('entry_date'), |
8409 |
|
__('id_parapheur_signature'), |
8410 |
|
__('emetteur'), |
8411 |
|
__('signataire'), |
8412 |
|
__('date_envoi'), |
8413 |
|
__('date_limite'), |
8414 |
|
__('date_retour'), |
8415 |
|
__('statut_signature'), |
8416 |
|
__('commentaire_signature') |
8417 |
|
); |
8418 |
|
|
8419 |
|
array_push($historique_signature_value_tab, array( |
8420 |
|
'entry_date' => date('d/m/Y H:i:s'), |
8421 |
|
'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'], |
8422 |
|
'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'], |
8423 |
|
'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'], |
8424 |
|
'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'], |
8425 |
|
'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'], |
8426 |
|
'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'], |
8427 |
|
'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']), |
8428 |
|
'commentaire_signature' => isset($historique_signature_values['commentaire_signature']) === false || $historique_signature_values['commentaire_signature'] == null ? null : $historique_signature_values['commentaire_signature'], |
8429 |
|
)); |
8430 |
|
|
8431 |
|
return json_encode($historique_signature_value_tab, JSON_HEX_APOS); |
8432 |
|
} |
8433 |
|
|
8434 |
|
/** |
8435 |
|
* TREATMENT - annuler_envoi_en_signature |
8436 |
|
* |
8437 |
|
* Permet d'annuler l'envoi du document de l'instruction au parapheur pour signature |
8438 |
|
* |
8439 |
|
* @return boolean true si l'annulation a été effectué avec succès false sinon |
8440 |
|
*/ |
8441 |
|
function annuler_envoi_en_signature() { |
8442 |
|
$this->begin_treatment(__METHOD__); |
8443 |
|
$this->correct = true; |
8444 |
|
|
8445 |
|
//Instanciation de la classe electronicsignature |
8446 |
|
$inst_es = $this->get_electronicsignature_instance(); |
8447 |
|
if ($inst_es === false) { |
8448 |
|
$this->correct = false; |
8449 |
|
return $this->end_treatment(__METHOD__, false); |
8450 |
|
} |
8451 |
|
|
8452 |
|
$data = array(); |
8453 |
|
if (! empty($this->getVal('id_parapheur_signature'))) { |
8454 |
|
$data['id_parapheur_signature'] = $this->getVal('id_parapheur_signature'); |
8455 |
|
} else { |
8456 |
|
$this->correct = false; |
8457 |
|
$this->addToMessage(__("Il n'y a pas d'identifiant de parapheur.")); |
8458 |
|
return $this->end_treatment(__METHOD__, false); |
8459 |
|
} |
8460 |
|
|
8461 |
|
// Appel de la méthode de l'abstracteur cancel_send_for_signature() |
8462 |
|
// Cette méthode doit retourner un tableau de valeur |
8463 |
|
try { |
8464 |
|
$result = $inst_es->cancel_send_for_signature($data); |
8465 |
|
} catch (electronicsignature_exception $e) { |
8466 |
|
$this->handle_electronicsignature_exception($e); |
8467 |
|
return $this->end_treatment(__METHOD__, false); |
8468 |
|
} |
8469 |
|
|
8470 |
|
// Après avoir reçu le résultat du parapheur, il faut mettre à jour les champs |
8471 |
|
$valF = array(); |
8472 |
|
|
8473 |
|
// Pour appeler la fonction modifier il faut traiter tous les champs de l'objet |
8474 |
|
foreach($this->champs as $identifiant => $champ) { |
8475 |
|
$valF[$champ] = $this->val[$identifiant]; |
8476 |
|
} |
8477 |
|
// On fait ensuite nos modifications spécifiques |
8478 |
|
$valF['id_parapheur_signature'] = null; |
8479 |
|
$valF['statut_signature'] = $result['statut']; |
8480 |
|
$valF['commentaire_signature'] = isset($result['commentaire_signature']) == true ? $result['commentaire_signature'] : null; |
8481 |
|
$valF['date_envoi_signature'] = null; |
8482 |
|
$valF['historique_signature'] = $this->get_updated_historique_signature($result); |
8483 |
|
|
8484 |
|
$ret = $this->modifier($valF); |
8485 |
|
|
8486 |
|
if ($ret === false) { |
8487 |
|
$this->correct = false; |
8488 |
|
$this->addToMessage(__("Une erreur est survenue lors de la mise à jour des champs.")); |
8489 |
|
// Termine le traitement |
8490 |
|
return $this->end_treatment(__METHOD__, false); |
8491 |
|
} |
8492 |
|
|
8493 |
|
// Message |
8494 |
|
$this->addToMessage(__("L'annulation a été effectuée avec succès.")); |
8495 |
|
|
8496 |
|
// Tout s'est bien passé, on termine le traitement |
8497 |
|
return $this->end_treatment(__METHOD__, true); |
8498 |
|
} |
8499 |
|
|
8500 |
|
|
8501 |
|
/** |
8502 |
|
* Récupère le contenu du champ historique_signature et le converti en tableau |
8503 |
|
* |
8504 |
|
* @return array sinon false en cas d'erreur |
8505 |
|
*/ |
8506 |
|
protected function get_historique_signature_decoded() { |
8507 |
|
$val = str_replace("'", '"', $this->getVal('historique_signature')); |
8508 |
|
if ($val === '' || $val == 'false') { |
8509 |
|
$val = json_encode(array()); |
8510 |
|
} |
8511 |
|
if($this->isJson($val) === false) { |
8512 |
|
return false; |
8513 |
|
} |
8514 |
|
return json_decode($val, true); |
8515 |
|
} |
8516 |
|
|
8517 |
|
/** |
8518 |
|
* Récupère les informations à afficher dans le tableau de suivi à l'aide |
8519 |
|
* d'une requête sql. Stocke ces informations dans un tableau. |
8520 |
|
* Converti le tableau au format json et renvoi le json obtenu |
8521 |
|
* |
8522 |
|
* @return json |
8523 |
|
*/ |
8524 |
|
protected function get_json_suivi_notification($typeTache) { |
8525 |
|
$whereTypeTache = ''; |
8526 |
|
if ($typeTache != null) { |
8527 |
|
if (is_array($typeTache)) { |
8528 |
|
$whereTypeTache = sprintf( |
8529 |
|
'AND task.type IN (%1$s)', |
8530 |
|
"'".implode("', '", $typeTache)."'" |
8531 |
|
); |
8532 |
|
} else { |
8533 |
|
$whereTypeTache = sprintf( |
8534 |
|
'AND task.type = \'%1$s\'', |
8535 |
|
$typeTache |
8536 |
|
); |
8537 |
|
} |
8538 |
|
} |
8539 |
|
$valSuivi = array(); |
8540 |
|
// Liste des champs à afficher. Permet également la traduction des noms de colonnes. |
8541 |
|
$listeChampsTrad = array( |
8542 |
|
__('emetteur'), |
8543 |
|
__('date_envoi'), |
8544 |
|
__('destinataire'), |
8545 |
|
__('date_premier_acces'), |
8546 |
|
__('instruction'), |
8547 |
|
__('statut'), |
8548 |
|
__('commentaire') |
8549 |
|
); |
8550 |
|
$listeChamps = array( |
8551 |
|
'emetteur', |
8552 |
|
'date_envoi', |
8553 |
|
'destinataire', |
8554 |
|
'date_premier_acces', |
8555 |
|
'instruction', |
8556 |
|
'statut', |
8557 |
|
'commentaire' |
8558 |
|
); |
8559 |
|
|
8560 |
|
// Récupération des infos nécessaires à l'affichage du tableau |
8561 |
|
// Les annexes sont |
8562 |
|
$sql = sprintf( |
8563 |
|
'SELECT DISTINCT |
8564 |
|
instruction_notification.instruction_notification, |
8565 |
|
CASE WHEN instruction_notification.automatique = TRUE |
8566 |
|
THEN TRIM(CONCAT(instruction_notification.emetteur, \' \', \'(automatique)\')) |
8567 |
|
ELSE instruction_notification.emetteur |
8568 |
|
END as emetteur, |
8569 |
|
date_envoi, |
8570 |
|
instruction_notification.destinataire, |
8571 |
|
instruction_notification.date_premier_acces, |
8572 |
|
evenement.libelle as instruction, |
8573 |
|
instruction_notification.statut, |
8574 |
|
instruction_notification.commentaire, |
8575 |
|
annexes.instruction_annexe |
8576 |
|
FROM |
8577 |
|
%1$sinstruction_notification |
8578 |
|
LEFT JOIN %1$sinstruction |
8579 |
|
ON instruction.instruction = instruction_notification.instruction |
8580 |
|
LEFT JOIN %1$sevenement |
8581 |
|
ON instruction.evenement = evenement.evenement |
8582 |
|
LEFT JOIN %1$sinstruction_notification_document |
8583 |
|
ON instruction_notification.instruction_notification = instruction_notification_document.instruction_notification |
8584 |
|
AND instruction_notification_document.annexe = true |
8585 |
|
LEFT JOIN %1$stask |
8586 |
|
ON instruction_notification.instruction_notification::CHARACTER VARYING = task.object_id |
8587 |
|
LEFT JOIN ( |
8588 |
|
SELECT |
8589 |
|
instruction_notification, |
8590 |
|
ARRAY_TO_STRING(ARRAY_AGG( |
8591 |
|
CASE WHEN |
8592 |
|
instruction_notification_document.instruction != 0 |
8593 |
|
THEN |
8594 |
|
evenement.libelle |
8595 |
|
ELSE |
8596 |
|
CONCAT(\'Avis - \', service.libelle) |
8597 |
|
END), |
8598 |
|
\', \' |
8599 |
|
) AS instruction_annexe |
8600 |
|
FROM |
8601 |
|
%1$sinstruction_notification_document |
8602 |
|
LEFT JOIN %1$sinstruction |
8603 |
|
ON instruction_notification_document.instruction = instruction.instruction |
8604 |
|
LEFT JOIN %1$sevenement |
8605 |
|
ON instruction.evenement = evenement.evenement |
8606 |
|
LEFT JOIN %1$sconsultation |
8607 |
|
ON instruction_notification_document.document_id = consultation.consultation |
8608 |
|
LEFT JOIN %1$sservice |
8609 |
|
ON consultation.service = service.service |
8610 |
|
WHERE |
8611 |
|
instruction_notification_document.annexe = \'t\' |
8612 |
|
GROUP BY |
8613 |
|
instruction_notification |
8614 |
|
) AS annexes |
8615 |
|
ON |
8616 |
|
annexes.instruction_notification = instruction_notification.instruction_notification |
8617 |
|
WHERE |
8618 |
|
instruction.instruction = %2$s |
8619 |
|
%3$s |
8620 |
|
ORDER BY |
8621 |
|
date_envoi ASC, instruction_notification.destinataire ASC', |
8622 |
|
DB_PREFIXE, |
8623 |
|
$this->getVal('instruction'), |
8624 |
|
$whereTypeTache |
8625 |
|
); |
8626 |
|
$res = $this->f->db->query($sql); |
8627 |
|
$this->f->addToLog(__METHOD__."(): db->query(\"".$sql."\")", VERBOSE_MODE); |
8628 |
|
$this->f->isDatabaseError($res); |
8629 |
|
// Stockage des infos de chaque notification dans un tableau |
8630 |
|
while( $row =& $res->fetchrow(DB_FETCHMODE_ASSOC) ) { |
8631 |
|
$valNotif = array(); |
8632 |
|
foreach($listeChamps as $champ) { |
8633 |
|
$valNotif[$champ] = $row[$champ]; |
8634 |
|
if (($champ === 'date_envoi' |
8635 |
|
|| $champ === 'date_premier_acces') |
8636 |
|
&& $row[$champ] !== null |
8637 |
|
&& $row[$champ] !== '') { |
8638 |
|
// |
8639 |
|
$valNotif[$champ] = date('d/m/Y H:i:s', strtotime($row[$champ])); |
8640 |
|
} |
8641 |
|
} |
8642 |
|
if ($row['instruction_annexe'] !== null && $row['instruction_annexe'] !== '') { |
8643 |
|
$lienAnnexe = ' ('.$row['instruction_annexe'].')'; |
8644 |
|
$valNotif['instruction'] .= $lienAnnexe; |
8645 |
|
} |
8646 |
|
array_push($valSuivi, $valNotif); |
8647 |
|
} |
8648 |
|
|
8649 |
|
// Passage du tableau au format json |
8650 |
|
return json_encode($valSuivi, JSON_HEX_APOS); |
8651 |
|
} |
8652 |
|
|
8653 |
|
/** |
8654 |
|
* Traitement des erreurs retournées par l'abstracteur electronicsignature. |
8655 |
|
* |
8656 |
|
* @param electronicsignature_exception $exception Exception retournée par l'abstracteur. |
8657 |
|
* |
8658 |
|
* @return void |
8659 |
|
*/ |
8660 |
|
public function handle_electronicsignature_exception(electronicsignature_exception $exception) { |
8661 |
|
$this->f->displayMessage('error', $exception->getMessage()); |
8662 |
|
} |
8663 |
|
|
8664 |
|
|
8665 |
|
/** |
8666 |
|
* Retourne une instance du connecteur electronicsignature, et la créer si elle n'existe pas. |
8667 |
|
* |
8668 |
|
* @param boolean $with_handle_error Flag pour afficher ou non le message d'erreur à l'utilisateur. |
8669 |
|
* @return electronicsignature Instance de l'abstracteur. |
8670 |
|
*/ |
8671 |
|
public function get_electronicsignature_instance($with_handle_error = true) { |
8672 |
|
if(isset($this->electronicsignature_instance)) { |
8673 |
|
return $this->electronicsignature_instance; |
8674 |
|
} |
8675 |
|
// Instanciation du connecteur electronicsignature |
8676 |
|
try { |
8677 |
|
require_once "electronicsignature.class.php"; |
8678 |
|
$collectivites = array("collectivite_idx" => $this->get_dossier_instruction_om_collectivite(), "collectivite_multi_idx" => $this->f->get_idx_collectivite_multi()); |
8679 |
|
$this->electronicsignature_instance = new electronicsignature($collectivites); |
8680 |
|
} catch (electronicsignature_exception $e) { |
8681 |
|
if ($with_handle_error === true) { |
8682 |
|
$this->handle_electronicsignature_exception($e); |
8683 |
|
} |
8684 |
|
return false; |
8685 |
|
} |
8686 |
|
return $this->electronicsignature_instance; |
8687 |
|
} |
8688 |
|
|
8689 |
|
/** |
8690 |
|
* TREATMENT - envoyer_au_controle_de_legalite |
8691 |
|
* |
8692 |
|
* Ajoute la tâche envoi_CL. |
8693 |
|
* C'est le traitement de la tâche qui mettra à jour la date d'envoi au contrôle de légalité. |
8694 |
|
* |
8695 |
|
* @return [type] [description] |
8696 |
|
*/ |
8697 |
|
function envoyer_au_controle_de_legalite() { |
8698 |
|
$this->begin_treatment(__METHOD__); |
8699 |
|
$this->correct = true; |
8700 |
|
|
8701 |
|
// |
8702 |
|
if ($this->can_be_sended_to_cl() === true) { |
8703 |
|
// Création de la task 'envoi_CL' |
8704 |
|
$inst_task = $this->f->get_inst__om_dbform(array( |
8705 |
|
"obj" => "task", |
8706 |
|
"idx" => 0, |
8707 |
|
)); |
8708 |
|
$task_val = array( |
8709 |
|
'type' => 'envoi_CL', |
8710 |
|
'object_id' => $this->getVal('instruction'), |
8711 |
|
'dossier' => $this->getVal('dossier'), |
8712 |
|
); |
8713 |
|
// Change l'état de la tâche de notification en fonction de l'état de |
8714 |
|
// transmission du dossier d'instruction |
8715 |
|
$inst_di = $this->get_inst_dossier($this->getVal('dossier')); |
8716 |
|
if ($this->f->is_option_mode_service_consulte_enabled() === false |
8717 |
|
&& ($inst_di->getVal('etat_transmission_platau') == 'non_transmissible' |
8718 |
|
|| $inst_di->getVal('etat_transmission_platau') == 'transmis_mais_non_transmissible')) { |
8719 |
|
// |
8720 |
|
$task_val['state'] = $inst_task::STATUS_DRAFT; |
8721 |
|
} |
8722 |
|
$add_task = $inst_task->add_task(array('val' => $task_val)); |
8723 |
|
if ($add_task === false) { |
8724 |
|
$this->addToMessage(sprintf('%s %s', |
8725 |
|
__("Une erreur s'est produite lors de la création tâche."), |
8726 |
|
__("Veuillez contacter votre administrateur.") |
8727 |
|
)); |
8728 |
|
$this->correct = false; |
8729 |
|
return $this->end_treatment(__METHOD__, false); |
8730 |
|
} |
8731 |
|
// Mise à jour du champs 'envoye_cl_platau' |
8732 |
|
$instr_val = array( |
8733 |
|
'envoye_cl_platau' => 't', |
8734 |
|
); |
8735 |
|
$res = $this->f->db->autoExecute( |
8736 |
|
DB_PREFIXE.$this->table, |
8737 |
|
$instr_val, |
8738 |
|
DB_AUTOQUERY_UPDATE, |
8739 |
|
$this->getCle($this->getVal($this->clePrimaire)) |
8740 |
|
); |
8741 |
|
$this->addToLog(__METHOD__."(): db->autoexecute(\"".DB_PREFIXE.'.'.$this->table."\", ".print_r($instr_val, true).", DB_AUTOQUERY_UPDATE, \"".$this->getCle($this->clePrimaire)."\");", DEBUG_MODE); |
8742 |
|
if ($this->f->isDatabaseError($res, true) === true) { |
8743 |
|
$this->addToMessage(sprintf('%s %s', |
8744 |
|
__("Une erreur s'est produite lors de la mise à jour de l'instruction."), |
8745 |
|
__("Veuillez contacter votre administrateur.") |
8746 |
|
)); |
8747 |
|
$this->correct = false; |
8748 |
|
return $this->end_treatment(__METHOD__, false); |
8749 |
|
} |
8750 |
|
// Message de validation à l'utilisateur |
8751 |
|
$this->addToMessage(__('Votre demande de transfert au contrôle de légalité à bien été prise en compte.')); |
8752 |
|
$this->addToMessage(__("La date d'envoi au contrôle de légalité sera mise à jour ultérieurement.")); |
8753 |
|
} |
8754 |
|
// |
8755 |
|
return $this->end_treatment(__METHOD__, true); |
8756 |
|
} |
8757 |
|
|
8758 |
|
|
8759 |
|
/** |
8760 |
|
* Retourne le lien de retour (VIEW formulaire et VIEW sousformulaire). |
8761 |
|
* |
8762 |
|
* @param string $view Appel dans le contexte de la vue 'formulaire' ou de |
8763 |
|
* la vue 'sousformulaire'. |
8764 |
|
* |
8765 |
|
* @return string |
8766 |
|
*/ |
8767 |
|
function get_back_link($view = "formulaire") { |
8768 |
|
// |
8769 |
|
$href = parent::get_back_link($view); |
8770 |
|
// |
8771 |
|
$crud = $this->get_action_crud(); |
8772 |
|
|
8773 |
|
// Redirection vers le formulaire de modification à la validation du |
8774 |
|
// formulaire d'ajout si l'événement associé possède une lettre type |
8775 |
|
if (($crud === 'create' |
8776 |
|
|| ($crud === null |
8777 |
|
&& $this->getParameter('maj') == 0)) |
8778 |
|
&& $this->correct == true |
8779 |
|
&& $this->evenement_has_an_edition($this->valF['evenement']) === true) { |
8780 |
|
|
8781 |
|
// On instancie l'instruction |
8782 |
|
$inst_instruction = $this->f->get_inst__om_dbform(array( |
8783 |
|
"obj" => "instruction", |
8784 |
|
"idx" => $this->valF[$this->clePrimaire], |
8785 |
|
)); |
8786 |
|
|
8787 |
|
// Si l'instruction n'est pas finalisée automatiquement |
8788 |
|
if ($inst_instruction->getVal('om_final_instruction') !== 't') { |
8789 |
|
$href = str_replace("&action=3", "&action=1", $href); |
8790 |
|
// |
8791 |
|
if (strpos($href, "&retour=tab") !== false) { |
8792 |
|
$href = str_replace("&retour=tab", "&retour= form", $href); |
8793 |
|
} else { |
8794 |
|
$href .= "&retour=form"; |
8795 |
|
} |
8796 |
|
} |
8797 |
|
} |
8798 |
|
|
8799 |
|
// |
8800 |
|
return $href; |
8801 |
|
} |
8802 |
|
|
8803 |
|
public function view_json_data() { |
8804 |
|
$this->checkAccessibility(); |
8805 |
|
$this->f->disableLog(); |
8806 |
|
$view = $this->get_json_data(); |
8807 |
|
printf(json_encode($view)); |
8808 |
|
} |
8809 |
|
|
8810 |
|
public function get_json_data() { |
8811 |
|
$val = array_combine($this->champs, $this->val); |
8812 |
|
foreach ($val as $key => $value) { |
8813 |
|
$val[$key] = strip_tags($value); |
8814 |
|
} |
8815 |
|
$val['tacite'] = 'f'; |
8816 |
|
$inst_ad = $this->f->get_inst__om_dbform(array( |
8817 |
|
"obj" => "avis_decision", |
8818 |
|
"idx" => $val['avis_decision'], |
8819 |
|
)); |
8820 |
|
if (preg_match('/[tT]acite/', $inst_ad->getVal('libelle')) === 1) { |
8821 |
|
$val['tacite'] = 't'; |
8822 |
|
} |
8823 |
|
return $val; |
8824 |
|
} |
8825 |
|
|
8826 |
|
public function get_related_instructions_next($next_type = 'retour_signature', $instruction = null) { |
8827 |
|
if (in_array($next_type, array('retour_signature', 'retour_ar', 'suivant_tacite', )) === false) { |
8828 |
|
return false; |
8829 |
|
} |
8830 |
|
$result = array(); |
8831 |
|
$evenements = array(); |
8832 |
|
if ($instruction === null) { |
8833 |
|
$instruction = $this->getVal($this->clePrimaire); |
8834 |
|
$evenement = $this->getVal('evenement'); |
8835 |
|
$dossier = $this->getVal('dossier'); |
8836 |
|
} else { |
8837 |
|
$inst = $this->f->get_inst__om_dbform(array( |
8838 |
|
"obj" => "instruction", |
8839 |
|
"idx" => $instruction, |
8840 |
|
)); |
8841 |
|
$evenement = $inst->getVal('evenement'); |
8842 |
|
$dossier = $inst->getVal('dossier'); |
8843 |
|
} |
8844 |
|
// |
8845 |
|
$query = sprintf(' |
8846 |
|
SELECT evenement_%3$s |
8847 |
|
FROM %1$sevenement |
8848 |
|
WHERE evenement = %2$s |
8849 |
|
', |
8850 |
|
DB_PREFIXE, |
8851 |
|
$evenement, |
8852 |
|
$next_type |
8853 |
|
); |
8854 |
|
$res = $this->f->get_one_result_from_db_query($query, true); |
8855 |
|
if ($res['code'] === 'KO') { |
8856 |
|
return false; |
8857 |
|
} |
8858 |
|
$ev_next = $res['result']; |
8859 |
|
// |
8860 |
|
$query = sprintf(' |
8861 |
|
SELECT MAX(instruction.instruction) as instruction |
8862 |
|
FROM %1$sinstruction |
8863 |
|
WHERE dossier = \'%3$s\' |
8864 |
|
AND evenement = %2$s |
8865 |
|
', |
8866 |
|
DB_PREFIXE, |
8867 |
|
$ev_next, |
8868 |
|
$dossier |
8869 |
|
); |
8870 |
|
$res = $this->f->get_one_result_from_db_query($query, true); |
8871 |
|
if ($res['code'] === 'KO') { |
8872 |
|
return false; |
8873 |
|
} |
8874 |
|
// |
8875 |
|
return $res['result']; |
8876 |
|
} |
8877 |
|
|
8878 |
|
public function get_related_instructions($instruction = null) { |
8879 |
|
$result = array(); |
8880 |
|
$evenements = array(); |
8881 |
|
if ($instruction === null) { |
8882 |
|
$instruction = $this->getVal($this->clePrimaire); |
8883 |
|
$evenement = $this->getVal('evenement'); |
8884 |
|
$dossier = $this->getVal('dossier'); |
8885 |
|
} else { |
8886 |
|
$inst = $this->f->get_inst__om_dbform(array( |
8887 |
|
"obj" => "instruction", |
8888 |
|
"idx" => $instruction, |
8889 |
|
)); |
8890 |
|
$evenement = $inst->getVal('evenement'); |
8891 |
|
$dossier = $inst->getVal('dossier'); |
8892 |
|
} |
8893 |
|
// |
8894 |
|
$query = sprintf(' |
8895 |
|
SELECT evenement |
8896 |
|
FROM %1$sevenement |
8897 |
|
WHERE evenement_retour_ar = %2$s |
8898 |
|
OR evenement_retour_signature = %2$s |
8899 |
|
', |
8900 |
|
DB_PREFIXE, |
8901 |
|
$evenement |
8902 |
|
); |
8903 |
|
$res = $this->f->get_one_result_from_db_query($query, true); |
8904 |
|
if ($res['code'] === 'KO') { |
8905 |
|
return false; |
8906 |
|
} |
8907 |
|
$ev_parent = $res['result']; |
8908 |
|
// |
8909 |
|
$query = sprintf(' |
8910 |
|
SELECT MAX(instruction.instruction) as instruction |
8911 |
|
FROM %1$sinstruction |
8912 |
|
WHERE dossier = \'%3$s\' |
8913 |
|
AND evenement = %2$s |
8914 |
|
', |
8915 |
|
DB_PREFIXE, |
8916 |
|
$ev_parent, |
8917 |
|
$dossier |
8918 |
|
); |
8919 |
|
$res = $this->f->get_one_result_from_db_query($query, true); |
8920 |
|
if ($res['code'] === 'KO') { |
8921 |
|
return false; |
8922 |
|
} |
8923 |
|
$result[] = $res['result']; |
8924 |
|
// |
8925 |
|
$query = sprintf(' |
8926 |
|
SELECT evenement_retour_ar |
8927 |
|
FROM %1$sevenement |
8928 |
|
WHERE evenement = %2$s |
8929 |
|
AND evenement_retour_ar != %3$s |
8930 |
|
', |
8931 |
|
DB_PREFIXE, |
8932 |
|
$ev_parent, |
8933 |
|
$evenement |
8934 |
|
); |
8935 |
|
$res = $this->f->get_one_result_from_db_query($query, true); |
8936 |
|
if ($res['code'] === 'KO') { |
8937 |
|
return false; |
8938 |
|
} |
8939 |
|
$evenements[] = $res['result']; |
8940 |
|
// |
8941 |
|
$query = sprintf(' |
8942 |
|
SELECT evenement_retour_signature |
8943 |
|
FROM %1$sevenement |
8944 |
|
WHERE evenement = %2$s |
8945 |
|
AND evenement_retour_signature != %3$s |
8946 |
|
', |
8947 |
|
DB_PREFIXE, |
8948 |
|
$ev_parent, |
8949 |
|
$evenement |
8950 |
|
); |
8951 |
|
$res = $this->f->get_one_result_from_db_query($query, true); |
8952 |
|
if ($res['code'] === 'KO') { |
8953 |
|
return false; |
8954 |
|
} |
8955 |
|
$evenements[] = $res['result']; |
8956 |
|
foreach ($evenements as $value) { |
8957 |
|
if ($value !== null) { |
8958 |
|
$query = sprintf(' |
8959 |
|
SELECT MAX(instruction.instruction) as instruction |
8960 |
|
FROM %1$sinstruction |
8961 |
|
WHERE dossier = \'%3$s\' |
8962 |
|
AND evenement = %2$s |
8963 |
|
', |
8964 |
|
DB_PREFIXE, |
8965 |
|
$value, |
8966 |
|
$dossier |
8967 |
|
); |
8968 |
|
$res = $this->f->get_one_result_from_db_query($query, true); |
8969 |
|
if ($res['code'] === 'KO') { |
8970 |
|
return false; |
8971 |
|
} |
8972 |
|
$result[] = $res['result']; |
8973 |
|
} |
8974 |
|
} |
8975 |
|
return $result; |
8976 |
|
} |
8977 |
|
|
8978 |
|
protected function getDocumentType($champ = null) { |
8979 |
|
$evenementId = $this->getVal('evenement'); |
8980 |
|
if (! empty($evenementId)) { |
8981 |
|
$evenement = $this->f->findObjectById('evenement', $evenementId); |
8982 |
|
if (! empty($evenement)) { |
8983 |
|
return __("Instruction").':'.$evenement->getVal('libelle'); |
8984 |
|
} |
8985 |
|
} |
8986 |
|
return parent::getDocumentType(); |
8987 |
|
} |
8988 |
|
|
8989 |
|
/** |
8990 |
|
* Récupère à l'aide d'une requête sql la liste des demandeurs |
8991 |
|
* pouvant être notifié. C'est à dire les demandeurs acceptant |
8992 |
|
* les notifications et pour lesquels une adresse mail existe. |
8993 |
|
* |
8994 |
|
* Dans le cas, d'une notification pour le portail citoyen, seul |
8995 |
|
* le pétitionnaire principal doit être notifier et uniquement si |
8996 |
|
* il a une adress mail et qu'il accepte les notifications. |
8997 |
|
* |
8998 |
|
* @param string identifiant du dossier |
8999 |
|
* @param boolean true si il faut récupérer la liste des demandeurs notifiable |
9000 |
|
* pour une notification de categorie portail |
9001 |
|
* @return array liste des demandeurs pouvant être notifié |
9002 |
|
*/ |
9003 |
|
protected function get_demandeurs_notifiable($idDossier = null, $portail = false) { |
9004 |
|
if ($idDossier === null) { |
9005 |
|
$idDossier = $this->getVal('dossier'); |
9006 |
|
} |
9007 |
|
// Ajoute une condition sur le where pour ne récupérer que le pétitionnaire principal |
9008 |
|
// pour une notification depuis le portail citoyen |
9009 |
|
$sqlPetitionnairePrincipal = ''; |
9010 |
|
if ($portail === true) { |
9011 |
|
$sqlPetitionnairePrincipal = 'AND lien_dossier_demandeur.petitionnaire_principal = true'; |
9012 |
|
} |
9013 |
|
|
9014 |
|
$listeDemandeursNotifiable = array(); |
9015 |
|
|
9016 |
|
// Requête de récupération des demandeurs |
9017 |
|
$sql = sprintf( |
9018 |
|
'SELECT |
9019 |
|
demandeur.demandeur, |
9020 |
|
CASE |
9021 |
|
WHEN demandeur.qualite=\'particulier\' |
9022 |
|
THEN TRIM(CONCAT(demandeur.particulier_nom, \' \', demandeur.particulier_prenom, \' \', demandeur.courriel)) |
9023 |
|
ELSE |
9024 |
|
TRIM(CONCAT(demandeur.personne_morale_raison_sociale, \' \', demandeur.personne_morale_denomination, \' \', demandeur.courriel)) |
9025 |
|
END AS destinataire, |
9026 |
|
demandeur.courriel |
9027 |
|
FROM |
9028 |
|
%1$sdossier |
9029 |
|
INNER JOIN %1$slien_dossier_demandeur |
9030 |
|
ON dossier.dossier = lien_dossier_demandeur.dossier |
9031 |
|
INNER JOIN %1$sdemandeur |
9032 |
|
ON lien_dossier_demandeur.demandeur = demandeur.demandeur |
9033 |
|
WHERE |
9034 |
|
dossier.dossier = \'%2$s\' AND |
9035 |
|
notification = \'t\' AND |
9036 |
|
courriel IS NOT NULL |
9037 |
|
%3$s', |
9038 |
|
DB_PREFIXE, |
9039 |
|
$idDossier, |
9040 |
|
$sqlPetitionnairePrincipal |
9041 |
|
); |
9042 |
|
$res = $this->f->db->query($sql); |
9043 |
|
$this->f->addToLog(__METHOD__."(): db->query(\"".$sql."\")", VERBOSE_MODE); |
9044 |
|
$this->f->isDatabaseError($res); |
9045 |
|
// Récupération des infos des demandeurs et stockage dans un tableau |
9046 |
|
// ayant pour clé les id des demandeurs |
9047 |
|
while($row = $res->fetchrow(DB_FETCHMODE_ASSOC)) { |
9048 |
|
$listeDemandeursNotifiable[$row['demandeur']] = $row; |
9049 |
|
} |
9050 |
|
|
9051 |
|
return $listeDemandeursNotifiable; |
9052 |
|
} |
9053 |
|
|
9054 |
|
/** |
9055 |
|
* Renvoie la liste des notifications liées à l'instruction |
9056 |
|
* |
9057 |
|
* @param integer id de l'instruction dont on cherche les notifications |
9058 |
|
* @return array liste des instruction_notification liés à l'instruction |
9059 |
|
*/ |
9060 |
|
public function get_instruction_notification($id_instruction, $typeNotification = null) { |
9061 |
|
$whereTypeTache = ''; |
9062 |
|
if ($typeNotification != null) { |
9063 |
|
if (is_array($typeNotification)) { |
9064 |
|
$whereTypeTache = sprintf( |
9065 |
|
'AND task.type IN (%1$s)', |
9066 |
|
"'".implode("', '", $typeNotification)."'" |
9067 |
|
); |
9068 |
|
} else { |
9069 |
|
$whereTypeTache = sprintf( |
9070 |
|
'AND task.type = \'%1$s\'', |
9071 |
|
$typeNotification |
9072 |
|
); |
9073 |
|
} |
9074 |
|
} |
9075 |
|
$listeInstrNotif = array(); |
9076 |
|
$sql = sprintf(' |
9077 |
|
SELECT |
9078 |
|
instruction_notification.instruction_notification |
9079 |
|
FROM |
9080 |
|
%1$sinstruction_notification |
9081 |
|
LEFT JOIN %1$stask |
9082 |
|
ON instruction_notification.instruction_notification::CHARACTER VARYING = task.object_id |
9083 |
|
WHERE |
9084 |
|
instruction = %2$s |
9085 |
|
%3$s', |
9086 |
|
DB_PREFIXE, |
9087 |
|
$id_instruction, |
9088 |
|
$whereTypeTache |
9089 |
|
); |
9090 |
|
$res = $this->f->db->query($sql); |
9091 |
|
$this->f->addToLog(__METHOD__."(): db->query(\"".$sql."\")", VERBOSE_MODE); |
9092 |
|
$this->f->isDatabaseError($res); |
9093 |
|
while ($row = $res->fetchrow(DB_FETCHMODE_ASSOC)) { |
9094 |
|
$listeInstrNotif[] = $row['instruction_notification']; |
9095 |
|
} |
9096 |
|
return $listeInstrNotif; |
9097 |
|
} |
9098 |
|
|
9099 |
|
/** |
9100 |
|
* Crée une clé d'accès unique permettant à un utilisateur |
9101 |
|
* anonyme de récupérer le document. |
9102 |
|
* |
9103 |
|
* @return string clé d'accès du document |
9104 |
|
*/ |
9105 |
|
protected function getCleAccesDocument() { |
9106 |
|
// Initialisation d'un tableau |
9107 |
|
$number_list = array(); |
9108 |
|
|
9109 |
|
// Génération aléatoire d'un nombre sur 4 caractères, 4 fois |
9110 |
|
for ($i = 0; $i < 4; $i++) { |
9111 |
|
$number_list[] = str_pad(mt_rand(0, 9999), 4, 0, STR_PAD_LEFT); |
9112 |
|
} |
9113 |
|
|
9114 |
|
// Transformation en chaîne tout en séparant les nombres par un "-" |
9115 |
|
$result = implode('-', $number_list); |
9116 |
|
|
9117 |
|
// Vérifie si la clé existe déjà et si c'est le cas génére une nouvelle clé |
9118 |
|
if ($this->getUidDocumentInstructionWithKey($result) != null) { |
9119 |
|
return $this->getCleAccesDocument(); |
9120 |
|
} |
9121 |
|
|
9122 |
|
// |
9123 |
|
return $result; |
9124 |
|
} |
9125 |
|
|
9126 |
|
/** |
9127 |
|
* Récupère une clé et renvoie l'uid du document liée à cette |
9128 |
|
* clé. Si la clé n'existe pas renvoie null. |
9129 |
|
* |
9130 |
|
* @param string $cleGen clé dont on cherche l'instruction |
9131 |
|
* @return integer|null |
9132 |
|
*/ |
9133 |
|
protected function getUidDocumentInstructionWithKey($cleGen) { |
9134 |
|
$query = sprintf( |
9135 |
|
'SELECT |
9136 |
|
instruction.om_fichier_instruction |
9137 |
|
FROM |
9138 |
|
%1$sinstruction_notification_document |
9139 |
|
LEFT JOIN %1$sinstruction ON instruction_notification_document.instruction = instruction.instruction |
9140 |
|
WHERE |
9141 |
|
instruction_notification_document.cle = \'%2$s\'', |
9142 |
|
DB_PREFIXE, |
9143 |
|
$this->f->db->escapeSimple($cleGen) |
9144 |
|
); |
9145 |
|
|
9146 |
?> |
$res = $this->f->db->getOne($query); |
9147 |
|
$this->addToLog(__METHOD__.": db->getOne(\"".$query."\");", VERBOSE_MODE); |
9148 |
|
$this->f->isDatabaseError($res); |
9149 |
|
return $res; |
9150 |
|
} |
9151 |
|
|
9152 |
|
/** |
9153 |
|
* Récupère une clé, fait une requête pour récupérer l'id de la notification liée a cette clé. |
9154 |
|
* Récupère l'instance de instruction_notification dont l'id a été récupéré et la renvoie. |
9155 |
|
* |
9156 |
|
* @param string $cleGen |
9157 |
|
* @return instruction_notification |
9158 |
|
*/ |
9159 |
|
protected function getInstanceNotificationWithKey($key) { |
9160 |
|
$sql = sprintf( |
9161 |
|
"SELECT |
9162 |
|
instruction_notification |
9163 |
|
FROM |
9164 |
|
%1\$sinstruction_notification_document |
9165 |
|
WHERE |
9166 |
|
cle = '%2\$s'", |
9167 |
|
DB_PREFIXE, |
9168 |
|
$this->f->db->escapeSimple($key) |
9169 |
|
); |
9170 |
|
$res = $this->f->db->getOne($sql); |
9171 |
|
$this->addToLog(__METHOD__.": db->getOne(\"".$sql."\");", VERBOSE_MODE); |
9172 |
|
$this->f->isDatabaseError($res); |
9173 |
|
|
9174 |
|
// Récupération de l'instance de notification |
9175 |
|
$instNotif = $this->f->get_inst__om_dbform(array( |
9176 |
|
"obj" => "instruction_notification", |
9177 |
|
"idx" => $res, |
9178 |
|
)); |
9179 |
|
return $instNotif; |
9180 |
|
} |
9181 |
|
|
9182 |
|
|
9183 |
|
/** |
9184 |
|
* Affiche la page de téléchargement du document de la notification. |
9185 |
|
* |
9186 |
|
* @param boolean $content_only Affiche le contenu seulement. |
9187 |
|
* |
9188 |
|
* @return void |
9189 |
|
*/ |
9190 |
|
public function view_telecharger_document_anonym() { |
9191 |
|
// Par défaut on considère qu'on va afficher le formulaire |
9192 |
|
$idx = 0; |
9193 |
|
// Flag d'erreur |
9194 |
|
$error = false; |
9195 |
|
// Message d'erreur |
9196 |
|
$message = ''; |
9197 |
|
|
9198 |
|
// Paramètres GET : récupération de la clé d'accès |
9199 |
|
$cle_acces_document = $this->f->get_submitted_get_value('key'); |
9200 |
|
$cle_acces_document = $this->f->db->escapeSimple($cle_acces_document); |
9201 |
|
// Vérification de l'existence de la clé et récupération de l'uid du fichier |
9202 |
|
$uidFichier = $this->getUidDocumentInstructionWithKey($cle_acces_document); |
9203 |
|
if ($uidFichier != null) { |
9204 |
|
// Récupération du document |
9205 |
|
$file = $this->f->storage->get($uidFichier); |
9206 |
|
|
9207 |
|
// Headers |
9208 |
|
header("Cache-Control: no-cache, must-revalidate"); // HTTP/1.1 |
9209 |
|
header("Expires: Sat, 26 Jul 1997 05:00:00 GMT"); // Date dans le passé |
9210 |
|
header("Content-Type: ".$file['metadata']['mimetype']); |
9211 |
|
header("Accept-Ranges: bytes"); |
9212 |
|
header("Content-Disposition: inline; filename=\"".$file['metadata']['filename']."\";" ); |
9213 |
|
// Affichage du document |
9214 |
|
echo $file['file_content']; |
9215 |
|
|
9216 |
|
// Récupération de la date de premier accès et maj du suivi uniquement |
9217 |
|
// si la date de 1er accès n'a pas encore été remplis |
9218 |
|
$inst_notif = $this->getInstanceNotificationWithKey($cle_acces_document); |
9219 |
|
if ($inst_notif->getVal('date_premier_acces') == null || |
9220 |
|
$inst_notif->getVal('date_premier_acces') == '') { |
9221 |
|
$notif_val = array(); |
9222 |
|
foreach ($inst_notif->champs as $champ) { |
9223 |
|
$notif_val[$champ] = $inst_notif->getVal($champ); |
9224 |
|
} |
9225 |
|
$notif_val['date_premier_acces'] = date("d/m/Y H:i:s"); |
9226 |
|
$notif_val['statut'] = 'vu'; |
9227 |
|
$notif_val['commentaire'] = 'Le document a été vu'; |
9228 |
|
$suivi_notif = $inst_notif->modifier($notif_val); |
9229 |
|
} |
9230 |
|
|
9231 |
|
} else { |
9232 |
|
// Page vide 404 |
9233 |
|
printf('Ressource inexistante'); |
9234 |
|
header('HTTP/1.0 404 Not Found'); |
9235 |
|
} |
9236 |
|
} |
9237 |
|
|
9238 |
|
/** |
9239 |
|
* Récupère le titre du document envoyé au parapheur |
9240 |
|
*/ |
9241 |
|
protected function getDocumentTitre($champ = null) { |
9242 |
|
$title = $this->getTitle(); |
9243 |
|
$dossier = $this->getDossier(); |
9244 |
|
return $dossier.' '.$title; |
9245 |
|
} |
9246 |
|
|
9247 |
|
/** |
9248 |
|
* Compose le nom du document à transmettre au parapheur. |
9249 |
|
* Le nom ets composé de cette manière : |
9250 |
|
* instruction_xxx_libelle_de_la_lettre_type_associee |
9251 |
|
* ou xxx correspond au numéro de l'instruction |
9252 |
|
*/ |
9253 |
|
protected function getDocumentLibelle() { |
9254 |
|
// Récupère le champ instruction |
9255 |
|
$instruction = $this->getVal("instruction"); |
9256 |
|
|
9257 |
|
// Requête sql servant à récupérer le titre du document |
9258 |
|
// TO_CHAR() introduit un espace avant l'affichage du nombre |
9259 |
|
// comme les espaces sont remplacé par des '_' dans le retour de la fonction |
9260 |
|
// il n'est pas nécessaire de mettre un '_' après le mot instruction. |
9261 |
|
$sql = sprintf( |
9262 |
|
'SELECT |
9263 |
|
CONCAT( |
9264 |
|
\'instruction\', |
9265 |
|
TO_CHAR(instruction.instruction, \'000\'), |
9266 |
|
\'_\', |
9267 |
|
LOWER(om_lettretype.libelle) |
9268 |
|
) as nom_fichier |
9269 |
|
FROM |
9270 |
|
%1$sinstruction |
9271 |
|
LEFT JOIN %1$som_lettretype ON om_lettretype.id = instruction.lettretype |
9272 |
|
WHERE |
9273 |
|
instruction = %2$s', |
9274 |
|
DB_PREFIXE, |
9275 |
|
$instruction |
9276 |
|
); |
9277 |
|
$documentLibelle = $this->f->db->getOne($sql); |
9278 |
|
$this->addToLog("getDocumentTitre(): db->getOne(\"".$sql."\");", VERBOSE_MODE); |
9279 |
|
if (database::isError($documentLibelle)) { |
9280 |
|
die(); |
9281 |
|
} |
9282 |
|
|
9283 |
|
// Transforamtion des ' ' en '_', des accents en lettres sans accents et des |
9284 |
|
// caractères spéciaux en '_' |
9285 |
|
// La méthode normalize_string est utilisé pour gérer les accents |
9286 |
|
$documentLibelle = $this->f->normalize_string($documentLibelle); |
9287 |
|
// TODO : comparer cette liste et celle de la méthode normalize_string |
9288 |
|
// pour éviter les doublons + vérifier qu'il n'y a pas de doublons dans cette |
9289 |
|
// liste |
9290 |
|
$invalid = array('Œ'=>'oe', 'œ'=>'oe', 'Ÿ'=>'y', 'ü'=>'u', |
9291 |
|
'¢' => '_', 'ß' => '_', '¥' => '_', '£' => '_', '™' => '_', '©' => '_', |
9292 |
|
'®' => '_', 'ª' => '_', '×' => '_', '÷' => '_', '±' => '_', '²' => '_', |
9293 |
|
'³' => '_', '¼' => '_', '½' => '_', '¾' => '_', 'µ' => '_', '¿' => '_', |
9294 |
|
'¶' => '_', '·' => '_', '¸' => '_', 'º' => '_', '°' => '_', '¯' => '_', |
9295 |
|
'§' => '_', '…' => '_', '¤' => '_', '¦' => '_', '≠' => '_', '¬' => '_', |
9296 |
|
'ˆ' => '_', '¨' => '_', '‰' => '_', '¤' => '_', '€' => '_', '$' => '_', |
9297 |
|
'«' => '_', '»' => '_', '‹' => '_', '›' => '_', 'ƒ' => '_', '¥' => '_', |
9298 |
|
'‘‘' => '_', '‚' => '_', '!' => '_', '¡' => '_', '¢' => '_', '£' => '_', |
9299 |
|
'?' => '_', '[' => '_', ']' => '_', '´' => '_', '`' => '_', '^' => '_', |
9300 |
|
'~' => '_', '˜' => '_', '#' => '_', '*' => '_', '.' => '_', ':' => '_', |
9301 |
|
';' => '_', '•' => '_', '¯' => '_', '‾' => '_', '–' => '_', '–' => '_', |
9302 |
|
'—' => '_', '_' => '_', '|' => '_', '¦' => '_', '‡' => '_', '§' => '_', |
9303 |
|
'¶' => '_', '©' => '_', '®' => '_', '™' => '_', '&' => '_', '@' => '_', |
9304 |
|
'/' => '_', '\\' => '_', '◊' => '_', '♠' => '_', '♣' => '_', '♥' => '_', |
9305 |
|
'♦' => '_', '←' => '_', '↑' => '_', '→' => '_', '↓' => '_', '↔' => '_', |
9306 |
|
'°' => '_', 'µ' => '_', '<' => '_', '>' => '_', '≤' => '_', '≥' => '_', |
9307 |
|
'=' => '_', '≈' => '_', '≠' => '_', '≡' => '_', '±' => '_', '−' => '_', |
9308 |
|
'+' => '_', '×' => '_', '÷' => '_', '⁄' => '_', '%' => '_', '‰' => '_', |
9309 |
|
'¼' => '_', '½' => '_', '¾' => '_', '¹' => '_', '²' => '_', '³' => '_', |
9310 |
|
'' => '_', 'º' => '_', 'ª' => '_', 'ƒ' => '_', '′' => '_', '″' => '_', |
9311 |
|
'∂' => '_', '∏' => '_', '∑' => '_', '√' => '_', '∞' => '_', '¬' => '_', |
9312 |
|
'∩' => '_', '∫' => '_', 'α' => '_', 'Α' => '_', 'β' => '_', 'Β' => '_', |
9313 |
|
'γ' => '_', 'Γ' => '_', 'δ' => '_', 'Δ' => '_', 'ε' => '_', 'Ε' => '_', |
9314 |
|
'ζ' => '_', 'Ζ' => '_', 'η' => '_', 'Η' => '_', 'θ' => '_', 'Θ' => '_', |
9315 |
|
'ι' => '_', 'Ι' => '_', 'κ' => '_', 'Κ' => '_', 'λ' => '_', 'Λ' => '_', |
9316 |
|
'μ' => '_', 'Μ' => '_', 'ν' => '_', 'Ν' => '_', 'ξ' => '_', 'Ξ' => '_', |
9317 |
|
'ο' => '_', 'Ο' => '_', 'π' => '_', 'Π' => '_', 'ρ' => '_', 'Ρ' => '_', |
9318 |
|
'σ' => '_', 'ς' => '_', 'Σ' => '_', 'τ' => '_', 'Τ' => '_', 'υ' => '_', |
9319 |
|
'Υ' => '_', 'φ' => '_', 'Φ' => '_', 'χ' => '_', 'Χ' => '_', 'ψ' => '_', |
9320 |
|
'Ψ' => '_', 'ω' => '_', 'Ω' => '_', ',' => '_', ' ' => '_' |
9321 |
|
); |
9322 |
|
|
9323 |
|
return str_replace(array_keys($invalid), array_values($invalid), $documentLibelle); |
9324 |
|
} |
9325 |
|
|
9326 |
|
/** |
9327 |
|
* Surcharge permettant de ne pas afficher le fil d'Ariane dans |
9328 |
|
* l'overlay de notification des demandeurs. |
9329 |
|
*/ |
9330 |
|
function getSubFormTitle($ent) { |
9331 |
|
$actionSansPath = array('411', '420', '430'); |
9332 |
|
if (in_array($this->getParameter('maj'), $actionSansPath)) { |
9333 |
|
return ''; |
9334 |
|
} |
9335 |
|
return parent::getSubFormTitle($ent); |
9336 |
|
} |
9337 |
|
}// fin classe |