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

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

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

revision 1282 by vpihour, Thu Feb 21 17:48:26 2013 UTC revision 1439 by nhaye, Fri Mar 15 14:45:21 2013 UTC
# Line 166  class instruction extends instruction_ge Line 166  class instruction extends instruction_ge
166              $form->setType('bible_auto', 'httpclick');              $form->setType('bible_auto', 'httpclick');
167              $form->setType('bible', 'httpclick');              $form->setType('bible', 'httpclick');
168              $form->setType('bible2', 'httpclick');              $form->setType('bible2', 'httpclick');
169              $form->setType('dossier', 'hiddenstatic');                $form->setType('dossier', 'hidden');  
170              $form->setType('libelle', 'hiddenstatic');              $form->setType('libelle', 'hiddenstatic');
171              $form->setType('signataire_arrete','select');              $form->setType('signataire_arrete','select');
172              if($maj==0){ // add              if($maj==0){ // add
# Line 182  class instruction extends instruction_ge Line 182  class instruction extends instruction_ge
182                  $form->setType('delai', 'hiddenstatic');                  $form->setType('delai', 'hiddenstatic');
183              }              }
184          } elseif($maj==2){          } elseif($maj==2){
185              $form->setType('dossier', 'hiddenstatic');              $form->setType('dossier', 'hidden');
186              $form->setType('bible_auto', 'hidden');              $form->setType('bible_auto', 'hidden');
187              $form->setType('bible', 'hidden');              $form->setType('bible', 'hidden');
188              $form->setType('bible2', 'hidden');              $form->setType('bible2', 'hidden');
189          }else {          }else {
190              $form->setType('destinataire', 'hidden');              $form->setType('destinataire', 'hidden');
191              $form->setType('dossier', 'static');              $form->setType('dossier', 'hidden');
192              $form->setType('bible_auto', 'hidden');              $form->setType('bible_auto', 'hidden');
193              $form->setType('bible', 'hidden');              $form->setType('bible', 'hidden');
194              $form->setType('bible2', 'hidden');              $form->setType('bible2', 'hidden');
# Line 238  class instruction extends instruction_ge Line 238  class instruction extends instruction_ge
238          $form->setType('archive_date_achevement', 'hidden');          $form->setType('archive_date_achevement', 'hidden');
239          $form->setType('archive_date_conformite', 'hidden');          $form->setType('archive_date_conformite', 'hidden');
240          $form->setType('archive_date_chantier', 'hidden');            $form->setType('archive_date_chantier', 'hidden');  
241            $form->setType('numero_arrete', 'hidden');
242      }      }
243            
244      /*Met des valeurs choisies dans certains select du formulaire*/      /*Met des valeurs choisies dans certains select du formulaire*/
# Line 305  class instruction extends instruction_ge Line 306  class instruction extends instruction_ge
306          $form->setSelect("bible2",$contenu);          $form->setSelect("bible2",$contenu);
307      } // function select      } // function select
308    
309      function setGroupe(&$form,$maj){      function setLayout(&$form, $maj){
310          $form->setGroupe('evenement','D');          if ( $maj < 2 OR $maj == 3 ) {
311          $form->setGroupe('libelle','G');                          /*Champ sur lequel s'ouvre le bloc 1 */
312          $form->setGroupe('date_evenement','G');              $form->setBloc('evenement','D',"","col_12");
313          $form->setGroupe('lettretype','F');  
314      }                  $form->setFieldset('evenement','D',_('Evenement'));
315                        $form->setBloc('evenement','D',"","group col_12");
316      function setRegroupe(&$form,$maj){                            $form->setBloc('date_evenement','F');
317          $form->setRegroupe('evenement','D',_('evenement'), "collapsible");                  $form->setFieldset('lettretype','F','');
318          $form->setRegroupe('libelle','G','');              
319          $form->setRegroupe('date_evenement','G','');              $form->setBloc('lettretype','F');
320          $form->setRegroupe('lettretype','F','');  
321          $form->setRegroupe('complement','D',_('complement'), "collapsible");              $form->setBloc('date_finalisation_courrier','D',"","col_12");
322          $form->setRegroupe('bible_auto','G','');  
323          $form->setRegroupe('bible','F','');                  $form->setFieldset('date_finalisation_courrier','D',_('Dates'));
324          $form->setRegroupe('complement2','D',_('complement2'), "startClosed");                      $form->setBloc('date_finalisation_courrier','D',"","col_6");
325          $form->setRegroupe('bible2','F','');                      $form->setBloc('date_envoi_controle_legalite','F');
326    
327                        $form->setBloc('signataire_arrete','D',"","col_6");
328                        $form->setBloc('date_retour_controle_legalite','F');
329                    $form->setFieldset('date_retour_controle_legalite','F','');
330                
331                $form->setBloc('date_retour_controle_legalite','F');
332    
333                $form->setBloc('complement','D',"","col_12");
334                    $form->setFieldset('complement','D',_('Complement'));
335                    $form->setFieldset('bible','F','');
336                $form->setBloc('bible','F');
337    
338                $form->setBloc('complement2','D',"","col_12");
339                    $form->setFieldset('complement2','D',_('Complement 2'));
340                    $form->setFieldset('bible2','F','');
341                $form->setBloc('bible2','F');
342            }
343      }      }
344            
345      /*Change le libellé de certains champs*/      /*Change le libellé de certains champs*/
# Line 331  class instruction extends instruction_ge Line 349  class instruction extends instruction_ge
349          $form->setLib('bible_auto',"");          $form->setLib('bible_auto',"");
350          $form->setLib('bible',"");          $form->setLib('bible',"");
351          $form->setLib('bible2',"");          $form->setLib('bible2',"");
         $form->setLib('lettretype',"->"._(" courrier "));  
         $form->setLib('date_evenement',_(" du "));  
