1 |
vpihour |
633 |
<?php |
2 |
|
|
//$Id$ |
3 |
|
|
//gen openMairie le 08/11/2012 14:59 |
4 |
|
|
|
5 |
|
|
require_once ("../gen/obj/lot.class.php"); |
6 |
|
|
|
7 |
|
|
class lot extends lot_gen { |
8 |
|
|
|
9 |
nhaye |
1268 |
var $postedValues = array(); |
10 |
|
|
var $donnees_techniques; |
11 |
|
|
var $idDT; |
12 |
|
|
|
13 |
vpihour |
633 |
function lot($id,&$db,$debug) { |
14 |
|
|
$this->constructeur($id,$db,$debug); |
15 |
nhaye |
1268 |
|
16 |
|
|
$this->donnees_techniques = $this->getDonneesTechniques(); |
17 |
vpihour |
633 |
}// fin constructeur |
18 |
|
|
|
19 |
nhaye |
1268 |
/** |
20 |
|
|
* Instantiation de la classe donnees techniques |
21 |
|
|
*/ |
22 |
|
|
function getDonneesTechniques() { |
23 |
|
|
$sql = "SELECT donnees_techniques FROM ".DB_PREFIXE."donnees_techniques WHERE lot = ".$this->getVal('lot'); |
24 |
|
|
$idDT = $this->db->getOne($sql); |
25 |
|
|
$this->f->addToLog("db->getone(\"".$sql."\");", VERBOSE_MODE); |
26 |
|
|
$this->f->isDatabaseError($idDT); |
27 |
|
|
if($idDT == "") { |
28 |
|
|
$idDT = "]"; |
29 |
|
|
} |
30 |
|
|
$this->idDT = $idDT; |
31 |
|
|
require_once ("../obj/donnees_techniques.class.php"); |
32 |
|
|
return new donnees_techniques($idDT, $this->db, DEBUG); |
33 |
|
|
} |
34 |
|
|
|
35 |
|
|
function setValF($val) { |
36 |
|
|
parent::setValF($val); |
37 |
|
|
// Récupération des id demandeurs postés |
38 |
|
|
foreach ($_POST as $key => $value) { |
39 |
|
|
if(!in_array($key,$this->champs)) { |
40 |
|
|
$this->postedValues[$key]=$value; |
41 |
|
|
} |
42 |
|
|
} |
43 |
|
|
} |
44 |
|
|
|
45 |
nhaye |
1240 |
function triggerAjouterApres($id, &$db, $val, $DEBUG) { |
46 |
|
|
parent::triggerAjouterApres($id, $db, $val, $DEBUG); |
47 |
nhaye |
1268 |
$this->postedValues['lot'] = $this->valF['lot']; |
48 |
|
|
$this->donnees_techniques->ajouter($this->postedValues, $db, $DEBUG); |
49 |
nhaye |
1240 |
|
50 |
nhaye |
1246 |
if($this->getParameter("idxformulaire") != "") { |
51 |
|
|
// Insertion du lien dossier/lot |
52 |
|
|
require_once ("../obj/lien_dossier_lot.class.php"); |
53 |
|
|
$ldl = new lien_dossier_lot("]", $db, $DEBUG); |
54 |
|
|
$valLdl['lien_dossier_lot'] = ""; |
55 |
|
|
$valLdl['dossier'] = $this->getParameter("idxformulaire"); |
56 |
|
|
$valLdl['lot'] = $this->valF["lot"]; |
57 |
|
|
$ldl->ajouter($valLdl, $db, $DEBUG); |
58 |
|
|
|
59 |
|
|
// Insertion du lien demandeur/lot |
60 |
|
|
require_once ("../obj/lien_lot_demandeur.class.php"); |
61 |
|
|
$lld = new lien_lot_demandeur("]", $db, $DEBUG); |
62 |
|
|
$sqlDemandeur = "SELECT * FROM ".DB_PREFIXE."lien_dossier_demandeur |
63 |
|
|
WHERE dossier='".$this->getParameter("idxformulaire")."'"; |
64 |
|
|
$res = $db->query($sqlDemandeur); |
65 |
|
|
$this->f->addToLog("db->query(\"".$sqlDemandeur."\");", VERBOSE_MODE); |
66 |
|
|
$this->f->isDatabaseError($res); |
67 |
|
|
while($row = $res->fetchRow(DB_FETCHMODE_ASSOC)) { |
68 |
|
|
unset($row['lien_dossier_demandeur']); |
69 |
|
|
unset($row['dossier']); |
70 |
|
|
$row['lien_lot_demandeur'] = ""; |
71 |
|
|
$row['lot'] = $this->valF["lot"]; |
72 |
|
|
$lld->ajouter($row, $db, $DEBUG); |
73 |
|
|
} |
74 |
nhaye |
1240 |
} |
75 |
|
|
} |
76 |
|
|
|
77 |
vpihour |
1245 |
/** |
78 |
|
|
* Cache le champ dossier_autorisation |
79 |
|
|
*/ |
80 |
vpihour |
1241 |
function setType(&$form,$maj) { |
81 |
|
|
parent::setType($form,$maj); |
82 |
|
|
|
83 |
|
|
$form->setType('dossier_autorisation', 'hidden'); |
84 |
|
|
} |
85 |
nhaye |
1268 |
|
86 |
|
|
|
87 |
vpihour |
1245 |
|
88 |
|
|
/** |
89 |
|
|
* Ajout de la liste des demandeurs |
90 |
|
|
*/ |
91 |
|
|
function sousformSpecificContent($maj) { |
92 |
nhaye |
1268 |
|
93 |
|
|
|
94 |
|
|
$this->donnees_techniques->afficherFormulaire($maj, $this->getParameter('validation'), |
95 |
|
|
$this->db, $this->postedValues, DEBUG, $this->idDT, $this->getParameter("idxformulaire"), |
96 |
|
|
"lot", $this->getParameter('typeformulaire'),$extra_parameters = array()); |
97 |
vpihour |
1245 |
//En consultation |
98 |
|
|
if ( $maj == 3 ){ |
99 |
|
|
|
100 |
|
|
//Récupère la liste des demandeurs |
101 |
|
|
$sql = "SELECT |
102 |
|
|
civilite.code as code, |
103 |
|
|
CASE WHEN demandeur.qualite='particulier' |
104 |
|
|
THEN TRIM(CONCAT(demandeur.particulier_nom, ' ', demandeur.particulier_prenom)) |
105 |
|
|
ELSE TRIM(CONCAT(demandeur.personne_morale_raison_sociale, ' ', demandeur.personne_morale_denomination)) |
106 |
|
|
END as nom, |
107 |
|
|
lien_lot_demandeur.petitionnaire_principal as petitionnaire_principal, |
108 |
|
|
demandeur.type_demandeur as type_demandeur |
109 |
|
|
FROM |
110 |
|
|
".DB_PREFIXE."lien_lot_demandeur |
111 |
|
|
LEFT JOIN |
112 |
|
|
".DB_PREFIXE."demandeur |
113 |
|
|
ON |
114 |
|
|
lien_lot_demandeur.demandeur = demandeur.demandeur |
115 |
|
|
LEFT JOIN |
116 |
|
|
".DB_PREFIXE."civilite |
117 |
|
|
ON |
118 |
|
|
demandeur.particulier_civilite = civilite.civilite OR |
119 |
|
|
demandeur.personne_morale_civilite = civilite.civilite |
120 |
|
|
WHERE lien_lot_demandeur.lot = ".$this->val[array_search('lot', $this->champs)]." |
121 |
|
|
ORDER BY demandeur.type_demandeur DESC"; |
122 |
|
|
|
123 |
|
|
$res = $this->f->db->query($sql); |
124 |
|
|
$this->f->addToLog("sousformSpecificContent() : ".$sql); |
125 |
|
|
$this->f->isDatabaseError($res); |
126 |
|
|
|
127 |
|
|
//Affichage des données |
128 |
|
|
echo "<div class=\"field field-type-static\">"; |
129 |
|
|
echo "<div class=\"form-libelle\">"; |
130 |
|
|
echo "<label id=\"lib-libelle\" class=\"libelle-demandeur\" for=\"demandeur\">"; |
131 |
|
|
echo _("demandeur"); |
132 |
|
|
echo "</label>"; |
133 |
|
|
echo "</div>"; |
134 |
|
|
echo "<div class=\"form-content\">"; |
135 |
|
|
echo "<span id=\"demandeur\" class=\"field_value\">"; |
136 |
|
|
|
137 |
|
|
$listDemandeur = ""; |
138 |
|
|
//La liste des demandeurs |
139 |
|
|
while($row=& $res->fetchRow(DB_FETCHMODE_ASSOC)){ |
140 |
|
|
|
141 |
|
|
//Ordonne l'affichage des demandeur |
142 |
|
|
if ( $row['petitionnaire_principal'] == 't' ){ |
143 |
|
|
|
144 |
|
|
$listDemandeur = $row['code']. " " . $row['nom'] . ", " . _("petitionnaire principal") . "<br/>".$listDemandeur; |
145 |
|
|
} |
146 |
|
|
else { |
147 |
|
|
|
148 |
|
|
$listDemandeur .= $row['code']. " " . $row['nom'] . ", " . $row['type_demandeur'] . "<br/>"; |
149 |
|
|
} |
150 |
|
|
} |
151 |
|
|
echo $listDemandeur; |
152 |
|
|
echo "</span>"; |
153 |
|
|
echo "</div>"; |
154 |
|
|
echo "</div>"; |
155 |
|
|
} |
156 |
|
|
} |
157 |
vpihour |
633 |
}// fin classe |
158 |
|
|
?> |