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

Diff of /trunk/obj/dossier.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 1140 by nhaye, Thu Jan 3 17:19:08 2013 UTC
# Line 25  class dossier extends dossier_gen { Line 25  class dossier extends dossier_gen {
25      var $aff_localisation = "collapsible";      var $aff_localisation = "collapsible";
26      var $aff_description = "startClosed";      var $aff_description = "startClosed";
27      var $aff_amenagement = "startClosed";      var $aff_amenagement = "startClosed";
28        var $dossier_instruction_type;
29    
30          function dossier($id,&$db,$DEBUG) {      function dossier($id,&$db,$DEBUG) {
31          $this->constructeur($id,$db,$DEBUG);          $this->constructeur($id,$db,$DEBUG);
32      } // fin constructeur      } // fin constructeur
33    
34        /*Mutateur pour ma variable dossier_instruction_type*/
35        public function getDossierInstructionType(){
36            return $this->dossier_instruction_type;
37        }
38        public function setDossierInstructionType($dossier_instruction_type){
39            $this->dossier_instruction_type = $dossier_instruction_type;
40        }
41            
42        // {{{ Gestion de la confidentialité des données spécifiques
43    
44        /**
45         * Surcharge pour gérer les actions disponibles dans le portlet
46         */
47        function checkAccessibility() {
48            //
49            parent::checkAccessibility();
50            // Si l'utilisateur est un intructeur qui en correspond pas à la
51            // division du dossier
52            if ($this->f->isUserInstructeur()
53                && isset($this->f->om_utilisateur["division"])
54                && $this->f->om_utilisateur["division"] != $this->getDivisionFromDossier()) {
55                //
56                $this->actions_sup = array();
57                $this->setParameter("actions", array());
58            }
59        }
60    
61        /**
62         * Cette methode est à surcharger elle permet de tester dans chaque classe
63         * des droits des droits spécifiques en fonction des données
64         */
65        function canAccess() {
66            // Si l'utilisateur est un intructeur qui ne correspond pas à la
67            // division du dossier
68            if ($this->f->isUserInstructeur()
69                && $this->f->om_utilisateur["division"] != $this->getDivisionFromDossier()
70                && $this->getParameter("maj") != 3) {
71                //
72                return false;
73            }
74            //
75            return true;
76        }
77    
78        /**
79         * Cette méthode permet de récupérer la division d'un dossier
80         */
81        function getDivisionFromDossier() {
82            //
83            if (!isset($this->val[array_search("dossier", $this->champs)])) {
84                return NULL;
85            }
86            //
87            $sql = "select division from ".DB_PREFIXE."dossier ";
88            $sql .= " where dossier='".$this->val[array_search("dossier", $this->champs)]."'";
89            //
90            $division = $this->db->getOne($sql);
91            $this->addToLog("getDivisionFromDossier(): db->getone(\"".$sql."\")", VERBOSE_MODE);
92            database::isError($division);
93            //
94            return $division;
95        }
96    
97        // }}}
98        /*
99         * Ajoute un numéro au dossier
100         *
101         */
102      function setValFAjout($val = array()) {      function setValFAjout($val = array()) {
103          $this->valF['dossier'] = $val['dossier_autorisation'];          
104            /*Récupération de la lettre associé au type de dossier d'instruction*/
105            $code = $this->getCode($this->getDossierInstructionType());
106            
107            /* Récupération de la valeur du suffixe ce dossier_instruction_type */
108            $suffixe = $this->getSuffixe($this->getDossierInstructionType());
109            
110            /*S'il est à TRUE, on récupère le numéro de version du dossier d'autorisation*/
111            $numeroVersion = "";
112            if ( $suffixe == 't' ){
113                
114                $numeroVersion = $this->getNumeroVersion($val['dossier_autorisation']);
115                
116                /* Incrémentation du numéro de version */
117                if ( is_numeric($numeroVersion) or $numeroVersion == -1 ){
118                    
119                    $this->incrementNumeroVersion($val['dossier_autorisation'], ++$numeroVersion);
120                }
121            }
122            
123            /*Création du numéro de dossier*/
124            $this->valF['dossier'] = $val['dossier_autorisation']."$code$numeroVersion";
125      }      }
126    
127        /*Récupère la valeur du suffixe d'un dossier_instruction_type*/
128        function getSuffixe($dossierInstructionType){
129            
130            $suffixe = "";
131            
132            $sql = "SELECT
133                        suffixe
134                    FROM
135                        ".DB_PREFIXE."dossier_instruction_type
136                    WHERE
137                        dossier_instruction_type = $dossierInstructionType";
138                        
139            $this->addToLog("getSuffixe(): db->query(\"".$sql."\")", VERBOSE_MODE);
140            $res = $this->db->query($sql);
141            if (database :: isError($res))
142                die($res->getMessage()."erreur ".$sql);
143                
144            if ( $res->numRows() > 0 ){
145                
146                $row = $res->fetchRow(DB_FETCHMODE_ASSOC);
147                $suffixe =  $row['suffixe'];
148            }
149            
150            return $suffixe;
151        }
152        
153        /*Récupère dans la table de paramètrage la lettre correspondant
154         * au dossier_instruction_type
155         */
156        function getCode($dossierInstructionType){
157            
158            $code = "";
159            
160            $sql = "SELECT
161                        code
162                    FROM
163                        ".DB_PREFIXE."dossier_instruction_type
164                    WHERE
165                        dossier_instruction_type = $dossierInstructionType";
166                        
167            $this->addToLog("getCode(): db->query(\"".$sql."\")", VERBOSE_MODE);
168            $res = $this->db->query($sql);
169            if (database :: isError($res))
170                die($res->getMessage()."erreur ".$sql);
171                
172            if ( $res->numRows() > 0 ){
173                
174                $row = $res->fetchRow(DB_FETCHMODE_ASSOC);
175                $code =  $row['code'];
176            }
177            
178            return $code;
179        }
180        
181        /*Récupère le numéro de version d'un dossier_autorisation*/
182        function getNumeroVersion($dossierAutorisation){
183            
184            $numeroVersion = "";
185            
186            $sql = "SELECT
187                        numero_version
188                    FROM
189                        ".DB_PREFIXE."dossier_autorisation
190                    WHERE
191                        dossier_autorisation = '$dossierAutorisation'";
192                        
193            $this->addToLog("getNumeroVersion(): db->query(\"".$sql."\")", VERBOSE_MODE);
194            $res = $this->db->query($sql);
195            if (database :: isError($res))
196                die($res->getMessage()."erreur ".$sql);
197                
198            if ( $res->numRows() > 0 ){
199                
200                $row = $res->fetchRow(DB_FETCHMODE_ASSOC);
201                $numeroVersion =  $row['numero_version'];
202            }
203            
204            return $numeroVersion;
205        }
206        
207        /*Incrémente le numéro de version du dossier*/
208        function incrementNumeroVersion($dossierAutorisation, $nouveauNumeroVersion) {
209            
210            $valF = array (
211                        "numero_version" => $nouveauNumeroVersion
212                    );
213            
214            $res = $this->db->autoExecute(DB_PREFIXE."dossier_autorisation",
215                                        $valF,
216                                        DB_AUTOQUERY_UPDATE,
217                                        "dossier_autorisation = '$dossierAutorisation'");
218                                        
219            if (database :: isError($res))
220                die($res->getMessage()."erreur ".$sql);
221                
222        }
223        
224      function setvalF($val){      function setvalF($val){
225          parent::setvalF($val);          parent::setvalF($val);
226          // enlever les valeurs a ne pas saisir -> recherche en trigger ajouter et modifier          // enlever les valeurs a ne pas saisir -> recherche en trigger ajouter et modifier
# Line 62  class dossier extends dossier_gen { Line 249  class dossier extends dossier_gen {
249          unset ($this->valF['date_conformite']);          unset ($this->valF['date_conformite']);
250      }      }
251    
252        /*Vérification des données saisies*/
253      function verifier($val,&$db,$DEBUG){      function verifier($val,&$db,$DEBUG){
254          parent::verifier($val,$db,$DEBUG);          parent::verifier($val,$db,$DEBUG);
255          if($val['parcelle']!="" and $val['sig']!='Oui'){          if($val['parcelle']!="" and $val['sig']!='Oui'){
# Line 194  class dossier extends dossier_gen { Line 382  class dossier extends dossier_gen {
382              // cache              // cache
383              if($maj==0) $form->setType('dossier', 'hidden');              if($maj==0) $form->setType('dossier', 'hidden');
384              $form->setType('annee', 'hidden');              $form->setType('annee', 'hidden');
             $form->setType('nature', 'select');  
385              $form->setType('parcelle_archive','hidden');              $form->setType('parcelle_archive','hidden');
386              $form->setType('parcelle_lot_archive','hidden');              $form->setType('parcelle_lot_archive','hidden');
387              $form->setType('objet_dossier','hidden'); // PC              $form->setType('objet_dossier','hidden'); // PC
# Line 288  class dossier extends dossier_gen { Line 475  class dossier extends dossier_gen {
475          }          }
476          if($maj == 3) {          if($maj == 3) {
477              $form->setType('annee', 'hidden');              $form->setType('annee', 'hidden');
             $form->setType('nature', 'selectstatic');  
478              $form->setType('temp1','hidden');              $form->setType('temp1','hidden');
479              $form->setType('temp2','hidden');              $form->setType('temp2','hidden');
480              $form->setType('temp3','hidden');              $form->setType('temp3','hidden');
# Line 305  class dossier extends dossier_gen { Line 491  class dossier extends dossier_gen {
491              $form->setType('division', 'hidden');              $form->setType('division', 'hidden');
492          }          }
493          $form->setType('dossier_autorisation', 'hiddenstatic');          $form->setType('dossier_autorisation', 'hiddenstatic');
494            //
495            if ($maj == 0) {
496                $form->setType('dossier_autorisation', 'select');
497            }
498            // On cache enjeu_ERP si l'option n'est pas activée
499            if($this->f->getParameter('option_ERP') != 'true') {
500                $form->setType('erp', 'hidden');
501                $form->setType('enjeu_erp', 'hidden');
502            }
503      }      }
504    
505      function setVal(&$form,$maj,$validation){      function setVal(&$form,$maj,$validation){
# Line 419  class dossier extends dossier_gen { Line 614  class dossier extends dossier_gen {
614                  $contenu[0]=array("dossier",$this->getParameter("idx"));                  $contenu[0]=array("dossier",$this->getParameter("idx"));
615                  $form->setSelect('geom',$contenu);                  $form->setSelect('geom',$contenu);
616              }              }
617                            // arrondissement recherche anvancée
618                $this->init_select($form, $db, $maj, $debug, "arrondissement",
619                               $sql_arrondissement, $sql_arrondissement_by_id, false);
620                // dossier_autorisation_type_detaille recherche anvancée
621                $this->init_select($form, $db, $maj, $debug, "dossier_autorisation_type_detaille",
622                               $sql_dossier_autorisation_type_detaille, $sql_dossier_autorisation_type_detaille_by_id, false);
623              /*              /*
624               * Affichage de données dans le select de la parcelle               * Affichage de données dans le select de la parcelle
625               * */               * */
# Line 702  class dossier extends dossier_gen { Line 902  class dossier extends dossier_gen {
902                    
903      }      }
904    
       
   
905      /* =============================================================      /* =============================================================
906      * fonction trigger relative a la connexion SIG      * fonction trigger relative a la connexion SIG
907      * $sig = 1 dans dyn/var.inc      * $sig = 1 dans dyn/var.inc
# Line 723  class dossier extends dossier_gen { Line 921  class dossier extends dossier_gen {
921                  $this->addToMessage("<br>"._("Parcelle non renseignee dans dossier")." ".$id." <br>");                  $this->addToMessage("<br>"._("Parcelle non renseignee dans dossier")." ".$id." <br>");
922                            
923          }          }
924                            
925          // envoi du message a ERP en cas d'un depot du dossier dat          
926          if ($this->valF['nature'] ==          if ($this->f->getParameter('option_erp') != "") {
927                  $this->f->getParameter('erp_depot_dossier_dat')) {              // envoi du message a ERP en cas d'un depot du dossier dat
928              $msgenque = new MessageEnqueuer();              if ($this->getDATDCode($this->valF['dossier']) ==
929              $msgenque->setDossierInstructionIdentifier($this->valF['dossier']);                      $this->f->getParameter('erp_depot_dossier_dat')) {
             $msgenque->enqueueMessage($msgenque::$ERP_DEPOT_DOSSIER_DAT);  
         }  
           
         // envoi du message a ERP en cas d'une demande d'ouverture DAT  
         if ($this->valF['nature'] ==  
                 $this->f->getParameter('erp_demande_ouverture_dat')) {  
             $msgenque = new MessageEnqueuer();  
             $msgenque->setDossierInstructionIdentifier($this->valF['dossier']);  
             $msgenque->enqueueMessage($msgenque::$ERP_DEMANDE_OUVERTURE_DAT);  
         }  
           
         if ($this->valF['erp'] === true) {  
             // envoi du message a ERP en cas d'annulation d'une demande  
             if ($this->valF['nature'] ==  
                     $this->f->getParameter('erp_annulation_demande')) {  
930                  $msgenque = new MessageEnqueuer();                  $msgenque = new MessageEnqueuer();
931                  $msgenque->setDossierInstructionIdentifier($this->valF['dossier']);                  $msgenque->setDossierInstructionIdentifier($this->valF['dossier']);
932                  $msgenque->enqueueMessage($msgenque::$ERP_ANNULATION_DEMANDE);                  $msgenque->enqueueMessage($msgenque::$ERP_DEPOT_DOSSIER_DAT);
933              }              }
934                            
935              // envoi du message a ERP en cas d'ouverture d'un dossier PC "rattache"              // envoi du message a ERP en cas d'une demande d'ouverture DAT
936              // au dossier DAACT              if ($this->getDATDCode($this->valF['dossier']) ==
937              if ($this->valF['nature'] ==                      $this->f->getParameter('erp_demande_ouverture_dat')) {
                     $this->f->getParameter('erp_demande_ouverture_pc_daact')) {  
938                  $msgenque = new MessageEnqueuer();                  $msgenque = new MessageEnqueuer();
939                  $msgenque->setDossierInstructionIdentifier($this->valF['dossier']);                  $msgenque->setDossierInstructionIdentifier($this->valF['dossier']);
940                  $msgenque->enqueueMessage($msgenque::$ERP_DEMANDE_OUVERTURE_PC);                  $msgenque->enqueueMessage($msgenque::$ERP_DEMANDE_OUVERTURE_DAT);
941              }              }
942          }              
943                        if ($this->valF['erp'] === true) {
944                    // envoi du message a ERP en cas d'annulation d'une demande
945                    if ($this->getDATDCode($this->valF['dossier']) ==
946                            $this->f->getParameter('erp_annulation_demande')) {
947                        $msgenque = new MessageEnqueuer();
948                        $msgenque->setDossierInstructionIdentifier($this->valF['dossier']);
949                        $msgenque->enqueueMessage($msgenque::$ERP_ANNULATION_DEMANDE);
950                    }
951                    
952                    // envoi du message a ERP en cas d'ouverture d'un dossier PC "rattache"
953                    // au dossier DAACT
954                    if ($this->getDATDCode($this->valF['dossier']) ==
955                            $this->f->getParameter('erp_demande_ouverture_pc_daact')) {
956                        $msgenque = new MessageEnqueuer();
957                        $msgenque->setDossierInstructionIdentifier($this->valF['dossier']);
958                        $msgenque->enqueueMessage($msgenque::$ERP_DEMANDE_OUVERTURE_PC);
959                    }
960                }
961            } // fin de if ($this->f->getParameter('option_erp') != "")        
962      }      }
963            
964      /*      /*
# Line 824  class dossier extends dossier_gen { Line 1024  class dossier extends dossier_gen {
1024      /*      /*
1025       * Retourne l'intructeur correspondant le mieux à la parcelle       * Retourne l'intructeur correspondant le mieux à la parcelle
1026       * */       * */
1027       function getInstructeurDivision( $quartier, $arrondissement, $section, $nature) {       function getInstructeurDivision( $quartier, $arrondissement, $section, $dossier_autorisation) {
1028                                    
1029          $quartier = ( $quartier == NULL ) ? -1 : $quartier;          $quartier = ( $quartier == NULL ) ? -1 : $quartier;
1030          $arrondissement = ( $arrondissement == NULL ) ? -1 : $arrondissement;          $arrondissement = ( $arrondissement == NULL ) ? -1 : $arrondissement;
1031                    
1032            /*Récupération du dossier_autorisation_type_detaille concerné par le $dossier_autorisation*/
1033          $sql = "          $sql = "
1034             SELECT             SELECT
1035                 instructeur, section, quartier, arrondissement, nature                 dossier_autorisation_type_detaille
1036             FROM             FROM
1037                 ".DB_PREFIXE."lien_localisation_nature l                 ".DB_PREFIXE."dossier_autorisation
1038             WHERE             WHERE
1039                 ( nature IS NULL AND arrondissement IS NULL AND quartier IS NULL AND section IS NULL ) OR                 dossier_autorisation = '$dossier_autorisation'";    
                ( nature IS NULL AND arrondissement IS NULL AND quartier IS NULL AND section = '$section' ) OR  
                ( nature IS NULL AND arrondissement IS NULL AND quartier = $quartier AND section IS NULL ) OR  
                ( nature IS NULL AND arrondissement IS NULL AND quartier = $quartier AND section = '$section' ) OR  
                ( nature IS NULL AND arrondissement = $arrondissement AND quartier IS NULL AND section IS NULL ) OR  
                ( nature IS NULL AND arrondissement = $arrondissement AND quartier IS NULL AND section = '$section' ) OR  
                ( nature IS NULL AND arrondissement = $arrondissement AND quartier = $quartier AND section IS NULL ) OR  
                ( nature IS NULL AND arrondissement = $arrondissement AND quartier = $quartier AND section = '$section' ) OR  
                ( nature = '$nature' AND arrondissement IS NULL AND quartier IS NULL AND section IS NULL ) OR  
                ( nature = '$nature' AND arrondissement IS NULL AND quartier IS NULL AND section = '$section' ) OR  
                ( nature = '$nature' AND arrondissement IS NULL AND quartier = $quartier AND section IS NULL ) OR  
                ( nature = '$nature' AND arrondissement IS NULL AND quartier = $quartier AND section = '$section' ) OR  
                ( nature = '$nature' AND arrondissement = $arrondissement AND quartier IS NULL AND section IS NULL ) OR  
                ( nature = '$nature' AND arrondissement = $arrondissement AND quartier IS NULL AND section = '$section' ) OR  
                ( nature = '$nature' AND arrondissement = $arrondissement AND quartier = $quartier AND section IS NULL ) OR  
                ( nature = '$nature' AND arrondissement = $arrondissement AND quartier = $quartier AND section = '$section' )  
            ORDER BY section, quartier, arrondissement, nature  
            LIMIT 1  
         ";  
           
         $this->addToLog("getInstructeurDivision( quartier, arrondissement, section, nature) : db->query(\"$sql\")", VERBOSE_MODE);  
         $res = $this->db->query($sql);  
         if (database :: isError($res))  
             die($res->getMessage()."erreur ".$sql);  
1040                    
1041          if ( $res->numRows() > 0 ){          $this->addToLog("getInstructeurDivision : db->query(\"$sql\")", VERBOSE_MODE);
1042            $resDATD = $this->db->query($sql);
1043            if (database :: isError($resDATD))
1044                die($resDATD->getMessage()."erreur ".$sql);
1045            
1046            if ( $resDATD->numRows() > 0 ){
1047                $rowDATD = $resDATD->fetchRow(DB_FETCHMODE_ASSOC);
1048                
1049                $sql = "
1050                   SELECT
1051                       instructeur, section, quartier, arrondissement, dossier_autorisation_type_detaille
1052                   FROM
1053                       ".DB_PREFIXE."affectation_automatique l
1054                   WHERE
1055                       ( dossier_autorisation_type_detaille IS NULL AND arrondissement IS NULL AND quartier IS NULL AND section IS NULL ) OR
1056                       ( dossier_autorisation_type_detaille IS NULL AND arrondissement IS NULL AND quartier IS NULL AND section = '$section' ) OR
1057                       ( dossier_autorisation_type_detaille IS NULL AND arrondissement IS NULL AND quartier = $quartier AND section IS NULL ) OR
1058                       ( dossier_autorisation_type_detaille IS NULL AND arrondissement IS NULL AND quartier = $quartier AND section = '$section' ) OR
1059                       ( dossier_autorisation_type_detaille IS NULL AND arrondissement = $arrondissement AND quartier IS NULL AND section IS NULL ) OR
1060                       ( dossier_autorisation_type_detaille IS NULL AND arrondissement = $arrondissement AND quartier IS NULL AND section = '$section' ) OR
1061                       ( dossier_autorisation_type_detaille IS NULL AND arrondissement = $arrondissement AND quartier = $quartier AND section IS NULL ) OR
1062                       ( dossier_autorisation_type_detaille IS NULL AND arrondissement = $arrondissement AND quartier = $quartier AND section = '$section' ) OR
1063                       ( dossier_autorisation_type_detaille = ".$rowDATD['dossier_autorisation_type_detaille']." AND arrondissement IS NULL AND quartier IS NULL AND section IS NULL ) OR
1064                       ( dossier_autorisation_type_detaille = ".$rowDATD['dossier_autorisation_type_detaille']." AND arrondissement IS NULL AND quartier IS NULL AND section = '$section' ) OR
1065                       ( dossier_autorisation_type_detaille = ".$rowDATD['dossier_autorisation_type_detaille']." AND arrondissement IS NULL AND quartier = $quartier AND section IS NULL ) OR
1066                       ( dossier_autorisation_type_detaille = ".$rowDATD['dossier_autorisation_type_detaille']." AND arrondissement IS NULL AND quartier = $quartier AND section = '$section' ) OR
1067                       ( dossier_autorisation_type_detaille = ".$rowDATD['dossier_autorisation_type_detaille']." AND arrondissement = $arrondissement AND quartier IS NULL AND section IS NULL ) OR
1068                       ( dossier_autorisation_type_detaille = ".$rowDATD['dossier_autorisation_type_detaille']." AND arrondissement = $arrondissement AND quartier IS NULL AND section = '$section' ) OR
1069                       ( dossier_autorisation_type_detaille = ".$rowDATD['dossier_autorisation_type_detaille']." AND arrondissement = $arrondissement AND quartier = $quartier AND section IS NULL ) OR
1070                       ( dossier_autorisation_type_detaille = ".$rowDATD['dossier_autorisation_type_detaille']." AND arrondissement = $arrondissement AND quartier = $quartier AND section = '$section' )
1071                   ORDER BY section, quartier, arrondissement, dossier_autorisation_type_detaille
1072                   LIMIT 1
1073                ";
1074                            
1075              $row = $res->fetchRow(DB_FETCHMODE_ASSOC);              $this->addToLog("getInstructeurDivision : db->query(\"$sql\")", VERBOSE_MODE);
               
             $sql = "SELECT division FROM ".DB_PREFIXE."instructeur WHERE instructeur = ".$row['instructeur'];  
1076              $res = $this->db->query($sql);              $res = $this->db->query($sql);
1077              if (database :: isError($res))              if (database :: isError($res))
1078                  die($res->getMessage()."erreur ".$sql);                  die($res->getMessage()."erreur ".$sql);
1079                                
1080              if ( $res->numRows() > 0 ){              if ( $res->numRows() > 0 ){
1081                                    
1082                  $rowT=& $res->fetchRow(DB_FETCHMODE_ASSOC);                  $row = $res->fetchRow(DB_FETCHMODE_ASSOC);
1083                  $row['division'] = $rowT['division'];                  
1084                    $sql = "SELECT division FROM ".DB_PREFIXE."instructeur WHERE instructeur = ".$row['instructeur'];
1085                    $res = $this->db->query($sql);
1086                    if (database :: isError($res))
1087                        die($res->getMessage()."erreur ".$sql);
1088                        
1089                    if ( $res->numRows() > 0 ){
1090                        
1091                        $rowT=& $res->fetchRow(DB_FETCHMODE_ASSOC);
1092                        $row['division'] = $rowT['division'];
1093                    }
1094                    
1095                    return $row;
1096              }              }
               
             return $row;  
1097          }          }
1098            
1099          return NULL;          return NULL;
1100       }       }
1101            
# Line 917  class dossier extends dossier_gen { Line 1135  class dossier extends dossier_gen {
1135              $section = $this->getSection($val['parcelle']);              $section = $this->getSection($val['parcelle']);
1136          }          }
1137                    
1138          // Si aucun instructeur n'est saisi et que la nature n'est pas vide          // Si aucun instructeur n'est saisi et que la dossier_autorisation_type_detaille n'est pas vide
1139          // alors on récupère l'instructeur et la division depuis l'affectation          // alors on récupère l'instructeur et la division depuis l'affectation
1140          if ( ( empty($this->valF['instructeur']) || $this->valF['instructeur'] == '' ) && $val['nature'] != '' ) {          if ( ( empty($this->valF['instructeur']) || $this->valF['instructeur'] == '' ) && $val['dossier_autorisation'] != '' ) {
1141                            
1142              //              //
1143              $instructeurDivision = $this->getInstructeurDivision($quartier, $arrondissement, $section, $val['nature']);              $instructeurDivision = $this->getInstructeurDivision($quartier, $arrondissement, $section, $val['dossier_autorisation']);
1144              if ( $instructeurDivision != NULL ){              if ( $instructeurDivision != NULL ){
1145                                    
1146                  $instructeur = $instructeurDivision['instructeur'];                  $instructeur = $instructeurDivision['instructeur'];
# Line 965  class dossier extends dossier_gen { Line 1183  class dossier extends dossier_gen {
1183                  $this->addToMessage("<br>"._("Parcelle ou parcelle_lot non renseignee dans dossier")." ".$id." <br>");                      $this->addToMessage("<br>"._("Parcelle ou parcelle_lot non renseignee dans dossier")." ".$id." <br>");    
1184              }              }
1185          }          }
1186                            
1187          // BOGUE: le test pour la nature doit etre change parce que          // verification si envoi vers ERP est active
1188          // 'erp_depot_dossier_dat' n'a pas la connexion directe avec          if ($this->f->getParameter('option_erp') != "") {
1189          // qualification d'un dossier, mais c'est necessaire pour les tests              if ($this->val[array_search('a_qualifier', $this->champs)] == 't'
1190          if ($this->val[array_search('a_qualifier', $this->champs)] == 't'                  && $this->valF['a_qualifier'] === false) {
1191              && $this->valF['a_qualifier'] === false) {                                  
1192                                // envoi du message "ERP Qualifie" pour un dossier DAT qui a besoin
1193              $dossier_nature_dat = array(                  // de la qualification URBA
1194                      $this->f->getParameter('erp_depot_dossier_dat'),                  if ($this->getDATDCode($this->valF['dossier']) ==
1195                      $this->f->getParameter('erp_demande_ouverture_dat'));                               $this->f->getParameter('erp_nature_dat')) {
1196                                    $msgenque = new MessageEnqueuer();
1197              // envoi du message "ERP Qualifie" pour un dossier DAT qui a besoin                      $msgenque->setDossierInstructionIdentifier($this->valF['dossier']);
1198              // de la qualification URBA                      $msgenque->setCompetence($this->valF['autorite_competente']);
1199              if (in_array($this->valF['nature'], $dossier_nature_dat)) {                      $msgenque->setContraintePlu($this->valF['servitude']);
1200                  $msgenque = new MessageEnqueuer();                      $msgenque->setReferenceCadastrale(
1201                  $msgenque->setDossierInstructionIdentifier($this->valF['dossier']);                              $this->getReferenceCadastrale($this->valF['dossier']));
1202                  $msgenque->setCompetence($this->valF['autorite_competente']);                      $msgenque->enqueueMessage($msgenque::$ERP_QUALIFIE);                            
1203                  $msgenque->setContraintePlu($this->valF['servitude']);                  }
1204                  $msgenque->setReferenceCadastrale(                  
1205                          $this->getReferenceCadastrale($this->valF['dossier']));                  // envoi des messages a ERP en cas du dossier PC traite par URBA, et
1206                  $msgenque->enqueueMessage($msgenque::$ERP_QUALIFIE);                                              // qui etait classifie come ERP
1207              }                  if ($this->getDATDCode($this->valF['dossier']) ==
1208                                        $this->f->getParameter('erp_dossier_nature_pc')
1209              // envoi des messages a ERP en cas du dossier PC traite par URBA, et                      && $this->valF['erp'] == true) {
1210              // qui etait classifie come ERP                      $msgenque = new MessageEnqueuer();
1211              if ($this->valF['nature'] == 'PC' && $this->valF['erp'] == true) {                      $msgenque->setDossierInstructionIdentifier($this->valF['dossier']);
1212                  $msgenque = new MessageEnqueuer();                      $msgenque->enqueueMessage($msgenque::$ERP_DEMANDE_COMPLETUDE_PC);
1213                  $msgenque->setDossierInstructionIdentifier($this->valF['dossier']);                      $msgenque->enqueueMessage($msgenque::$ERP_DEMANDE_QUALIFICATION_PC);
1214                  $msgenque->enqueueMessage($msgenque::$ERP_DEMANDE_COMPLETUDE_PC);                  }
                 $msgenque->enqueueMessage($msgenque::$ERP_DEMANDE_QUALIFICATION_PC);  
1215              }              }
1216                        } // fin de if($this->f->getParameter('option_erp'))
1217          }          }
1218    
1219        /**
1220         * Retourne le type de dossier d'autorisation du dossier courant :
1221         *  - dossier_autorisation_type_detaille.code
1222         **/
1223        function getDATDCode($idxDossier) {
1224            $sql = "SELECT dossier_autorisation_type_detaille.code
1225                    FROM ".DB_PREFIXE."dossier_autorisation_type_detaille
1226                    INNER JOIN ".DB_PREFIXE."dossier_autorisation
1227                        ON dossier_autorisation_type_detaille.dossier_autorisation_type_detaille =
1228                           dossier_autorisation.dossier_autorisation_type_detaille
1229                    INNER JOIN ".DB_PREFIXE."dossier ON dossier.dossier_autorisation = dossier_autorisaiton.dossier_autorisation
1230                    WHERE dossier.dossier = ".$idxDossier;
1231            $res = $db -> getOne($sql);
1232            $this->f->isDatabaseError();
1233            return $res;
1234      }      }
1235            
1236            

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

[email protected]
ViewVC Help
Powered by ViewVC 1.1.26