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

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

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1505 - (hide annotations)
Tue Mar 19 17:12:20 2013 UTC (11 years, 10 months ago) by fmichon
File size: 46390 byte(s)
Correction : si il n'y a aucune demande dans la table, alors une erreur de base de données se produisait puisque le cas de figure n'était pas pris en compte

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

[email protected]
ViewVC Help
Powered by ViewVC 1.1.26