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

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

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1442 - (hide annotations)
Fri Mar 15 15:08:29 2013 UTC (11 years, 10 months ago) by nhaye
File size: 46314 byte(s)
Modification du libellé de l'adresse

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

[email protected]
ViewVC Help
Powered by ViewVC 1.1.26