1 |
fraynaud |
178 |
<?php |
2 |
fmichon |
1515 |
/** |
3 |
|
|
* Ce script permet d'effectuer le transfert de dossier à SITADEL |
4 |
|
|
* |
5 |
|
|
* @package openfoncier |
6 |
|
|
* @version SVN : $Id$ |
7 |
|
|
*/ |
8 |
|
|
|
9 |
fraynaud |
178 |
require_once "../obj/utils.class.php"; |
10 |
|
|
require_once "../app/sitadel.class.php"; |
11 |
fraynaud |
184 |
require_once "../dyn/locales.inc.php"; |
12 |
|
|
require_once "../dyn/version.inc.php"; |
13 |
|
|
require_once "sitadel.inc"; |
14 |
fmichon |
380 |
$f = new utils(NULL, "export_sitadel", _("export SITADEL"), "ico_reqmo.png", "export"); |
15 |
fraynaud |
178 |
$f->addHTMLHeadJs(array("../js/script.js")); |
16 |
|
|
// GET |
17 |
|
|
if (isset ($_GET['validation'])){ |
18 |
|
|
$validation=$_GET['validation']; |
19 |
|
|
}else{ |
20 |
|
|
$validation=0; |
21 |
|
|
} |
22 |
|
|
/** |
23 |
|
|
* Description de la page |
24 |
|
|
*/ |
25 |
|
|
$description = _("Cette page vous permet de Transmettre les dossiers suivant la procedure SITADEL"); |
26 |
|
|
$f->displayDescription($description); |
27 |
|
|
//controle |
28 |
|
|
$DEBUG=1; |
29 |
fraynaud |
193 |
$t10 = "||||||||||"; // 10 | |
30 |
fraynaud |
184 |
|
31 |
fraynaud |
178 |
// parametres collectivite |
32 |
|
|
// ============================================================================= |
33 |
|
|
// validation = 0 |
34 |
|
|
// ============================================================================= |
35 |
|
|
if($validation==0){ |
36 |
|
|
$validation=1; |
37 |
|
|
echo "<form method=\"POST\" action=\"sitadel.php?validation=".$validation."\" name=f1>"; |
38 |
|
|
echo " "._("debut")." "; |
39 |
|
|
echo "<input type='text' name='datedebut' id=\"datedebut\" value=\""; |
40 |
|
|
echo "\" size=\"15\" class=\"champFormulaire datepicker\" onchange='fdate(this)' onkeyup=\"\" onclick=\"\" />"; |
41 |
|
|
echo " "._("fin")." "; |
42 |
|
|
echo "<input type='text' name='datefin' id=\"datefin\" value=\""; |
43 |
|
|
echo "\" size=\"15\" class=\"champFormulaire datepicker\" onchange='fdate(this)' onkeyup=\"\" onclick=\"\" />"; |
44 |
|
|
echo " "._("Numero d ordre d envoi")." : "."<SELECT name='numero'>"; |
45 |
|
|
for($i=1;$i<11;$i++){ |
46 |
|
|
echo "<option value ='".$i."'>".$i."</option>"; |
47 |
|
|
} |
48 |
|
|
echo "</select>"; |
49 |
|
|
echo "<br><br><input type='submit' value='export SITADEL'>"; |
50 |
|
|
echo "<br><br></form>"; |
51 |
fraynaud |
187 |
}else{ // ===================== extraction ================================= |
52 |
fraynaud |
178 |
$correct=true; |
53 |
fraynaud |
193 |
$longueurenregistrement= 0 ; |
54 |
|
|
$t10 = "||||||||||"; // 10 | |
55 |
|
|
$datedebut =''; |
56 |
|
|
$datefin=''; |
57 |
fraynaud |
190 |
if($_POST["datedebut"]=="") |
58 |
|
|
$correct=false; |
59 |
|
|
else |
60 |
|
|
$datedebut = substr($_POST["datedebut"],6,4). |
61 |
|
|
"-".substr($_POST["datedebut"],3,2)."-". |
62 |
|
|
substr($_POST["datedebut"],0,2); |
63 |
|
|
if($_POST["datefin"]=="") |
64 |
|
|
$correct=false; |
65 |
|
|
else |
66 |
|
|
$datefin = substr($_POST["datefin"],6,4). |
67 |
|
|
"-".substr($_POST["datefin"],3,2)."-". |
68 |
|
|
substr($_POST["datefin"],0,2); |
69 |
fraynaud |
178 |
if ($correct==true){ // *** |
70 |
vpihour |
510 |
// dossiers concern�s |
71 |
fraynaud |
247 |
$sql= "select * from ".DB_PREFIXE."dossier"; |
72 |
nhaye |
1138 |
$sql.= " INNER JOIN ".DB_PREFIXE."dossier_autorisation |
73 |
|
|
ON dossier.dossier_autorisation=dossier_autorisation.dossier_autorisation |
74 |
|
|
INNER JOIN ".DB_PREFIXE."dossier_autorisation_type_detaille |
75 |
|
|
ON dossier_autorisation.dossier_autorisation_type_detaille |
76 |
|
|
= dossier_autorisation_type_detaille.dossier_autorisation_type_detaille"; |
77 |
|
|
$sql.= " where (dossier_autorisation_type_detaille.code='PCI' |
78 |
|
|
or dossier_autorisation_type_detaille.code='PCA' |
79 |
|
|
or dossier_autorisation_type_detaille.code = 'PD' |
80 |
|
|
or dossier_autorisation_type_detaille.code = 'PA' |
81 |
|
|
or dossier_autorisation_type_detaille.code = 'DP')"; |
82 |
fraynaud |
190 |
$sql.= " AND ((date_depot >='".$datedebut."' AND date_depot<='".$datefin."')"; |
83 |
|
|
$sql.= " OR (date_decision>='".$datedebut."' AND date_decision<='".$datefin."')"; |
84 |
|
|
$sql.= " OR (date_chantier>='".$datedebut."' AND date_chantier<='".$datefin."'))"; |
85 |
|
|
$sql.= " order by date_depot"; |
86 |
fraynaud |
178 |
$res = $f->db -> query ($sql); |
87 |
|
|
$f->isDatabaseError($res); |
88 |
fraynaud |
190 |
$export=""; |
89 |
fraynaud |
178 |
while ($row=& $res->fetchRow(DB_FETCHMODE_ASSOC)){ |
90 |
fraynaud |
187 |
// initialisation |
91 |
|
|
$g = new sitadel($row['dossier']); |
92 |
|
|
$g->row=$row; |
93 |
|
|
// sitadel |
94 |
|
|
$g->val=$val; |
95 |
|
|
// parametre |
96 |
fraynaud |
247 |
$sql = "select parametre, valeur from ".DB_PREFIXE."statistique where dossier ='".$row['dossier']."'"; |
97 |
fraynaud |
187 |
$res1 = $f->db -> query ($sql); |
98 |
|
|
$f->isDatabaseError($res1); |
99 |
|
|
while ($row1=& $res1->fetchRow(DB_FETCHMODE_ASSOC)){ |
100 |
|
|
$g->parametre[$row1['parametre']]=$row1['valeur']; |
101 |
|
|
} |
102 |
|
|
$departement =$f->collectivite["departement"]; |
103 |
|
|
$commune =$f->collectivite["commune"]; |
104 |
|
|
$region =$f->collectivite["region"]; |
105 |
|
|
// depot |
106 |
|
|
$depot=""; |
107 |
|
|
// type different de transfert |
108 |
fraynaud |
190 |
if($row['types']!='Transfert' |
109 |
|
|
and (($row['date_depot'] >= $datedebut |
110 |
|
|
and $row['date_depot']<=$datefin) |
111 |
|
|
or ($row['date_decision'] >= $datedebut |
112 |
|
|
and $row['date_decision']<=$datefin))){ |
113 |
fraynaud |
193 |
$depot.=$g->entete("DEPOT",$departement,$commune,$pf_departement); |
114 |
fraynaud |
187 |
$depot.=$g->etatcivil(); |
115 |
|
|
$depot.=$g->adresse(); |
116 |
|
|
$depot.=$g->delegataire(); |
117 |
|
|
$depot.=$g->meltel($row['types']); |
118 |
|
|
$depot.=$g->adresse_terrain(); |
119 |
|
|
$depot.=$g->parcelle(); |
120 |
|
|
// =========================== |
121 |
|
|
// contrat maison individuelle |
122 |
|
|
// =========================== |
123 |
|
|
// sitadel : contrat| |
124 |
|
|
// openfoncier : non renseigne |
125 |
|
|
$depot.= $g->p('contrat')."|"; |
126 |
|
|
// ========== |
127 |
|
|
// architecte |
128 |
|
|
// ========== |
129 |
|
|
// sitadel : architecte| |
130 |
|
|
// openfoncier : architecte >0 |
131 |
|
|
if($row['architecte']>0) |
132 |
|
|
$depot.= "1|"; |
133 |
|
|
else |
134 |
|
|
$depot.= "0|"; |
135 |
|
|
// ===================== |
136 |
|
|
// utilisation data cnil |
137 |
|
|
// ====================== |
138 |
|
|
// sitadel : cnil |
139 |
|
|
// openfoncier : non renseigne |
140 |
|
|
$depot.= $g->p('cnil'); |
141 |
|
|
// fin d enregistrement depot |
142 |
|
|
$depot.="\n"; |
143 |
fraynaud |
178 |
} |
144 |
fraynaud |
187 |
|
145 |
|
|
// transfert |
146 |
|
|
$transfert =""; |
147 |
fraynaud |
190 |
if($row['types']=='Transfert' |
148 |
|
|
and $row['date_depot'] >= $datedebut |
149 |
|
|
and $row['date_depot']<=$datefin){ |
150 |
fraynaud |
193 |
$transfert.=$g->entete("TRANSFERT",$departement,$commune,$pf_departement); |
151 |
fraynaud |
187 |
$transfert.=$g->etatcivil(); |
152 |
|
|
$transfert.=$g->adresse(); |
153 |
|
|
$transfert.=$g->meltel($row['types']); |
154 |
|
|
$transfert.="\n"; |
155 |
fraynaud |
178 |
} |
156 |
fraynaud |
187 |
|
157 |
|
|
|
158 |
|
|
//decision |
159 |
|
|
// type different de modificatif |
160 |
|
|
$decision=""; |
161 |
fraynaud |
200 |
if($row['types']!='Modificatif' |
162 |
|
|
and $row['types']!='Transfert' |
163 |
|
|
and (($row['date_depot'] >= $datedebut and $row['date_depot']<=$datefin) |
164 |
|
|
or ($row['date_decision'] >= $datedebut and $row['date_decision']<=$datefin))){ |
165 |
fraynaud |
187 |
$avis_sitadel=""; |
166 |
|
|
$avis_sitadel_motif=""; |
167 |
|
|
// enregistrement decision dans tous les cas |
168 |
fraynaud |
193 |
$decision.=$g->entete("DECISION",$departement,$commune,$pf_departement); |
169 |
fraynaud |
187 |
//if ($row['date_decision']== '0000-00-00' |
170 |
|
|
// or !isset($row['date_decision'])){ |
171 |
fraynaud |
190 |
//if(isset($row['date_decision']) and $row['date_decision']!=""){ |
172 |
fraynaud |
187 |
// avis_sitadel et avis_sitadel_motif |
173 |
vpihour |
510 |
if($row['avis_decision']!=''){ |
174 |
fraynaud |
190 |
$avis_sitadel = "0"; |
175 |
|
|
$avis_sitadel_motif="0" ; |
176 |
vpihour |
510 |
$sql="select sitadel, sitadel_motif from ".DB_PREFIXE."avis_decision where avis_decision ='". |
177 |
|
|
$row['avis_decision']."'"; |
178 |
fraynaud |
187 |
$res1 = $f->db -> query ($sql); |
179 |
|
|
$f->isDatabaseError($res1); |
180 |
|
|
while ($row1=& $res1->fetchRow(DB_FETCHMODE_ASSOC)){ |
181 |
|
|
$avis_sitadel = $row1['sitadel']; |
182 |
|
|
$avis_sitadel_motif = $row1['sitadel_motif']; |
183 |
|
|
} |
184 |
fraynaud |
200 |
$decision.= $g->decision_groupe1($avis_sitadel,$avis_sitadel_motif,$structure); |
185 |
fraynaud |
193 |
}else{ |
186 |
fraynaud |
200 |
$decision.= $g->decision_groupe1("0","",$structure); // pas d avis |
187 |
|
|
//$decision.= "***".$t10.$t10.$t10.$t10.$t10.$t10.$t10.$t10."|||"; //83 |
188 |
fraynaud |
193 |
} |
189 |
fraynaud |
187 |
// si la decision est favorable, envoi des informations statistiques |
190 |
|
|
if($avis_sitadel==2 or $avis_sitadel==4 |
191 |
|
|
or $avis_sitadel==5){ |
192 |
|
|
// si decision favorable, expresse ou tacite GROUPE 2 |
193 |
|
|
$decision.= $g->terrain(); |
194 |
|
|
$decision.= $g->amenagement(); |
195 |
|
|
if($row['travaux']!=''){ |
196 |
|
|
$sql= "select codelascot,libelle |
197 |
fraynaud |
258 |
from ".DB_PREFIXE."travaux where travaux=".$row['travaux']; |
198 |
fraynaud |
187 |
$res2 = $f->db -> query ($sql); |
199 |
|
|
$f->isDatabaseError($res2); |
200 |
fraynaud |
258 |
$temp=$row['description']; |
201 |
|
|
// enlever les RC |
202 |
|
|
$temp = str_replace( chr(10), " ", $temp); |
203 |
|
|
$temp = str_replace( chr(13), " ", $temp); |
204 |
fraynaud |
187 |
while ($row2=& $res2->fetchRow(DB_FETCHMODE_ASSOC)){ |
205 |
fraynaud |
259 |
$travaux = $row2['libelle']." "; // *** |
206 |
fraynaud |
187 |
$lascot = $row2['codelascot']; |
207 |
|
|
} |
208 |
fraynaud |
258 |
$travaux.=" ".$temp; |
209 |
fraynaud |
187 |
$decision.= $g->travaux($travaux,$lascot, $row['types']); |
210 |
|
|
} |
211 |
fraynaud |
247 |
$sql3="select * from ".DB_PREFIXE."destination_shon where dossier = '". |
212 |
fraynaud |
187 |
$row['dossier']."' order by destination"; |
213 |
|
|
$res3 = $f->db -> query ($sql3); |
214 |
|
|
$f->isDatabaseError($res3); |
215 |
fraynaud |
322 |
// *** |
216 |
|
|
$temp = array(); |
217 |
|
|
$shonant = array(); |
218 |
|
|
$shondem = array(); |
219 |
|
|
$shonanttr = array(); |
220 |
|
|
$shonprojtr = array(); |
221 |
|
|
$shoncr1 = array(); |
222 |
|
|
$shoncr2 = array(); |
223 |
|
|
while ($row3=& $res3->fetchRow(DB_FETCHMODE_ASSOC)){ |
224 |
|
|
// round(8.5, 0, PHP_ROUND_HALF_DOWN); |
225 |
|
|
if(isset($row3["shon_anterieure"])) |
226 |
|
|
$shonant[$row3['destination']]=round($row3["shon_anterieure"], 0); |
227 |
|
|
else |
228 |
|
|
$shonant[$row3['destination']]=0; |
229 |
|
|
if(isset($row3["shon_demolie"])) |
230 |
|
|
$shondem[$row3['destination']]=round($row3["shon_demolie"], 0); |
231 |
|
|
else |
232 |
|
|
$shondem[$row3['destination']]=0; |
233 |
|
|
if(isset($row3["shon_anterieure_supprimee"])) |
234 |
|
|
$shonanttr[$row3['destination']]=round($row3["shon_anterieure_supprimee"], 0); |
235 |
|
|
else |
236 |
|
|
$shonanttr[$row3['destination']]=0; |
237 |
|
|
if(isset($row3["shon_nouvelle_transformee"])) |
238 |
|
|
$shonprojtr[$row3['destination']]=round($row3["shon_nouvelle_transformee"], 0); |
239 |
|
|
else |
240 |
|
|
$shonprojtr[$row3['destination']]=0; |
241 |
|
|
if(isset($row3["shon_nouvelle"])) |
242 |
|
|
$shoncr1[$row3['destination']]=round($row3["shon_nouvelle"], 0); |
243 |
|
|
else |
244 |
|
|
$shoncr1[$row3['destination']]=0; |
245 |
|
|
if(isset($row3["shon_shob_transformee"])) |
246 |
|
|
$shoncr2[$row3['destination']]=round($row3["shon_shob_transformee"], 0); |
247 |
|
|
else |
248 |
|
|
$shoncr2[$row3['destination']]=0; |
249 |
|
|
|
250 |
|
|
//$shonant[$row3['destination']]=$row3["shon_anterieure"]; |
251 |
|
|
//$shondem[$row3['destination']]=$row3["shon_demolie"]; |
252 |
|
|
//$shonanttr[$row3['destination']]=$row3["shon_anterieure_supprimee"]; |
253 |
|
|
//$shonprojtr[$row3['destination']]=$row3["shon_nouvelle_transformee"]; |
254 |
|
|
//$shoncr1[$row3['destination']]=$row3["shon_nouvelle"]; |
255 |
|
|
//$shoncr2[$row3['destination']]=$row3["shon_shob_transformee"]; |
256 |
|
|
|
257 |
|
|
} |
258 |
|
|
$decision.= $g->destination($shonant); |
259 |
|
|
$decision.= $g->destination($shondem); |
260 |
|
|
$decision.= $g->destination($shonanttr); |
261 |
|
|
$decision.= $g->destination($shonprojtr); |
262 |
|
|
$decision.= $g->destination($shoncr1); |
263 |
|
|
$decision.= $g->destination($shoncr2); |
264 |
fraynaud |
187 |
|
265 |
fraynaud |
322 |
$decision.= $g->descriptif($row['types']); |
266 |
fraynaud |
200 |
}else // decision defavorable ou pas de decision |
267 |
|
|
$decision.= $t10.$t10.$t10.$t10.$t10.$t10.$t10.$t10."|||"; //83 | + 12 | = 95 | pour 96 zones |
268 |
fraynaud |
187 |
$decision.="\n"; |
269 |
|
|
} |
270 |
|
|
|
271 |
|
|
// modificatif |
272 |
|
|
$modificatif=''; |
273 |
fraynaud |
190 |
if($row['types']=='Modificatif' |
274 |
|
|
and $row['date_depot'] >= $datedebut |
275 |
|
|
and $row['date_depot']<=$datefin){ |
276 |
fraynaud |
193 |
$modificatif.=$g->entete("MODIFICATIF",$departement,$commune,$pf_departement); |
277 |
fraynaud |
187 |
if(isset($row['date_decision']) or $row['date_decision']==""){ |
278 |
|
|
// avis_sitadel et avis_sitadel_motif |
279 |
vpihour |
510 |
if($row['avis_decision']!=''){ |
280 |
fraynaud |
187 |
$avis_sitadel = 0; |
281 |
|
|
$avis_sitadel_motif=0 ; |
282 |
vpihour |
510 |
$sql="select sitadel, sitadel_motif from ".DB_PREFIXE."avis_decision where avis_decision ='". |
283 |
|
|
$row['avis_decision']."'"; |
284 |
fraynaud |
187 |
$res1 = $f->db -> query ($sql); |
285 |
|
|
$f->isDatabaseError($res1); |
286 |
|
|
while ($row1=& $res1->fetchRow(DB_FETCHMODE_ASSOC)){ |
287 |
|
|
$avis_sitadel = $row1['sitadel']; |
288 |
|
|
$avis_sitadel_motif = $row1['sitadel_motif']; |
289 |
|
|
} |
290 |
fraynaud |
200 |
$modificatif.= $g->decision_groupe1($avis_sitadel,$avis_sitadel_motif,$structure); |
291 |
fraynaud |
178 |
} |
292 |
fraynaud |
187 |
// si la decision est favorable, envoi des informations statistiques |
293 |
|
|
if($avis_sitadel==2 or $avis_sitadel==4 |
294 |
|
|
or $avis_sitadel==5){ |
295 |
|
|
// si decision favorable, expresse ou tacite GROUPE 2 |
296 |
|
|
$modificatif.=$g->adresse_terrain(); //*** |
297 |
|
|
$modificatif.=$g->parcelle(); //*** |
298 |
|
|
$modificatif.=$g->terrain(); //*** |
299 |
fraynaud |
259 |
// enlever les RC |
300 |
|
|
$temp=$row['description']; |
301 |
|
|
$temp = str_replace( chr(10), " ", $temp); |
302 |
|
|
$temp = str_replace( chr(13), " ", $temp); |
303 |
fraynaud |
187 |
if($row['travaux']!=''){ |
304 |
|
|
$sql= "select codelascot,libelle |
305 |
fraynaud |
267 |
from ".DB_PREFIXE."travaux where travaux=".$row['travaux']; |
306 |
fraynaud |
187 |
$res2 = $f->db -> query ($sql); |
307 |
|
|
$f->isDatabaseError($res2); |
308 |
|
|
while ($row2=& $res2->fetchRow(DB_FETCHMODE_ASSOC)){ |
309 |
fraynaud |
258 |
$travaux = $row2['libelle']." ".$row['description']; // ***; |
310 |
fraynaud |
187 |
$lascot = $row2['codelascot']; |
311 |
|
|
} |
312 |
fraynaud |
259 |
$travaux.=" ".$temp; |
313 |
fraynaud |
187 |
$modificatif.= $g->travaux($travaux,$lascot, $row['types']); |
314 |
|
|
} |
315 |
fraynaud |
258 |
$sql3="select * from ".DB_PREFIXE."destination_shon where dossier = '". |
316 |
fraynaud |
187 |
$row['dossier']."' order by destination"; |
317 |
|
|
$res3 = $f->db -> query ($sql3); |
318 |
|
|
$f->isDatabaseError($res3); |
319 |
|
|
$temp = array(); |
320 |
|
|
while ($row3=& $res3->fetchRow(DB_FETCHMODE_ASSOC)){ |
321 |
|
|
$shonant[$row3['destination']]=$row3["shon_anterieure"]; |
322 |
|
|
$shondem[$row3['destination']]=$row3["shon_demolie"]; |
323 |
|
|
$shonanttr[$row3['destination']]=$row3["shon_anterieure_supprimee"]; |
324 |
|
|
$shonprojtr[$row3['destination']]=$row3["shon_nouvelle_transformee"]; |
325 |
|
|
$shoncr1[$row3['destination']]=$row3["shon_nouvelle"]; |
326 |
|
|
$shoncr2[$row3['destination']]=$row3["shon_shob_transformee"]; |
327 |
|
|
} |
328 |
|
|
$modificatif.= $g->destination($shonant); |
329 |
|
|
$modificatif.= $g->destination($shondem); |
330 |
|
|
$modificatif.= $g->destination($shonanttr); |
331 |
|
|
$modificatif.= $g->destination($shonprojtr); |
332 |
|
|
$modificatif.= $g->destination($shoncr1); |
333 |
|
|
$modificatif.= $g->destination($shoncr2); |
334 |
|
|
|
335 |
|
|
$modificatif.= $g->descriptif($row['types']); |
336 |
|
|
$modificatif.="\n"; |
337 |
|
|
} |
338 |
|
|
} |
339 |
|
|
} |
340 |
fraynaud |
178 |
|
341 |
fraynaud |
200 |
// suivi DOC |
342 |
fraynaud |
187 |
$suivi1=""; |
343 |
fraynaud |
190 |
if($row['date_chantier'] >= $datedebut and $row['date_chantier']<=$datefin){ |
344 |
fraynaud |
193 |
$suivi1.=$g->entete("SUIVI",$departement,$commune,$pf_departement); |
345 |
fraynaud |
190 |
$suivi1.=$g->chantier(); |
346 |
|
|
$suivi1.="\n"; |
347 |
|
|
} |
348 |
fraynaud |
187 |
// suivi DAT |
349 |
|
|
$suivi2=""; |
350 |
fraynaud |
190 |
if($row['date_achevement'] >= $datedebut and $row['date_achevement']<=$datefin){ |
351 |
fraynaud |
193 |
$suivi2.=$g->entete("SUIVI",$departement,$commune,$pf_departement); |
352 |
fraynaud |
190 |
$suivi2.=$g->achevement(); |
353 |
|
|
$suivi2.="\n"; |
354 |
fraynaud |
178 |
} |
355 |
fraynaud |
190 |
// export |
356 |
|
|
$export.=$depot.$decision.$transfert.$modificatif.$suivi1.$suivi2; |
357 |
fraynaud |
187 |
} // fin while |
358 |
fraynaud |
190 |
// *************************************** |
359 |
|
|
// entete de l enregistrement page 8 et 9 |
360 |
|
|
// *************************************** |
361 |
|
|
// numero |
362 |
nhaye |
1197 |
// $numero= $db -> nextId('sitadel'); |
363 |
|
|
$departement =$f->collectivite["departement"]; |
364 |
|
|
$commune =$f->collectivite["commune"]; |
365 |
|
|
$region =$f->collectivite["region"]; |
366 |
fraynaud |
190 |
$numero=$_POST["numero"]; |
367 |
fraynaud |
193 |
$fichiertransmis = date('ymj').$pf_departement.$departement.$commune; |
368 |
fraynaud |
190 |
$longueurenregistrement= 0 ; // a calculer *** enregistrement le plus long |
369 |
fraynaud |
193 |
$entete = "SITADEL|".$pf_departement.$departement."|".$commune."|".$region."|".$fichiertransmis."|".$numero."|"; |
370 |
fraynaud |
190 |
// calcul enregistrement le plus long |
371 |
fmichon |
323 |
if(DBCHARSET=='UTF8'){ |
372 |
fraynaud |
190 |
$export=utf8_decode($export); |
373 |
|
|
} |
374 |
|
|
// nombreenrgistremment et longueurenregistrement |
375 |
|
|
$nbenr = explode("\n",$export); |
376 |
|
|
$tmp=array(); |
377 |
|
|
$cpt=0; |
378 |
|
|
for($i=0;$i<sizeof($nbenr);$i++){ |
379 |
|
|
// mb_strlen( variable,encoding) PHP 4 >= 4.0.6, PHP 5 |
380 |
vpihour |
510 |
// Le param�tre encoding est l'encodage des caract�res. |
381 |
|
|
// S'il est omis, l'encodage de caracteres interne sera utilis�. |
382 |
fraynaud |
190 |
$tmp[$i] = strlen($nbenr[$i]); |
383 |
|
|
//echo strlen($nbenr[$i])." ".$nbenr[$i]."<br>"; |
384 |
|
|
$cpt++; |
385 |
|
|
} |
386 |
|
|
$longueurenregistrement=max($tmp); |
387 |
|
|
$nombreenregistrement=$cpt; // + entete |
388 |
|
|
// Date de modification |
389 |
|
|
$datemodification = date('y').str_pad (DATE('m'), 2, "0", STR_PAD_LEFT).str_pad (DATE('j'), 2, "0", STR_PAD_LEFT); |
390 |
|
|
// export |
391 |
|
|
$version = substr($version,0,8); |
392 |
fraynaud |
200 |
$entete.= $longueurenregistrement."|".$datemodification."|". |
393 |
|
|
$nombreenregistrement."|openFoncier|".$version."\n"; |
394 |
fraynaud |
190 |
$export=$entete.$export; |
395 |
fraynaud |
193 |
// $str = htmlentities($str, ENT_QUOTES); |
396 |
fraynaud |
190 |
// ecriture des fichiers en tmp |
397 |
|
|
$fichier = "../tmp/SITADEL".substr($_POST["datedebut"],3,2). |
398 |
fraynaud |
322 |
"".substr($_POST["datedebut"],8,4).""; |
399 |
fraynaud |
190 |
$inf = fopen($fichier,"w"); |
400 |
|
|
fwrite($inf,$export); |
401 |
|
|
fclose($inf); |
402 |
fraynaud |
200 |
echo "<br>"._("Fichier")." ".$fichier." "._("sauvegarde")."<br /><br /><br />"; |
403 |
fraynaud |
190 |
// affichage |
404 |
|
|
echo "<br /><br />Pour telecharger le fichier, cliquer ici : <a href=\"".$fichier."\" target=\"_blank\">"; |
405 |
fraynaud |
322 |
echo "<img src=\"../app/img/ico_trace.png\" alt=\"Telecharger le fichier CNEN\" title=\"Telecharger le fichier Sitadel\" />"; |
406 |
fraynaud |
200 |
echo "</a>"._("avec le bouton droit et enregistrer la cible du lien sous.")."<br /><br />"; |
407 |
fraynaud |
190 |
if($DEBUG==1){ |
408 |
|
|
$affiche=""; |
409 |
|
|
$affiche= str_replace("\n","<br>",$export); |
410 |
|
|
echo $affiche; |
411 |
|
|
} |
412 |
fraynaud |
187 |
}else // correct = false |
413 |
fraynaud |
200 |
echo _("remplissez les 2 dates"); |
414 |
fraynaud |
178 |
}//validation |
415 |
fraynaud |
200 |
?> |