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 |
|
|
26 |
var $aff_description = "startClosed"; |
var $aff_description = "startClosed"; |
27 |
var $aff_amenagement = "startClosed"; |
var $aff_amenagement = "startClosed"; |
28 |
|
|
29 |
function dossier($id,&$db,$DEBUG) { |
function dossier($id,&$db,$DEBUG) { |
30 |
$this->constructeur($id,$db,$DEBUG); |
$this->constructeur($id,$db,$DEBUG); |
31 |
} // fin constructeur |
} // fin constructeur |
32 |
|
|
33 |
|
// {{{ Gestion de la confidentialité des données spécifiques |
34 |
|
|
35 |
|
/** |
36 |
|
* Surcharge pour gérer les actions disponibles dans le portlet |
37 |
|
*/ |
38 |
|
function checkAccessibility() { |
39 |
|
// |
40 |
|
parent::checkAccessibility(); |
41 |
|
// Si l'utilisateur est un intructeur qui en correspond pas à la |
42 |
|
// division du dossier |
43 |
|
if ($this->f->isUserInstructeur() |
44 |
|
&& isset($this->f->om_utilisateur["division"]) |
45 |
|
&& $this->f->om_utilisateur["division"] != $this->getDivisionFromDossier()) { |
46 |
|
// |
47 |
|
$this->actions_sup = array(); |
48 |
|
$this->setParameter("actions", array()); |
49 |
|
} |
50 |
|
} |
51 |
|
|
52 |
|
/** |
53 |
|
* Cette methode est à surcharger elle permet de tester dans chaque classe |
54 |
|
* des droits des droits spécifiques en fonction des données |
55 |
|
*/ |
56 |
|
function canAccess() { |
57 |
|
// Si l'utilisateur est un intructeur qui ne correspond pas à la |
58 |
|
// division du dossier |
59 |
|
if ($this->f->isUserInstructeur() |
60 |
|
&& $this->f->om_utilisateur["division"] != $this->getDivisionFromDossier() |
61 |
|
&& $this->getParameter("maj") != 3) { |
62 |
|
// |
63 |
|
return false; |
64 |
|
} |
65 |
|
// |
66 |
|
return true; |
67 |
|
} |
68 |
|
|
69 |
|
/** |
70 |
|
* Cette méthode permet de récupérer la division d'un dossier |
71 |
|
*/ |
72 |
|
function getDivisionFromDossier() { |
73 |
|
// |
74 |
|
if (!isset($this->val[array_search("dossier", $this->champs)])) { |
75 |
|
return NULL; |
76 |
|
} |
77 |
|
// |
78 |
|
$sql = "select division from ".DB_PREFIXE."dossier "; |
79 |
|
$sql .= " where dossier='".$this->val[array_search("dossier", $this->champs)]."'"; |
80 |
|
// |
81 |
|
$division = $this->db->getOne($sql); |
82 |
|
$this->addToLog("getDivisionFromDossier(): db->getone(\"".$sql."\")", VERBOSE_MODE); |
83 |
|
database::isError($division); |
84 |
|
// |
85 |
|
return $division; |
86 |
|
} |
87 |
|
|
88 |
|
// }}} |
89 |
|
|
90 |
function setValFAjout($val = array()) { |
function setValFAjout($val = array()) { |
91 |
// Cle primaire |
$this->valF['dossier'] = $val['dossier_autorisation'].str_pad(rand(1, 99),2, "0", STR_PAD_LEFT); |
|
$lettre=$this->f->collectivite["lettre"]; |
|
|
$numero_unique = $this->f->collectivite["numero_unique"]; |
|
|
if($numero_unique==1){ |
|
|
// numero unique (voir dyn/var.inc) |
|
|
$temp=$this->$db->nextId(DB_PREFIXE.$this->table); |
|
|
}else{ |
|
|
// numero suivant nature |
|
|
$temp=$this->db->nextId(DB_PREFIXE."dossier_".$val['nature']); |
|
|
} |
|
|
$temp=str_pad($temp,4,"0", STR_PAD_LEFT); |
|
|
$this->valF['dossier'] = $this->valF['nature'].$this->valF['annee']. |
|
|
$lettre.$temp; |
|
92 |
} |
} |
93 |
|
|
94 |
function setvalF($val){ |
function setvalF($val){ |
322 |
$form->setType('temp3',$temp3_type); |
$form->setType('temp3',$temp3_type); |
323 |
$form->setType('temp4',$temp4_type); |
$form->setType('temp4',$temp4_type); |
324 |
$form->setType('temp5',$temp5_type); |
$form->setType('temp5',$temp5_type); |
325 |
|
$form->setType('a_qualifier', 'checkbox'); |
326 |
} |
} |
327 |
if ($maj == 1) { |
if ($maj == 1) { |
328 |
// |
// |
355 |
$form->setType('parcelle_lot_archive','hidden'); |
$form->setType('parcelle_lot_archive','hidden'); |
356 |
$form->setType('geom1','hidden'); |
$form->setType('geom1','hidden'); |
357 |
$form->setType('geom','hidden'); |
$form->setType('geom','hidden'); |
358 |
|
$form->setType('a_qualifier', 'checkboxstatic'); |
359 |
} |
} |
|
$form->setType('a_qualifier', 'hidden'); |
|
360 |
// |
// |
361 |
if(!$this->f->getParameter('afficher_division') === 'true') { |
if(!$this->f->getParameter('afficher_division') === 'true') { |
362 |
$form->setType('division', 'hidden'); |
$form->setType('division', 'hidden'); |
363 |
} |
} |
364 |
|
$form->setType('dossier_autorisation', 'hiddenstatic'); |
365 |
|
// |
366 |
|
if ($maj == 0) { |
367 |
|
$form->setType('dossier_autorisation', 'select'); |
368 |
|
} |
369 |
|
// On cache enjeu_ERP si l'option n'est pas activée |
370 |
|
if($this->f->getParameter('option_ERP') != 'true') { |
371 |
|
$form->setType('erp', 'hidden'); |
372 |
|
$form->setType('enjeu_erp', 'hidden'); |
373 |
|
} |
374 |
} |
} |
375 |
|
|
376 |
function setVal(&$form,$maj,$validation){ |
function setVal(&$form,$maj,$validation){ |
665 |
$form->setFieldset('date_complet', 'D', _('Instruction'), 'col_12'); |
$form->setFieldset('date_complet', 'D', _('Instruction'), 'col_12'); |
666 |
$form->setRegroupe('date_conformite','F',''); |
$form->setRegroupe('date_conformite','F',''); |
667 |
// |
// |
668 |
$form->setBloc('geom1', 'F'); |
$form->setBloc('terrain_superficie', 'F'); |
669 |
|
|
670 |
} |
} |
671 |
|
|
765 |
$form->setRegroupe('amenagement','D',_('Amenagement'), $this->aff_amenagement); |
$form->setRegroupe('amenagement','D',_('Amenagement'), $this->aff_amenagement); |
766 |
$form->setRegroupe('parcelle_lot','G',''); |
$form->setRegroupe('parcelle_lot','G',''); |
767 |
$form->setRegroupe('parcelle_lot_lotissement','F',''); |
$form->setRegroupe('parcelle_lot_lotissement','F',''); |
768 |
|
|
769 |
} |
} |
770 |
|
|
|
|
|
|
|
|
771 |
/* ============================================================= |
/* ============================================================= |
772 |
* fonction trigger relative a la connexion SIG |
* fonction trigger relative a la connexion SIG |
773 |
* $sig = 1 dans dyn/var.inc |
* $sig = 1 dans dyn/var.inc |
774 |
|
* utilisé aussi pour envoyer une message au service REST d'ERP |
775 |
* =============================================================== |
* =============================================================== |
776 |
*/ |
*/ |
777 |
|
|
787 |
$this->addToMessage("<br>"._("Parcelle non renseignee dans dossier")." ".$id." <br>"); |
$this->addToMessage("<br>"._("Parcelle non renseignee dans dossier")." ".$id." <br>"); |
788 |
|
|
789 |
} |
} |
790 |
|
|
791 |
|
// envoi du message a ERP en cas d'un depot du dossier dat |
792 |
|
if ($this->valF['nature'] == |
793 |
|
$this->f->getParameter('erp_depot_dossier_dat')) { |
794 |
|
$msgenque = new MessageEnqueuer(); |
795 |
|
$msgenque->setDossierInstructionIdentifier($this->valF['dossier']); |
796 |
|
$msgenque->enqueueMessage($msgenque::$ERP_DEPOT_DOSSIER_DAT); |
797 |
|
} |
798 |
|
|
799 |
|
// envoi du message a ERP en cas d'une demande d'ouverture DAT |
800 |
|
if ($this->valF['nature'] == |
801 |
|
$this->f->getParameter('erp_demande_ouverture_dat')) { |
802 |
|
$msgenque = new MessageEnqueuer(); |
803 |
|
$msgenque->setDossierInstructionIdentifier($this->valF['dossier']); |
804 |
|
$msgenque->enqueueMessage($msgenque::$ERP_DEMANDE_OUVERTURE_DAT); |
805 |
|
} |
806 |
|
|
807 |
|
if ($this->valF['erp'] === true) { |
808 |
|
// envoi du message a ERP en cas d'annulation d'une demande |
809 |
|
if ($this->valF['nature'] == |
810 |
|
$this->f->getParameter('erp_annulation_demande')) { |
811 |
|
$msgenque = new MessageEnqueuer(); |
812 |
|
$msgenque->setDossierInstructionIdentifier($this->valF['dossier']); |
813 |
|
$msgenque->enqueueMessage($msgenque::$ERP_ANNULATION_DEMANDE); |
814 |
|
} |
815 |
|
|
816 |
|
// envoi du message a ERP en cas d'ouverture d'un dossier PC "rattache" |
817 |
|
// au dossier DAACT |
818 |
|
if ($this->valF['nature'] == |
819 |
|
$this->f->getParameter('erp_demande_ouverture_pc_daact')) { |
820 |
|
$msgenque = new MessageEnqueuer(); |
821 |
|
$msgenque->setDossierInstructionIdentifier($this->valF['dossier']); |
822 |
|
$msgenque->enqueueMessage($msgenque::$ERP_DEMANDE_OUVERTURE_PC); |
823 |
|
} |
824 |
|
} |
825 |
|
|
826 |
} |
} |
827 |
|
|
828 |
/* |
/* |
829 |
* Calcul l'identifiant du quartier et d'un arrondissement d'une parcelle |
* Calcul l'identifiant du quartier et d'un arrondissement d'une parcelle |
830 |
* */ |
* */ |
831 |
function getQuartierArrondissement($parcelle, &$quartier, &$arrondissement, &$db) { |
function getQuartierArrondissement($parcelle) { |
832 |
|
|
833 |
$parcelle = trim($parcelle); |
$parcelle = trim($parcelle); |
834 |
$quartier = ''; |
$quartier = ''; |
835 |
|
|
836 |
/*Code impots*/ |
/*Récupère le code impot du quartier dans la parcelle*/ |
837 |
for ( $i = 0 ; $i < strlen($parcelle) ; $i++ ) |
for ( $i = 0 ; $i < strlen($parcelle) ; $i++ ){ |
838 |
if (is_numeric($parcelle[$i]) ) |
|
839 |
|
if (is_numeric($parcelle[$i]) ){ |
840 |
|
|
841 |
$quartier .= $parcelle[$i]; |
$quartier .= $parcelle[$i]; |
842 |
else |
} |
843 |
|
else{ |
844 |
|
|
845 |
break; |
break; |
846 |
|
} |
847 |
|
} |
848 |
|
|
849 |
if ( $quartier !== '' ){ |
if ( $quartier !== '' ){ |
850 |
|
|
852 |
$sql = "SELECT |
$sql = "SELECT |
853 |
quartier, arrondissement |
quartier, arrondissement |
854 |
FROM |
FROM |
855 |
quartier |
".DB_PREFIXE."quartier |
856 |
WHERE |
WHERE |
857 |
code_impots='$quartier'"; |
code_impots='$quartier'"; |
858 |
|
|
859 |
$res = $db->query($sql); |
$this->addToLog("getQuartierArrondissement(parcelle) : db->query(\"$sql\")", VERBOSE_MODE); |
860 |
|
$res = $this->db->query($sql); |
861 |
if (database :: isError($res)) |
if (database :: isError($res)) |
862 |
die($res->getMessage()."erreur ".$sql); |
die($res->getMessage()."erreur ".$sql); |
863 |
|
|
864 |
if ( $res->numRows() > 0 ){ |
if ( $res->numRows() > 0 ){ |
865 |
|
|
866 |
while ($row=& $res->fetchRow(DB_FETCHMODE_ASSOC)){ |
return $res->fetchRow(DB_FETCHMODE_ASSOC); |
|
|
|
|
$quartier = $row['quartier']; |
|
|
$arrondissement = $row['arrondissement']; |
|
|
} |
|
867 |
} |
} |
868 |
} |
} |
869 |
|
|
870 |
|
return NULL; |
871 |
} |
} |
872 |
|
|
873 |
/* |
/* |
888 |
/* |
/* |
889 |
* Retourne l'intructeur correspondant le mieux à la parcelle |
* Retourne l'intructeur correspondant le mieux à la parcelle |
890 |
* */ |
* */ |
891 |
function getInstructeur( $quartier, $arrondissement, $section, $nature, &$db, &$division) { |
function getInstructeurDivision( $quartier, $arrondissement, $section, $dossier_autorisation) { |
892 |
|
|
893 |
|
$quartier = ( $quartier == NULL ) ? -1 : $quartier; |
894 |
|
$arrondissement = ( $arrondissement == NULL ) ? -1 : $arrondissement; |
895 |
|
|
896 |
|
/*Récupération du dossier_autorisation_type_detaille concerné par le $dossier_autorisation*/ |
897 |
$sql = " |
$sql = " |
898 |
SELECT |
SELECT |
899 |
instructeur, section, quartier, arrondissement, nature |
dossier_autorisation_type_detaille |
900 |
FROM |
FROM |
901 |
lien_localisation_nature l |
".DB_PREFIXE."dossier_autorisation |
902 |
WHERE |
WHERE |
903 |
( nature IS NULL AND arrondissement IS NULL AND quartier IS NULL AND section IS NULL ) OR |
dossier_autorisation = '$dossier_autorisation'"; |
904 |
( nature IS NULL AND arrondissement IS NULL AND quartier IS NULL AND section = '$section' ) OR |
|
905 |
( nature IS NULL AND arrondissement IS NULL AND quartier = $quartier AND section IS NULL ) OR |
$this->addToLog("getInstructeurDivision : db->query(\"$sql\")", VERBOSE_MODE); |
906 |
( nature IS NULL AND arrondissement IS NULL AND quartier = $quartier AND section = '$section' ) OR |
$resDATD = $this->db->query($sql); |
907 |
( nature IS NULL AND arrondissement = $arrondissement AND quartier IS NULL AND section IS NULL ) OR |
if (database :: isError($resDATD)) |
908 |
( nature IS NULL AND arrondissement = $arrondissement AND quartier IS NULL AND section = '$section' ) OR |
die($resDATD->getMessage()."erreur ".$sql); |
|
( 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); |
|
909 |
|
|
910 |
if ( $res->numRows() > 0 ){ |
if ( $resDATD->numRows() > 0 ){ |
911 |
$row=& $res->fetchRow(DB_FETCHMODE_ASSOC); |
$rowDATD = $resDATD->fetchRow(DB_FETCHMODE_ASSOC); |
912 |
|
|
913 |
$sql = "SELECT division FROM instructeur WHERE instructeur = ".$row['instructeur']; |
$sql = " |
914 |
$res = $db->query($sql); |
SELECT |
915 |
|
instructeur, section, quartier, arrondissement, dossier_autorisation_type_detaille |
916 |
|
FROM |
917 |
|
".DB_PREFIXE."affectation_automatique l |
918 |
|
WHERE |
919 |
|
( dossier_autorisation_type_detaille IS NULL AND arrondissement IS NULL AND quartier IS NULL AND section IS NULL ) OR |
920 |
|
( dossier_autorisation_type_detaille IS NULL AND arrondissement IS NULL AND quartier IS NULL AND section = '$section' ) OR |
921 |
|
( dossier_autorisation_type_detaille IS NULL AND arrondissement IS NULL AND quartier = $quartier AND section IS NULL ) OR |
922 |
|
( dossier_autorisation_type_detaille IS NULL AND arrondissement IS NULL AND quartier = $quartier AND section = '$section' ) OR |
923 |
|
( dossier_autorisation_type_detaille IS NULL AND arrondissement = $arrondissement AND quartier IS NULL AND section IS NULL ) OR |
924 |
|
( dossier_autorisation_type_detaille IS NULL AND arrondissement = $arrondissement AND quartier IS NULL AND section = '$section' ) OR |
925 |
|
( dossier_autorisation_type_detaille IS NULL AND arrondissement = $arrondissement AND quartier = $quartier AND section IS NULL ) OR |
926 |
|
( dossier_autorisation_type_detaille IS NULL AND arrondissement = $arrondissement AND quartier = $quartier AND section = '$section' ) OR |
927 |
|
( dossier_autorisation_type_detaille = ".$rowDATD['dossier_autorisation_type_detaille']." AND arrondissement IS NULL AND quartier IS NULL AND section IS NULL ) OR |
928 |
|
( dossier_autorisation_type_detaille = ".$rowDATD['dossier_autorisation_type_detaille']." AND arrondissement IS NULL AND quartier IS NULL AND section = '$section' ) OR |
929 |
|
( dossier_autorisation_type_detaille = ".$rowDATD['dossier_autorisation_type_detaille']." AND arrondissement IS NULL AND quartier = $quartier AND section IS NULL ) OR |
930 |
|
( dossier_autorisation_type_detaille = ".$rowDATD['dossier_autorisation_type_detaille']." AND arrondissement IS NULL AND quartier = $quartier AND section = '$section' ) OR |
931 |
|
( dossier_autorisation_type_detaille = ".$rowDATD['dossier_autorisation_type_detaille']." AND arrondissement = $arrondissement AND quartier IS NULL AND section IS NULL ) OR |
932 |
|
( dossier_autorisation_type_detaille = ".$rowDATD['dossier_autorisation_type_detaille']." AND arrondissement = $arrondissement AND quartier IS NULL AND section = '$section' ) OR |
933 |
|
( dossier_autorisation_type_detaille = ".$rowDATD['dossier_autorisation_type_detaille']." AND arrondissement = $arrondissement AND quartier = $quartier AND section IS NULL ) OR |
934 |
|
( dossier_autorisation_type_detaille = ".$rowDATD['dossier_autorisation_type_detaille']." AND arrondissement = $arrondissement AND quartier = $quartier AND section = '$section' ) |
935 |
|
ORDER BY section, quartier, arrondissement, dossier_autorisation_type_detaille |
936 |
|
LIMIT 1 |
937 |
|
"; |
938 |
|
|
939 |
|
$this->addToLog("getInstructeurDivision : db->query(\"$sql\")", VERBOSE_MODE); |
940 |
|
$res = $this->db->query($sql); |
941 |
if (database :: isError($res)) |
if (database :: isError($res)) |
942 |
die($res->getMessage()."erreur ".$sql); |
die($res->getMessage()."erreur ".$sql); |
943 |
|
|
944 |
if ( $res->numRows() > 0 ){ |
if ( $res->numRows() > 0 ){ |
945 |
$rowT=& $res->fetchRow(DB_FETCHMODE_ASSOC); |
|
946 |
$division = $rowT['division']; |
$row = $res->fetchRow(DB_FETCHMODE_ASSOC); |
947 |
|
|
948 |
|
$sql = "SELECT division FROM ".DB_PREFIXE."instructeur WHERE instructeur = ".$row['instructeur']; |
949 |
|
$res = $this->db->query($sql); |
950 |
|
if (database :: isError($res)) |
951 |
|
die($res->getMessage()."erreur ".$sql); |
952 |
|
|
953 |
|
if ( $res->numRows() > 0 ){ |
954 |
|
|
955 |
|
$rowT=& $res->fetchRow(DB_FETCHMODE_ASSOC); |
956 |
|
$row['division'] = $rowT['division']; |
957 |
|
} |
958 |
|
|
959 |
|
return $row; |
960 |
} |
} |
|
|
|
|
return $row['instructeur']; |
|
961 |
} |
} |
962 |
|
|
963 |
return NULL; |
return NULL; |
964 |
} |
} |
965 |
|
|
970 |
*/ |
*/ |
971 |
|
|
972 |
function triggerajouter($id,&$db,$val,$DEBUG) { |
function triggerajouter($id,&$db,$val,$DEBUG) { |
973 |
|
// |
974 |
|
$this->addToLog("triggerajouter() : start", EXTRA_VERBOSE_MODE); |
975 |
|
|
976 |
|
// Initialisation des variables nécessaires à l'affectation automatique |
977 |
|
$quartier = NULL; |
978 |
|
$arrondissement = NULL; |
979 |
|
$section = NULL; |
980 |
|
$instructeur = NULL; |
981 |
|
|
982 |
|
// Si la parcelle n'est pas vide alors on récupère la section, le |
983 |
|
// quartier et l'arrondissement |
984 |
|
if ($val['parcelle'] != '') { |
985 |
|
// Cette méthode récupère l'arrondissement et le quartier associé à une parcelle |
986 |
|
$quartierArrondissement = $this->getQuartierArrondissement($val['parcelle']); |
987 |
|
if ( $quartierArrondissement!= NULL ){ |
988 |
|
|
989 |
/*Localisation*/ |
$quartier = $quartierArrondissement['quartier']; |
990 |
$quartier = 'NULL'; |
$arrondissement = $quartierArrondissement['arrondissement']; |
991 |
$arrondissement = 'NULL'; |
} |
992 |
$section = 'NULL' ; |
// Si il n'y a pas d'arrondissement alors on vide le quartier |
993 |
|
if ( strcmp($arrondissement,'') == 0 ) { |
994 |
if($val['parcelle']!=''){ |
|
995 |
|
$arrondissement = NULL; |
996 |
$this->getQuartierArrondissement($val['parcelle'], $quartier, $arrondissement, $db); |
$quartier = NULL; |
997 |
|
} |
998 |
if ( strcmp($arrondissement,'NULL') == 0 ) |
// On récupère la section |
|
$quartier = 'NULL'; |
|
|
|
|
999 |
$section = $this->getSection($val['parcelle']); |
$section = $this->getSection($val['parcelle']); |
1000 |
|
} |
1001 |
|
|
1002 |
|
// Si aucun instructeur n'est saisi et que la dossier_autorisation_type_detaille n'est pas vide |
1003 |
|
// alors on récupère l'instructeur et la division depuis l'affectation |
1004 |
|
if ( ( empty($this->valF['instructeur']) || $this->valF['instructeur'] == '' ) && $val['dossier_autorisation'] != '' ) { |
1005 |
|
|
1006 |
/*Instructeur*/ |
// |
1007 |
if ( ( empty($this->valF['instructeur']) || $this->valF['instructeur'] == '' ) && $val['nature'] != '' ){ |
$instructeurDivision = $this->getInstructeurDivision($quartier, $arrondissement, $section, $val['dossier_autorisation']); |
1008 |
|
if ( $instructeurDivision != NULL ){ |
1009 |
|
|
1010 |
$division = ''; |
$instructeur = $instructeurDivision['instructeur']; |
1011 |
$instructeur = $this->getInstructeur($quartier, $arrondissement, $section, $val['nature'], $db, $division); |
$division = $instructeurDivision['division']; |
1012 |
|
} |
1013 |
|
|
1014 |
|
if ( $instructeur != NULL ){ |
1015 |
|
|
1016 |
if ( $instructeur != NULL ){ |
$this->valF['instructeur'] = $instructeur; |
1017 |
$this->valF['instructeur'] = $instructeur; |
$this->valF['division'] = $division; |
1018 |
$this->valF['division'] = $division; |
} else { |
1019 |
} |
if ($this->f->isAccredited("dossier_modifier_instructeur")) { |
1020 |
else { |
$this->addToMessage("<br/> "._("Pensez a assigner un instructeur a ce dossier.")." <br/>"); |
1021 |
if ( is_numeric($_SESSION['profil']) && $_SESSION['profil'] == 5 ) |
} else { |
1022 |
$this->addToMessage("<br/> "._("Pensez a assigner un instructeur 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/>"); |
|
else |
|
|
$this->addToMessage("<br/> "._("Aucun instructeur compatible avec ce dossier trouve, contactez votre administrateur afin d'en assigner un a ce dossier.")." <br/>"); |
|
1023 |
} |
} |
1024 |
} |
} |
1025 |
|
} else { |
1026 |
else |
$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/>"); |
|
1027 |
} |
} |
1028 |
|
// |
1029 |
else |
$this->addToLog("triggerajouter() : end", EXTRA_VERBOSE_MODE); |
|
$this->addToMessage("<br/> "._("Pensez a assigner un instructeur a ce dossier.")." <br/>"); |
|
1030 |
} |
} |
1031 |
|
|
1032 |
function triggermodifierapres($id,&$db,$val,$DEBUG) { |
function triggermodifierapres($id,&$db,$val,$DEBUG) { |
1046 |
} |
} |
1047 |
$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>"); |
1048 |
} |
} |
1049 |
} |
} |
1050 |
|
|
1051 |
|
// BOGUE: le test pour la nature doit etre change parce que |
1052 |
|
// 'erp_depot_dossier_dat' n'a pas la connexion directe avec |
1053 |
|
// qualification d'un dossier, mais c'est necessaire pour les tests |
1054 |
|
if ($this->val[array_search('a_qualifier', $this->champs)] == 't' |
1055 |
|
&& $this->valF['a_qualifier'] === false) { |
1056 |
|
|
1057 |
|
$dossier_nature_dat = array( |
1058 |
|
$this->f->getParameter('erp_depot_dossier_dat'), |
1059 |
|
$this->f->getParameter('erp_demande_ouverture_dat')); |
1060 |
|
|
1061 |
|
// envoi du message "ERP Qualifie" pour un dossier DAT qui a besoin |
1062 |
|
// de la qualification URBA |
1063 |
|
if (in_array($this->valF['nature'], $dossier_nature_dat)) { |
1064 |
|
$msgenque = new MessageEnqueuer(); |
1065 |
|
$msgenque->setDossierInstructionIdentifier($this->valF['dossier']); |
1066 |
|
$msgenque->setCompetence($this->valF['autorite_competente']); |
1067 |
|
$msgenque->setContraintePlu($this->valF['servitude']); |
1068 |
|
$msgenque->setReferenceCadastrale( |
1069 |
|
$this->getReferenceCadastrale($this->valF['dossier'])); |
1070 |
|
$msgenque->enqueueMessage($msgenque::$ERP_QUALIFIE); |
1071 |
|
} |
1072 |
|
|
1073 |
|
// envoi des messages a ERP en cas du dossier PC traite par URBA, et |
1074 |
|
// qui etait classifie come ERP |
1075 |
|
if ($this->valF['nature'] == 'PC' && $this->valF['erp'] == true) { |
1076 |
|
$msgenque = new MessageEnqueuer(); |
1077 |
|
$msgenque->setDossierInstructionIdentifier($this->valF['dossier']); |
1078 |
|
$msgenque->enqueueMessage($msgenque::$ERP_DEMANDE_COMPLETUDE_PC); |
1079 |
|
$msgenque->enqueueMessage($msgenque::$ERP_DEMANDE_QUALIFICATION_PC); |
1080 |
|
} |
1081 |
|
|
1082 |
|
} |
1083 |
|
|
1084 |
} |
} |
1085 |
|
|
1086 |
|
|
1087 |
|
/** |
1088 |
|
* Retourne la reference cadastrale de la demande attache a un dossier ERP |
1089 |
|
* specifique |
1090 |
|
* @param string $dossier L'identifiant du dossier |
1091 |
|
* @return string|null La reference cadastrale si elle est trouve, |
1092 |
|
* sinon NULL. En cas d'erreur de la BD, l'execution s'arrete. |
1093 |
|
*/ |
1094 |
|
function getReferenceCadastrale($dossier) { |
1095 |
|
$sql = "SELECT terrain_references_cadastrales FROM ".DB_PREFIXE."demande WHERE dossier_instruction = '" . $dossier . "'"; |
1096 |
|
$res = $this->db->limitquery($sql, 0, 1); |
1097 |
|
$this->addToLog("getReferenceCadastrale(): db->limitquery(\"". |
1098 |
|
str_replace(",",", ",$sql)."\", 0, 1);", VERBOSE_MODE); |
1099 |
|
// Si une erreur survient on die |
1100 |
|
if (database::isError($res, true)) { |
1101 |
|
// Appel de la methode de recuperation des erreurs |
1102 |
|
$this->erreur_db($res->getDebugInfo(), $res->getMessage(), 'demande'); |
1103 |
|
} |
1104 |
|
// retourne la nature du dossier |
1105 |
|
while ($row =& $res->fetchRow()) { |
1106 |
|
return $row[0]; |
1107 |
|
} |
1108 |
|
// la nature n'etait pas trouve, ce qui ne devrait pas se passer |
1109 |
|
return NULL; |
1110 |
|
} |
1111 |
|
|
1112 |
|
|
1113 |
function sig_parametre(&$db){ |
function sig_parametre(&$db){ |
1114 |
if (file_exists ("../dyn/var.inc")) |
if (file_exists ("../dyn/var.inc")) |