<?php
//$Id$ 
//gen openMairie le 09/10/2012 10:26

require_once ("../obj/om_dbform.class.php");

class dossier_gen extends om_dbform {
    var $table="dossier";
    var $clePrimaire="dossier";
    var $typeCle="A";
    var $required_field=array(
        "date_depot",
        "dossier",
        "nature"
    );
    var $retourformulaire;

    function setvalF($val) {
        //affectation valeur formulaire
        $this->valF['dossier'] = $val['dossier'];
        $this->valF['nature'] = $val['nature'];
        if ($val['annee'] == "") {
            $this->valF['annee'] = ""; // -> default
        } else {
            $this->valF['annee'] = $val['annee'];
        }
        if ($val['etat'] == "") {
            $this->valF['etat'] = NULL;
        } else {
            $this->valF['etat'] = $val['etat'];
        }
        if ($val['types'] == "") {
            $this->valF['types'] = ""; // -> default
        } else {
            $this->valF['types'] = $val['types'];
        }
        if ($val['objet_dossier'] == "") {
            $this->valF['objet_dossier'] = ""; // -> default
        } else {
            $this->valF['objet_dossier'] = $val['objet_dossier'];
        }
        if (!is_numeric($val['instructeur'])) {
            $this->valF['instructeur'] = NULL;
        } else {
            $this->valF['instructeur'] = $val['instructeur'];
        }
        if ($val['date_demande'] != "") {
            $this->valF['date_demande'] = $this->dateDB($val['date_demande']);
        } else {
            $this->valF['date_demande'] = NULL;
        }
        if ($val['date_depot'] != "") {
            $this->valF['date_depot'] = $this->dateDB($val['date_depot']);
        }
        if ($val['date_complet'] != "") {
            $this->valF['date_complet'] = $this->dateDB($val['date_complet']);
        } else {
            $this->valF['date_complet'] = NULL;
        }
        if ($val['date_rejet'] != "") {
            $this->valF['date_rejet'] = $this->dateDB($val['date_rejet']);
        } else {
            $this->valF['date_rejet'] = NULL;
        }
        if ($val['date_notification_delai'] != "") {
            $this->valF['date_notification_delai'] = $this->dateDB($val['date_notification_delai']);
        } else {
            $this->valF['date_notification_delai'] = NULL;
        }
        if (!is_numeric($val['delai'])) {
            $this->valF['delai'] = 0; // -> default
        } else {
            $this->valF['delai'] = $val['delai'];
        }
        if ($val['date_limite'] != "") {
            $this->valF['date_limite'] = $this->dateDB($val['date_limite']);
        } else {
            $this->valF['date_limite'] = NULL;
        }
        if ($val['accord_tacite'] == "") {
            $this->valF['accord_tacite'] = ""; // -> default
        } else {
            $this->valF['accord_tacite'] = $val['accord_tacite'];
        }
        if ($val['date_decision'] != "") {
            $this->valF['date_decision'] = $this->dateDB($val['date_decision']);
        } else {
            $this->valF['date_decision'] = NULL;
        }
        if ($val['avis'] == "") {
            $this->valF['avis'] = NULL;
        } else {
            $this->valF['avis'] = $val['avis'];
        }
        if ($val['date_validite'] != "") {
            $this->valF['date_validite'] = $this->dateDB($val['date_validite']);
        } else {
            $this->valF['date_validite'] = NULL;
        }
        if ($val['date_chantier'] != "") {
            $this->valF['date_chantier'] = $this->dateDB($val['date_chantier']);
        } else {
            $this->valF['date_chantier'] = NULL;
        }
        if ($val['date_achevement'] != "") {
            $this->valF['date_achevement'] = $this->dateDB($val['date_achevement']);
        } else {
            $this->valF['date_achevement'] = NULL;
        }
        if ($val['date_conformite'] != "") {
            $this->valF['date_conformite'] = $this->dateDB($val['date_conformite']);
        } else {
            $this->valF['date_conformite'] = NULL;
        }
        if ($val['demandeur_civilite'] == "") {
            $this->valF['demandeur_civilite'] = NULL;
        } else {
            $this->valF['demandeur_civilite'] = $val['demandeur_civilite'];
        }
        if ($val['demandeur_nom'] == "") {
            $this->valF['demandeur_nom'] = ""; // -> default
        } else {
            $this->valF['demandeur_nom'] = $val['demandeur_nom'];
        }
        if ($val['demandeur_societe'] == "") {
            $this->valF['demandeur_societe'] = ""; // -> default
        } else {
            $this->valF['demandeur_societe'] = $val['demandeur_societe'];
        }
        if ($val['demandeur_adresse'] == "") {
            $this->valF['demandeur_adresse'] = ""; // -> default
        } else {
            $this->valF['demandeur_adresse'] = $val['demandeur_adresse'];
        }
        if ($val['demandeur_adresse_complement'] == "") {
            $this->valF['demandeur_adresse_complement'] = ""; // -> default
        } else {
            $this->valF['demandeur_adresse_complement'] = $val['demandeur_adresse_complement'];
        }
        if ($val['demandeur_cp'] == "") {
            $this->valF['demandeur_cp'] = ""; // -> default
        } else {
            $this->valF['demandeur_cp'] = $val['demandeur_cp'];
        }
        if ($val['demandeur_ville'] == "") {
            $this->valF['demandeur_ville'] = ""; // -> default
        } else {
            $this->valF['demandeur_ville'] = $val['demandeur_ville'];
        }
        if ($val['demandeur_pays'] == "") {
            $this->valF['demandeur_pays'] = ""; // -> default
        } else {
            $this->valF['demandeur_pays'] = $val['demandeur_pays'];
        }
        if ($val['demandeur_telephone'] == "") {
            $this->valF['demandeur_telephone'] = ""; // -> default
        } else {
            $this->valF['demandeur_telephone'] = $val['demandeur_telephone'];
        }
        if ($val['demandeur_email'] == "") {
            $this->valF['demandeur_email'] = ""; // -> default
        } else {
            $this->valF['demandeur_email'] = $val['demandeur_email'];
        }
        if (!is_numeric($val['demandeur_categorie'])) {
            $this->valF['demandeur_categorie'] = NULL;
        } else {
            $this->valF['demandeur_categorie'] = $val['demandeur_categorie'];
        }
        if ($val['delegataire'] == "") {
            $this->valF['delegataire'] = ""; // -> default
        } else {
            $this->valF['delegataire'] = $val['delegataire'];
        }
        if ($val['delegataire_civilite'] == "") {
            $this->valF['delegataire_civilite'] = NULL;
        } else {
            $this->valF['delegataire_civilite'] = $val['delegataire_civilite'];
        }
        if ($val['delegataire_nom'] == "") {
            $this->valF['delegataire_nom'] = ""; // -> default
        } else {
            $this->valF['delegataire_nom'] = $val['delegataire_nom'];
        }
        if ($val['delegataire_societe'] == "") {
            $this->valF['delegataire_societe'] = ""; // -> default
        } else {
            $this->valF['delegataire_societe'] = $val['delegataire_societe'];
        }
        if ($val['delegataire_adresse'] == "") {
            $this->valF['delegataire_adresse'] = ""; // -> default
        } else {
            $this->valF['delegataire_adresse'] = $val['delegataire_adresse'];
        }
        if ($val['delegataire_adresse_complement'] == "") {
            $this->valF['delegataire_adresse_complement'] = ""; // -> default
        } else {
            $this->valF['delegataire_adresse_complement'] = $val['delegataire_adresse_complement'];
        }
        if ($val['delegataire_cp'] == "") {
            $this->valF['delegataire_cp'] = ""; // -> default
        } else {
            $this->valF['delegataire_cp'] = $val['delegataire_cp'];
        }
        if ($val['delegataire_ville'] == "") {
            $this->valF['delegataire_ville'] = ""; // -> default
        } else {
            $this->valF['delegataire_ville'] = $val['delegataire_ville'];
        }
        if ($val['delegataire_pays'] == "") {
            $this->valF['delegataire_pays'] = ""; // -> default
        } else {
            $this->valF['delegataire_pays'] = $val['delegataire_pays'];
        }
        if ($val['delegataire_telephone'] == "") {
            $this->valF['delegataire_telephone'] = ""; // -> default
        } else {
            $this->valF['delegataire_telephone'] = $val['delegataire_telephone'];
        }
        if ($val['delegataire_email'] == "") {
            $this->valF['delegataire_email'] = ""; // -> default
        } else {
            $this->valF['delegataire_email'] = $val['delegataire_email'];
        }
        if ($val['terrain_numero'] == "") {
            $this->valF['terrain_numero'] = ""; // -> default
        } else {
            $this->valF['terrain_numero'] = $val['terrain_numero'];
        }
        if ($val['terrain_numero_complement'] == "") {
            $this->valF['terrain_numero_complement'] = ""; // -> default
        } else {
            $this->valF['terrain_numero_complement'] = $val['terrain_numero_complement'];
        }
        if ($val['terrain_adresse'] == "") {
            $this->valF['terrain_adresse'] = ""; // -> default
        } else {
            $this->valF['terrain_adresse'] = $val['terrain_adresse'];
        }
        if ($val['terrain_adresse_complement'] == "") {
            $this->valF['terrain_adresse_complement'] = ""; // -> default
        } else {
            $this->valF['terrain_adresse_complement'] = $val['terrain_adresse_complement'];
        }
        if ($val['terrain_cp'] == "") {
            $this->valF['terrain_cp'] = ""; // -> default
        } else {
            $this->valF['terrain_cp'] = $val['terrain_cp'];
        }
        if ($val['terrain_ville'] == "") {
            $this->valF['terrain_ville'] = ""; // -> default
        } else {
            $this->valF['terrain_ville'] = $val['terrain_ville'];
        }
        if (!is_numeric($val['architecte'])) {
            $this->valF['architecte'] = NULL;
        } else {
            $this->valF['architecte'] = $val['architecte'];
        }
        if (!is_numeric($val['terrain_surface'])) {
            $this->valF['terrain_surface'] = NULL;
        } else {
            $this->valF['terrain_surface'] = $val['terrain_surface'];
        }
        if (!is_numeric($val['terrain_surface_calcul'])) {
            $this->valF['terrain_surface_calcul'] = NULL;
        } else {
            $this->valF['terrain_surface_calcul'] = $val['terrain_surface_calcul'];
        }
        if ($val['rivoli'] == "") {
            $this->valF['rivoli'] = NULL;
        } else {
            $this->valF['rivoli'] = $val['rivoli'];
        }
        if (!is_numeric($val['travaux'])) {
            $this->valF['travaux'] = NULL;
        } else {
            $this->valF['travaux'] = $val['travaux'];
        }
        if ($val['travaux_complement'] == "") {
            $this->valF['travaux_complement'] = NULL;
        } else {
            $this->valF['travaux_complement'] = $val['travaux_complement'];
        }
        if ($val['parcelle'] == "") {
            $this->valF['parcelle'] = NULL;
        } else {
            $this->valF['parcelle'] = $val['parcelle'];
        }
        if ($val['pos'] == "") {
            $this->valF['pos'] = NULL;
        } else {
            $this->valF['pos'] = $val['pos'];
        }
        if ($val['sig'] == "") {
            $this->valF['sig'] = ""; // -> default
        } else {
            $this->valF['sig'] = $val['sig'];
        }
        if (!is_numeric($val['batiment_nombre'])) {
            $this->valF['batiment_nombre'] = NULL;
        } else {
            $this->valF['batiment_nombre'] = $val['batiment_nombre'];
        }
        if (!is_numeric($val['logement_nombre'])) {
            $this->valF['logement_nombre'] = NULL;
        } else {
            $this->valF['logement_nombre'] = $val['logement_nombre'];
        }
        if (!is_numeric($val['shon'])) {
            $this->valF['shon'] = NULL;
        } else {
            $this->valF['shon'] = $val['shon'];
        }
        if (!is_numeric($val['shon_calcul'])) {
            $this->valF['shon_calcul'] = NULL;
        } else {
            $this->valF['shon_calcul'] = $val['shon_calcul'];
        }
        if (!is_numeric($val['shob'])) {
            $this->valF['shob'] = NULL;
        } else {
            $this->valF['shob'] = $val['shob'];
        }
        if (!is_numeric($val['lot'])) {
            $this->valF['lot'] = NULL;
        } else {
            $this->valF['lot'] = $val['lot'];
        }
        if (!is_numeric($val['hauteur'])) {
            $this->valF['hauteur'] = NULL;
        } else {
            $this->valF['hauteur'] = $val['hauteur'];
        }
        if (!is_numeric($val['piece_nombre'])) {
            $this->valF['piece_nombre'] = NULL;
        } else {
            $this->valF['piece_nombre'] = $val['piece_nombre'];
        }
        if ($val['amenagement'] == "") {
            $this->valF['amenagement'] = ""; // -> default
        } else {
            $this->valF['amenagement'] = $val['amenagement'];
        }
        if (!is_numeric($val['parcelle_lot'])) {
            $this->valF['parcelle_lot'] = NULL;
        } else {
            $this->valF['parcelle_lot'] = $val['parcelle_lot'];
        }
        if ($val['parcelle_lot_lotissement'] == "") {
            $this->valF['parcelle_lot_lotissement'] = ""; // -> default
        } else {
            $this->valF['parcelle_lot_lotissement'] = $val['parcelle_lot_lotissement'];
        }
            $this->valF['description'] = $val['description'];
        if ($val['temp1'] == "") {
            $this->valF['temp1'] = ""; // -> default
        } else {
            $this->valF['temp1'] = $val['temp1'];
        }
        if ($val['temp2'] == "") {
            $this->valF['temp2'] = ""; // -> default
        } else {
            $this->valF['temp2'] = $val['temp2'];
        }
        if ($val['temp3'] == "") {
            $this->valF['temp3'] = ""; // -> default
        } else {
            $this->valF['temp3'] = $val['temp3'];
        }
        if ($val['temp4'] == "") {
            $this->valF['temp4'] = ""; // -> default
        } else {
            $this->valF['temp4'] = $val['temp4'];
        }
        if ($val['temp5'] == "") {
            $this->valF['temp5'] = ""; // -> default
        } else {
            $this->valF['temp5'] = $val['temp5'];
        }
            $this->valF['servitude'] = $val['servitude'];
        if ($val['geom'] == "") {
            unset($this->valF['geom']);
        } else {
            $this->valF['geom'] = $val['geom'];
        }
        if ($val['geom1'] == "") {
            unset($this->valF['geom1']);
        } else {
            $this->valF['geom1'] = $val['geom1'];
        }
    }

