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