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