/[openfoncier]/trunk/obj/demande.class.php
ViewVC logotype

Annotation of /trunk/obj/demande.class.php

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1606 - (hide annotations)
Tue Apr 2 17:25:20 2013 UTC (11 years, 10 months ago) by nhaye
File size: 45864 byte(s)
Vérification de l'existance d'un état initial des DA

1 vpihour 632 <?php
2     //$Id$
3     //gen openMairie le 08/11/2012 14:00
4    
5     require_once ("../gen/obj/demande.class.php");
6    
7     class demande extends demande_gen {
8    
9 nhaye 838 var $valIdDemandeur = array("petitionnaire_principal" => "",
10     "delegataire" => "",
11     "petitionnaire" => array());
12     var $postedIdDemandeur = array("petitionnaire_principal" => "",
13     "delegataire" => "",
14     "petitionnaire" => array());
15 nhaye 807
16 nhaye 1333 var $autreDossierEnCour;
17    
18 vpihour 632 function demande($id,&$db,$debug) {
19     $this->constructeur($id,$db,$debug);
20     }// fin constructeur
21 fmichon 1005
22     function setValF($val) {
23     parent::setValF($val);
24     // Récupération des id demandeurs postés
25     $this->getPostedValues();
26 nhaye 1020 //$this->valIdDemandeur=$this->postedIdDemandeur;
27 fmichon 1005 }
28    
29     /**
30     * Méthode permettant de récupérer les valeurs du dossier d'autorisation
31 vpihour 1058 * correspondant à la nouvelle demande
32 fmichon 1005 */
33 nhaye 1039 function getValFromDossier($dossier_autorisation) {
34 fmichon 1005 include "../sql/pgsql/demande.form.inc.php";
35     $sql=str_replace("<idx>",$this->getParameter("idx_dossier"),
36 nhaye 1053 $sql_infos_dossier);
37 fmichon 1005 $res = $this->db->query($sql);
38 nhaye 1039 $this->addToLog("demande -> getValFromDossier() : ".$sql);
39 fmichon 1005 $this->f->isDatabaseError();
40     $row = & $res->fetchRow(DB_FETCHMODE_ASSOC);
41     return $row;
42     }
43 vpihour 651
44 vpihour 799 /*
45     * La date du jour par défaut dans le champs date_demande
46     * Put the date of the day by default into the field date_demande
47     */
48 vpihour 635 function setVal(&$form, $maj, $validation, &$db) {
49     if($maj == 0) {
50 fmichon 1005 $form->setVal("date_demande",date('d/m/Y'));
51    
52     // Récupération des valeurs du dossier d'autorisation correspondant
53     if($this->getParameter("idx_dossier") != "") {
54 nhaye 1039 $val_autorisation = $this->getValFromDossier(
55 fmichon 1005 $this->getParameter("idx_dossier"));
56     foreach($val_autorisation as $champ => $value) {
57     $form->setVal($champ,$value);
58     }
59     }
60 vpihour 635 }
61     }
62 nhaye 1404 function getDataSubmit() {
63    
64     $datasubmit = parent::getDataSubmit();
65     if($this->getParameter("idx_dossier") != "") {
66     $datasubmit .= "&idx_dossier=".$this->getParameter("idx_dossier");
67     }
68     return $datasubmit;
69     }
70 vpihour 635
71 nhaye 838 /**
72     * Méthode de verification du contenu
73     */
74     function verifier($val, &$db, $DEBUG) {
75     parent::verifier($val, $db, $DEBUG);
76     if(!isset($this->postedIdDemandeur["petitionnaire_principal"]) OR
77     empty($this->postedIdDemandeur["petitionnaire_principal"])) {
78     $this->correct = false;
79     $this->addToMessage("La saisie d'un petitionnaire principal est obligatoire.");
80     }
81     }
82 nhaye 1333
83     /**
84     * Configuration des select
85     */
86     function setSelect(&$form, $maj,&$db,$debug) {
87     parent::setSelect($form, $maj,$db,$debug);
88    
89     if(file_exists ("../sql/".$db->phptype."/".$this->table.".form.inc.php"))
90     include ("../sql/".$db->phptype."/".$this->table.".form.inc.php");
91     elseif(file_exists ("../sql/".$db->phptype."/".$this->table.".form.inc"))
92     include ("../sql/".$db->phptype."/".$this->table.".form.inc");
93    
94     //Récupération de paramètre pour le rechargement ajax du select
95     $idx_dossier = $this->getParameter("idx_dossier");
96     $datd = $this->getParameter("datd");
97    
98     $contenu = array();
99    
100     // Ajout de filtre sur la requête (initial)
101     if(isset($idx_dossier) AND $idx_dossier != "") {
102 nhaye 1580 $sql_demande_type .= " WHERE demande_type.demande_nature = 2 ";
103    
104     // ajout du numéro de dossier existant pour tester l'état du DA
105     $sql_demande_type .= "AND dossier.dossier = '".$idx_dossier."' ";
106 nhaye 1333 } else {
107 nhaye 1580 $sql_demande_type .= " WHERE demande_type.demande_nature = 1 ";
108 nhaye 1333 }
109 nhaye 1404 if(isset($_POST["dossier_autorisation_type_detaille"]) AND $_POST["dossier_autorisation_type_detaille"] != "") {
110     $datd = $_POST["dossier_autorisation_type_detaille"];
111     }
112     // Ajout de filtre sur la requête (dossier_autorisation_type_detaille)
113 nhaye 1333 if(isset($datd) AND $datd != "") {
114 nhaye 1580 $sql_demande_type .= " AND demande_type.dossier_autorisation_type_detaille = ".$datd;
115 nhaye 1333 } else {
116 fmichon 1505 $datd = $this->getVal("dossier_autorisation_type_detaille");
117     if ($datd != "") {
118 nhaye 1580 $sql_demande_type .= " AND demande_type.dossier_autorisation_type_detaille = ".$datd;
119 fmichon 1505 }
120 nhaye 1333 }
121    
122     $res = $db->query($sql_demande_type);
123    
124     // logger
125     $this->addToLog("setSelect()[gen/obj]: db->query(\"".$sql_demande_type."\");",
126     VERBOSE_MODE);
127 nhaye 1335 $this->f->isDatabaseError($res);
128 nhaye 1333
129     $contenu[0][0] = '';
130     $contenu[1][0] = _('choisir')."&nbsp;"._("demande_type");
131    
132     $k=1;
133     while($row =& $res->fetchRow()){
134    
135 nhaye 1580 $contenu[0][$k] = $row[0];
136     $contenu[1][$k] = $row[1];
137     $k++;
138 nhaye 1333 }
139    
140     $form->setSelect("demande_type", $contenu);
141    
142     }
143 vpihour 799 /*
144     * Ajout du fielset
145     * Add fieldset
146     */
147 vpihour 635 function setLayout(&$form, $maj){
148     if ( $maj < 2 OR $maj == 3 ) {
149    
150 vpihour 1058 /*Champ sur lequel s'ouvre le bloc 1 */
151 nhaye 807 $form->setBloc('dossier_autorisation_type_detaille','D',"","dossier_type col_8");
152 vpihour 1058
153 nhaye 807 $form->setFieldset('dossier_autorisation_type_detaille','D'
154     ,_('Type de dossier/demande'));
155     $form->setFieldset('demande_type','F','');
156    
157     $form->setBloc('demande_type','F');
158 vpihour 1058 /*Fin bloc 1*/
159 nhaye 807
160 vpihour 1058 /*Champ sur lequel s'ouvre le bloc 2 */
161 nhaye 807 $form->setBloc('date_demande','D',"","col_4 demande_hidden_bloc");
162     $form->setFieldset('date_demande','D',_('Date de la demande'));
163     $form->setFieldset('date_demande','F','');
164 vpihour 635 $form->setBloc('date_demande','F');
165 vpihour 1058 /*Fin bloc 2*/
166 vpihour 635
167 vpihour 1058 /*Champ sur lequel s'ouvre le bloc 3 */
168 nhaye 807 $form->setBloc('terrain_references_cadastrales','D',"",
169     "localisation col_12 demande_hidden_bloc");
170 vpihour 693 $form->setFieldset('terrain_references_cadastrales','D',_('Localisation du terrain'));
171     $form->setFieldset('terrain_superficie','F','');
172 vpihour 635 $form->setBloc('terrain_superficie','F');
173 vpihour 1058 /*Fin bloc 4*/
174 vpihour 676
175 vpihour 635 }
176     }
177 vpihour 641
178 vpihour 799 /*
179     * Ajoute des actions sur les deux premiers select
180     * Add actions on the two first select
181     */
182 vpihour 641 function setOnchange(&$form,$maj){
183     parent::setOnchange($form,$maj);
184     $form->setOnchange("dossier_autorisation_type_detaille","changeDemandeType();");
185     $form->setOnchange("demande_type","showFormsDemande();");
186     }
187 nhaye 1442
188     function setLib(&$form,$maj) {
189     parent::setLib($form,$maj);
190     //libelle des champs
191    
192     $form->setLib('complement',_('terrain_adresse'));
193     }
194 vpihour 799 /*
195     * Cache le champ terrain_references_cadastrales
196     * Hide the fiels terrain_references_cadastrales
197     */
198 vpihour 651 function setType(&$form,$maj) {
199     parent::setType($form,$maj);
200    
201 vpihour 689 $form->setType('dossier_instruction', 'hidden');
202     $form->setType('dossier_autorisation', 'hidden');
203 fmichon 1005
204     $form->setType('instruction_recepisse', 'hidden');
205     $form->setType('arrondissement', 'hidden');
206    
207     // Si il s'agit d'une demande sur dossier existant on desactive tous les champs
208     // sauf demande_type
209 nhaye 1100 if(($maj == 0 AND $this-> getParameter("idx_dossier"))) {
210 nhaye 1053 $form->setType('dossier_autorisation_type_detaille', 'selecthiddenstatic');
211     $form->setType('terrain_references_cadastrales', 'hiddenstatic');
212     $form->setType('terrain_adresse_voie_numero', 'hiddenstatic');
213     $form->setType('complement', 'hiddenstatic');
214     $form->setType('terrain_adresse_lieu_dit', 'hiddenstatic');
215     $form->setType('terrain_adresse_localite', 'hiddenstatic');
216     $form->setType('terrain_adresse_code_postal', 'hiddenstatic');
217     $form->setType('terrain_adresse_bp', 'hiddenstatic');
218     $form->setType('terrain_adresse_cedex', 'hiddenstatic');
219     $form->setType('terrain_superficie', 'hiddenstatic');
220 fmichon 1005 }
221 nhaye 1100 if($maj == 1) {
222     $form->setType('dossier_autorisation_type_detaille', 'selecthiddenstatic');
223 nhaye 1095 $form->setType('demande_type', 'selecthiddenstatic');
224     }
225 nhaye 1100 if($maj == 3) {
226 nhaye 1101 $form->setType('terrain_references_cadastrales', 'referencescadastralesstatic');
227 nhaye 1100 }
228    
229 vpihour 651 }
230 vpihour 676
231 nhaye 807 /**
232 nhaye 920 * Méthode permettant d'ajouter un dossier d'autorisation
233     */
234     function ajoutDossierAutorisation($id, &$db, $val, $DEBUG){
235     require_once '../obj/dossier_autorisation.class.php';
236     $dossier_autorisation = new dossier_autorisation("]",$db,$DEBUG);
237 nhaye 1606 $id_etat_initial_da = $this->getParameter('etat_initial_dossier_autorisation');
238     $error = false;
239     // Vérification de l'existance d'un état initial des DA
240     if(isset($id_etat_initial_da)) {
241     $sql = "SELECT count(*) FROM ".DB_PREFIXE."etat_dossier_autorisation
242     WHERE etat_dossier_autorisation = ".$id_etat_initial_da;
243     $count = $this->db->getOne($sql);
244     $this->addToLog("ajoutDossierAutorisation() getOne() : ".$sql);
245     $this->f->isDatabaseError($count);
246     if($count != 1) {
247     $error = true;
248     } else {
249     // Création du dossier
250     foreach($dossier_autorisation->champs as $value) {
251     $valAuto[$value] = NULL;
252     }
253     $valAuto['dossier_autorisation']="";
254     $valAuto['exercice']=NULL;
255     $valAuto['insee']=NULL;
256     $valAuto['arrondissement']=NULL;
257     $valAuto['etat_dossier_autorisation']=$this->getParameter('etat_initial_dossier_autorisation');
258     $valAuto['erp_numero_batiment']=NULL;
259     $valAuto['erp_ouvert']=NULL;
260     $valAuto['erp_arrete_decision']=NULL;
261     $valAuto['dossier_autorisation_type_detaille']=$this->valF['dossier_autorisation_type_detaille'];
262     $valAuto['depot_initial']=$this->dateDBToForm($this->valF['date_demande']);
263     $valAuto['terrain_references_cadastrales']=$this->valF['terrain_references_cadastrales'];
264     $valAuto['terrain_adresse_voie_numero']=$this->valF['terrain_adresse_voie_numero'];
265     $valAuto['complement']=$this->valF['complement'];
266     $valAuto['terrain_adresse_lieu_dit']=$this->valF['terrain_adresse_lieu_dit'];
267     $valAuto['terrain_adresse_localite']=$this->valF['terrain_adresse_localite'];
268     $valAuto['terrain_adresse_code_postal']=$this->valF['terrain_adresse_code_postal'];
269     $valAuto['terrain_adresse_bp']=$this->valF['terrain_adresse_bp'];
270     $valAuto['terrain_adresse_cedex']=$this->valF['terrain_adresse_cedex'];
271     $valAuto['terrain_superficie']=$this->valF['terrain_superficie'];
272     $valAuto['numero_version']=-1;
273     // Ajout du dossier dans la base
274     $dossier_autorisation->ajouter($valAuto, $db, $DEBUG);
275     // Liaison du dossier ajouter à la demande
276     $this->valF['dossier_autorisation'] = $dossier_autorisation->valF['dossier_autorisation'];
277     }
278     } else {
279     $error = true;
280 nhaye 920 }
281 nhaye 1606 // Affichage de l'erreur et stop de l'affichage
282     if( $error ) {
283     echo "</div>";
284     $class = "error";
285     $message = _("Erreur de parametrage. Contactez votre administrateur.");
286     $this->f->displayMessage($class, $message);
287     die();
288     }
289    
290 nhaye 920 }
291    
292 vpihour 1273 function getCodeDemandeType($demande_type){
293    
294     $sql = "SELECT
295     code
296     FROM
297     ".DB_PREFIXE."demande_type
298     WHERE
299     demande_type = ".$demande_type;
300     $codeDemandeType = $this->db->getOne($sql);
301     $this->addToLog("db->getone(\"".$sql."\");", VERBOSE_MODE);
302    
303     return $codeDemandeType;
304     }
305    
306 nhaye 920 /**
307     * Méthode permettant d'ajouter un dossier d'instruction
308     */
309 fmichon 1005 function ajoutDossierInstruction($id, &$db, $val, $DEBUG, $dossier_instruction_type){
310 nhaye 920 require_once '../obj/dossier.class.php';
311     $dossier = new dossier("]",$db,$DEBUG);
312     foreach($dossier->champs as $value) {
313     $valInstr[$value] = NULL;
314     }
315     require_once '../obj/dossier_autorisation_type_detaille.class.php';
316     $datd = new dossier_autorisation_type_detaille(
317     $this->valF['dossier_autorisation_type_detaille'],$db,$DEBUG);
318 fmichon 1005
319     /*Ajout de la variable dossier_instruction_type à l'objet dossier pour le
320     * versionning
321     */
322     $dossier->setDossierInstructionType($dossier_instruction_type);
323    
324 nhaye 920 // Définition des valeurs à entrée dans la table
325 nhaye 1186 $valInstr['dossier_instruction_type']=$dossier_instruction_type;
326 nhaye 920 $valInstr['date_depot']=$this->dateDBToForm($this->valF['date_demande']);
327 nhaye 1571 $valInstr['date_dernier_depot']=$this->dateDBToForm($this->valF['date_demande']);
328 nhaye 1037 $valInstr['date_demande']=$this->dateDBToForm($this->valF['date_demande']);
329 nhaye 920 $valInstr['depot_initial']=$this->dateDBToForm($this->valF['date_demande']);
330     $valInstr['terrain_references_cadastrales']=$this->valF['terrain_references_cadastrales'];
331     $valInstr['terrain_adresse_voie_numero']=$this->valF['terrain_adresse_voie_numero'];
332     $valInstr['complement']=$this->valF['complement'];
333     $valInstr['terrain_adresse_lieu_dit']=$this->valF['terrain_adresse_lieu_dit'];
334     $valInstr['terrain_adresse_localite']=$this->valF['terrain_adresse_localite'];
335     $valInstr['terrain_adresse_code_postal']=$this->valF['terrain_adresse_code_postal'];
336     $valInstr['terrain_adresse_bp']=$this->valF['terrain_adresse_bp'];
337     $valInstr['terrain_adresse_cedex']=$this->valF['terrain_adresse_cedex'];
338     $valInstr['terrain_superficie']=$this->valF['terrain_superficie'];
339     $valInstr['description']="";
340 fmichon 927 $valInstr['dossier_autorisation']=$this->valF['dossier_autorisation'];
341 nhaye 1262
342 vpihour 1273 /*
343     * Gestion de la qualification
344     * */
345     //Récupérer le code du type de la demande
346     $codeDemandeType = $this->getCodeDemandeType($val['demande_type']);
347    
348     //Marque le dossier comme à qualifier selon le type de dossier d'instruction
349     if ( strcasecmp($codeDemandeType, "DI") == 0 ||
350     strcasecmp($codeDemandeType, "DT") == 0 ||
351     strcasecmp($codeDemandeType, "DM") == 0 ||
352     strcasecmp($codeDemandeType, "DP") == 0 ||
353     strcasecmp($codeDemandeType, "DTP") == 0 ||
354 vpihour 1307 strcasecmp($codeDemandeType, "DAACT") == 0 ||
355 vpihour 1273 strcasecmp($codeDemandeType, "DOC") == 0 ){
356    
357     $valInstr['a_qualifier'] = TRUE;
358     }
359    
360 nhaye 1262 // Récupération du cerfa pour le type d'instruction sélectionnée et valide
361 vpihour 1273 $sql = "SELECT
362     dossier_instruction_type.cerfa
363     FROM
364     ".DB_PREFIXE."dossier_instruction_type
365     JOIN
366     ".DB_PREFIXE."cerfa
367     ON
368     dossier_instruction_type.cerfa = cerfa.cerfa
369     WHERE
370     now()<=om_validite_fin
371     AND now()>=om_validite_debut
372     AND dossier_instruction_type=".$dossier_instruction_type;
373 nhaye 1262 $valInstr['cerfa'] = $db->getOne($sql);
374     $this->addToLog("db->getone(\"".$sql."\");", VERBOSE_MODE);
375    
376 nhaye 920 $dossier->ajouter($valInstr, $db, $DEBUG);
377     $this->f->isDatabaseError();
378     // Liaison du dossier ajouter à la demande
379     $this->valF['dossier_instruction'] = $dossier->valF['dossier'];
380     }
381    
382     /**
383 vpihour 1374 * Méthode permettant d'ajouter les données techniques au dossier d'instruction
384     */
385     function ajoutDonneesTechniques($id, &$db, $val, $DEBUG){
386    
387     require_once '../obj/donnees_techniques.class.php';
388     $donnees_techniques = new donnees_techniques("]",$db,$DEBUG);
389    
390     // Champs tous à NULL car seul le champ concernant le dossier d'instruction sera rempli
391     foreach($donnees_techniques->champs as $value) {
392     $val[$value] = NULL;
393     }
394    
395     // Ajout du numéro de dossier d'instruction
396     $val['dossier_instruction']=$this->valF['dossier_instruction'];
397    
398     // Ajout des données techniques
399     $donnees_techniques->ajouter($val, $db, $DEBUG);
400     $this->f->isDatabaseError();
401     }
402    
403     /**
404 nhaye 920 * Ajout des liens demandeurs / dossier d'autorisation
405 nhaye 907 **/
406 nhaye 920 function ajoutLiensDossierAutorisation($id, &$db, $val, $DEBUG) {
407     // Création des liens entre le dossier autorisation et les demandeurs
408 nhaye 907 include '../sql/pgsql/demande.form.inc.php';
409 nhaye 920 require_once '../obj/lien_dossier_autorisation_demandeur.class.php';
410     $ldad = new lien_dossier_autorisation_demandeur("]",$db,$DEBUG);
411     // Recupération des demandeurs liés à la demande
412     $sql = str_replace("<demande>",$this->valF['demande'],$sql_lien_demande_demandeur);
413     $res = $db->query($sql);
414     $this->f->addToLog("demande.class.php: db->query(\"".$sql."\");", VERBOSE_MODE);
415     $this->f->isDatabaseError();
416     while($row = &$res->fetchRow(DB_FETCHMODE_ASSOC)) {
417     $row['lien_dossier_autorisation_demandeur'] = NULL;
418     $row['dossier_autorisation'] = $this->valF['dossier_autorisation'];
419     $ldad->ajouter($row, $db, $DEBUG);
420     }
421     }
422    
423     /**
424     * Ajout des liens demandeurs / dossier d'autorisation
425     **/
426     function ajoutLiensDossierInstruction($id, &$db, $val, $DEBUG) {
427     // Création des liens entre le dossier instruction et les demandeurs
428     include '../sql/pgsql/demande.form.inc.php';
429     require_once '../obj/lien_dossier_demandeur.class.php';
430     $ldd = new lien_dossier_demandeur("]",$db,$DEBUG);
431     // Recupération des demandeurs liés à la demande
432     $sql = str_replace("<demande>",$this->valF['demande'],$sql_lien_demande_demandeur);
433     $res = $db->query($sql);
434     $this->f->addToLog("demande.class.php: db->query(\"".$sql."\");", VERBOSE_MODE);
435     $this->f->isDatabaseError();
436     while($row = &$res->fetchRow(DB_FETCHMODE_ASSOC)) {
437     $row['lien_dossier_demandeur'] = NULL;
438     $row['dossier'] = $this->valF['dossier_instruction'];
439     $ldd->ajouter($row, $db, $DEBUG);
440     }
441     }
442    
443 fmichon 1005 /*
444     * Récupère l'identifiant d'un arrondissement à partir d'un code postal
445     */
446     function getArrondissement($terrain_adresse_code_postal){
447    
448     $arrondissement = NULL;
449    
450     $sql = "SELECT
451     arrondissement
452     FROM
453     ".DB_PREFIXE."arrondissement
454     WHERE
455     code_postal = '$terrain_adresse_code_postal' ";
456     $this->addToLog("demande.class.php : ".$sql." execute <br>", EXTRA_VERBOSE_MODE);
457    
458     $res = $this->db->query($sql);
459     $this->f->isDatabaseError($res);
460    
461     if( $res->numrows() > 0 ) {
462    
463     $row=& $res->fetchRow(DB_FETCHMODE_ASSOC);
464     $arrondissement = $row['arrondissement'];
465     }
466    
467     return $arrondissement;
468     }
469    
470     /*
471     * Récupère l'évènement lié à un type de demande
472     */
473     function getEvenement($demande_type){
474    
475     $evenement = NULL;
476    
477     $sql =
478     "SELECT
479     evenement
480     FROM
481     ".DB_PREFIXE."demande_type
482     WHERE
483     demande_type = $demande_type";
484    
485     $res = $this->db->query($sql);
486     $this->f->isDatabaseError($res);
487    
488     if ( $res->numrows() > 0 ){
489    
490     $row=& $res->fetchRow(DB_FETCHMODE_ASSOC);
491     $evenement = $row['evenement'];
492     }
493    
494     return $evenement;
495     }
496    
497     /*
498     * Récupère la lettre type lié à un événement
499     */
500     function getLettreType($evenement){
501    
502     $lettretype = NULL;
503    
504     $sql =
505     "SELECT
506     lettretype
507     FROM
508     ".DB_PREFIXE."evenement
509     WHERE
510     evenement = $evenement";
511    
512     $res = $this->db->query($sql);
513     $this->f->isDatabaseError($res);
514    
515     if ( $res->numrows() > 0 ){
516    
517     $row=& $res->fetchRow(DB_FETCHMODE_ASSOC);
518     $lettretype = $row['lettretype'];
519     }
520    
521     return $lettretype;
522     }
523    
524 nhaye 920 /**
525     * Ajout des dossiers
526     **/
527     function triggerAjouter($id, &$db, $val, $DEBUG){
528     include '../sql/pgsql/demande.form.inc.php';
529 nhaye 907 if($this->valF["demande_type"] != NULL) {
530     $res = $db->query(str_replace('<idx>', $this->valF['demande_type'], $sql_demande_type_details_by_id));
531     $this->f->isDatabaseError();
532 nhaye 920 $dossier_type = $res->fetchRow(DB_FETCHMODE_ASSOC);
533 nhaye 907 // Création du dossier_autorisation
534 nhaye 1054 if($this->valF['dossier_autorisation'] == "") {
535 nhaye 920 $this->ajoutDossierAutorisation($id, $db, $val, $DEBUG);
536 nhaye 907 $this -> addToMessage(_("Creation du dossier d'autorisation no").$this->valF['dossier_autorisation']);
537     }
538 nhaye 920 // Création du dossier d'instruction
539     if($dossier_type['dossier_instruction_type'] != NULL) {
540 fmichon 1005 $this->ajoutDossierInstruction($id, $db, $val, $DEBUG, $dossier_type['dossier_instruction_type']);
541 nhaye 945 $this -> addToMessage(_("Creation du dossier d'instruction no").$this->valF['dossier_instruction']);
542 vpihour 1374
543     //Ajout des données techniques au dossier d'instruction
544     $this->ajoutDonneesTechniques($id, $db, $val, $DEBUG);
545 nhaye 907 }
546 vpihour 930
547     /*Création du lien de téléchargement de récépissé de demande*/
548     if ( $this->valF['demande_type'] != "" && is_numeric($this->valF['demande_type'])
549     && isset($this->valF['dossier_instruction']) && $this->valF['dossier_instruction'] !== "" ){
550    
551     /*Récupérer l'événement lié à ce type de demande*/
552 fmichon 1005 $evenement = $this->getEvenement($this->valF['demande_type']);
553    
554 vpihour 930 /*Récupération de la lettre type de l'événement*/
555 fmichon 1005 $lettretype = $this->getLettreType($evenement);
556 vpihour 930
557     /*Création d'une nouvelle instruction avec cet événement*/
558     /*Données*/
559     $valInstr['instruction']=NULL;
560    
561     $valInstr['destinataire']=$this->valF['dossier_instruction'];
562     $valInstr['dossier']=$this->valF['dossier_instruction'];
563    
564 vpihour 1127 $valInstr['date_evenement']=date("d/m/Y");
565 fmichon 1005 $valInstr['evenement']=$evenement;
566     $valInstr['lettretype']=$lettretype;
567 vpihour 930 $valInstr['complement']="";
568     $valInstr['complement2']="";
569    
570     $valInstr['action']="initialisation";
571     $valInstr['delai']="2";
572     $valInstr['etat']="notifier";
573     $valInstr['accord_tacite']="Oui";
574     $valInstr['delai_notification']="1";
575     $valInstr['archive_delai']="0";
576     $valInstr['archive_date_complet']=NULL;
577 nhaye 1571 $valInstr['archive_date_dernier_depot']=NULL;
578 vpihour 930 $valInstr['archive_date_rejet']=NULL;
579     $valInstr['archive_date_limite']=NULL;
580     $valInstr['archive_date_notification_delai']=NULL;
581     $valInstr['archive_accord_tacite']="Non";
582     $valInstr['archive_etat']="initialiser";
583     $valInstr['archive_date_decision']=NULL;
584     $valInstr['archive_avis']="";
585     $valInstr['archive_date_validite']=NULL;
586     $valInstr['archive_date_achevement']=NULL;
587     $valInstr['archive_date_chantier']=NULL;
588     $valInstr['archive_date_conformite']=NULL;
589     $valInstr['complement3']="";
590     $valInstr['complement4']="";
591     $valInstr['complement5']="";
592     $valInstr['complement6']="";
593     $valInstr['complement7']="";
594     $valInstr['complement8']="";
595     $valInstr['complement9']="";
596     $valInstr['complement10']="";
597     $valInstr['complement11']="";
598     $valInstr['complement12']="";
599     $valInstr['complement13']="";
600     $valInstr['complement14']="";
601     $valInstr['complement15']="";
602     $valInstr['avis_decision']=NULL;
603 vpihour 1136 $valInstr['date_finalisation_courrier']=NULL;
604     $valInstr['date_envoi_signature']=NULL;
605     $valInstr['date_retour_signature']=NULL;
606     $valInstr['date_envoi_rar']=NULL;
607     $valInstr['date_retour_rar']=NULL;
608     $valInstr['date_envoi_controle_legalite']=NULL;
609     $valInstr['date_retour_controle_legalite']=NULL;
610 nhaye 1246 $valInstr['signataire_arrete']=NULL;
611 vpihour 1307 $valInstr['numero_arrete']=NULL;
612 vpihour 930
613     /*Fichier requis*/
614     require_once '../obj/instruction.class.php';
615    
616     /*Création d'un nouveau dossier*/
617     $instruction = new instruction("]",$db,$DEBUG);
618     $instruction->valF = "";
619     $instruction->ajouter($valInstr, $db, $DEBUG);
620 vpihour 1058
621     /*Si la création a réussie*/
622 vpihour 930 if ( $instruction->valF['instruction'] != "" ){
623    
624 vpihour 1058 /*Affichage du récépissé de la demande*/
625 fmichon 1005 $this->valF['instruction_recepisse'] = $instruction->valF['instruction'];
626 vpihour 930 $this -> addToMessage("<br/><a
627     class='lien'
628 fmichon 1385 href='../pdf/pdflettretype.php?obj=".$lettretype."&amp;idx=".$instruction->valF['instruction']."'
629 vpihour 1084 target='_blank'>
630 vpihour 930 <span
631     class=\"om-icon om-icon-16 om-icon-fix pdf-16\"
632     title=\""._("Telecharger le recepisse de la demande")."\">".
633     _("Telecharger le recepisse de la demande").
634     "</span>
635     &nbsp;&nbsp;&nbsp;&nbsp;".
636     _("Telecharger le recepisse de la demande")."
637 vpihour 1093 </a><br/>");
638 vpihour 930 }
639 vpihour 1058 /*Sinon affiche un message d'erreur*/
640 vpihour 930 else {
641    
642 fmichon 1012 $this -> addToMessage(_("Une erreur s'est produite lors de la creation du recepisse"));
643 vpihour 930 }
644     }
645 fmichon 1005
646     /*Ajout de l'arrondissement à partir du code postal*/
647     if ( !is_null($this->valF["terrain_adresse_code_postal"]) && is_numeric($this->valF["terrain_adresse_code_postal"]) ){
648    
649     $this->valF["arrondissement"] = $this->getArrondissement($this->valF["terrain_adresse_code_postal"]);
650     }
651 nhaye 907 }
652     }
653    
654     /**
655 nhaye 828 * Ajout des délégataires et pétitionnaires
656 nhaye 807 **/
657 nhaye 828 function triggerAjouterApres($id, &$db, $val, $DEBUG){
658     $this->insertLinkDemandeDemandeur($db, $DEBUG);
659 fmichon 1005
660 nhaye 920 // Ajout des lliens entre dossier_autorisation et demandeur
661 vpihour 1070 if(!empty($this->valF['dossier_autorisation']) AND $val['dossier_autorisation'] == "" ) {
662 nhaye 920 $this->ajoutLiensDossierAutorisation($id, $db, $val, $DEBUG);
663     }
664     // Ajout des lliens entre dossier et demandeur
665     if(!empty($this->valF['dossier_instruction'])) {
666     $this->ajoutLiensDossierInstruction($id, $db, $val, $DEBUG);
667     }
668 nhaye 1246
669     // Duplication des lots et liaison au nouveau dossier_d'instruction
670     if(!empty($this->valF['dossier_autorisation']) AND $val['dossier_autorisation'] != "" ) {
671     $this->lienLotDossierInstruction($id, $db, $val, $DEBUG);
672     }
673 nhaye 828 }
674 vpihour 1058
675     /*Ajout du lien demande / demandeur(s)*/
676 nhaye 828 function triggerModifierApres($id, &$db, $val, $DEBUG){
677 nhaye 1039 $this->listeDemandeur("demande",$this->val[array_search('demande', $this->champs)]);
678 nhaye 828 $this->insertLinkDemandeDemandeur($db, $DEBUG);
679 nhaye 838 $this->valIdDemandeur=$this->postedIdDemandeur;
680 nhaye 828
681     }
682    
683     /**
684 nhaye 1246 * Gestion des liens entre les lots du DA et le nouveau dossier
685     **/
686     function lienLotDossierInstruction($id, $db, $val, $DEBUG) {
687     require_once ("../obj/lot.class.php");
688     $lot = new lot("]", $db, $DEBUG);
689     require_once ("../obj/lien_dossier_lot.class.php");
690     $ldl = new lien_dossier_lot("]", $db, $DEBUG);
691     require_once ("../obj/lien_lot_demandeur.class.php");
692     $lld = new lien_lot_demandeur("]", $db, $DEBUG);
693    
694    
695     $sqlLots = "SELECT * FROM ".DB_PREFIXE."lot
696     WHERE dossier_autorisation = '".$this->valF['dossier_autorisation']."'";
697     $resLot = $db -> query($sqlLots);
698     $this->f->addToLog("db->query(\"".$sqlLots."\");", VERBOSE_MODE);
699     $this->f->isDatabaseError($resLot);
700     while ($rowLot=& $resLot->fetchRow(DB_FETCHMODE_ASSOC)){
701     // Insertion du nouveau lot
702     $valLot['lot'] = "";
703     $valLot['libelle'] = $rowLot['libelle'];
704     $valLot['dossier_autorisation'] = NULL;
705     $lot -> ajouter($valLot, $db, $DEBUG);
706 nhaye 1247
707 nhaye 1246 //Insertion du lien entre le lot et le dossier d'instruction
708     $valLdl['lien_dossier_lot'] = "";
709     $valLdl['dossier'] = $this->valF['dossier_instruction'];
710     $valLdl['lot'] = $lot->valF['lot'];
711     $ldl->ajouter($valLdl, $db, $DEBUG);
712    
713     //Insertion des liens entre dossier et les lots
714     $sqlDemandeurs = "SELECT * FROM ".DB_PREFIXE."lien_lot_demandeur
715     WHERE lot = ".$rowLot['lot'];
716     $res = $db -> query($sqlDemandeurs);
717     $this->f->addToLog("db->query(\"".$sqlDemandeurs."\");", VERBOSE_MODE);
718     $this->f->isDatabaseError($res);
719    
720     while ($row=& $res->fetchRow(DB_FETCHMODE_ASSOC)){
721     $valLld["lien_lot_demandeur"] = "";
722     $valLld["lot"]=$lot->valF['lot'];
723     $valLld["demandeur"] = $row['demandeur'];
724     $valLld["petitionnaire_principal"] = $row['petitionnaire_principal'];
725     $lld->ajouter($valLld, $db, $DEBUG);
726     }
727     }
728     }
729    
730     /**
731 vpihour 1058 * Gestion des liens entre la demande et les demandeurs recemment ajoutés
732 nhaye 828 **/
733     function insertLinkDemandeDemandeur($db, $DEBUG) {
734     //
735     require_once "../obj/lien_demande_demandeur.class.php";
736 nhaye 838 // Comparaison de l'id petitionnaire principal
737     if(isset($this->postedIdDemandeur['petitionnaire_principal']) AND
738     !empty($this->postedIdDemandeur['petitionnaire_principal']) AND
739     $this->valIdDemandeur['petitionnaire_principal'] !=
740     $this->postedIdDemandeur['petitionnaire_principal']) {
741     // Ajout du nouveau lien
742     $this->addLinkDemandeDemandeur($this->postedIdDemandeur['petitionnaire_principal'], true, $db, $DEBUG);
743     if(!empty($this->valIdDemandeur['petitionnaire_principal'])) {
744     $this->deleteLinkDemandeDemandeur($this->valIdDemandeur['petitionnaire_principal'], $db, $DEBUG);
745 nhaye 807 }
746 nhaye 828 }
747 nhaye 838
748     // Comparaison du delegataire
749     if(isset($this->postedIdDemandeur['delegataire']) AND
750     !empty($this->postedIdDemandeur['delegataire']) AND
751     $this->valIdDemandeur['delegataire'] !=
752     $this->postedIdDemandeur['delegataire']) {
753     // Ajout du nouveau lien
754     $this->addLinkDemandeDemandeur($this->postedIdDemandeur['delegataire'], false, $db, $DEBUG);
755     if(!empty($this->valIdDemandeur['delegataire'])) {
756     $this->deleteLinkDemandeDemandeur($this->valIdDemandeur['delegataire'], $db, $DEBUG);
757     }
758     }
759    
760     // Comparaison des different petitionnaires
761     if(isset($this->postedIdDemandeur['petitionnaire'])) {
762     // Suppression des liens non valides
763     foreach ($this->valIdDemandeur['petitionnaire'] as $petitionnaire) {
764     if(!in_array($petitionnaire, $this->postedIdDemandeur['petitionnaire'])) {
765     $this->deleteLinkDemandeDemandeur($petitionnaire, $db, $DEBUG);
766     }
767     }
768     // Ajout des nouveaux liens
769     foreach ($this->postedIdDemandeur['petitionnaire'] as $petitionnaire) {
770     if(!in_array($petitionnaire, $this->valIdDemandeur['petitionnaire'])) {
771     $this->addLinkDemandeDemandeur($petitionnaire, false, $db, $DEBUG);
772     }
773     }
774     }
775     }
776    
777    
778     /**
779     * Fonction permettant d'ajouter un lien
780     * entre la table demande et demandeur
781     **/
782     function addLinkDemandeDemandeur($id, $principal, $db, $DEBUG) {
783     $lienAjout = new lien_demande_demandeur(
784     "]",
785     $db,
786     $DEBUG);
787     $lien = array('lien_demande_demandeur' => "",
788     'petitionnaire_principal' => (($principal)?"t":"f"),
789     'demande' => $this->valF['demande'],
790     'demandeur' => $id);
791     $lienAjout->ajouter($lien, $db, $DEBUG);
792     $lienAjout->__destruct();
793     }
794    
795     /**
796     * Fonction permettant de supprimer un lien
797     * entre la table demande et demandeur
798     **/
799     function deleteLinkDemandeDemandeur($id, $db, $DEBUG) {
800     // Suppression
801     $sql = "DELETE FROM ".DB_PREFIXE."lien_demande_demandeur ".
802     "WHERE demande=".$this->valF['demande'].
803     " AND demandeur=".$id;
804     // Execution de la requete de suppression de l'objet
805     $res = $db->query($sql);
806     // Logger
807     $this->f->addToLog("supprimer(): db->query(\"".$sql."\");", VERBOSE_MODE);
808     $this->f->isDatabaseError();
809    
810     }
811    
812 vpihour 1058 /*
813     * Teste si le lien entre une demande et un demandeur existe
814     * */
815 nhaye 838 function isLinkDemandeDemandeurExist($idDemandeur) {
816     $sql = "SELECT count(*)
817     FROM ".DB_PREFIXE."lien_demande_demandeur
818     WHERE demande = ".$this->valF['demande'].
819     "AND demandeur = ".$idDemandeur;
820     $count = $this->f->db->getOne($sql);
821     $this->f->addToLog("db->getone(\"".$sql."\");", VERBOSE_MODE);
822     $this->f->isDatabaseError($count);
823     if ($count === 0) {
824     return false;
825 nhaye 828 } else {
826 nhaye 838 return true;
827 nhaye 828 }
828 nhaye 838
829 nhaye 828 }
830    
831     /**
832     * Methode de recupération des valeurs postées
833     **/
834     function getPostedValues() {
835     // Récupération des demandeurs dans POST
836     if (isset($_POST['petitionnaire_principal']) OR
837     isset($_POST['delegataire']) OR
838     isset($_POST['petitionnaire'])) {
839     if( isset($_POST['petitionnaire_principal']) AND
840     !empty($_POST['petitionnaire_principal'])) {
841 nhaye 838 $this->postedIdDemandeur['petitionnaire_principal'] = $_POST['petitionnaire_principal'];
842 nhaye 807 }
843 nhaye 828 if( isset($_POST['delegataire']) AND
844     !empty($_POST['delegataire'])) {
845 nhaye 838 $this->postedIdDemandeur['delegataire'] = $_POST['delegataire'];
846 nhaye 828 }
847     if( isset($_POST['petitionnaire']) AND
848     !empty($_POST['petitionnaire'])) {
849 nhaye 838 $this->postedIdDemandeur['petitionnaire'] = $_POST['petitionnaire'];
850 nhaye 828 }
851 nhaye 807 }
852 vpihour 676 }
853 nhaye 828 /**
854 nhaye 1039 * Méthode permettant de récupérer les id des demandeur liés à la demande ou
855     * liés au dossier d'autorisation
856 nhaye 828 **/
857 nhaye 1039 function listeDemandeur($from, $id) {
858 nhaye 828 // Récupération des demandeurs de la base
859 nhaye 1406 if(isset($this->valF['demande_type']) AND $this->getCodeDemandeType($this->valF['demande_type']) != "DT") {
860 nhaye 1405 $sql = "SELECT demandeur.demandeur,
861     demandeur.type_demandeur,
862     lien_".$from."_demandeur.petitionnaire_principal
863     FROM ".DB_PREFIXE."lien_".$from."_demandeur
864     INNER JOIN ".DB_PREFIXE."demandeur
865     ON demandeur.demandeur=lien_".$from."_demandeur.demandeur
866     WHERE ".$from." = '".$id."'";
867     $res = $this->f->db->query($sql);
868     $this->f->addToLog("listeDemandeur() : ".$sql);
869     $this->f->isDatabaseError($res);
870     // Stoquage du résultat dans un tableau
871     while ($row=& $res->fetchRow(DB_FETCHMODE_ASSOC)){
872     if ($row['petitionnaire_principal'] == 't' AND
873     $row['type_demandeur']=="petitionnaire") {
874     $this->valIdDemandeur['petitionnaire_principal']=$row['demandeur'];
875     } elseif ($row['petitionnaire_principal'] == 'f' AND
876     $row['type_demandeur']=="petitionnaire"){
877     $this->valIdDemandeur['petitionnaire'][]=$row['demandeur'];
878     } elseif ($row['type_demandeur']=="delegataire"){
879     $this->valIdDemandeur['delegataire']=$row['demandeur'];
880     }
881 nhaye 828 }
882     }
883     }
884 nhaye 807
885 nhaye 1037
886 nhaye 807 /**
887 nhaye 1037 * Surcharge du bouton retour afin de retourner sur la recherche de dossiers
888     * d'instruction existant
889     */
890     function retour($premier = 0, $recherche = "", $tricol = "") {
891    
892     echo "\n<a class=\"retour\" ";
893     echo "href=\"";
894     //
895     if($this->getParameter("idx_dossier") != "") {
896     echo "tab.php?";
897     echo "obj=recherche_dossier";
898    
899     } else {
900     if($this->getParameter("retour")=="form" AND !($this->getParameter("validation")>0 AND $this->getParameter("maj")==2 AND $this->correct)) {
901     echo "form.php?";
902     } else {
903     echo "tab.php?";
904     }
905     echo "obj=".get_class($this);
906     if($this->getParameter("retour")=="form") {
907     echo "&amp;idx=".$this->getParameter("idx");
908     echo "&amp;action=3";
909     }
910     }
911     echo "&amp;premier=".$this->getParameter("premier");
912     echo "&amp;tricol=".$this->getParameter("tricol");
913     echo "&amp;recherche=".$this->getParameter("recherche");
914     echo "&amp;selectioncol=".$this->getParameter("selectioncol");
915     echo "&amp;advs_id=".$this->getParameter("advs_id");
916     echo "&amp;valide=".$this->getParameter("valide");
917     //
918     echo "\"";
919     echo ">";
920     //
921     echo _("Retour");
922     //
923     echo "</a>\n";
924    
925     }
926    
927    
928     /**
929 nhaye 807 * Ajout de la liste des demandeurs
930     */
931     function formSpecificContent($maj) {
932 nhaye 842 if(!$this->correct AND $maj != 0) {
933 nhaye 1039 $this->listeDemandeur("demande", $this->val[array_search('demande', $this->champs)]);
934 nhaye 838 }
935 nhaye 1039 // Si le paramètre idx_dossier est défini on récupère les demandeurs liés au dossier d'instruction
936     if($this->getParameter("idx_dossier") != "") {
937     $this->listeDemandeur("dossier", $this->getParameter("idx_dossier"));
938     }
939 nhaye 838 if($maj < 2 AND !$this->correct) {
940     $linkable = true;
941     } else {
942     $linkable = false;
943     }
944 nhaye 1020
945 nhaye 807 // Conteneur de la listes des demandeurs
946 nhaye 1097 echo "<div id=\"liste_demandeur\" class=\"demande_hidden_bloc col_12\">";
947 nhaye 807 echo "<fieldset class=\"cadre ui-corner-all ui-widget-content\">";
948     echo " <legend class=\"ui-corner-all ui-widget-content ui-state-active\">"
949     ._("Petitionnaire")."</legend>";
950     // Si des demandeurs sont liés à la demande
951 nhaye 828 require_once "../obj/petitionnaire.class.php";
952     require_once "../obj/delegataire.class.php";
953 nhaye 1097 // Affichage du bloc pétitionnaire principal / délégataire
954     // L'ID DU DIV SUIVANT EST NECESSAIRE AU BON FONCTIONNEMENT DU JS
955 nhaye 1118 echo "<div id=\"petitionnaire_principal_delegataire col_12\">";
956 nhaye 1097 // Affichage de la synthèse
957     if (isset ($this->valIdDemandeur["petitionnaire_principal"]) AND
958     !empty($this->valIdDemandeur["petitionnaire_principal"])) {
959     $demandeur = new petitionnaire(
960     $this->valIdDemandeur["petitionnaire_principal"],
961     $this->f->db,false);
962     $demandeur -> afficherSynthese("petitionnaire_principal", $linkable);
963     $demandeur -> __destruct();
964     } elseif ( isset ($this->postedIdDemandeur["petitionnaire_principal"]) AND
965     !empty($this->postedIdDemandeur["petitionnaire_principal"]) ) {
966     $demandeur = new petitionnaire(
967     $this->postedIdDemandeur["petitionnaire_principal"],
968     $this->f->db,false);
969     $demandeur -> afficherSynthese("petitionnaire_principal", $linkable);
970     $demandeur -> __destruct();
971     }
972     // Si en édition de formulaire
973     if($maj < 2) {
974     // Bouton d'ajout du pétitionnaire principal
975     // L'ID DE L'INPUT SUIVANT EST NECESSAIRE AU BON FONCTIONNEMENT DU JS
976     echo "<span id=\"add_petitionnaire_principal\"
977     class=\"om-form-button add-16\">".
978     _("Saisir le petitionnaire principal").
979     "</span>";
980     }
981     // Bouton d'ajout du delegataire
982     // L'ID DU DIV ET DE L'INPUT SUIVANT EST NECESSAIRE AU BON FONCTIONNEMENT DU JS
983     echo "<div id=\"delegataire\">";
984     // Affichage de la synthèse
985     if (isset ($this->valIdDemandeur["delegataire"]) AND
986     !empty($this->valIdDemandeur["delegataire"])) {
987     $demandeur = new delegataire($this->valIdDemandeur["delegataire"],
988     $this->f->db,false);
989     $demandeur -> afficherSynthese("delegataire", $linkable);
990     $demandeur -> __destruct();
991     } elseif ( isset ($this->postedIdDemandeur["delegataire"]) AND
992     !empty($this->postedIdDemandeur["delegataire"]) ) {
993 nhaye 807
994 nhaye 1097 $demandeur = new delegataire($this->postedIdDemandeur["delegataire"],
995     $this->f->db,false);
996     $demandeur -> afficherSynthese("delegataire", $linkable);
997     $demandeur -> __destruct();
998     }
999     if($maj < 2) {
1000     echo "<span id=\"add_delegataire\"
1001 vpihour 1075 class=\"om-form-button add-16\">".
1002 nhaye 1097 _("Saisir le delegataire").
1003 vpihour 1051 "</span>";
1004 nhaye 1097 }
1005     echo "</div>";
1006 nhaye 1118 echo "<div class=\"both\"></div>";
1007 nhaye 1097 echo "</div>";
1008     // Bloc des pétitionnaires secondaires
1009     // L'ID DU DIV SUIVANT EST NECESSAIRE AU BON FONCTIONNEMENT DU JS
1010 nhaye 1118 echo "<div id=\"listePetitionnaires col_12\">";
1011 fmichon 1005
1012 nhaye 1097 // Affichage de la synthèse
1013     if (isset ($this->valIdDemandeur["petitionnaire"]) AND
1014     !empty($this->valIdDemandeur["petitionnaire"])) {
1015    
1016     foreach ($this->valIdDemandeur["petitionnaire"] as $petitionnaire) {
1017     $demandeur = new petitionnaire($petitionnaire,
1018     $this->f->db,false);
1019     $demandeur -> afficherSynthese("petitionnaire", $linkable);
1020 nhaye 1065 $demandeur -> __destruct();
1021     }
1022    
1023 nhaye 1097 } elseif ( isset ($this->postedIdDemandeur["petitionnaire"]) AND
1024     !empty($this->postedIdDemandeur["petitionnaire"]) ) {
1025     foreach ($this->postedIdDemandeur["petitionnaire"] as $petitionnaire) {
1026     $demandeur = new petitionnaire($petitionnaire,
1027     $this->f->db,false);
1028     $demandeur -> afficherSynthese("petitionnaire", $linkable);
1029     $demandeur -> __destruct();
1030 nhaye 828 }
1031 nhaye 1097 }
1032     if ($maj < 2) {
1033     // L'ID DE L'INPUT SUIVANT EST NECESSAIRE AU BON FONCTIONNEMENT DU JS
1034     echo "<span id=\"add_petitionnaire\"
1035     class=\"om-form-button add-16\">".
1036     _("Ajouter un petitionnaire")
1037     ."</span>";
1038     }
1039     echo "</div>";
1040 nhaye 807 echo "</fieldset>";
1041     echo "</div>";
1042     }
1043    
1044 nhaye 1097 // {{{
1045    
1046     // getter
1047     function getValIdDemandeur() {
1048     return $this->valIdDemandeur;
1049     }
1050     // setter
1051     function setValIdDemandeur($valIdDemandeur) {
1052     $this->valIdDemandeur = $valIdDemandeur;
1053     }
1054 vpihour 1106
1055     //Supression du lien entre la demandeur et le(s) demandeur(s)
1056     function triggerSupprimer($id, &$db, $val, $DEBUG){
1057    
1058     //Création de la requête
1059     $sql = "DELETE FROM
1060     ".DB_PREFIXE."lien_demande_demandeur
1061     WHERE
1062     demande = $id";
1063    
1064     $res = $this->f->db->query($sql);
1065     $this->f->addToLog("triggerSupprimer() : ".$sql);
1066     $this->f->isDatabaseError($res);
1067     }
1068    
1069 nhaye 1097 // }}}
1070 vpihour 632 }// fin classe
1071 fmichon 1005 ?>

[email protected]
ViewVC Help
Powered by ViewVC 1.1.26