    //==========================
    // Formulaire  [form]
    //==========================

    function setType(&$form,$maj) {
        //type
        if ($maj==0){ //ajout
            $form->setType('dossier','text');

            if($this->retourformulaire=='nature'
               and $form->val['nature'] == $this->getParameter('idxformulaire')) {
                $form->setType('nature','selecthiddenstatic');
            } else {
                $form->setType('nature','select');
            }
            $form->setType('annee','text');

            if($this->retourformulaire=='etat'
               and $form->val['etat'] == $this->getParameter('idxformulaire')) {
                $form->setType('etat','selecthiddenstatic');
            } else {
                $form->setType('etat','select');
            }
            $form->setType('types','text');
            $form->setType('objet_dossier','text');

            if($this->retourformulaire=='om_utilisateur'
               and $form->val['instructeur'] == $this->getParameter('idxformulaire')) {
                $form->setType('instructeur','selecthiddenstatic');
            } else {
                $form->setType('instructeur','select');
            }
            if($this->retourformulaire=='')
                $form->setType('date_demande','date');
            else
                $form->setType('date_demande','date2');
            if($this->retourformulaire=='')
                $form->setType('date_depot','date');
            else
                $form->setType('date_depot','date2');
            if($this->retourformulaire=='')
                $form->setType('date_complet','date');
            else
                $form->setType('date_complet','date2');
            if($this->retourformulaire=='')
                $form->setType('date_rejet','date');
            else
                $form->setType('date_rejet','date2');
            if($this->retourformulaire=='')
                $form->setType('date_notification_delai','date');
            else
                $form->setType('date_notification_delai','date2');
            $form->setType('delai','text');
            if($this->retourformulaire=='')
                $form->setType('date_limite','date');
            else
                $form->setType('date_limite','date2');
            $form->setType('accord_tacite','text');
            if($this->retourformulaire=='')
                $form->setType('date_decision','date');
            else
                $form->setType('date_decision','date2');

            if($this->retourformulaire=='avis'
               and $form->val['avis'] == $this->getParameter('idxformulaire')) {
                $form->setType('avis','selecthiddenstatic');
            } else {
                $form->setType('avis','select');
            }
            if($this->retourformulaire=='')
                $form->setType('date_validite','date');
            else
                $form->setType('date_validite','date2');
            if($this->retourformulaire=='')
                $form->setType('date_chantier','date');
            else
                $form->setType('date_chantier','date2');
            if($this->retourformulaire=='')
                $form->setType('date_achevement','date');
            else
                $form->setType('date_achevement','date2');
            if($this->retourformulaire=='')
                $form->setType('date_conformite','date');
            else
                $form->setType('date_conformite','date2');

            if($this->retourformulaire=='civilite'
               and $form->val['demandeur_civilite'] == $this->getParameter('idxformulaire')) {
                $form->setType('demandeur_civilite','selecthiddenstatic');
            } else {
                $form->setType('demandeur_civilite','select');
            }
            $form->setType('demandeur_nom','text');
            $form->setType('demandeur_societe','text');
            $form->setType('demandeur_adresse','text');
            $form->setType('demandeur_adresse_complement','text');
            $form->setType('demandeur_cp','text');
            $form->setType('demandeur_ville','text');
            $form->setType('demandeur_pays','text');
            $form->setType('demandeur_telephone','text');
            $form->setType('demandeur_email','text');

            if($this->retourformulaire=='categorie_demandeur'
               and $form->val['demandeur_categorie'] == $this->getParameter('idxformulaire')) {
                $form->setType('demandeur_categorie','selecthiddenstatic');
            } else {
                $form->setType('demandeur_categorie','select');
            }
            $form->setType('delegataire','text');

            if($this->retourformulaire=='civilite'
               and $form->val['delegataire_civilite'] == $this->getParameter('idxformulaire')) {
                $form->setType('delegataire_civilite','selecthiddenstatic');
            } else {
                $form->setType('delegataire_civilite','select');
            }
            $form->setType('delegataire_nom','text');
            $form->setType('delegataire_societe','text');
            $form->setType('delegataire_adresse','text');
            $form->setType('delegataire_adresse_complement','text');
            $form->setType('delegataire_cp','text');
            $form->setType('delegataire_ville','text');
            $form->setType('delegataire_pays','text');
            $form->setType('delegataire_telephone','text');
            $form->setType('delegataire_email','text');
            $form->setType('terrain_numero','text');
            $form->setType('terrain_numero_complement','text');
            $form->setType('terrain_adresse','text');
            $form->setType('terrain_adresse_complement','text');
            $form->setType('terrain_cp','text');
            $form->setType('terrain_ville','text');

            if($this->retourformulaire=='architecte'
               and $form->val['architecte'] == $this->getParameter('idxformulaire')) {
                $form->setType('architecte','selecthiddenstatic');
            } else {
                $form->setType('architecte','select');
            }
            $form->setType('terrain_surface','text');
            $form->setType('terrain_surface_calcul','text');

            if($this->retourformulaire=='rivoli'
               and $form->val['rivoli'] == $this->getParameter('idxformulaire')) {
                $form->setType('rivoli','selecthiddenstatic');
            } else {
                $form->setType('rivoli','select');
            }

            if($this->retourformulaire=='travaux'
               and $form->val['travaux'] == $this->getParameter('idxformulaire')) {
                $form->setType('travaux','selecthiddenstatic');
            } else {
                $form->setType('travaux','select');
            }
            $form->setType('travaux_complement','text');

            if($this->retourformulaire=='parcelle'
               and $form->val['parcelle'] == $this->getParameter('idxformulaire')) {
                $form->setType('parcelle','selecthiddenstatic');
            } else {
                $form->setType('parcelle','select');
            }

            if($this->retourformulaire=='pos'
               and $form->val['pos'] == $this->getParameter('idxformulaire')) {
                $form->setType('pos','selecthiddenstatic');
            } else {
                $form->setType('pos','select');
            }
            $form->setType('sig','text');
            $form->setType('batiment_nombre','text');
            $form->setType('logement_nombre','text');
            $form->setType('shon','text');
            $form->setType('shon_calcul','text');
            $form->setType('shob','text');
            $form->setType('lot','text');
            $form->setType('hauteur','text');
            $form->setType('piece_nombre','text');
            $form->setType('amenagement','text');

            if($this->retourformulaire=='parcelle_lot'
               and $form->val['parcelle_lot'] == $this->getParameter('idxformulaire')) {
                $form->setType('parcelle_lot','selecthiddenstatic');
            } else {
                $form->setType('parcelle_lot','select');
            }
            $form->setType('parcelle_lot_lotissement','text');
            $form->setType('description','textarea');
            $form->setType('temp1','text');
            $form->setType('temp2','text');
            $form->setType('temp3','text');
            $form->setType('temp4','text');
            $form->setType('temp5','text');
            $form->setType('servitude','textarea');
            $form->setType('geom','geom');
            $form->setType('geom1','geom');
        }// fin ajout
        if ($maj==1){ //modifier
            $form->setType('dossier','hiddenstatic');

            if($this->retourformulaire=='nature'
               and $form->val['nature'] == $this->getParameter('idxformulaire')) {
                $form->setType('nature','selecthiddenstatic');
            } else {
                $form->setType('nature','select');
            }
            $form->setType('annee','text');

            if($this->retourformulaire=='etat'
               and $form->val['etat'] == $this->getParameter('idxformulaire')) {
                $form->setType('etat','selecthiddenstatic');
            } else {
                $form->setType('etat','select');
            }
            $form->setType('types','text');
            $form->setType('objet_dossier','text');

            if($this->retourformulaire=='om_utilisateur'
               and $form->val['instructeur'] == $this->getParameter('idxformulaire')) {
                $form->setType('instructeur','selecthiddenstatic');
            } else {
                $form->setType('instructeur','select');
            }
            if($this->retourformulaire=='')
                $form->setType('date_demande','date');
            else
                $form->setType('date_demande','date2');
            if($this->retourformulaire=='')
                $form->setType('date_depot','date');
            else
                $form->setType('date_depot','date2');
            if($this->retourformulaire=='')
                $form->setType('date_complet','date');
            else
                $form->setType('date_complet','date2');
            if($this->retourformulaire=='')
                $form->setType('date_rejet','date');
            else
                $form->setType('date_rejet','date2');
            if($this->retourformulaire=='')
                $form->setType('date_notification_delai','date');
            else
                $form->setType('date_notification_delai','date2');
            $form->setType('delai','text');
            if($this->retourformulaire=='')
                $form->setType('date_limite','date');
            else
                $form->setType('date_limite','date2');
            $form->setType('accord_tacite','text');
            if($this->retourformulaire=='')
                $form->setType('date_decision','date');
            else
                $form->setType('date_decision','date2');

            if($this->retourformulaire=='avis'
               and $form->val['avis'] == $this->getParameter('idxformulaire')) {
                $form->setType('avis','selecthiddenstatic');
            } else {
                $form->setType('avis','select');
            }
            if($this->retourformulaire=='')
                $form->setType('date_validite','date');
            else
                $form->setType('date_validite','date2');
            if($this->retourformulaire=='')
                $form->setType('date_chantier','date');
            else
                $form->setType('date_chantier','date2');
            if($this->retourformulaire=='')
                $form->setType('date_achevement','date');
            else
                $form->setType('date_achevement','date2');
            if($this->retourformulaire=='')
                $form->setType('date_conformite','date');
            else
                $form->setType('date_conformite','date2');

            if($this->retourformulaire=='civilite'
               and $form->val['demandeur_civilite'] == $this->getParameter('idxformulaire')) {
                $form->setType('demandeur_civilite','selecthiddenstatic');
            } else {
                $form->setType('demandeur_civilite','select');
            }
            $form->setType('demandeur_nom','text');
            $form->setType('demandeur_societe','text');
            $form->setType('demandeur_adresse','text');
            $form->setType('demandeur_adresse_complement','text');
            $form->setType('demandeur_cp','text');
            $form->setType('demandeur_ville','text');
            $form->setType('demandeur_pays','text');
            $form->setType('demandeur_telephone','text');
            $form->setType('demandeur_email','text');

            if($this->retourformulaire=='categorie_demandeur'
               and $form->val['demandeur_categorie'] == $this->getParameter('idxformulaire')) {
                $form->setType('demandeur_categorie','selecthiddenstatic');
            } else {
                $form->setType('demandeur_categorie','select');
            }
            $form->setType('delegataire','text');

            if($this->retourformulaire=='civilite'
               and $form->val['delegataire_civilite'] == $this->getParameter('idxformulaire')) {
                $form->setType('delegataire_civilite','selecthiddenstatic');
            } else {
                $form->setType('delegataire_civilite','select');
            }
            $form->setType('delegataire_nom','text');
            $form->setType('delegataire_societe','text');
            $form->setType('delegataire_adresse','text');
            $form->setType('delegataire_adresse_complement','text');
            $form->setType('delegataire_cp','text');
            $form->setType('delegataire_ville','text');
            $form->setType('delegataire_pays','text');
            $form->setType('delegataire_telephone','text');
            $form->setType('delegataire_email','text');
            $form->setType('terrain_numero','text');
            $form->setType('terrain_numero_complement','text');
            $form->setType('terrain_adresse','text');
            $form->setType('terrain_adresse_complement','text');
            $form->setType('terrain_cp','text');
            $form->setType('terrain_ville','text');

            if($this->retourformulaire=='architecte'
               and $form->val['architecte'] == $this->getParameter('idxformulaire')) {
                $form->setType('architecte','selecthiddenstatic');
            } else {
                $form->setType('architecte','select');
            }
            $form->setType('terrain_surface','text');
            $form->setType('terrain_surface_calcul','text');

            if($this->retourformulaire=='rivoli'
               and $form->val['rivoli'] == $this->getParameter('idxformulaire')) {
                $form->setType('rivoli','selecthiddenstatic');
            } else {
                $form->setType('rivoli','select');
            }

            if($this->retourformulaire=='travaux'
               and $form->val['travaux'] == $this->getParameter('idxformulaire')) {
                $form->setType('travaux','selecthiddenstatic');
            } else {
                $form->setType('travaux','select');
            }
            $form->setType('travaux_complement','text');

            if($this->retourformulaire=='parcelle'
               and $form->val['parcelle'] == $this->getParameter('idxformulaire')) {
                $form->setType('parcelle','selecthiddenstatic');
            } else {
                $form->setType('parcelle','select');
            }

            if($this->retourformulaire=='pos'
               and $form->val['pos'] == $this->getParameter('idxformulaire')) {
                $form->setType('pos','selecthiddenstatic');
            } else {
                $form->setType('pos','select');
            }
            $form->setType('sig','text');
            $form->setType('batiment_nombre','text');
            $form->setType('logement_nombre','text');
            $form->setType('shon','text');
            $form->setType('shon_calcul','text');
            $form->setType('shob','text');
            $form->setType('lot','text');
            $form->setType('hauteur','text');
            $form->setType('piece_nombre','text');
            $form->setType('amenagement','text');

            if($this->retourformulaire=='parcelle_lot'
               and $form->val['parcelle_lot'] == $this->getParameter('idxformulaire')) {
                $form->setType('parcelle_lot','selecthiddenstatic');
            } else {
                $form->setType('parcelle_lot','select');
            }
            $form->setType('parcelle_lot_lotissement','text');
            $form->setType('description','textarea');
            $form->setType('temp1','text');
            $form->setType('temp2','text');
            $form->setType('temp3','text');
            $form->setType('temp4','text');
            $form->setType('temp5','text');
            $form->setType('servitude','textarea');
            $form->setType('geom','geom');
            $form->setType('geom1','geom');
        }// fin modifier
        if ($maj==2){ //supprimer
            $form->setType('dossier','hiddenstatic');
            $form->setType('nature','selectstatic');
            $form->setType('annee','hiddenstatic');
            $form->setType('etat','selectstatic');
            $form->setType('types','hiddenstatic');
            $form->setType('objet_dossier','hiddenstatic');
            $form->setType('instructeur','selectstatic');
            $form->setType('date_demande','hiddenstatic');
            $form->setType('date_depot','hiddenstatic');
            $form->setType('date_complet','hiddenstatic');
            $form->setType('date_rejet','hiddenstatic');
            $form->setType('date_notification_delai','hiddenstatic');
            $form->setType('delai','hiddenstatic');
            $form->setType('date_limite','hiddenstatic');
            $form->setType('accord_tacite','hiddenstatic');
            $form->setType('date_decision','hiddenstatic');
            $form->setType('avis','selectstatic');
            $form->setType('date_validite','hiddenstatic');
            $form->setType('date_chantier','hiddenstatic');
            $form->setType('date_achevement','hiddenstatic');
            $form->setType('date_conformite','hiddenstatic');
            $form->setType('demandeur_civilite','selectstatic');
            $form->setType('demandeur_nom','hiddenstatic');
            $form->setType('demandeur_societe','hiddenstatic');
            $form->setType('demandeur_adresse','hiddenstatic');
            $form->setType('demandeur_adresse_complement','hiddenstatic');
            $form->setType('demandeur_cp','hiddenstatic');
            $form->setType('demandeur_ville','hiddenstatic');
            $form->setType('demandeur_pays','hiddenstatic');
            $form->setType('demandeur_telephone','hiddenstatic');
            $form->setType('demandeur_email','hiddenstatic');
            $form->setType('demandeur_categorie','selectstatic');
            $form->setType('delegataire','hiddenstatic');
            $form->setType('delegataire_civilite','selectstatic');
            $form->setType('delegataire_nom','hiddenstatic');
            $form->setType('delegataire_societe','hiddenstatic');
            $form->setType('delegataire_adresse','hiddenstatic');
            $form->setType('delegataire_adresse_complement','hiddenstatic');
            $form->setType('delegataire_cp','hiddenstatic');
            $form->setType('delegataire_ville','hiddenstatic');
            $form->setType('delegataire_pays','hiddenstatic');
            $form->setType('delegataire_telephone','hiddenstatic');
            $form->setType('delegataire_email','hiddenstatic');
            $form->setType('terrain_numero','hiddenstatic');
            $form->setType('terrain_numero_complement','hiddenstatic');
            $form->setType('terrain_adresse','hiddenstatic');
            $form->setType('terrain_adresse_complement','hiddenstatic');
            $form->setType('terrain_cp','hiddenstatic');
            $form->setType('terrain_ville','hiddenstatic');
            $form->setType('architecte','selectstatic');
            $form->setType('terrain_surface','hiddenstatic');
            $form->setType('terrain_surface_calcul','hiddenstatic');
            $form->setType('rivoli','selectstatic');
            $form->setType('travaux','selectstatic');
            $form->setType('travaux_complement','hiddenstatic');
            $form->setType('parcelle','selectstatic');
            $form->setType('pos','selectstatic');
            $form->setType('sig','hiddenstatic');
            $form->setType('batiment_nombre','hiddenstatic');
            $form->setType('logement_nombre','hiddenstatic');
            $form->setType('shon','hiddenstatic');
            $form->setType('shon_calcul','hiddenstatic');
            $form->setType('shob','hiddenstatic');
            $form->setType('lot','hiddenstatic');
            $form->setType('hauteur','hiddenstatic');
            $form->setType('piece_nombre','hiddenstatic');
            $form->setType('amenagement','hiddenstatic');
            $form->setType('parcelle_lot','selectstatic');
            $form->setType('parcelle_lot_lotissement','hiddenstatic');
            $form->setType('description','hiddenstatic');
            $form->setType('temp1','hiddenstatic');
            $form->setType('temp2','hiddenstatic');
            $form->setType('temp3','hiddenstatic');
            $form->setType('temp4','hiddenstatic');
            $form->setType('temp5','hiddenstatic');
            $form->setType('servitude','hiddenstatic');
            $form->setType('geom','hiddenstatic');
            $form->setType('geom1','hiddenstatic');
        }//fin supprimer
        if ($maj==3){ //consulter
            $form->setType('dossier','static');
            $form->setType('nature','selectstatic');
            $form->setType('annee','static');
            $form->setType('etat','selectstatic');
            $form->setType('types','static');
            $form->setType('objet_dossier','static');
            $form->setType('instructeur','selectstatic');
            $form->setType('date_demande','datestatic');
            $form->setType('date_depot','datestatic');
            $form->setType('date_complet','datestatic');
            $form->setType('date_rejet','datestatic');
            $form->setType('date_notification_delai','datestatic');
            $form->setType('delai','static');
            $form->setType('date_limite','datestatic');
            $form->setType('accord_tacite','static');
            $form->setType('date_decision','datestatic');
            $form->setType('avis','selectstatic');
            $form->setType('date_validite','datestatic');
            $form->setType('date_chantier','datestatic');
            $form->setType('date_achevement','datestatic');
            $form->setType('date_conformite','datestatic');
            $form->setType('demandeur_civilite','selectstatic');
            $form->setType('demandeur_nom','static');
            $form->setType('demandeur_societe','static');
            $form->setType('demandeur_adresse','static');
            $form->setType('demandeur_adresse_complement','static');
            $form->setType('demandeur_cp','static');
            $form->setType('demandeur_ville','static');
            $form->setType('demandeur_pays','static');
            $form->setType('demandeur_telephone','static');
            $form->setType('demandeur_email','static');
            $form->setType('demandeur_categorie','selectstatic');
            $form->setType('delegataire','static');
            $form->setType('delegataire_civilite','selectstatic');
            $form->setType('delegataire_nom','static');
            $form->setType('delegataire_societe','static');
            $form->setType('delegataire_adresse','static');
            $form->setType('delegataire_adresse_complement','static');
            $form->setType('delegataire_cp','static');
            $form->setType('delegataire_ville','static');
            $form->setType('delegataire_pays','static');
            $form->setType('delegataire_telephone','static');
            $form->setType('delegataire_email','static');
            $form->setType('terrain_numero','static');
            $form->setType('terrain_numero_complement','static');
            $form->setType('terrain_adresse','static');
            $form->setType('terrain_adresse_complement','static');
            $form->setType('terrain_cp','static');
            $form->setType('terrain_ville','static');
            $form->setType('architecte','selectstatic');
            $form->setType('terrain_surface','static');
            $form->setType('terrain_surface_calcul','static');
            $form->setType('rivoli','selectstatic');
            $form->setType('travaux','selectstatic');
            $form->setType('travaux_complement','static');
            $form->setType('parcelle','selectstatic');
            $form->setType('pos','selectstatic');
            $form->setType('sig','static');
            $form->setType('batiment_nombre','static');
            $form->setType('logement_nombre','static');
            $form->setType('shon','static');
            $form->setType('shon_calcul','static');
            $form->setType('shob','static');
            $form->setType('lot','static');
            $form->setType('hauteur','static');
            $form->setType('piece_nombre','static');
            $form->setType('amenagement','static');
            $form->setType('parcelle_lot','selectstatic');
            $form->setType('parcelle_lot_lotissement','static');
            $form->setType('description','textareastatic');
            $form->setType('temp1','static');
            $form->setType('temp2','static');
            $form->setType('temp3','static');
            $form->setType('temp4','static');
            $form->setType('temp5','static');
            $form->setType('servitude','textareastatic');
            $form->setType('geom','geom');
            $form->setType('geom1','geom');
        }//fin consulter
    }

