"._("dossier"); if(!isset($premier)) $premier=''; if(!isset($recherche1)) $recherche1=''; if(!isset($tricolsf)) $tricolsf=''; if(!isset($premiersf)) $premiersf=''; if(!isset($selection)) $selection=''; if(!isset($retourformulaire)) $retourformulaire=''; if (isset($idx) && $idx != ']' && trim($idx) != '') { $ent .= "-> ".$idx." "; } if (isset($idz) && trim($idz) != '') { $ent .= " ".strtoupper($idz)." "; } // FROM $table = DB_PREFIXE."dossier LEFT JOIN ".DB_PREFIXE."autorite_competente ON dossier.autorite_competente=autorite_competente.autorite_competente LEFT JOIN ".DB_PREFIXE."avis_decision ON dossier.avis_decision=avis_decision.avis_decision LEFT JOIN ".DB_PREFIXE."division ON dossier.division=division.division LEFT JOIN ".DB_PREFIXE."dossier_autorisation ON dossier.dossier_autorisation=dossier_autorisation.dossier_autorisation LEFT JOIN ".DB_PREFIXE."dossier_instruction_type ON dossier.dossier_instruction_type=dossier_instruction_type.dossier_instruction_type LEFT JOIN ".DB_PREFIXE."etat as etat5 ON dossier.etat=etat5.etat LEFT JOIN ".DB_PREFIXE."etat as etat6 ON dossier.etat_pendant_incompletude=etat6.etat LEFT JOIN ".DB_PREFIXE."evenement as evenement7 ON dossier.evenement_suivant_tacite=evenement7.evenement LEFT JOIN ".DB_PREFIXE."evenement as evenement8 ON dossier.evenement_suivant_tacite_incompletude=evenement8.evenement LEFT JOIN ".DB_PREFIXE."instructeur ON dossier.instructeur=instructeur.instructeur LEFT JOIN ".DB_PREFIXE."om_collectivite ON dossier.om_collectivite=om_collectivite.om_collectivite LEFT JOIN ".DB_PREFIXE."parcelle ON dossier.parcelle=parcelle.parcelle LEFT JOIN ".DB_PREFIXE."parcelle_lot ON dossier.parcelle_lot=parcelle_lot.parcelle_lot LEFT JOIN ".DB_PREFIXE."pos ON dossier.pos=pos.pos LEFT JOIN ".DB_PREFIXE."quartier ON dossier.quartier=quartier.quartier "; // SELECT $champAffiche = array( 'dossier.dossier as "'._("dossier").'"', 'dossier.annee as "'._("annee").'"', 'etat5.libelle as "'._("etat").'"', 'instructeur.nom as "'._("instructeur").'"', 'to_char(dossier.date_demande ,\'DD/MM/YYYY\') as "'._("date_demande").'"', 'to_char(dossier.date_depot ,\'DD/MM/YYYY\') as "'._("date_depot").'"', 'to_char(dossier.date_complet ,\'DD/MM/YYYY\') as "'._("date_complet").'"', 'to_char(dossier.date_rejet ,\'DD/MM/YYYY\') as "'._("date_rejet").'"', 'to_char(dossier.date_notification_delai ,\'DD/MM/YYYY\') as "'._("date_notification_delai").'"', 'dossier.delai as "'._("delai").'"', 'to_char(dossier.date_limite ,\'DD/MM/YYYY\') as "'._("date_limite").'"', 'dossier.accord_tacite as "'._("accord_tacite").'"', 'to_char(dossier.date_decision ,\'DD/MM/YYYY\') as "'._("date_decision").'"', 'to_char(dossier.date_validite ,\'DD/MM/YYYY\') as "'._("date_validite").'"', 'to_char(dossier.date_chantier ,\'DD/MM/YYYY\') as "'._("date_chantier").'"', 'to_char(dossier.date_achevement ,\'DD/MM/YYYY\') as "'._("date_achevement").'"', 'to_char(dossier.date_conformite ,\'DD/MM/YYYY\') as "'._("date_conformite").'"', 'parcelle.debut as "'._("parcelle").'"', 'pos.libelle as "'._("pos").'"', 'dossier.sig as "'._("sig").'"', 'dossier.batiment_nombre as "'._("batiment_nombre").'"', 'dossier.logement_nombre as "'._("logement_nombre").'"', 'dossier.shon as "'._("shon").'"', 'dossier.shon_calcul as "'._("shon_calcul").'"', 'dossier.shob as "'._("shob").'"', 'dossier.lot as "'._("lot").'"', 'dossier.hauteur as "'._("hauteur").'"', 'dossier.piece_nombre as "'._("piece_nombre").'"', 'dossier.amenagement as "'._("amenagement").'"', 'parcelle_lot.lotissement as "'._("parcelle_lot").'"', 'dossier.parcelle_lot_lotissement as "'._("parcelle_lot_lotissement").'"', 'dossier.temp1 as "'._("temp1").'"', 'dossier.temp2 as "'._("temp2").'"', 'dossier.temp3 as "'._("temp3").'"', 'dossier.temp4 as "'._("temp4").'"', 'dossier.temp5 as "'._("temp5").'"', "case dossier.erp when 't' then 'Oui' else 'Non' end as \""._("erp")."\"", 'avis_decision.libelle as "'._("avis_decision").'"', "case dossier.enjeu_erp when 't' then 'Oui' else 'Non' end as \""._("enjeu_erp")."\"", "case dossier.enjeu_urba when 't' then 'Oui' else 'Non' end as \""._("enjeu_urba")."\"", 'division.libelle as "'._("division").'"', 'autorite_competente.libelle as "'._("autorite_competente").'"', "case dossier.a_qualifier when 't' then 'Oui' else 'Non' end as \""._("a_qualifier")."\"", 'dossier.terrain_adresse_voie_numero as "'._("terrain_adresse_voie_numero").'"', 'dossier.terrain_adresse_voie as "'._("terrain_adresse_voie").'"', 'dossier.terrain_adresse_lieu_dit as "'._("terrain_adresse_lieu_dit").'"', 'dossier.terrain_adresse_localite as "'._("terrain_adresse_localite").'"', 'dossier.terrain_adresse_code_postal as "'._("terrain_adresse_code_postal").'"', 'dossier.terrain_adresse_bp as "'._("terrain_adresse_bp").'"', 'dossier.terrain_adresse_cedex as "'._("terrain_adresse_cedex").'"', 'dossier.terrain_superficie as "'._("terrain_superficie").'"', 'dossier_autorisation.dossier_autorisation_type_detaille as "'._("dossier_autorisation").'"', 'dossier_instruction_type.libelle as "'._("dossier_instruction_type").'"', 'to_char(dossier.date_dernier_depot ,\'DD/MM/YYYY\') as "'._("date_dernier_depot").'"', 'dossier.version as "'._("version").'"', "case dossier.incompletude when 't' then 'Oui' else 'Non' end as \""._("incompletude")."\"", 'evenement7.libelle as "'._("evenement_suivant_tacite").'"', 'evenement8.libelle as "'._("evenement_suivant_tacite_incompletude").'"', 'etat6.libelle as "'._("etat_pendant_incompletude").'"', 'to_char(dossier.date_limite_incompletude ,\'DD/MM/YYYY\') as "'._("date_limite_incompletude").'"', 'dossier.delai_incompletude as "'._("delai_incompletude").'"', 'dossier.dossier_libelle as "'._("dossier_libelle").'"', 'dossier.numero_versement_archive as "'._("numero_versement_archive").'"', 'dossier.duree_validite as "'._("duree_validite").'"', 'quartier.libelle as "'._("quartier").'"', "case dossier.incomplet_notifie when 't' then 'Oui' else 'Non' end as \""._("incomplet_notifie")."\"", 'dossier.tax_secteur as "'._("tax_secteur").'"', 'dossier.tax_mtn_part_commu as "'._("tax_mtn_part_commu").'"', 'dossier.tax_mtn_part_depart as "'._("tax_mtn_part_depart").'"', 'dossier.tax_mtn_part_reg as "'._("tax_mtn_part_reg").'"', 'dossier.tax_mtn_total as "'._("tax_mtn_total").'"', 'dossier.geom as "'._("geom").'"', 'dossier.geom1 as "'._("geom1").'"', ); // if ($_SESSION['niveau'] == '2') { array_push($champAffiche, "om_collectivite.libelle as \""._("collectivite")."\""); } // $champNonAffiche = array( 'dossier.description as "'._("description").'"', 'dossier.servitude as "'._("servitude").'"', 'dossier.terrain_references_cadastrales as "'._("terrain_references_cadastrales").'"', 'dossier.om_collectivite as "'._("om_collectivite").'"', 'dossier.log_instructions as "'._("log_instructions").'"', ); // $champRecherche = array( 'dossier.dossier as "'._("dossier").'"', 'dossier.annee as "'._("annee").'"', 'etat5.libelle as "'._("etat").'"', 'instructeur.nom as "'._("instructeur").'"', 'dossier.delai as "'._("delai").'"', 'dossier.accord_tacite as "'._("accord_tacite").'"', 'parcelle.debut as "'._("parcelle").'"', 'pos.libelle as "'._("pos").'"', 'dossier.sig as "'._("sig").'"', 'dossier.batiment_nombre as "'._("batiment_nombre").'"', 'dossier.logement_nombre as "'._("logement_nombre").'"', 'dossier.shon as "'._("shon").'"', 'dossier.shon_calcul as "'._("shon_calcul").'"', 'dossier.shob as "'._("shob").'"', 'dossier.lot as "'._("lot").'"', 'dossier.hauteur as "'._("hauteur").'"', 'dossier.piece_nombre as "'._("piece_nombre").'"', 'dossier.amenagement as "'._("amenagement").'"', 'parcelle_lot.lotissement as "'._("parcelle_lot").'"', 'dossier.parcelle_lot_lotissement as "'._("parcelle_lot_lotissement").'"', 'dossier.temp1 as "'._("temp1").'"', 'dossier.temp2 as "'._("temp2").'"', 'dossier.temp3 as "'._("temp3").'"', 'dossier.temp4 as "'._("temp4").'"', 'dossier.temp5 as "'._("temp5").'"', 'avis_decision.libelle as "'._("avis_decision").'"', 'division.libelle as "'._("division").'"', 'autorite_competente.libelle as "'._("autorite_competente").'"', 'dossier.terrain_adresse_voie_numero as "'._("terrain_adresse_voie_numero").'"', 'dossier.terrain_adresse_voie as "'._("terrain_adresse_voie").'"', 'dossier.terrain_adresse_lieu_dit as "'._("terrain_adresse_lieu_dit").'"', 'dossier.terrain_adresse_localite as "'._("terrain_adresse_localite").'"', 'dossier.terrain_adresse_code_postal as "'._("terrain_adresse_code_postal").'"', 'dossier.terrain_adresse_bp as "'._("terrain_adresse_bp").'"', 'dossier.terrain_adresse_cedex as "'._("terrain_adresse_cedex").'"', 'dossier.terrain_superficie as "'._("terrain_superficie").'"', 'dossier_autorisation.dossier_autorisation_type_detaille as "'._("dossier_autorisation").'"', 'dossier_instruction_type.libelle as "'._("dossier_instruction_type").'"', 'dossier.version as "'._("version").'"', 'evenement7.libelle as "'._("evenement_suivant_tacite").'"', 'evenement8.libelle as "'._("evenement_suivant_tacite_incompletude").'"', 'etat6.libelle as "'._("etat_pendant_incompletude").'"', 'dossier.delai_incompletude as "'._("delai_incompletude").'"', 'dossier.dossier_libelle as "'._("dossier_libelle").'"', 'dossier.numero_versement_archive as "'._("numero_versement_archive").'"', 'dossier.duree_validite as "'._("duree_validite").'"', 'quartier.libelle as "'._("quartier").'"', 'dossier.tax_secteur as "'._("tax_secteur").'"', 'dossier.tax_mtn_part_commu as "'._("tax_mtn_part_commu").'"', 'dossier.tax_mtn_part_depart as "'._("tax_mtn_part_depart").'"', 'dossier.tax_mtn_part_reg as "'._("tax_mtn_part_reg").'"', 'dossier.tax_mtn_total as "'._("tax_mtn_total").'"', ); // if ($_SESSION['niveau'] == '2') { array_push($champRecherche, "om_collectivite.libelle as \""._("collectivite")."\""); } $tri="ORDER BY dossier.annee ASC NULLS LAST"; $edition="dossier"; /** * Gestion de la clause WHERE => $selection */ // Filtre listing standard if ($_SESSION["niveau"] == "2") { // Filtre MULTI $selection = ""; } else { // Filtre MONO $selection = " WHERE (dossier.om_collectivite = '".$_SESSION["collectivite"]."') "; } // Liste des clés étrangères avec leurs éventuelles surcharges $foreign_keys_extended = array( "autorite_competente" => array("autorite_competente", ), "avis_decision" => array("avis_decision", ), "division" => array("division", ), "dossier_autorisation" => array("dossier_autorisation", ), "dossier_instruction_type" => array("dossier_instruction_type", ), "etat" => array("etat", ), "evenement" => array("evenement", ), "instructeur" => array("instructeur", ), "om_collectivite" => array("om_collectivite", ), "parcelle" => array("parcelle", ), "parcelle_lot" => array("parcelle_lot", ), "pos" => array("pos", ), "quartier" => array("quartier", ), ); // Filtre listing sous formulaire - autorite_competente if (in_array($retourformulaire, $foreign_keys_extended["autorite_competente"])) { if ($_SESSION["niveau"] == "2") { // Filtre MULTI $selection = " WHERE (dossier.autorite_competente = '".$idx."') "; } else { // Filtre MONO $selection = " WHERE (dossier.om_collectivite = '".$_SESSION["collectivite"]."') AND (dossier.autorite_competente = '".$idx."') "; } } // Filtre listing sous formulaire - avis_decision if (in_array($retourformulaire, $foreign_keys_extended["avis_decision"])) { if ($_SESSION["niveau"] == "2") { // Filtre MULTI $selection = " WHERE (dossier.avis_decision = '".$idx."') "; } else { // Filtre MONO $selection = " WHERE (dossier.om_collectivite = '".$_SESSION["collectivite"]."') AND (dossier.avis_decision = '".$idx."') "; } } // Filtre listing sous formulaire - division if (in_array($retourformulaire, $foreign_keys_extended["division"])) { if ($_SESSION["niveau"] == "2") { // Filtre MULTI $selection = " WHERE (dossier.division = '".$idx."') "; } else { // Filtre MONO $selection = " WHERE (dossier.om_collectivite = '".$_SESSION["collectivite"]."') AND (dossier.division = '".$idx."') "; } } // Filtre listing sous formulaire - dossier_autorisation if (in_array($retourformulaire, $foreign_keys_extended["dossier_autorisation"])) { if ($_SESSION["niveau"] == "2") { // Filtre MULTI $selection = " WHERE (dossier.dossier_autorisation = '".$idx."') "; } else { // Filtre MONO $selection = " WHERE (dossier.om_collectivite = '".$_SESSION["collectivite"]."') AND (dossier.dossier_autorisation = '".$idx."') "; } } // Filtre listing sous formulaire - dossier_instruction_type if (in_array($retourformulaire, $foreign_keys_extended["dossier_instruction_type"])) { if ($_SESSION["niveau"] == "2") { // Filtre MULTI $selection = " WHERE (dossier.dossier_instruction_type = '".$idx."') "; } else { // Filtre MONO $selection = " WHERE (dossier.om_collectivite = '".$_SESSION["collectivite"]."') AND (dossier.dossier_instruction_type = '".$idx."') "; } } // Filtre listing sous formulaire - etat if (in_array($retourformulaire, $foreign_keys_extended["etat"])) { if ($_SESSION["niveau"] == "2") { // Filtre MULTI $selection = " WHERE (dossier.etat = '".$idx."' OR dossier.etat_pendant_incompletude = '".$idx."') "; } else { // Filtre MONO $selection = " WHERE (dossier.om_collectivite = '".$_SESSION["collectivite"]."') AND (dossier.etat = '".$idx."' OR dossier.etat_pendant_incompletude = '".$idx."') "; } } // Filtre listing sous formulaire - evenement if (in_array($retourformulaire, $foreign_keys_extended["evenement"])) { if ($_SESSION["niveau"] == "2") { // Filtre MULTI $selection = " WHERE (dossier.evenement_suivant_tacite = '".$idx."' OR dossier.evenement_suivant_tacite_incompletude = '".$idx."') "; } else { // Filtre MONO $selection = " WHERE (dossier.om_collectivite = '".$_SESSION["collectivite"]."') AND (dossier.evenement_suivant_tacite = '".$idx."' OR dossier.evenement_suivant_tacite_incompletude = '".$idx."') "; } } // Filtre listing sous formulaire - instructeur if (in_array($retourformulaire, $foreign_keys_extended["instructeur"])) { if ($_SESSION["niveau"] == "2") { // Filtre MULTI $selection = " WHERE (dossier.instructeur = '".$idx."') "; } else { // Filtre MONO $selection = " WHERE (dossier.om_collectivite = '".$_SESSION["collectivite"]."') AND (dossier.instructeur = '".$idx."') "; } } // Filtre listing sous formulaire - om_collectivite if (in_array($retourformulaire, $foreign_keys_extended["om_collectivite"])) { if ($_SESSION["niveau"] == "2") { // Filtre MULTI $selection = " WHERE (dossier.om_collectivite = '".$idx."') "; } else { // Filtre MONO $selection = " WHERE (dossier.om_collectivite = '".$_SESSION["collectivite"]."') AND (dossier.om_collectivite = '".$idx."') "; } } // Filtre listing sous formulaire - parcelle if (in_array($retourformulaire, $foreign_keys_extended["parcelle"])) { if ($_SESSION["niveau"] == "2") { // Filtre MULTI $selection = " WHERE (dossier.parcelle = '".$idx."') "; } else { // Filtre MONO $selection = " WHERE (dossier.om_collectivite = '".$_SESSION["collectivite"]."') AND (dossier.parcelle = '".$idx."') "; } } // Filtre listing sous formulaire - parcelle_lot if (in_array($retourformulaire, $foreign_keys_extended["parcelle_lot"])) { if ($_SESSION["niveau"] == "2") { // Filtre MULTI $selection = " WHERE (dossier.parcelle_lot = '".$idx."') "; } else { // Filtre MONO $selection = " WHERE (dossier.om_collectivite = '".$_SESSION["collectivite"]."') AND (dossier.parcelle_lot = '".$idx."') "; } } // Filtre listing sous formulaire - pos if (in_array($retourformulaire, $foreign_keys_extended["pos"])) { if ($_SESSION["niveau"] == "2") { // Filtre MULTI $selection = " WHERE (dossier.pos = '".$idx."') "; } else { // Filtre MONO $selection = " WHERE (dossier.om_collectivite = '".$_SESSION["collectivite"]."') AND (dossier.pos = '".$idx."') "; } } // Filtre listing sous formulaire - quartier if (in_array($retourformulaire, $foreign_keys_extended["quartier"])) { if ($_SESSION["niveau"] == "2") { // Filtre MULTI $selection = " WHERE (dossier.quartier = '".$idx."') "; } else { // Filtre MONO $selection = " WHERE (dossier.om_collectivite = '".$_SESSION["collectivite"]."') AND (dossier.quartier = '".$idx."') "; } } /** * Gestion SOUSFORMULAIRE => $sousformulaire */ $sousformulaire = array( 'blocnote', 'consultation', 'demande', 'document_numerise', 'donnees_techniques', 'dossier_commission', 'dossier_contrainte', 'dossier_geolocalisation', 'dossier_message', 'dossier_parcelle', 'instruction', 'lien_dossier_demandeur', 'lot', 'rapport_instruction', ); ?>