35 |
"delegataire" => "", |
"delegataire" => "", |
36 |
"petitionnaire" => array()); |
"petitionnaire" => array()); |
37 |
|
|
38 |
|
/** @var boolean Les nouvelles actions sont activées sur cet objet */ |
39 |
|
var $activate_class_action; |
40 |
|
|
41 |
function dossier($id,&$db,$DEBUG) { |
function dossier($id,&$db,$DEBUG) { |
42 |
|
//On active les nouvelles actions |
43 |
|
$this->activate_class_action = true; |
44 |
$this->constructeur($id,$db,$DEBUG); |
$this->constructeur($id,$db,$DEBUG); |
45 |
} // fin constructeur |
} // fin constructeur |
46 |
|
|
51 |
public function setDossierInstructionType($dossier_instruction_type){ |
public function setDossierInstructionType($dossier_instruction_type){ |
52 |
$this->dossier_instruction_type = $dossier_instruction_type; |
$this->dossier_instruction_type = $dossier_instruction_type; |
53 |
} |
} |
|
|
|
|
// {{{ Gestion de la confidentialité des données spécifiques |
|
54 |
|
|
55 |
/** |
/** |
56 |
* Surcharge pour gérer les actions disponibles dans le portlet |
* Définition des actions disponibles sur la classe. |
57 |
|
* |
58 |
|
* @return void |
59 |
*/ |
*/ |
60 |
function checkAccessibility() { |
function init_class_actions() { |
61 |
// |
|
62 |
parent::checkAccessibility(); |
parent::init_class_actions(); |
|
// Si l'utilisateur est un intructeur qui ne correspond pas à la |
|
|
// division du dossier |
|
|
if ($this->f->isUserInstructeur() |
|
|
&& isset($this->f->om_utilisateur["division"]) |
|
|
&& $this->f->om_utilisateur["division"] != $this->getDivisionFromDossier()) { |
|
|
// |
|
|
$this->parameters["actions"]["modifier"] = NULL; |
|
|
// |
|
|
$this->actions_sup["geolocalisation"] = NULL; |
|
|
|
|
|
//Cache le lien du rapport d'instruction, si aucun n'est lié |
|
|
if ( $this->getRapportInstruction() == '' ){ |
|
|
|
|
|
$this->actions_sup['rapport_instruction'] = NULL; |
|
|
} |
|
|
|
|
|
//Cache le lien des données techniques, si aucun n'est lié |
|
|
if ( $this->getDonneesTechniques() == '' ){ |
|
|
|
|
|
$this->actions_sup['donnees_techniques'] = NULL; |
|
|
} |
|
|
} |
|
|
|
|
|
//Si l'utilisateur est un instructeur et le dossier d'instruction est clôturé, |
|
|
//il n'est plus possible de le modifier, on affiche pas le lien de modification du |
|
|
//portlet |
|
|
if ( $this->f->isUserInstructeur() && $this->getStatut() == "cloture" ){ |
|
|
|
|
|
$this->parameters["actions"]["modifier"] = NULL; |
|
|
// |
|
|
$this->actions_sup["geolocalisation"] = NULL; |
|
|
|
|
|
//Cache le lien du rapport d'instruction, si aucun n'est lié |
|
|
if ( $this->getRapportInstruction() == '' ){ |
|
|
|
|
|
$this->actions_sup['rapport_instruction'] = NULL; |
|
|
} |
|
|
} |
|
|
|
|
|
//Cache le lien des données techniques, si aucun n'est lié |
|
|
if ( $this->getDonneesTechniques() == '' && !$this->f->isUserAdministrateur() ){ |
|
|
|
|
|
$this->actions_sup['donnees_techniques'] = NULL; |
|
|
} |
|
63 |
|
|
64 |
// Si l'option sig n'est pas réglé sur 'sig_externe', |
// ACTION - 004 - contrainte |
65 |
// l'action géolocalisation n'est pas affiché |
// |
66 |
if ($this->f->getParameter('option_sig') != 'sig_externe') { |
$this->class_actions[4] = array( |
67 |
// |
"identifier" => "contrainte", |
68 |
$this->actions_sup["geolocalisation"] = NULL; |
"view" => "view_contrainte", |
69 |
} |
"permission_suffix" => "contrainte", |
70 |
|
); |
71 |
|
|
72 |
|
// ACTION - 005 - view_document_numerise |
73 |
|
// Interface spécifique du tableau des pièces |
74 |
|
$this->class_actions[5] = array( |
75 |
|
"identifier" => "view_document_numerise", |
76 |
|
"view" => "view_document_numerise", |
77 |
|
"permission_suffix" => "document_numerise", |
78 |
|
); |
79 |
} |
} |
80 |
|
|
81 |
/** |
/** |
82 |
* Cette methode est à surcharger elle permet de tester dans chaque classe |
* VIEW - view_document_numerise. |
83 |
* des droits des droits spécifiques en fonction des données |
* |
84 |
|
* Vue du tableau des pièces du dossier d'autorisation. |
85 |
|
* |
86 |
|
* Cette vue permet de gérer le contenu de l'onglet "Pièce(s)" sur un |
87 |
|
* dossier d'autorisation. Cette vue spécifique est nécessaire car |
88 |
|
* l'ergonomie standard du framework ne prend pas en charge ce cas. |
89 |
|
* C'est ici la vue spécifique des pièces liées au dossier qui est |
90 |
|
* affichée directement au clic de l'onglet au lieu du soustab. |
91 |
|
* |
92 |
|
* L'idée est donc de simuler l'ergonomie standard en créant un container |
93 |
|
* et d'appeler la méthode javascript 'ajaxit' pour charger le contenu |
94 |
|
* de la vue visualisation de l'objet lié. |
95 |
|
* |
96 |
|
* @return void |
97 |
*/ |
*/ |
98 |
function canAccess() { |
function view_document_numerise() { |
99 |
// Si l'utilisateur est un intructeur qui ne correspond pas à la |
// Vérification de l'accessibilité sur l'élément |
100 |
// division du dossier |
$this->checkAccessibility(); |
101 |
if ($this->f->isUserInstructeur() |
// Récupération des variables GET |
102 |
&& $this->f->om_utilisateur["division"] != $this->getDivisionFromDossier() |
($this->f->get_submitted_get_value('idxformulaire')!==null ? $idxformulaire = |
103 |
&& $this->getParameter("maj") != 3) { |
$this->f->get_submitted_get_value('idxformulaire') : $idxformulaire = ""); |
104 |
// |
($this->f->get_submitted_get_value('retourformulaire')!==null ? $retourformulaire = |
105 |
return false; |
$this->f->get_submitted_get_value('retourformulaire') : $retourformulaire = ""); |
106 |
} |
// Objet à charger |
107 |
// Si l'utilisateur est un instructeur et que le dossier est cloturé |
$obj = "document_numerise"; |
108 |
if ( $this->f->isUserInstructeur() && $this->getStatut() == "cloture" |
// Construction de l'url de sousformulaire à appeler |
109 |
&& $this->getParameter("maj") != 3) { |
$url = "../scr/sousform.php?obj=".$obj; |
110 |
|
$url .= "&idx=".$idxformulaire; |
111 |
return false; |
$url .= "&action=4"; |
112 |
} |
$url .= "&retourformulaire=".$retourformulaire; |
113 |
// |
$url .= "&idxformulaire=".$idxformulaire; |
114 |
return true; |
$url .= "&retour=form"; |
115 |
|
// Affichage du container permettant le reffraichissement du contenu |
116 |
|
// dans le cas des action-direct. |
117 |
|
printf(' |
118 |
|
<div id="sousform-href" data-href="%s"> |
119 |
|
</div>', |
120 |
|
$url |
121 |
|
); |
122 |
|
// Affichage du container permettant de charger le retour de la requête |
123 |
|
// ajax récupérant le sous formulaire. |
124 |
|
printf(' |
125 |
|
<div id="sousform-%s"> |
126 |
|
</div> |
127 |
|
<script> |
128 |
|
ajaxIt(\'%s\', \'%s\'); |
129 |
|
</script>', |
130 |
|
$obj, |
131 |
|
$obj, |
132 |
|
$url |
133 |
|
); |
134 |
} |
} |
135 |
|
|
136 |
/** |
/** |
385 |
$this->f->addToError("", $numeroVersionDossierInstructionType, $numeroVersionDossierInstructionType); |
$this->f->addToError("", $numeroVersionDossierInstructionType, $numeroVersionDossierInstructionType); |
386 |
return false; |
return false; |
387 |
} |
} |
388 |
|
|
389 |
|
// Requête SQL |
390 |
|
$sql = "SELECT |
391 |
|
substring(dossier, '.{2}$')::int as last_num_dossier |
392 |
|
FROM ".DB_PREFIXE."dossier |
393 |
|
WHERE dossier_instruction_type = ".$dossier_instruction_type." |
394 |
|
AND dossier_autorisation = '".$dossier_autorisation."' |
395 |
|
AND version = ( |
396 |
|
SELECT max(version) |
397 |
|
FROM ".DB_PREFIXE."dossier |
398 |
|
WHERE dossier_instruction_type = ".$dossier_instruction_type." |
399 |
|
AND dossier_autorisation = '".$dossier_autorisation."' |
400 |
|
GROUP BY dossier_instruction_type, dossier_autorisation |
401 |
|
)"; |
402 |
|
$res = $this->db->query($sql); |
403 |
|
$this->f->addToLog(__METHOD__."(): db->query(\"".$sql."\")", VERBOSE_MODE); |
404 |
|
$this->f->isDatabaseError($res); |
405 |
|
$row =& $res->fetchRow(DB_FETCHMODE_ASSOC); |
406 |
|
|
407 |
|
$num_version_last_dossier = $row['last_num_dossier']; |
408 |
|
|
409 |
|
if (!empty($num_version_last_dossier) |
410 |
|
&& $num_version_last_dossier >= $numeroVersionDossierInstructionType) { |
411 |
|
// Modifie le numéro suivant |
412 |
|
$numeroVersionDossierInstructionType = $num_version_last_dossier; |
413 |
|
} |
414 |
// |
// |
415 |
if ($increment === true) { |
if ($increment === true) { |
416 |
$numeroVersionDossierInstructionType = ++$numeroVersionDossierInstructionType; |
$numeroVersionDossierInstructionType = ++$numeroVersionDossierInstructionType; |
678 |
$form->setType('numero_versement_archive', 'static'); |
$form->setType('numero_versement_archive', 'static'); |
679 |
$form->setType('enjeu_urba', 'checkboxstatic'); |
$form->setType('enjeu_urba', 'checkboxstatic'); |
680 |
$form->setType('enjeu_erp', 'checkboxstatic'); |
$form->setType('enjeu_erp', 'checkboxstatic'); |
|
$form->setType('terrain_references_cadastrales','referencescadastralesstatic'); |
|
|
$form->setType('terrain_adresse_voie_numero','static'); |
|
|
$form->setType('terrain_adresse_voie','static'); |
|
|
$form->setType('terrain_adresse_lieu_dit','static'); |
|
|
$form->setType('terrain_adresse_localite','static'); |
|
|
$form->setType('terrain_adresse_code_postal','static'); |
|
|
$form->setType('terrain_adresse_bp','static'); |
|
|
$form->setType('terrain_adresse_cedex','static'); |
|
|
$form->setType('terrain_superficie','static'); |
|
681 |
} |
} |
682 |
} |
} |
683 |
|
|
692 |
if ($maj == 0) { |
if ($maj == 0) { |
693 |
$form->setType('dossier_autorisation', 'select'); |
$form->setType('dossier_autorisation', 'select'); |
694 |
} |
} |
|
// On cache enjeu_ERP si l'option n'est pas activée |
|
|
if($this->f->getParameter('option_erp') != 'true') { |
|
|
$form->setType('erp', 'hidden'); |
|
|
$form->setType('enjeu_erp', 'hidden'); |
|
|
} |
|
695 |
|
|
696 |
// En mode modifier, supprimer et consulter |
// En mode modifier, supprimer et consulter |
697 |
if ($maj != 0) { |
if ($maj != 0) { |
706 |
$form->setType('date_chantier', 'hiddendate'); |
$form->setType('date_chantier', 'hiddendate'); |
707 |
$form->setType('date_achevement', 'hiddendate'); |
$form->setType('date_achevement', 'hiddendate'); |
708 |
$form->setType('date_conformite', 'hiddendate'); |
$form->setType('date_conformite', 'hiddendate'); |
709 |
|
|
710 |
|
// On cache les champs geom si aucun SIG n'est configuré |
711 |
|
if($this->f->getParameter('option_sig') == '' |
712 |
|
|| $this->f->getParameter('option_sig') == 'aucun'){ |
713 |
|
$form->setType('geom', 'hidden'); |
714 |
|
$form->setType('geom1', 'hidden'); |
715 |
|
} |
716 |
} |
} |
717 |
|
|
718 |
function setVal(&$form,$maj,$validation){ |
function setVal(&$form,$maj,$validation){ |
753 |
} |
} |
754 |
|
|
755 |
function setSelect(&$form, $maj,&$db,$debug) { |
function setSelect(&$form, $maj,&$db,$debug) { |
756 |
parent::setSelect($form, $maj, $db, $debug); |
// XXX Commenté pour patcher le problème de montée en charge de la base |
757 |
|
// de données en cas de reprise de données d'un gros volume de dossier |
758 |
|
// d'instruction |
759 |
|
//parent::setSelect($form, $maj, $db, $debug); |
760 |
|
|
761 |
//optimisation sur table importante parcelle -> pas d appel methode parent |
//optimisation sur table importante parcelle -> pas d appel methode parent |
762 |
if(file_exists ("../sql/".$db->phptype."/".$this->table.".form.inc.php")) |
if(file_exists ("../sql/".OM_DB_PHPTYPE."/".$this->table.".form.inc.php")) |
763 |
include ("../sql/".$db->phptype."/".$this->table.".form.inc.php"); |
include ("../sql/".OM_DB_PHPTYPE."/".$this->table.".form.inc.php"); |
764 |
|
|
765 |
/* |
/* |
766 |
* Pour chaque init_select d'un select non modifiable on teste |
* Pour chaque init_select d'un select non modifiable on teste |
770 |
|
|
771 |
// instructeur |
// instructeur |
772 |
$this->init_select($form, $db, $maj, $debug, "instructeur", |
$this->init_select($form, $db, $maj, $debug, "instructeur", |
773 |
$sql_instructeur, $sql_instructeur_by_id, false); |
$sql_instructeur, $sql_instructeur_by_id, true); |
774 |
|
|
775 |
// etat |
// etat |
776 |
if ($maj == 1) { |
if ($maj == 1) { |
884 |
if($this->f->getParameter('option_afficher_division')==='true') { |
if($this->f->getParameter('option_afficher_division')==='true') { |
885 |
// instructeur |
// instructeur |
886 |
$this->init_select($form, $db, $maj, $debug, "instructeur", |
$this->init_select($form, $db, $maj, $debug, "instructeur", |
887 |
$sql_instructeur_div, $sql_instructeur_div_by_id, false); |
$sql_instructeur_div, $sql_instructeur_div_by_id, true); |
888 |
} |
} |
889 |
} |
} |
890 |
|
|
934 |
// En-tête |
// En-tête |
935 |
$form->setBloc('dossier_libelle', 'D', '', ($maj == 3 ? 'col_9':'col_12')); |
$form->setBloc('dossier_libelle', 'D', '', ($maj == 3 ? 'col_9':'col_12')); |
936 |
|
|
937 |
// Col1 : Fieldset "Dossier d'Instruction" |
// Col1 : Fieldset "Dossier d'Instruction" |
938 |
$form->setBloc('dossier_libelle', 'D', '', 'col_9'); |
$form->setBloc('dossier_libelle', 'D', '', 'col_9'); |
939 |
|
|
940 |
$form->setFieldset('dossier_libelle', 'D', _("Dossier d'instruction")); |
$form->setFieldset('dossier_libelle', 'D', _("Dossier d'instruction")); |
943 |
|
|
944 |
$form->setBloc('geom', 'F'); |
$form->setBloc('geom', 'F'); |
945 |
|
|
946 |
// Col2 : 3 fieldsets |
// Col2 : 3 fieldsets |
947 |
$form->setBloc('enjeu_urba', 'D', '', 'col_3'); |
$form->setBloc('enjeu_urba', 'D', '', 'col_3'); |
948 |
|
|
949 |
// Fieldset "Enjeu" |
// Fieldset "Enjeu" |
1068 |
} |
} |
1069 |
|
|
1070 |
|
|
1071 |
if ($this->f->getParameter('option_erp') != "") { |
if ($this->f->getParameter('option_erp') === 'true') { |
1072 |
// envoi du message a ERP en cas d'un depot du dossier dat |
// envoi du message a ERP en cas d'un depot du dossier dat |
1073 |
if ($this->f->getDATDCode($this->valF['dossier']) == |
if ($this->f->getDATDCode($this->valF['dossier']) == |
1074 |
$this->f->getParameter('erp_depot_dossier_dat')) { |
$this->f->getParameter('erp_depot_dossier_dat')) { |
1167 |
} |
} |
1168 |
} |
} |
1169 |
} |
} |
1170 |
} // fin de if ($this->f->getParameter('option_erp') != "") |
} // fin de if ($this->f->getParameter('option_erp') === 'true') |
1171 |
|
|
1172 |
|
//On ajoute les données techniques |
1173 |
|
if($this->ajoutDonneesTechniquesDI($id, $db, $val, $DEBUG) === false){ |
1174 |
|
// |
1175 |
|
$this -> addToMessage( |
1176 |
|
_("Erreur lors de l'enregistrement du dossier.")." ". |
1177 |
|
_("Contactez votre administrateur.") |
1178 |
|
); |
1179 |
|
$this->correct = false; |
1180 |
|
return false; |
1181 |
|
} |
1182 |
|
|
1183 |
// Mise à jour des données du dossier d'autorisation |
// Mise à jour des données du dossier d'autorisation |
1184 |
require_once "../obj/dossier_autorisation.class.php"; |
require_once "../obj/dossier_autorisation.class.php"; |
1185 |
$da = new dossier_autorisation($this->valF["dossier_autorisation"], $this->db, DEBUG); |
$da = new dossier_autorisation($this->valF["dossier_autorisation"], $this->db, DEBUG); |
1279 |
* |
* |
1280 |
* @return array |
* @return array |
1281 |
*/ |
*/ |
1282 |
function getInstructeurDivision( $quartier, $arrondissement, $section, $dossier_autorisation) { |
function getInstructeurDivision( $quartier, $arrondissement, $section, $dossier_autorisation_type_detaille) { |
1283 |
|
|
1284 |
$quartier = ( $quartier == NULL ) ? -1 : $quartier; |
$quartier = ( $quartier == NULL ) ? -1 : $quartier; |
1285 |
$arrondissement = ( $arrondissement == NULL ) ? -1 : $arrondissement; |
$arrondissement = ( $arrondissement == NULL ) ? -1 : $arrondissement; |
|
|
|
|
//Récupération du dossier_autorisation_type_detaille concerné par le |
|
|
//$dossier_autorisation |
|
|
$sql = " |
|
|
SELECT |
|
|
dossier_autorisation_type_detaille |
|
|
FROM |
|
|
".DB_PREFIXE."dossier_autorisation |
|
|
WHERE |
|
|
dossier_autorisation = '$dossier_autorisation'"; |
|
|
|
|
|
$this->addToLog("getInstructeurDivision : db->query(\"$sql\")", VERBOSE_MODE); |
|
|
$resDATD = $this->db->query($sql); |
|
|
if (database :: isError($resDATD)) |
|
|
die($resDATD->getMessage()."erreur ".$sql); |
|
1286 |
|
|
1287 |
//Si le dossier d'autorisation a un type détaillé de dossier |
//Si le dossier d'autorisation a un type détaillé de dossier |
1288 |
//d'autorisation associé |
//d'autorisation associé |
1289 |
if ( $resDATD->numRows() > 0 ){ |
if ($dossier_autorisation_type_detaille != '' |
1290 |
$rowDATD = $resDATD->fetchRow(DB_FETCHMODE_ASSOC); |
&& $dossier_autorisation_type_detaille != null){ |
1291 |
|
|
1292 |
//Requête de récupération de l'instructeur à affecter |
//Requête de récupération de l'instructeur à affecter |
1293 |
$sql = " |
$sql = " |
1294 |
SELECT |
SELECT |
1304 |
( dossier_autorisation_type_detaille IS NULL AND arrondissement = $arrondissement AND quartier IS NULL AND section = '$section' ) OR |
( dossier_autorisation_type_detaille IS NULL AND arrondissement = $arrondissement AND quartier IS NULL AND section = '$section' ) OR |
1305 |
( dossier_autorisation_type_detaille IS NULL AND arrondissement = $arrondissement AND quartier = $quartier AND section IS NULL ) OR |
( dossier_autorisation_type_detaille IS NULL AND arrondissement = $arrondissement AND quartier = $quartier AND section IS NULL ) OR |
1306 |
( dossier_autorisation_type_detaille IS NULL AND arrondissement = $arrondissement AND quartier = $quartier AND section = '$section' ) OR |
( dossier_autorisation_type_detaille IS NULL AND arrondissement = $arrondissement AND quartier = $quartier AND section = '$section' ) OR |
1307 |
( dossier_autorisation_type_detaille = ".$rowDATD['dossier_autorisation_type_detaille']." AND arrondissement IS NULL AND quartier IS NULL AND section IS NULL ) OR |
( dossier_autorisation_type_detaille = ".$dossier_autorisation_type_detaille." AND arrondissement IS NULL AND quartier IS NULL AND section IS NULL ) OR |
1308 |
( dossier_autorisation_type_detaille = ".$rowDATD['dossier_autorisation_type_detaille']." AND arrondissement IS NULL AND quartier IS NULL AND section = '$section' ) OR |
( dossier_autorisation_type_detaille = ".$dossier_autorisation_type_detaille." AND arrondissement IS NULL AND quartier IS NULL AND section = '$section' ) OR |
1309 |
( dossier_autorisation_type_detaille = ".$rowDATD['dossier_autorisation_type_detaille']." AND arrondissement IS NULL AND quartier = $quartier AND section IS NULL ) OR |
( dossier_autorisation_type_detaille = ".$dossier_autorisation_type_detaille." AND arrondissement IS NULL AND quartier = $quartier AND section IS NULL ) OR |
1310 |
( dossier_autorisation_type_detaille = ".$rowDATD['dossier_autorisation_type_detaille']." AND arrondissement IS NULL AND quartier = $quartier AND section = '$section' ) OR |
( dossier_autorisation_type_detaille = ".$dossier_autorisation_type_detaille." AND arrondissement IS NULL AND quartier = $quartier AND section = '$section' ) OR |
1311 |
( dossier_autorisation_type_detaille = ".$rowDATD['dossier_autorisation_type_detaille']." AND arrondissement = $arrondissement AND quartier IS NULL AND section IS NULL ) OR |
( dossier_autorisation_type_detaille = ".$dossier_autorisation_type_detaille." AND arrondissement = $arrondissement AND quartier IS NULL AND section IS NULL ) OR |
1312 |
( dossier_autorisation_type_detaille = ".$rowDATD['dossier_autorisation_type_detaille']." AND arrondissement = $arrondissement AND quartier IS NULL AND section = '$section' ) OR |
( dossier_autorisation_type_detaille = ".$dossier_autorisation_type_detaille." AND arrondissement = $arrondissement AND quartier IS NULL AND section = '$section' ) OR |
1313 |
( dossier_autorisation_type_detaille = ".$rowDATD['dossier_autorisation_type_detaille']." AND arrondissement = $arrondissement AND quartier = $quartier AND section IS NULL ) OR |
( dossier_autorisation_type_detaille = ".$dossier_autorisation_type_detaille." AND arrondissement = $arrondissement AND quartier = $quartier AND section IS NULL ) OR |
1314 |
( dossier_autorisation_type_detaille = ".$rowDATD['dossier_autorisation_type_detaille']." AND arrondissement = $arrondissement AND quartier = $quartier AND section = '$section' ) |
( dossier_autorisation_type_detaille = ".$dossier_autorisation_type_detaille." AND arrondissement = $arrondissement AND quartier = $quartier AND section = '$section' ) |
1315 |
ORDER BY dossier_autorisation_type_detaille, section, quartier, arrondissement |
ORDER BY dossier_autorisation_type_detaille, section, quartier, arrondissement |
1316 |
LIMIT 1"; |
LIMIT 1"; |
1317 |
$this->addToLog("getInstructeurDivision : db->query(\"$sql\")", VERBOSE_MODE); |
$this->addToLog("getInstructeurDivision : db->query(\"$sql\")", VERBOSE_MODE); |
1343 |
|
|
1344 |
return NULL; |
return NULL; |
1345 |
} |
} |
1346 |
|
|
1347 |
|
/** |
1348 |
|
* Récupère le type détaillé d'une dossier d'autorisation. |
1349 |
|
* |
1350 |
|
* @param integer $dossier_autorisation DA |
1351 |
|
* |
1352 |
|
* @return mixed |
1353 |
|
*/ |
1354 |
|
function get_dossier_autorisation_da_type_detaille($dossier_autorisation) { |
1355 |
|
|
1356 |
|
// |
1357 |
|
$resDATD = ""; |
1358 |
|
|
1359 |
|
//Récupération du dossier_autorisation_type_detaille concerné par le |
1360 |
|
//$dossier_autorisation |
1361 |
|
$sql = " |
1362 |
|
SELECT |
1363 |
|
dossier_autorisation_type_detaille |
1364 |
|
FROM |
1365 |
|
".DB_PREFIXE."dossier_autorisation |
1366 |
|
WHERE |
1367 |
|
dossier_autorisation = '$dossier_autorisation'"; |
1368 |
|
$this->addToLog(__METHOD__." : db->query(\"$sql\")", VERBOSE_MODE); |
1369 |
|
$resDATD = $this->db->getOne($sql); |
1370 |
|
$this->f->isDatabaseError($resDATD); |
1371 |
|
|
1372 |
|
// |
1373 |
|
return $resDATD; |
1374 |
|
} |
1375 |
|
|
1376 |
/* ============================================================= |
/* ============================================================= |
1377 |
* fonction trigger relative a la connexion SIG |
* fonction trigger relative a la connexion SIG |
1414 |
// Si aucun instructeur n'est saisi et que la dossier_autorisation_type_detaille n'est pas vide |
// Si aucun instructeur n'est saisi et que la dossier_autorisation_type_detaille n'est pas vide |
1415 |
// alors on récupère l'instructeur et la division depuis l'affectation |
// alors on récupère l'instructeur et la division depuis l'affectation |
1416 |
if ( ( empty($this->valF['instructeur']) || $this->valF['instructeur'] == '' ) && $val['dossier_autorisation'] != '' ) { |
if ( ( empty($this->valF['instructeur']) || $this->valF['instructeur'] == '' ) && $val['dossier_autorisation'] != '' ) { |
1417 |
|
|
1418 |
|
// Récupère le type détaillé du DA |
1419 |
|
$dossier_autorisation_type_detaille = $this->get_dossier_autorisation_da_type_detaille($this->valF['dossier_autorisation']); |
1420 |
|
|
1421 |
//Récupération de l'instructeur ainsi que de sa division |
//Récupération de l'instructeur ainsi que de sa division |
1422 |
$instructeurDivision = $this->getInstructeurDivision($quartier, $arrondissement, $section, $this->valF['dossier_autorisation']); |
$instructeurDivision = $this->getInstructeurDivision($quartier, $arrondissement, $section, $dossier_autorisation_type_detaille); |
1423 |
|
|
1424 |
//Si un instructeur et sa division ont été récupérés |
//Si un instructeur et sa division ont été récupérés |
1425 |
if ( $instructeurDivision != NULL ){ |
if ( $instructeurDivision != NULL ){ |
1472 |
} |
} |
1473 |
|
|
1474 |
// verification si envoi vers ERP est active |
// verification si envoi vers ERP est active |
1475 |
if ($this->f->getParameter('option_erp') != "") { |
if ($this->f->getParameter('option_erp') === 'true') { |
1476 |
if ($this->val[array_search('a_qualifier', $this->champs)] == 't' |
if ($this->val[array_search('a_qualifier', $this->champs)] == 't' |
1477 |
&& $this->valF['a_qualifier'] === false) { |
&& $this->valF['a_qualifier'] === false) { |
1478 |
|
|
1553 |
} |
} |
1554 |
} |
} |
1555 |
} |
} |
1556 |
} // fin de if($this->f->getParameter('option_erp')) |
} // fin de if($this->f->getParameter('option_erp') === 'true') |
1557 |
|
|
1558 |
// Ajout ou modification des demandeurs |
// Ajout ou modification des demandeurs |
1559 |
$this->insertLinkDemandeDemandeur($db, $DEBUG); |
$this->insertLinkDemandeDemandeur($db, $DEBUG); |
1836 |
**/ |
**/ |
1837 |
function getPostedValues() { |
function getPostedValues() { |
1838 |
// Récupération des demandeurs dans POST |
// Récupération des demandeurs dans POST |
1839 |
if (isset($_POST['petitionnaire_principal']) OR |
if ($this->f->get_submitted_post_value('petitionnaire_principal') !== null OR |
1840 |
isset($_POST['delegataire']) OR |
$this->f->get_submitted_post_value('delegataire') !== null OR |
1841 |
isset($_POST['petitionnaire'])) { |
$this->f->get_submitted_post_value('petitionnaire') !== null) { |
1842 |
if( isset($_POST['petitionnaire_principal']) AND |
if($this->f->get_submitted_post_value('petitionnaire_principal') !== null AND |
1843 |
!empty($_POST['petitionnaire_principal'])) { |
$this->f->get_submitted_post_value('petitionnaire_principal') != '') { |
1844 |
$this->postedIdDemandeur['petitionnaire_principal'] = $_POST['petitionnaire_principal']; |
$this->postedIdDemandeur['petitionnaire_principal'] = $this->f->get_submitted_post_value('petitionnaire_principal'); |
1845 |
} |
} |
1846 |
if( isset($_POST['delegataire']) AND |
if($this->f->get_submitted_post_value('delegataire') !== null AND |
1847 |
!empty($_POST['delegataire'])) { |
$this->f->get_submitted_post_value('delegataire') != '') { |
1848 |
$this->postedIdDemandeur['delegataire'] = $_POST['delegataire']; |
$this->postedIdDemandeur['delegataire'] = $this->f->get_submitted_post_value('delegataire'); |
1849 |
} |
} |
1850 |
if( isset($_POST['petitionnaire']) AND |
if($this->f->get_submitted_post_value('petitionnaire') !== null AND |
1851 |
!empty($_POST['petitionnaire'])) { |
$this->f->get_submitted_post_value('petitionnaire') != '') { |
1852 |
$this->postedIdDemandeur['petitionnaire'] = $_POST['petitionnaire']; |
$this->postedIdDemandeur['petitionnaire'] = $this->f->get_submitted_post_value('petitionnaire'); |
1853 |
} |
} |
1854 |
} |
} |
1855 |
} |
} |
2126 |
*/ |
*/ |
2127 |
$this->listeDemandeur("dossier", $this->getVal('dossier')); |
$this->listeDemandeur("dossier", $this->getVal('dossier')); |
2128 |
|
|
2129 |
if($maj < 2 AND !$this->correct AND !$this->f->isUserQualificateur()) { |
if($maj < 2 AND !$this->correct) { |
2130 |
$linkable = true; |
$linkable = true; |
2131 |
} else { |
} else { |
2132 |
$linkable = false; |
$linkable = false; |
2248 |
|
|
2249 |
$sql = "SELECT statut |
$sql = "SELECT statut |
2250 |
FROM ".DB_PREFIXE."etat |
FROM ".DB_PREFIXE."etat |
2251 |
WHERE etat ='".$etat."'"; |
WHERE libelle ='".$etat."'"; |
2252 |
$statut = $this->db->getOne($sql); |
$statut = $this->db->getOne($sql); |
2253 |
$this->f->addToLog("getStatut() : db->getOne(\"".$sql."\")", VERBOSE_MODE); |
$this->f->addToLog("getStatut() : db->getOne(\"".$sql."\")", VERBOSE_MODE); |
2254 |
if ( database::isError($statut)){ |
if ( database::isError($statut, true)){ |
2255 |
die(); |
die(); |
2256 |
} |
} |
2257 |
} |
} |
2318 |
echo "tab.php?"; |
echo "tab.php?"; |
2319 |
} |
} |
2320 |
// Permet de retourner sur la bonne page |
// Permet de retourner sur la bonne page |
2321 |
if (isset($_GET['retourformulaire']) && $_GET['retourformulaire'] != '') { |
if ($this->f->get_submitted_get_value('retourformulaire') !== null && $this->f->get_submitted_get_value('retourformulaire') != '') { |
2322 |
echo "obj=".$_GET['retourformulaire']; |
echo "obj=".$this->f->get_submitted_get_value('retourformulaire'); |
2323 |
} else { |
} else { |
2324 |
echo "obj=".get_class($this); |
echo "obj=".get_class($this); |
2325 |
} |
} |
2326 |
if (isset($_GET['retourformulaire2']) && $_GET['retourformulaire2'] != '') { |
if ($this->f->get_submitted_get_value('retourformulaire2') !== null && $this->f->get_submitted_get_value('retourformulaire2') != '') { |
2327 |
echo "&retourformulaire=".$_GET['retourformulaire2']; |
echo "&retourformulaire=".$this->f->get_submitted_get_value('retourformulaire2'); |
2328 |
} |
} |
2329 |
if($this->getParameter("retour")=="form") { |
if($this->getParameter("retour")=="form") { |
2330 |
echo "&idx=".$this->getParameter("idx"); |
echo "&idx=".$this->getParameter("idx"); |
2574 |
return $quartier; |
return $quartier; |
2575 |
} |
} |
2576 |
|
|
2577 |
|
/** |
2578 |
|
* Méthode permettant d'ajouter les données techniques d'un DI. |
2579 |
|
* |
2580 |
|
* @param integer $id identifiant de la demande |
2581 |
|
* @param database &$db handler de la base de donnée |
2582 |
|
* @param array $val tableau de valeurs postées via le formulaire |
2583 |
|
* @param boolean $DEBUG debug |
2584 |
|
* |
2585 |
|
* @return boolean false si erreur |
2586 |
|
*/ |
2587 |
|
function ajoutDonneesTechniquesDI($id, &$db, $val, $DEBUG) { |
2588 |
|
|
2589 |
|
//On vérifie que le dossier d'autorisation a des données techniques |
2590 |
|
$sql = "SELECT * " |
2591 |
|
."FROM ".DB_PREFIXE."donnees_techniques " |
2592 |
|
."WHERE dossier_autorisation = '".$this->valF["dossier_autorisation"]."'"; |
2593 |
|
$dtda = $this->db->query($sql); |
2594 |
|
$this->addToLog(__METHOD__."(): db->query(\"".$sql."\")", VERBOSE_MODE); |
2595 |
|
if($this->f->isDatabaseError($dtda, true)){ |
2596 |
|
$this->f->addToLog(__METHOD__."() : ERROR - Erreur de base de données. Impossible d'ajouter les données techniques du dossier d'instruction.", DEBUG_MODE); |
2597 |
|
return false; |
2598 |
|
} |
2599 |
|
|
2600 |
|
//Si le dossier d'autorisation a des données techniques |
2601 |
|
if ( $dtda->numrows() == 1 ){ |
2602 |
|
// |
2603 |
|
require_once '../obj/donnees_techniques.class.php'; |
2604 |
|
$dtdi = new donnees_techniques(']', $db, $DEBUG); |
2605 |
|
//Préparation des données |
2606 |
|
$valF = $dtda->fetchRow(DB_FETCHMODE_ASSOC); |
2607 |
|
//Suppression de l'identifiant |
2608 |
|
$valF["donnees_techniques"] = null; |
2609 |
|
// Ajout du numéro de dossier d'instruction |
2610 |
|
$valF['dossier_instruction'] = $this->valF['dossier']; |
2611 |
|
// Suppression du numéro de dossier d'autorisation |
2612 |
|
$valF['dossier_autorisation'] = null; |
2613 |
|
// Ajout des données techniques |
2614 |
|
if($dtdi->ajouter($valF, $db, $DEBUG) === false) { |
2615 |
|
$this->f->addToLog(__METHOD__."() : ERROR - Impossible d'ajouter les données techniques du dossier d'instruction.", DEBUG_MODE); |
2616 |
|
return false; |
2617 |
|
} |
2618 |
|
} |
2619 |
|
else { |
2620 |
|
//Le dossier d'autorisation n'a pas de données techniques |
2621 |
|
$this->f->addToLog(__METHOD__."() : ERROR - le DA n'a pas de données techniques.", DEBUG_MODE); |
2622 |
|
return -1; |
2623 |
|
} |
2624 |
|
|
2625 |
|
// |
2626 |
|
return true; |
2627 |
|
} |
2628 |
|
|
2629 |
|
/** |
2630 |
|
* VIEW - contrainte. |
2631 |
|
* |
2632 |
|
* Vue des contraintes du dossier |
2633 |
|
* |
2634 |
|
* Cette vue permet de gérer le contenu de l'onglet "Contrainte(s)" sur un |
2635 |
|
* dossier. Cette vue spécifique est nécessaire car l'ergonomie standard du |
2636 |
|
* framework ne prend pas en charge ce cas. |
2637 |
|
* C'est ici la vue spécifique des contraintes liées au dossier qui est |
2638 |
|
* affichée directement au clic de l'onglet au lieu du soustab. |
2639 |
|
* |
2640 |
|
* L'idée est donc de simuler l'ergonomie standard en créant un container |
2641 |
|
* et d'appeler la méthode javascript 'ajaxit' pour charger le contenu |
2642 |
|
* de la vue visualisation de l'objet lié. |
2643 |
|
* |
2644 |
|
* @return void |
2645 |
|
*/ |
2646 |
|
function view_contrainte() { |
2647 |
|
// Vérification de l'accessibilité sur l'élément |
2648 |
|
$this->checkAccessibility(); |
2649 |
|
// Récupération des variables GET |
2650 |
|
($this->f->get_submitted_get_value('idxformulaire')!==null ? $idxformulaire = |
2651 |
|
$this->f->get_submitted_get_value('idxformulaire') : $idxformulaire = ""); |
2652 |
|
($this->f->get_submitted_get_value('retourformulaire')!==null ? $retourformulaire = |
2653 |
|
$this->f->get_submitted_get_value('retourformulaire') : $retourformulaire = ""); |
2654 |
|
// Objet à charger |
2655 |
|
$obj = "dossier_contrainte"; |
2656 |
|
// Construction de l'url de sousformulaire à appeler |
2657 |
|
$url = "../scr/sousform.php?obj=".$obj; |
2658 |
|
$url .= "&idx=".$idxformulaire; |
2659 |
|
$url .= "&action=4"; |
2660 |
|
$url .= "&retourformulaire=".$retourformulaire; |
2661 |
|
$url .= "&idxformulaire=".$idxformulaire; |
2662 |
|
$url .= "&retour=form"; |
2663 |
|
// Affichage du container permettant le reffraichissement du contenu |
2664 |
|
// dans le cas des action-direct. |
2665 |
|
printf(' |
2666 |
|
<div id="sousform-href" data-href="%s"> |
2667 |
|
</div>', |
2668 |
|
$url |
2669 |
|
); |
2670 |
|
// Affichage du container permettant de charger le retour de la requête |
2671 |
|
// ajax récupérant le sous formulaire. |
2672 |
|
printf(' |
2673 |
|
<div id="sousform-%s"> |
2674 |
|
</div> |
2675 |
|
<script> |
2676 |
|
ajaxIt(\'%s\', \'%s\'); |
2677 |
|
</script>', |
2678 |
|
$obj, |
2679 |
|
$obj, |
2680 |
|
$url |
2681 |
|
); |
2682 |
|
} |
2683 |
|
|
2684 |
|
/** |
2685 |
|
* Cette methode permet d'afficher le bouton de validation du formulaire |
2686 |
|
* |
2687 |
|
* @param integer $maj Mode de mise a jour |
2688 |
|
* @return void |
2689 |
|
*/ |
2690 |
|
function bouton($maj) { |
2691 |
|
|
2692 |
|
if (!$this->correct |
2693 |
|
&& $this->checkActionAvailability() == true) { |
2694 |
|
// |
2695 |
|
switch($maj) { |
2696 |
|
case 0 : |
2697 |
|
$bouton = _("Ajouter"); |
2698 |
|
break; |
2699 |
|
case 1 : |
2700 |
|
$bouton = _("Modifier"); |
2701 |
|
break; |
2702 |
|
case 2 : |
2703 |
|
$bouton = _("Supprimer"); |
2704 |
|
break; |
2705 |
|
default : |
2706 |
|
// Actions specifiques |
2707 |
|
if ($this->get_action_param($maj, "button") != null) { |
2708 |
|
// |
2709 |
|
$bouton = $this->get_action_param($maj, "button"); |
2710 |
|
} else { |
2711 |
|
// |
2712 |
|
$bouton = _("Valider"); |
2713 |
|
} |
2714 |
|
break; |
2715 |
|
} |
2716 |
|
// |
2717 |
|
$params = array( |
2718 |
|
"value" => $bouton, |
2719 |
|
"name" => "submit", |
2720 |
|
"onclick"=>"return getDataFieldReferenceCadastrale();", |
2721 |
|
); |
2722 |
|
// |
2723 |
|
$this->f->layout->display_form_button($params); |
2724 |
|
} |
2725 |
|
|
2726 |
|
} |
2727 |
|
|
2728 |
}// fin classe |
}// fin classe |
2729 |
?> |
?> |