    function setOnchange(&$form,$maj) {
    //javascript controle client
        $form->setOnchange('instructeur','VerifNum(this)');
        $form->setOnchange('date_demande','fdate(this)');
        $form->setOnchange('date_depot','fdate(this)');
        $form->setOnchange('date_complet','fdate(this)');
        $form->setOnchange('date_rejet','fdate(this)');
        $form->setOnchange('date_notification_delai','fdate(this)');
        $form->setOnchange('delai','VerifNum(this)');
        $form->setOnchange('date_limite','fdate(this)');
        $form->setOnchange('date_decision','fdate(this)');
        $form->setOnchange('date_validite','fdate(this)');
        $form->setOnchange('date_chantier','fdate(this)');
        $form->setOnchange('date_achevement','fdate(this)');
        $form->setOnchange('date_conformite','fdate(this)');
        $form->setOnchange('demandeur_categorie','VerifNum(this)');
        $form->setOnchange('architecte','VerifNum(this)');
        $form->setOnchange('terrain_surface','VerifNum(this)');
        $form->setOnchange('terrain_surface_calcul','VerifNum(this)');
        $form->setOnchange('travaux','VerifNum(this)');
        $form->setOnchange('batiment_nombre','VerifNum(this)');
        $form->setOnchange('logement_nombre','VerifNum(this)');
        $form->setOnchange('shon','VerifNum(this)');
        $form->setOnchange('shon_calcul','VerifNum(this)');
        $form->setOnchange('shob','VerifNum(this)');
        $form->setOnchange('lot','VerifNum(this)');
        $form->setOnchange('hauteur','VerifNum(this)');
        $form->setOnchange('piece_nombre','VerifNum(this)');
        $form->setOnchange('parcelle_lot','VerifNum(this)');
    }
    /**
     * Methode setTaille
     */
    function setTaille(&$form, $maj) {
        $form->setTaille("dossier", 12);
        $form->setTaille("nature", 10);
        $form->setTaille("annee", 10);
        $form->setTaille("etat", 20);
        $form->setTaille("types", 12);
        $form->setTaille("objet_dossier", 20);
        $form->setTaille("instructeur", 11);
        $form->setTaille("date_demande", 12);
        $form->setTaille("date_depot", 12);
        $form->setTaille("date_complet", 12);
        $form->setTaille("date_rejet", 12);
        $form->setTaille("date_notification_delai", 12);
        $form->setTaille("delai", 11);
        $form->setTaille("date_limite", 12);
        $form->setTaille("accord_tacite", 10);
        $form->setTaille("date_decision", 12);
        $form->setTaille("avis", 10);
        $form->setTaille("date_validite", 12);
        $form->setTaille("date_chantier", 12);
        $form->setTaille("date_achevement", 12);
        $form->setTaille("date_conformite", 12);
        $form->setTaille("demandeur_civilite", 10);
        $form->setTaille("demandeur_nom", 30);
        $form->setTaille("demandeur_societe", 30);
        $form->setTaille("demandeur_adresse", 30);
        $form->setTaille("demandeur_adresse_complement", 30);
        $form->setTaille("demandeur_cp", 10);
        $form->setTaille("demandeur_ville", 30);
        $form->setTaille("demandeur_pays", 30);
        $form->setTaille("demandeur_telephone", 14);
        $form->setTaille("demandeur_email", 30);
        $form->setTaille("demandeur_categorie", 11);
        $form->setTaille("delegataire", 10);
        $form->setTaille("delegataire_civilite", 10);
        $form->setTaille("delegataire_nom", 30);
        $form->setTaille("delegataire_societe", 30);
        $form->setTaille("delegataire_adresse", 30);
        $form->setTaille("delegataire_adresse_complement", 30);
        $form->setTaille("delegataire_cp", 10);
        $form->setTaille("delegataire_ville", 30);
        $form->setTaille("delegataire_pays", 30);
        $form->setTaille("delegataire_telephone", 14);
        $form->setTaille("delegataire_email", 30);
        $form->setTaille("terrain_numero", 10);
        $form->setTaille("terrain_numero_complement", 10);
        $form->setTaille("terrain_adresse", 30);
        $form->setTaille("terrain_adresse_complement", 30);
        $form->setTaille("terrain_cp", 10);
        $form->setTaille("terrain_ville", 30);
        $form->setTaille("architecte", 11);
        $form->setTaille("terrain_surface", 20);
        $form->setTaille("terrain_surface_calcul", 20);
        $form->setTaille("rivoli", 10);
        $form->setTaille("travaux", 11);
        $form->setTaille("travaux_complement", 30);
        $form->setTaille("parcelle", 20);
        $form->setTaille("pos", 10);
        $form->setTaille("sig", 10);
        $form->setTaille("batiment_nombre", 11);
        $form->setTaille("logement_nombre", 11);
        $form->setTaille("shon", 20);
        $form->setTaille("shon_calcul", 20);
        $form->setTaille("shob", 20);
        $form->setTaille("lot", 11);
        $form->setTaille("hauteur", 20);
        $form->setTaille("piece_nombre", 11);
        $form->setTaille("amenagement", 12);
        $form->setTaille("parcelle_lot", 11);
        $form->setTaille("parcelle_lot_lotissement", 30);
        $form->setTaille("description", 80);
        $form->setTaille("temp1", 30);
        $form->setTaille("temp2", 30);
        $form->setTaille("temp3", 30);
        $form->setTaille("temp4", 30);
        $form->setTaille("temp5", 30);
        $form->setTaille("servitude", 80);
        $form->setTaille("geom", 10);
        $form->setTaille("geom1", 10);
    }

