1 |
vpihour |
840 |
<?php |
2 |
|
|
// $Id: edition_d.php,v 1.4 2009-12-15 09:26:19 jbastide Exp $ |
3 |
|
|
/** |
4 |
|
|
* Fichiers requis |
5 |
|
|
*/ |
6 |
|
|
require_once "../obj/utils.class.php"; |
7 |
|
|
|
8 |
|
|
/*Si une mise à jour des dossiers est demandées*/ |
9 |
|
|
if ( isset($_GET['update']) ){ |
10 |
|
|
|
11 |
|
|
$f = new utils("nohtml"); |
12 |
|
|
$f->disableLog(); |
13 |
|
|
$f->addHTMLHeadJs(array("../js/script.js")); |
14 |
|
|
|
15 |
|
|
$sql = "SELECT |
16 |
|
|
dossier |
17 |
|
|
FROM |
18 |
vpihour |
856 |
".DB_PREFIXE."dossier |
19 |
vpihour |
840 |
where |
20 |
nhaye |
889 |
(select e.statut from ".DB_PREFIXE."etat e where e.etat = dossier.etat ) = 'encours'"; |
21 |
vpihour |
840 |
|
22 |
|
|
$res = $f->db->query($sql); |
23 |
|
|
$f->isDatabaseError($res); |
24 |
|
|
|
25 |
|
|
/*Pour chaque dossier récupérer la liste des instructions*/ |
26 |
|
|
while ($row=& $res->fetchRow(DB_FETCHMODE_ASSOC)) { |
27 |
|
|
|
28 |
|
|
$sql = "SELECT |
29 |
|
|
instruction |
30 |
|
|
FROM |
31 |
vpihour |
856 |
".DB_PREFIXE."instruction |
32 |
vpihour |
840 |
WHERE |
33 |
|
|
dossier = '".$row['dossier']."' |
34 |
|
|
AND evenement = ".$f->getParameter('affichage_obligatoire'); |
35 |
|
|
|
36 |
vpihour |
856 |
$resInstr = $f->db->query($sql); |
37 |
|
|
$f->isDatabaseError($resInstr); |
38 |
vpihour |
840 |
|
39 |
|
|
/* |
40 |
|
|
* Si aucune instruction n'a d'événement de type "affichage_obligatoire", |
41 |
|
|
* on créé une nouvelle instruction avec cet événement. |
42 |
|
|
* */ |
43 |
|
|
if ( $resInstr->numrows() == 0 ){ |
44 |
vpihour |
856 |
|
45 |
|
|
$sql = "SELECT |
46 |
|
|
lettretype |
47 |
|
|
FROM |
48 |
|
|
evenement |
49 |
|
|
WHERE |
50 |
|
|
evenement = ".$f->getParameter('affichage_obligatoire'); |
51 |
|
|
$resLT = $f->db->query($sql); |
52 |
|
|
$f->isDatabaseError($resLT); |
53 |
vpihour |
840 |
|
54 |
vpihour |
856 |
$rowLT=& $resLT->fetchRow(DB_FETCHMODE_ASSOC); |
55 |
|
|
|
56 |
|
|
$valF = array ( |
57 |
|
|
"instruction" => $f->db->nextId(DB_PREFIXE."instruction"), |
58 |
|
|
"destinataire" => $row['dossier'], |
59 |
|
|
"datecourrier" =>date("Y-m-d"), |
60 |
|
|
"evenement" =>$f->getParameter('affichage_obligatoire'), |
61 |
|
|
"lettretype" =>$rowLT['lettretype'], |
62 |
|
|
"complement" => "","complement2" =>"", |
63 |
|
|
"dossier" =>$row['dossier'],"action" =>"initialisation", |
64 |
|
|
"delai" => "2","etat" =>"notifier", |
65 |
|
|
"accord_tacite" =>"Oui","delai_notification" =>"1", |
66 |
|
|
"archive_delai" => "0","archive_date_complet" =>NULL, |
67 |
|
|
"archive_date_rejet" =>NULL,"archive_date_limite" =>NULL, |
68 |
|
|
"archive_date_notification_delai" => NULL, |
69 |
|
|
"archive_accord_tacite" =>"Non","archive_etat" =>"initialiser", |
70 |
|
|
"archive_date_decision" =>NULL, "archive_avis" => "", |
71 |
|
|
"archive_date_validite" =>NULL,"archive_date_achevement" =>NULL, |
72 |
|
|
"archive_date_chantier" =>NULL, "archive_date_conformite" => NULL, |
73 |
|
|
"complement3" =>"","complement4" =>"", |
74 |
|
|
"complement5" =>"", "complement6" => "", |
75 |
|
|
"complement7" =>"","complement8" =>"", |
76 |
|
|
"complement9" =>"", "complement10" => "", |
77 |
|
|
"complement11" =>"","complement12" =>"", |
78 |
|
|
"complement13" =>"", "complement14" => "", |
79 |
|
|
"complement15" =>"","avis_decision" =>NULL |
80 |
|
|
); |
81 |
|
|
|
82 |
|
|
$resInsertInstr = |
83 |
|
|
$f->db->autoExecute(DB_PREFIXE."instruction", $valF, DB_AUTOQUERY_INSERT); |
84 |
vpihour |
840 |
} |
85 |
|
|
} |
86 |
|
|
} |
87 |
|
|
/*Sinon*/ |
88 |
|
|
else { |
89 |
|
|
|
90 |
|
|
$f = new utils(NULL, |
91 |
|
|
"edition_m", |
92 |
|
|
_("edition")." "._("des")." "._("affichages")." "._("des")." "._("dossiers"), |
93 |
|
|
"ico_edition.png", |
94 |
|
|
"edition"); |
95 |
|
|
$f->addHTMLHeadJs(array("../js/script.js")); |
96 |
|
|
|
97 |
|
|
/*Affichage du formulaire*/ |
98 |
|
|
echo "<form name='f1' id='f1'>"; |
99 |
|
|
|
100 |
|
|
echo "<br><br>". |
101 |
|
|
" |
102 |
|
|
<a |
103 |
|
|
class='lien' |
104 |
|
|
href='javascript:dossier_m()'> |
105 |
|
|
<span |
106 |
|
|
class=\"om-icon om-icon-16 om-icon-fix pdf-16\" |
107 |
|
|
title=\""._("Edition")."\">". |
108 |
|
|
_("Edition"). |
109 |
|
|
"</span> |
110 |
|
|
". |
111 |
|
|
_("affichage")."_"._("des")."_"._("dossiers")." |
112 |
|
|
</a><br/>"; |
113 |
|
|
echo "</form>"; |
114 |
|
|
} |
115 |
|
|
|
116 |
|
|
?> |