411 |
"permission_suffix" => "envoyer_a_signature", |
"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", |
427 |
|
"is_parapheur_annulation_parameter_enabled" |
428 |
|
), |
429 |
|
"permission_suffix" => "envoyer_a_signature", |
430 |
|
); |
431 |
|
|
432 |
// |
// |
433 |
$this->class_actions[401] = array( |
$this->class_actions[401] = array( |
434 |
"identifier" => "preview_edition", |
"identifier" => "preview_edition", |
452 |
"permission_suffix" => "modifier", |
"permission_suffix" => "modifier", |
453 |
); |
); |
454 |
|
|
455 |
// ACTION - 410 - Notifier les pétitionnaires (portail citoyen) |
// ACTION - 411 - Notifier les pétitionnaires (portail citoyen) |
456 |
$this->class_actions[411] = array( |
$this->class_actions[411] = array( |
457 |
"identifier" => "notification_manuelle_portal", |
"identifier" => "notification_manuelle_portal", |
458 |
"portlet" => array( |
"portlet" => array( |
468 |
"permission_suffix" => "modifier", |
"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( |
$this->class_actions[403] = array( |
503 |
"identifier" => "envoyer_au_controle_de_legalite", |
"identifier" => "envoyer_au_controle_de_legalite", |
643 |
"commentaire_signature", |
"commentaire_signature", |
644 |
"historique_signature", |
"historique_signature", |
645 |
"'' as suivi_notification", |
"'' as suivi_notification", |
646 |
|
"'' as suivi_notification_service", |
647 |
|
"'' as suivi_notification_tiers", |
648 |
|
|
649 |
"'' as preview_edition", |
"'' as preview_edition", |
650 |
"envoye_cl_platau", |
"envoye_cl_platau", |
651 |
|
"'' as log_instruction" |
652 |
); |
); |
653 |
} |
} |
654 |
|
|
710 |
return true; |
return true; |
711 |
} |
} |
712 |
|
|
713 |
|
/** |
714 |
|
* CONDITION - is_parapheur_annulation_parameter_enabled |
715 |
|
* |
716 |
|
* Vérifie que l'option d'annulation de l'envoi en signature est activée. |
717 |
|
* |
718 |
|
* @return boolean |
719 |
|
*/ |
720 |
|
function is_parapheur_annulation_parameter_enabled() { |
721 |
|
//Instanciation de la classe electronicsignature |
722 |
|
$inst_es = $this->get_electronicsignature_instance(); |
723 |
|
if ($inst_es === false) { |
724 |
|
return false; |
725 |
|
} |
726 |
|
|
727 |
|
if ($inst_es->get_conf('cancel_send') !== 'true' && $inst_es->get_conf('cancel_send') !== true) { |
728 |
|
return false; |
729 |
|
} |
730 |
|
|
731 |
|
return true; |
732 |
|
} |
733 |
|
|
734 |
|
|
735 |
/** |
/** |
736 |
* CONDITION - is_sent_for_signature |
* CONDITION - is_sent_for_signature |
747 |
if ($this->has_connector_electronicsignature() === true |
if ($this->has_connector_electronicsignature() === true |
748 |
&& empty($this->getVal("id_parapheur_signature")) === false |
&& empty($this->getVal("id_parapheur_signature")) === false |
749 |
&& ($this->getVal("statut_signature") != "canceled" |
&& ($this->getVal("statut_signature") != "canceled" |
750 |
|| $this->getVal("statut_signature") != "expired" |
&& $this->getVal("statut_signature") != "expired" |
751 |
|| $this->getVal("statut_signature") != "finished")) { |
&& $this->getVal("statut_signature") != "finished")) { |
752 |
// |
// |
753 |
return true; |
return true; |
754 |
} |
} |
796 |
return false; |
return false; |
797 |
} |
} |
798 |
|
|
799 |
|
|
800 |
|
/** |
801 |
|
* is_sent_to_cl |
802 |
|
* |
803 |
|
* Vérifie que l'instruction a été envoyé au contrôle de légalité |
804 |
|
* |
805 |
|
* @return boolean |
806 |
|
*/ |
807 |
function is_sent_to_cl() { |
function is_sent_to_cl() { |
808 |
// Si l'instruction a une édition |
// Si la case à cocher de l'instruction envoye_cl_platau est à "t" |
809 |
// et que l'événement est paramétré pour envoyer le contrôle de légalité |
if ($this->getVal('envoye_cl_platau') === 't') { |
810 |
// par Plat'AU |
// |
811 |
// et que la date de retour signature est renseignée |
return true; |
|
// et que la date d'envoi au contrôle légalité n'est pas renseignée |
|
|
// et qu'il n'existe pas de task envoi_CL en cours (!= done ou canceled) |
|
|
if ($this->has_an_edition() === true) { |
|
|
$inst_evenement = $this->get_inst_evenement($this->getVal('evenement')); |
|
|
if ($inst_evenement->getVal('envoi_cl_platau') === 't' |
|
|
|| $this->getVal('envoye_cl_platau') === 't') { |
|
|
// |
|
|
return true; |
|
|
} |
|
812 |
} |
} |
813 |
// |
// |
814 |
return false; |
return false; |
925 |
/** |
/** |
926 |
* CONDITION - can_display_notification |
* CONDITION - can_display_notification |
927 |
* |
* |
928 |
* Vérifie que le fieldset "Suivi notification" soit affichable |
* Vérifie que le champs "Suivi notification" est affichable |
929 |
* |
* |
930 |
* @return boolean |
* @return boolean |
931 |
*/ |
*/ |
932 |
function can_display_notification() { |
function can_display_notification_demandeur() { |
933 |
// Le suivi des notification est affiché si l'événement est notifiable |
// Le suivi des notification est affiché si l'événement est notifiable |
934 |
// et si des notifications ont été envoyées |
// et si des notifications ont été envoyées |
935 |
$evenement_id = $this->getVal("evenement"); |
$evenement_id = $this->getVal("evenement"); |
938 |
$inst_evenement->getVal('notification') != '') { |
$inst_evenement->getVal('notification') != '') { |
939 |
// Des notifications ont été envoyé si il existe au moins une notification |
// Des notifications ont été envoyé si il existe au moins une notification |
940 |
// liées à l'instruction |
// liées à l'instruction |
941 |
$idsNotifs = $this->get_instruction_notification($this->getVal($this->clePrimaire)); |
$idsNotifs = $this->get_instruction_notification( |
942 |
|
$this->getVal($this->clePrimaire), |
943 |
|
array( |
944 |
|
'notification_recepisse', |
945 |
|
'notification_instruction', |
946 |
|
'notification_decision', |
947 |
|
), |
948 |
|
true |
949 |
|
); |
950 |
|
if (isset($idsNotifs) && $idsNotifs !== array()) { |
951 |
|
return true; |
952 |
|
} |
953 |
|
} |
954 |
|
return false; |
955 |
|
} |
956 |
|
|
957 |
|
/** |
958 |
|
* CONDITION - can_display_notification |
959 |
|
* |
960 |
|
* Vérifie que le champs "suivi_notification_service" est affichable |
961 |
|
* |
962 |
|
* @return boolean |
963 |
|
*/ |
964 |
|
function can_display_notification_service() { |
965 |
|
// Le suivi des notification est affiché si l'événement est notifiable |
966 |
|
// et si des notifications ont été envoyées |
967 |
|
$evenement_id = $this->getVal("evenement"); |
968 |
|
$inst_evenement = $this->get_inst_evenement($evenement_id); |
969 |
|
if ($this->get_boolean_from_pgsql_value($inst_evenement->getVal('notification_service')) == true) { |
970 |
|
// Des notifications ont été envoyé si il existe au moins une notification |
971 |
|
// de type notification_service_consulte liées à l'instruction |
972 |
|
$idsNotifs = $this->get_instruction_notification( |
973 |
|
$this->getVal($this->clePrimaire), |
974 |
|
'notification_service_consulte' |
975 |
|
); |
976 |
|
if (isset($idsNotifs) && $idsNotifs !== array()) { |
977 |
|
return true; |
978 |
|
} |
979 |
|
} |
980 |
|
return false; |
981 |
|
} |
982 |
|
|
983 |
|
|
984 |
|
/** |
985 |
|
* CONDITION - can_display_notification_tiers |
986 |
|
* |
987 |
|
* Vérifie que le champs "suivi_notification_tiers" est affichable |
988 |
|
* |
989 |
|
* @return boolean |
990 |
|
*/ |
991 |
|
function can_display_notification_tiers() { |
992 |
|
// Le suivi des notification est affiché si l'événement est notifiable |
993 |
|
// et si des notifications ont été envoyées |
994 |
|
$evenement_id = $this->getVal("evenement"); |
995 |
|
$inst_evenement = $this->get_inst_evenement($evenement_id); |
996 |
|
if ($this->get_boolean_from_pgsql_value($inst_evenement->getVal('notification_tiers')) == true) { |
997 |
|
// Des notifications ont été envoyé si il existe au moins une notification |
998 |
|
// de type notification_tiers_consulte liées à l'instruction |
999 |
|
$idsNotifs = $this->get_instruction_notification( |
1000 |
|
$this->getVal($this->clePrimaire), |
1001 |
|
'notification_tiers_consulte' |
1002 |
|
); |
1003 |
if (isset($idsNotifs) && $idsNotifs !== array()) { |
if (isset($idsNotifs) && $idsNotifs !== array()) { |
1004 |
return true; |
return true; |
1005 |
} |
} |
1151 |
} |
} |
1152 |
} |
} |
1153 |
|
|
1154 |
// Le champ de suivi des notifications n'est pas affichable dans tous les cas |
// Le champ de suivi des notifications des demandeurs n'est pas affichable dans tous les cas |
1155 |
if ($this->can_display_notification() === true && $maj == 3) { |
if ($this->can_display_notification_demandeur() === true && $maj == 3) { |
1156 |
$form->setType('suivi_notification', 'jsontotab'); |
$form->setType('suivi_notification', 'jsontotab'); |
1157 |
} |
} |
1158 |
|
// Le champ de suivi des notifications des services n'est pas affichable dans tous les cas |
1159 |
|
if ($this->can_display_notification_service() === true && $maj == 3) { |
1160 |
|
$form->setType('suivi_notification_service', 'jsontotab'); |
1161 |
|
} |
1162 |
|
// Le champ de suivi des notifications des tiers n'est pas affichable dans tous les cas |
1163 |
|
if ($this->can_display_notification_tiers() === true && $maj == 3) { |
1164 |
|
$form->setType('suivi_notification_tiers', 'jsontotab'); |
1165 |
|
} |
1166 |
|
|
1167 |
// MODE AJOUTER |
// MODE AJOUTER |
1168 |
if ($this->getParameter('maj') == 0) { |
if ($this->getParameter('maj') == 0) { |
1223 |
$form->setType('btn_refresh', 'httpclickbutton'); |
$form->setType('btn_refresh', 'httpclickbutton'); |
1224 |
$form->setType('btn_preview', 'httpclickbutton'); |
$form->setType('btn_preview', 'httpclickbutton'); |
1225 |
$form->setType('btn_redaction', 'httpclickbutton'); |
$form->setType('btn_redaction', 'httpclickbutton'); |
1226 |
|
// /!\ le type du champs est utilisé dans un selecteur dans le jscript.js |
1227 |
|
// pour identifiant le champ de prévisualisation et régler sa taille à |
1228 |
|
// l'affichage du champ. En cas de modification, le selecteur doit également |
1229 |
|
// être mis à jour |
1230 |
$form->setType('live_preview', 'previsualiser_pdf'); |
$form->setType('live_preview', 'previsualiser_pdf'); |
1231 |
} |
} |
1232 |
|
|
1251 |
$form->setType('date_retour_rar', 'date'); |
$form->setType('date_retour_rar', 'date'); |
1252 |
$form->setType('date_envoi_controle_legalite', 'date'); |
$form->setType('date_envoi_controle_legalite', 'date'); |
1253 |
if ($this->is_sent_to_cl() === true) { |
if ($this->is_sent_to_cl() === true) { |
1254 |
$form->setType("date_envoi_controle_legalite", "datereadonly"); |
$form->setType("date_envoi_controle_legalite", "datedisabled"); |
1255 |
} |
} |
1256 |
$form->setType('date_retour_controle_legalite', 'date'); |
$form->setType('date_retour_controle_legalite', 'date'); |
1257 |
$form->setType('date_finalisation_courrier', 'date'); |
$form->setType('date_finalisation_courrier', 'date'); |
1323 |
$form->setType('date_retour_rar', 'date'); |
$form->setType('date_retour_rar', 'date'); |
1324 |
$form->setType('date_envoi_controle_legalite', 'date'); |
$form->setType('date_envoi_controle_legalite', 'date'); |
1325 |
if ($this->is_sent_to_cl() === true) { |
if ($this->is_sent_to_cl() === true) { |
1326 |
$form->setType("date_envoi_controle_legalite", "datereadonly"); |
$form->setType("date_envoi_controle_legalite", "datedisabled"); |
1327 |
} |
} |
1328 |
$form->setType('date_retour_controle_legalite', 'date'); |
$form->setType('date_retour_controle_legalite', 'date'); |
1329 |
$form->setType('date_finalisation_courrier', 'date'); |
$form->setType('date_finalisation_courrier', 'date'); |
1335 |
} |
} |
1336 |
$form->setType('preview_edition', 'previsualiser'); |
$form->setType('preview_edition', 'previsualiser'); |
1337 |
} |
} |
1338 |
|
|
1339 |
|
// Si l'instruction a été envoyé au contrôle de légalité et que la |
1340 |
|
// tâche envoi_cl lié n'a pas encore été traité il faut indiquer à |
1341 |
|
// l'utilisateur que l'envoi au cl est en cours de traitement. |
1342 |
|
if ($this->is_sent_to_cl() === true |
1343 |
|
&& empty($this->getVal('date_envoi_controle_legalite')) |
1344 |
|
&& $maj == 3) { |
1345 |
|
$form->setType("date_envoi_controle_legalite", "hiddenstatic"); |
1346 |
|
} |
1347 |
} |
} |
1348 |
|
|
1349 |
function setOnchange(&$form,$maj){ |
function setOnchange(&$form,$maj){ |
1425 |
* @return string |
* @return string |
1426 |
*/ |
*/ |
1427 |
function get_var_sql_forminc__sql_signataire_arrete() { |
function get_var_sql_forminc__sql_signataire_arrete() { |
1428 |
return "SELECT |
return sprintf( |
1429 |
signataire_arrete.signataire_arrete, |
"SELECT |
1430 |
CONCAT_WS(' - ', CONCAT_WS(' ', signataire_arrete.prenom, signataire_arrete.nom), signataire_arrete.description) |
signataire_arrete.signataire_arrete, |
1431 |
FROM ".DB_PREFIXE."signataire_arrete |
CONCAT_WS( |
1432 |
WHERE ((signataire_arrete.om_validite_debut IS NULL AND (signataire_arrete.om_validite_fin IS NULL OR signataire_arrete.om_validite_fin > CURRENT_DATE)) OR (signataire_arrete.om_validite_debut <= CURRENT_DATE AND (signataire_arrete.om_validite_fin IS NULL OR signataire_arrete.om_validite_fin > CURRENT_DATE))) |
' - ', |
1433 |
ORDER BY signataire_arrete.prenom, signataire_arrete.nom"; |
CONCAT_WS(' ', signataire_arrete.prenom, signataire_arrete.nom), |
1434 |
|
signataire_habilitation.libelle, |
1435 |
|
signataire_arrete.description |
1436 |
|
) |
1437 |
|
FROM |
1438 |
|
%1\$ssignataire_arrete |
1439 |
|
LEFT JOIN %1\$ssignataire_habilitation |
1440 |
|
ON signataire_arrete.signataire_habilitation = signataire_habilitation.signataire_habilitation |
1441 |
|
WHERE |
1442 |
|
((signataire_arrete.om_validite_debut IS NULL |
1443 |
|
AND (signataire_arrete.om_validite_fin IS NULL |
1444 |
|
OR signataire_arrete.om_validite_fin > CURRENT_DATE)) |
1445 |
|
OR (signataire_arrete.om_validite_debut <= CURRENT_DATE |
1446 |
|
AND (signataire_arrete.om_validite_fin IS NULL |
1447 |
|
OR signataire_arrete.om_validite_fin > CURRENT_DATE))) |
1448 |
|
ORDER BY |
1449 |
|
signataire_arrete.prenom, |
1450 |
|
signataire_arrete.nom", |
1451 |
|
DB_PREFIXE |
1452 |
|
); |
1453 |
} |
} |
1454 |
|
|
1455 |
/** |
/** |
1457 |
* @return string |
* @return string |
1458 |
*/ |
*/ |
1459 |
function get_var_sql_forminc__sql_signataire_arrete_by_id() { |
function get_var_sql_forminc__sql_signataire_arrete_by_id() { |
1460 |
return "SELECT |
return sprintf( |
1461 |
signataire_arrete.signataire_arrete, |
"SELECT |
1462 |
CONCAT_WS(' - ', CONCAT_WS(' ', signataire_arrete.prenom, signataire_arrete.nom), signataire_arrete.description) |
signataire_arrete.signataire_arrete, |
1463 |
FROM ".DB_PREFIXE."signataire_arrete |
CONCAT_WS( |
1464 |
WHERE signataire_arrete.signataire_arrete = <idx>"; |
' - ', |
1465 |
|
CONCAT_WS(' ', signataire_arrete.prenom, signataire_arrete.nom), |
1466 |
|
signataire_habilitation.libelle, |
1467 |
|
signataire_arrete.description |
1468 |
|
) |
1469 |
|
FROM |
1470 |
|
%1\$ssignataire_arrete |
1471 |
|
LEFT JOIN %1\$ssignataire_habilitation |
1472 |
|
ON signataire_arrete.signataire_habilitation = signataire_habilitation.signataire_habilitation |
1473 |
|
WHERE |
1474 |
|
signataire_arrete.signataire_arrete = <idx>", |
1475 |
|
DB_PREFIXE |
1476 |
|
); |
1477 |
} |
} |
1478 |
|
|
1479 |
/** |
/** |
1481 |
* @return string |
* @return string |
1482 |
*/ |
*/ |
1483 |
function get_var_sql_forminc__sql_signataire_arrete_by_di() { |
function get_var_sql_forminc__sql_signataire_arrete_by_di() { |
1484 |
return "SELECT |
return sprintf( |
1485 |
signataire_arrete.signataire_arrete, |
"SELECT |
1486 |
CONCAT_WS(' - ', CONCAT_WS(' ', signataire_arrete.prenom, signataire_arrete.nom), signataire_arrete.description) |
signataire_arrete.signataire_arrete, |
1487 |
FROM ".DB_PREFIXE."signataire_arrete |
CONCAT_WS( |
1488 |
LEFT JOIN ".DB_PREFIXE."om_collectivite ON signataire_arrete.om_collectivite = om_collectivite.om_collectivite |
' - ', |
1489 |
WHERE ((signataire_arrete.om_validite_debut IS NULL AND (signataire_arrete.om_validite_fin IS NULL OR signataire_arrete.om_validite_fin > CURRENT_DATE)) OR (signataire_arrete.om_validite_debut <= CURRENT_DATE AND (signataire_arrete.om_validite_fin IS NULL OR signataire_arrete.om_validite_fin > CURRENT_DATE))) |
CONCAT_WS(' ', signataire_arrete.prenom, signataire_arrete.nom), |
1490 |
AND (om_collectivite.niveau = '2' OR signataire_arrete.om_collectivite = <collectivite_di>) |
signataire_habilitation.libelle, |
1491 |
ORDER BY signataire_arrete.prenom, signataire_arrete.nom"; |
signataire_arrete.description |
1492 |
|
) |
1493 |
|
FROM |
1494 |
|
%1\$ssignataire_arrete |
1495 |
|
LEFT JOIN %1\$som_collectivite |
1496 |
|
ON signataire_arrete.om_collectivite = om_collectivite.om_collectivite |
1497 |
|
LEFT JOIN %1\$ssignataire_habilitation |
1498 |
|
ON signataire_arrete.signataire_habilitation = signataire_habilitation.signataire_habilitation |
1499 |
|
WHERE |
1500 |
|
((signataire_arrete.om_validite_debut IS NULL |
1501 |
|
AND (signataire_arrete.om_validite_fin IS NULL |
1502 |
|
OR signataire_arrete.om_validite_fin > CURRENT_DATE)) |
1503 |
|
OR (signataire_arrete.om_validite_debut <= CURRENT_DATE |
1504 |
|
AND (signataire_arrete.om_validite_fin IS NULL |
1505 |
|
OR signataire_arrete.om_validite_fin > CURRENT_DATE))) |
1506 |
|
AND (om_collectivite.niveau = '2' |
1507 |
|
OR signataire_arrete.om_collectivite = <collectivite_di>) |
1508 |
|
ORDER BY |
1509 |
|
signataire_arrete.prenom, signataire_arrete.nom", |
1510 |
|
DB_PREFIXE |
1511 |
|
); |
1512 |
} |
} |
1513 |
|
|
1514 |
/** |
/** |
1516 |
* @return string |
* @return string |
1517 |
*/ |
*/ |
1518 |
function get_var_sql_forminc__sql_signataire_arrete_defaut() { |
function get_var_sql_forminc__sql_signataire_arrete_defaut() { |
1519 |
return "SELECT |
return sprintf( |
1520 |
signataire_arrete.signataire_arrete, |
"SELECT |
1521 |
CONCAT_WS(' - ', CONCAT_WS(' ', signataire_arrete.prenom, signataire_arrete.nom), signataire_arrete.description) |
signataire_arrete.signataire_arrete, |
1522 |
FROM ".DB_PREFIXE."signataire_arrete |
CONCAT_WS( |
1523 |
WHERE ((signataire_arrete.om_validite_debut IS NULL AND (signataire_arrete.om_validite_fin IS NULL OR signataire_arrete.om_validite_fin > CURRENT_DATE)) OR (signataire_arrete.om_validite_debut <= CURRENT_DATE AND (signataire_arrete.om_validite_fin IS NULL OR signataire_arrete.om_validite_fin > CURRENT_DATE))) AND signataire_arrete.defaut IS TRUE |
' - ', |
1524 |
ORDER BY signataire_arrete.prenom, signataire_arrete.nom"; |
CONCAT_WS(' ', signataire_arrete.prenom, signataire_arrete.nom), |
1525 |
|
signataire_habilitation.libelle, |
1526 |
|
signataire_arrete.description |
1527 |
|
) |
1528 |
|
FROM |
1529 |
|
%1\$ssignataire_arrete |
1530 |
|
LEFT JOIN %1\$ssignataire_habilitation |
1531 |
|
ON signataire_arrete.signataire_habilitation = signataire_habilitation.signataire_habilitation |
1532 |
|
WHERE |
1533 |
|
((signataire_arrete.om_validite_debut IS NULL |
1534 |
|
AND (signataire_arrete.om_validite_fin IS NULL |
1535 |
|
OR signataire_arrete.om_validite_fin > CURRENT_DATE)) |
1536 |
|
OR (signataire_arrete.om_validite_debut <= CURRENT_DATE |
1537 |
|
AND (signataire_arrete.om_validite_fin IS NULL |
1538 |
|
OR signataire_arrete.om_validite_fin > CURRENT_DATE))) |
1539 |
|
AND signataire_arrete.defaut IS TRUE |
1540 |
|
ORDER BY |
1541 |
|
signataire_arrete.prenom, signataire_arrete.nom", |
1542 |
|
DB_PREFIXE |
1543 |
|
); |
1544 |
} |
} |
1545 |
|
|
1546 |
/** |
/** |
1548 |
* @return string |
* @return string |
1549 |
*/ |
*/ |
1550 |
function get_var_sql_forminc__sql_signataire_arrete_defaut_by_di() { |
function get_var_sql_forminc__sql_signataire_arrete_defaut_by_di() { |
1551 |
return "SELECT |
return sprintf( |
1552 |
signataire_arrete.signataire_arrete, |
"SELECT |
1553 |
CONCAT_WS(' - ', CONCAT_WS(' ', signataire_arrete.prenom, signataire_arrete.nom), signataire_arrete.description) |
signataire_arrete.signataire_arrete, |
1554 |
FROM ".DB_PREFIXE."signataire_arrete |
CONCAT_WS( |
1555 |
LEFT JOIN ".DB_PREFIXE."om_collectivite ON signataire_arrete.om_collectivite = om_collectivite.om_collectivite |
' - ', |
1556 |
WHERE ((signataire_arrete.om_validite_debut IS NULL AND (signataire_arrete.om_validite_fin IS NULL OR signataire_arrete.om_validite_fin > CURRENT_DATE)) OR (signataire_arrete.om_validite_debut <= CURRENT_DATE AND (signataire_arrete.om_validite_fin IS NULL OR signataire_arrete.om_validite_fin > CURRENT_DATE))) AND signataire_arrete.defaut IS TRUE |
CONCAT_WS(' ', signataire_arrete.prenom, signataire_arrete.nom), |
1557 |
AND (om_collectivite.niveau = '2' OR signataire_arrete.om_collectivite = <collectivite_di>) |
signataire_habilitation.libelle, |
1558 |
ORDER BY signataire_arrete.prenom, signataire_arrete.nom"; |
signataire_arrete.description |
1559 |
|
) |
1560 |
|
FROM |
1561 |
|
%1\$ssignataire_arrete |
1562 |
|
LEFT JOIN %1\$ssignataire_habilitation |
1563 |
|
ON signataire_arrete.signataire_habilitation = signataire_habilitation.signataire_habilitation |
1564 |
|
LEFT JOIN %1\$som_collectivite |
1565 |
|
ON signataire_arrete.om_collectivite = om_collectivite.om_collectivite |
1566 |
|
WHERE |
1567 |
|
((signataire_arrete.om_validite_debut IS NULL |
1568 |
|
AND (signataire_arrete.om_validite_fin IS NULL |
1569 |
|
OR signataire_arrete.om_validite_fin > CURRENT_DATE)) |
1570 |
|
OR (signataire_arrete.om_validite_debut <= CURRENT_DATE |
1571 |
|
AND (signataire_arrete.om_validite_fin IS NULL |
1572 |
|
OR signataire_arrete.om_validite_fin > CURRENT_DATE))) |
1573 |
|
AND signataire_arrete.defaut IS TRUE |
1574 |
|
AND (om_collectivite.niveau = '2' |
1575 |
|
OR signataire_arrete.om_collectivite = <collectivite_di>) |
1576 |
|
ORDER BY |
1577 |
|
signataire_arrete.prenom, |
1578 |
|
signataire_arrete.nom", |
1579 |
|
DB_PREFIXE |
1580 |
|
); |
1581 |
} |
} |
1582 |
|
|
1583 |
/** |
/** |
1911 |
$form->setVal("destinataire", $this->getParameter("idxformulaire")); |
$form->setVal("destinataire", $this->getParameter("idxformulaire")); |
1912 |
$form->setVal("dossier", $this->getParameter("idxformulaire")); |
$form->setVal("dossier", $this->getParameter("idxformulaire")); |
1913 |
} |
} |
1914 |
|
|
1915 |
|
// Si l'instruction a été envoyé au contrôle de légalité et que la |
1916 |
|
// tâche envoi_cl lié n'a pas encore été traité il faut indiquer à |
1917 |
|
// l'utilisateur que l'envoi au cl est en cours de traitement. |
1918 |
|
if ($this->is_sent_to_cl() === true |
1919 |
|
&& empty($this->getVal('date_envoi_controle_legalite')) |
1920 |
|
&& $maj == 3) { |
1921 |
|
$form->setVal("date_envoi_controle_legalite", __("En cours de traitement.")); |
1922 |
|
} |
1923 |
// |
// |
1924 |
$this->set_form_default_values($form, $maj, $validation); |
$this->set_form_default_values($form, $maj, $validation); |
1925 |
} |
} |
1989 |
} |
} |
1990 |
|
|
1991 |
if ($maj == 3 |
if ($maj == 3 |
1992 |
&& $this->can_display_notification() |
&& $this->can_display_notification_demandeur() |
1993 |
|
) { |
1994 |
|
$typeNotification = array( |
1995 |
|
'notification_recepisse', |
1996 |
|
'notification_instruction', |
1997 |
|
'notification_decision', |
1998 |
|
); |
1999 |
|
$form->setVal("suivi_notification", $this->get_json_suivi_notification($typeNotification, true)); |
2000 |
|
} |
2001 |
|
if ($maj == 3 |
2002 |
|
&& $this->can_display_notification_service() |
2003 |
) { |
) { |
2004 |
$form->setVal("suivi_notification", $this->get_json_suivi_notification()); |
$form->setVal("suivi_notification_service", $this->get_json_suivi_notification(array('notification_service_consulte'))); |
2005 |
|
} |
2006 |
|
if ($maj == 3 |
2007 |
|
&& $this->can_display_notification_tiers() |
2008 |
|
) { |
2009 |
|
$form->setVal("suivi_notification_tiers", $this->get_json_suivi_notification(array('notification_tiers_consulte'))); |
2010 |
} |
} |
2011 |
} |
} |
2012 |
|
|
2013 |
function setLayout(&$form, $maj){ |
function setLayout(&$form, $maj){ |
2014 |
|
// En consultation, pour les dossiers qui n'ont pas été transmis par le portail |
2015 |
|
// citoyen, si la notification des demandeurs est activée sur l'évenement |
2016 |
|
// d'instruction et que le paramétrage du demandeur principal n'est pas |
2017 |
|
// correct alors un message a destination de l'instructeur est affiché. |
2018 |
|
if ($maj == 3) { |
2019 |
|
// Si le dossier n'a pas été déposé sur le portail citoyen ou si |
2020 |
|
// la requête permettant de savoir le type de demande à échouée, on |
2021 |
|
// vérifie si il y a des erreurs de paramétrage et si c'est le cas |
2022 |
|
// on affiche un message d'information |
2023 |
|
if ($this->dossier_depose_sur_portail() == null || |
2024 |
|
! $this->dossier_depose_sur_portail()) { |
2025 |
|
$erreurParam = $this->get_info_notification_fail(); |
2026 |
|
// Récupération de l'évenement d'instruction |
2027 |
|
$instEV = $this->get_inst_evenement(); |
2028 |
|
if (! empty($instEV->getVal('notification')) && $erreurParam != array()) { |
2029 |
|
$class = 'text-info ui-state-highlight ui-state-info'; |
2030 |
|
$message = __("Attention l'envoi de notification automatique n'est pas possible."); |
2031 |
|
$this->f->display_panel_information( |
2032 |
|
$class, |
2033 |
|
$message, |
2034 |
|
$erreurParam, |
2035 |
|
__('Veuillez corriger les informations suivantes.'), |
2036 |
|
'erreur_param_notif' |
2037 |
|
); |
2038 |
|
} |
2039 |
|
} |
2040 |
|
} |
2041 |
$form->setBloc('evenement','D',"","sousform-instruction-action-".$maj); |
$form->setBloc('evenement','D',"","sousform-instruction-action-".$maj); |
2042 |
|
|
2043 |
$form->setFieldset('evenement','D',_('Evenement')); |
$form->setFieldset('evenement','D',_('Evenement')); |
2067 |
|
|
2068 |
$form->setFieldset('suivi_notification', 'D', __("Suivi notification"), "collapsible"); |
$form->setFieldset('suivi_notification', 'D', __("Suivi notification"), "collapsible"); |
2069 |
$form->setFieldset('suivi_notification','F'); |
$form->setFieldset('suivi_notification','F'); |
2070 |
|
$form->setFieldset('suivi_notification_service', 'D', __("Suivi notification service"), "collapsible"); |
2071 |
|
$form->setFieldset('suivi_notification_service','F'); |
2072 |
|
$form->setFieldset('suivi_notification_tiers', 'D', __("Suivi notification tiers"), "collapsible"); |
2073 |
|
$form->setFieldset('suivi_notification_tiers','F'); |
2074 |
|
|
2075 |
if ($maj == 1) { |
if ($maj == 1) { |
2076 |
// Récupère la collectivité du dossier d'instruction |
// Récupère la collectivité du dossier d'instruction |
2152 |
$form->setLib('commentaire_signature', __("commentaire")); |
$form->setLib('commentaire_signature', __("commentaire")); |
2153 |
$form->setLib('historique_signature', ''); |
$form->setLib('historique_signature', ''); |
2154 |
$form->setLib('suivi_notification', ''); |
$form->setLib('suivi_notification', ''); |
2155 |
|
$form->setLib('suivi_notification_service', ''); |
2156 |
|
$form->setLib('suivi_notification_tiers', ''); |
2157 |
$form->setLib('preview_edition', ""); |
$form->setLib('preview_edition', ""); |
2158 |
|
|
2159 |
// Ajout d'une infobulle d'aide lorsque le formulaire est en mode |
// Ajout d'une infobulle d'aide lorsque le formulaire est en mode |
2304 |
$this->valF["code_barres"] = $idTypeCourrier . $idCourrier; |
$this->valF["code_barres"] = $idTypeCourrier . $idCourrier; |
2305 |
} |
} |
2306 |
|
|
2307 |
// Test si une restriction est valide |
/** |
2308 |
// return boolean |
* Test si une restriction est valide. |
2309 |
|
* |
2310 |
|
* @return boolean |
2311 |
|
*/ |
2312 |
function restrictionIsValid($restriction){ |
function restrictionIsValid($restriction){ |
2313 |
if($this->restriction_valid != null) { |
if($this->restriction_valid != null) { |
2314 |
return $this->restriction_valid; |
return $this->restriction_valid; |
3248 |
); |
); |
3249 |
|
|
3250 |
// Création d'une notification et d'une tâche pour chaque demandeur à notifier |
// Création d'une notification et d'une tâche pour chaque demandeur à notifier |
3251 |
|
$demandeurPrincipalNotifie = false; |
3252 |
foreach ($demandeursANotifie as $demandeur) { |
foreach ($demandeursANotifie as $demandeur) { |
3253 |
|
// Identifie si le demandeur principal a été notifié ou pas |
3254 |
|
// et récupère ses informations |
3255 |
|
if ($demandeur['petitionnaire_principal'] == 't') { |
3256 |
|
$demandeurPrincipalNotifie = true; |
3257 |
|
// Si le demandeur principal est notifiable mais qu'il y a des erreurs dans |
3258 |
|
// son paramétrage, on effectue pas le traitement et on passe à l'itération |
3259 |
|
// suivante. On le considère également comme non notifié pour gérer l'envoie |
3260 |
|
// des messages d'erreurs |
3261 |
|
// Si la demande a été déposée via le portail alors le paramétrage n'a pas |
3262 |
|
// d'impact sur la notification |
3263 |
|
$erreursParam = $this->get_info_notification_fail($val['dossier']); |
3264 |
|
if (! $this->dossier_depose_sur_portail($val['dossier']) && $erreursParam != array()) { |
3265 |
|
$demandeurPrincipalNotifie = false; |
3266 |
|
continue; |
3267 |
|
} |
3268 |
|
} |
3269 |
// Ajout de la notif et récupération de son id |
// Ajout de la notif et récupération de son id |
3270 |
$idNotif = $this->ajouter_notification( |
$idNotif = $this->ajouter_notification( |
3271 |
$this->valF[$this->clePrimaire], |
$this->valF[$this->clePrimaire], |
3272 |
$this->f->get_connected_user_login_name(), |
$this->f->get_connected_user_login_name(), |
3273 |
$demandeur, |
$demandeur, |
3274 |
$collectivite_di, |
$collectivite_di, |
3275 |
|
array(), |
3276 |
true |
true |
3277 |
); |
); |
3278 |
if ($idNotif === false) { |
if ($idNotif === false) { |
3291 |
return false; |
return false; |
3292 |
} |
} |
3293 |
} |
} |
3294 |
|
// Si le demandeur principal n'est pas notifiable, on créé une nouvelle notification |
3295 |
|
// en erreur avec en commentaire la raison pour laquelle le demandeur principal |
3296 |
|
// n'a pas pu être notifié |
3297 |
|
if (! $demandeurPrincipalNotifie) { |
3298 |
|
// Analyse pour savoir pourquoi le demandeur principal n'est pas notifiable |
3299 |
|
$erreursParam = $this->get_info_notification_fail($val['dossier']); |
3300 |
|
$demandeurPrincipal = $this->get_info_petitionnaire_principal_dossier($val['dossier']); |
3301 |
|
// Ajout de la notif et récupération de son id |
3302 |
|
$idNotif = $this->ajouter_notification( |
3303 |
|
$this->valF[$this->clePrimaire], |
3304 |
|
$this->f->get_connected_user_login_name(), |
3305 |
|
$demandeurPrincipal, |
3306 |
|
$collectivite_di, |
3307 |
|
array(), |
3308 |
|
true, |
3309 |
|
'Echec', |
3310 |
|
implode(' ', $erreursParam) |
3311 |
|
); |
3312 |
|
if ($idNotif === false) { |
3313 |
|
$this->addToMessage( |
3314 |
|
__('Erreur : la création de la notification a échouée.'). |
3315 |
|
__("Veuillez contacter votre administrateur.") |
3316 |
|
); |
3317 |
|
return false; |
3318 |
|
} |
3319 |
|
// Prépare un message d'alerte à destination de l'instructeur pour l'informer |
3320 |
|
// de l'échec de la notification |
3321 |
|
$dossier_message = $this->get_inst_dossier_message(0); |
3322 |
|
$dossier_message_val = array( |
3323 |
|
'dossier' => $val['dossier'], |
3324 |
|
'type' => _('erreur expedition'), |
3325 |
|
'emetteur' => $this->f->get_connected_user_login_name().' (automatique)', |
3326 |
|
'login' => $_SESSION['login'], |
3327 |
|
'date_emission' => date('Y-m-d H:i:s'), |
3328 |
|
'contenu' => _('Échec lors de la notification de l\'instruction '). |
3329 |
|
$inst_evenement->getVal('libelle'). |
3330 |
|
'.<br>'. |
3331 |
|
implode("\n", $erreursParam). |
3332 |
|
'<br>'. |
3333 |
|
_('Veuillez corriger ces informations avant de renvoyer la notification.') |
3334 |
|
); |
3335 |
|
$add = $dossier_message->add_notification_message($dossier_message_val, true); |
3336 |
|
// Si une erreur se produit pendant l'ajout |
3337 |
|
if ($add !== true) { |
3338 |
|
$this->addToLog(__METHOD__."(): Le message d'alerte concernant l'echec de l'envoi de la notification n'a pas pu être envoyé.", DEBUG_MODE); |
3339 |
|
return false; |
3340 |
|
} |
3341 |
|
} |
3342 |
$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."))); |
$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."))); |
3343 |
} |
} |
3344 |
|
|
3365 |
return $this->add_log_to_dossier($id, array_merge($val, $this->valF)); |
return $this->add_log_to_dossier($id, array_merge($val, $this->valF)); |
3366 |
} |
} |
3367 |
|
|
3368 |
|
/** |
3369 |
|
* Cette méthode vérifie si toutes les conditions de l'envoi de la notification |
3370 |
|
* sont remplies. |
3371 |
|
* Les conditions vérifiées sont les suivantes : |
3372 |
|
* - Le petitionnaire principal doit accepter les notifications |
3373 |
|
* - Le pétitionnaire principal doit avoir une adresse mail renseignée |
3374 |
|
* - Le pétitionnaire principal doit avoir une adresse mail correcte |
3375 |
|
* Pour chaque vérification effectué un message d'erreur est ajouté si la |
3376 |
|
* condition n'est pas remplie. |
3377 |
|
* Renvoie le message d'erreur en sortie. |
3378 |
|
* |
3379 |
|
* @param string identifiant du dossier sur lequel les notifications ont échouée |
3380 |
|
* @return string |
3381 |
|
*/ |
3382 |
|
protected function get_info_notification_fail($dossier = null) { |
3383 |
|
// Utilise l'identifiant du dossier passé en paramètre et si aucun dossier n'a été récupéré |
3384 |
|
// utilise celui associé à l'instruction |
3385 |
|
if ($dossier == null) { |
3386 |
|
$dossier = $this->getVal('dossier'); |
3387 |
|
} |
3388 |
|
// Tableau contenant la liste des messages d'erreur |
3389 |
|
$errorMessage = array(); |
3390 |
|
// Récupère les informations du demandeurs principal |
3391 |
|
$infoPetitionnaire = $this->get_info_petitionnaire_principal_dossier($dossier); |
3392 |
|
// Vérifie si le pétitionnaire principal à bien la case "accepte les notification" cochée |
3393 |
|
if (isset($infoPetitionnaire['notification']) && $infoPetitionnaire['notification'] != 't') { |
3394 |
|
$errorMessage[] = __('Le pétitionnaire principal n\'accepte pas les notifications.'); |
3395 |
|
} |
3396 |
|
// Vérifie si l'adresse mail du pétitionnaire principale est renseignée |
3397 |
|
if (isset($infoPetitionnaire['courriel']) && ! empty($infoPetitionnaire['courriel'])) { |
3398 |
|
// Vérifie si le format de l'adresse mail est pas correct et, si ce n'est pas le cas, informe l'utilisateur |
3399 |
|
// qu'il doit le corriger avant de pouvoir ajouter l'nstruction |
3400 |
|
if (! $this->f->checkValidEmailAddress($infoPetitionnaire['courriel'])) { |
3401 |
|
$errorMessage[] = __('Le courriel du pétitionnaire principal n\'est pas correct : '). |
3402 |
|
$infoPetitionnaire['courriel']. |
3403 |
|
'.'; |
3404 |
|
} |
3405 |
|
} else { |
3406 |
|
// Si le courriel du pétitionnaire principal |
3407 |
|
$errorMessage[] = __('Le courriel du pétitionnaire principal n\'est pas renseigné.'); |
3408 |
|
} |
3409 |
|
|
3410 |
|
return $errorMessage; |
3411 |
|
} |
3412 |
|
|
3413 |
|
/** |
3414 |
|
* Méthode servant à vérifier si un dossier a été déposé sur |
3415 |
|
* le portail citoyen ou pas. |
3416 |
|
* La verification se fait via une requête sql dans laquelle |
3417 |
|
* on va chercher un dossier ayant pour id l'identifiant de |
3418 |
|
* dossier associé à l'instruction et pour lequel la demande |
3419 |
|
* associée la plus ancienne est une demande de création de |
3420 |
|
* dossier via portail |
3421 |
|
* |
3422 |
|
* @param string identifiant du dossier. Si non renseigné c'est le dossier |
3423 |
|
* associé à l'instruction qui est utilisé |
3424 |
|
* @return boolean|void true : dossier déposé via portail, false : dossier |
3425 |
|
* non déposé via portail et null : erreur de base de données. |
3426 |
|
*/ |
3427 |
|
protected function dossier_depose_sur_portail($dossier = null) { |
3428 |
|
if (empty($dossier)) { |
3429 |
|
$dossier = $this->getVal('dossier'); |
3430 |
|
} |
3431 |
|
$sql = sprintf( |
3432 |
|
'SELECT |
3433 |
|
dossier |
3434 |
|
FROM |
3435 |
|
%1$sdossier |
3436 |
|
-- Récuperation de la première demande associée au dossier |
3437 |
|
LEFT JOIN ( |
3438 |
|
SELECT |
3439 |
|
demande, |
3440 |
|
dossier_instruction, |
3441 |
|
source_depot |
3442 |
|
FROM |
3443 |
|
%1$sdemande |
3444 |
|
WHERE |
3445 |
|
dossier_instruction = \'%2$s\' |
3446 |
|
ORDER BY |
3447 |
|
demande ASC |
3448 |
|
LIMIT 1 |
3449 |
|
) as demande ON dossier.dossier = demande.dossier_instruction |
3450 |
|
WHERE |
3451 |
|
dossier.dossier = \'%2$s\' |
3452 |
|
AND demande.source_depot = \'portal\'', |
3453 |
|
DB_PREFIXE, |
3454 |
|
$dossier |
3455 |
|
); |
3456 |
|
$res = $this->f->get_one_result_from_db_query($sql, true); |
3457 |
|
if ($res['code'] === 'KO') { |
3458 |
|
$this->addToMessage(__('Erreur : La vérification du mode de dépôt du dossier à échoué')); |
3459 |
|
return; |
3460 |
|
} |
3461 |
|
// Si on a un résultat c'est que le dossier a été déposé via le portail |
3462 |
|
return ! empty($res['result']); |
3463 |
|
} |
3464 |
|
|
3465 |
|
public function is_service_notifiable() { |
3466 |
|
$evenement = $this->get_inst_evenement($this->getVal('evenement')); |
3467 |
|
|
3468 |
|
// Si l'instruction a une édition non finalisé quel que soit |
3469 |
|
// le type de notification, il n'est pas notifiable |
3470 |
|
if ($this->has_an_edition() === true) { |
3471 |
|
if ($this->is_unfinalizable_without_bypass() === false) { |
3472 |
|
return false; |
3473 |
|
} |
3474 |
|
} |
3475 |
|
// Vérifie si la notification des tiers est active pour l'évènement |
3476 |
|
return $this->get_boolean_from_pgsql_value($evenement->getVal('notification_service')); |
3477 |
|
} |
3478 |
|
|
3479 |
|
public function is_tiers_notifiable() { |
3480 |
|
$evenement = $this->get_inst_evenement($this->getVal('evenement')); |
3481 |
|
|
3482 |
|
// Si l'instruction a une édition non finalisé quel que soit |
3483 |
|
// le type de notification, il n'est pas notifiable |
3484 |
|
if ($this->has_an_edition() === true) { |
3485 |
|
if ($this->is_unfinalizable_without_bypass() === false) { |
3486 |
|
return false; |
3487 |
|
} |
3488 |
|
} |
3489 |
|
// Vérifie si la notification des tiers est active pour l'évènement |
3490 |
|
return $this->get_boolean_from_pgsql_value($evenement->getVal('notification_tiers')); |
3491 |
|
} |
3492 |
|
|
3493 |
|
/** |
3494 |
|
* Méthode permettant de savoir si une instruction peut |
3495 |
|
* être notifiée manuellement selon les différents types |
3496 |
|
* de notification. |
3497 |
|
* |
3498 |
|
* Si l'instruction a une édition non finalisée alors elle n'est pas |
3499 |
|
* manuellement notifiable. |
3500 |
|
* Si l'instruction est associé à un événement de notification pour |
3501 |
|
* lequel un retour signature est recquis, elle n'est notifiable que |
3502 |
|
* si la date de retour de signature est remplie. |
3503 |
|
* Par défaut si le type de notification n'est pas connu alors l'instruction |
3504 |
|
* n'est pas notifiable. |
3505 |
|
* Pour tous les autres cas l'instruction est manuellement notifiable. |
3506 |
|
* |
3507 |
|
* @return boolean true : notifiable | false : non notifiable |
3508 |
|
*/ |
3509 |
public function is_notifiable_by_task_manual() { |
public function is_notifiable_by_task_manual() { |
3510 |
$ev = $this->get_inst_evenement($this->getVal('evenement')); |
$ev = $this->get_inst_evenement($this->getVal('evenement')); |
3511 |
|
|
3518 |
} |
} |
3519 |
|
|
3520 |
// Gestion des différents cas selon la valeur du champs notification |
// Gestion des différents cas selon la valeur du champs notification |
3521 |
switch ($ev->getVal('notification')) { |
if ($ev->getVal('notification') == 'notification_manuelle' || |
3522 |
case 'notification_manuelle': |
$ev->getVal('notification') == 'notification_manuelle_annexe' || |
3523 |
return true; |
$ev->getVal('notification') == 'notification_automatique' |
3524 |
case 'notification_manuelle_annexe': |
) { |
3525 |
return true; |
return true; |
3526 |
case 'notification_automatique': |
} elseif (($ev->getVal('notification') == 'notification_auto_signature_requise' || |
3527 |
return false; |
$ev->getVal('notification') == 'notification_manuelle_signature_requise' || |
3528 |
case 'notification_auto_signature_requise': |
$ev->getVal('notification') == 'notification_manuelle_annexe_signature_requise') && |
3529 |
return false; |
$this->getVal('date_retour_signature') != null && |
3530 |
case 'notification_manuelle_signature_requise': |
$this->getVal('date_retour_signature') != '' |
3531 |
// Si il y a une date de retour de signature la notification est possible |
) { |
3532 |
if ($this->getVal('date_retour_signature') === null |
return true ; |
|
|| $this->getVal('date_retour_signature') === '') { |
|
|
return false; |
|
|
} |
|
|
return true; |
|
|
case 'notification_manuelle_annexe_signature_requise': |
|
|
// Si il y a une date de retour de signature la notification est possible |
|
|
if ($this->getVal('date_retour_signature') === null |
|
|
|| $this->getVal('date_retour_signature') === '') { |
|
|
return false; |
|
|
} |
|
|
return true; |
|
|
default: |
|
|
return false; |
|
3533 |
} |
} |
3534 |
|
return false; |
3535 |
} |
} |
3536 |
|
|
3537 |
/** |
/** |
3558 |
$this->f->get_connected_user_login_name(), |
$this->f->get_connected_user_login_name(), |
3559 |
$destinataire[0], |
$destinataire[0], |
3560 |
$collectivite_di, |
$collectivite_di, |
3561 |
|
array(), |
3562 |
true |
true |
3563 |
); |
); |
3564 |
if ($idNotification === false) { |
if ($idNotification === false) { |
3576 |
return $this->end_treatment(__METHOD__, true); |
return $this->end_treatment(__METHOD__, true); |
3577 |
} |
} |
3578 |
$this->addToMessage( __("Le demandeur principal n'est pas notifiable.")); |
$this->addToMessage( __("Le demandeur principal n'est pas notifiable.")); |
3579 |
return $this->end_treatment(__METHOD__, true); |
return $this->end_treatment(__METHOD__, false); |
3580 |
} |
} |
3581 |
|
|
3582 |
public function notification_by_task($object_id, $dossier, $category = null, $type = null) { |
public function notification_by_task($object_id, $dossier, $category = null, $type = null) { |
3585 |
$category = 'portal'; |
$category = 'portal'; |
3586 |
} |
} |
3587 |
// Si le type n'est pas correctement spécifié, alors il est calculé |
// Si le type n'est pas correctement spécifié, alors il est calculé |
3588 |
if ($type === null |
if ($type !== 'notification_recepisse' |
3589 |
|| $type !== 'notification_recepisse' |
&& $type !== 'notification_instruction' |
3590 |
|| $type !== 'notification_instruction' |
&& $type !== 'notification_decision' |
3591 |
|| $type !== 'notification_decision') { |
&& $type !== 'notification_service_consulte' |
3592 |
|
&& $type !== 'notification_tiers_consulte') { |
3593 |
// |
// |
3594 |
$type = 'notification_instruction'; |
$type = 'notification_instruction'; |
3595 |
// Vérifie si l'instruction est un récépissé |
// Vérifie si l'instruction est un récépissé |
3661 |
$emetteur, |
$emetteur, |
3662 |
$destinataire, |
$destinataire, |
3663 |
$collectiviteId, |
$collectiviteId, |
3664 |
|
$annexes = array(), |
3665 |
$demandeAuto = false, |
$demandeAuto = false, |
3666 |
$idInstrDocAnnexe = null |
$statut = 'en cours d\'envoi', |
3667 |
|
$commentaire = 'Notification en cours de traitement' |
3668 |
) { |
) { |
3669 |
// Vérification que les paramètres nécessaires à l'envoi de la notification existe avant |
// Vérification que les paramètres nécessaires à l'envoi de la notification existe avant |
3670 |
// de créer la notification |
// de créer la notification |
3686 |
'destinataire' => $destinataire['destinataire'], |
'destinataire' => $destinataire['destinataire'], |
3687 |
'courriel' => $destinataire['courriel'], |
'courriel' => $destinataire['courriel'], |
3688 |
'date_premier_acces' => null, |
'date_premier_acces' => null, |
3689 |
'statut' => 'en cours d\'envoi', |
'statut' => $statut, |
3690 |
'commentaire' => 'Notification en cours de traitement' |
'commentaire' => $commentaire |
3691 |
); |
); |
3692 |
|
|
3693 |
// Création de la notification |
// Création de la notification |
3700 |
// Si il y a une lettretype finalisé stockage de la clé d'accès au documents |
// Si il y a une lettretype finalisé stockage de la clé d'accès au documents |
3701 |
if ($this->evenement_has_an_edition($this->getVal('evenement')) === true) { |
if ($this->evenement_has_an_edition($this->getVal('evenement')) === true) { |
3702 |
$add_notif_doc = $this->ajouter_notification_document( |
$add_notif_doc = $this->ajouter_notification_document( |
3703 |
|
$inst_notif->getVal($inst_notif->clePrimaire), |
3704 |
$this->getVal($this->clePrimaire), |
$this->getVal($this->clePrimaire), |
3705 |
$inst_notif->getVal($inst_notif->clePrimaire) |
'instruction' |
3706 |
); |
); |
3707 |
if ($add_notif_doc === false) { |
if ($add_notif_doc === false) { |
3708 |
$this->addToMessage(__("Erreur lors de la génération de la notification du document.")); |
$this->addToMessage(__("Erreur lors de la génération de la notification du document.")); |
3710 |
} |
} |
3711 |
} |
} |
3712 |
// Si une annexe a été choisie stockage de la clé d'accès à l'annexe |
// Si une annexe a été choisie stockage de la clé d'accès à l'annexe |
3713 |
if ($idInstrDocAnnexe != null || $idInstrDocAnnexe != '') { |
if (! empty($annexes) && is_array($annexes)) { |
3714 |
$add_notif_annexe = $this->ajouter_notification_document( |
$add_notif_annexe = $this->ajouter_notification_document_multiple( |
|
$idInstrDocAnnexe, |
|
3715 |
$inst_notif->getVal($inst_notif->clePrimaire), |
$inst_notif->getVal($inst_notif->clePrimaire), |
3716 |
true |
$annexes |
3717 |
); |
); |
3718 |
if ($add_notif_annexe === false) { |
if ($add_notif_annexe === false) { |
3719 |
$this->addToMessage(__("Erreur lors de la génération de la notification de l'annexe.")); |
$this->addToMessage(__("Erreur lors de la génération de la notification de l'annexe.")); |
3726 |
} |
} |
3727 |
|
|
3728 |
/** |
/** |
3729 |
* Vérifie si le paramétrage de la notification des demandeurs est correct. |
* Pour chaque élément du tableau passé en paramètre ajoute une nouvelle |
3730 |
|
* instance dans la table instruction_notification_document lié a la |
3731 |
|
* notification dont l'id est passé en paramètre. |
3732 |
* |
* |
3733 |
* @param integer identifiant de la collectivité |
* @param array tableau contenant les informations nécessaires pour créer les annexes |
3734 |
* @return boolean |
* |
3735 |
|
* @return integer|boolean identifiant de la notification créée si le traitement |
3736 |
|
* a réussie, false sinon. |
3737 |
*/ |
*/ |
3738 |
protected function is_parametrage_notification_correct($collectiviteId) { |
protected function ajouter_notification_document_multiple($idNotification, $listeDocument) { |
3739 |
$categorie = $this->f->get_param_option_notification($collectiviteId); |
foreach ($listeDocument as $paramDoc) { |
3740 |
$urlAccesNotif = $this->f->get_parametre_notification_url_acces($collectiviteId); |
if (! $this->ajouter_notification_document($idNotification, $paramDoc['id'], $paramDoc['tableDocument'], $paramDoc['isAnnexe'])) { |
3741 |
if ($categorie == 'mail' && $urlAccesNotif == null) { |
$this->addToMessage(__("Erreur lors de la génération des documents à notifier.")); |
3742 |
return false; |
return false; |
3743 |
|
} |
3744 |
} |
} |
3745 |
return true; |
return true; |
3746 |
} |
} |
3747 |
|
|
3748 |
/** |
/** |
3749 |
* Ajoute un élément dans la table instruction_notification_document. |
* Ajoute un élément dans la table instruction_notification_document en utilisant |
3750 |
|
* les éléments fourni en paramètre |
3751 |
* |
* |
|
* @param integer $idInstruction : id de l'instruction à laquelle est rattaché le document |
|
3752 |
* @param integer $idNotification : id de la notification à laquelle on associe le document |
* @param integer $idNotification : id de la notification à laquelle on associe le document |
3753 |
|
* @param integer $idDocument : id de l'objet auquel est rattaché le document |
3754 |
|
* @param string $tableDocument : nom de la table a laquelle est rattaché le document |
3755 |
* @param boolean $isAnnexe : indique si le document est une annexe ou pas |
* @param boolean $isAnnexe : indique si le document est une annexe ou pas |
3756 |
* |
* |
3757 |
* @return boolean indique si le traitement a réussi |
* @return boolean indique si le traitement a réussi |
3758 |
*/ |
*/ |
3759 |
protected function ajouter_notification_document($idInstruction, $idNotification, $isAnnexe = false) { |
protected function ajouter_notification_document($idNotification, $idDocument, $tableDocument, $isAnnexe = false) { |
3760 |
$inst_notif_doc = $this->f->get_inst__om_dbform(array( |
$inst_notif_doc = $this->f->get_inst__om_dbform(array( |
3761 |
"obj" => "instruction_notification_document", |
"obj" => "instruction_notification_document", |
3762 |
"idx" => "]", |
"idx" => "]", |
3763 |
)); |
)); |
3764 |
|
// l'attribut instruction doit obligatoirement être renseigné |
3765 |
|
// pour éviter toutes confusion avec d'autres instruction l'id |
3766 |
|
// 0 est donné au document n'appartenant pas aux instructions |
3767 |
$notif_doc_val = array( |
$notif_doc_val = array( |
3768 |
'instruction_notification_document' => null, |
'instruction_notification_document' => null, |
3769 |
'instruction_notification' => $idNotification, |
'instruction_notification' => $idNotification, |
3770 |
'instruction' => $idInstruction, |
'instruction' => $tableDocument == 'instruction' ? $idDocument : 0, |
3771 |
|
'document_type' => $tableDocument, |
3772 |
|
'document_id' => $idDocument, |
3773 |
'cle' => $this->getCleAccesDocument(), |
'cle' => $this->getCleAccesDocument(), |
3774 |
'annexe' => $isAnnexe |
'annexe' => $isAnnexe |
3775 |
); |
); |
3782 |
} |
} |
3783 |
|
|
3784 |
/** |
/** |
3785 |
|
* Vérifie si le paramétrage de la notification des demandeurs est correct. |
3786 |
|
* |
3787 |
|
* @param integer identifiant de la collectivité |
3788 |
|
* @return boolean |
3789 |
|
*/ |
3790 |
|
protected function is_parametrage_notification_correct($collectiviteId) { |
3791 |
|
$categorie = $this->f->get_param_option_notification($collectiviteId); |
3792 |
|
$urlAccesNotif = $this->f->get_parametre_notification_url_acces($collectiviteId); |
3793 |
|
if ($categorie == 'mail' && $urlAccesNotif == null) { |
3794 |
|
return false; |
3795 |
|
} |
3796 |
|
return true; |
3797 |
|
} |
3798 |
|
|
3799 |
|
/** |
3800 |
* TRIGGER - triggermodifierapres. |
* TRIGGER - triggermodifierapres. |
3801 |
* |
* |
3802 |
* @return boolean |
* @return boolean |
4150 |
); |
); |
4151 |
|
|
4152 |
// Création d'une notification et d'une tâche pour chaque demandeur à notifier |
// Création d'une notification et d'une tâche pour chaque demandeur à notifier |
4153 |
|
$demandeurPrincipalNotifie = false; |
4154 |
foreach ($demandeursANotifie as $demandeur) { |
foreach ($demandeursANotifie as $demandeur) { |
4155 |
|
// Identifie si le demandeur principal a été notifié ou pas |
4156 |
|
// et récupère ses informations |
4157 |
|
if ($demandeur['petitionnaire_principal'] == 't') { |
4158 |
|
$demandeurPrincipalNotifie = true; |
4159 |
|
// Si le demandeur principal est notifiable mais qu'il y a des erreurs dans |
4160 |
|
// son paramétrage, on effectue pas le traitement et on passe à l'itération |
4161 |
|
// suivante. On le considère également comme non notifié pour gérer l'envoie |
4162 |
|
// des messages d'erreurs |
4163 |
|
// Si la demande a été déposée via le portail alors le paramétrage n'a pas |
4164 |
|
// d'impact sur la notification |
4165 |
|
$erreursParam = $this->get_info_notification_fail(); |
4166 |
|
if (! $this->dossier_depose_sur_portail() && $erreursParam != array()) { |
4167 |
|
$demandeurPrincipalNotifie = false; |
4168 |
|
continue; |
4169 |
|
} |
4170 |
|
} |
4171 |
// Ajout de la notif et récupération de son id |
// Ajout de la notif et récupération de son id |
4172 |
$idNotif = $this->ajouter_notification( |
$idNotif = $this->ajouter_notification( |
4173 |
$this->valF[$this->clePrimaire], |
$this->valF[$this->clePrimaire], |
4174 |
$this->f->get_connected_user_login_name(), |
$this->f->get_connected_user_login_name(), |
4175 |
$demandeur, |
$demandeur, |
4176 |
$collectivite_di, |
$collectivite_di, |
4177 |
|
array(), |
4178 |
true |
true |
4179 |
); |
); |
4180 |
if ($idNotif === false) { |
if ($idNotif === false) { |
4193 |
return false; |
return false; |
4194 |
} |
} |
4195 |
} |
} |
4196 |
|
// Si le demandeur principal n'est pas notifiable, on créé une nouvelle notification |
4197 |
|
// en erreur avec en commentaire la raison pour laquelle le demandeur principal |
4198 |
|
// n'a pas pu être notifié |
4199 |
|
if (! $demandeurPrincipalNotifie) { |
4200 |
|
// Analyse pour savoir pourquoi le demandeur principal n'est pas notifiable |
4201 |
|
$erreursParam = $this->get_info_notification_fail(); |
4202 |
|
$demandeurPrincipal = $this->get_info_petitionnaire_principal_dossier($this->getVal('dossier')); |
4203 |
|
// Ajout de la notif et récupération de son id |
4204 |
|
$idNotif = $this->ajouter_notification( |
4205 |
|
$this->valF[$this->clePrimaire], |
4206 |
|
$this->f->get_connected_user_login_name(), |
4207 |
|
$demandeurPrincipal, |
4208 |
|
$collectivite_di, |
4209 |
|
array(), |
4210 |
|
true, |
4211 |
|
'Echec', |
4212 |
|
implode(' ', $erreursParam) |
4213 |
|
); |
4214 |
|
if ($idNotif === false) { |
4215 |
|
$this->addToMessage( |
4216 |
|
__('Erreur : la création de la notification a échouée.'). |
4217 |
|
__("Veuillez contacter votre administrateur.") |
4218 |
|
); |
4219 |
|
return false; |
4220 |
|
} |
4221 |
|
// Prépare un message d'alerte à destination de l'instructeur pour l'informer |
4222 |
|
// de l'échec de la notification |
4223 |
|
$dossier_message = $this->get_inst_dossier_message(0); |
4224 |
|
$dossier_message_val = array( |
4225 |
|
'dossier' => $this->getVal('dossier'), |
4226 |
|
'type' => _('erreur expedition'), |
4227 |
|
'emetteur' => $this->f->get_connected_user_login_name(), |
4228 |
|
'login' => $_SESSION['login'], |
4229 |
|
'date_emission' => date('Y-m-d H:i:s'), |
4230 |
|
'contenu' => _('Échec lors de la notification de l\'instruction '). |
4231 |
|
$ev->getVal('libelle'). |
4232 |
|
'.<br>'. |
4233 |
|
implode("\n", $erreursParam). |
4234 |
|
'<br>'. |
4235 |
|
_('Veuillez corriger ces informations avant de renvoyer la notification.') |
4236 |
|
); |
4237 |
|
$add = $dossier_message->add_notification_message($dossier_message_val, true); |
4238 |
|
// Si une erreur se produit pendant l'ajout |
4239 |
|
if ($add !== true) { |
4240 |
|
$this->addToLog(__METHOD__."(): Le message d'alerte concernant l'echec de l'envoi de la notification n'a pas pu être envoyé.", DEBUG_MODE); |
4241 |
|
return false; |
4242 |
|
} |
4243 |
|
} |
4244 |
$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."))); |
$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."))); |
4245 |
} |
} |
4246 |
} |
} |
4499 |
} |
} |
4500 |
|
|
4501 |
/** |
/** |
4502 |
|
* Surcharge de la méthode verifier() de la classe om_dbform pour y ajouter |
4503 |
|
* les vérifications suivantes : |
4504 |
|
* - Si l'instruction à un événement associé et que cet événement à des restrictions : |
4505 |
|
* 1. vérifie si la restriction est valide, si ce n'est pas le cas récupère et affiche |
4506 |
|
* le message d'erreur associé à la restriction |
4507 |
|
* 2. vérifie si les restrictions sont respectées. Si ce n'est pas le cas bloque l'ajout |
4508 |
|
* et / ou la modification et affiche un message d'erreur |
4509 |
|
* - |
4510 |
|
* - |
4511 |
|
* - |
4512 |
|
* - |
4513 |
|
* - |
4514 |
|
* - |
4515 |
|
* |
4516 |
|
* @param array val : tableau contenant les valeurs issues du formulaire. |
4517 |
|
* @param - dnu1 : Paramètre déprécié et non utilisé. |
4518 |
|
* @param - dnu2 : Paramètre déprécié et non utilisé. |
4519 |
|
* |
4520 |
* @return void |
* @return void |
4521 |
*/ |
*/ |
4522 |
function verifier($val = array(), &$dnu1 = null, $dnu2 = null) { |
function verifier($val = array(), &$dnu1 = null, $dnu2 = null) { |
4598 |
} |
} |
4599 |
|
|
4600 |
} |
} |
4601 |
|
|
4602 |
|
/** |
4603 |
|
* Récupère et stocket dans un tableau toutes les infos du pétitionnaire |
4604 |
|
* principal du dossier auquel appartiens l'instruction. |
4605 |
|
* Renvoie un tableau contenant les informations du pétitionnaire principal. |
4606 |
|
* |
4607 |
|
* Si l'identifiant de l'instruction n'a pas pu etre récupéré renvoie false |
4608 |
|
* et affiche un message dans les logs. |
4609 |
|
* En cas d'erreur de base de donnée renvoie false et affiche un message d'erreur. |
4610 |
|
* |
4611 |
|
* @param string identifiant du dossier |
4612 |
|
* @return array|boolean |
4613 |
|
*/ |
4614 |
|
protected function get_info_petitionnaire_principal_dossier($dossier = null) { |
4615 |
|
// Si l'identifiant de l'instruction n'a pas été fournit on récupère celui de |
4616 |
|
// l'objet courant |
4617 |
|
if (empty($dossier)) { |
4618 |
|
$dossier = $this->getVal('dossier'); |
4619 |
|
// Si la récupération de l'identifiant de l'instruction a échoué la méthode renvoie |
4620 |
|
// false et on affiche un message d'erreur dans les logs |
4621 |
|
if (empty($dossier)) { |
4622 |
|
$this->addToLog(__METHOD__.' : L\'identifiant du dossier n\'a pas pu être récupéré'); |
4623 |
|
return false; |
4624 |
|
} |
4625 |
|
} |
4626 |
|
|
4627 |
|
// Requête sql servant à récupérer toutes les informations relatives au demandeurs |
4628 |
|
// principal |
4629 |
|
$sql = sprintf( |
4630 |
|
'SELECT |
4631 |
|
-- Récupère toutes les informations du demandeur principal |
4632 |
|
demandeur.*, |
4633 |
|
CASE |
4634 |
|
WHEN demandeur.qualite=\'particulier\' |
4635 |
|
THEN TRIM(CONCAT(demandeur.particulier_nom, \' \', demandeur.particulier_prenom, \' \', demandeur.courriel)) |
4636 |
|
ELSE |
4637 |
|
TRIM(CONCAT(demandeur.personne_morale_raison_sociale, \' \', demandeur.personne_morale_denomination, \' \', demandeur.courriel)) |
4638 |
|
END AS destinataire |
4639 |
|
FROM |
4640 |
|
%1$sdossier |
4641 |
|
LEFT JOIN %1$slien_dossier_demandeur |
4642 |
|
ON lien_dossier_demandeur.dossier = dossier.dossier |
4643 |
|
LEFT JOIN %1$sdemandeur |
4644 |
|
ON demandeur.demandeur = lien_dossier_demandeur.demandeur |
4645 |
|
WHERE |
4646 |
|
dossier.dossier = \'%2$s\' |
4647 |
|
AND lien_dossier_demandeur.petitionnaire_principal IS TRUE', |
4648 |
|
DB_PREFIXE, |
4649 |
|
$dossier |
4650 |
|
); |
4651 |
|
|
4652 |
|
$res = $this->f->get_one_row_result_from_db_query($sql); |
4653 |
|
if ($res['code'] === 'KO') { |
4654 |
|
return false; |
4655 |
|
} |
4656 |
|
return $res['result']; |
4657 |
|
} |
4658 |
|
|
4659 |
|
|
4660 |
|
|
4661 |
/** |
/** |
4662 |
* Finalisation des documents. |
* Finalisation des documents. |
5805 |
|
|
5806 |
|
|
5807 |
// 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 |
5808 |
$sql = |
// /!\ Requête lié à celles du widget indiquant les dossiers éligible au changement |
5809 |
"SELECT |
// de décision : |
5810 |
|
// * dossier_instruction.class.php : view_widget_dossiers_evenement_retour_finalise() |
5811 |
|
// * dossier_instruction.inc.php : si le paramètre filtre_decision = true |
5812 |
|
$sql = sprintf( |
5813 |
|
'SELECT |
5814 |
dossier.dossier |
dossier.dossier |
5815 |
FROM |
FROM |
5816 |
".DB_PREFIXE."dossier |
%1$sdossier |
5817 |
JOIN ".DB_PREFIXE."instruction ON instruction.instruction = ( |
JOIN %1$setat |
5818 |
SELECT instruction |
ON dossier.etat = etat.etat AND etat.statut = \'encours\' |
5819 |
FROM ".DB_PREFIXE."instruction |
JOIN %1$slien_dossier_demandeur |
5820 |
JOIN ".DB_PREFIXE."evenement on instruction.evenement=evenement.evenement |
ON dossier.dossier = lien_dossier_demandeur.dossier AND lien_dossier_demandeur.petitionnaire_principal IS TRUE |
5821 |
WHERE instruction.dossier = dossier.dossier |
JOIN %1$sdossier_instruction_type |
5822 |
AND evenement.retour IS FALSE |
ON dossier.dossier_instruction_type=dossier_instruction_type.dossier_instruction_type |
5823 |
ORDER BY date_evenement DESC, instruction DESC |
JOIN %1$sinstruction |
5824 |
LIMIT 1 |
-- Recherche de la dernière instruction qui ne soit pas liée à un événement retour |
5825 |
) |
ON instruction.instruction = ( |
5826 |
JOIN ".DB_PREFIXE."evenement ON instruction.evenement=evenement.evenement |
SELECT instruction |
5827 |
JOIN ".DB_PREFIXE."instructeur ON dossier.instructeur=instructeur.instructeur |
FROM %1$sinstruction |
5828 |
JOIN ".DB_PREFIXE."om_utilisateur ON instructeur.om_utilisateur=om_utilisateur.om_utilisateur |
JOIN %1$sevenement ON instruction.evenement=evenement.evenement |
5829 |
JOIN ".DB_PREFIXE."om_collectivite ON om_collectivite.om_collectivite=om_utilisateur.om_collectivite |
AND evenement.retour IS FALSE |
5830 |
JOIN ".DB_PREFIXE."etat ON dossier.etat = etat.etat |
WHERE instruction.dossier = dossier.dossier |
5831 |
|
ORDER BY date_evenement DESC, instruction DESC |
5832 |
|
LIMIT 1 |
5833 |
|
) |
5834 |
|
-- On ne garde que les dossiers pour lesquels la dernière instruction est finalisée |
5835 |
|
-- ou alors pour laquelle l instruction a été ajouté par la commune et est |
5836 |
|
-- non signée, non notifié, etc. |
5837 |
|
AND (instruction.om_final_instruction IS TRUE |
5838 |
|
OR instruction.created_by_commune IS TRUE) |
5839 |
|
AND instruction.date_retour_signature IS NULL |
5840 |
|
AND instruction.date_envoi_rar IS NULL |
5841 |
|
AND instruction.date_retour_rar IS NULL |
5842 |
|
AND instruction.date_envoi_controle_legalite IS NULL |
5843 |
|
AND instruction.date_retour_controle_legalite IS NULL |
5844 |
|
-- On vérifie que l instruction soit un arrêté ou un changement de décision |
5845 |
|
JOIN %1$sevenement |
5846 |
|
ON instruction.evenement=evenement.evenement |
5847 |
|
AND (evenement.type = \'arrete\' |
5848 |
|
OR evenement.type = \'changement_decision\') |
5849 |
|
-- Recherche les informations du pétitionnaire principal pour l affichage |
5850 |
|
JOIN %1$sdemandeur |
5851 |
|
ON lien_dossier_demandeur.demandeur = demandeur.demandeur |
5852 |
|
-- Recherche la collectivité rattachée à l instructeur |
5853 |
|
JOIN %1$sinstructeur |
5854 |
|
ON dossier.instructeur=instructeur.instructeur |
5855 |
|
JOIN %1$sdivision |
5856 |
|
ON instructeur.division=division.division |
5857 |
|
JOIN %1$sdirection |
5858 |
|
ON division.direction=direction.direction |
5859 |
|
JOIN %1$som_collectivite |
5860 |
|
ON direction.om_collectivite=om_collectivite.om_collectivite |
5861 |
WHERE |
WHERE |
5862 |
|
-- Vérification que la décision a été prise par l agglo |
5863 |
( |
om_collectivite.niveau = \'2\' |
5864 |
evenement.type = 'arrete' AND |
AND dossier.dossier = \'%2$s\' |
5865 |
( |
', |
5866 |
instruction.om_final_instruction IS TRUE |
DB_PREFIXE, |
5867 |
OR instruction.created_by_commune IS TRUE |
$idx |
5868 |
) 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' |
|
|
"; |
|
5869 |
|
|
5870 |
|
|
5871 |
// Si collectivité de l'utilisateur niveau mono alors filtre sur celle-ci |
// Si collectivité de l'utilisateur niveau mono alors filtre sur celle-ci |
5872 |
if ($this->f->isCollectiviteMono($_SESSION['collectivite']) === true) { |
if ($this->f->isCollectiviteMono($_SESSION['collectivite']) === true) { |
5873 |
$sql .= " AND dossier.om_collectivite=".$_SESSION['collectivite']; |
$sql .= sprintf( |
5874 |
|
' AND dossier.om_collectivite=%1$s', |
5875 |
|
$_SESSION['collectivite'] |
5876 |
|
); |
5877 |
} |
} |
5878 |
$res = $this->f->db->getone($sql); |
$res = $this->f->db->getone($sql); |
5879 |
if (database::isError($res)) { |
if (database::isError($res)) { |
5982 |
// dites de TREATMENT. |
// dites de TREATMENT. |
5983 |
$this->begin_treatment(__METHOD__); |
$this->begin_treatment(__METHOD__); |
5984 |
$message = ''; |
$message = ''; |
5985 |
|
$ev = $this->get_inst_evenement($this->getVal('evenement')); |
5986 |
|
|
5987 |
|
// Controle du signataire |
5988 |
|
if (! $this->controle_signataire($ev)) { |
5989 |
|
$this->addToMessage(__("Le document ne peut pas être finalisé car aucun signataire n'a été sélectionné.")); |
5990 |
|
// Termine le traitement |
5991 |
|
return $this->end_treatment(__METHOD__, false); |
5992 |
|
} |
5993 |
|
|
5994 |
// Traitement de la finalisation |
// Traitement de la finalisation |
5995 |
$ret = $this->manage_finalizing("finalize", $val); |
$ret = $this->manage_finalizing("finalize", $val); |
6003 |
|
|
6004 |
// Envoi des notifications aux demandeurs si la notification est automatique |
// Envoi des notifications aux demandeurs si la notification est automatique |
6005 |
// et que la signature n'est pas requise |
// et que la signature n'est pas requise |
|
$ev = $this->get_inst_evenement($this->getVal('evenement')); |
|
6006 |
if ($ev->getVal('notification') === 'notification_automatique') { |
if ($ev->getVal('notification') === 'notification_automatique') { |
6007 |
// Récupération de la catégorie et envoie des notifications au(x) demandeur(s) |
// Récupération de la catégorie et envoie des notifications au(x) demandeur(s) |
6008 |
$collectivite_di = $this->get_dossier_instruction_om_collectivite($this->getVal('dossier')); |
$collectivite_di = $this->get_dossier_instruction_om_collectivite($this->getVal('dossier')); |
6015 |
); |
); |
6016 |
|
|
6017 |
// Création d'une notification et d'une tâche pour chaque demandeur à notifier |
// Création d'une notification et d'une tâche pour chaque demandeur à notifier |
6018 |
|
$demandeurPrincipalNotifie = false; |
6019 |
if (count($demandeursANotifie) > 0) { |
if (count($demandeursANotifie) > 0) { |
6020 |
foreach ($demandeursANotifie as $demandeur) { |
foreach ($demandeursANotifie as $demandeur) { |
6021 |
|
// Identifie si le demandeur principal a été notifié ou pas |
6022 |
|
// et récupère ses informations |
6023 |
|
if ($demandeur['petitionnaire_principal'] == 't') { |
6024 |
|
$demandeurPrincipalNotifie = true; |
6025 |
|
// Si le demandeur principal est notifiable mais qu'il y a des erreurs dans |
6026 |
|
// son paramétrage, on effectue pas le traitement et on passe à l'itération |
6027 |
|
// suivante. On le considère également comme non notifié pour gérer l'envoie |
6028 |
|
// des messages d'erreurs |
6029 |
|
// Si la demande a été déposée via le portail alors le paramétrage n'a pas |
6030 |
|
// d'impact sur la notification |
6031 |
|
$erreursParam = $this->get_info_notification_fail(); |
6032 |
|
if (! $this->dossier_depose_sur_portail() && $erreursParam != array()) { |
6033 |
|
$demandeurPrincipalNotifie = false; |
6034 |
|
continue; |
6035 |
|
} |
6036 |
|
} |
6037 |
// Ajout de la notif et récupération de son id |
// Ajout de la notif et récupération de son id |
6038 |
$idNotif = $this->ajouter_notification( |
$idNotif = $this->ajouter_notification( |
6039 |
$this->getVal($this->clePrimaire), |
$this->getVal($this->clePrimaire), |
6040 |
$this->f->get_connected_user_login_name(), |
$this->f->get_connected_user_login_name(), |
6041 |
$demandeur, |
$demandeur, |
6042 |
$collectivite_di, |
$collectivite_di, |
6043 |
|
array(), |
6044 |
true |
true |
6045 |
); |
); |
6046 |
if ($idNotif === false) { |
if ($idNotif === false) { |
6059 |
// Termine le traitement |
// Termine le traitement |
6060 |
return $this->end_treatment(__METHOD__, false); |
return $this->end_treatment(__METHOD__, false); |
6061 |
} |
} |
6062 |
|
$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."))); |
6063 |
|
} |
6064 |
|
} |
6065 |
|
// Si le demandeur principal n'est pas notifiable, on créé une nouvelle notification |
6066 |
|
// en erreur avec en commentaire la raison pour laquelle le demandeur principal |
6067 |
|
// n'a pas pu être notifié |
6068 |
|
if (! $demandeurPrincipalNotifie) { |
6069 |
|
// Analyse pour savoir pourquoi le demandeur principal n'est pas notifiable |
6070 |
|
$erreursParam = $this->get_info_notification_fail(); |
6071 |
|
$demandeurPrincipal = $this->get_info_petitionnaire_principal_dossier($this->getVal('dossier')); |
6072 |
|
// Ajout de la notif et récupération de son id |
6073 |
|
$idNotif = $this->ajouter_notification( |
6074 |
|
$this->valF[$this->clePrimaire], |
6075 |
|
$this->f->get_connected_user_login_name(), |
6076 |
|
$demandeurPrincipal, |
6077 |
|
$collectivite_di, |
6078 |
|
array(), |
6079 |
|
true, |
6080 |
|
'Echec', |
6081 |
|
implode(' ', $erreursParam) |
6082 |
|
); |
6083 |
|
if ($idNotif === false) { |
6084 |
|
$this->addToMessage( |
6085 |
|
__('Erreur : la création de la notification a échouée.'). |
6086 |
|
__("Veuillez contacter votre administrateur.") |
6087 |
|
); |
6088 |
|
return false; |
6089 |
|
} |
6090 |
|
// Prépare un message d'alerte à destination de l'instructeur pour l'informer |
6091 |
|
// de l'échec de la notification |
6092 |
|
$dossier_message = $this->get_inst_dossier_message(0); |
6093 |
|
$dossier_message_val = array( |
6094 |
|
'dossier' => $this->getVal('dossier'), |
6095 |
|
'type' => _('erreur expedition'), |
6096 |
|
'emetteur' => $this->f->get_connected_user_login_name(), |
6097 |
|
'login' => $_SESSION['login'], |
6098 |
|
'date_emission' => date('Y-m-d H:i:s'), |
6099 |
|
'contenu' => _('Échec lors de la notification de l\'instruction '). |
6100 |
|
$ev->getVal('libelle'). |
6101 |
|
'.<br>'. |
6102 |
|
implode("\n", $erreursParam). |
6103 |
|
'<br>'. |
6104 |
|
_('Veuillez corriger ces informations avant de renvoyer la notification.') |
6105 |
|
); |
6106 |
|
$add = $dossier_message->add_notification_message($dossier_message_val, true); |
6107 |
|
// Si une erreur se produit pendant l'ajout |
6108 |
|
if ($add !== true) { |
6109 |
|
$this->addToLog(__METHOD__."(): Le message d'alerte concernant l'echec de l'envoi de la notification n'a pas pu être envoyé.", DEBUG_MODE); |
6110 |
|
return false; |
6111 |
} |
} |
|
$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."))); |
|
6112 |
} |
} |
6113 |
} |
} |
6114 |
|
|
6117 |
} |
} |
6118 |
|
|
6119 |
/** |
/** |
6120 |
|
* Récupère l'instance de dossier message. |
6121 |
|
* |
6122 |
|
* @param string $dossier_message Identifiant du message. |
6123 |
|
* |
6124 |
|
* @return object |
6125 |
|
*/ |
6126 |
|
private function get_inst_dossier_message($dossier_message = null) { |
6127 |
|
// |
6128 |
|
return $this->get_inst_common("dossier_message", $dossier_message); |
6129 |
|
} |
6130 |
|
|
6131 |
|
/** |
6132 |
|
* Vérifie si le signataire est obligatoire pour finaliser |
6133 |
|
* le document apartir du paramétrage de l'événement. |
6134 |
|
* Si c'est le cas, vérifie si il y a bien un signataire |
6135 |
|
* renseigné. |
6136 |
|
* Si c'est le cas renvoie true, sinon renvoie false. |
6137 |
|
* |
6138 |
|
* @param evenement évenement de l'instruction permettant de |
6139 |
|
* récupérer le paramétrage |
6140 |
|
* @return boolean |
6141 |
|
*/ |
6142 |
|
protected function controle_signataire($evenement) { |
6143 |
|
// Vérifie si le signataire est obligatoire et si c'est le cas |
6144 |
|
// vérifie si il y a bien un signataire pour le document |
6145 |
|
if ($evenement->is_signataire_obligatoire() && |
6146 |
|
($this->getVal('signataire_arrete') === null || |
6147 |
|
$this->getVal('signataire_arrete') === '')) { |
6148 |
|
return false; |
6149 |
|
} |
6150 |
|
return true; |
6151 |
|
} |
6152 |
|
|
6153 |
|
/** |
6154 |
* TREATMENT - unfinalize. |
* TREATMENT - unfinalize. |
6155 |
* |
* |
6156 |
* Permet de définaliser un enregistrement. |
* Permet de définaliser un enregistrement. |
6429 |
$this->f->isDatabaseError($consultation); |
$this->f->isDatabaseError($consultation); |
6430 |
// Si consultation liée, récupération du retour d'avis |
// Si consultation liée, récupération du retour d'avis |
6431 |
if($consultation=='Oui'){ |
if($consultation=='Oui'){ |
6432 |
$sql="select date_retour,avis_consultation.libelle as avis_consultation, |
$sql = sprintf( |
6433 |
service.libelle as service |
'(SELECT |
6434 |
from ".DB_PREFIXE."consultation inner join ".DB_PREFIXE."service |
date_retour, |
6435 |
on consultation.service =service.service |
avis_consultation.libelle as avis_consultation, |
6436 |
left join ".DB_PREFIXE."avis_consultation on |
COALESCE(service.libelle, tiers_consulte.libelle) as service |
6437 |
consultation.avis_consultation = avis_consultation.avis_consultation |
FROM |
6438 |
where dossier ='".$idx."' and consultation.visible"; |
%1$sconsultation |
6439 |
|
LEFT JOIN %1$stiers_consulte ON consultation.tiers_consulte = tiers_consulte.tiers_consulte |
6440 |
|
LEFT JOIN %1$sservice ON consultation.service = service.service |
6441 |
|
LEFT JOIN %1$savis_consultation ON consultation.avis_consultation = avis_consultation.avis_consultation |
6442 |
|
WHERE |
6443 |
|
dossier = \'%2$s\' |
6444 |
|
AND consultation.visible)', |
6445 |
|
DB_PREFIXE, |
6446 |
|
$this->f->db->escapeSimple($idx) |
6447 |
|
); |
6448 |
$res = $this->f->db->query($sql); |
$res = $this->f->db->query($sql); |
6449 |
$this->f->isDatabaseError($res); |
$this->f->isDatabaseError($res); |
6450 |
// Récupération des consultations |
// Récupération des consultations |
6501 |
$merge_fields = array(); |
$merge_fields = array(); |
6502 |
// |
// |
6503 |
if (array_key_exists('c1', $_POST) === true) { |
if (array_key_exists('c1', $_POST) === true) { |
6504 |
$merge_fields['[complement_instruction]'] = urldecode($_POST['c1']); |
$merge_fields['[complement_instruction]'] = $_POST['c1']; |
6505 |
$merge_fields['[complement1_instruction]'] = urldecode($_POST['c1']); |
$merge_fields['[complement1_instruction]'] = $_POST['c1']; |
6506 |
} |
} |
6507 |
if (array_key_exists('c2', $_POST) === true) { |
if (array_key_exists('c2', $_POST) === true) { |
6508 |
$merge_fields['[complement2_instruction]'] = urldecode($_POST['c2']); |
$merge_fields['[complement2_instruction]'] = $_POST['c2']; |
6509 |
} |
} |
6510 |
if (array_key_exists('c3', $_POST) === true) { |
if (array_key_exists('c3', $_POST) === true) { |
6511 |
$merge_fields['[complement3_instruction]'] = urldecode($_POST['c3']); |
$merge_fields['[complement3_instruction]'] = $_POST['c3']; |
6512 |
} |
} |
6513 |
if (array_key_exists('c4', $_POST) === true) { |
if (array_key_exists('c4', $_POST) === true) { |
6514 |
$merge_fields['[complement4_instruction]'] = urldecode($_POST['c4']); |
$merge_fields['[complement4_instruction]'] = $_POST['c4']; |
6515 |
} |
} |
6516 |
$params = array( |
$params = array( |
6517 |
"watermark" => true, |
"watermark" => true, |
6523 |
if (array_key_exists('corps', $_POST) === true) { |
if (array_key_exists('corps', $_POST) === true) { |
6524 |
$params["specific"]["corps"] = array( |
$params["specific"]["corps"] = array( |
6525 |
"mode" => "set", |
"mode" => "set", |
6526 |
"value" => urldecode($_POST['corps']), |
"value" => $_POST['corps'], |
6527 |
); |
); |
6528 |
} |
} |
6529 |
if (array_key_exists('titre', $_POST) === true) { |
if (array_key_exists('titre', $_POST) === true) { |
6530 |
$params["specific"]["titre"] = array( |
$params["specific"]["titre"] = array( |
6531 |
"mode" => "set", |
"mode" => "set", |
6532 |
"value" => urldecode($_POST['titre']), |
"value" => $_POST['titre'], |
6533 |
); |
); |
6534 |
} |
} |
6535 |
$dossier_instruction_om_collectivite = $this->get_dossier_instruction_om_collectivite(); |
$dossier_instruction_om_collectivite = $this->get_dossier_instruction_om_collectivite(); |
7950 |
} |
} |
7951 |
|
|
7952 |
/** |
/** |
7953 |
|
* VIEW - view_overlay_notification_service_consulte. |
7954 |
|
* |
7955 |
|
* Ouvre le sous-formulaire de notification des services consulte |
7956 |
|
* en ajaxIt dans un overlay. |
7957 |
|
* Cette action est bindée pour utiliser la fonction popUpIt. |
7958 |
|
* |
7959 |
|
* @return void |
7960 |
|
*/ |
7961 |
|
function view_overlay_notification_service_consulte() { |
7962 |
|
|
7963 |
|
// Vérification de l'accessibilité sur l'élément |
7964 |
|
$this->checkAccessibility(); |
7965 |
|
|
7966 |
|
printf( |
7967 |
|
'<script type="text/javascript" > |
7968 |
|
overlayIt(\'%1$s\',\'%2$s&objsf=%1$s&idxformulaire=%4$s&retourformulaire=dossier_instruction&obj=%1$s&action=420&idx=%3$s\', 1); |
7969 |
|
</script>', |
7970 |
|
'instruction_notification_manuelle', |
7971 |
|
OM_ROUTE_SOUSFORM, |
7972 |
|
$this->getVal($this->clePrimaire), |
7973 |
|
$this->getVal('dossier') |
7974 |
|
); |
7975 |
|
} |
7976 |
|
|
7977 |
|
/** |
7978 |
|
* VIEW - overlay_notification_tiers_consulte. |
7979 |
|
* |
7980 |
|
* Ouvre le sous-formulaire de notification des tiers consulte |
7981 |
|
* en ajaxIt dans un overlay. |
7982 |
|
* Cette action est bindée pour utiliser la fonction popUpIt. |
7983 |
|
* |
7984 |
|
* @return void |
7985 |
|
*/ |
7986 |
|
function view_overlay_notification_tiers_consulte() { |
7987 |
|
|
7988 |
|
// Vérification de l'accessibilité sur l'élément |
7989 |
|
$this->checkAccessibility(); |
7990 |
|
|
7991 |
|
printf( |
7992 |
|
'<script type="text/javascript" > |
7993 |
|
overlayIt(\'%1$s\',\'%2$s&objsf=%1$s&idxformulaire=%4$s&retourformulaire=dossier_instruction&obj=%1$s&action=430&idx=%3$s\', 1); |
7994 |
|
</script>', |
7995 |
|
'instruction_notification_manuelle', |
7996 |
|
OM_ROUTE_SOUSFORM, |
7997 |
|
$this->getVal($this->clePrimaire), |
7998 |
|
$this->getVal('dossier') |
7999 |
|
); |
8000 |
|
} |
8001 |
|
/** |
8002 |
* 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 |
8003 |
* pour exclure les dossiers du groupe contentieux. |
* pour exclure les dossiers du groupe contentieux. |
8004 |
* |
* |
8544 |
"signataire_arrete_email" => $inst_signataire_arrete->getVal('email'), |
"signataire_arrete_email" => $inst_signataire_arrete->getVal('email'), |
8545 |
"signataire_arrete_nom" => $inst_signataire_arrete->getVal('nom'), |
"signataire_arrete_nom" => $inst_signataire_arrete->getVal('nom'), |
8546 |
"signataire_arrete_prenom" => $inst_signataire_arrete->getVal('prenom'), |
"signataire_arrete_prenom" => $inst_signataire_arrete->getVal('prenom'), |
8547 |
"date_limite_instruction" => $inst_dossier->getVal('incomplet_notifie') === 't' ? $inst_dossier->getVal('date_limite_incompletude') : $inst_dossier->getVal('date_limite'), |
// Permet d'envoyer en signature l'instruction le jour de la date limite |
8548 |
|
"date_limite_instruction" => $this->compute_date_limite(1), |
8549 |
"dossier" => $this->getVal('dossier'), |
"dossier" => $this->getVal('dossier'), |
8550 |
"is_forced_view_files" => $is_forced_view_files, |
"is_forced_view_files" => $is_forced_view_files, |
8551 |
'commentaire_signature' => $is_forced_view_files === true ? __('relecture demandee.') : null |
'commentaire_signature' => $is_forced_view_files === true ? __('relecture demandee.') : null |
8636 |
} |
} |
8637 |
|
|
8638 |
/** |
/** |
8639 |
|
* Permet de récupérer la bonne date limite en fonction de si l'instruction |
8640 |
|
* est en incomplet notifié ou non. |
8641 |
|
* On peut ajouter des jours à cette date grâce au paramètre "delay". |
8642 |
|
* Cette fonction est utilisée dans un cas spécifique où on veut envoyer |
8643 |
|
* l'instruction en signature le jour de la date limite. |
8644 |
|
* |
8645 |
|
* @param int $delay Le nombre de jour à ajouter à la date limite. |
8646 |
|
* |
8647 |
|
* @return string $date_limite la date limite calculé ou false |
8648 |
|
*/ |
8649 |
|
private function compute_date_limite($delay) { |
8650 |
|
// Instanciation de l'objet dossier |
8651 |
|
$inst_dossier = $this->f->get_inst__om_dbform(array( |
8652 |
|
'obj' => 'dossier', |
8653 |
|
'idx' => $this->getVal('dossier'), |
8654 |
|
)); |
8655 |
|
|
8656 |
|
$date_to_compute = null; |
8657 |
|
if ($inst_dossier->getVal('incomplet_notifie') === 't') { |
8658 |
|
$date_to_compute = $inst_dossier->getVal('date_limite_incompletude'); |
8659 |
|
} else { |
8660 |
|
$date_to_compute = $inst_dossier->getVal('date_limite'); |
8661 |
|
} |
8662 |
|
|
8663 |
|
$date_limite = date("Y-m-d", strtotime($date_to_compute."+ $delay days")); |
8664 |
|
|
8665 |
|
return $date_limite; |
8666 |
|
} |
8667 |
|
|
8668 |
|
/** |
8669 |
* Permet de récupérer la traduction de la valeur de statut_signature |
* Permet de récupérer la traduction de la valeur de statut_signature |
8670 |
* |
* |
8671 |
* @return string la valeur de statut_signature traduite | false |
* @return string la valeur de statut_signature traduite | false |
8713 |
|
|
8714 |
$date_to_convert = array( |
$date_to_convert = array( |
8715 |
'date_envoi_signature' => $historique_signature_values['date_envoi_signature'], |
'date_envoi_signature' => $historique_signature_values['date_envoi_signature'], |
8716 |
'date_limite_instruction' => $historique_signature_values['date_limite_instruction'], |
'date_limite_instruction' => $this->compute_date_limite(0), |
8717 |
'date_retour_signature' => $historique_signature_values['date_retour_signature'] |
'date_retour_signature' => $historique_signature_values['date_retour_signature'] |
8718 |
); |
); |
8719 |
|
|
8756 |
|
|
8757 |
return json_encode($historique_signature_value_tab, JSON_HEX_APOS); |
return json_encode($historique_signature_value_tab, JSON_HEX_APOS); |
8758 |
} |
} |
8759 |
|
|
8760 |
|
/** |
8761 |
|
* TREATMENT - annuler_envoi_en_signature |
8762 |
|
* |
8763 |
|
* Permet d'annuler l'envoi du document de l'instruction au parapheur pour signature |
8764 |
|
* |
8765 |
|
* @return boolean true si l'annulation a été effectué avec succès false sinon |
8766 |
|
*/ |
8767 |
|
function annuler_envoi_en_signature() { |
8768 |
|
$this->begin_treatment(__METHOD__); |
8769 |
|
$this->correct = true; |
8770 |
|
|
8771 |
|
//Instanciation de la classe electronicsignature |
8772 |
|
$inst_es = $this->get_electronicsignature_instance(); |
8773 |
|
if ($inst_es === false) { |
8774 |
|
$this->correct = false; |
8775 |
|
return $this->end_treatment(__METHOD__, false); |
8776 |
|
} |
8777 |
|
|
8778 |
|
$data = array(); |
8779 |
|
if (! empty($this->getVal('id_parapheur_signature'))) { |
8780 |
|
$data['id_parapheur_signature'] = $this->getVal('id_parapheur_signature'); |
8781 |
|
} else { |
8782 |
|
$this->correct = false; |
8783 |
|
$this->addToMessage(__("Il n'y a pas d'identifiant de parapheur.")); |
8784 |
|
return $this->end_treatment(__METHOD__, false); |
8785 |
|
} |
8786 |
|
|
8787 |
|
// Appel de la méthode de l'abstracteur cancel_send_for_signature() |
8788 |
|
// Cette méthode doit retourner un tableau de valeur |
8789 |
|
try { |
8790 |
|
$result = $inst_es->cancel_send_for_signature($data); |
8791 |
|
} catch (electronicsignature_exception $e) { |
8792 |
|
$this->handle_electronicsignature_exception($e); |
8793 |
|
return $this->end_treatment(__METHOD__, false); |
8794 |
|
} |
8795 |
|
|
8796 |
|
// Après avoir reçu le résultat du parapheur, il faut mettre à jour les champs |
8797 |
|
$valF = array(); |
8798 |
|
|
8799 |
|
// Pour appeler la fonction modifier il faut traiter tous les champs de l'objet |
8800 |
|
foreach($this->champs as $identifiant => $champ) { |
8801 |
|
$valF[$champ] = $this->val[$identifiant]; |
8802 |
|
} |
8803 |
|
// On fait ensuite nos modifications spécifiques |
8804 |
|
$valF['id_parapheur_signature'] = null; |
8805 |
|
$valF['statut_signature'] = $result['statut']; |
8806 |
|
$valF['commentaire_signature'] = isset($result['commentaire_signature']) == true ? $result['commentaire_signature'] : null; |
8807 |
|
$valF['date_envoi_signature'] = null; |
8808 |
|
$valF['historique_signature'] = $this->get_updated_historique_signature($result); |
8809 |
|
|
8810 |
|
$ret = $this->modifier($valF); |
8811 |
|
|
8812 |
|
if ($ret === false) { |
8813 |
|
$this->correct = false; |
8814 |
|
$this->addToMessage(__("Une erreur est survenue lors de la mise à jour des champs.")); |
8815 |
|
// Termine le traitement |
8816 |
|
return $this->end_treatment(__METHOD__, false); |
8817 |
|
} |
8818 |
|
|
8819 |
|
// Message |
8820 |
|
$this->addToMessage(__("L'annulation a été effectuée avec succès.")); |
8821 |
|
|
8822 |
|
// Tout s'est bien passé, on termine le traitement |
8823 |
|
return $this->end_treatment(__METHOD__, true); |
8824 |
|
} |
8825 |
|
|
8826 |
|
|
8827 |
/** |
/** |
8830 |
* @return array sinon false en cas d'erreur |
* @return array sinon false en cas d'erreur |
8831 |
*/ |
*/ |
8832 |
protected function get_historique_signature_decoded() { |
protected function get_historique_signature_decoded() { |
8833 |
$val = $this->getVal('historique_signature'); |
$val = str_replace("'", '"', $this->getVal('historique_signature')); |
8834 |
if ($val === '') { |
if ($val === '' || $val == 'false') { |
8835 |
$val = json_encode(array()); |
$val = json_encode(array()); |
8836 |
} |
} |
8837 |
if($this->isJson($val) === false) { |
if($this->isJson($val) === false) { |
8843 |
/** |
/** |
8844 |
* Récupère les informations à afficher dans le tableau de suivi à l'aide |
* Récupère les informations à afficher dans le tableau de suivi à l'aide |
8845 |
* d'une requête sql. Stocke ces informations dans un tableau. |
* d'une requête sql. Stocke ces informations dans un tableau. |
8846 |
* Converti le tableau au format json et renvoi le json obtenu |
* Converti le tableau au format json et renvoi le json obtenu. |
8847 |
|
* |
8848 |
|
* Pour identifier quel suivi est affiché (notification des demandeurs, des services ou |
8849 |
|
* de tiers) ce sont les tâches liées aux notifications qui sont utilisés. |
8850 |
|
* La clause where de la requête est construite à partir du tableau contenant les types |
8851 |
|
* de tâches fourni en paramètre. |
8852 |
|
* Il est également possible d'afficher les notifications n'étant pas lié à des tâches. |
8853 |
* |
* |
8854 |
|
* Si le suivi concerne la notification des demandeurs via le portail citoyen, |
8855 |
|
* la date de premier accès ne sera pas affichée. |
8856 |
|
* |
8857 |
|
* @param array liste des tâches permettant d'identifier quelles notification afficher |
8858 |
|
* @param boolean permet d'afficher les notifications non liées à des tâches |
8859 |
* @return json |
* @return json |
8860 |
*/ |
*/ |
8861 |
protected function get_json_suivi_notification() { |
protected function get_json_suivi_notification($typeTache, $nonLieTache = false) { |
8862 |
|
$whereTypeTache = ''; |
8863 |
|
$sqlTaskNull = ''; |
8864 |
|
$suiviDateAcces = true; |
8865 |
|
// Défini si on veux que la requête récupère également les notifications qui n'ont pas |
8866 |
|
// de tâches associées. C'est le cas pour les notifications de demandeurs lorsque la |
8867 |
|
// notification du demandeur principal n'a pas pu être envoyée à cause d'un mauvais |
8868 |
|
// paramétrage |
8869 |
|
if(is_bool($nonLieTache) && $nonLieTache === true) { |
8870 |
|
$sqlTaskNull = 'OR task.type is null'; |
8871 |
|
} |
8872 |
|
// Prépare la clause where pour ne récupérer que les notifications liées à certain type de tâches |
8873 |
|
// Permet de différencier les notifications des demandeurs de celle des services et de celles des |
8874 |
|
// tiers consulté |
8875 |
|
if (is_array($typeTache) && $typeTache != array()) { |
8876 |
|
if (is_array($typeTache)) { |
8877 |
|
$whereTypeTache = sprintf( |
8878 |
|
'AND (task.type IN (%1$s) %2$s)', |
8879 |
|
"'".implode("', '", $typeTache)."'", |
8880 |
|
$sqlTaskNull |
8881 |
|
); |
8882 |
|
} |
8883 |
|
// La date de premier accès n'a pas besoin d'être renseigné pour |
8884 |
|
// les notifications des demandeurs via le portail citoyen. |
8885 |
|
// Les notifications des demandeurs sont liés à 3 types de tâches |
8886 |
|
// notification_recepisse, notification_instruction, notification_decision |
8887 |
|
// Si le suivi de la notification concerne un de ces types de tâches on |
8888 |
|
// considère que c'est une notification de demandeurs. |
8889 |
|
// Dans ce cas on vérifie si cette notification est paramétrée pour passer |
8890 |
|
// via le portail. Par défaut si rien n'est paramétré on considère que la |
8891 |
|
// notification est faite via le portail |
8892 |
|
if ((in_array('notification_recepisse', $typeTache) || |
8893 |
|
in_array('notification_instruction', $typeTache) || |
8894 |
|
in_array('notification_decision', $typeTache))) { |
8895 |
|
$dossier = $this->getVal('dossier'); |
8896 |
|
$collectivite_di = $this->get_dossier_instruction_om_collectivite($dossier); |
8897 |
|
$modeNotification = $this->f->get_param_option_notification($collectivite_di); |
8898 |
|
if (empty($modeNotification) || $modeNotification == 'portal') { |
8899 |
|
$suiviDateAcces = false; |
8900 |
|
} |
8901 |
|
} |
8902 |
|
} |
8903 |
|
|
8904 |
$valSuivi = array(); |
$valSuivi = array(); |
8905 |
// Liste des champs à afficher. Permet également la traduction des noms de colonnes. |
// Liste des champs à afficher. Permet également la traduction des noms de colonnes. |
8906 |
$listeChampsTrad = array( |
$listeChampsTrad = array( |
8909 |
__('destinataire'), |
__('destinataire'), |
8910 |
__('date_premier_acces'), |
__('date_premier_acces'), |
8911 |
__('instruction'), |
__('instruction'), |
8912 |
|
__('annexes'), |
8913 |
__('statut'), |
__('statut'), |
8914 |
__('commentaire') |
__('commentaire') |
8915 |
); |
); |
8919 |
'destinataire', |
'destinataire', |
8920 |
'date_premier_acces', |
'date_premier_acces', |
8921 |
'instruction', |
'instruction', |
8922 |
|
'annexes', |
8923 |
'statut', |
'statut', |
8924 |
'commentaire' |
'commentaire' |
8925 |
); |
); |
8926 |
|
// Si la date de premier_acces n'a pas à être affiché on la supprime de la liste |
8927 |
|
if (! $suiviDateAcces) { |
8928 |
|
$listeChamps = array( |
8929 |
|
'emetteur', |
8930 |
|
'date_envoi', |
8931 |
|
'destinataire', |
8932 |
|
'instruction', |
8933 |
|
'annexes', |
8934 |
|
'statut', |
8935 |
|
'commentaire' |
8936 |
|
); |
8937 |
|
} |
8938 |
|
|
8939 |
// Récupération des infos nécessaires à l'affichage du tableau |
// Récupération des infos nécessaires à l'affichage du tableau |
8940 |
$sql = sprintf( |
$sql = sprintf( |
8941 |
'SELECT |
'SELECT DISTINCT |
8942 |
instruction_notification.instruction_notification, |
instruction_notification.instruction_notification, |
8943 |
|
-- Affiche la mention automatique avec le nom de l emetteur si la notification a été envoyé automatiquement |
8944 |
CASE WHEN instruction_notification.automatique = TRUE |
CASE WHEN instruction_notification.automatique = TRUE |
8945 |
THEN TRIM(CONCAT(instruction_notification.emetteur, \' \', \'(automatique)\')) |
THEN TRIM(CONCAT(instruction_notification.emetteur, \' \', \'(automatique)\')) |
8946 |
ELSE instruction_notification.emetteur |
ELSE instruction_notification.emetteur |
8951 |
evenement.libelle as instruction, |
evenement.libelle as instruction, |
8952 |
instruction_notification.statut, |
instruction_notification.statut, |
8953 |
instruction_notification.commentaire, |
instruction_notification.commentaire, |
8954 |
instruction_notification_document.instruction as instruction_annexe |
annexes.instruction_annexe as annexes |
8955 |
FROM |
FROM |
8956 |
%1$sinstruction_notification |
%1$sinstruction_notification |
8957 |
LEFT JOIN %1$sinstruction |
LEFT JOIN %1$sinstruction |
8961 |
LEFT JOIN %1$sinstruction_notification_document |
LEFT JOIN %1$sinstruction_notification_document |
8962 |
ON instruction_notification.instruction_notification = instruction_notification_document.instruction_notification |
ON instruction_notification.instruction_notification = instruction_notification_document.instruction_notification |
8963 |
AND instruction_notification_document.annexe = true |
AND instruction_notification_document.annexe = true |
8964 |
|
-- Récupère les tâches liées au notification pour pouvoir par la suite identifier le type de notification |
8965 |
|
LEFT JOIN %1$stask |
8966 |
|
ON instruction_notification.instruction_notification::CHARACTER VARYING = task.object_id |
8967 |
|
-- Récupération de la liste des annexes sous la forme d une liste |
8968 |
|
LEFT JOIN ( |
8969 |
|
SELECT |
8970 |
|
instruction_notification, |
8971 |
|
-- Récupère la liste des annexes de la notification |
8972 |
|
-- sous la forme d un json pour récupérer toutes les informatiosn nécessaire |
8973 |
|
-- à l affichage du lien vers les annexes |
8974 |
|
CONCAT( |
8975 |
|
\'[\', |
8976 |
|
STRING_AGG( |
8977 |
|
-- Affiche le nom du fichier selon le type de document/pièce |
8978 |
|
CASE |
8979 |
|
WHEN instruction_notification_document.document_type = \'instruction\' |
8980 |
|
THEN CONCAT( |
8981 |
|
\'{ |
8982 |
|
"obj" : "instruction", |
8983 |
|
"champs" : "om_fichier_instruction", |
8984 |
|
"label" : "\', evenement.libelle, \'", |
8985 |
|
"id" : "\', instruction.instruction,\'" |
8986 |
|
}\' |
8987 |
|
) |
8988 |
|
WHEN instruction_notification_document.document_type = \'consultation\' |
8989 |
|
THEN CONCAT( |
8990 |
|
\'{ |
8991 |
|
"obj" : "consultation", |
8992 |
|
"champs" : "fichier", |
8993 |
|
"label" : "Avis - \', service.libelle, \'", |
8994 |
|
"id" : "\', consultation.consultation,\'" |
8995 |
|
}\' |
8996 |
|
) |
8997 |
|
ELSE |
8998 |
|
CONCAT( |
8999 |
|
\'{ |
9000 |
|
"obj" : "document_numerise", |
9001 |
|
"champs" : "uid", |
9002 |
|
"label" : "\', document_numerise.nom_fichier, \' - \', document_numerise_type.libelle, \'", |
9003 |
|
"id" : "\', document_numerise.document_numerise,\'" |
9004 |
|
}\' |
9005 |
|
) |
9006 |
|
END, |
9007 |
|
\', \'), |
9008 |
|
\']\' |
9009 |
|
) AS instruction_annexe |
9010 |
|
FROM |
9011 |
|
%1$sinstruction_notification_document |
9012 |
|
LEFT JOIN %1$sinstruction |
9013 |
|
ON instruction_notification_document.instruction = instruction.instruction |
9014 |
|
LEFT JOIN %1$sevenement |
9015 |
|
ON instruction.evenement = evenement.evenement |
9016 |
|
LEFT JOIN %1$sconsultation |
9017 |
|
ON instruction_notification_document.document_id = consultation.consultation |
9018 |
|
LEFT JOIN %1$sservice |
9019 |
|
ON consultation.service = service.service |
9020 |
|
LEFT JOIN %1$sdocument_numerise |
9021 |
|
ON instruction_notification_document.document_id = document_numerise.document_numerise |
9022 |
|
LEFT JOIN %1$sdocument_numerise_type |
9023 |
|
ON document_numerise.document_numerise_type = document_numerise_type.document_numerise_type |
9024 |
|
WHERE |
9025 |
|
instruction_notification_document.annexe = \'t\' |
9026 |
|
GROUP BY |
9027 |
|
instruction_notification |
9028 |
|
) AS annexes |
9029 |
|
ON |
9030 |
|
annexes.instruction_notification = instruction_notification.instruction_notification |
9031 |
WHERE |
WHERE |
9032 |
instruction.instruction = %2$s |
instruction.instruction = %2$s |
9033 |
|
%3$s |
9034 |
ORDER BY |
ORDER BY |
9035 |
date_envoi ASC, instruction_notification.destinataire ASC', |
date_envoi ASC, instruction_notification.destinataire ASC', |
9036 |
DB_PREFIXE, |
DB_PREFIXE, |
9037 |
$this->getVal('instruction') |
$this->getVal('instruction'), |
9038 |
|
$whereTypeTache |
9039 |
); |
); |
9040 |
$res = $this->f->db->query($sql); |
$res = $this->f->db->query($sql); |
9041 |
$this->f->addToLog(__METHOD__."(): db->query(\"".$sql."\")", VERBOSE_MODE); |
$this->f->addToLog(__METHOD__."(): db->query(\"".$sql."\")", VERBOSE_MODE); |
9042 |
$this->f->isDatabaseError($res); |
$this->f->isDatabaseError($res); |
9043 |
|
// Préparation du lien de téléchargement des annexes |
9044 |
|
$htmlList = |
9045 |
|
'<style> |
9046 |
|
#content .gridjs-td a.lien_annexe { |
9047 |
|
text-decoration : underline dotted 1px; |
9048 |
|
} |
9049 |
|
#content a.lien_annexe:hover { |
9050 |
|
text-decoration : underline solid 1px; |
9051 |
|
color : #46aede; |
9052 |
|
} |
9053 |
|
ol {padding-left : 10px;} |
9054 |
|
</style> |
9055 |
|
<ol>%1$s</ol>'; |
9056 |
|
$lienTelechargement = |
9057 |
|
'<a class="lien_annexe" href="../app/index.php?module=form&snippet=file&obj=%1$s&champ=%2$s&id=%3$s" target="blank" title="%4$s"> |
9058 |
|
Annexe |
9059 |
|
</a>'; |
9060 |
// Stockage des infos de chaque notification dans un tableau |
// Stockage des infos de chaque notification dans un tableau |
9061 |
while( $row =& $res->fetchrow(DB_FETCHMODE_ASSOC) ) { |
while( $row =& $res->fetchrow(DB_FETCHMODE_ASSOC) ) { |
9062 |
$valNotif = array(); |
$valNotif = array(); |
9068 |
&& $row[$champ] !== '') { |
&& $row[$champ] !== '') { |
9069 |
// |
// |
9070 |
$valNotif[$champ] = date('d/m/Y H:i:s', strtotime($row[$champ])); |
$valNotif[$champ] = date('d/m/Y H:i:s', strtotime($row[$champ])); |
9071 |
|
} else if ($champ === 'annexes') { |
9072 |
|
$listeAnnexe = ''; |
9073 |
|
$infoAnnexes = json_decode($row[$champ], true); |
9074 |
|
if (! empty($infoAnnexes) && json_last_error() === JSON_ERROR_NONE) { |
9075 |
|
// A partir des infos récupérées prépare le code html du lien vers chacune |
9076 |
|
// des annexes et ajoute un élément de liste par annexe |
9077 |
|
foreach($infoAnnexes as $annexe) { |
9078 |
|
$listeAnnexe .= sprintf( |
9079 |
|
'<li>%s</li>', |
9080 |
|
sprintf($lienTelechargement, |
9081 |
|
$annexe['obj'], |
9082 |
|
$annexe['champs'], |
9083 |
|
$annexe['id'], |
9084 |
|
$annexe['label'] |
9085 |
|
) |
9086 |
|
); |
9087 |
|
} |
9088 |
|
// Construction de la liste des annexes |
9089 |
|
$valNotif[$champ] = sprintf( |
9090 |
|
$htmlList, |
9091 |
|
$listeAnnexe |
9092 |
|
); |
9093 |
|
} |
9094 |
} |
} |
9095 |
} |
} |
|
if ($row['instruction_annexe'] !== null && $row['instruction_annexe'] !== '') { |
|
|
$inst_instruction = $this->f->get_inst__om_dbform(array( |
|
|
"obj" => "instruction", |
|
|
"idx" => $row['instruction_annexe'], |
|
|
)); |
|
|
$inst_evenement = $inst_instruction->get_inst_evenement(); |
|
|
$lienAnnexe = ' ('.$inst_evenement->getVal('libelle').')'; |
|
|
$valNotif['instruction'] .= $lienAnnexe; |
|
|
} |
|
9096 |
array_push($valSuivi, $valNotif); |
array_push($valSuivi, $valNotif); |
9097 |
} |
} |
9098 |
|
|
9188 |
DB_AUTOQUERY_UPDATE, |
DB_AUTOQUERY_UPDATE, |
9189 |
$this->getCle($this->getVal($this->clePrimaire)) |
$this->getCle($this->getVal($this->clePrimaire)) |
9190 |
); |
); |
9191 |
$this->addToLog(__METHOD__."(): db->autoexecute(\"".DB_PREFIXE.'.'.$this->table."\", ".print_r($instr_val, true).", DB_AUTOQUERY_UPDATE, \"".$this->getCle($this->clePrimaire)."\");", DEBUG_MODE); |
$this->addToLog(__METHOD__."(): db->autoexecute(\"".DB_PREFIXE.'.'.$this->table."\", ".print_r($instr_val, true).", DB_AUTOQUERY_UPDATE, \"".$this->getCle($this->clePrimaire)."\");", VERBOSE_MODE); |
9192 |
if ($this->f->isDatabaseError($res, true) === true) { |
if ($this->f->isDatabaseError($res, true) === true) { |
9193 |
$this->addToMessage(sprintf('%s %s', |
$this->addToMessage(sprintf('%s %s', |
9194 |
__("Une erreur s'est produite lors de la mise à jour de l'instruction."), |
__("Une erreur s'est produite lors de la mise à jour de l'instruction."), |
9457 |
// Ajoute une condition sur le where pour ne récupérer que le pétitionnaire principal |
// Ajoute une condition sur le where pour ne récupérer que le pétitionnaire principal |
9458 |
// pour une notification depuis le portail citoyen |
// pour une notification depuis le portail citoyen |
9459 |
$sqlPetitionnairePrincipal = ''; |
$sqlPetitionnairePrincipal = ''; |
9460 |
|
// Gestion des champs nécessaires pour la notification d'un demandeur |
9461 |
|
$condition_demandeur = "AND demandeur.notification = 't' |
9462 |
|
AND demandeur.courriel IS NOT NULL"; |
9463 |
if ($portail === true) { |
if ($portail === true) { |
9464 |
$sqlPetitionnairePrincipal = 'AND lien_dossier_demandeur.petitionnaire_principal = true'; |
$sqlPetitionnairePrincipal = 'AND lien_dossier_demandeur.petitionnaire_principal = true'; |
9465 |
|
$condition_demandeur = "AND ( |
9466 |
|
(notification = 't' AND courriel IS NOT NULL) |
9467 |
|
OR demande.source_depot = 'portal' |
9468 |
|
)"; |
9469 |
} |
} |
9470 |
|
|
9471 |
$listeDemandeursNotifiable = array(); |
$listeDemandeursNotifiable = array(); |
9480 |
ELSE |
ELSE |
9481 |
TRIM(CONCAT(demandeur.personne_morale_raison_sociale, \' \', demandeur.personne_morale_denomination, \' \', demandeur.courriel)) |
TRIM(CONCAT(demandeur.personne_morale_raison_sociale, \' \', demandeur.personne_morale_denomination, \' \', demandeur.courriel)) |
9482 |
END AS destinataire, |
END AS destinataire, |
9483 |
demandeur.courriel |
demandeur.courriel, |
9484 |
|
petitionnaire_principal |
9485 |
FROM |
FROM |
9486 |
%1$sdossier |
%1$sdossier |
9487 |
INNER JOIN %1$slien_dossier_demandeur |
INNER JOIN %1$slien_dossier_demandeur |
9488 |
ON dossier.dossier = lien_dossier_demandeur.dossier |
ON dossier.dossier = lien_dossier_demandeur.dossier |
9489 |
INNER JOIN %1$sdemandeur |
INNER JOIN %1$sdemandeur |
9490 |
ON lien_dossier_demandeur.demandeur = demandeur.demandeur |
ON lien_dossier_demandeur.demandeur = demandeur.demandeur |
9491 |
|
-- Récupération de la plus ancienne demande associée au dossier (la demande |
9492 |
|
-- de création du dossier) |
9493 |
|
INNER JOIN ( |
9494 |
|
SELECT |
9495 |
|
demande, |
9496 |
|
dossier_instruction, |
9497 |
|
source_depot |
9498 |
|
FROM |
9499 |
|
%1$sdemande |
9500 |
|
WHERE |
9501 |
|
dossier_instruction = \'%2$s\' |
9502 |
|
ORDER BY |
9503 |
|
demande ASC |
9504 |
|
LIMIT 1 |
9505 |
|
) as demande |
9506 |
|
ON dossier.dossier = demande.dossier_instruction |
9507 |
WHERE |
WHERE |
9508 |
dossier.dossier = \'%2$s\' AND |
dossier.dossier = \'%2$s\' |
9509 |
notification = \'t\' AND |
%3$s |
9510 |
courriel IS NOT NULL |
%4$s', |
|
%3$s', |
|
9511 |
DB_PREFIXE, |
DB_PREFIXE, |
9512 |
$idDossier, |
$idDossier, |
9513 |
|
$condition_demandeur, |
9514 |
$sqlPetitionnairePrincipal |
$sqlPetitionnairePrincipal |
9515 |
); |
); |
9516 |
$res = $this->f->db->query($sql); |
$res = $this->f->db->query($sql); |
9531 |
* @param integer id de l'instruction dont on cherche les notifications |
* @param integer id de l'instruction dont on cherche les notifications |
9532 |
* @return array liste des instruction_notification liés à l'instruction |
* @return array liste des instruction_notification liés à l'instruction |
9533 |
*/ |
*/ |
9534 |
public function get_instruction_notification($id_instruction) { |
public function get_instruction_notification($id_instruction, $typeNotification = null, $nonLieTache = false) { |
9535 |
|
$whereTypeTache = ''; |
9536 |
|
$sqlTaskNull = ''; |
9537 |
|
// Défini si on veux que la requête récupère également les notifications qui n'ont pas |
9538 |
|
// de tâches associées. C'est le cas pour les notifications de demandeurs lorsque la |
9539 |
|
// notification du demandeur principal n'a pas pu être envoyée à cause d'un mauvais |
9540 |
|
// paramétrage |
9541 |
|
if(is_bool($nonLieTache) && $nonLieTache === true) { |
9542 |
|
$sqlTaskNull = 'OR task.type is null'; |
9543 |
|
} |
9544 |
|
if ($typeNotification != null) { |
9545 |
|
if (is_array($typeNotification)) { |
9546 |
|
$whereTypeTache = sprintf( |
9547 |
|
'AND (task.type IN (%1$s) %2$s)', |
9548 |
|
"'".implode("', '", $typeNotification)."'", |
9549 |
|
$sqlTaskNull |
9550 |
|
); |
9551 |
|
} else { |
9552 |
|
$whereTypeTache = sprintf( |
9553 |
|
'AND (task.type = \'%1$s\' %2$s)', |
9554 |
|
$typeNotification, |
9555 |
|
$sqlTaskNull |
9556 |
|
); |
9557 |
|
} |
9558 |
|
} |
9559 |
$listeInstrNotif = array(); |
$listeInstrNotif = array(); |
9560 |
$sql = sprintf(' |
$sql = sprintf(' |
9561 |
SELECT |
SELECT |
9562 |
instruction_notification.instruction_notification |
instruction_notification.instruction_notification |
9563 |
FROM |
FROM |
9564 |
%1$sinstruction_notification |
%1$sinstruction_notification |
9565 |
|
LEFT JOIN %1$stask |
9566 |
|
ON instruction_notification.instruction_notification::CHARACTER VARYING = task.object_id |
9567 |
WHERE |
WHERE |
9568 |
instruction = %2$s', |
instruction = %2$s |
9569 |
|
%3$s', |
9570 |
DB_PREFIXE, |
DB_PREFIXE, |
9571 |
$id_instruction |
$id_instruction, |
9572 |
|
$whereTypeTache |
9573 |
); |
); |
9574 |
$res = $this->f->db->query($sql); |
$res = $this->f->db->query($sql); |
9575 |
$this->f->addToLog(__METHOD__."(): db->query(\"".$sql."\")", VERBOSE_MODE); |
$this->f->addToLog(__METHOD__."(): db->query(\"".$sql."\")", VERBOSE_MODE); |
9812 |
* l'overlay de notification des demandeurs. |
* l'overlay de notification des demandeurs. |
9813 |
*/ |
*/ |
9814 |
function getSubFormTitle($ent) { |
function getSubFormTitle($ent) { |
9815 |
if ($this->getParameter('maj') == '411') { |
$actionSansPath = array('411', '420', '430'); |
9816 |
|
if (in_array($this->getParameter('maj'), $actionSansPath)) { |
9817 |
return ''; |
return ''; |
9818 |
} |
} |
9819 |
return parent::getSubFormTitle($ent); |
return parent::getSubFormTitle($ent); |