    /**
     * Methode setMax
     */
    function setMax(&$form, $maj) {
        $form->setMax("dossier", 12);
        $form->setMax("nature", 2);
        $form->setMax("annee", 2);
        $form->setMax("etat", 20);
        $form->setMax("types", 12);
        $form->setMax("objet_dossier", 20);
        $form->setMax("instructeur", 11);
        $form->setMax("date_demande", 12);
        $form->setMax("date_depot", 12);
        $form->setMax("date_complet", 12);
        $form->setMax("date_rejet", 12);
        $form->setMax("date_notification_delai", 12);
        $form->setMax("delai", 11);
        $form->setMax("date_limite", 12);
        $form->setMax("accord_tacite", 3);
        $form->setMax("date_decision", 12);
        $form->setMax("avis", 2);
        $form->setMax("date_validite", 12);
        $form->setMax("date_chantier", 12);
        $form->setMax("date_achevement", 12);
        $form->setMax("date_conformite", 12);
        $form->setMax("demandeur_civilite", 10);
        $form->setMax("demandeur_nom", 80);
        $form->setMax("demandeur_societe", 80);
        $form->setMax("demandeur_adresse", 80);
        $form->setMax("demandeur_adresse_complement", 39);
        $form->setMax("demandeur_cp", 5);
        $form->setMax("demandeur_ville", 30);
        $form->setMax("demandeur_pays", 40);
        $form->setMax("demandeur_telephone", 14);
        $form->setMax("demandeur_email", 40);
        $form->setMax("demandeur_categorie", 11);
        $form->setMax("delegataire", 3);
        $form->setMax("delegataire_civilite", 10);
        $form->setMax("delegataire_nom", 80);
        $form->setMax("delegataire_societe", 80);
        $form->setMax("delegataire_adresse", 80);
        $form->setMax("delegataire_adresse_complement", 39);
        $form->setMax("delegataire_cp", 5);
        $form->setMax("delegataire_ville", 30);
        $form->setMax("delegataire_pays", 40);
        $form->setMax("delegataire_telephone", 14);
        $form->setMax("delegataire_email", 40);
        $form->setMax("terrain_numero", 4);
        $form->setMax("terrain_numero_complement", 5);
        $form->setMax("terrain_adresse", 80);
        $form->setMax("terrain_adresse_complement", 80);
        $form->setMax("terrain_cp", 5);
        $form->setMax("terrain_ville", 30);
        $form->setMax("architecte", 11);
        $form->setMax("terrain_surface", 20);
        $form->setMax("terrain_surface_calcul", 20);
        $form->setMax("rivoli", 4);
        $form->setMax("travaux", 11);
        $form->setMax("travaux_complement", 100);
        $form->setMax("parcelle", 20);
        $form->setMax("pos", 10);
        $form->setMax("sig", 3);
        $form->setMax("batiment_nombre", 11);
        $form->setMax("logement_nombre", 11);
        $form->setMax("shon", 20);
        $form->setMax("shon_calcul", 20);
        $form->setMax("shob", 20);
        $form->setMax("lot", 11);
        $form->setMax("hauteur", 20);
        $form->setMax("piece_nombre", 11);
        $form->setMax("amenagement", 12);
        $form->setMax("parcelle_lot", 11);
        $form->setMax("parcelle_lot_lotissement", 60);
        $form->setMax("description", 6);
        $form->setMax("temp1", 100);
        $form->setMax("temp2", 100);
        $form->setMax("temp3", 100);
        $form->setMax("temp4", 100);
        $form->setMax("temp5", 100);
        $form->setMax("servitude", 6);
        $form->setMax("geom", -5);
        $form->setMax("geom1", -5);
    }


