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

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

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1571 - (hide annotations)
Thu Mar 28 12:22:00 2013 UTC (11 years, 10 months ago) by nhaye
File size: 46542 byte(s)
Ajout du champ date_dernier_depot à la table dossier + régénération
Ajouter un champ regle_date_dernier_depot à la table action,
Ajouter un champ archive_date_dernier_depot à la table instruction,
reproduire le fonctionnement de la gestion de la date de complétude.
La date de dernier dépôt = date demande lors du dépôt initial.

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

[email protected]
ViewVC Help
Powered by ViewVC 1.1.26