/[openfoncier]/branches/3.14.1/obj/instruction.class.php
ViewVC logotype

Diff of /branches/3.14.1/obj/instruction.class.php

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

revision 2605 by vpihour, Wed Dec 11 15:22:26 2013 UTC revision 2606 by vpihour, Thu Dec 12 18:05:40 2013 UTC
# Line 498  class instruction extends instruction_ge Line 498  class instruction extends instruction_ge
498          //          //
499          parent::cleSecondaire($id, $db, $val, $DEBUG);          parent::cleSecondaire($id, $db, $val, $DEBUG);
500                    
501          //verifie evt instr sans crea instr          $id = $this->getVal($this->clePrimaire);
         $sql = "select demande_type.dossier_instruction_type  
          from ".DB_PREFIXE."demande_type  
          left join ".DB_PREFIXE."demande  
          on  
          demande.demande_type = demande_type.demande_type  
          where demande.instruction_recepisse = ".$id;  
502    
          $res = $this->db->getOne($sql);  
503                    
504          // Aucune clé secondaire n'a été trouvée, || c'est un evt sans creation de DIl'instruction peut être supprimée          //Requête de vérification que cette événement d'instruction n'est pas lié
505            //à la création d'un dossier d'instruction
506            $sql = "SELECT demande_type.dossier_instruction_type
507                FROM ".DB_PREFIXE."demande_type
508                LEFT JOIN ".DB_PREFIXE."demande
509                ON demande.demande_type = demande_type.demande_type
510                WHERE demande.instruction_recepisse = ".$id;
511            $res = $this->db->getOne($sql);
512            $this->addToLog("cleSecondaire(): db->getone(\"".$sql."\");", VERBOSE_MODE);
513            if (database::isError($res)) {
514                die($res->getMessage());
515            }
516    
517            // Aucune clé secondaire n'a été trouvée ou c'est un événement sans
518            //création de dossier d'instruction, l'événement d'instruction peut être
519            //supprimé
520          if ( $this->correct !== false || $res == null || $res == ""){          if ( $this->correct !== false || $res == null || $res == ""){
521                    
522                //Si c'est un événement d'instruction lié à une demande
523              if ($res == null || $res == ""){              if ($res == null || $res == ""){
524                                    
525                  //utiliser ftion modifier                  //On récupère l'identifiant de la demande liée
526                  $sql = "update ".DB_PREFIXE."demande                  $sql = "SELECT demande
527                  set demande.instruction_recepisse = NULL                      FROM ".DB_PREFIXE."demande
528                   where demande.instruction_recepisse = ".$id;                      WHERE instruction_recepisse = ".$id;
529                                    $res = $this->db->getOne($sql);
530           $res = $this->db->query($sql);                  $this->addToLog("cleSecondaire(): db->getone(\"".$sql."\");", VERBOSE_MODE);
531                    if (database::isError($res)) {
532                        die($res->getMessage());
533                    }
534    
535                    require_once "../obj/demande.class.php";
536                    $demande = new demande($res, $this->db, DEBUG);
537    
538                    //On met à jour la demande en supprimant la liaison vers
539                    //l'événement d'instruction
540                    $demande->setParameter("maj", 1);
541                    $valF = array();
542                    foreach($demande->champs as $identifiant => $champ) {
543                        $valF[$champ] = $demande->val[$identifiant];
544                    }
545                    $valF['date_demande']=$demande->dateDBToForm($valF['date_demande']);
546                    $valF['instruction_recepisse']=NULL;
547                    $ret = $demande->modifier($valF, $this->db, DEBUG);
548              }              }
549                                    
550              /**              /**

Legend:
Removed from v.2605  
changed lines
  Added in v.2606

[email protected]
ViewVC Help
Powered by ViewVC 1.1.26