93 |
elseif(file_exists ("../sql/".$db->phptype."/".$this->table.".form.inc")) |
elseif(file_exists ("../sql/".$db->phptype."/".$this->table.".form.inc")) |
94 |
include ("../sql/".$db->phptype."/".$this->table.".form.inc"); |
include ("../sql/".$db->phptype."/".$this->table.".form.inc"); |
95 |
|
|
96 |
//Récupération de paramètre pour le rechargement ajax du select |
// Si en ajout |
97 |
$idx_dossier = $this->getParameter("idx_dossier"); |
if ($maj == 0) { |
98 |
$datd = $this->getParameter("datd"); |
//Récupération de paramètre pour le rechargement ajax du select |
99 |
|
$idx_dossier = $this->getParameter("idx_dossier"); |
100 |
$contenu = array(); |
$datd = $this->getParameter("datd"); |
101 |
|
|
102 |
// Ajout de filtre sur la requête (initial) |
$contenu = array(); |
103 |
if(isset($idx_dossier) AND $idx_dossier != "") { |
|
104 |
$sql_demande_type .= " WHERE demande_type.demande_nature = 2 "; |
$sql_demande_type = "SELECT demande_type.demande_type, demande_type.libelle FROM ".DB_PREFIXE."demande_type |
105 |
|
LEFT OUTER JOIN ".DB_PREFIXE."lien_demande_type_etat_dossier_autorisation |
106 |
|
ON lien_demande_type_etat_dossier_autorisation.demande_type=demande_type.demande_type |
107 |
|
LEFT OUTER JOIN ".DB_PREFIXE."dossier_autorisation |
108 |
|
ON lien_demande_type_etat_dossier_autorisation.etat_dossier_autorisation= |
109 |
|
dossier_autorisation.etat_dossier_autorisation |
110 |
|
LEFT OUTER JOIN ".DB_PREFIXE."dossier |
111 |
|
ON dossier.dossier_autorisation=dossier_autorisation.dossier_autorisation"; |
112 |
|
|
113 |
|
|
114 |
|
// Ajout de filtre sur la requête (initial) |
115 |
|
if(isset($idx_dossier) AND $idx_dossier != "") { |
116 |
|
$sql_demande_type .= " WHERE demande_type.demande_nature = 2 "; |
117 |
|
|
118 |
// ajout du numéro de dossier existant pour tester l'état du DA |
// ajout du numéro de dossier existant pour tester l'état du DA |
119 |
$sql_demande_type .= "AND dossier.dossier = '".$idx_dossier."' "; |
$sql_demande_type .= "AND dossier.dossier = '".$idx_dossier."' "; |
120 |
} else { |
} else { |
121 |
$sql_demande_type .= " WHERE demande_type.demande_nature = 1 "; |
$sql_demande_type .= " WHERE demande_type.demande_nature = 1 "; |
122 |
} |
} |
123 |
if(isset($_POST["dossier_autorisation_type_detaille"]) AND $_POST["dossier_autorisation_type_detaille"] != "") { |
if(isset($_POST["dossier_autorisation_type_detaille"]) AND $_POST["dossier_autorisation_type_detaille"] != "") { |
124 |
$datd = $_POST["dossier_autorisation_type_detaille"]; |
$datd = $_POST["dossier_autorisation_type_detaille"]; |
125 |
} |
} |
126 |
// Ajout de filtre sur la requête (dossier_autorisation_type_detaille) |
// Ajout de filtre sur la requête (dossier_autorisation_type_detaille) |
127 |
if(isset($datd) AND $datd != "") { |
if(isset($datd) AND $datd != "") { |
|
$sql_demande_type .= " AND demande_type.dossier_autorisation_type_detaille = ".$datd; |
|
|
} else { |
|
|
$datd = $this->getVal("dossier_autorisation_type_detaille"); |
|
|
if ($datd != "") { |
|
128 |
$sql_demande_type .= " AND demande_type.dossier_autorisation_type_detaille = ".$datd; |
$sql_demande_type .= " AND demande_type.dossier_autorisation_type_detaille = ".$datd; |
129 |
|
} else { |
130 |
|
$datd = $this->getVal("dossier_autorisation_type_detaille"); |
131 |
|
if ($datd != "") { |
132 |
|
$sql_demande_type .= " AND demande_type.dossier_autorisation_type_detaille = ".$datd; |
133 |
|
} |
134 |
} |
} |
135 |
} |
$sql_demande_type .= " ORDER BY demande_type.libelle"; |
136 |
|
$res = $db->query($sql_demande_type); |
137 |
|
|
138 |
$res = $db->query($sql_demande_type); |
// logger |
139 |
|
$this->f->addToLog("setSelect(): db->query(\"".$sql_demande_type."\");", |
140 |
|
VERBOSE_MODE); |
141 |
|
if ( database::isError($res)){ |
142 |
|
die(); |
143 |
|
} |
144 |
|
|
145 |
// logger |
$contenu[0][0] = ''; |
146 |
$this->f->addToLog("setSelect(): db->query(\"".$sql_demande_type."\");", |
$contenu[1][0] = _('choisir')." "._("demande_type"); |
|
VERBOSE_MODE); |
|
|
if ( database::isError($res)){ |
|
|
die(); |
|
|
} |
|
147 |
|
|
148 |
$contenu[0][0] = ''; |
$k=1; |
149 |
$contenu[1][0] = _('choisir')." "._("demande_type"); |
while($row =& $res->fetchRow()){ |
150 |
|
|
151 |
$k=1; |
$contenu[0][$k] = $row[0]; |
152 |
while($row =& $res->fetchRow()){ |
$contenu[1][$k] = $row[1]; |
153 |
|
$k++; |
154 |
|
} |
155 |
|
|
156 |
$contenu[0][$k] = $row[0]; |
$form->setSelect("demande_type", $contenu); |
|
$contenu[1][$k] = $row[1]; |
|
|
$k++; |
|
157 |
} |
} |
158 |
|
|
|
$form->setSelect("demande_type", $contenu); |
|
|
|
|
159 |
} |
} |
160 |
/* |
/* |
161 |
* Ajout du fielset |
* Ajout du fielset |
198 |
*/ |
*/ |
199 |
function setOnchange(&$form,$maj){ |
function setOnchange(&$form,$maj){ |
200 |
parent::setOnchange($form,$maj); |
parent::setOnchange($form,$maj); |
201 |
|
|
202 |
$form->setOnchange("dossier_autorisation_type_detaille","changeDemandeType();"); |
$form->setOnchange("dossier_autorisation_type_detaille","changeDemandeType();"); |
203 |
$form->setOnchange("demande_type","showFormsDemande();"); |
$form->setOnchange("demande_type","showFormsDemande();"); |
204 |
} |
} |
570 |
if ( database::isError($res)){ |
if ( database::isError($res)){ |
571 |
die(); |
die(); |
572 |
} |
} |
573 |
|
// Attribut permettant de définir si un dossier a été créé |
574 |
|
$this->ajoutDI = FALSE; |
575 |
$dossier_type = $res->fetchRow(DB_FETCHMODE_ASSOC); |
$dossier_type = $res->fetchRow(DB_FETCHMODE_ASSOC); |
576 |
// Création du dossier_autorisation |
// Création du dossier_autorisation |
577 |
if($this->valF['dossier_autorisation'] == "") { |
if($this->valF['dossier_autorisation'] == "") { |
578 |
$this->ajoutDossierAutorisation($id, $db, $val, $DEBUG); |
$this->ajoutDossierAutorisation($id, $db, $val, $DEBUG); |
579 |
$this -> addToMessage(_("Creation du dossier d'autorisation no").$this->valF['dossier_autorisation']); |
$this -> addToMessage(_("Creation du dossier d'autorisation no").$this->valF['dossier_autorisation']); |
580 |
} |
} |
581 |
|
// Enregistrement du numéro dossier existant (il sera écrasé si un DI est créé) |
582 |
|
if ($this->getParameter("idx_dossier") != "") { |
583 |
|
$this->valF['dossier_instruction'] = $this->getParameter("idx_dossier"); |
584 |
|
} |
585 |
// Création du dossier d'instruction |
// Création du dossier d'instruction |
586 |
if($dossier_type['dossier_instruction_type'] != NULL) { |
if($dossier_type['dossier_instruction_type'] != NULL) { |
587 |
$this->ajoutDossierInstruction($id, $db, $val, $DEBUG, $dossier_type['dossier_instruction_type']); |
$this->ajoutDossierInstruction($id, $db, $val, $DEBUG, $dossier_type['dossier_instruction_type']); |
588 |
$this -> addToMessage(_("Creation du dossier d'instruction no").$this->valF['dossier_instruction']); |
$this -> addToMessage(_("Creation du dossier d'instruction no").$this->valF['dossier_instruction']); |
589 |
|
// Attribut permettant de définir si un dossier a été créé. |
590 |
|
$this->ajoutDI = TRUE; |
591 |
|
|
592 |
//Ajout des données techniques au dossier d'instruction |
//Ajout des données techniques au dossier d'instruction |
593 |
$this->ajoutDonneesTechniques($id, $db, $val, $DEBUG); |
$this->ajoutDonneesTechniques($id, $db, $val, $DEBUG); |
664 |
$valInstr['date_retour_controle_legalite']=NULL; |
$valInstr['date_retour_controle_legalite']=NULL; |
665 |
$valInstr['signataire_arrete']=NULL; |
$valInstr['signataire_arrete']=NULL; |
666 |
$valInstr['numero_arrete']=NULL; |
$valInstr['numero_arrete']=NULL; |
667 |
|
$valInstr['code_barres']=NULL; |
668 |
|
$valInstr['om_fichier_instruction']=NULL; |
669 |
|
$valInstr['om_final_instruction']=NULL; |
670 |
|
$valInstr['document_numerise']=NULL; |
671 |
|
|
672 |
/*Fichier requis*/ |
/*Fichier requis*/ |
673 |
require_once '../obj/instruction.class.php'; |
require_once '../obj/instruction.class.php'; |
677 |
$instruction->valF = ""; |
$instruction->valF = ""; |
678 |
$instruction->ajouter($valInstr, $db, $DEBUG); |
$instruction->ajouter($valInstr, $db, $DEBUG); |
679 |
|
|
680 |
|
//Finalisation du document |
681 |
|
$_GET['obj']='instruction'; |
682 |
|
$_GET['idx']=$instruction->valF[$instruction->clePrimaire]; |
683 |
|
$instruction = new instruction($_GET['idx'],$db,$DEBUG); |
684 |
|
$res = $instruction->finaliser('', 1, '', ''); |
685 |
|
|
686 |
/*Si la création a réussie*/ |
/*Si la création a réussie*/ |
687 |
if ( $instruction->valF['instruction'] != "" ){ |
if ( $instruction->valF['instruction'] != "" ){ |
688 |
|
|
690 |
$this->valF['instruction_recepisse'] = $instruction->valF['instruction']; |
$this->valF['instruction_recepisse'] = $instruction->valF['instruction']; |
691 |
$this -> addToMessage("<br/><a |
$this -> addToMessage("<br/><a |
692 |
class='lien' |
class='lien' |
693 |
href='../pdf/pdflettretype.php?obj=".$lettretype."&idx=".$instruction->valF['instruction']."' |
href='" |
694 |
|
.((isset($res['pdf'])&&$instruction->valF['om_final_instruction'])?$res['pdf']: |
695 |
|
"../pdf/pdflettretype.php?obj=".$lettretype."&idx=".$instruction->valF['instruction'])."' |
696 |
target='_blank'> |
target='_blank'> |
697 |
<span |
<span |
698 |
class=\"om-icon om-icon-16 om-icon-fix pdf-16\" |
class=\"om-icon om-icon-16 om-icon-fix pdf-16\" |
729 |
$this->ajoutLiensDossierAutorisation($id, $db, $val, $DEBUG); |
$this->ajoutLiensDossierAutorisation($id, $db, $val, $DEBUG); |
730 |
} |
} |
731 |
// Ajout des lliens entre dossier et demandeur |
// Ajout des lliens entre dossier et demandeur |
732 |
if(!empty($this->valF['dossier_instruction'])) { |
if($this->ajoutDI === TRUE) { |
733 |
$this->ajoutLiensDossierInstruction($id, $db, $val, $DEBUG); |
$this->ajoutLiensDossierInstruction($id, $db, $val, $DEBUG); |
734 |
} |
} |
735 |
|
|