352      }      }
353    
354      // ==================================================================      // ==================================================================
# Line 536  class instruction extends instruction_ge Line 552  class instruction extends instruction_ge
552          // voir parametrage des actions en dur          // voir parametrage des actions en dur
553          $param=1;          $param=1;
554          if($param==1){          if($param==1){
555          $sql="select * from ".DB_PREFIXE."action where action = '".$this->valF['action']."'";              $sql="select * from ".DB_PREFIXE."action where action = '".$this->valF['action']."'";
556          $res = $db->query($sql);              $res = $db->query($sql);
557          if (database::isError($res))              if (database::isError($res))
558              die($res->getMessage());                  die($res->getMessage());
559          while ($row=& $res->fetchRow(DB_FETCHMODE_ASSOC)){              while ($row=& $res->fetchRow(DB_FETCHMODE_ASSOC)){
560              if($row['regle_etat']!=''){                  if($row['regle_etat']!=''){
561                  $valF['etat']= $this->regle($row['regle_etat']);                      $valF['etat']= $this->regle($row['regle_etat']);
562              }                  }
563              if($row['regle_delai']!=''){                  if($row['regle_delai']!=''){
564                  $valF['delai']= $this->regle($row['regle_delai']);                      $valF['delai']= $this->regle($row['regle_delai']);
565              }                  }
566              if($row['regle_accord_tacite']!=''){                  if($row['regle_accord_tacite']!=''){
567                  $valF['accord_tacite']= $this->regle($row['regle_accord_tacite']);                      $valF['accord_tacite']= $this->regle($row['regle_accord_tacite']);
568              }                  }
569              if($row['regle_avis']!=''){                  if($row['regle_avis']!=''){
570                  $valF['avis_decision']= $this->regle($row['regle_avis']);                      $valF['avis_decision']= $this->regle($row['regle_avis']);
571              }                  }
572              if($row['regle_date_limite']!=''){                  if($row['regle_date_limite']!=''){
573                  $valF['date_limite']= $this->regle($row['regle_date_limite']);                      $valF['date_limite']= $this->regle($row['regle_date_limite']);
574              }                  }
575              if($row['regle_date_complet']!=''){                  if($row['regle_date_complet']!=''){
576                  $valF['date_complet']= $this->regle($row['regle_date_complet']);                      $valF['date_complet']= $this->regle($row['regle_date_complet']);
577              }                  }
578              if($row['regle_date_notification_delai']!=''){                  if($row['regle_date_notification_delai']!=''){
579                  $valF['date_notification_delai']= $this->regle($row['regle_date_notification_delai']);                      $valF['date_notification_delai']= $this->regle($row['regle_date_notification_delai']);
580              }                  }
581              if($row['regle_date_decision']!=''){                  if($row['regle_date_decision']!=''){
582                  $valF['date_decision']= $this->regle($row['regle_date_decision']);                      $valF['date_decision']= $this->regle($row['regle_date_decision']);
583              }                  }
584              if($row['regle_date_rejet']!=''){                  if($row['regle_date_rejet']!=''){
585                  $valF['date_rejet']= $this->regle($row['regle_date_rejet']);                      $valF['date_rejet']= $this->regle($row['regle_date_rejet']);
586              }                  }
587             if($row['regle_date_validite']!=''){                 if($row['regle_date_validite']!=''){
588                  $valF['date_validite']= $this->regle($row['regle_date_validite']);                      $valF['date_validite']= $this->regle($row['regle_date_validite']);
589              }                  }
590             if($row['regle_date_chantier']!=''){                 if($row['regle_date_chantier']!=''){
591                  $valF['date_chantier']= $this->regle($row['regle_date_chantier']);                      $valF['date_chantier']= $this->regle($row['regle_date_chantier']);
592              }                  }
593             if($row['regle_date_achevement']!=''){                 if($row['regle_date_achevement']!=''){
594                  $valF['date_achevement']= $this->regle($row['regle_date_achevement']);                      $valF['date_achevement']= $this->regle($row['regle_date_achevement']);
595              }                  }
596             if($row['regle_date_conformite']!=''){                 if($row['regle_date_conformite']!=''){
597                  $valF['date_conformite']= $this->regle($row['regle_date_conformite']);                      $valF['date_conformite']= $this->regle($row['regle_date_conformite']);
598                    }
599                  
600                   // Appel des méthode stockées dans le champ methode_trigger
601                   if($row['methode_trigger'] != "") {
602                       foreach (explode(";", $row['methode_trigger']) as $methode) {
603                           if(method_exists($this, $methode)) {
604                               $this->$methode();
605                           }
606                          
607                       }
608                   }
609              }              }
         }  
610          }else{          }else{
611              switch ($this->valF['action']) {              switch ($this->valF['action']) {
612              case "initialisation" :              case "initialisation" :
# Line 808  class instruction extends instruction_ge Line 834  class instruction extends instruction_ge
834              $db->affectedRows()." "._('enregistrement').              $db->affectedRows()." "._('enregistrement').
835              " "._('mis_a_jour')."]" ;              " "._('mis_a_jour')."]" ;
836          }          }
837    
838            // Envoi des infos au
839            if ($this->valF['date_retour_signature'] != $this->getVal('date_retour_signature')) {
840                $msgenque = new MessageEnqueuer();
841                $sqlArrete = "SELECT instruction.signataire_arrete as \"ws_DA_In_Signataire\",
842                                    signataire_arrete.nom as \"ws_DA_In_Sign_Nom\",
843                                    signataire_arrete.prenom as \"ws_DA_In_Sign_Prenom\",
844                                    signataire_arrete.qualite as \"ws_DA_In_Sign_Qualite\",
845                                    instruction.date_evenement as \"ws_DA_In_Dte_Redac\",
846                                    '' as \"ws_DA_In_lieu_Redac\",
847                                    instruction.dossier as \"ws_DA_In_N_Doss_DAS\",
848                                    '' as \"ws_DA_In_Sigle\",
849                                    instruction.etat as \"ws_DA_In_Decision\",
850                                    dossier.date_depot as \"ws_DA_In_Dte_Depot_Dem\",
851                                    dossier.terrain_numero as \"ws_DA_In_N_Voie\",
852                                    '' as \"ws_DA_In_Type_Voie\",
853                                    dossier.complement as \"ws_DA_In_Adresse1\",
854                                    dossier.terrain_adresse_lieu_dit as \"ws_DA_In_Adresse2\",
855                                    dossier.terrain_adresse_code_postal as \"ws_DA_In_CP\",
856                                    dossier.terrain_adresse_localite as \"ws_DA_In_Ville\",
857                                    dossier.terrain_references_cadastrales as \"ws_DA_In_Nb_Parcelle\",
858                                    '' as \"ws_DA_In_Detail_Parcelle\",
859                                    CONCAT(donnees_techniques.am_projet_desc,' ',donnees_techniques.co_projet_desc) as \"ws_DA_In_Nature_Trvx\",
860                                    '' as \"ws_DA_In_Destination_Trvx\",
861                                    dossier_autorisation_type_detaille.code as \"ws_DA_In_Type_Dos_Autoris\",
862                                    COALESCE(particulier_nom,personne_morale_raison_sociale) as \"ws_DA_In_Nom_Petition\",
863                                    COALESCE(particulier_prenom, personne_morale_denomination) as \"ws_DA_In_Prenom_Petition\",
864                                    '' as \"ws_DA_In_Piece_GED\",
865                                    instruction.date_retour_signature as \"ws_DA_In_Dte_Signature\"
866                            FROM ".DB_PREFIXE."instruction
867                            LEFT JOIN ".DB_PREFIXE."signataire_arrete ON
868                                instruction.signataire_arrete = signataire_arrete.signataire_arrete
869                            LEFT JOIN ".DB_PREFIXE."dossier ON
870                                instruction.dossier = dossier.dossier
871                            LEFT JOIN ".DB_PREFIXE."lien_dossier_demandeur ON
872                                lien_dossier_demandeur.dossier = dossier.dossier
873                            LEFT JOIN ".DB_PREFIXE."demandeur ON
874                                lien_dossier_demandeur.demandeur = demandeur.demandeur
875                            LEFT JOIN ".DB_PREFIXE."dossier_instruction_type ON
876                                dossier.dossier_instruction_type = dossier_instruction_type.dossier_instruction_type
877                            LEFT JOIN ".DB_PREFIXE."dossier_autorisation_type_detaille ON
878                                dossier_instruction_type.dossier_autorisation_type_detaille =
879                                    dossier_autorisation_type_detaille.dossier_autorisation_type_detaille
880                            LEFT JOIN ".DB_PREFIXE."donnees_techniques ON
881                                    donnees_techniques.dossier_instruction = dossier.dossier
882                            WHERE instruction.instruction = ".$this->valF['instruction'];
883                $resArrete = $this->db->query($sqlArrete);
884                $this->f->addToLog("triggerModifierApres(): db->query(\"".$sqlArrete."\");", VERBOSE_MODE);
885                $this->f->isDatabaseError();
886    
887                $rowArrete = $resArrete->fetchRow(DB_FETCHMODE_ASSOC);
888                $msgenque->setArreteInfo($rowArrete);
889                $msgenque->enqueueMessage($msgenque::$ARRETE_ENVOI);                
890            }
891      }      }
892    
893    
# Line 938  class instruction extends instruction_ge Line 1018  class instruction extends instruction_ge
1018      /**      /**
1019       * Méthode permettant de mettre à jour l'état d'un DA       * Méthode permettant de mettre à jour l'état d'un DA
1020       */       */
1021       function majEtatDA($dossier_autorisation, $action, $avis_decision) {      function majEtatDA() {
1022                    if($this->valF['action'] == 'accepter' AND $this->valF['avis_decision'] == 8) {
1023       }              $val['etat_dossier_autorisation']=5;
1024            } elseif($this->valF['action'] == 'accepter' AND $this->valF['avis_decision'] == 15) {
1025                $val['etat_dossier_autorisation']=3;
1026            } elseif($this->valF['action'] == 'accepter') {
1027                $val['etat_dossier_autorisation']=2;
1028            } elseif($this->valF['action'] == 'rejeter') {
1029                $val['etat_dossier_autorisation']=4;
1030            } elseif($this->valF['action'] == 'terminer') {
1031                $val['etat_dossier_autorisation']=8;
1032            } elseif($this->valF['action'] == 'majorer') {
1033                $val['etat_dossier_autorisation']=6;
1034            } else {
1035                $val['etat_dossier_autorisation']=7;
1036            }
1037            
1038            //Récupération du numéro de dossier d'autorisation lié au dossier d'instruction
1039            $IDdossier_autorisation = $this->getDossierAutorisation($this->valF['dossier']);
1040          
1041            // Mis à jour de l'état du dossier d'autorisation
1042            require_once '../obj/dossier_autorisation.class.php';
1043            $dossier_autorisation = new dossier_autorisation($IDdossier_autorisation,$this->db,DEBUG);
1044            
1045            $dossier_autorisation->val[array_search("etat_dossier_autorisation", $dossier_autorisation->champs)] = $val['etat_dossier_autorisation'];
1046            
1047            //Récupération des données
1048            $valDossierAutorisation = array();
1049            for ( $i=0 ; $i<count($dossier_autorisation->champs); $i++){
1050                
1051                $valDossierAutorisation[$dossier_autorisation->champs[$i]]=
1052                    $dossier_autorisation->val[$i];
1053            }
1054    
1055            $dossier_autorisation->modifier($valDossierAutorisation, $this->db, DEBUG);
1056        }
1057            
1058      /**     /**
1059       * Méthode permettant de mettre à jour les données d'un DA      * Méthode permettant de mettre à jour les données d'un DA
1060       */      */
1061       function majDataDA($dossier_autorisation, $valDI) {      function majDataDA() {
1062                    
1063       }          //Récupération du numéro de dossier d'autorisation lié au dossier d'instruction
1064            $IDdossier_autorisation = $this->getDossierAutorisation($this->valF['dossier']);
1065            require_once '../obj/dossier_autorisation.class.php';
1066            $dossier_autorisation = new dossier_autorisation($IDdossier_autorisation,$this->db,DEBUG);
1067            
1068            require_once '../obj/dossier.class.php';
1069            $dossier = new dossier($this->valF['dossier'],$this->db,DEBUG);
1070            
1071            //Récupération des données
1072            $valDossierAutorisation = array();
1073            for ( $i=0 ; $i<count($dossier_autorisation->champs); $i++){
1074                
1075                if ( array_search($dossier_autorisation->champs[$i], $dossier->champs) ){
1076                    
1077                    $valDossierAutorisation[$dossier_autorisation->champs[$i]]=$dossier->getVal($dossier_autorisation->champs[$i]);
1078                }
1079                else {
1080                    $valDossierAutorisation[$dossier_autorisation->champs[$i]]=
1081                    $dossier_autorisation->val[$i];
1082                }
1083            }
1084    
1085            $dossier_autorisation->modifier($valDossierAutorisation, $this->db, DEBUG);
1086            
1087            // Suppression du liens entre les lots et le DA
1088            $valLot['dossier_autorisation'] = NULL;
1089            $this->db->autoExecute(DB_PREFIXE."lot", $valLot, DB_AUTOQUERY_UPDATE, "dossier_autorisation='".$IDdossier_autorisation."'");
1090            
1091            // Liaison des lots du DI avec le DA
1092            $sqlLot = "SELECT lot FROM ".DB_PREFIXE."lien_dossier_lot WHERE dossier='".$this->valF['dossier']."'";
1093            $res = $this->db->query($sqlLot);
1094            $this->addToLog($sqlLot);
1095            $this->f->isDatabaseError();
1096            while($rowLot = $res->fetchRow(DB_FETCHMODE_ASSOC)) {
1097                $valLot['dossier_autorisation'] = $IDdossier_autorisation;
1098                $this->db->autoExecute(DB_PREFIXE."lot", $valLot, DB_AUTOQUERY_UPDATE, "lot=".$rowLot['lot']);
1099            }
1100        }
1101        
1102        // Récupération de l'identifiant du dossier d'autorisation lié au dossier d'instruction
1103        function getDossierAutorisation($dossier_instruction){
1104            
1105            $sql = "SELECT
1106                        dossier_autorisation.dossier_autorisation
1107                    FROM
1108                        ".DB_PREFIXE."dossier_autorisation
1109                    LEFT JOIN
1110                        ".DB_PREFIXE."dossier
1111                        ON
1112                            dossier_autorisation.dossier_autorisation = dossier.dossier_autorisation
1113                    WHERE
1114                        dossier.dossier = '".$dossier_instruction."'";
1115          
1116            $IDdossier_autorisation = $this->db->getOne($sql);
1117            $this->addToLog("getDossierAutorisation(): db->getone(\"".$sql."\")", VERBOSE_MODE);
1118            database::isError($IDdossier_autorisation);
1119            
1120            return $IDdossier_autorisation;
1121        }
1122  }// fin classe  }// fin classe
1123  ?>  ?>

Legend:
Removed from v.1282  
changed lines
  Added in v.1439

[email protected]
ViewVC Help
Powered by ViewVC 1.1.26