183 |
*/ |
*/ |
184 |
function setValFAjout($val = array()) { |
function setValFAjout($val = array()) { |
185 |
|
|
186 |
/*Récupération de la lettre associé au type de dossier d'instruction*/ |
//Récupération de la lettre associé au type de dossier d'instruction |
187 |
$code = $this->getCode($this->getDossierInstructionType()); |
$code = $this->getCode($this->getDossierInstructionType()); |
188 |
|
|
189 |
/* Récupération de la valeur du suffixe ce dossier_instruction_type */ |
//Récupération de la valeur du suffixe ce dossier_instruction_type |
190 |
$suffixe = $this->getSuffixe($this->getDossierInstructionType()); |
$suffixe = $this->getSuffixe($this->getDossierInstructionType()); |
191 |
|
|
192 |
/*S'il est à TRUE, on récupère le numéro de version du dossier d'autorisation*/ |
//S'il est à TRUE, on récupère le numéro de version du dossier d'autorisation |
193 |
$numeroVersion = ""; |
$numeroVersion = ""; |
194 |
|
$numeroVersionDIT = ""; |
195 |
if ( $suffixe == 't' ){ |
if ( $suffixe == 't' ){ |
196 |
|
|
197 |
|
//Récupération du numéro de version |
198 |
$numeroVersion = $this->getNumeroVersion($val['dossier_autorisation']); |
$numeroVersion = $this->getNumeroVersion($val['dossier_autorisation']); |
199 |
|
|
200 |
/* Incrémentation du numéro de version */ |
//Incrémentation du numéro de version |
201 |
if ( is_numeric($numeroVersion) or $numeroVersion == -1 ){ |
if ( is_numeric($numeroVersion) or $numeroVersion == -1 ){ |
202 |
|
|
203 |
$this->incrementNumeroVersion($val['dossier_autorisation'], ++$numeroVersion); |
$this->incrementNumeroVersion($val['dossier_autorisation'], ++$numeroVersion); |
204 |
} |
} |
205 |
|
//Récupération du numéro de version en fonction du type de dossier d'instruction |
206 |
|
//Si c'est un modificatif ou un transfert, on utilise un numéro du type |
207 |
|
// 01 ou 02, etc. sinon on utilise le numéro de version comme auparavant |
208 |
|
$numeroVersionDossierInstructionType = $this->getNumeroVersionDossierInstructionType($val['dossier_autorisation'], $val['dossier_instruction_type'], $numeroVersion); |
209 |
} |
} |
210 |
|
|
211 |
/*Création du numéro de dossier*/ |
//Création du numéro de dossier |
212 |
$this->valF['dossier'] = $val['dossier_autorisation']."$code$numeroVersion"; |
$this->valF['dossier'] = $val['dossier_autorisation'].$code.$numeroVersionDossierInstructionType; |
213 |
$this->valF['version'] = $numeroVersion; |
$this->valF['version'] = $numeroVersion; |
214 |
|
|
215 |
// Identifiant du dossier d'instruction lisible |
// Identifiant du dossier d'instruction lisible |
216 |
// Ex : DP 013055 13 00002P0 |
// Ex : DP 013055 13 00002P0 |
217 |
$this->valF['dossier_libelle'] = $this->get_dossier_autorisation_libelle($val['dossier_autorisation']).$code.$numeroVersion; |
$this->valF['dossier_libelle'] = $this->get_dossier_autorisation_libelle($val['dossier_autorisation']).$code.$numeroVersionDossierInstructionType; |
218 |
} |
} |
219 |
|
|
220 |
/*Récupère la valeur du suffixe d'un dossier_instruction_type*/ |
/*Récupère la valeur du suffixe d'un dossier_instruction_type*/ |
315 |
} |
} |
316 |
|
|
317 |
/** |
/** |
318 |
|
* Retourne un numéro de version en fonction du type de dossier d'instruction |
319 |
|
* @param string $dossier_autorisation |
320 |
|
* @param integer $dossier_instruction_type |
321 |
|
* @return int |
322 |
|
*/ |
323 |
|
public function getNumeroVersionDossierInstructionType($dossier_autorisation, $dossier_instruction_type, $numero_version){ |
324 |
|
|
325 |
|
$numeroVersionDossierInstructionType = $numero_version; |
326 |
|
|
327 |
|
//On récupère le code correspondant au type de dossier d'instruction passé |
328 |
|
//en paramètre |
329 |
|
$sql = "SELECT |
330 |
|
code |
331 |
|
FROM |
332 |
|
".DB_PREFIXE."dossier_instruction_type |
333 |
|
WHERE |
334 |
|
dossier_instruction_type = ".$dossier_instruction_type; |
335 |
|
$codeDossierInstructionType = $this->db->getOne($sql); |
336 |
|
$this->f->addToLog("getNumeroVersionDossierInstructionType(): db->getOne(\"".$sql."\")", VERBOSE_MODE); |
337 |
|
if ( database::isError($codeDossierInstructionType)){ |
338 |
|
$this->f->addToError("", $codeDossierInstructionType, $codeDossierInstructionType); |
339 |
|
return false; |
340 |
|
} |
341 |
|
|
342 |
|
|
343 |
|
// Si c'est un dossier d'instruction de type "Initial", code "P", on retourne 0 |
344 |
|
if ( strcmp($codeDossierInstructionType, "P") == 0 ){ |
345 |
|
return 0; |
346 |
|
} |
347 |
|
//Si c'est un modificatif ou transfert on retourne un nombre correspondant au |
348 |
|
//nombre de dossier d'instruction de ce type, rattaché au dossier |
349 |
|
//d'autorisation complété par des 0 à gauche si besoin. Format du retour |
350 |
|
//attendu : 01 ou 02, etc. |
351 |
|
elseif ( strcmp($codeDossierInstructionType, "M") == 0 || |
352 |
|
strcmp($codeDossierInstructionType, "T") == 0 ){ |
353 |
|
|
354 |
|
//On récupère le nombre de dossier d'instruction de ce type rattaché au |
355 |
|
//dossier d'autorisation |
356 |
|
$sql = "SELECT |
357 |
|
count(*) |
358 |
|
FROM |
359 |
|
".DB_PREFIXE."dossier |
360 |
|
LEFT JOIN |
361 |
|
".DB_PREFIXE."dossier_autorisation |
362 |
|
ON |
363 |
|
dossier_autorisation.dossier_autorisation = dossier.dossier_autorisation |
364 |
|
WHERE |
365 |
|
dossier_autorisation.dossier_autorisation = '".$dossier_autorisation."' |
366 |
|
AND |
367 |
|
dossier.dossier_instruction_type = ".$dossier_instruction_type; |
368 |
|
$numeroVersionDossierInstructionType = $this->db->getOne($sql); |
369 |
|
$this->f->addToLog("getNumeroVersionDossierInstructionType(): db->getOne(\"".$sql."\")", VERBOSE_MODE); |
370 |
|
if ( database::isError($numeroVersionDossierInstructionType)){ |
371 |
|
$this->f->addToError("", $numeroVersionDossierInstructionType, $numeroVersionDossierInstructionType); |
372 |
|
return false; |
373 |
|
} |
374 |
|
//On compléte par des 0 à gauche |
375 |
|
$numeroVersionDossierInstructionType = str_pad(++$numeroVersionDossierInstructionType, 2, "0", STR_PAD_LEFT); |
376 |
|
|
377 |
|
return $numeroVersionDossierInstructionType; |
378 |
|
} |
379 |
|
//Sinon on retourne le numéro de version |
380 |
|
else{ |
381 |
|
return $numeroVersionDossierInstructionType; |
382 |
|
} |
383 |
|
} |
384 |
|
/** |
385 |
* Retourne le libellé du dossier d'autorisation |
* Retourne le libellé du dossier d'autorisation |
386 |
* @param string $dossier_autorisation Identifiant du dossier d'autorisation |
* @param string $dossier_autorisation Identifiant du dossier d'autorisation |
387 |
* @return string Libellé dossier d'autorisation |
* @return string Libellé dossier d'autorisation |
435 |
unset ($this->valF['date_chantier']); |
unset ($this->valF['date_chantier']); |
436 |
unset ($this->valF['date_achevement']); |
unset ($this->valF['date_achevement']); |
437 |
unset ($this->valF['date_conformite']); |
unset ($this->valF['date_conformite']); |
438 |
|
|
439 |
|
// Durée de validaité lors de la création du dossier d'instruction |
440 |
|
$this->valF['duree_validite'] = $this->get_duree_validite($this->valF['dossier_autorisation']); |
441 |
} |
} |
442 |
|
|
443 |
/*Vérification des données saisies*/ |
/*Vérification des données saisies*/ |
468 |
$form->setType('evenement_suivant_tacite','hidden'); |
$form->setType('evenement_suivant_tacite','hidden'); |
469 |
$form->setType('evenement_suivant_tacite_incompletude','hidden'); |
$form->setType('evenement_suivant_tacite_incompletude','hidden'); |
470 |
$form->setType('etat_pendant_incompletude','hidden'); |
$form->setType('etat_pendant_incompletude','hidden'); |
471 |
|
$form->setType('duree_validite','hidden'); |
472 |
if ($maj < 2) { //ajouter et modifier |
if ($maj < 2) { //ajouter et modifier |
473 |
// cache |
// cache |
474 |
if($maj==0) $form->setType('dossier_libelle', 'hidden'); |
if($maj==0) $form->setType('dossier_libelle', 'hidden'); |
588 |
$form->setType('shob', 'hidden'); |
$form->setType('shob', 'hidden'); |
589 |
$form->setType('lot', 'hidden'); |
$form->setType('lot', 'hidden'); |
590 |
} |
} |
591 |
|
|
592 |
|
// Le profil Qualificateur ne peut modifier seulement les champs |
593 |
|
// autorite_competente, a_qualifier et erp |
594 |
|
if ($this->f->isUserQualificateur()) { |
595 |
|
|
596 |
|
// En modification |
597 |
|
if ($maj == 1) { |
598 |
|
|
599 |
|
$form->setType('numero_versement_archive', 'static'); |
600 |
|
$form->setType('enjeu_urba', 'checkboxstatic'); |
601 |
|
$form->setType('enjeu_erp', 'checkboxstatic'); |
602 |
|
$form->setType('description','textareastatic'); |
603 |
|
$form->setType('terrain_references_cadastrales','referencescadastralesstatic'); |
604 |
|
$form->setType('terrain_adresse_voie_numero','static'); |
605 |
|
$form->setType('terrain_adresse_voie','static'); |
606 |
|
$form->setType('terrain_adresse_lieu_dit','static'); |
607 |
|
$form->setType('terrain_adresse_localite','static'); |
608 |
|
$form->setType('terrain_adresse_code_postal','static'); |
609 |
|
$form->setType('terrain_adresse_bp','static'); |
610 |
|
$form->setType('terrain_adresse_cedex','static'); |
611 |
|
$form->setType('terrain_superficie','static'); |
612 |
|
} |
613 |
|
} |
614 |
|
|
615 |
// |
// |
616 |
if(!$this->f->getParameter('afficher_division') === 'true') { |
if(!$this->f->getParameter('afficher_division') === 'true') { |
617 |
$form->setType('division', 'hidden'); |
$form->setType('division', 'hidden'); |
766 |
$form->setBloc('dossier_libelle', 'D', '', 'col_9'); |
$form->setBloc('dossier_libelle', 'D', '', 'col_9'); |
767 |
|
|
768 |
$form->setFieldset('dossier_libelle', 'D', _("Dossier d'instruction")); |
$form->setFieldset('dossier_libelle', 'D', _("Dossier d'instruction")); |
769 |
$form->setFieldset('autorite_competente', 'F'); |
$form->setFieldset('numero_versement_archive', 'F'); |
770 |
|
|
771 |
$form->setBloc('autorite_competente', 'F'); |
$form->setBloc('numero_versement_archive', 'F'); |
772 |
|
|
773 |
$form->setBloc('date_demande', 'D', '', 'col_3'); |
$form->setBloc('date_demande', 'D', '', 'col_3'); |
774 |
|
|
1484 |
|
|
1485 |
$this->listeDemandeur("dossier", $this->getVal('dossier')); |
$this->listeDemandeur("dossier", $this->getVal('dossier')); |
1486 |
|
|
1487 |
if($maj < 2 AND !$this->correct) { |
if($maj < 2 AND !$this->correct AND !$this->f->isUserQualificateur()) { |
1488 |
$linkable = true; |
$linkable = true; |
1489 |
} else { |
} else { |
1490 |
$linkable = false; |
$linkable = false; |
1672 |
} else { |
} else { |
1673 |
echo "tab.php?"; |
echo "tab.php?"; |
1674 |
} |
} |
1675 |
echo "obj=".get_class($this); |
// Permet de retourner sur la bonne page |
1676 |
|
if (isset($_GET['retourformulaire']) && $_GET['retourformulaire'] != '') { |
1677 |
|
echo "obj=".$_GET['retourformulaire']; |
1678 |
|
} else { |
1679 |
|
echo "obj=".get_class($this); |
1680 |
|
} |
1681 |
if($this->getParameter("retour")=="form") { |
if($this->getParameter("retour")=="form") { |
1682 |
echo "&idx=".$this->getParameter("idx"); |
echo "&idx=".$this->getParameter("idx"); |
1683 |
echo "&idz=".$this->getParameter("idz"); |
echo "&idz=".$this->getParameter("idz"); |
1706 |
* @param array $val Valeurs de l'objet |
* @param array $val Valeurs de l'objet |
1707 |
* @param intger $maj Mode du formulaire |
* @param intger $maj Mode du formulaire |
1708 |
*/ |
*/ |
1709 |
function setEnt($ent, $val = array(), $maj) { |
function getFormTitle($ent) { |
1710 |
|
|
1711 |
// Fil d'Ariane |
// Fil d'Ariane |
1712 |
$ent = _("instruction")." -> "._("dossiers d'instruction"); |
$ent = _("instruction")." -> "._("dossiers d'instruction"); |
1713 |
|
|
1714 |
// Si différent de l'ajout |
// Si différent de l'ajout |
1715 |
if($maj != 0) { |
if($this->getParameter("maj") != 0) { |
1716 |
// Si le champ dossier_libelle existe |
// Si le champ dossier_libelle existe |
1717 |
if (isset($val["dossier_libelle"]) && trim($val["dossier_libelle"]) != '') { |
if (trim($this->getVal("dossier_libelle")) != '') { |
1718 |
$ent .= " -> ".strtoupper($val["dossier_libelle"]); |
$ent .= " -> ".strtoupper($this->getVal("dossier_libelle")); |
1719 |
} |
} |
1720 |
// Si le champ dossier existe |
// Si le champ dossier existe |
1721 |
if (isset($val["dossier"]) && trim($val["dossier"]) != '') { |
if (trim($this->getVal("dossier")) != '') { |
1722 |
$demandeur = $this->get_demandeur($val["dossier"]); |
$demandeur = $this->get_demandeur($this->getVal("dossier")); |
1723 |
// Si le demandeur existe |
// Si le demandeur existe |
1724 |
if (isset($demandeur) && trim($demandeur) != '') { |
if (isset($demandeur) && trim($demandeur) != '') { |
1725 |
$ent .= " ".strtoupper($demandeur); |
$ent .= " ".strtoupper($demandeur); |
1728 |
} |
} |
1729 |
|
|
1730 |
// Change le fil d'Ariane |
// Change le fil d'Ariane |
1731 |
$this->ent .= $ent; |
return $ent; |
1732 |
} |
} |
1733 |
|
|
1734 |
/** |
/** |
1760 |
// Résultat retourné |
// Résultat retourné |
1761 |
return $demandeur; |
return $demandeur; |
1762 |
} |
} |
1763 |
|
|
1764 |
|
/** |
1765 |
|
* Récupère la durée de validité du type détaillé du dossier d'autorisation |
1766 |
|
* @param string $dossier_autorisation Identifiant dossier d'autorisation |
1767 |
|
* @return intger Durée de validité |
1768 |
|
*/ |
1769 |
|
function get_duree_validite($dossier_autorisation) { |
1770 |
|
|
1771 |
|
// init de la variable de retour |
1772 |
|
$duree_validite = ""; |
1773 |
|
|
1774 |
|
// Récupération de la duree de validite du dossier d'autorisation |
1775 |
|
$sql = "SELECT duree_validite_parametrage |
1776 |
|
FROM ".DB_PREFIXE."dossier_autorisation_type_detaille |
1777 |
|
LEFT JOIN ".DB_PREFIXE."dossier_autorisation |
1778 |
|
ON dossier_autorisation.dossier_autorisation_type_detaille = dossier_autorisation_type_detaille.dossier_autorisation_type_detaille |
1779 |
|
WHERE dossier_autorisation.dossier_autorisation='".$dossier_autorisation."'"; |
1780 |
|
$duree_validite = $this->db->getOne($sql); |
1781 |
|
$this->f->addToLog("get_duree_validite(): db->getOne(\"".$sql."\");", VERBOSE_MODE); |
1782 |
|
database::isError($duree_validite); |
1783 |
|
|
1784 |
|
// retourne le résultat |
1785 |
|
return $duree_validite; |
1786 |
|
|
1787 |
|
} |
1788 |
|
|
1789 |
}// fin classe |
}// fin classe |
1790 |
?> |
?> |