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 |
|
|
dossier |
19 |
|
|
where |
20 |
|
|
(select e.statut from etat e where e.etat = dossier.etat ) = 'encours'"; |
21 |
|
|
|
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 |
|
|
instruction |
32 |
|
|
WHERE |
33 |
|
|
dossier = '".$row['dossier']."' |
34 |
|
|
AND evenement = ".$f->getParameter('affichage_obligatoire'); |
35 |
|
|
|
36 |
|
|
$resInstr = $f->db->query($sql); |
37 |
|
|
$f->isDatabaseError($resInstr); |
38 |
|
|
|
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 |
|
|
|
45 |
|
|
$sql = "INSERT INTO |
46 |
|
|
instruction |
47 |
|
|
VALUES |
48 |
|
|
(nextval('instruction_seq'), '".$row['dossier']."', '".date("Y-m-d")."', |
49 |
|
|
".$f->getParameter('affichage_obligatoire').", |
50 |
|
|
'recepisse_1', '', '', '".$row['dossier']."', |
51 |
|
|
'initialisation', 2, 'notifier', 'Oui', 1, 0, NULL, |
52 |
|
|
NULL, NULL, NULL, 'Non', 'initialiser', NULL, '', NULL, |
53 |
|
|
NULL, NULL, NULL, '', '', '', '', '', '', '', '', '', |
54 |
|
|
'', '', '', '', NULL);"; |
55 |
|
|
//echo json_encode($sql."\n"); |
56 |
|
|
$resInsertInstr = $f->db->query($sql); |
57 |
|
|
$f->isDatabaseError($resInsertInstr); |
58 |
|
|
} |
59 |
|
|
} |
60 |
|
|
} |
61 |
|
|
/*Sinon*/ |
62 |
|
|
else { |
63 |
|
|
|
64 |
|
|
$f = new utils(NULL, |
65 |
|
|
"edition_m", |
66 |
|
|
_("edition")." "._("des")." "._("affichages")." "._("des")." "._("dossiers"), |
67 |
|
|
"ico_edition.png", |
68 |
|
|
"edition"); |
69 |
|
|
$f->addHTMLHeadJs(array("../js/script.js")); |
70 |
|
|
|
71 |
|
|
/*Affichage du formulaire*/ |
72 |
|
|
echo "<form name='f1' id='f1'>"; |
73 |
|
|
|
74 |
|
|
echo "<br><br>". |
75 |
|
|
" |
76 |
|
|
<a |
77 |
|
|
class='lien' |
78 |
|
|
href='javascript:dossier_m()'> |
79 |
|
|
<span |
80 |
|
|
class=\"om-icon om-icon-16 om-icon-fix pdf-16\" |
81 |
|
|
title=\""._("Edition")."\">". |
82 |
|
|
_("Edition"). |
83 |
|
|
"</span> |
84 |
|
|
". |
85 |
|
|
_("affichage")."_"._("des")."_"._("dossiers")." |
86 |
|
|
</a><br/>"; |
87 |
|
|
echo "</form>"; |
88 |
|
|
} |
89 |
|
|
|
90 |
|
|
?> |