3 |
//gen openMairie le 10/02/2011 20:39 |
//gen openMairie le 10/02/2011 20:39 |
4 |
|
|
5 |
require_once ("../gen/obj/dossier.class.php"); |
require_once ("../gen/obj/dossier.class.php"); |
6 |
|
require_once("../services/outgoing/messageenqueuer.php"); |
7 |
|
|
8 |
class dossier extends dossier_gen { |
class dossier extends dossier_gen { |
9 |
|
|
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 |
// Cle primaire |
|
104 |
$lettre=$this->f->collectivite["lettre"]; |
/*Récupération de la lettre associé au type de dossier d'instruction*/ |
105 |
$numero_unique = $this->f->collectivite["numero_unique"]; |
$code = $this->getCode($this->getDossierInstructionType()); |
106 |
if($numero_unique==1){ |
|
107 |
// numero unique (voir dyn/var.inc) |
/* Récupération de la valeur du suffixe ce dossier_instruction_type */ |
108 |
$temp=$this->$db->nextId(DB_PREFIXE.$this->table); |
$suffixe = $this->getSuffixe($this->getDossierInstructionType()); |
109 |
}else{ |
|
110 |
// numero suivant nature |
/*S'il est à TRUE, on récupère le numéro de version du dossier d'autorisation*/ |
111 |
$temp=$this->db->nextId(DB_PREFIXE."dossier_".$val['nature']); |
$numeroVersion = ""; |
112 |
} |
if ( $suffixe == 't' ){ |
113 |
$temp=str_pad($temp,4,"0", STR_PAD_LEFT); |
|
114 |
$this->valF['dossier'] = $this->valF['nature'].$this->valF['annee']. |
$numeroVersion = $this->getNumeroVersion($val['dossier_autorisation']); |
115 |
$lettre.$temp; |
|
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 |
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'){ |
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 |
396 |
//select |
//select |
397 |
$form->setType('terrain_numero_complement','select'); |
$form->setType('terrain_numero_complement','select'); |
398 |
|
|
|
// combo |
|
|
$form->setType('rivoli','comboD'); |
|
|
$form->setType('terrain_adresse','comboG'); |
|
|
$form->setType('architecte_nom','comboG'); |
|
|
$form->setType('architecte','comboD'); |
|
399 |
|
|
400 |
|
|
401 |
// hiddenstatic |
// hiddenstatic |
423 |
$form->setType('date_conformite','hiddenstaticdate'); |
$form->setType('date_conformite','hiddenstaticdate'); |
424 |
|
|
425 |
// checkbox |
// checkbox |
426 |
$form->setType('sig','checkbox'); |
$form->setType('sig','checkbox'); |
|
$form->setType('delegataire','checkbox'); |
|
|
|
|
|
// mail |
|
|
$form->setType('delegataire_email','mail'); |
|
|
$form->setType('demandeur_email','mail'); |
|
427 |
|
|
428 |
// zones temp et strategysig |
// zones temp et strategysig |
429 |
|
|
442 |
$form->setType('temp3',$temp3_type); |
$form->setType('temp3',$temp3_type); |
443 |
$form->setType('temp4',$temp4_type); |
$form->setType('temp4',$temp4_type); |
444 |
$form->setType('temp5',$temp5_type); |
$form->setType('temp5',$temp5_type); |
445 |
|
$form->setType('a_qualifier', 'checkbox'); |
446 |
|
} |
447 |
|
if ($maj == 1) { |
448 |
|
// |
449 |
|
if ($this->f->isAccredited("dossier_modifier_instructeur")) { |
450 |
|
$form->setType('instructeur', 'select'); |
451 |
|
} else { |
452 |
|
$form->setType('instructeur', 'selecthiddenstatic'); |
453 |
|
} |
454 |
|
// |
455 |
|
if($this->f->getParameter('afficher_division') === 'true') { |
456 |
|
// |
457 |
|
if ($this->f->isAccredited("dossier_modifier_division")) { |
458 |
|
$form->setType('division', 'select'); |
459 |
|
} else { |
460 |
|
$form->setType('division', 'selecthiddenstatic'); |
461 |
|
} |
462 |
|
} else { |
463 |
|
$form->setType('division', 'hidden'); |
464 |
|
} |
465 |
} |
} |
466 |
if($maj == 3) { |
if($maj == 3) { |
467 |
$form->setType('annee', 'hidden'); |
$form->setType('annee', 'hidden'); |
|
$form->setType('nature', 'selectstatic'); |
|
468 |
$form->setType('temp1','hidden'); |
$form->setType('temp1','hidden'); |
469 |
$form->setType('temp2','hidden'); |
$form->setType('temp2','hidden'); |
470 |
$form->setType('temp3','hidden'); |
$form->setType('temp3','hidden'); |
474 |
$form->setType('parcelle_lot_archive','hidden'); |
$form->setType('parcelle_lot_archive','hidden'); |
475 |
$form->setType('geom1','hidden'); |
$form->setType('geom1','hidden'); |
476 |
$form->setType('geom','hidden'); |
$form->setType('geom','hidden'); |
477 |
|
$form->setType('a_qualifier', 'checkboxstatic'); |
478 |
} |
} |
479 |
if($this->f->getParameter('afficher_division')==='true') { |
// |
480 |
$form->setType('division','hiddenstatic'); |
if(!$this->f->getParameter('afficher_division') === 'true') { |
481 |
} else { |
$form->setType('division', 'hidden'); |
482 |
$form->setType('division','hidden'); |
} |
483 |
|
$form->setType('dossier_autorisation', 'hiddenstatic'); |
484 |
|
$form->setType('dossier_instruction_type', 'selecthiddenstatic'); |
485 |
|
// |
486 |
|
if ($maj == 0) { |
487 |
|
$form->setType('dossier_autorisation', 'select'); |
488 |
|
} |
489 |
|
// On cache enjeu_ERP si l'option n'est pas activée |
490 |
|
if($this->f->getParameter('option_ERP') != 'true') { |
491 |
|
$form->setType('erp', 'hidden'); |
492 |
|
$form->setType('enjeu_erp', 'hidden'); |
493 |
} |
} |
|
|
|
|
/* Gestion des droits pour l'ajout forcé d'un instructeur, si le profil est 5, c'est un administrateur */ |
|
|
if ( !$this->f->isAccredited("dossier_modifier_instructeur") ) |
|
|
$form->setType('instructeur', 'hidden'); |
|
494 |
} |
} |
495 |
|
|
496 |
function setVal(&$form,$maj,$validation){ |
function setVal(&$form,$maj,$validation){ |
499 |
if ($maj == 0){ |
if ($maj == 0){ |
500 |
//$dossier_cp = $this->f->collectivite["cp"]; |
//$dossier_cp = $this->f->collectivite["cp"]; |
501 |
//$dossier_ville = $this->f->collectivite["ville"]; |
//$dossier_ville = $this->f->collectivite["ville"]; |
|
//$form->setVal('nature', $this->nature); |
|
502 |
|
|
503 |
$form->setVal('annee', date('y')); |
$form->setVal('annee', date('y')); |
504 |
$form->setVal('date_demande', date('Y-m-d')); |
$form->setVal('date_demande', date('Y-m-d')); |
526 |
if(file_exists ("../sql/".$db->phptype."/".$this->table.".form.inc.php")) |
if(file_exists ("../sql/".$db->phptype."/".$this->table.".form.inc.php")) |
527 |
include ("../sql/".$db->phptype."/".$this->table.".form.inc.php"); |
include ("../sql/".$db->phptype."/".$this->table.".form.inc.php"); |
528 |
if($maj<2){ |
if($maj<2){ |
|
// travaux |
|
|
$contenu=array(); |
|
|
// prise en compte du solde en ajout |
|
|
if($maj==0) |
|
|
$sql_travaux = $sql_travaux. |
|
|
" and solde = 'Non' order by libelle"; |
|
|
else |
|
|
$sql_travaux = $sql_travaux. |
|
|
" order by libelle"; |
|
|
$res = $db->query($sql_travaux); |
|
|
if (database::isError($res)) die($res->getMessage()).$sql_travaux; |
|
|
$this->addToLog(" la requete ".$sql_travaux." est executee", VERBOSE_MODE); |
|
|
$contenu[0][0]=""; |
|
|
$contenu[1][0]=_('choisir')." "._('travaux'); |
|
|
$k=1; |
|
|
while ($row=& $res->fetchRow()){ |
|
|
$contenu[0][$k]=$row[0]; |
|
|
$contenu[1][$k]=$row[1]; |
|
|
$k++; |
|
|
} |
|
|
$form->setSelect("travaux",$contenu); |
|
|
|
|
|
// code et libelle voie |
|
|
$contenu=""; |
|
|
$contenu[0][0]="rivoli";// table |
|
|
$contenu[0][1]="rivoli"; // zone origine |
|
|
$contenu[1][0]="libelle"; |
|
|
$contenu[1][1]="terrain_adresse"; |
|
|
$form->setSelect("rivoli",$contenu); |
|
|
//terrain_adresse |
|
|
$contenu=""; |
|
|
$contenu[0][0]="rivoli";// table |
|
|
$contenu[0][1]="libelle"; // zone origine |
|
|
$contenu[1][0]="rivoli"; |
|
|
$contenu[1][1]="rivoli"; |
|
|
$form->setSelect("terrain_adresse",$contenu); |
|
|
// code et libelle architecte |
|
|
$contenu=""; |
|
|
$contenu[0][0]="architecte";// table |
|
|
$contenu[0][1]="architecte"; // zone origine |
|
|
$contenu[1][0]="nom"; |
|
|
$contenu[1][1]="architecte_nom"; |
|
|
$form->setSelect("architecte",$contenu); |
|
|
$contenu=""; |
|
|
$contenu[0][0]="architecte";// table |
|
|
$contenu[0][1]="nom"; // zone origine |
|
|
$contenu[1][0]="architecte"; |
|
|
$contenu[1][1]="architecte"; |
|
|
$form->setSelect("architecte_nom",$contenu); |
|
529 |
// parcelle_lot |
// parcelle_lot |
530 |
$contenu=""; |
$contenu=""; |
531 |
$contenu[0][0]="parcelle_lot";// table |
$contenu[0][0]="parcelle_lot";// table |
555 |
$contenu[0]=array("dossier",$this->getParameter("idx")); |
$contenu[0]=array("dossier",$this->getParameter("idx")); |
556 |
$form->setSelect('geom',$contenu); |
$form->setSelect('geom',$contenu); |
557 |
} |
} |
558 |
|
// arrondissement recherche anvancée |
559 |
|
$this->init_select($form, $db, $maj, $debug, "arrondissement", |
560 |
|
$sql_arrondissement, $sql_arrondissement_by_id, false); |
561 |
|
// dossier_autorisation_type_detaille recherche anvancée |
562 |
|
$this->init_select($form, $db, $maj, $debug, "dossier_autorisation_type_detaille", |
563 |
|
$sql_dossier_autorisation_type_detaille, $sql_dossier_autorisation_type_detaille_by_id, false); |
564 |
/* |
/* |
565 |
* Affichage de données dans le select de la parcelle |
* Affichage de données dans le select de la parcelle |
566 |
* */ |
* */ |
593 |
} |
} |
594 |
|
|
595 |
function setGroupe(&$form,$maj){ |
function setGroupe(&$form,$maj){ |
|
If ($maj==0){ |
|
|
$form->setGroupe('date_demande','D'); |
|
|
$form->setGroupe('date_depot','G'); |
|
|
$form->setGroupe('division','F'); |
|
|
}else{ |
|
|
$form->setGroupe('dossier','D'); |
|
|
$form->setGroupe('nature','G'); |
|
|
$form->setGroupe('annee','G'); |
|
|
$form->setGroupe('date_demande','G'); |
|
|
$form->setGroupe('date_depot','G'); |
|
|
$form->setGroupe('division','F'); |
|
|
} |
|
|
$form->setGroupe('demandeur_categorie','D'); |
|
|
$form->setGroupe('demandeur_civilite','G'); |
|
|
$form->setGroupe('demandeur_nom','F'); |
|
|
|
|
|
$form->setGroupe('demandeur_societe','D'); |
|
|
$form->setGroupe('demandeur_adresse','G'); |
|
|
$form->setGroupe('demandeur_adresse_complement','F'); |
|
|
|
|
|
$form->setGroupe('demandeur_cp','D'); |
|
|
$form->setGroupe('demandeur_ville','G'); |
|
|
$form->setGroupe('demandeur_pays','F'); |
|
|
|
|
|
$form->setGroupe('demandeur_email','D'); |
|
|
$form->setGroupe('demandeur_telephone','F'); |
|
|
|
|
|
$form->setGroupe('delegataire','D'); |
|
|
$form->setGroupe('delegataire_civilite','G'); |
|
|
$form->setGroupe('delegataire_nom','F'); |
|
|
|
|
|
$form->setGroupe('delegataire_societe','D'); |
|
|
$form->setGroupe('delegataire_adresse','G'); |
|
|
$form->setGroupe('delegataire_adresse_complement','F'); |
|
|
$form->setGroupe('delegataire_cp','D'); |
|
|
$form->setGroupe('delegataire_ville','G'); |
|
|
$form->setGroupe('delegataire_pays','F'); |
|
|
|
|
|
$form->setGroupe('delegataire_email','D'); |
|
|
$form->setGroupe('delegataire_telephone','F'); |
|
|
|
|
|
$form->setGroupe('architecte','D'); |
|
|
$form->setGroupe('architecte_nom','F'); |
|
|
//$form->setGroupe('saisie_architecte','F'); |
|
|
|
|
|
$form->setGroupe('travaux','D'); |
|
|
$form->setGroupe('travaux_complement','F'); |
|
|
|
|
|
// terrain |
|
|
$form->setGroupe('terrain_numero','D'); |
|
|
$form->setGroupe('terrain_numero_complement','G'); |
|
|
$form->setGroupe('rivoli','F'); |
|
|
$form->setGroupe('terrain_adresse','D'); |
|
|
$form->setGroupe('terrain_adresse_complement','F'); |
|
|
|
|
|
$form->setGroupe('terrain_cp','D'); |
|
|
$form->setGroupe('terrain_ville','F'); |
|
|
|
|
|
// surface |
|
|
$form->setGroupe('terrain_surface','D'); |
|
|
$form->setGroupe('terrain_surface_calcul','F'); |
|
|
|
|
596 |
// instruction |
// instruction |
597 |
$form->setGroupe('date_complet','D'); |
$form->setGroupe('date_complet','D'); |
598 |
$form->setGroupe('date_rejet','G'); |
$form->setGroupe('date_rejet','G'); |
658 |
$form->setOnchange('terrain_surface','VerifNumdec(this)'); |
$form->setOnchange('terrain_surface','VerifNumdec(this)'); |
659 |
} |
} |
660 |
|
|
661 |
function setRegroupe(&$form,$maj){ |
function setLayout(&$form, $maj) { |
662 |
// depot |
// |
663 |
If ($maj==0){ |
$form->setBloc('dossier', 'D', '', ($maj == 3 ? 'col_9':'col_12')); |
664 |
$form->setRegroupe('date_demande','D',_("Depot"),$this->aff_depot ); |
$form->setBloc('dossier', 'D', '', 'col_9'); |
665 |
} |
$form->setFieldset('dossier', 'D', _("Dossier d'instruction")); |
666 |
If ($maj==1){ |
$form->setFieldset('autorite_competente', 'F'); |
667 |
$form->setRegroupe('dossier','D',_("Depot"), $this->aff_depot); |
$form->setBloc('autorite_competente', 'F'); |
668 |
$form->setRegroupe('date_demande','G',''); |
$form->setBloc('date_demande', 'D', '', 'col_3'); |
669 |
} |
$form->setFieldset('date_demande', 'D', _("Depot")); |
670 |
$form->setRegroupe('date_depot','G',''); |
$form->setFieldset('date_depot', 'F'); |
671 |
$form->setRegroupe('division','F',''); |
$form->setFieldset('enjeu_urba', 'D', _("Enjeu")); |
672 |
|
$form->setFieldset('enjeu_erp', 'F'); |
673 |
// travaux |
$form->setBloc('enjeu_erp', 'F'); |
674 |
$form->setRegroupe('architecte','D',_('Architecte')." / "._("Travaux"), $this->aff_travaux); |
$form->setBloc('enjeu_erp', 'F'); |
675 |
$form->setRegroupe('architecte_nom','G',''); |
// |
676 |
$form->setRegroupe('travaux','G',''); |
$form->setBloc('objet_dossier', 'D', '', 'col_12'); |
677 |
$form->setRegroupe('travaux_complement','F',''); |
// |
678 |
|
$form->setFieldset('date_complet', 'D', _('Instruction'), 'col_12'); |
|
// instruction |
|
|
$form->setRegroupe('date_complet','D',_('Instruction'), $this->aff_instruction); |
|
|
$form->setRegroupe('date_rejet','G',''); |
|
|
$form->setRegroupe('date_notification_delai','G',''); |
|
|
$form->setRegroupe('delai','G',''); |
|
|
$form->setRegroupe('date_limite','G','Decision '); |
|
|
$form->setRegroupe('accord_tacite','G',''); |
|
|
$form->setRegroupe('etat','G',''); |
|
|
$form->setRegroupe('date_decision','G',''); |
|
|
$form->setRegroupe('avis_decision','G',''); |
|
|
$form->setRegroupe('date_validite','G',''); |
|
|
$form->setRegroupe('types','G',''); |
|
|
$form->setRegroupe('date_chantier','G',''); |
|
|
$form->setRegroupe('date_achevement','G',''); |
|
679 |
$form->setRegroupe('date_conformite','F',''); |
$form->setRegroupe('date_conformite','F',''); |
680 |
|
// |
681 |
|
$form->setBloc('date_conformite', 'F'); |
682 |
|
|
683 |
// demandeur |
$form->setBloc('parcelle','D',"", "col_12"); |
684 |
$form->setRegroupe('demandeur_categorie','D',_('Demandeur'), $this->aff_demandeur); |
$form->setBloc('a_qualifier','F'); |
|
$form->setRegroupe('demandeur_civilite','G',''); |
|
|
$form->setRegroupe('demandeur_nom','G',''); |
|
|
$form->setRegroupe('demandeur_societe','G',''); |
|
|
$form->setRegroupe('demandeur_adresse','G','Decision '); |
|
|
$form->setRegroupe('demandeur_cp','G',''); |
|
|
$form->setRegroupe('demandeur_ville','G',''); |
|
|
$form->setRegroupe('demandeur_pays','G',''); |
|
|
$form->setRegroupe('demandeur_email','G',''); |
|
|
$form->setRegroupe('demandeur_telephone','F',''); |
|
|
|
|
|
|
|
|
// delegataire |
|
|
$form->setRegroupe('delegataire','D',_('delegataire'), $this->aff_delegataire); |
|
|
$form->setRegroupe('delegataire_civilite','G',''); |
|
|
$form->setRegroupe('delegataire_nom','G',''); |
|
|
$form->setRegroupe('delegataire_societe','G',''); |
|
|
$form->setRegroupe('delegataire_adresse','G','Decision '); |
|
|
$form->setRegroupe('delegataire_cp','G',''); |
|
|
$form->setRegroupe('delegataire_ville','G',''); |
|
|
$form->setRegroupe('delegataire_pays','G',''); |
|
|
$form->setRegroupe('delegataire_email','G',''); |
|
|
$form->setRegroupe('delegataire_telephone','F',''); |
|
|
|
|
|
// terrain |
|
|
$form->setRegroupe('terrain_numero','D',_('terrain'), $this->aff_terrain); |
|
|
$form->setRegroupe('terrain_numero_complement','G',''); |
|
|
$form->setRegroupe('rivoli','G',''); |
|
|
$form->setRegroupe('terrain_adresse','G',''); |
|
|
$form->setRegroupe('terrain_adresse_complement','G',''); |
|
|
$form->setRegroupe('terrain_cp','G',''); |
|
|
$form->setRegroupe('terrain_ville','G',''); |
|
|
$form->setRegroupe('terrain_surface','G',_('surface'),'');// $this->aff_surface); |
|
|
$form->setRegroupe('terrain_surface_calcul','F',''); |
|
|
|
|
|
// localisation |
|
|
$form->setRegroupe('parcelle','D',_('localisation'), $this->aff_localisation); |
|
|
$form->setRegroupe('pos','G',''); |
|
|
$form->setRegroupe('sig','F',''); |
|
|
if($maj==1){ |
|
|
$form->setRegroupe('sig','G',''); |
|
|
$form->setRegroupe('geom','F',''); |
|
|
} |
|
685 |
|
|
686 |
// description |
//Fieldset "Localisation du terrain" |
687 |
$form->setRegroupe('batiment_nombre','D',_('statistique'), $this->aff_description); |
$form->setBloc('terrain_references_cadastrales','D',"","col_12"); |
688 |
$form->setRegroupe('logement_nombre','G',''); |
$form->setFieldset('terrain_references_cadastrales','D',_('Localisation du terrain')); |
689 |
$form->setRegroupe('hauteur','G',''); |
$form->setFieldset('terrain_superficie','F',''); |
690 |
$form->setRegroupe('piece_nombre','G',''); |
$form->setBloc('terrain_superficie','F'); |
691 |
$form->setRegroupe('shon','G',''); |
} |
692 |
$form->setRegroupe('shon_calcul','G',''); |
|
693 |
$form->setRegroupe('shob','G',''); |
function setRegroupe(&$form,$maj) { |
694 |
$form->setRegroupe('lot','F',''); |
//// depot |
695 |
|
//If ($maj==0){ |
696 |
|
// $form->setRegroupe('date_demande','D',_("Depot"),$this->aff_depot ); |
697 |
|
//} |
698 |
|
//If ($maj==1){ |
699 |
|
// $form->setRegroupe('dossier','D',_("Depot"), $this->aff_depot); |
700 |
|
// $form->setRegroupe('date_demande','G',''); |
701 |
|
//} |
702 |
|
//$form->setRegroupe('date_depot','G',''); |
703 |
|
//$form->setRegroupe('division','F',''); |
704 |
|
|
705 |
|
|
706 |
|
|
707 |
$form->setRegroupe('description','D',_('description').' '._('servitude'), $this->aff_amenagement); |
$form->setRegroupe('description','D',_('description').' '._('servitude'), $this->aff_amenagement); |
708 |
$form->setRegroupe('servitude','F',''); |
$form->setRegroupe('servitude','F',''); |
711 |
$form->setRegroupe('amenagement','D',_('Amenagement'), $this->aff_amenagement); |
$form->setRegroupe('amenagement','D',_('Amenagement'), $this->aff_amenagement); |
712 |
$form->setRegroupe('parcelle_lot','G',''); |
$form->setRegroupe('parcelle_lot','G',''); |
713 |
$form->setRegroupe('parcelle_lot_lotissement','F',''); |
$form->setRegroupe('parcelle_lot_lotissement','F',''); |
714 |
|
|
715 |
} |
} |
716 |
|
|
|
|
|
|
|
|
717 |
/* ============================================================= |
/* ============================================================= |
718 |
* fonction trigger relative a la connexion SIG |
* fonction trigger relative a la connexion SIG |
719 |
* $sig = 1 dans dyn/var.inc |
* $sig = 1 dans dyn/var.inc |
720 |
|
* utilisé aussi pour envoyer une message au service REST d'ERP |
721 |
* =============================================================== |
* =============================================================== |
722 |
*/ |
*/ |
723 |
|
|
733 |
$this->addToMessage("<br>"._("Parcelle non renseignee dans dossier")." ".$id." <br>"); |
$this->addToMessage("<br>"._("Parcelle non renseignee dans dossier")." ".$id." <br>"); |
734 |
|
|
735 |
} |
} |
736 |
|
|
737 |
|
|
738 |
|
if ($this->f->getParameter('option_erp') != "") { |
739 |
|
// envoi du message a ERP en cas d'un depot du dossier dat |
740 |
|
if ($this->getDATDCode($this->valF['dossier']) == |
741 |
|
$this->f->getParameter('erp_depot_dossier_dat')) { |
742 |
|
$msgenque = new MessageEnqueuer(); |
743 |
|
$msgenque->setDossierInstructionIdentifier($this->valF['dossier']); |
744 |
|
$msgenque->enqueueMessage($msgenque::$ERP_DEPOT_DOSSIER_DAT); |
745 |
|
} |
746 |
|
|
747 |
|
// envoi du message a ERP en cas d'une demande d'ouverture DAT |
748 |
|
if ($this->getDATDCode($this->valF['dossier']) == |
749 |
|
$this->f->getParameter('erp_demande_ouverture_dat')) { |
750 |
|
$msgenque = new MessageEnqueuer(); |
751 |
|
$msgenque->setDossierInstructionIdentifier($this->valF['dossier']); |
752 |
|
$msgenque->enqueueMessage($msgenque::$ERP_DEMANDE_OUVERTURE_DAT); |
753 |
|
} |
754 |
|
|
755 |
|
if ($this->valF['erp'] === true) { |
756 |
|
// envoi du message a ERP en cas d'annulation d'une demande |
757 |
|
if ($this->getDATDCode($this->valF['dossier']) == |
758 |
|
$this->f->getParameter('erp_annulation_demande')) { |
759 |
|
$msgenque = new MessageEnqueuer(); |
760 |
|
$msgenque->setDossierInstructionIdentifier($this->valF['dossier']); |
761 |
|
$msgenque->enqueueMessage($msgenque::$ERP_ANNULATION_DEMANDE); |
762 |
|
} |
763 |
|
|
764 |
|
// envoi du message a ERP en cas d'ouverture d'un dossier PC "rattache" |
765 |
|
// au dossier DAACT |
766 |
|
if ($this->getDATDCode($this->valF['dossier']) == |
767 |
|
$this->f->getParameter('erp_demande_ouverture_pc_daact')) { |
768 |
|
$msgenque = new MessageEnqueuer(); |
769 |
|
$msgenque->setDossierInstructionIdentifier($this->valF['dossier']); |
770 |
|
$msgenque->enqueueMessage($msgenque::$ERP_DEMANDE_OUVERTURE_PC); |
771 |
|
} |
772 |
|
} |
773 |
|
} // fin de if ($this->f->getParameter('option_erp') != "") |
774 |
} |
} |
775 |
|
|
776 |
/* |
/* |
777 |
* Calcul l'identifiant du quartier et d'un arrondissement d'une parcelle |
* Calcul l'identifiant du quartier et d'un arrondissement d'une parcelle |
778 |
* */ |
* */ |
779 |
function getQuartierArrondissement($parcelle, &$quartier, &$arrondissement, &$db) { |
function getQuartierArrondissement($parcelle) { |
780 |
|
|
781 |
$parcelle = trim($parcelle); |
$parcelle = trim($parcelle); |
782 |
$quartier = ''; |
$quartier = ''; |
783 |
|
|
784 |
/*Code impots*/ |
/*Récupère le code impot du quartier dans la parcelle*/ |
785 |
for ( $i = 0 ; $i < strlen($parcelle) ; $i++ ) |
for ( $i = 0 ; $i < strlen($parcelle) ; $i++ ){ |
786 |
if (is_numeric($parcelle[$i]) ) |
|
787 |
|
if (is_numeric($parcelle[$i]) ){ |
788 |
|
|
789 |
$quartier .= $parcelle[$i]; |
$quartier .= $parcelle[$i]; |
790 |
else |
} |
791 |
|
else{ |
792 |
|
|
793 |
break; |
break; |
794 |
|
} |
795 |
|
} |
796 |
|
|
797 |
if ( $quartier !== '' ){ |
if ( $quartier !== '' ){ |
798 |
|
|
800 |
$sql = "SELECT |
$sql = "SELECT |
801 |
quartier, arrondissement |
quartier, arrondissement |
802 |
FROM |
FROM |
803 |
quartier |
".DB_PREFIXE."quartier |
804 |
WHERE |
WHERE |
805 |
code_impots='$quartier'"; |
code_impots='$quartier'"; |
806 |
|
|
807 |
$res = $db->query($sql); |
$this->addToLog("getQuartierArrondissement(parcelle) : db->query(\"$sql\")", VERBOSE_MODE); |
808 |
|
$res = $this->db->query($sql); |
809 |
if (database :: isError($res)) |
if (database :: isError($res)) |
810 |
die($res->getMessage()."erreur ".$sql); |
die($res->getMessage()."erreur ".$sql); |
811 |
|
|
812 |
if ( $res->numRows() > 0 ){ |
if ( $res->numRows() > 0 ){ |
813 |
|
|
814 |
while ($row=& $res->fetchRow(DB_FETCHMODE_ASSOC)){ |
return $res->fetchRow(DB_FETCHMODE_ASSOC); |
|
|
|
|
$quartier = $row['quartier']; |
|
|
$arrondissement = $row['arrondissement']; |
|
|
} |
|
815 |
} |
} |
816 |
} |
} |
817 |
|
|
818 |
|
return NULL; |
819 |
} |
} |
820 |
|
|
821 |
/* |
/* |
836 |
/* |
/* |
837 |
* Retourne l'intructeur correspondant le mieux à la parcelle |
* Retourne l'intructeur correspondant le mieux à la parcelle |
838 |
* */ |
* */ |
839 |
function getInstructeur( $quartier, $arrondissement, $section, $nature, &$db) { |
function getInstructeurDivision( $quartier, $arrondissement, $section, $dossier_autorisation) { |
840 |
|
|
841 |
|
$quartier = ( $quartier == NULL ) ? -1 : $quartier; |
842 |
|
$arrondissement = ( $arrondissement == NULL ) ? -1 : $arrondissement; |
843 |
|
|
844 |
|
/*Récupération du dossier_autorisation_type_detaille concerné par le $dossier_autorisation*/ |
845 |
$sql = " |
$sql = " |
846 |
SELECT |
SELECT |
847 |
instructeur, section, quartier, arrondissement, nature |
dossier_autorisation_type_detaille |
848 |
FROM |
FROM |
849 |
lien_localisation_nature l |
".DB_PREFIXE."dossier_autorisation |
850 |
WHERE |
WHERE |
851 |
( 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 |
|
|
"; |
|
|
|
|
|
$res = $db->query($sql); |
|
|
if (database :: isError($res)) |
|
|
die($res->getMessage()."erreur ".$sql); |
|
852 |
|
|
853 |
if ( $res->numRows() > 0 ){ |
$this->addToLog("getInstructeurDivision : db->query(\"$sql\")", VERBOSE_MODE); |
854 |
$row=& $res->fetchRow(DB_FETCHMODE_ASSOC); |
$resDATD = $this->db->query($sql); |
855 |
return $row['instructeur']; |
if (database :: isError($resDATD)) |
856 |
} |
die($resDATD->getMessage()."erreur ".$sql); |
857 |
|
|
858 |
|
if ( $resDATD->numRows() > 0 ){ |
859 |
|
$rowDATD = $resDATD->fetchRow(DB_FETCHMODE_ASSOC); |
860 |
|
|
861 |
|
$sql = " |
862 |
|
SELECT |
863 |
|
instructeur, section, quartier, arrondissement, dossier_autorisation_type_detaille |
864 |
|
FROM |
865 |
|
".DB_PREFIXE."affectation_automatique l |
866 |
|
WHERE |
867 |
|
( dossier_autorisation_type_detaille IS NULL AND arrondissement IS NULL AND quartier IS NULL AND section IS NULL ) OR |
868 |
|
( dossier_autorisation_type_detaille IS NULL AND arrondissement IS NULL AND quartier IS NULL AND section = '$section' ) OR |
869 |
|
( dossier_autorisation_type_detaille IS NULL AND arrondissement IS NULL AND quartier = $quartier AND section IS NULL ) OR |
870 |
|
( dossier_autorisation_type_detaille IS NULL AND arrondissement IS NULL AND quartier = $quartier AND section = '$section' ) OR |
871 |
|
( dossier_autorisation_type_detaille IS NULL AND arrondissement = $arrondissement AND quartier IS NULL AND section IS NULL ) OR |
872 |
|
( dossier_autorisation_type_detaille IS NULL AND arrondissement = $arrondissement AND quartier IS NULL AND section = '$section' ) OR |
873 |
|
( dossier_autorisation_type_detaille IS NULL AND arrondissement = $arrondissement AND quartier = $quartier AND section IS NULL ) OR |
874 |
|
( dossier_autorisation_type_detaille IS NULL AND arrondissement = $arrondissement AND quartier = $quartier AND section = '$section' ) OR |
875 |
|
( dossier_autorisation_type_detaille = ".$rowDATD['dossier_autorisation_type_detaille']." AND arrondissement IS NULL AND quartier IS NULL AND section IS NULL ) OR |
876 |
|
( dossier_autorisation_type_detaille = ".$rowDATD['dossier_autorisation_type_detaille']." AND arrondissement IS NULL AND quartier IS NULL AND section = '$section' ) OR |
877 |
|
( dossier_autorisation_type_detaille = ".$rowDATD['dossier_autorisation_type_detaille']." AND arrondissement IS NULL AND quartier = $quartier AND section IS NULL ) OR |
878 |
|
( dossier_autorisation_type_detaille = ".$rowDATD['dossier_autorisation_type_detaille']." AND arrondissement IS NULL AND quartier = $quartier AND section = '$section' ) OR |
879 |
|
( dossier_autorisation_type_detaille = ".$rowDATD['dossier_autorisation_type_detaille']." AND arrondissement = $arrondissement AND quartier IS NULL AND section IS NULL ) OR |
880 |
|
( dossier_autorisation_type_detaille = ".$rowDATD['dossier_autorisation_type_detaille']." AND arrondissement = $arrondissement AND quartier IS NULL AND section = '$section' ) OR |
881 |
|
( dossier_autorisation_type_detaille = ".$rowDATD['dossier_autorisation_type_detaille']." AND arrondissement = $arrondissement AND quartier = $quartier AND section IS NULL ) OR |
882 |
|
( dossier_autorisation_type_detaille = ".$rowDATD['dossier_autorisation_type_detaille']." AND arrondissement = $arrondissement AND quartier = $quartier AND section = '$section' ) |
883 |
|
ORDER BY section, quartier, arrondissement, dossier_autorisation_type_detaille |
884 |
|
LIMIT 1 |
885 |
|
"; |
886 |
|
|
887 |
|
$this->addToLog("getInstructeurDivision : db->query(\"$sql\")", VERBOSE_MODE); |
888 |
|
$res = $this->db->query($sql); |
889 |
|
if (database :: isError($res)) |
890 |
|
die($res->getMessage()."erreur ".$sql); |
891 |
|
|
892 |
|
if ( $res->numRows() > 0 ){ |
893 |
|
|
894 |
|
$row = $res->fetchRow(DB_FETCHMODE_ASSOC); |
895 |
|
|
896 |
|
$sql = "SELECT division FROM ".DB_PREFIXE."instructeur WHERE instructeur = ".$row['instructeur']; |
897 |
|
$res = $this->db->query($sql); |
898 |
|
if (database :: isError($res)) |
899 |
|
die($res->getMessage()."erreur ".$sql); |
900 |
|
|
901 |
|
if ( $res->numRows() > 0 ){ |
902 |
|
|
903 |
|
$rowT=& $res->fetchRow(DB_FETCHMODE_ASSOC); |
904 |
|
$row['division'] = $rowT['division']; |
905 |
|
} |
906 |
|
|
907 |
|
return $row; |
908 |
|
} |
909 |
|
} |
910 |
|
|
911 |
return NULL; |
return NULL; |
912 |
} |
} |
913 |
|
|
918 |
*/ |
*/ |
919 |
|
|
920 |
function triggerajouter($id,&$db,$val,$DEBUG) { |
function triggerajouter($id,&$db,$val,$DEBUG) { |
921 |
|
// |
922 |
|
$this->addToLog("triggerajouter() : start", EXTRA_VERBOSE_MODE); |
923 |
|
|
924 |
|
// Initialisation des variables nécessaires à l'affectation automatique |
925 |
|
$quartier = NULL; |
926 |
|
$arrondissement = NULL; |
927 |
|
$section = NULL; |
928 |
|
$instructeur = NULL; |
929 |
|
|
930 |
|
// Si la parcelle n'est pas vide alors on récupère la section, le |
931 |
|
// quartier et l'arrondissement |
932 |
|
if ($val['parcelle'] != '') { |
933 |
|
// Cette méthode récupère l'arrondissement et le quartier associé à une parcelle |
934 |
|
$quartierArrondissement = $this->getQuartierArrondissement($val['parcelle']); |
935 |
|
if ( $quartierArrondissement!= NULL ){ |
936 |
|
|
937 |
/*Localisation*/ |
$quartier = $quartierArrondissement['quartier']; |
938 |
$quartier = 'NULL'; |
$arrondissement = $quartierArrondissement['arrondissement']; |
939 |
$arrondissement = 'NULL'; |
} |
940 |
$section = 'NULL' ; |
// Si il n'y a pas d'arrondissement alors on vide le quartier |
941 |
|
if ( strcmp($arrondissement,'') == 0 ) { |
942 |
if($val['parcelle']!=''){ |
|
943 |
|
$arrondissement = NULL; |
944 |
$this->getQuartierArrondissement($val['parcelle'], $quartier, $arrondissement, $db); |
$quartier = NULL; |
945 |
|
} |
946 |
if ( strcmp($arrondissement,'NULL') == 0 ) |
// On récupère la section |
|
$quartier = 'NULL'; |
|
|
|
|
947 |
$section = $this->getSection($val['parcelle']); |
$section = $this->getSection($val['parcelle']); |
|
|
|
|
|
|
948 |
} |
} |
949 |
|
|
950 |
/*Instructeur*/ |
// Si aucun instructeur n'est saisi et que la dossier_autorisation_type_detaille n'est pas vide |
951 |
if ( ( empty($this->valF['instructeur']) || $this->valF['instructeur'] == '' ) && $val['nature'] != '' ){ |
// alors on récupère l'instructeur et la division depuis l'affectation |
952 |
|
if ( ( empty($this->valF['instructeur']) || $this->valF['instructeur'] == '' ) && $val['dossier_autorisation'] != '' ) { |
953 |
$instructeur = $this->getInstructeur($quartier, $arrondissement, $section, $val['nature'], $db); |
|
954 |
|
// |
955 |
|
$instructeurDivision = $this->getInstructeurDivision($quartier, $arrondissement, $section, $val['dossier_autorisation']); |
956 |
|
if ( $instructeurDivision != NULL ){ |
957 |
|
|
958 |
|
$instructeur = $instructeurDivision['instructeur']; |
959 |
|
$division = $instructeurDivision['division']; |
960 |
|
} |
961 |
|
|
962 |
if ( $instructeur != NULL ) |
if ( $instructeur != NULL ){ |
963 |
|
|
964 |
$this->valF['instructeur'] = $instructeur; |
$this->valF['instructeur'] = $instructeur; |
965 |
else { |
$this->valF['division'] = $division; |
966 |
if ( is_numeric($_SESSION['profil']) && $_SESSION['profil'] == 5 ) |
} else { |
967 |
|
if ($this->f->isAccredited("dossier_modifier_instructeur")) { |
968 |
$this->addToMessage("<br/> "._("Pensez a assigner un instructeur a ce dossier.")." <br/>"); |
$this->addToMessage("<br/> "._("Pensez a assigner un instructeur a ce dossier.")." <br/>"); |
969 |
else |
} else { |
970 |
$this->addToMessage("<br/> "._("Aucun instructeur compatible avec ce dossier trouve, contactez votre administrateur afin d'en assigner un a ce dossier.")." <br/>"); |
$this->addToMessage("<br/> "._("Aucun instructeur compatible avec ce dossier trouve, contactez votre administrateur afin d'en assigner un a ce dossier.")." <br/>"); |
971 |
|
} |
972 |
} |
} |
973 |
|
} else { |
974 |
|
$this->addToMessage("<br/> "._("Aucun instructeur compatible avec ce dossier trouve, contactez votre administrateur afin d'en assigner un a ce dossier.")." <br/>"); |
975 |
} |
} |
976 |
|
// |
977 |
else |
$this->addToLog("triggerajouter() : end", EXTRA_VERBOSE_MODE); |
|
$this->addToMessage("<br/> "._("Aucun instructeur compatible avec ce dossier trouve, contactez votre administrateur afin d'en assigner un a ce dossier.")." <br/>"); |
|
978 |
} |
} |
979 |
|
|
980 |
function triggermodifierapres($id,&$db,$val,$DEBUG) { |
function triggermodifierapres($id,&$db,$val,$DEBUG) { |
994 |
} |
} |
995 |
$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>"); |
996 |
} |
} |
997 |
} |
} |
998 |
|
|
999 |
|
// verification si envoi vers ERP est active |
1000 |
|
if ($this->f->getParameter('option_erp') != "") { |
1001 |
|
if ($this->val[array_search('a_qualifier', $this->champs)] == 't' |
1002 |
|
&& $this->valF['a_qualifier'] === false) { |
1003 |
|
|
1004 |
|
// envoi du message "ERP Qualifie" pour un dossier DAT qui a besoin |
1005 |
|
// de la qualification URBA |
1006 |
|
if ($this->getDATDCode($this->valF['dossier']) == |
1007 |
|
$this->f->getParameter('erp_nature_dat')) { |
1008 |
|
$msgenque = new MessageEnqueuer(); |
1009 |
|
$msgenque->setDossierInstructionIdentifier($this->valF['dossier']); |
1010 |
|
$msgenque->setCompetence($this->valF['autorite_competente']); |
1011 |
|
$msgenque->setContraintePlu($this->valF['servitude']); |
1012 |
|
$msgenque->setReferenceCadastrale( |
1013 |
|
$this->getReferenceCadastrale($this->valF['dossier'])); |
1014 |
|
$msgenque->enqueueMessage($msgenque::$ERP_QUALIFIE); |
1015 |
|
} |
1016 |
|
|
1017 |
|
// envoi des messages a ERP en cas du dossier PC traite par URBA, et |
1018 |
|
// qui etait classifie come ERP |
1019 |
|
if ($this->getDATDCode($this->valF['dossier']) == |
1020 |
|
$this->f->getParameter('erp_dossier_nature_pc') |
1021 |
|
&& $this->valF['erp'] == true) { |
1022 |
|
$msgenque = new MessageEnqueuer(); |
1023 |
|
$msgenque->setDossierInstructionIdentifier($this->valF['dossier']); |
1024 |
|
$msgenque->enqueueMessage($msgenque::$ERP_DEMANDE_COMPLETUDE_PC); |
1025 |
|
$msgenque->enqueueMessage($msgenque::$ERP_DEMANDE_QUALIFICATION_PC); |
1026 |
|
} |
1027 |
|
} |
1028 |
|
} // fin de if($this->f->getParameter('option_erp')) |
1029 |
} |
} |
1030 |
|
|
1031 |
|
/** |
1032 |
|
* Retourne le type de dossier d'autorisation du dossier courant : |
1033 |
|
* - dossier_autorisation_type_detaille.code |
1034 |
|
**/ |
1035 |
|
function getDATDCode($idxDossier) { |
1036 |
|
$sql = "SELECT dossier_autorisation_type_detaille.code |
1037 |
|
FROM ".DB_PREFIXE."dossier_autorisation_type_detaille |
1038 |
|
INNER JOIN ".DB_PREFIXE."dossier_autorisation |
1039 |
|
ON dossier_autorisation_type_detaille.dossier_autorisation_type_detaille = |
1040 |
|
dossier_autorisation.dossier_autorisation_type_detaille |
1041 |
|
INNER JOIN ".DB_PREFIXE."dossier ON dossier.dossier_autorisation = dossier_autorisation.dossier_autorisation |
1042 |
|
WHERE dossier.dossier = '".$idxDossier."'"; |
1043 |
|
$res = $this -> db -> getOne($sql); |
1044 |
|
$this->f->isDatabaseError(); |
1045 |
|
$this->addToLog($sql); |
1046 |
|
return $res; |
1047 |
|
} |
1048 |
|
|
1049 |
|
|
1050 |
|
/** |
1051 |
|
* Retourne la reference cadastrale de la demande attache a un dossier ERP |
1052 |
|
* specifique |
1053 |
|
* @param string $dossier L'identifiant du dossier |
1054 |
|
* @return string|null La reference cadastrale si elle est trouve, |
1055 |
|
* sinon NULL. En cas d'erreur de la BD, l'execution s'arrete. |
1056 |
|
*/ |
1057 |
|
function getReferenceCadastrale($dossier) { |
1058 |
|
$sql = "SELECT terrain_references_cadastrales FROM ".DB_PREFIXE."demande WHERE dossier_instruction = '" . $dossier . "'"; |
1059 |
|
$res = $this->db->limitquery($sql, 0, 1); |
1060 |
|
$this->addToLog("getReferenceCadastrale(): db->limitquery(\"". |
1061 |
|
str_replace(",",", ",$sql)."\", 0, 1);", VERBOSE_MODE); |
1062 |
|
// Si une erreur survient on die |
1063 |
|
if (database::isError($res, true)) { |
1064 |
|
// Appel de la methode de recuperation des erreurs |
1065 |
|
$this->erreur_db($res->getDebugInfo(), $res->getMessage(), 'demande'); |
1066 |
|
} |
1067 |
|
// retourne la nature du dossier |
1068 |
|
while ($row =& $res->fetchRow()) { |
1069 |
|
return $row[0]; |
1070 |
|
} |
1071 |
|
// la nature n'etait pas trouve, ce qui ne devrait pas se passer |
1072 |
|
return NULL; |
1073 |
|
} |
1074 |
|
|
1075 |
|
|
1076 |
function sig_parametre(&$db){ |
function sig_parametre(&$db){ |
1077 |
if (file_exists ("../dyn/var.inc")) |
if (file_exists ("../dyn/var.inc")) |
1078 |
include ("../dyn/var.inc"); |
include ("../dyn/var.inc"); |