    function setLib(&$form,$maj) {
    //libelle des champs
        $form->setLib('dossier',_('dossier'));
        $form->setLib('nature',_('nature'));
        $form->setLib('annee',_('annee'));
        $form->setLib('etat',_('etat'));
        $form->setLib('types',_('types'));
        $form->setLib('objet_dossier',_('objet_dossier'));
        $form->setLib('instructeur',_('instructeur'));
        $form->setLib('date_demande',_('date_demande'));
        $form->setLib('date_depot',_('date_depot'));
        $form->setLib('date_complet',_('date_complet'));
        $form->setLib('date_rejet',_('date_rejet'));
        $form->setLib('date_notification_delai',_('date_notification_delai'));
        $form->setLib('delai',_('delai'));
        $form->setLib('date_limite',_('date_limite'));
        $form->setLib('accord_tacite',_('accord_tacite'));
        $form->setLib('date_decision',_('date_decision'));
        $form->setLib('avis',_('avis'));
        $form->setLib('date_validite',_('date_validite'));
        $form->setLib('date_chantier',_('date_chantier'));
        $form->setLib('date_achevement',_('date_achevement'));
        $form->setLib('date_conformite',_('date_conformite'));
        $form->setLib('demandeur_civilite',_('demandeur_civilite'));
        $form->setLib('demandeur_nom',_('demandeur_nom'));
        $form->setLib('demandeur_societe',_('demandeur_societe'));
        $form->setLib('demandeur_adresse',_('demandeur_adresse'));
        $form->setLib('demandeur_adresse_complement',_('demandeur_adresse_complement'));
        $form->setLib('demandeur_cp',_('demandeur_cp'));
        $form->setLib('demandeur_ville',_('demandeur_ville'));
        $form->setLib('demandeur_pays',_('demandeur_pays'));
        $form->setLib('demandeur_telephone',_('demandeur_telephone'));
        $form->setLib('demandeur_email',_('demandeur_email'));
        $form->setLib('demandeur_categorie',_('demandeur_categorie'));
        $form->setLib('delegataire',_('delegataire'));
        $form->setLib('delegataire_civilite',_('delegataire_civilite'));
        $form->setLib('delegataire_nom',_('delegataire_nom'));
        $form->setLib('delegataire_societe',_('delegataire_societe'));
        $form->setLib('delegataire_adresse',_('delegataire_adresse'));
        $form->setLib('delegataire_adresse_complement',_('delegataire_adresse_complement'));
        $form->setLib('delegataire_cp',_('delegataire_cp'));
        $form->setLib('delegataire_ville',_('delegataire_ville'));
        $form->setLib('delegataire_pays',_('delegataire_pays'));
        $form->setLib('delegataire_telephone',_('delegataire_telephone'));
        $form->setLib('delegataire_email',_('delegataire_email'));
        $form->setLib('terrain_numero',_('terrain_numero'));
        $form->setLib('terrain_numero_complement',_('terrain_numero_complement'));
        $form->setLib('terrain_adresse',_('terrain_adresse'));
        $form->setLib('terrain_adresse_complement',_('terrain_adresse_complement'));
        $form->setLib('terrain_cp',_('terrain_cp'));
        $form->setLib('terrain_ville',_('terrain_ville'));
        $form->setLib('architecte',_('architecte'));
        $form->setLib('terrain_surface',_('terrain_surface'));
        $form->setLib('terrain_surface_calcul',_('terrain_surface_calcul'));
        $form->setLib('rivoli',_('rivoli'));
        $form->setLib('travaux',_('travaux'));
        $form->setLib('travaux_complement',_('travaux_complement'));
        $form->setLib('parcelle',_('parcelle'));
        $form->setLib('pos',_('pos'));
        $form->setLib('sig',_('sig'));
        $form->setLib('batiment_nombre',_('batiment_nombre'));
        $form->setLib('logement_nombre',_('logement_nombre'));
        $form->setLib('shon',_('shon'));
        $form->setLib('shon_calcul',_('shon_calcul'));
        $form->setLib('shob',_('shob'));
        $form->setLib('lot',_('lot'));
        $form->setLib('hauteur',_('hauteur'));
        $form->setLib('piece_nombre',_('piece_nombre'));
        $form->setLib('amenagement',_('amenagement'));
        $form->setLib('parcelle_lot',_('parcelle_lot'));
        $form->setLib('parcelle_lot_lotissement',_('parcelle_lot_lotissement'));
        $form->setLib('description',_('description'));
        $form->setLib('temp1',_('temp1'));
        $form->setLib('temp2',_('temp2'));
        $form->setLib('temp3',_('temp3'));
        $form->setLib('temp4',_('temp4'));
        $form->setLib('temp5',_('temp5'));
        $form->setLib('servitude',_('servitude'));
        $form->setLib('geom',_('geom'));
        $form->setLib('geom1',_('geom1'));
    }

