/[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 1723 by nhaye, Thu Apr 18 09:23:52 2013 UTC revision 1724 by nhaye, Thu Apr 18 17:07:35 2013 UTC
# Line 32  class instruction extends instruction_ge Line 32  class instruction extends instruction_ge
32      var $archive_date_depot; // specific      var $archive_date_depot; // specific
33      var $retourformulaire;   // specific      var $retourformulaire;   // specific
34      var $idxformulaire;      // specific      var $idxformulaire;      // specific
35        var $valEvenement;
36    
37      function instruction($id, &$db, $debug) {      function instruction($id, &$db, $debug) {
38          $this->constructeur($id, $db, $debug);          $this->constructeur($id, $db, $debug);
# Line 581  class instruction extends instruction_ge Line 582  class instruction extends instruction_ge
582              if ($row['date_conformite']!='') {              if ($row['date_conformite']!='') {
583                  $this->valF['archive_date_conformite']= $row['date_conformite'];                    $this->valF['archive_date_conformite']= $row['date_conformite'];  
584              }              }
585                if ($row['incompletude']!='') {
586                    $this->valF['archive_incompletude']= $row['incompletude'];  
587                }
588                if ($row['evenement_suivant_tacite']!='') {
589                    $this->valF['archive_evenement_suivant_tacite']= $row['evenement_suivant_tacite'];  
590                }
591                if ($row['evenement_suivant_tacite_incompletude']!='') {
592                    $this->valF['archive_evenement_suivant_tacite_incompletude']= $row['evenement_suivant_tacite_incompletude'];  
593                }
594                if ($row['etat_pendant_incompletude']!='') {
595                    $this->valF['archive_etat_pendant_incompletude']= $row['etat_pendant_incompletude'];  
596                }
597                if ($row['date_limite_incompletude']!='') {
598                    $this->valF['archive_date_limite_incompletude']= $row['date_limite_incompletude'];  
599                }
600                if ($row['delai_incompletude']!='') {
601                    $this->valF['archive_delai_incompletude']= $row['delai_incompletude'];  
602                }
603          }          }
604      }      }
605            
# Line 705  class instruction extends instruction_ge Line 724  class instruction extends instruction_ge
724           * Mise à jour des valeurs du dossier en fonction des valeurs calculées           * Mise à jour des valeurs du dossier en fonction des valeurs calculées
725           * par l'action           * par l'action
726           */           */
727            $this->getValEvenement();
728          // Initialisation          // Initialisation
729          $valF = "";          $valF = "";
730          // Récupération des paramètres de l'action          // Récupération des paramètres de l'action
# Line 716  class instruction extends instruction_ge Line 736  class instruction extends instruction_ge
736              die($res->getMessage());              die($res->getMessage());
737          }          }
738          while ($row=& $res->fetchRow(DB_FETCHMODE_ASSOC)) {          while ($row=& $res->fetchRow(DB_FETCHMODE_ASSOC)) {
739              // pour chacune des regles, on applique la regle              // Si le dossier lié à l'instruction deviens incomplet le champ
740              if($row['regle_etat']!=''){              // concervant l'état du dossier avant incompletude devient etat_pendant_incompletude
741                  $valF['etat'] = $this->regle($row['regle_etat']);              if($this->valEvenement['type'] == "incompletude" AND $this->dossierIncomplet() === false) {
742                    $valF['incompletude'] = TRUE;
743                    $valF['etat_pendant_incompletude'] = $this->valF['archive_etat'];
744                    if($row['regle_etat']!=''){
745                        $valF['etat'] = $this->regle($row['regle_etat']);
746                    }
747                }
748                // Si le dossier est incomplet et que l'événement n'est pas de type
749                // incompletude l'état est stocké dans le champ etat_pendant_incompletude
750                if($this->valEvenement['type'] != "incompletude" AND $this->dossierIncomplet() === true) {
751                    if($row['regle_etat']!=''){
752                        $valF['etat_pendant_incompletude'] = $this->regle($row['regle_etat']);
753                    }
754                }
755                // Si le dossier est incomplet et que l'événement est de type
756                // incompletude l'état est stocké dans le champ etat
757                if($this->valEvenement['type'] == "incompletude" AND $this->dossierIncomplet() === true) {
758                    if($row['regle_etat']!=''){
759                        $valF['etat'] = $this->regle($row['regle_etat']);
760                    }
761              }              }
762                // Si le dossier n'est pas incomplet et que l'événement n'est pas de type
763                // incompletude : traitement normal
764                if($this->valEvenement['type'] != "incompletude" AND $this->dossierIncomplet() === false) {
765                    if($row['regle_etat']!=''){
766                        $valF['etat'] = $this->regle($row['regle_etat']);
767                    }
768                }
769    
770                // pour chacune des regles, on applique la regle
771              if($row['regle_delai']!=''){              if($row['regle_delai']!=''){
772                  $valF['delai'] = $this->regle($row['regle_delai']);                  $valF['delai'] = $this->regle($row['regle_delai']);
773              }              }
# Line 759  class instruction extends instruction_ge Line 807  class instruction extends instruction_ge
807              if($row['regle_date_conformite']!=''){              if($row['regle_date_conformite']!=''){
808                  $valF['date_conformite']= $this->regle($row['regle_date_conformite']);                  $valF['date_conformite']= $this->regle($row['regle_date_conformite']);
809              }              }
   
810          }          }
811          // Si des valeurs ont été calculées alors on met à jour l'enregistrement          // Si des valeurs ont été calculées alors on met à jour l'enregistrement
812          if ($valF != "") {          if ($valF != "") {
# Line 1070  class instruction extends instruction_ge Line 1117  class instruction extends instruction_ge
1117          } else {          } else {
1118              $valF['date_conformite'] = NULL;              $valF['date_conformite'] = NULL;
1119          }          }
1120            if ($val['archive_incompletude'] != '') {
1121                $valF['incompletude'] = $val['archive_incompletude'];
1122            } else {
1123                $valF['incompletude'] = NULL;
1124            }
1125            if ($val['archive_evenement_suivant_tacite'] != '') {
1126                $valF['evenement_suivant_tacite'] = $val['archive_evenement_suivant_tacite'];
1127            } else {
1128                $valF['evenement_suivant_tacite'] = NULL;
1129            }
1130            if ($val['archive_evenement_suivant_tacite_incompletude'] != '') {
1131                $valF['evenement_suivant_tacite_incompletude'] = $val['archive_evenement_suivant_tacite_incompletude'];
1132            } else {
1133                $valF['evenement_suivant_tacite_incompletude'] = NULL;
1134            }
1135            if ($val['archive_etat_pendant_incompletude'] != '') {
1136                $valF['etat_pendant_incompletude'] = $val['archive_etat_pendant_incompletude'];
1137            } else {
1138                $valF['etat_pendant_incompletude'] = NULL;
1139            }
1140            if ($val['archive_date_limite_incompletude'] != '') {
1141                $valF['date_limite_incompletude'] = $val['archive_date_limite_incompletude'];
1142            } else {
1143                $valF['date_limite_incompletude'] = NULL;
1144            }
1145            if ($val['archive_delai_incompletude'] != '') {
1146                $valF['delai_incompletude'] = $val['archive_delai_incompletude'];
1147            } else {
1148                $valF['delai_incompletude'] = NULL;
1149            }
1150          // On met à jour le dossier          // On met à jour le dossier
1151          $cle = " dossier='".$val['dossier']."'";          $cle = " dossier='".$val['dossier']."'";
1152          $res = $db->autoExecute(DB_PREFIXE.'dossier', $valF, DB_AUTOQUERY_UPDATE, $cle);          $res = $db->autoExecute(DB_PREFIXE.'dossier', $valF, DB_AUTOQUERY_UPDATE, $cle);
# Line 1182  class instruction extends instruction_ge Line 1259  class instruction extends instruction_ge
1259          $this->updateDate("date_retour_controle_legalite");          $this->updateDate("date_retour_controle_legalite");
1260      }      }
1261    
1262        /**
1263         * Méthode permettant de récupérer toutes les valeurs de l'événement
1264         * sélectionné après validation du formulaire d'instruction
1265         *
1266         * @return array() veleurs de l'événement lié
1267         */
1268    
1269        private function getValEvenement() {
1270            if(!empty($this->valEvenement)) {
1271                return $this->valEvenement;
1272            } else {
1273                $sql = "SELECT * FROM ".DB_PREFIXE."evenement
1274                    WHERE evenement=".$this->valF['evenement'];
1275                $res = $this->db->query($sql);
1276                $this->addToLog("getValEvenement(): db->query(\"".$sql."\");", VERBOSE_MODE);
1277                if (database::isError($res)) {
1278                    die($res->getMessage());
1279                }
1280                $this->valEvenement = $res->fetchRow(DB_FETCHMODE_ASSOC);
1281                return $this->valEvenement;
1282            }
1283        }
1284    
1285        /**
1286         * Méthode permettant de savoir si le dossier lié à l'instruction à le flag
1287         * incompletude à true après validation du formulaire d'instruction
1288         *
1289         * @return boolean
1290         */
1291        private function dossierIncomplet() {
1292            $sql = "SELECT incompletude FROM ".DB_PREFIXE."dossier
1293                    WHERE dossier='".$this->valF['dossier']."'";
1294            $incompletude = $this->db->getOne($sql);
1295            $this->addToLog("dossierIncomplet(): db->query(\"".$sql."\");", VERBOSE_MODE);
1296            if (database::isError($incompletude)) {
1297                die($incompletude->getMessage());
1298            }
1299            if ($incompletude == 't') {
1300                return true;
1301            } else {
1302                return false;
1303            }
1304        }
1305    
1306  }// fin classe  }// fin classe
1307  ?>  ?>

Legend:
Removed from v.1723  
changed lines
  Added in v.1724

[email protected]
ViewVC Help
Powered by ViewVC 1.1.26