1 |
fmichon |
1022 |
<?php |
2 |
|
|
//$Id$ |
3 |
|
|
//gen openMairie le 07/12/2012 17:33 |
4 |
|
|
|
5 |
|
|
require_once ("../gen/obj/commission.class.php"); |
6 |
|
|
|
7 |
|
|
class commission extends commission_gen { |
8 |
|
|
|
9 |
|
|
function commission($id,&$db,$debug) { |
10 |
|
|
$this->constructeur($id,$db,$debug); |
11 |
|
|
}// fin constructeur |
12 |
|
|
|
13 |
fmichon |
1332 |
function afterFormSpecificContent() { |
14 |
vpihour |
1389 |
|
15 |
|
|
//Le sous-formulaire spécifique ne s'affiche qu'en consultation |
16 |
|
|
if ( $this->parameters['maj'] == 3 ){ |
17 |
|
|
$f = $this->f; |
18 |
fmichon |
1520 |
include "../app/commission_manage.php"; |
19 |
vpihour |
1389 |
} |
20 |
fmichon |
1332 |
} |
21 |
vpihour |
1389 |
|
22 |
|
|
//Le type de commission n'est pas modifiable une fois la commission ajoutée |
23 |
|
|
function setType(&$form,$maj) { |
24 |
|
|
parent::setType($form,$maj); |
25 |
|
|
|
26 |
vpihour |
1401 |
//Cache le champ code en ajout |
27 |
|
|
if ( $maj == 0 ){ |
28 |
|
|
|
29 |
|
|
$form->setType('code', 'hidden'); |
30 |
|
|
} |
31 |
|
|
|
32 |
vpihour |
1389 |
if ( $maj > 0 ) { |
33 |
vpihour |
1390 |
$form->setType('commission_type', 'selecthiddenstatic'); |
34 |
vpihour |
1401 |
$form->setType('code', 'hiddenstatic'); |
35 |
vpihour |
1389 |
} |
36 |
vpihour |
1899 |
|
37 |
|
|
//Cache les champs pour la finalisation |
38 |
|
|
$form->setType('om_fichier_commission_odj', 'hidden'); |
39 |
|
|
$form->setType('om_final_commission_odj', 'hidden'); |
40 |
|
|
$form->setType('om_fichier_commission_cr', 'hidden'); |
41 |
|
|
$form->setType('om_final_commission_cr', 'hidden'); |
42 |
vpihour |
1389 |
} |
43 |
fmichon |
1332 |
|
44 |
vpihour |
1389 |
//Action javascript au changement du type de la commission |
45 |
|
|
function setOnchange(&$form,$maj){ |
46 |
|
|
parent::setOnchange($form,$maj); |
47 |
|
|
|
48 |
|
|
$form->setOnchange("commission_type","chargeDonneesCommissionType(this.value);"); |
49 |
|
|
} |
50 |
|
|
|
51 |
|
|
// Date du jour par défaut |
52 |
|
|
function setVal(&$form, $maj, $validation, &$db) { |
53 |
|
|
|
54 |
|
|
if( $maj == 0 ) { |
55 |
|
|
|
56 |
|
|
$form->setVal("date_commission",date('d/m/Y')); |
57 |
|
|
} |
58 |
|
|
} |
59 |
vpihour |
1401 |
|
60 |
|
|
// Génération automatique du code de la commission |
61 |
vpihour |
1453 |
function setvalF($val) { |
62 |
|
|
parent::setValF($val); |
63 |
vpihour |
1772 |
|
64 |
vpihour |
1401 |
// Récupération du code du type de la commission |
65 |
vpihour |
1772 |
$codeTypeCommission = ""; |
66 |
|
|
if ( isset($val['commission_type']) && is_numeric($val['commission_type'])) |
67 |
|
|
$codeTypeCommission = $this->getCodeTypeCommission($val['commission_type']); |
68 |
vpihour |
1401 |
|
69 |
|
|
//Formatte la date |
70 |
|
|
$dateFormatee = $this->formatDate($val['date_commission']); |
71 |
|
|
|
72 |
|
|
$this->valF['code'] = $codeTypeCommission.$dateFormatee; |
73 |
|
|
} |
74 |
|
|
|
75 |
|
|
//Retourne le code du type de la commission passée en paramètre |
76 |
|
|
function getCodeTypeCommission($typeCommission){ |
77 |
|
|
|
78 |
|
|
$codeTypeCommission = ""; |
79 |
|
|
|
80 |
|
|
$sql = "SELECT |
81 |
|
|
code |
82 |
|
|
FROM |
83 |
|
|
".DB_PREFIXE."commission_type |
84 |
|
|
WHERE |
85 |
|
|
commission_type = ".$typeCommission; |
86 |
|
|
$codeTypeCommission = $this->db->getOne($sql); |
87 |
fmichon |
1886 |
$this->f->addToLog("getCodeTypeCommission(): db->getone(\"".$sql."\")", VERBOSE_MODE); |
88 |
vpihour |
1773 |
if ( database::isError($codeTypeCommission) ){ |
89 |
|
|
die(); |
90 |
|
|
} |
91 |
vpihour |
1401 |
|
92 |
|
|
return $codeTypeCommission; |
93 |
|
|
} |
94 |
|
|
|
95 |
|
|
// Prend une date au format JJ/MM/AAAA et retourne AAAAMMJJ |
96 |
|
|
function formatDate($date){ |
97 |
|
|
|
98 |
|
|
$dateFormatee = explode('/',$date); |
99 |
|
|
$dateFormatee = $dateFormatee[2].$dateFormatee[1].$dateFormatee[0]; |
100 |
|
|
|
101 |
|
|
return $dateFormatee; |
102 |
|
|
} |
103 |
fmichon |
1022 |
}// fin classe |
104 |
|
|
?> |