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

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

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

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

Legend:
Removed from v.927  
changed lines
  Added in v.1595

[email protected]
ViewVC Help
Powered by ViewVC 1.1.26