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; |
1340 |
// tâche envoi_cl lié n'a pas encore été traité il faut indiquer à |
// 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. |
// l'utilisateur que l'envoi au cl est en cours de traitement. |
1342 |
if ($this->is_sent_to_cl() === true |
if ($this->is_sent_to_cl() === true |
|
&& $this->getVal('envoye_cl_platau') == 't' |
|
1343 |
&& empty($this->getVal('date_envoi_controle_legalite')) |
&& empty($this->getVal('date_envoi_controle_legalite')) |
1344 |
&& $maj == 3) { |
&& $maj == 3) { |
1345 |
$form->setType("date_envoi_controle_legalite", "hiddenstatic"); |
$form->setType("date_envoi_controle_legalite", "hiddenstatic"); |
1916 |
// tâche envoi_cl lié n'a pas encore été traité il faut indiquer à |
// 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. |
// l'utilisateur que l'envoi au cl est en cours de traitement. |
1918 |
if ($this->is_sent_to_cl() === true |
if ($this->is_sent_to_cl() === true |
|
&& $this->getVal('envoye_cl_platau') == 't' |
|
1919 |
&& empty($this->getVal('date_envoi_controle_legalite')) |
&& empty($this->getVal('date_envoi_controle_legalite')) |
1920 |
&& $maj == 3) { |
&& $maj == 3) { |
1921 |
$form->setVal("date_envoi_controle_legalite", __("En cours de traitement.")); |
$form->setVal("date_envoi_controle_legalite", __("En cours de traitement.")); |
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) { |
3304 |
$this->f->get_connected_user_login_name(), |
$this->f->get_connected_user_login_name(), |
3305 |
$demandeurPrincipal, |
$demandeurPrincipal, |
3306 |
$collectivite_di, |
$collectivite_di, |
3307 |
|
array(), |
3308 |
true, |
true, |
3309 |
'Echec', |
'Echec', |
3310 |
implode(' ', $erreursParam) |
implode(' ', $erreursParam) |
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) { |
3661 |
$emetteur, |
$emetteur, |
3662 |
$destinataire, |
$destinataire, |
3663 |
$collectiviteId, |
$collectiviteId, |
3664 |
|
$annexes = array(), |
3665 |
$demandeAuto = false, |
$demandeAuto = false, |
3666 |
$statut = 'en cours d\'envoi', |
$statut = 'en cours d\'envoi', |
3667 |
$commentaire = 'Notification en cours de traitement', |
$commentaire = 'Notification en cours de traitement' |
|
$idInstrDocAnnexe = null |
|
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 |
3699 |
|
|
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_instruction( |
$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_instruction( |
$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 |
/** |
/** |
|
* A partir des informations passée en argument ajoute un nouvel élément |
|
|
* dans la table instruction_notification. |
|
|
* Ajoute également un nouvel élement dans instruction_notification_document |
|
|
* si l'instruction possède une lettretype. |
|
|
* |
|
|
* @param integer identifiant de l'instruction notifiée |
|
|
* @param string information concernant l'emetteur |
|
|
* @param array tableau contenant 2 entrées |
|
|
* - destinatire : nom, prenom ou raison sociale, dénomination et courriel |
|
|
* - courriel : adresse mail de la personne à notifier |
|
|
* @param boolean indique si la notification est automatique ou manuelle |
|
|
* |
|
|
* @return integer|boolean identifiant de la notification créée si le traitement |
|
|
* a réussie, false sinon. |
|
|
*/ |
|
|
protected function ajouter_notification_sans_annexe( |
|
|
$idInstruction, |
|
|
$emetteur, |
|
|
$destinataire, |
|
|
$demandeAuto = false |
|
|
) { |
|
|
// Préparation de la notification |
|
|
$inst_notif = $this->f->get_inst__om_dbform(array( |
|
|
"obj" => "instruction_notification", |
|
|
"idx" => "]", |
|
|
)); |
|
|
$notif_val = array( |
|
|
'instruction_notification' => null, |
|
|
'instruction' => $idInstruction, |
|
|
'automatique' => $demandeAuto, |
|
|
'emetteur' => $emetteur, |
|
|
'date_envoi' => null, |
|
|
'destinataire' => $destinataire['destinataire'], |
|
|
'courriel' => $destinataire['courriel'], |
|
|
'date_premier_acces' => null, |
|
|
'statut' => 'en cours d\'envoi', |
|
|
'commentaire' => 'Notification en cours de traitement' |
|
|
); |
|
|
|
|
|
// Création de la notification |
|
|
$add_notif = $inst_notif->ajouter($notif_val); |
|
|
if ($add_notif === false) { |
|
|
$this->addToMessage(__("Erreur lors de la génération de la notification au(x) pétitionnaire(s).")); |
|
|
return false; |
|
|
} |
|
|
|
|
|
// Si il y a une lettretype finalisé stockage de la clé d'accès au documents |
|
|
if ($this->evenement_has_an_edition($this->getVal('evenement')) === true) { |
|
|
$add_notif_doc = $this->ajouter_notification_document_instruction( |
|
|
$this->getVal($this->clePrimaire), |
|
|
$inst_notif->getVal($inst_notif->clePrimaire) |
|
|
); |
|
|
if ($add_notif_doc === false) { |
|
|
$this->addToMessage(__("Erreur lors de la génération de la notification du document.")); |
|
|
return false; |
|
|
} |
|
|
} |
|
|
// Renvoie l'id de la nouvelle instance de instruction_notification |
|
|
return $inst_notif->getVal($inst_notif->clePrimaire); |
|
|
} |
|
|
|
|
|
/** |
|
3729 |
* Pour chaque élément du tableau passé en paramètre ajoute une nouvelle |
* Pour chaque élément du tableau passé en paramètre ajoute une nouvelle |
3730 |
* instance dans la table instruction_notification_document lié a la |
* instance dans la table instruction_notification_document lié a la |
3731 |
* notification dont l'id est passé en paramètre. |
* notification dont l'id est passé en paramètre. |
3736 |
* a réussie, false sinon. |
* a réussie, false sinon. |
3737 |
*/ |
*/ |
3738 |
protected function ajouter_notification_document_multiple($idNotification, $listeDocument) { |
protected function ajouter_notification_document_multiple($idNotification, $listeDocument) { |
3739 |
foreach ($listeDocument as $idDoc => $paramDoc) { |
foreach ($listeDocument as $paramDoc) { |
3740 |
if (! $this->ajouter_notification_document($idNotification, $idDoc, $paramDoc['tableDocument'], $paramDoc['isAnnexe'])) { |
if (! $this->ajouter_notification_document($idNotification, $paramDoc['id'], $paramDoc['tableDocument'], $paramDoc['isAnnexe'])) { |
3741 |
$this->addToMessage(__("Erreur lors de la génération des documents à notifier.")); |
$this->addToMessage(__("Erreur lors de la génération des documents à notifier.")); |
3742 |
return false; |
return false; |
3743 |
} |
} |
3797 |
} |
} |
3798 |
|
|
3799 |
/** |
/** |
|
* Ajoute un élément dans la table instruction_notification_document. |
|
|
* Ne permet d'ajouter que des documents de notification lié à la table instruction |
|
|
* |
|
|
* TODO : supprimer cette méthode pour en faire une générique a la place |
|
|
* |
|
|
* @param integer $idInstruction : id de l'instruction à laquelle est rattaché le document |
|
|
* @param integer $idNotification : id de la notification à laquelle on associe le document |
|
|
* @param boolean $isAnnexe : indique si le document est une annexe ou pas |
|
|
* |
|
|
* @return boolean indique si le traitement a réussi |
|
|
*/ |
|
|
protected function ajouter_notification_document_instruction($idInstruction, $idNotification, $isAnnexe = false) { |
|
|
$inst_notif_doc = $this->f->get_inst__om_dbform(array( |
|
|
"obj" => "instruction_notification_document", |
|
|
"idx" => "]", |
|
|
)); |
|
|
$notif_doc_val = array( |
|
|
'instruction_notification_document' => null, |
|
|
'instruction_notification' => $idNotification, |
|
|
'instruction' => $idInstruction, |
|
|
'document_type' => 'instruction', |
|
|
'document_id' => $idInstruction, |
|
|
'cle' => $this->getCleAccesDocument(), |
|
|
'annexe' => $isAnnexe |
|
|
); |
|
|
|
|
|
$add_notif_doc = $inst_notif_doc->ajouter($notif_doc_val); |
|
|
if ($add_notif_doc === false) { |
|
|
return false; |
|
|
} |
|
|
return true; |
|
|
} |
|
|
|
|
|
/** |
|
3800 |
* TRIGGER - triggermodifierapres. |
* TRIGGER - triggermodifierapres. |
3801 |
* |
* |
3802 |
* @return boolean |
* @return boolean |
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) { |
4206 |
$this->f->get_connected_user_login_name(), |
$this->f->get_connected_user_login_name(), |
4207 |
$demandeurPrincipal, |
$demandeurPrincipal, |
4208 |
$collectivite_di, |
$collectivite_di, |
4209 |
|
array(), |
4210 |
true, |
true, |
4211 |
'Echec', |
'Echec', |
4212 |
implode(' ', $erreursParam) |
implode(' ', $erreursParam) |
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) { |
6075 |
$this->f->get_connected_user_login_name(), |
$this->f->get_connected_user_login_name(), |
6076 |
$demandeurPrincipal, |
$demandeurPrincipal, |
6077 |
$collectivite_di, |
$collectivite_di, |
6078 |
|
array(), |
6079 |
true, |
true, |
6080 |
'Echec', |
'Echec', |
6081 |
implode(' ', $erreursParam) |
implode(' ', $erreursParam) |
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($typeTache, $nonLieTache = false) { |
protected function get_json_suivi_notification($typeTache, $nonLieTache = false) { |
8862 |
$whereTypeTache = ''; |
$whereTypeTache = ''; |
8863 |
$sqlTaskNull = ''; |
$sqlTaskNull = ''; |
8864 |
|
$suiviDateAcces = true; |
8865 |
// Défini si on veux que la requête récupère également les notifications qui n'ont pas |
// 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 |
// 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 |
// notification du demandeur principal n'a pas pu être envoyée à cause d'un mauvais |
8872 |
// Prépare la clause where pour ne récupérer que les notifications liées à certain type de tâches |
// 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 |
// Permet de différencier les notifications des demandeurs de celle des services et de celles des |
8874 |
// tiers consulté |
// tiers consulté |
8875 |
if ($typeTache != null) { |
if (is_array($typeTache) && $typeTache != array()) { |
8876 |
if (is_array($typeTache)) { |
if (is_array($typeTache)) { |
8877 |
$whereTypeTache = sprintf( |
$whereTypeTache = sprintf( |
8878 |
'AND (task.type IN (%1$s) %2$s)', |
'AND (task.type IN (%1$s) %2$s)', |
8879 |
"'".implode("', '", $typeTache)."'", |
"'".implode("', '", $typeTache)."'", |
8880 |
$sqlTaskNull |
$sqlTaskNull |
8881 |
); |
); |
8882 |
} else { |
} |
8883 |
$whereTypeTache = sprintf( |
// La date de premier accès n'a pas besoin d'être renseigné pour |
8884 |
'AND (task.type = \'%1$s\' %2$s)', |
// les notifications des demandeurs via le portail citoyen. |
8885 |
$typeTache, |
// Les notifications des demandeurs sont liés à 3 types de tâches |
8886 |
$sqlTaskNull |
// 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( |
8951 |
evenement.libelle as instruction, |
evenement.libelle as instruction, |
8952 |
instruction_notification.statut, |
instruction_notification.statut, |
8953 |
instruction_notification.commentaire, |
instruction_notification.commentaire, |
8954 |
annexes.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 |
8969 |
SELECT |
SELECT |
8970 |
instruction_notification, |
instruction_notification, |
8971 |
-- Récupère la liste des annexes de la notification |
-- Récupère la liste des annexes de la notification |
8972 |
ARRAY_TO_STRING(ARRAY_AGG( |
-- sous la forme d un json pour récupérer toutes les informatiosn nécessaire |
8973 |
CASE WHEN |
-- à l affichage du lien vers les annexes |
8974 |
-- Si les documents annexés sont des documents d instruction alors ils sont liés à une instruction |
CONCAT( |
8975 |
-- et la colonne instruction contiendra un identifiant différent de 0. Si ce n est pas le cas |
\'[\', |
8976 |
-- et que c est un retour d avis de service alors l id sera 0. |
STRING_AGG( |
8977 |
instruction_notification_document.instruction != 0 |
-- Affiche le nom du fichier selon le type de document/pièce |
8978 |
THEN |
CASE |
8979 |
evenement.libelle |
WHEN instruction_notification_document.document_type = \'instruction\' |
8980 |
ELSE |
THEN CONCAT( |
8981 |
CONCAT(\'Avis - \', service.libelle) |
\'{ |
8982 |
END), |
"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 |
) AS instruction_annexe |
9010 |
FROM |
FROM |
9011 |
%1$sinstruction_notification_document |
%1$sinstruction_notification_document |
9017 |
ON instruction_notification_document.document_id = consultation.consultation |
ON instruction_notification_document.document_id = consultation.consultation |
9018 |
LEFT JOIN %1$sservice |
LEFT JOIN %1$sservice |
9019 |
ON consultation.service = service.service |
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 |
WHERE |
9025 |
instruction_notification_document.annexe = \'t\' |
instruction_notification_document.annexe = \'t\' |
9026 |
GROUP BY |
GROUP BY |
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'] !== '') { |
|
|
$lienAnnexe = ' ('.$row['instruction_annexe'].')'; |
|
|
$valNotif['instruction'] .= $lienAnnexe; |
|
|
} |
|
9096 |
array_push($valSuivi, $valNotif); |
array_push($valSuivi, $valNotif); |
9097 |
} |
} |
9098 |
|
|