    function setSelect(&$form, $maj,&$db,$debug) {
        if(file_exists ("../sql/".$db->phptype."/".$this->table.".form.inc.php"))
            include ("../sql/".$db->phptype."/".$this->table.".form.inc.php");
        elseif(file_exists ("../sql/".$db->phptype."/".$this->table.".form.inc"))
            include ("../sql/".$db->phptype."/".$this->table.".form.inc");

        // architecte
        $this->init_select($form, $db, $maj, $debug, "architecte",
                           $sql_architecte, $sql_architecte_by_id, false);

        // avis
        $this->init_select($form, $db, $maj, $debug, "avis",
                           $sql_avis, $sql_avis_by_id, false);

        // delegataire_civilite
        $this->init_select($form, $db, $maj, $debug, "delegataire_civilite",
                           $sql_delegataire_civilite, $sql_delegataire_civilite_by_id, false);

        // demandeur_categorie
        $this->init_select($form, $db, $maj, $debug, "demandeur_categorie",
                           $sql_demandeur_categorie, $sql_demandeur_categorie_by_id, false);

        // demandeur_civilite
        $this->init_select($form, $db, $maj, $debug, "demandeur_civilite",
                           $sql_demandeur_civilite, $sql_demandeur_civilite_by_id, false);

        // etat
        $this->init_select($form, $db, $maj, $debug, "etat",
                           $sql_etat, $sql_etat_by_id, false);

        // instructeur
        $this->init_select($form, $db, $maj, $debug, "instructeur",
                           $sql_instructeur, $sql_instructeur_by_id, false);

        // nature
        $this->init_select($form, $db, $maj, $debug, "nature",
                           $sql_nature, $sql_nature_by_id, false);

        // parcelle
        $this->init_select($form, $db, $maj, $debug, "parcelle",
                           $sql_parcelle, $sql_parcelle_by_id, false);

        // parcelle_lot
        $this->init_select($form, $db, $maj, $debug, "parcelle_lot",
                           $sql_parcelle_lot, $sql_parcelle_lot_by_id, false);

        // pos
        $this->init_select($form, $db, $maj, $debug, "pos",
                           $sql_pos, $sql_pos_by_id, false);

        // rivoli
        $this->init_select($form, $db, $maj, $debug, "rivoli",
                           $sql_rivoli, $sql_rivoli_by_id, false);

        // travaux
        $this->init_select($form, $db, $maj, $debug, "travaux",
                           $sql_travaux, $sql_travaux_by_id, false);
            // geom
            if($maj==1 || $maj==3){ //modification ou visualisation
                $contenu=array();
                $contenu[0]=array("dossier",$this->getParameter("idx"),"0");
                $form->setSelect('geom',$contenu);
            }
            // geom1
            if($maj==1 || $maj==3){ //modification ou visualisation
                $contenu=array();
                $contenu[0]=array("dossier",$this->getParameter("idx"),"1");
                $form->setSelect('geom1',$contenu);
            }
    }// fin select

