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 $donnees_techniques; |
10 |
|
|
var $idDT; |
11 |
|
|
|
12 |
vpihour |
633 |
function lot($id,&$db,$debug) { |
13 |
|
|
$this->constructeur($id,$db,$debug); |
14 |
nhaye |
1268 |
|
15 |
vpihour |
633 |
}// fin constructeur |
16 |
|
|
|
17 |
nhaye |
1268 |
|
18 |
nhaye |
1240 |
function triggerAjouterApres($id, &$db, $val, $DEBUG) { |
19 |
|
|
parent::triggerAjouterApres($id, $db, $val, $DEBUG); |
20 |
|
|
|
21 |
nhaye |
1246 |
if($this->getParameter("idxformulaire") != "") { |
22 |
|
|
// Insertion du lien dossier/lot |
23 |
|
|
require_once ("../obj/lien_dossier_lot.class.php"); |
24 |
|
|
$ldl = new lien_dossier_lot("]", $db, $DEBUG); |
25 |
|
|
$valLdl['lien_dossier_lot'] = ""; |
26 |
|
|
$valLdl['dossier'] = $this->getParameter("idxformulaire"); |
27 |
|
|
$valLdl['lot'] = $this->valF["lot"]; |
28 |
|
|
$ldl->ajouter($valLdl, $db, $DEBUG); |
29 |
|
|
|
30 |
|
|
// Insertion du lien demandeur/lot |
31 |
|
|
require_once ("../obj/lien_lot_demandeur.class.php"); |
32 |
|
|
$lld = new lien_lot_demandeur("]", $db, $DEBUG); |
33 |
|
|
$sqlDemandeur = "SELECT * FROM ".DB_PREFIXE."lien_dossier_demandeur |
34 |
|
|
WHERE dossier='".$this->getParameter("idxformulaire")."'"; |
35 |
|
|
$res = $db->query($sqlDemandeur); |
36 |
|
|
$this->f->addToLog("db->query(\"".$sqlDemandeur."\");", VERBOSE_MODE); |
37 |
|
|
$this->f->isDatabaseError($res); |
38 |
|
|
while($row = $res->fetchRow(DB_FETCHMODE_ASSOC)) { |
39 |
|
|
unset($row['lien_dossier_demandeur']); |
40 |
|
|
unset($row['dossier']); |
41 |
|
|
$row['lien_lot_demandeur'] = ""; |
42 |
|
|
$row['lot'] = $this->valF["lot"]; |
43 |
|
|
$lld->ajouter($row, $db, $DEBUG); |
44 |
|
|
} |
45 |
nhaye |
1240 |
} |
46 |
|
|
} |
47 |
|
|
|
48 |
vpihour |
1245 |
/** |
49 |
|
|
* Cache le champ dossier_autorisation |
50 |
|
|
*/ |
51 |
vpihour |
1241 |
function setType(&$form,$maj) { |
52 |
|
|
parent::setType($form,$maj); |
53 |
|
|
|
54 |
|
|
$form->setType('dossier_autorisation', 'hidden'); |
55 |
|
|
} |
56 |
nhaye |
1268 |
|
57 |
|
|
|
58 |
vpihour |
1245 |
|
59 |
|
|
/** |
60 |
|
|
* Ajout de la liste des demandeurs |
61 |
|
|
*/ |
62 |
|
|
function sousformSpecificContent($maj) { |
63 |
nhaye |
1268 |
|
64 |
vpihour |
1245 |
//En consultation |
65 |
|
|
if ( $maj == 3 ){ |
66 |
|
|
|
67 |
|
|
//Récupère la liste des demandeurs |
68 |
|
|
$sql = "SELECT |
69 |
|
|
civilite.code as code, |
70 |
|
|
CASE WHEN demandeur.qualite='particulier' |
71 |
|
|
THEN TRIM(CONCAT(demandeur.particulier_nom, ' ', demandeur.particulier_prenom)) |
72 |
|
|
ELSE TRIM(CONCAT(demandeur.personne_morale_raison_sociale, ' ', demandeur.personne_morale_denomination)) |
73 |
|
|
END as nom, |
74 |
|
|
lien_lot_demandeur.petitionnaire_principal as petitionnaire_principal, |
75 |
|
|
demandeur.type_demandeur as type_demandeur |
76 |
|
|
FROM |
77 |
|
|
".DB_PREFIXE."lien_lot_demandeur |
78 |
|
|
LEFT JOIN |
79 |
|
|
".DB_PREFIXE."demandeur |
80 |
|
|
ON |
81 |
|
|
lien_lot_demandeur.demandeur = demandeur.demandeur |
82 |
|
|
LEFT JOIN |
83 |
|
|
".DB_PREFIXE."civilite |
84 |
|
|
ON |
85 |
|
|
demandeur.particulier_civilite = civilite.civilite OR |
86 |
|
|
demandeur.personne_morale_civilite = civilite.civilite |
87 |
|
|
WHERE lien_lot_demandeur.lot = ".$this->val[array_search('lot', $this->champs)]." |
88 |
|
|
ORDER BY demandeur.type_demandeur DESC"; |
89 |
|
|
|
90 |
|
|
$res = $this->f->db->query($sql); |
91 |
|
|
$this->f->addToLog("sousformSpecificContent() : ".$sql); |
92 |
|
|
$this->f->isDatabaseError($res); |
93 |
|
|
|
94 |
|
|
//Affichage des données |
95 |
|
|
echo "<div class=\"field field-type-static\">"; |
96 |
|
|
echo "<div class=\"form-libelle\">"; |
97 |
|
|
echo "<label id=\"lib-libelle\" class=\"libelle-demandeur\" for=\"demandeur\">"; |
98 |
|
|
echo _("demandeur"); |
99 |
|
|
echo "</label>"; |
100 |
|
|
echo "</div>"; |
101 |
|
|
echo "<div class=\"form-content\">"; |
102 |
|
|
echo "<span id=\"demandeur\" class=\"field_value\">"; |
103 |
|
|
|
104 |
|
|
$listDemandeur = ""; |
105 |
|
|
//La liste des demandeurs |
106 |
|
|
while($row=& $res->fetchRow(DB_FETCHMODE_ASSOC)){ |
107 |
|
|
|
108 |
|
|
//Ordonne l'affichage des demandeur |
109 |
|
|
if ( $row['petitionnaire_principal'] == 't' ){ |
110 |
|
|
|
111 |
|
|
$listDemandeur = $row['code']. " " . $row['nom'] . ", " . _("petitionnaire principal") . "<br/>".$listDemandeur; |
112 |
|
|
} |
113 |
|
|
else { |
114 |
|
|
|
115 |
|
|
$listDemandeur .= $row['code']. " " . $row['nom'] . ", " . $row['type_demandeur'] . "<br/>"; |
116 |
|
|
} |
117 |
|
|
} |
118 |
|
|
echo $listDemandeur; |
119 |
|
|
echo "</span>"; |
120 |
|
|
echo "</div>"; |
121 |
|
|
echo "</div>"; |
122 |
|
|
} |
123 |
|
|
} |
124 |
vpihour |
633 |
}// fin classe |
125 |
|
|
?> |