15 |
$sql = "SELECT |
$sql = "SELECT |
16 |
dossier |
dossier |
17 |
FROM |
FROM |
18 |
dossier |
".DB_PREFIXE."dossier |
19 |
where |
where |
20 |
(select e.statut from etat e where e.etat = dossier.etat ) = 'encours'"; |
(select e.statut from etat e where e.etat = dossier.etat ) = 'encours'"; |
21 |
|
|
28 |
$sql = "SELECT |
$sql = "SELECT |
29 |
instruction |
instruction |
30 |
FROM |
FROM |
31 |
instruction |
".DB_PREFIXE."instruction |
32 |
WHERE |
WHERE |
33 |
dossier = '".$row['dossier']."' |
dossier = '".$row['dossier']."' |
34 |
AND evenement = ".$f->getParameter('affichage_obligatoire'); |
AND evenement = ".$f->getParameter('affichage_obligatoire'); |
35 |
|
|
36 |
$resInstr = $f->db->query($sql); |
$resInstr = $f->db->query($sql); |
37 |
$f->isDatabaseError($resInstr); |
$f->isDatabaseError($resInstr); |
38 |
|
|
39 |
/* |
/* |
40 |
* Si aucune instruction n'a d'événement de type "affichage_obligatoire", |
* Si aucune instruction n'a d'événement de type "affichage_obligatoire", |
41 |
* on créé une nouvelle instruction avec cet événement. |
* on créé une nouvelle instruction avec cet événement. |
42 |
* */ |
* */ |
43 |
if ( $resInstr->numrows() == 0 ){ |
if ( $resInstr->numrows() == 0 ){ |
44 |
|
|
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 |
|
|
54 |
$sql = "INSERT INTO |
$rowLT=& $resLT->fetchRow(DB_FETCHMODE_ASSOC); |
55 |
instruction |
|
56 |
VALUES |
$valF = array ( |
57 |
(nextval('instruction_seq'), '".$row['dossier']."', '".date("Y-m-d")."', |
"instruction" => $f->db->nextId(DB_PREFIXE."instruction"), |
58 |
".$f->getParameter('affichage_obligatoire').", |
"destinataire" => $row['dossier'], |
59 |
'recepisse_1', '', '', '".$row['dossier']."', |
"datecourrier" =>date("Y-m-d"), |
60 |
'initialisation', 2, 'notifier', 'Oui', 1, 0, NULL, |
"evenement" =>$f->getParameter('affichage_obligatoire'), |
61 |
NULL, NULL, NULL, 'Non', 'initialiser', NULL, '', NULL, |
"lettretype" =>$rowLT['lettretype'], |
62 |
NULL, NULL, NULL, '', '', '', '', '', '', '', '', '', |
"complement" => "","complement2" =>"", |
63 |
'', '', '', '', NULL);"; |
"dossier" =>$row['dossier'],"action" =>"initialisation", |
64 |
//echo json_encode($sql."\n"); |
"delai" => "2","etat" =>"notifier", |
65 |
$resInsertInstr = $f->db->query($sql); |
"accord_tacite" =>"Oui","delai_notification" =>"1", |
66 |
$f->isDatabaseError($resInsertInstr); |
"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 |
} |
} |
85 |
} |
} |
86 |
} |
} |