    //==================================
    // sous Formulaire  [subform]
    //==================================

    function setValsousformulaire(&$form,$maj,$validation,$idxformulaire,$retourformulaire,$typeformulaire,&$db,$DEBUG=null){
        $this->retourformulaire = $retourformulaire;
        if($validation == 0) {
            if($retourformulaire =='architecte')
                $form->setVal('architecte', $idxformulaire);
            if($retourformulaire =='avis')
                $form->setVal('avis', $idxformulaire);
            if($retourformulaire =='categorie_demandeur')
                $form->setVal('demandeur_categorie', $idxformulaire);
            if($retourformulaire =='etat')
                $form->setVal('etat', $idxformulaire);
            if($retourformulaire =='om_utilisateur')
                $form->setVal('instructeur', $idxformulaire);
            if($retourformulaire =='nature')
                $form->setVal('nature', $idxformulaire);
            if($retourformulaire =='parcelle')
                $form->setVal('parcelle', $idxformulaire);
            if($retourformulaire =='parcelle_lot')
                $form->setVal('parcelle_lot', $idxformulaire);
            if($retourformulaire =='pos')
                $form->setVal('pos', $idxformulaire);
            if($retourformulaire =='rivoli')
                $form->setVal('rivoli', $idxformulaire);
            if($retourformulaire =='travaux')
                $form->setVal('travaux', $idxformulaire);
        }// fin validation
        if ($validation == 0 and $maj == 0) {
            if($retourformulaire =='civilite')
                $form->setVal('delegataire_civilite', $idxformulaire);
            if($retourformulaire =='civilite')
                $form->setVal('demandeur_civilite', $idxformulaire);
        }// fin validation
    }// fin setValsousformulaire

    //==================================
    // cle secondaire  [secondary key]
    //==================================
    /**
     * Methode clesecondaire
     */
    function cleSecondaire($id, &$db = NULL, $val = array(), $DEBUG = false) {
        // On appelle la methode de la classe parent
        parent::cleSecondaire($id, $db, $val, $DEBUG);
        // Verification de la cle secondaire : blocnote
        $this->rechercheTable($db, "blocnote", "dossier", $id);
        // Verification de la cle secondaire : consultation
        $this->rechercheTable($db, "consultation", "dossier", $id);
        // Verification de la cle secondaire : destination_shon
        $this->rechercheTable($db, "destination_shon", "dossier", $id);
        // Verification de la cle secondaire : instruction
        $this->rechercheTable($db, "instruction", "dossier", $id);
        // Verification de la cle secondaire : statistique
        $this->rechercheTable($db, "statistique", "dossier", $id);
        // Verification de la cle secondaire : terrain
        $this->rechercheTable($db, "terrain", "dossier", $id);
    }


}// fin classe
?>