/[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 908 by nhaye, Thu Nov 29 15:36:11 2012 UTC revision 1020 by nhaye, Fri Dec 7 15:17:11 2012 UTC
# Line 16  class demande extends demande_gen { Line 16  class demande extends demande_gen {
16      function demande($id,&$db,$debug) {      function demande($id,&$db,$debug) {
17          $this->constructeur($id,$db,$debug);          $this->constructeur($id,$db,$debug);
18      }// fin constructeur      }// fin constructeur
19    
20        function setValF($val) {
21            parent::setValF($val);
22            
23            // Récupération des id demandeurs postés
24            $this->getPostedValues();
25            //$this->valIdDemandeur=$this->postedIdDemandeur;
26        }
27    
28        /**
29         * Méthode permettant de récupérer les valeurs du dossier d'autorisation
30         * correspondant àla nouvelle demande
31         */
32        function getValFromDossierAutorisation($dossier_autorisation) {
33            include "../sql/pgsql/demande.form.inc.php";
34            $sql=str_replace("<idx>",$this->getParameter("idx_dossier"),
35                        $sql_infos_dossier_autorisation);
36            $res = $this->db->query($sql);
37            $this->addToLog("demande -> getValFromDossierAutorisation() : ".$sql);
38            $this->f->isDatabaseError();
39            $row = & $res->fetchRow(DB_FETCHMODE_ASSOC);
40            return $row;
41        }
42            
43       /*       /*
44      * 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 46  class demande extends demande_gen {
46      */      */
47      function setVal(&$form, $maj, $validation, &$db) {      function setVal(&$form, $maj, $validation, &$db) {
48          if($maj == 0) {          if($maj == 0) {
49               $form->setVal("date_demande",date('d/m/Y'));              $form->setVal("date_demande",date('d/m/Y'));
50    
51                // Récupération des valeurs du dossier d'autorisation correspondant
52                if($this->getParameter("idx_dossier") != "") {
53                    $val_autorisation = $this->getValFromDossierAutorisation(
54                                                $this->getParameter("idx_dossier"));
55                    foreach($val_autorisation as $champ => $value) {
56                        $form->setVal($champ,$value);
57                    }
58                }
59          }          }
60      }      }
61            
# Line 32  class demande extends demande_gen { Line 64  class demande extends demande_gen {
64       */       */
65      function verifier($val, &$db, $DEBUG) {      function verifier($val, &$db, $DEBUG) {
66          parent::verifier($val, $db, $DEBUG);          parent::verifier($val, $db, $DEBUG);
         $this->getPostedValues();  
67          if(!isset($this->postedIdDemandeur["petitionnaire_principal"]) OR          if(!isset($this->postedIdDemandeur["petitionnaire_principal"]) OR
68             empty($this->postedIdDemandeur["petitionnaire_principal"])) {             empty($this->postedIdDemandeur["petitionnaire_principal"])) {
69              $this->correct = false;              $this->correct = false;
70              $this->addToMessage("La saisie d'un petitionnaire principal est obligatoire.");              $this->addToMessage("La saisie d'un petitionnaire principal est obligatoire.");
             $this->valIdDemandeur=$this->postedIdDemandeur;  
71          }          }
72      }      }
73      /*      /*
# Line 93  class demande extends demande_gen { Line 123  class demande extends demande_gen {
123                    
124          $form->setType('dossier_instruction', 'hidden');          $form->setType('dossier_instruction', 'hidden');
125          $form->setType('dossier_autorisation', 'hidden');          $form->setType('dossier_autorisation', 'hidden');
126    
127            $form->setType('instruction_recepisse', 'hidden');
128            $form->setType('arrondissement', 'hidden');
129    
130            // Si il s'agit d'une demande sur dossier existant on desactive tous les champs
131            // sauf demande_type
132            if($maj == 0 AND $this-> getParameter("idx_dossier")) {
133                $form->setType('dossier_autorisation_type_detaille', 'selectdisabled');
134                $form->setType('terrain_references_cadastrales', 'textdisabled');
135                $form->setType('terrain_adresse_voie_numero', 'textdisabled');
136                $form->setType('complement', 'textdisabled');
137                $form->setType('terrain_adresse_lieu_dit', 'textdisabled');
138                $form->setType('terrain_adresse_localite', 'textdisabled');
139                $form->setType('terrain_adresse_code_postal', 'textdisabled');
140                $form->setType('terrain_adresse_bp', 'textdisabled');
141                $form->setType('terrain_adresse_cedex', 'textdisabled');
142                $form->setType('terrain_superficie', 'textdisabled');
143                $form->setType('nombre_lots', 'textdisabled');
144            }
145        }
146    
147        /**
148         * Méthode permettant d'ajouter un dossier d'autorisation
149         */
150        function ajoutDossierAutorisation($id, &$db, $val, $DEBUG){
151            require_once '../obj/dossier_autorisation.class.php';
152            $dossier_autorisation = new dossier_autorisation("]",$db,$DEBUG);
153            // Création du dossier
154            foreach($dossier_autorisation->champs as $value) {
155                $valAuto[$value] = NULL;
156            }
157            $valAuto['dossier_autorisation']=NULL;
158            $valAuto['nature']=NULL;
159            $valAuto['exercice']=NULL;
160            $valAuto['insee']=NULL;
161            $valAuto['arrondissement']=NULL;
162            $valAuto['etat']=NULL;
163            $valAuto['erp_numero_batiment']=NULL;
164            $valAuto['erp_ouvert']=NULL;
165            $valAuto['erp_arrete_decision']=NULL;
166            $valAuto['dossier_autorisation_type_detaille']=$this->valF['dossier_autorisation_type_detaille'];
167            $valAuto['depot_initial']=$this->valF['date_demande'];
168            $valAuto['terrain_references_cadastrales']=$this->valF['terrain_references_cadastrales'];
169            $valAuto['terrain_adresse_voie_numero']=$this->valF['terrain_adresse_voie_numero'];
170            $valAuto['complement']=$this->valF['complement'];
171            $valAuto['terrain_adresse_lieu_dit']=$this->valF['terrain_adresse_lieu_dit'];
172            $valAuto['terrain_adresse_localite']=$this->valF['terrain_adresse_localite'];
173            $valAuto['terrain_adresse_code_postal']=$this->valF['terrain_adresse_code_postal'];
174            $valAuto['terrain_adresse_bp']=$this->valF['terrain_adresse_bp'];
175            $valAuto['terrain_adresse_cedex']=$this->valF['terrain_adresse_cedex'];
176            $valAuto['terrain_superficie']=$this->valF['terrain_superficie'];
177            $valAuto['numero_version']=-1;
178            // Ajout du dossier dans la base
179            $dossier_autorisation->ajouter($valAuto, $db, $DEBUG);
180            // Liaison du dossier ajouter à la demande
181            $this->valF['dossier_autorisation'] = $dossier_autorisation->valF['dossier_autorisation'];
182        }
183    
184        /**
185         * Méthode permettant d'ajouter un dossier d'instruction
186         */
187        function ajoutDossierInstruction($id, &$db, $val, $DEBUG, $dossier_instruction_type){
188            require_once '../obj/dossier.class.php';
189            $dossier = new dossier("]",$db,$DEBUG);
190            foreach($dossier->champs as $value) {
191                $valInstr[$value] = NULL;
192            }
193            require_once '../obj/dossier_autorisation_type_detaille.class.php';
194            $datd = new dossier_autorisation_type_detaille(
195                    $this->valF['dossier_autorisation_type_detaille'],$db,$DEBUG);
196                    
197            /*Ajout de la variable dossier_instruction_type à l'objet dossier pour le
198             * versionning
199             */
200            $dossier->setDossierInstructionType($dossier_instruction_type);
201            
202            // Définition des valeurs à entrée dans la table
203            $valInstr['nature']=$datd->val[array_search("code", $datd->champs)];
204            $valInstr['dossier_autorisation_type_detaille']=$this->valF['dossier_autorisation_type_detaille'];
205            $valInstr['date_depot']=$this->dateDBToForm($this->valF['date_demande']);
206            $valInstr['depot_initial']=$this->dateDBToForm($this->valF['date_demande']);
207            $valInstr['terrain_references_cadastrales']=$this->valF['terrain_references_cadastrales'];
208            $valInstr['terrain_adresse_voie_numero']=$this->valF['terrain_adresse_voie_numero'];
209            $valInstr['complement']=$this->valF['complement'];
210            $valInstr['terrain_adresse_lieu_dit']=$this->valF['terrain_adresse_lieu_dit'];
211            $valInstr['terrain_adresse_localite']=$this->valF['terrain_adresse_localite'];
212            $valInstr['terrain_adresse_code_postal']=$this->valF['terrain_adresse_code_postal'];
213            $valInstr['terrain_adresse_bp']=$this->valF['terrain_adresse_bp'];
214            $valInstr['terrain_adresse_cedex']=$this->valF['terrain_adresse_cedex'];
215            $valInstr['terrain_superficie']=$this->valF['terrain_superficie'];
216            $valInstr['description']="";
217            $valInstr['dossier_autorisation']=$this->valF['dossier_autorisation'];
218            $dossier->ajouter($valInstr, $db, $DEBUG);
219            $this->f->isDatabaseError();
220            // Liaison du dossier ajouter à la demande
221            $this->valF['dossier_instruction'] = $dossier->valF['dossier'];
222        }
223    
224        /**
225         * Ajout des liens demandeurs / dossier d'autorisation
226         **/
227        function ajoutLiensDossierAutorisation($id, &$db, $val, $DEBUG) {
228            // Création des liens entre le dossier autorisation et les demandeurs
229            include '../sql/pgsql/demande.form.inc.php';
230            require_once '../obj/lien_dossier_autorisation_demandeur.class.php';
231            $ldad = new lien_dossier_autorisation_demandeur("]",$db,$DEBUG);
232            // Recupération des demandeurs liés à la demande
233            $sql = str_replace("<demande>",$this->valF['demande'],$sql_lien_demande_demandeur);
234            $res = $db->query($sql);
235            $this->f->addToLog("demande.class.php: db->query(\"".$sql."\");", VERBOSE_MODE);
236            $this->f->isDatabaseError();
237            while($row = &$res->fetchRow(DB_FETCHMODE_ASSOC)) {
238                $row['lien_dossier_autorisation_demandeur'] = NULL;
239                $row['dossier_autorisation'] = $this->valF['dossier_autorisation'];
240                $ldad->ajouter($row, $db, $DEBUG);
241            }
242      }      }
243    
244      /**      /**
245       * Méthode permettant la création de dossiers       * Ajout des liens demandeurs / dossier d'autorisation
246       **/       **/
247      function triggerAjoutDossier($id, &$db, $val, $DEBUG){      function ajoutLiensDossierInstruction($id, &$db, $val, $DEBUG) {
248            // Création des liens entre le dossier instruction et les demandeurs
249            include '../sql/pgsql/demande.form.inc.php';
250            require_once '../obj/lien_dossier_demandeur.class.php';
251            $ldd = new lien_dossier_demandeur("]",$db,$DEBUG);
252            // Recupération des demandeurs liés à la demande
253            $sql = str_replace("<demande>",$this->valF['demande'],$sql_lien_demande_demandeur);
254            $res = $db->query($sql);
255            $this->f->addToLog("demande.class.php: db->query(\"".$sql."\");", VERBOSE_MODE);
256            $this->f->isDatabaseError();
257            while($row = &$res->fetchRow(DB_FETCHMODE_ASSOC)) {
258                $row['lien_dossier_demandeur'] = NULL;
259                $row['dossier'] = $this->valF['dossier_instruction'];
260                $ldd->ajouter($row, $db, $DEBUG);
261            }
262        }
263    
264        /*
265         * Récupère l'identifiant d'un arrondissement à partir d'un code postal
266         */
267        function getArrondissement($terrain_adresse_code_postal){
268            
269            $arrondissement = NULL;
270            
271            $sql = "SELECT
272                        arrondissement
273                    FROM
274                        ".DB_PREFIXE."arrondissement
275                    WHERE
276                        code_postal = '$terrain_adresse_code_postal' ";
277            $this->addToLog("demande.class.php : ".$sql." execute <br>", EXTRA_VERBOSE_MODE);
278            
279            $res = $this->db->query($sql);
280            $this->f->isDatabaseError($res);
281            
282            if( $res->numrows() > 0 ) {
283                
284                $row=& $res->fetchRow(DB_FETCHMODE_ASSOC);
285                $arrondissement = $row['arrondissement'];
286            }
287            
288            return $arrondissement;
289        }
290        
291        /*
292         * Récupère l'évènement lié à un type de demande
293         */
294         function getEvenement($demande_type){
295            
296             $evenement = NULL;
297            
298             $sql =
299                "SELECT
300                    evenement
301                FROM
302                    ".DB_PREFIXE."demande_type
303                WHERE
304                    demande_type = $demande_type";
305                
306            $res = $this->db->query($sql);
307            $this->f->isDatabaseError($res);
308            
309            if ( $res->numrows() > 0 ){
310                    
311                $row=& $res->fetchRow(DB_FETCHMODE_ASSOC);
312                $evenement = $row['evenement'];
313            }
314            
315            return $evenement;
316         }
317        
318         /*
319         * Récupère la lettre type lié à un événement
320         */
321         function getLettreType($evenement){
322            
323             $lettretype = NULL;
324            
325             $sql =
326                "SELECT
327                    lettretype
328                FROM
329                    ".DB_PREFIXE."evenement
330                WHERE
331                    evenement = $evenement";
332                
333            $res = $this->db->query($sql);
334            $this->f->isDatabaseError($res);
335            
336            if ( $res->numrows() > 0 ){
337                    
338                $row=& $res->fetchRow(DB_FETCHMODE_ASSOC);
339                $lettretype = $row['lettretype'];
340            }
341            
342            return $lettretype;
343         }
344        
345        /**
346         * Ajout des dossiers
347         **/
348        function triggerAjouter($id, &$db, $val, $DEBUG){
349          include '../sql/pgsql/demande.form.inc.php';          include '../sql/pgsql/demande.form.inc.php';
350          if($this->valF["demande_type"] != NULL) {          if($this->valF["demande_type"] != NULL) {
351              $res = $db->query(str_replace('<idx>', $this->valF['demande_type'], $sql_demande_type_details_by_id));              $res = $db->query(str_replace('<idx>', $this->valF['demande_type'], $sql_demande_type_details_by_id));
352              $this->f->isDatabaseError();              $this->f->isDatabaseError();
353              $row = $res->fetchRow(DB_FETCHMODE_ASSOC);              $dossier_type = $res->fetchRow(DB_FETCHMODE_ASSOC);
354              // Création du dossier_autorisation              // Création du dossier_autorisation
355              if($row ['dossier_autorisation_type_detaille'] != NULL) {              if($dossier_type['dossier_autorisation_type_detaille'] != NULL) {
356                  // Création du dossier                  $this->ajoutDossierAutorisation($id, $db, $val, $DEBUG);
                 $valAuto['dossier_autorisation']=NULL;  
                 $valAuto['nature']=NULL;  
                 $valAuto['exercice']=NULL;  
                 $valAuto['insee']=NULL;  
                 $valAuto['arrondissement']=NULL;  
                 $valAuto['etat']=NULL;  
                 $valAuto['erp_numero_batiment']=NULL;  
                 $valAuto['erp_ouvert']=NULL;  
                 $valAuto['erp_arrete_decision']=NULL;  
                 $valAuto['dossier_autorisation_type_detaille']=$this->valF['dossier_autorisation_type_detaille'];  
                 $valAuto['depot_initial']=$this->valF['date_demande'];  
                 $valAuto['terrain_references_cadastrales']=$this->valF['terrain_references_cadastrales'];  
                 $valAuto['terrain_adresse_voie_numero']=$this->valF['terrain_adresse_voie_numero'];  
                 $valAuto['complement']=$this->valF['complement'];  
                 $valAuto['terrain_adresse_lieu_dit']=$this->valF['terrain_adresse_lieu_dit'];  
                 $valAuto['terrain_adresse_localite']=$this->valF['terrain_adresse_localite'];  
                 $valAuto['terrain_adresse_code_postal']=$this->valF['terrain_adresse_code_postal'];  
                 $valAuto['terrain_adresse_bp']=$this->valF['terrain_adresse_bp'];  
                 $valAuto['terrain_adresse_cedex']=$this->valF['terrain_adresse_cedex'];  
                 $valAuto['terrain_superficie']=$this->valF['terrain_superficie'];  
                 require_once '../obj/dossier_autorisation.class.php';  
                 $dossier_autorisation = new dossier_autorisation("]",$db,$DEBUG);  
                 $dossier_autorisation->ajouter($valAuto, $db, $DEBUG);  
                 $this->valF['dossier_autorisation'] = $dossier_autorisation->valF['dossier_autorisation'];  
                 // Création des liens entre le dossier et les demandeurs  
                 require_once '../obj/lien_dossier_autorisation_demandeur.class.php';  
                 $ldad = new lien_dossier_autorisation_demandeur("]",$db,$DEBUG);  
                 $sql = str_replace("<demande>",$this->valF['demande'],$sql_lien_demande_demandeur);  
                 $res = $db->query($sql);  
                 $this->f->addToLog("demande.class.php: db->query(\"".$sql."\");", VERBOSE_MODE);  
                 $this->f->isDatabaseError();  
                 while($row = &$res->fetchRow(DB_FETCHMODE_ASSOC)) {  
                     $row['lien_dossier_autorisation_demandeur'] = NULL;  
                     $row['dossier_autorisation'] = $this->valF['dossier_autorisation'];  
                     $ldad->ajouter($row, $db, $DEBUG);  
                 }  
357                  $this -> addToMessage(_("Creation du dossier d'autorisation no").$this->valF['dossier_autorisation']);                  $this -> addToMessage(_("Creation du dossier d'autorisation no").$this->valF['dossier_autorisation']);
358              }              }
359              /*              // Création du dossier d'instruction
360              if($row ['dossier_instruction_type'] != NULL) {              if($dossier_type['dossier_instruction_type'] != NULL) {
361                  $valInstr['dossier_autorisation_type_detaille']=$this->valF['dossier_autorisation_type_detaille'];                  $this->ajoutDossierInstruction($id, $db, $val, $DEBUG, $dossier_type['dossier_instruction_type']);
362                                    $this -> addToMessage(_("Creation du dossier d'instruction no").$this->valF['dossier_instruction']);
363                  $valInstr['depot_initial']=$this->valF['date_demande'];              }
364                  $valInstr['terrain_references_cadastrales']=$this->valF['terrain_references_cadastrales'];              
365                  $valInstr['terrain_adresse_voie_numero']=$this->valF['terrain_adresse_voie_numero'];              /*Création du lien de téléchargement de récépissé de demande*/
366                  $valInstr['complement']=$this->valF['complement'];              if ( $this->valF['demande_type'] != "" && is_numeric($this->valF['demande_type'])
367                  $valInstr['terrain_adresse_lieu_dit']=$this->valF['terrain_adresse_lieu_dit'];                  && isset($this->valF['dossier_instruction']) && $this->valF['dossier_instruction'] !== "" ){
368                  $valInstr['terrain_adresse_localite']=$this->valF['terrain_adresse_localite'];              
369                  $valInstr['terrain_adresse_code_postal']=$this->valF['terrain_adresse_code_postal'];                  /*Récupérer l'événement lié à ce type de demande*/
370                  $valInstr['terrain_adresse_bp']=$this->valF['terrain_adresse_bp'];                  $evenement = $this->getEvenement($this->valF['demande_type']);
371                  $valInstr['terrain_adresse_cedex']=$this->valF['terrain_adresse_cedex'];                                  
372                  $valInstr['terrain_superficie']=$this->valF['terrain_superficie'];                  /*Récupération de la lettre type de l'événement*/
373                    $lettretype = $this->getLettreType($evenement);
374                  require_once '../obj/dossier.class.php';                  
375                  $dossier_instruction = new dossier("]",$db,$DEBUG);                  /*Création d'une nouvelle instruction avec cet événement*/
376                  $dossier_instruction->ajouter($valInstr, $db, $DEBUG);                  /*Données*/
377                  $this->valF['dossier_instruction'] = $dossier_instruction->valF['dossier'];                  $valInstr['instruction']=NULL;
378                    
379                    $valInstr['destinataire']=$this->valF['dossier_instruction'];
380                    $valInstr['dossier']=$this->valF['dossier_instruction'];
381                    
382                    $valInstr['datecourrier']=date("d/m/Y");
383                    $valInstr['evenement']=$evenement;
384                    $valInstr['lettretype']=$lettretype;
385                    $valInstr['complement']="";
386                    $valInstr['complement2']="";
387                    
388                    $valInstr['action']="initialisation";
389                    $valInstr['delai']="2";
390                    $valInstr['etat']="notifier";
391                    $valInstr['accord_tacite']="Oui";
392                    $valInstr['delai_notification']="1";
393                    $valInstr['archive_delai']="0";
394                    $valInstr['archive_date_complet']=NULL;
395                    $valInstr['archive_date_rejet']=NULL;
396                    $valInstr['archive_date_limite']=NULL;
397                    $valInstr['archive_date_notification_delai']=NULL;
398                    $valInstr['archive_accord_tacite']="Non";
399                    $valInstr['archive_etat']="initialiser";
400                    $valInstr['archive_date_decision']=NULL;
401                    $valInstr['archive_avis']="";
402                    $valInstr['archive_date_validite']=NULL;
403                    $valInstr['archive_date_achevement']=NULL;
404                    $valInstr['archive_date_chantier']=NULL;
405                    $valInstr['archive_date_conformite']=NULL;
406                    $valInstr['complement3']="";
407                    $valInstr['complement4']="";
408                    $valInstr['complement5']="";
409                    $valInstr['complement6']="";
410                    $valInstr['complement7']="";
411                    $valInstr['complement8']="";
412                    $valInstr['complement9']="";
413                    $valInstr['complement10']="";
414                    $valInstr['complement11']="";
415                    $valInstr['complement12']="";
416                    $valInstr['complement13']="";
417                    $valInstr['complement14']="";
418                    $valInstr['complement15']="";
419                    $valInstr['avis_decision']=NULL;
420                                    
421                    /*Fichier requis*/
422                    require_once '../obj/instruction.class.php';
423                    
424                    /*Création d'un nouveau dossier*/
425                    $instruction = new instruction("]",$db,$DEBUG);
426                    $instruction->valF = "";
427                    $instruction->ajouter($valInstr, $db, $DEBUG);
428                    if ( $instruction->valF['instruction'] != "" ){
429                        
430                        $this->valF['instruction_recepisse'] = $instruction->valF['instruction'];
431                        $this -> addToMessage("<br/><a
432                            class='lien'
433                            href='../pdf/pdflettretype.php?obj=".$lettretype."&amp;idx=".$this->valF['dossier_instruction']."'>
434                                <span
435                                class=\"om-icon om-icon-16 om-icon-fix pdf-16\"
436                                title=\""._("Telecharger le recepisse de la demande")."\">".
437                                    _("Telecharger le recepisse de la demande").
438                                "</span>
439                                &nbsp;&nbsp;&nbsp;&nbsp;".
440                                _("Telecharger le recepisse de la demande")."
441                            </a></br>");
442                    }
443                    else {
444                        
445                        $this -> addToMessage(_("Une erreur s'est produite lors de la creation du recepisse"));
446                    }
447                }
448    
449                /*Ajout de l'arrondissement à partir du code postal*/
450                if ( !is_null($this->valF["terrain_adresse_code_postal"]) && is_numeric($this->valF["terrain_adresse_code_postal"]) ){
451                    
452                    $this->valF["arrondissement"] = $this->getArrondissement($this->valF["terrain_adresse_code_postal"]);
453              }              }
             */  
454          }          }
455      }      }
456    
# Line 174  class demande extends demande_gen { Line 459  class demande extends demande_gen {
459       **/       **/
460      function triggerAjouterApres($id, &$db, $val, $DEBUG){      function triggerAjouterApres($id, &$db, $val, $DEBUG){
461          $this->insertLinkDemandeDemandeur($db, $DEBUG);          $this->insertLinkDemandeDemandeur($db, $DEBUG);
462          $this->valIdDemandeur=$this->postedIdDemandeur;          
463          $this->triggerAjoutDossier($id, $db, $val, $DEBUG);          // Ajout des lliens entre dossier_autorisation et demandeur
464            if(!empty($this->valF['dossier_autorisation'])) {
465                $this->ajoutLiensDossierAutorisation($id, $db, $val, $DEBUG);
466            }
467            // Ajout des lliens entre dossier et demandeur
468            if(!empty($this->valF['dossier_instruction'])) {
469                $this->ajoutLiensDossierInstruction($id, $db, $val, $DEBUG);
470            }
471      }      }
472      function triggerModifierApres($id, &$db, $val, $DEBUG){      function triggerModifierApres($id, &$db, $val, $DEBUG){
473          $this->listeDemandeur();          $this->listeDemandeur();
# Line 190  class demande extends demande_gen { Line 482  class demande extends demande_gen {
482      function insertLinkDemandeDemandeur($db, $DEBUG) {      function insertLinkDemandeDemandeur($db, $DEBUG) {
483          //          //
484          require_once "../obj/lien_demande_demandeur.class.php";          require_once "../obj/lien_demande_demandeur.class.php";
   
485          // Comparaison de l'id petitionnaire principal          // Comparaison de l'id petitionnaire principal
486          if(isset($this->postedIdDemandeur['petitionnaire_principal']) AND          if(isset($this->postedIdDemandeur['petitionnaire_principal']) AND
487             !empty($this->postedIdDemandeur['petitionnaire_principal']) AND             !empty($this->postedIdDemandeur['petitionnaire_principal']) AND
# Line 346  class demande extends demande_gen { Line 637  class demande extends demande_gen {
637          } else {          } else {
638              $linkable = false;              $linkable = false;
639          }          }
640    
641          // Conteneur de la listes des demandeurs          // Conteneur de la listes des demandeurs
642          echo "<div class=\"demande_hidden_bloc col_12\">";          echo "<div class=\"demande_hidden_bloc col_12\">";
643          echo "<fieldset class=\"cadre ui-corner-all ui-widget-content\">";          echo "<fieldset class=\"cadre ui-corner-all ui-widget-content\">";
# Line 366  class demande extends demande_gen { Line 658  class demande extends demande_gen {
658                                      $this->f->db,false);                                      $this->f->db,false);
659                  $demandeur -> afficherSynthese("petitionnaire_principal", $linkable);                  $demandeur -> afficherSynthese("petitionnaire_principal", $linkable);
660                  $demandeur -> __destruct();                  $demandeur -> __destruct();
661                } else {
662                    $demandeur = new petitionnaire(
663                                        $this->postedIdDemandeur["petitionnaire_principal"],
664                                        $this->f->db,false);
665                    $demandeur -> afficherSynthese("petitionnaire_principal", $linkable);
666                    $demandeur -> __destruct();
667              }              }
668              // Si en édition de formulaire              // Si en édition de formulaire
669              if($maj < 2 AND $this->correct != true) {              if($maj < 2 AND $this->correct != true) {
# Line 374  class demande extends demande_gen { Line 672  class demande extends demande_gen {
672                  echo "<input id=\"add_petitionnaire_principal\"                  echo "<input id=\"add_petitionnaire_principal\"
673                      class=\"ui-button ui-widget ui-state-default ui-corner-all\"                      class=\"ui-button ui-widget ui-state-default ui-corner-all\"
674                      type=\"button\" value=\""._("Saisir le petitionnaire principal")."\"/>";                      type=\"button\" value=\""._("Saisir le petitionnaire principal")."\"/>";
                 echo " <span class=\"om-icon om-icon-16 om-icon-fix arrow-right-16\">></span> ";  
675                  // Bouton d'ajout du delegataire                  // Bouton d'ajout du delegataire
676                  // L'ID DE L'INPUT SUIVANT EST NECESSAIRE AU BON FONCTIONNEMENT DU JS                  // L'ID DU DIV ET DE L'INPUT SUIVANT EST NECESSAIRE AU BON FONCTIONNEMENT DU JS
677                    echo "<div id=\"delegataire\">";
678                    echo " <span class=\"om-icon om-icon-16 om-icon-fix arrow-right-16\">></span> ";
679    
680                    // Affichage de la synthèse
681                    if (isset ($this->valIdDemandeur["delegataire"]) AND
682                        !empty($this->valIdDemandeur["delegataire"])) {
683                        $demandeur = new delegataire($this->valIdDemandeur["delegataire"],
684                                                   $this->f->db,false);
685                        $demandeur -> afficherSynthese("delegataire", $linkable);
686                        $demandeur -> __destruct();
687                    } else {
688                        $demandeur = new delegataire($this->postedIdDemandeur["delegataire"],
689                                                   $this->f->db,false);
690                        $demandeur -> afficherSynthese("delegataire", $linkable);
691                        $demandeur -> __destruct();
692                    }
693                  echo "<input id=\"add_delegataire\"                  echo "<input id=\"add_delegataire\"
694                      class=\"ui-button ui-widget ui-state-default ui-corner-all\"                      class=\"ui-button ui-widget ui-state-default ui-corner-all\"
695                      type=\"button\" value=\""._("Saisir le delegataire")."\"/>";                      type=\"button\" value=\""._("Saisir le delegataire")."\"/>";
696                    echo "</div>";
697              }              }
             // Affichage de la synthèse  
             if (isset ($this->valIdDemandeur["delegataire"]) AND  
                 !empty($this->valIdDemandeur["delegataire"])) {  
                 $demandeur = new delegataire($this->valIdDemandeur["delegataire"],  
                                            $this->f->db,false);  
                 $demandeur -> afficherSynthese("delegataire", $linkable);  
                 $demandeur -> __destruct();  
             }  
               
698              echo "</div>";              echo "</div>";
   
699              // Bloc des pétitionnaires secondaires              // Bloc des pétitionnaires secondaires
700              // L'ID DU DIV SUIVANT EST NECESSAIRE AU BON FONCTIONNEMENT DU JS              // L'ID DU DIV SUIVANT EST NECESSAIRE AU BON FONCTIONNEMENT DU JS
701              echo "<div id=\"listePetitionnaires\">";              echo "<div id=\"listePetitionnaires\">";
# Line 407  class demande extends demande_gen { Line 711  class demande extends demande_gen {
711                      $demandeur -> __destruct();                      $demandeur -> __destruct();
712                  }                  }
713                                    
714                } else {
715                    foreach ($this->postedIdDemandeur["petitionnaire"] as $petitionnaire) {
716                        $demandeur = new petitionnaire($petitionnaire,
717                                               $this->f->db,false);
718                        $demandeur -> afficherSynthese("petitionnaire", $linkable);
719                        $demandeur -> __destruct();
720                    }
721              }              }
722              if ($maj < 2 AND !$this->correct) {              if ($maj < 2 AND !$this->correct) {
723                  // 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
# Line 420  class demande extends demande_gen { Line 731  class demande extends demande_gen {
731      }      }
732    
733  }// fin classe  }// fin classe
 ?>  
734    ?>

Legend:
Removed from v.908  
changed lines
  Added in v.1020

[email protected]
ViewVC Help
Powered by ViewVC 1.1.26