1 |
vpihour |
1154 |
<?php |
2 |
|
|
//$Id$ |
3 |
|
|
//gen openMairie le 07/01/2013 15:28 |
4 |
|
|
|
5 |
|
|
require_once ("../gen/obj/rapport_instruction.class.php"); |
6 |
|
|
|
7 |
|
|
class rapport_instruction extends rapport_instruction_gen { |
8 |
|
|
|
9 |
|
|
function rapport_instruction($id,&$db,$debug) { |
10 |
|
|
$this->constructeur($id,$db,$debug); |
11 |
|
|
}// fin constructeur |
12 |
vpihour |
1185 |
|
13 |
|
|
// Modification du style de certains champs |
14 |
|
|
function setType(&$form,$maj) { |
15 |
|
|
parent::setType($form,$maj); |
16 |
|
|
|
17 |
vpihour |
1218 |
if( $maj < 2 ){ |
18 |
|
|
// Numero de dossier d'instruction non modifiable |
19 |
|
|
$form->setType('dossier_instruction', 'hiddenstatic'); |
20 |
|
|
|
21 |
|
|
// Select pour le proposition de décision |
22 |
|
|
$form->setType('proposition_decision', 'select'); |
23 |
|
|
} |
24 |
vpihour |
1185 |
$form->setType('dossier_instruction', 'hiddenstatic'); |
25 |
|
|
} |
26 |
|
|
|
27 |
|
|
// Pré-remplir les champs |
28 |
vpihour |
1218 |
function setValsousformulaire(&$form, $maj,$validation,$idxformulaire,$retourformulaire,$typeformulaire,&$db,$DEBUG=null) { |
29 |
vpihour |
1185 |
|
30 |
vpihour |
1218 |
parent::setValsousformulaire($form, $maj,$validation,$idxformulaire,$retourformulaire,$typeformulaire,$db,$DEBUG); |
31 |
vpihour |
1185 |
|
32 |
vpihour |
1218 |
if($maj == 0) { |
33 |
vpihour |
1185 |
|
34 |
|
|
// Analyse réglementaire |
35 |
|
|
// Choisi par l'administrateur |
36 |
vpihour |
1218 |
$analyse_reglementaire = $this->f->getParameter('rapport_instruction_analyse_reglementaire'); |
37 |
|
|
|
38 |
vpihour |
1185 |
$form->setVal("analyse_reglementaire",$analyse_reglementaire); |
39 |
|
|
|
40 |
|
|
// Description du projet |
41 |
|
|
// Libellé des travaux du dossier en cours |
42 |
|
|
// Création de la requête |
43 |
|
|
$sql = "SELECT |
44 |
nhaye |
1400 |
CONCAT(donnees_techniques.am_projet_desc,' ',donnees_techniques.co_projet_desc) as libelle |
45 |
vpihour |
1185 |
FROM |
46 |
|
|
".DB_PREFIXE."dossier |
47 |
nhaye |
1400 |
LEFT JOIN ".DB_PREFIXE."donnees_techniques ON |
48 |
|
|
donnees_techniques.dossier_instruction = dossier.dossier |
49 |
vpihour |
1185 |
WHERE |
50 |
vpihour |
1218 |
dossier.dossier = '".$idxformulaire."'"; |
51 |
vpihour |
1185 |
|
52 |
|
|
// Exécution de la requête |
53 |
|
|
$this->f->addToLog("setVal(): db->query(\"".$sql."\");", VERBOSE_MODE); |
54 |
|
|
$res = $db->query($sql); |
55 |
|
|
$this->f->isDatabaseError(); |
56 |
|
|
|
57 |
vpihour |
1218 |
// Si le champ travaux est rempli |
58 |
vpihour |
1185 |
while ($row=&$res->fetchrow(DB_FETCHMODE_ASSOC)){ |
59 |
|
|
|
60 |
|
|
if ( $row['libelle'] != "" ){ |
61 |
|
|
|
62 |
vpihour |
1218 |
$description_projet = $row['libelle']; |
63 |
vpihour |
1185 |
|
64 |
|
|
$form->setVal("description_projet",$description_projet); |
65 |
|
|
} |
66 |
|
|
} |
67 |
vpihour |
1218 |
|
68 |
|
|
// Ajout automatique du numéro de dossier d'instruction |
69 |
|
|
$form->setVal("dossier_instruction",$idxformulaire); |
70 |
vpihour |
1185 |
} |
71 |
|
|
} |
72 |
|
|
|
73 |
|
|
/* |
74 |
|
|
* Select pour le proposition_decision |
75 |
|
|
*/ |
76 |
|
|
function setSelect(&$form, $maj,&$db,$debug) { |
77 |
|
|
parent::setSelect($form, $maj,$db,$debug); |
78 |
|
|
|
79 |
|
|
// Lors d'un ajout ou d'une modification |
80 |
|
|
if( $maj < 2 ){ |
81 |
|
|
|
82 |
|
|
// proposition_decision |
83 |
|
|
$contenu=array(); |
84 |
vpihour |
1154 |
|
85 |
vpihour |
1185 |
$k = 0; |
86 |
|
|
$contenu[0][$k]=""; |
87 |
|
|
$contenu[1][$k++]=_('choisir')." "._('proposition_decision'); |
88 |
|
|
|
89 |
|
|
// Si le paramètre existe et a été remplie |
90 |
|
|
if ( !is_null($this->f->getParameter('rapport_instruction_proposition_decision'))){ |
91 |
|
|
|
92 |
|
|
$donnees = $this->f->getParameter('rapport_instruction_proposition_decision'); |
93 |
|
|
$donnees = explode('<br />', nl2br(htmlentities($donnees))); |
94 |
|
|
|
95 |
|
|
// Pour chaque ligne du paramètre, faire une ligne dans le select |
96 |
|
|
foreach ($donnees as $value) { |
97 |
|
|
|
98 |
|
|
$contenu[0][$k]=$value; |
99 |
|
|
$contenu[1][$k++]=$value; |
100 |
|
|
} |
101 |
|
|
} |
102 |
|
|
$form->setSelect("proposition_decision",$contenu); |
103 |
|
|
|
104 |
|
|
} |
105 |
|
|
} |
106 |
|
|
|
107 |
|
|
/** |
108 |
vpihour |
1218 |
* Surcharge du bouton retour afin de retourner sur le dossier d'instruction selon de cas |
109 |
vpihour |
1185 |
*/ |
110 |
vpihour |
1218 |
function retoursousformulaire($idxformulaire, $retourformulaire, $val, |
111 |
|
|
$objsf, $premiersf, $tricolsf, $validation, |
112 |
|
|
$idx, $maj, $retour) { |
113 |
vpihour |
1185 |
|
114 |
vpihour |
1218 |
// Ajout et consultation, retour dossier |
115 |
|
|
if ( ( $maj == 0 && $validation == 0 ) || |
116 |
|
|
( $maj == 3 && $validation == 0 ) || |
117 |
|
|
( $maj == 0 && $validation == 1 ) ){ |
118 |
|
|
|
119 |
|
|
echo "\n<a class=\"retour\" "; |
120 |
|
|
echo "href=\"#\" "; |
121 |
|
|
echo "onclick=\"redirectPortletAction(1,'main');\" "; |
122 |
|
|
echo ">"; |
123 |
|
|
echo _("Retour"); |
124 |
|
|
echo "</a>\n"; |
125 |
|
|
} |
126 |
|
|
//Sinon affiche un retour normal |
127 |
|
|
else { |
128 |
|
|
|
129 |
|
|
parent::retoursousformulaire($idxformulaire, $retourformulaire, $val, |
130 |
|
|
$objsf, $premiersf, $tricolsf, $validation, |
131 |
|
|
$idx, $maj, $retour); |
132 |
|
|
} |
133 |
vpihour |
1185 |
} |
134 |
vpihour |
1154 |
}// fin classe |
135 |
|
|
?> |