Commit 9be43b8a48fe70905eece797c2571afce02f4c65
1 parent
5e70d8b0
Exists in
master
and in
3 other branches
#3523 Implémentaion et uilisation Table configuration
Showing
24 changed files
with
619 additions
and
163 deletions
Show diff stats
database/labinvent_2.0_19-04-16.sql renamed to database/labinvent_2.1_09-05-16.sql
100755 → 100644
@@ -296,6 +296,35 @@ CREATE TABLE IF NOT EXISTS `users` ( | @@ -296,6 +296,35 @@ CREATE TABLE IF NOT EXISTS `users` ( | ||
296 | ) ENGINE=InnoDB DEFAULT CHARSET=latin1 AUTO_INCREMENT=25 ; | 296 | ) ENGINE=InnoDB DEFAULT CHARSET=latin1 AUTO_INCREMENT=25 ; |
297 | 297 | ||
298 | 298 | ||
299 | +-- -------------------------------------------------------- | ||
300 | +-- | ||
301 | +-- Structure de la table `configurations` | ||
302 | +-- | ||
303 | + | ||
304 | +DROP TABLE IF EXISTS `configurations`; | ||
305 | +CREATE TABLE IF NOT EXISTS `configurations` ( | ||
306 | + `id` int(11) NOT NULL AUTO_INCREMENT, | ||
307 | + `nom` varchar(45) NOT NULL COMMENT 'obligatoire (et unique)', | ||
308 | + `mode_install` tinyint(1) DEFAULT NULL, | ||
309 | + `mode_debug` tinyint(1) DEFAULT NULL, | ||
310 | + `use_ldap` tinyint(1) DEFAULT NULL, | ||
311 | + `host_ldap` varchar(30) DEFAULT NULL, | ||
312 | + `port_ldap` varchar(10) DEFAULT NULL, | ||
313 | + `authentificationType_ldap` varchar(30) DEFAULT NULL, | ||
314 | + `baseDn_ldap` varchar(30) DEFAULT NULL, | ||
315 | + `filter_ldap` varchar(30) DEFAULT NULL, | ||
316 | + `labName` varchar(30) DEFAULT NULL, | ||
317 | + `labNameShort` varchar(20) DEFAULT NULL, | ||
318 | + `labPresent` varchar(10) DEFAULT NULL, | ||
319 | + `labUmr` varchar(30) DEFAULT NULL, | ||
320 | + `hasPrinter` tinyint(1) DEFAULT NULL, | ||
321 | + `emailGuest1` varchar(45) DEFAULT NULL, | ||
322 | + `emailGuest2` varchar(45) DEFAULT NULL, | ||
323 | + `emailGuest3` varchar(45) DEFAULT NULL, | ||
324 | + PRIMARY KEY (`id`), | ||
325 | + UNIQUE KEY `nom_UNIQUE` (`nom`) | ||
326 | +); | ||
327 | + | ||
299 | -- | 328 | -- |
300 | -- Contraintes pour les tables exportées | 329 | -- Contraintes pour les tables exportées |
301 | -- | 330 | -- |
@@ -349,6 +378,11 @@ ALTER TABLE `suivis` | @@ -349,6 +378,11 @@ ALTER TABLE `suivis` | ||
349 | ALTER TABLE `users` | 378 | ALTER TABLE `users` |
350 | ADD CONSTRAINT `fk_users_groupes_travails1` FOREIGN KEY (`groupes_metier_id`) REFERENCES `groupes_metiers` (`id`) ON DELETE NO ACTION ON UPDATE NO ACTION; | 379 | ADD CONSTRAINT `fk_users_groupes_travails1` FOREIGN KEY (`groupes_metier_id`) REFERENCES `groupes_metiers` (`id`) ON DELETE NO ACTION ON UPDATE NO ACTION; |
351 | 380 | ||
381 | + | ||
382 | +-- Insertion par défaut pour la table configuration | ||
383 | +Insert into `configurations`(`nom`, `mode_install`, `mode_debug`, `use_ldap`, `host_ldap`, `port_ldap`, `authentificationType_ldap`, `baseDn_ldap`, `filter_ldap`, `labName`, `labNameShort`, `labPresent`, `labUmr`, `hasPrinter`, `emailGuest1`, `emailGuest2`, `emailGuest3`) values ('default', '1', '0', '0', '', '', '', '', '', 'LABONAME', 'LABO', 'du ', '', '0', '', '', ''); | ||
384 | + | ||
385 | + | ||
352 | /*!40101 SET CHARACTER_SET_CLIENT=@OLD_CHARACTER_SET_CLIENT */; | 386 | /*!40101 SET CHARACTER_SET_CLIENT=@OLD_CHARACTER_SET_CLIENT */; |
353 | /*!40101 SET CHARACTER_SET_RESULTS=@OLD_CHARACTER_SET_RESULTS */; | 387 | /*!40101 SET CHARACTER_SET_RESULTS=@OLD_CHARACTER_SET_RESULTS */; |
354 | /*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */; | 388 | /*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */; |
@@ -0,0 +1 @@ | @@ -0,0 +1 @@ | ||
1 | +/db-update-2016-05-09.sql~ |
@@ -0,0 +1,27 @@ | @@ -0,0 +1,27 @@ | ||
1 | + | ||
2 | +DROP TABLE IF EXISTS `configurations`; | ||
3 | +CREATE TABLE IF NOT EXISTS `configurations` ( | ||
4 | + `id` int(11) NOT NULL AUTO_INCREMENT, | ||
5 | + `nom` varchar(45) NOT NULL COMMENT 'obligatoire (et unique)', | ||
6 | + `mode_install` tinyint(1) DEFAULT NULL, | ||
7 | + `mode_debug` tinyint(1) DEFAULT NULL, | ||
8 | + `use_ldap` tinyint(1) DEFAULT NULL, | ||
9 | + `host_ldap` varchar(30) DEFAULT NULL, | ||
10 | + `port_ldap` varchar(10) DEFAULT NULL, | ||
11 | + `authentificationType_ldap` varchar(30) DEFAULT NULL, | ||
12 | + `baseDn_ldap` varchar(30) DEFAULT NULL, | ||
13 | + `filter_ldap` varchar(30) DEFAULT NULL, | ||
14 | + `labName` varchar(30) DEFAULT NULL, | ||
15 | + `labNameShort` varchar(20) DEFAULT NULL, | ||
16 | + `labPresent` varchar(10) DEFAULT NULL, | ||
17 | + `labUmr` varchar(30) DEFAULT NULL, | ||
18 | + `hasPrinter` tinyint(1) DEFAULT NULL, | ||
19 | + `emailGuest1` varchar(45) DEFAULT NULL, | ||
20 | + `emailGuest2` varchar(45) DEFAULT NULL, | ||
21 | + `emailGuest3` varchar(45) DEFAULT NULL, | ||
22 | + PRIMARY KEY (`id`), | ||
23 | + UNIQUE KEY `nom_UNIQUE` (`nom`) | ||
24 | +); | ||
25 | + | ||
26 | + | ||
27 | +Insert into `configurations`(`nom`, `mode_install`, `mode_debug`, `use_ldap`, `host_ldap`, `port_ldap`, `authentificationType_ldap`, `baseDn_ldap`, `filter_ldap`, `labName`, `labNameShort`, `labPresent`, `labUmr`, `hasPrinter`, `emailGuest1`, `emailGuest2`, `emailGuest3`) values ('default', '1', '0', '0', '', '', '', '', '', 'LABONAME', 'LABO', 'du ', '', '0', '', '', ''); |
install/installation.sh
@@ -283,8 +283,8 @@ cd database/ | @@ -283,8 +283,8 @@ cd database/ | ||
283 | echo "Creation script de construction." | 283 | echo "Creation script de construction." |
284 | [[ -f build.sql ]] && cp -p build.sql build.sql.ORIG | 284 | [[ -f build.sql ]] && cp -p build.sql build.sql.ORIG |
285 | 285 | ||
286 | - #Contraintes présentes dans le fichier "labinvent_2.0_19-04-16.sql" | ||
287 | - cat ./labinvent_2.0_19-04-16.sql > ./build.sql | 286 | + #Contraintes présentes dans le fichier "labinvent_2.1_09-05-16.sql" |
287 | + cat ./labinvent_2.1_09-05-16.sql > ./build.sql | ||
288 | 288 | ||
289 | # Ajout login & mdp utlisateur application dans le script build.sql | 289 | # Ajout login & mdp utlisateur application dans le script build.sql |
290 | sed -e "s/'mydb'/'$bddUserName'/" -i ./build.sql | 290 | sed -e "s/'mydb'/'$bddUserName'/" -i ./build.sql |
install/installation.sh~
@@ -49,24 +49,48 @@ read | @@ -49,24 +49,48 @@ read | ||
49 | 49 | ||
50 | #Creation des dossiers temporaires (tmp, logs, ...) | 50 | #Creation des dossiers temporaires (tmp, logs, ...) |
51 | echo "Création des dossiers temporaires..." | 51 | echo "Création des dossiers temporaires..." |
52 | -mkdir ./logs/ | ||
53 | -touch ./logs/error.log | ||
54 | -touch ./logs/cli-error.log | ||
55 | -mkdir ./tmp/ | ||
56 | -mkdir ./tmp/bake/ | ||
57 | -mkdir ./tmp/cache/ | ||
58 | -mkdir ./tmp/cache/models/ | ||
59 | -mkdir ./tmp/cache/persistent/ | ||
60 | -mkdir ./tmp/cache/views/ | ||
61 | -mkdir ./tmp/documents/ | ||
62 | -mkdir ./tmp/sessions/ | ||
63 | -mkdir ./tmp/tests/ | 52 | +if [ ! -d "./logs" ]; then |
53 | + mkdir ./logs/ | ||
54 | +fi | ||
55 | +if [ ! -f "./logs/error.log" ]; then | ||
56 | + touch ./logs/error.log | ||
57 | +fi | ||
58 | +if [ ! -f "./logs/cli-error.log" ]; then | ||
59 | + touch ./logs/cli-error.log | ||
60 | +fi | ||
61 | + | ||
62 | +if [ ! -d "./tmp" ]; then | ||
63 | + mkdir ./tmp/ | ||
64 | +fi | ||
65 | +if [ ! -d "./tmp/bake" ]; then | ||
66 | + mkdir ./tmp/bake/ | ||
67 | +fi | ||
68 | +if [ ! -d "./tmp/cache" ]; then | ||
69 | + mkdir ./tmp/cache/ | ||
70 | +fi | ||
71 | +if [ ! -d "./tmp/cache/models" ]; then | ||
72 | + mkdir ./tmp/cache/models/ | ||
73 | +fi | ||
74 | +if [ ! -d "./tmp/cache/persistent" ]; then | ||
75 | + mkdir ./tmp/cache/persistent/ | ||
76 | +fi | ||
77 | +if [ ! -d "./tmp/cache/views" ]; then | ||
78 | + mkdir ./tmp/cache/views/ | ||
79 | +fi | ||
80 | +if [ ! -d "./tmp/documents" ]; then | ||
81 | + mkdir ./tmp/documents/ | ||
82 | +fi | ||
83 | +if [ ! -d "./tmp/sessions" ]; then | ||
84 | + mkdir ./tmp/sessions/ | ||
85 | +fi | ||
86 | +if [ ! -d "./tmp/tests" ]; then | ||
87 | + mkdir ./tmp/tests/ | ||
88 | +fi | ||
89 | + | ||
64 | echo "==>Done" | 90 | echo "==>Done" |
65 | 91 | ||
66 | # Donner les droits et le groupe aux dossiers | 92 | # Donner les droits et le groupe aux dossiers |
67 | echo "Mise à jour des droits des dossiers..." | 93 | echo "Mise à jour des droits des dossiers..." |
68 | -##sudo chgrp -R $grp ./tmp/ | ||
69 | -##sudo chmod -R 775 ./tmp/ | ||
70 | 94 | ||
71 | 95 | ||
72 | # 1) POUR LES QRCODES | 96 | # 1) POUR LES QRCODES |
@@ -109,15 +133,15 @@ chmod -R 777 ./tmp/ | @@ -109,15 +133,15 @@ chmod -R 777 ./tmp/ | ||
109 | sudo chgrp -R $grp ./tmp/ | 133 | sudo chgrp -R $grp ./tmp/ |
110 | chmod -R 777 ./logs/ | 134 | chmod -R 777 ./logs/ |
111 | sudo chgrp -R $grp ./logs/ | 135 | sudo chgrp -R $grp ./logs/ |
136 | +#Il semble qu'il manque des droits au dossier Vendor, droit trop général à réduire (identifié les composants qui ont besoin de s'éxécuter ou de se lire, pas d'écriture dans le dossier Vendor normalement...) | ||
137 | +chmod -R 777 ./vendor/cakephp/ | ||
112 | echo "==>Done" | 138 | echo "==>Done" |
113 | 139 | ||
114 | -#chown --> user | ||
115 | 140 | ||
116 | # CONFIGURATION (Database and LDAP) | 141 | # CONFIGURATION (Database and LDAP) |
117 | 142 | ||
118 | cakephpAppPath=./ | 143 | cakephpAppPath=./ |
119 | configPath=$cakephpAppPath/config | 144 | configPath=$cakephpAppPath/config |
120 | -#myconfigFile=$configPath/config.php | ||
121 | dbConfigFile=$configPath/app.php | 145 | dbConfigFile=$configPath/app.php |
122 | myConfigFile=$configPath/app.php | 146 | myConfigFile=$configPath/app.php |
123 | configFile=$configPath/app.php | 147 | configFile=$configPath/app.php |
@@ -125,7 +149,6 @@ configFile=$configPath/app.php | @@ -125,7 +149,6 @@ configFile=$configPath/app.php | ||
125 | # Copy sample GENERAL config file to real personal file (make a copy first if already exists !) | 149 | # Copy sample GENERAL config file to real personal file (make a copy first if already exists !) |
126 | [[ -f $myConfigFile ]] && cp -p $myConfigFile $myConfigFile.ORIG | 150 | [[ -f $myConfigFile ]] && cp -p $myConfigFile $myConfigFile.ORIG |
127 | cp $configPath/app.default.php $myConfigFile | 151 | cp $configPath/app.default.php $myConfigFile |
128 | -#cp $configPath/app.default.php $configPath/app.php | ||
129 | 152 | ||
130 | # - 1) Configuration : LDAP | 153 | # - 1) Configuration : LDAP |
131 | echo | 154 | echo |
@@ -182,7 +205,6 @@ echo "Informations sur la base de donnee " | @@ -182,7 +205,6 @@ echo "Informations sur la base de donnee " | ||
182 | 205 | ||
183 | echo "Voulez-vous creer la base de donnees, Oui/Non ? (par defaut, Non) :" | 206 | echo "Voulez-vous creer la base de donnees, Oui/Non ? (par defaut, Non) :" |
184 | read rep | 207 | read rep |
185 | -##if [ -z $rep ] || [ $rep = "N" ] || [ $rep = "n" ] || [ $rep = "Non" ] || [ $rep = "non" ] || [ $rep = "NON" ]; then | ||
186 | if [ -z $rep ] ; then | 208 | if [ -z $rep ] ; then |
187 | rep="Non" | 209 | rep="Non" |
188 | fi | 210 | fi |
@@ -217,8 +239,7 @@ read bddName | @@ -217,8 +239,7 @@ read bddName | ||
217 | if [ -z $bddName ] ; then | 239 | if [ -z $bddName ] ; then |
218 | bddName="labinvent" | 240 | bddName="labinvent" |
219 | fi | 241 | fi |
220 | -#sed -i "s/mydb/$bddName/" $dbConfigFile | ||
221 | -#sed -e "s/mydb/$bddName/" -i $dbConfigFile | 242 | +sed -e "s/'database' => 'database'/'database' => '$bddName'/" -i $dbConfigFile |
222 | 243 | ||
223 | echo "Entrez le login privilegie vous donnant le droit de CREER la Base de donnees inventaire (NB: ce login ne sera utilise qu'une seule fois, pour la creation de la base ; par defaut=root) :" | 244 | echo "Entrez le login privilegie vous donnant le droit de CREER la Base de donnees inventaire (NB: ce login ne sera utilise qu'une seule fois, pour la creation de la base ; par defaut=root) :" |
224 | read bddAdminName | 245 | read bddAdminName |
@@ -242,14 +263,11 @@ if [ -z $bddUserName ] ; then | @@ -242,14 +263,11 @@ if [ -z $bddUserName ] ; then | ||
242 | bddUserName=$defaultBddUserName | 263 | bddUserName=$defaultBddUserName |
243 | fi | 264 | fi |
244 | echo "==> BD inventaire user login = $bddUserName" | 265 | echo "==> BD inventaire user login = $bddUserName" |
245 | -#sed -i "s/root/$bddUserName/" $dbConfigFile | ||
246 | -#sed -e "s/root/$bddUserName/" -i $dbConfigFile | 266 | +sed -e "s/'username' => 'username'/'username' => '$bddUserName'/" -i $dbConfigFile |
247 | echo "Entrez le mot de passe de cet utilisateur :" | 267 | echo "Entrez le mot de passe de cet utilisateur :" |
248 | read -s bddUserPass | 268 | read -s bddUserPass |
249 | # Cela ne s ecrit pas sur l ecran | 269 | # Cela ne s ecrit pas sur l ecran |
250 | -# read -s bddPassword | ||
251 | -#sed -i "s/pwdrt/$bddUserPass/" $dbConfigFile | ||
252 | -#sed -e "s/pwdrt/$bddUserPass/" -i $dbConfigFile | 270 | +sed -e "s/'password' => 'password'/'password' => '$bddUserPass'/" -i $dbConfigFile |
253 | echo | 271 | echo |
254 | 272 | ||
255 | 273 | ||
@@ -264,13 +282,13 @@ cd database/ | @@ -264,13 +282,13 @@ cd database/ | ||
264 | 282 | ||
265 | echo "Creation script de construction." | 283 | echo "Creation script de construction." |
266 | [[ -f build.sql ]] && cp -p build.sql build.sql.ORIG | 284 | [[ -f build.sql ]] && cp -p build.sql build.sql.ORIG |
285 | + | ||
267 | #Contraintes présentes dans le fichier "labinvent_2.0_19-04-16.sql" | 286 | #Contraintes présentes dans le fichier "labinvent_2.0_19-04-16.sql" |
268 | cat ./labinvent_2.0_19-04-16.sql > ./build.sql | 287 | cat ./labinvent_2.0_19-04-16.sql > ./build.sql |
269 | - # Ajout des contraintes | ||
270 | - #cat ./Upd_TableConstraints.sql >> ./build.sql | ||
271 | - #sed -i "s/bddUserName/$bddUserName/" ./build.sql | ||
272 | - sed -e "s/bddUserName/$bddUserName/" -i ./build.sql | ||
273 | - sed -e "s/bddUserPass/$bddUserPass/" -i ./build.sql | 288 | + |
289 | + # Ajout login & mdp utlisateur application dans le script build.sql | ||
290 | + sed -e "s/'mydb'/'$bddUserName'/" -i ./build.sql | ||
291 | + sed -e "s/'mydb1'/'$bddUserPass'/" -i ./build.sql | ||
274 | 292 | ||
275 | # Seulement pour IRAP | 293 | # Seulement pour IRAP |
276 | if [ $INSTALL_DATA_IRAP -eq 1 ] ; then | 294 | if [ $INSTALL_DATA_IRAP -eq 1 ] ; then |
@@ -287,9 +305,7 @@ if [ $INSTALL_DATA_IRAP -eq 1 ] ; then | @@ -287,9 +305,7 @@ if [ $INSTALL_DATA_IRAP -eq 1 ] ; then | ||
287 | fi | 305 | fi |
288 | 306 | ||
289 | rep=" " | 307 | rep=" " |
290 | -##echo "Caracteristation des users" | ||
291 | echo "Maintenant, nous allons definir l utilisateur qui sera superadministrateur de l application, ca peut etre VOUS :" | 308 | echo "Maintenant, nous allons definir l utilisateur qui sera superadministrateur de l application, ca peut etre VOUS :" |
292 | -##if [ $LDAP = "Oui" ] || [ -z $rep ] || [ $rep = "N" ] || [ $rep = "n" ] || [ $rep = "Non" ] || [ $rep = "non" ] || [ $rep = "NON" ]; then | ||
293 | cat ./Insert_Users.sql >> ./build.sql | 309 | cat ./Insert_Users.sql >> ./build.sql |
294 | echo "- Entrez ses (vos) Nom et Prenom (sous forme : Nom Prenom ) :" | 310 | echo "- Entrez ses (vos) Nom et Prenom (sous forme : Nom Prenom ) :" |
295 | read UserName UserPrenom | 311 | read UserName UserPrenom |
@@ -301,13 +317,10 @@ echo "Maintenant, nous allons definir l utilisateur qui sera superadministrateur | @@ -301,13 +317,10 @@ echo "Maintenant, nous allons definir l utilisateur qui sera superadministrateur | ||
301 | fi | 317 | fi |
302 | echo "- Entrez son (votre) email :" | 318 | echo "- Entrez son (votre) email :" |
303 | read mel | 319 | read mel |
304 | - #sed -i "s/Nom/$UserName/" ./build.sql | ||
305 | sed -e "s/Nom/$UserName/" -i ./build.sql | 320 | sed -e "s/Nom/$UserName/" -i ./build.sql |
306 | sed -e "s/Prenom/$UserPrenom/" -i ./build.sql | 321 | sed -e "s/Prenom/$UserPrenom/" -i ./build.sql |
307 | sed -e "s/userlogin/$login/" -i ./build.sql | 322 | sed -e "s/userlogin/$login/" -i ./build.sql |
308 | sed -e "s/'__@__'/'$mel'/" -i ./build.sql | 323 | sed -e "s/'__@__'/'$mel'/" -i ./build.sql |
309 | - #sed -e "s/mydb/$bddName/" -i ./build.sql | ||
310 | -##fi | ||
311 | 324 | ||
312 | if [ $LDAP != "Oui" ]; then | 325 | if [ $LDAP != "Oui" ]; then |
313 | echo "Voulez-vous installer quelques utilisateurs supplementaires dans la base de donnees (vous pourrez ensuite changer leur nom dans l'application, ou meme les supprimer ; par defaut, Oui): Oui/Non ?" | 326 | echo "Voulez-vous installer quelques utilisateurs supplementaires dans la base de donnees (vous pourrez ensuite changer leur nom dans l'application, ou meme les supprimer ; par defaut, Oui): Oui/Non ?" |
@@ -315,26 +328,14 @@ if [ $LDAP != "Oui" ]; then | @@ -315,26 +328,14 @@ if [ $LDAP != "Oui" ]; then | ||
315 | if [ -z $rep ] || [ $rep = "O" ] || [ $rep = "o" ] || [ $rep = "Oui" ] || [ $rep = "oui" ] || [ $rep = "OUI" ]; then | 328 | if [ -z $rep ] || [ $rep = "O" ] || [ $rep = "o" ] || [ $rep = "Oui" ] || [ $rep = "oui" ] || [ $rep = "OUI" ]; then |
316 | echo "Ajout de quelques utilisateurs supplementaires dans la base" | 329 | echo "Ajout de quelques utilisateurs supplementaires dans la base" |
317 | cat ./Insert_FakeUsers.sql >> ./build.sql | 330 | cat ./Insert_FakeUsers.sql >> ./build.sql |
318 | - #sed -e "s/mydb/$bddName/" -i ./build.sql | ||
319 | fi | 331 | fi |
320 | fi | 332 | fi |
321 | 333 | ||
322 | - #sed -e "s/mydb/$bddName/" -i ./build.sql | ||
323 | - | ||
324 | -#cd .. | ||
325 | 334 | ||
326 | -echo | ||
327 | -#if [ $SQL = "Oui" ]; then | ||
328 | -#if [ $BDD = "Oui" ]; then | ||
329 | - #sed -i "s/mydb/$bddName/" ./database/build.sql | ||
330 | - #sed -e "s/mydb/$bddName/" -i ./database/build.sql | ||
331 | sed -e "s/mydb/$bddName/" -i ./build.sql | 335 | sed -e "s/mydb/$bddName/" -i ./build.sql |
332 | echo "Creation base de donnees (Attention, votre serveur de BD doit etre demarre)" | 336 | echo "Creation base de donnees (Attention, votre serveur de BD doit etre demarre)" |
333 | - ##mysql --user=$bddUserName --password=$bddPassword -h $bddIp $bddName < ./database/build.sql | ||
334 | - #mysql --user=$bddAdminName --password=$bddAdminPass -h $bddIp < ./database/build.sql | ||
335 | mysql --user=$bddAdminName --password=$bddAdminPass -h $bddIp < ./build.sql | 337 | mysql --user=$bddAdminName --password=$bddAdminPass -h $bddIp < ./build.sql |
336 | echo "Base creee (a verifier)" | 338 | echo "Base creee (a verifier)" |
337 | -#fi | ||
338 | 339 | ||
339 | cd ../ | 340 | cd ../ |
340 | 341 | ||
@@ -355,14 +356,13 @@ echo "Si vous voulez le conserver, le script de creation de la BD est database/b | @@ -355,14 +356,13 @@ echo "Si vous voulez le conserver, le script de creation de la BD est database/b | ||
355 | echo | 356 | echo |
356 | echo "MAINTENANT :" | 357 | echo "MAINTENANT :" |
357 | echo "1) Verifiez que la BD d'inventaire ($bddName) a bien ete cree (avec phpmyadmin par exemple)" | 358 | echo "1) Verifiez que la BD d'inventaire ($bddName) a bien ete cree (avec phpmyadmin par exemple)" |
358 | -echo "2) Verifiez le contenu de votre fichier de configuration de la BD (cakephp/app/Config/database.php)" | 359 | +echo "2) Allez sur l'application, vous devriez arriver par défaut sur un mode install vous donnant des informations sur la configuration de votre application, vérifiez que tout les points soit validé, sinon rajouter les extensions manquantes..." |
359 | echo "3) Testez l'accès à l'application par le web" | 360 | echo "3) Testez l'accès à l'application par le web" |
360 | -echo "Pour cela, suivez la suite des instructions qui sont dans le fichier INSTALLATION.txt (à la racine du projet), que vous avez normalement deja commence a lire." | 361 | +echo "Pour aller sur l'application, suivez la suite des instructions qui sont dans le fichier INSTALLATION.txt (à la racine du projet), que vous avez normalement deja commence a lire." |
361 | echo | 362 | echo |
362 | echo "N'oubliez pas 3 choses importantes (voir la doc INSTALLATION.txt pour plus de details) :" | 363 | echo "N'oubliez pas 3 choses importantes (voir la doc INSTALLATION.txt pour plus de details) :" |
363 | echo "1) Passer en mode LDAP (si vous le souhaitez et si ca n'est pas deja fait)" | 364 | echo "1) Passer en mode LDAP (si vous le souhaitez et si ca n'est pas deja fait)" |
364 | echo "2) Personnaliser les 2 fichiers logos suivants dans webroot/img/ :" | 365 | echo "2) Personnaliser les 2 fichiers logos suivants dans webroot/img/ :" |
365 | echo "- logo_entity.jpg : le logo du laboratoire" | 366 | echo "- logo_entity.jpg : le logo du laboratoire" |
366 | echo "- logo_software.jpg : le logo du logiciel" | 367 | echo "- logo_software.jpg : le logo du logiciel" |
367 | -echo "3) Personnaliser le logiciel pour votre entite (laboratoire) (via le fichier de configuration config/app.php" | ||
368 | -echo | 368 | +echo "3) Personnaliser le logiciel pour votre entite (laboratoire) (via le menu de configuration dans la section outils de l'application)" |
src/Controller/AppController.php
@@ -16,6 +16,7 @@ namespace App\Controller; | @@ -16,6 +16,7 @@ namespace App\Controller; | ||
16 | 16 | ||
17 | use Cake\Controller\Controller; | 17 | use Cake\Controller\Controller; |
18 | use Cake\Event\Event; | 18 | use Cake\Event\Event; |
19 | +use Cake\ORM\TableRegistry; | ||
19 | 20 | ||
20 | /** | 21 | /** |
21 | * Application Controller | 22 | * Application Controller |
@@ -104,5 +105,8 @@ class AppController extends Controller | @@ -104,5 +105,8 @@ class AppController extends Controller | ||
104 | $this->set('_serialize', true); | 105 | $this->set('_serialize', true); |
105 | } | 106 | } |
106 | $this->set('username', $this->Auth->user('username')); | 107 | $this->set('username', $this->Auth->user('username')); |
108 | + | ||
109 | + $configuration = TableRegistry::get('Configurations')->find()->where(['id =' => 1])->first(); | ||
110 | + $this->set('configuration', $configuration); | ||
107 | } | 111 | } |
108 | } | 112 | } |
@@ -0,0 +1,120 @@ | @@ -0,0 +1,120 @@ | ||
1 | +<?php | ||
2 | +namespace App\Controller; | ||
3 | + | ||
4 | +use App\Controller\AppController; | ||
5 | + | ||
6 | +/** | ||
7 | + * Configurations Controller | ||
8 | + * | ||
9 | + * @property \App\Model\Table\ConfigurationsTable $Configurations | ||
10 | + */ | ||
11 | +class ConfigurationsController extends AppController | ||
12 | +{ | ||
13 | + /** | ||
14 | + * View method | ||
15 | + * | ||
16 | + * @param string|null $id Configuration id. | ||
17 | + * @return \Cake\Network\Response|null | ||
18 | + * @throws \Cake\Datasource\Exception\RecordNotFoundException When record not found. | ||
19 | + */ | ||
20 | + public function view($id = null) | ||
21 | + { | ||
22 | + $configuration = $this->Configurations->get($id, [ | ||
23 | + 'contain' => [] | ||
24 | + ]); | ||
25 | + | ||
26 | + $this->set('configuration', $configuration); | ||
27 | + $this->set('_serialize', ['configuration']); | ||
28 | + } | ||
29 | + | ||
30 | + | ||
31 | + /** | ||
32 | + * Edit method | ||
33 | + * | ||
34 | + * @param string|null $id Configuration id. | ||
35 | + * @return \Cake\Network\Response|void Redirects on successful edit, renders view otherwise. | ||
36 | + * @throws \Cake\Network\Exception\NotFoundException When record not found. | ||
37 | + */ | ||
38 | + public function edit($id = null) | ||
39 | + { | ||
40 | + $configuration = $this->Configurations->get($id, [ | ||
41 | + 'contain' => [] | ||
42 | + ]); | ||
43 | + if ($this->request->is(['patch', 'post', 'put'])) { | ||
44 | + $configuration = $this->Configurations->patchEntity($configuration, $this->request->data); | ||
45 | + if ($this->Configurations->save($configuration)) { | ||
46 | + $this->Flash->success(__('La configuration a bien été sauvegardé.')); | ||
47 | + return $this->redirect(['action' => 'view', $id]); | ||
48 | + } else { | ||
49 | + $this->Flash->error(__('La configuration n\'a pas pu être sauvegardé.')); | ||
50 | + } | ||
51 | + } | ||
52 | + $this->set(compact('configuration')); | ||
53 | + $this->set('_serialize', ['configuration']); | ||
54 | + | ||
55 | + } | ||
56 | + | ||
57 | + | ||
58 | + /** | ||
59 | + * Activate debug mode | ||
60 | + * | ||
61 | + * @return \Cake\Network\Response|NULL | ||
62 | + */ | ||
63 | + public function debugOn() { | ||
64 | + $config = $this->Configurations->get('1')->set('mode_debug', 1); | ||
65 | + | ||
66 | + if ($this->Configurations->save($config)) { | ||
67 | + $this->Flash->success(__('Le mode debug a bien été démarrer.')); | ||
68 | + } | ||
69 | + | ||
70 | + return $this->redirect(['controller' => 'pages', 'action' => 'tools']); | ||
71 | + } | ||
72 | + | ||
73 | + /** | ||
74 | + * Desactivate debug mode | ||
75 | + * | ||
76 | + * @return \Cake\Network\Response|NULL | ||
77 | + */ | ||
78 | + public function debugOff() { | ||
79 | + $config = $this->Configurations->get('1')->set('mode_debug', 0); | ||
80 | + | ||
81 | + if ($this->Configurations->save($config)) { | ||
82 | + $this->Flash->success(__('Le mode debug a bien été arréter.')); | ||
83 | + } | ||
84 | + | ||
85 | + return $this->redirect(['controller' => 'pages', 'action' => 'tools']); | ||
86 | + } | ||
87 | + | ||
88 | + | ||
89 | + /** | ||
90 | + * Activate install mode | ||
91 | + * | ||
92 | + * @return \Cake\Network\Response|NULL | ||
93 | + */ | ||
94 | + public function installOn() { | ||
95 | + $config = $this->Configurations->get('1')->set('mode_install', 1); | ||
96 | + | ||
97 | + if ($this->Configurations->save($config)) { | ||
98 | + $this->Flash->success(__('Le mode install a bien été démarrer.')); | ||
99 | + } | ||
100 | + | ||
101 | + return $this->redirect(['controller' => 'pages', 'action' => 'home']); | ||
102 | + } | ||
103 | + | ||
104 | + /** | ||
105 | + * Desactivate install mode | ||
106 | + * | ||
107 | + * @return \Cake\Network\Response|NULL | ||
108 | + */ | ||
109 | + public function installOff() { | ||
110 | + $config = $this->Configurations->get('1')->set('mode_install', 0); | ||
111 | + | ||
112 | + if ($this->Configurations->save($config)) { | ||
113 | + $this->Flash->success(__('Le mode install a bien été arréter.')); | ||
114 | + } | ||
115 | + | ||
116 | + return $this->redirect(['controller' => 'pages', 'action' => 'tools']); | ||
117 | + } | ||
118 | + | ||
119 | + | ||
120 | +} |
src/Controller/MaterielsController.php
@@ -324,29 +324,6 @@ class MaterielsController extends AppController | @@ -324,29 +324,6 @@ class MaterielsController extends AppController | ||
324 | 324 | ||
325 | } | 325 | } |
326 | 326 | ||
327 | - /** | ||
328 | - * Activate install mode | ||
329 | - * | ||
330 | - * @return \Cake\Network\Response|NULL | ||
331 | - */ | ||
332 | - public function installOn() { | ||
333 | - //Configure::write('install',true); | ||
334 | - $this->request->session()->write('install',true); | ||
335 | - | ||
336 | - return $this->redirect(['controller' => 'pages', 'action' => 'home']); | ||
337 | - } | ||
338 | - | ||
339 | - /** | ||
340 | - * Desactivate install mode | ||
341 | - * | ||
342 | - * @return \Cake\Network\Response|NULL | ||
343 | - */ | ||
344 | - public function installOff() { | ||
345 | - //Configure::write('install', false); | ||
346 | - $this->request->session()->write('install',false); | ||
347 | - | ||
348 | - return $this->redirect(['controller' => 'pages', 'action' => 'tools']); | ||
349 | - } | ||
350 | 327 | ||
351 | 328 | ||
352 | 329 |
@@ -0,0 +1,44 @@ | @@ -0,0 +1,44 @@ | ||
1 | +<?php | ||
2 | +namespace App\Model\Entity; | ||
3 | + | ||
4 | +use Cake\ORM\Entity; | ||
5 | + | ||
6 | +/** | ||
7 | + * Configuration Entity. | ||
8 | + * | ||
9 | + * @property int $id | ||
10 | + * @property string $nom | ||
11 | + * @property bool $mode_install | ||
12 | + * @property bool $mode_debug | ||
13 | + * @property bool $use_ldap | ||
14 | + * @property string $host_ldap | ||
15 | + * @property string $port_ldap | ||
16 | + * @property string $authentificationType_ldap | ||
17 | + * @property string $baseDn_ldap | ||
18 | + * @property string $filter_ldap | ||
19 | + * @property string $labName | ||
20 | + * @property string $labNameShort | ||
21 | + * @property string $labPresent | ||
22 | + * @property string $labUmr | ||
23 | + * @property bool $hasPrinter | ||
24 | + * @property string $emailGuest1 | ||
25 | + * @property string $emailGuest2 | ||
26 | + * @property string $emailGuest3 | ||
27 | + */ | ||
28 | +class Configuration extends Entity | ||
29 | +{ | ||
30 | + | ||
31 | + /** | ||
32 | + * Fields that can be mass assigned using newEntity() or patchEntity(). | ||
33 | + * | ||
34 | + * Note that when '*' is set to true, this allows all unspecified fields to | ||
35 | + * be mass assigned. For security purposes, it is advised to set '*' to false | ||
36 | + * (or remove it), and explicitly make individual fields accessible as needed. | ||
37 | + * | ||
38 | + * @var array | ||
39 | + */ | ||
40 | + protected $_accessible = [ | ||
41 | + '*' => true, | ||
42 | + 'id' => false, | ||
43 | + ]; | ||
44 | +} |
@@ -0,0 +1,116 @@ | @@ -0,0 +1,116 @@ | ||
1 | +<?php | ||
2 | +namespace App\Model\Table; | ||
3 | + | ||
4 | +use App\Model\Entity\Configuration; | ||
5 | +use Cake\ORM\Query; | ||
6 | +use Cake\ORM\RulesChecker; | ||
7 | +use Cake\ORM\Table; | ||
8 | +use Cake\Validation\Validator; | ||
9 | + | ||
10 | +/** | ||
11 | + * Configurations Model | ||
12 | + * | ||
13 | + */ | ||
14 | +class ConfigurationsTable extends Table | ||
15 | +{ | ||
16 | + | ||
17 | + /** | ||
18 | + * Initialize method | ||
19 | + * | ||
20 | + * @param array $config The configuration for the Table. | ||
21 | + * @return void | ||
22 | + */ | ||
23 | + public function initialize(array $config) | ||
24 | + { | ||
25 | + parent::initialize($config); | ||
26 | + | ||
27 | + $this->table('configurations'); | ||
28 | + $this->displayField('id'); | ||
29 | + $this->primaryKey('id'); | ||
30 | + } | ||
31 | + | ||
32 | + /** | ||
33 | + * Default validation rules. | ||
34 | + * | ||
35 | + * @param \Cake\Validation\Validator $validator Validator instance. | ||
36 | + * @return \Cake\Validation\Validator | ||
37 | + */ | ||
38 | + public function validationDefault(Validator $validator) | ||
39 | + { | ||
40 | + $validator | ||
41 | + ->integer('id') | ||
42 | + ->allowEmpty('id', 'create'); | ||
43 | + | ||
44 | + $validator | ||
45 | + ->requirePresence('nom', 'create') | ||
46 | + ->notEmpty('nom') | ||
47 | + ->add('nom', 'unique', ['rule' => 'validateUnique', 'provider' => 'table']); | ||
48 | + | ||
49 | + $validator | ||
50 | + ->boolean('mode_install') | ||
51 | + ->allowEmpty('mode_install'); | ||
52 | + | ||
53 | + $validator | ||
54 | + ->boolean('mode_debug') | ||
55 | + ->allowEmpty('mode_debug'); | ||
56 | + | ||
57 | + $validator | ||
58 | + ->boolean('use_ldap') | ||
59 | + ->allowEmpty('use_ldap'); | ||
60 | + | ||
61 | + $validator | ||
62 | + ->allowEmpty('host_ldap'); | ||
63 | + | ||
64 | + $validator | ||
65 | + ->allowEmpty('port_ldap'); | ||
66 | + | ||
67 | + $validator | ||
68 | + ->allowEmpty('authentificationType_ldap'); | ||
69 | + | ||
70 | + $validator | ||
71 | + ->allowEmpty('baseDn_ldap'); | ||
72 | + | ||
73 | + $validator | ||
74 | + ->allowEmpty('filter_ldap'); | ||
75 | + | ||
76 | + $validator | ||
77 | + ->allowEmpty('labName'); | ||
78 | + | ||
79 | + $validator | ||
80 | + ->allowEmpty('labNameShort'); | ||
81 | + | ||
82 | + $validator | ||
83 | + ->allowEmpty('labPresent'); | ||
84 | + | ||
85 | + $validator | ||
86 | + ->allowEmpty('labUmr'); | ||
87 | + | ||
88 | + $validator | ||
89 | + ->boolean('hasPrinter') | ||
90 | + ->allowEmpty('hasPrinter'); | ||
91 | + | ||
92 | + $validator | ||
93 | + ->allowEmpty('emailGuest1'); | ||
94 | + | ||
95 | + $validator | ||
96 | + ->allowEmpty('emailGuest2'); | ||
97 | + | ||
98 | + $validator | ||
99 | + ->allowEmpty('emailGuest3'); | ||
100 | + | ||
101 | + return $validator; | ||
102 | + } | ||
103 | + | ||
104 | + /** | ||
105 | + * Returns a rules checker object that will be used for validating | ||
106 | + * application integrity. | ||
107 | + * | ||
108 | + * @param \Cake\ORM\RulesChecker $rules The rules object to be modified. | ||
109 | + * @return \Cake\ORM\RulesChecker | ||
110 | + */ | ||
111 | + public function buildRules(RulesChecker $rules) | ||
112 | + { | ||
113 | + $rules->add($rules->isUnique(['nom'])); | ||
114 | + return $rules; | ||
115 | + } | ||
116 | +} |
src/Model/Table/MaterielsTable.php
@@ -255,16 +255,16 @@ class MaterielsTable extends AppTable | @@ -255,16 +255,16 @@ class MaterielsTable extends AppTable | ||
255 | // numero_laboratoire generator (QC changed this in Jan 2015) | 255 | // numero_laboratoire generator (QC changed this in Jan 2015) |
256 | if (empty($entity->get('numero_laboratoire')) && !empty($entity->get('date_acquisition'))) { | 256 | if (empty($entity->get('numero_laboratoire')) && !empty($entity->get('date_acquisition'))) { |
257 | $year = substr($entity->get('date_acquisition'), 6, 4); | 257 | $year = substr($entity->get('date_acquisition'), 6, 4); |
258 | - $labName = 'IRAP'; | ||
259 | - | 258 | + $labShortName = TableRegistry::get('Configurations')->find()->first()->labNameShort; |
259 | + | ||
260 | $num = TableRegistry::get('Materiels')->find('all', [ | 260 | $num = TableRegistry::get('Materiels')->find('all', [ |
261 | 'fields' => ['numero_laboratoire'], | 261 | 'fields' => ['numero_laboratoire'], |
262 | - 'conditions' => ['Materiels.numero_laboratoire LIKE' => $labName.'-'.$year.'%'], | 262 | + 'conditions' => ['Materiels.numero_laboratoire LIKE' => $labShortName.'-'.$year.'%'], |
263 | 'order' => ['Materiels.numero_laboratoire DESC'] | 263 | 'order' => ['Materiels.numero_laboratoire DESC'] |
264 | ])->first()['numero_laboratoire']; | 264 | ])->first()['numero_laboratoire']; |
265 | 265 | ||
266 | $newId = substr($num, -4)+1; | 266 | $newId = substr($num, -4)+1; |
267 | - $labNumber = $labName.'-'.$year.'-'.sprintf("%04d", $newId); | 267 | + $labNumber = $labShortName.'-'.$year.'-'.sprintf("%04d", $newId); |
268 | 268 | ||
269 | $entity->set('numero_laboratoire', $labNumber); | 269 | $entity->set('numero_laboratoire', $labNumber); |
270 | } | 270 | } |
@@ -0,0 +1,35 @@ | @@ -0,0 +1,35 @@ | ||
1 | + | ||
2 | +<div class="configurations form"> | ||
3 | + <?= $this->Form->create($configuration) ?> | ||
4 | + <fieldset> | ||
5 | + <h2><i class="icon-edit"></i> Editer la configuration</h2> | ||
6 | + <?php | ||
7 | + echo $this->Form->input('mode_install'); | ||
8 | + echo $this->Form->input('mode_debug'); | ||
9 | + echo $this->Form->input('use_ldap', ['label' => 'Utilisation du LDAP']); | ||
10 | + echo $this->Form->input('host_ldap', ['label' => 'Host du LDAP']); | ||
11 | + echo $this->Form->input('port_ldap', ['label' => 'Port du LDAP']); | ||
12 | + echo $this->Form->input('authentificationType_ldap', ['label' => 'Type d\'authentification du LDAP']); | ||
13 | + echo $this->Form->input('baseDn_ldap', ['label' => 'Base DN du LDAP']); | ||
14 | + echo $this->Form->input('filter_ldap', ['label' => 'Filtre du LDAP']); | ||
15 | + echo $this->Form->input('labName', ['label' => 'Nom complet du Labo']); | ||
16 | + echo $this->Form->input('labNameShort', ['label' => 'Nom court du Labo']); | ||
17 | + echo $this->Form->input('labPresent', ['label' => 'Liaison présentation nom du Labo']); | ||
18 | + echo $this->Form->input('labUmr', ['label' => 'UMR du Labo']); | ||
19 | + echo $this->Form->input('hasPrinter', ['label' => 'Imprimante disponible']); | ||
20 | + echo $this->Form->input('emailGuest1', ['label' => 'Mail guest 1']); | ||
21 | + echo $this->Form->input('emailGuest2', ['label' => 'Mail guest 2']); | ||
22 | + echo $this->Form->input('emailGuest3', ['label' => 'Mail guest 3']); | ||
23 | + ?> | ||
24 | + </fieldset> | ||
25 | + <?= $this->Form->submit(__('Valider')) ?> | ||
26 | + <?= $this->Form->end() ?> | ||
27 | +</div> | ||
28 | + | ||
29 | + | ||
30 | +<div class="actions"> | ||
31 | + <?php | ||
32 | + echo $this->element('menu'); | ||
33 | + echo $this->element('menu_form', [ 'pluralHumanName' => 'Configuration générale' ]); | ||
34 | + ?> | ||
35 | +</div> | ||
0 | \ No newline at end of file | 36 | \ No newline at end of file |
@@ -0,0 +1,68 @@ | @@ -0,0 +1,68 @@ | ||
1 | +<?php | ||
2 | +function displayElement($nom, $valeur) { | ||
3 | + echo '<tr><td><strong>'.$nom.' </strong></td><td>'.$valeur.'</td></tr>'; | ||
4 | +} | ||
5 | +?> | ||
6 | + | ||
7 | +<div class="configurations view"> | ||
8 | + <h2>Configuration générale de l'application</h2> | ||
9 | + <table style="margin-bottom: 30px;"> | ||
10 | + | ||
11 | + <?php | ||
12 | + echo $this->Html->link(__('<i class="icon-pencil"></i> Editer la configuration'), | ||
13 | + ['action' => 'edit', $configuration->id], | ||
14 | + ['escape' => false,'onclick' => 'return true;'] | ||
15 | + ); | ||
16 | + | ||
17 | + if(h($configuration->mode_install) == 1) { | ||
18 | + $install="Oui"; | ||
19 | + }else { | ||
20 | + $install="Non"; | ||
21 | + } | ||
22 | + displayElement(__('Mode install'), $install); | ||
23 | + | ||
24 | + if(h($configuration->mode_debug) == 1) { | ||
25 | + $debug="Oui"; | ||
26 | + }else { | ||
27 | + $debug="Non"; | ||
28 | + } | ||
29 | + displayElement(__('Mode debug'), $debug); | ||
30 | + | ||
31 | + if(h($configuration->use_ldap) == 1) { | ||
32 | + $ldap="Oui"; | ||
33 | + }else { | ||
34 | + $ldap="Non"; | ||
35 | + } | ||
36 | + displayElement(__('Utilisation du LDAP'), $ldap); | ||
37 | + | ||
38 | + displayElement(__('Host du LDAP'), h($configuration->host_ldap)); | ||
39 | + displayElement(__('Port du LDAP'), h($configuration->port_ldap)); | ||
40 | + displayElement(__('Type d\'authentification du LDAP'), h($configuration->authentificationType_ldap)); | ||
41 | + displayElement(__('Base DN du LDAP'), h($configuration->baseDn_ldap)); | ||
42 | + displayElement(__('Filtre du LDAP'), h($configuration->filter_ldap)); | ||
43 | + | ||
44 | + displayElement(__('Nom complet du Labo'), h($configuration->labName)); | ||
45 | + displayElement(__('Nom court du Labo'), h($configuration->labNameShort)); | ||
46 | + displayElement(__('Liaison présentation nom du Labo'), h($configuration->labPresent)); | ||
47 | + displayElement(__('UMR du Labo'), h($configuration->labUmr)); | ||
48 | + | ||
49 | + if(h($configuration->hasPrinter) == 1) { | ||
50 | + $print="Oui"; | ||
51 | + }else { | ||
52 | + $print="Non"; | ||
53 | + } | ||
54 | + displayElement(__('Imprimante disponible'), $print); | ||
55 | + | ||
56 | + displayElement(__('Mail guest 1'), h($configuration->emailGuest1)); | ||
57 | + displayElement(__('Mail guest 2'), h($configuration->emailGuest2)); | ||
58 | + displayElement(__('Mail guest 3'), h($configuration->emailGuest3)); | ||
59 | + | ||
60 | + ?> | ||
61 | + | ||
62 | + | ||
63 | + </table> | ||
64 | +</div> | ||
65 | + | ||
66 | + <div class="actions"> | ||
67 | + <?php echo $this->element('menu') ?> | ||
68 | + </div> |
src/Template/Layout/default.ctp
@@ -93,7 +93,7 @@ $cakeDescription = 'Labinvent 2.0'; | @@ -93,7 +93,7 @@ $cakeDescription = 'Labinvent 2.0'; | ||
93 | </i></td> | 93 | </i></td> |
94 | <td id="version"> | 94 | <td id="version"> |
95 | <!-- VERSION M.m.f.b (version (M)ajeure, version (m)ineure, numero de nouvelle (f)onctionnalite, numero de (b)ugfix) --> | 95 | <!-- VERSION M.m.f.b (version (M)ajeure, version (m)ineure, numero de nouvelle (f)onctionnalite, numero de (b)ugfix) --> |
96 | - <font color="black">VERSION 2.0.3.1 (08/05/2016)</font> | 96 | + <font color="black">VERSION 2.0.5.1 (09/05/2016)</font> |
97 | </td> | 97 | </td> |
98 | </tr> | 98 | </tr> |
99 | </table> | 99 | </table> |
src/Template/Materiels/add.ctp
@@ -40,8 +40,8 @@ | @@ -40,8 +40,8 @@ | ||
40 | echo $this->Form->input('date_reception', ['type' => 'text', 'label' => 'Date de réception', 'class' => 'datepicker', 'placeholder' => 'A éditer lors de la réception uniquement.', 'empty' => true]); | 40 | echo $this->Form->input('date_reception', ['type' => 'text', 'label' => 'Date de réception', 'class' => 'datepicker', 'placeholder' => 'A éditer lors de la réception uniquement.', 'empty' => true]); |
41 | 41 | ||
42 | echo $this->Form->input('numero_serie', ['label' => 'Numéro de série']); | 42 | echo $this->Form->input('numero_serie', ['label' => 'Numéro de série']); |
43 | - echo $this->Form->input('groupes_thematique_id', ['label' => 'Groupe thématique', 'options' => $groupesThematiques]); | ||
44 | - echo $this->Form->input('groupes_metier_id', ['label' => 'Groupe métier', 'options' => $groupesMetiers]); | 43 | + echo $this->Form->input('groupes_thematique_id', ['label' => 'Groupe thématique', 'empty' => 'Choisir un groupe thématique', 'options' => $groupesThematiques]); |
44 | + echo $this->Form->input('groupes_metier_id', ['label' => 'Groupe métier', 'empty' => 'Choisir un groupe métier', 'options' => $groupesMetiers]); | ||
45 | 45 | ||
46 | echo $this->Form->input('nom_responsable', [ | 46 | echo $this->Form->input('nom_responsable', [ |
47 | 'label' => 'Nom du responsable', | 47 | 'label' => 'Nom du responsable', |
src/Template/Materiels/edit.ctp
@@ -150,10 +150,12 @@ if (IS_VALIDATED) | @@ -150,10 +150,12 @@ if (IS_VALIDATED) | ||
150 | ]); | 150 | ]); |
151 | echo $this->Form->input('groupes_thematique_id', [ | 151 | echo $this->Form->input('groupes_thematique_id', [ |
152 | 'label' => 'Groupe thématique', | 152 | 'label' => 'Groupe thématique', |
153 | + 'empty' => 'Choisir un groupe thématique', | ||
153 | 'disabled' => isReadonlyField('groupes_thematique_id', $myReadonlyFields), | 154 | 'disabled' => isReadonlyField('groupes_thematique_id', $myReadonlyFields), |
154 | 'options' => $groupesThematiques]); | 155 | 'options' => $groupesThematiques]); |
155 | echo $this->Form->input('groupes_metier_id', [ | 156 | echo $this->Form->input('groupes_metier_id', [ |
156 | 'label' => 'Groupe métier', | 157 | 'label' => 'Groupe métier', |
158 | + 'empty' => 'Choisir un groupe métier', | ||
157 | 'disabled' => isReadonlyField('groupes_metier_id', $myReadonlyFields), | 159 | 'disabled' => isReadonlyField('groupes_metier_id', $myReadonlyFields), |
158 | 'options' => $groupesMetiers]); | 160 | 'options' => $groupesMetiers]); |
159 | 161 |
src/Template/Pages/home.ctp
@@ -3,7 +3,7 @@ | @@ -3,7 +3,7 @@ | ||
3 | use Cake\Core\Configure; | 3 | use Cake\Core\Configure; |
4 | 4 | ||
5 | //if (Configure::read('debug')) { | 5 | //if (Configure::read('debug')) { |
6 | -if ($this->request->session()->read('install')) { | 6 | +if ($configuration->mode_install) { |
7 | include("home_install.ctp"); | 7 | include("home_install.ctp"); |
8 | } | 8 | } |
9 | else { | 9 | else { |
src/Template/Pages/home_app.ctp
@@ -2,7 +2,7 @@ | @@ -2,7 +2,7 @@ | ||
2 | <div class="index"> | 2 | <div class="index"> |
3 | <h2><i class="icon-home"></i> Accueil</h2> | 3 | <h2><i class="icon-home"></i> Accueil</h2> |
4 | 4 | ||
5 | -<p>Bienvenue sur l'inventaire administratif et technique de l'<b>IRAP</b>.</p> | 5 | +<p>Bienvenue sur l'inventaire administratif et technique <?= $configuration->labPresent.' <b>'.$configuration->labName ?></b>.</p> |
6 | 6 | ||
7 | <?php | 7 | <?php |
8 | //Utilisateur connecté | 8 | //Utilisateur connecté |
src/Template/Pages/home_install.ctp
@@ -40,7 +40,7 @@ $this->layout = false; | @@ -40,7 +40,7 @@ $this->layout = false; | ||
40 | <div id="content"> | 40 | <div id="content"> |
41 | <div class="row"> | 41 | <div class="row"> |
42 | <div class="columns large-12 ctp-warning checks", style="text-align: center"> | 42 | <div class="columns large-12 ctp-warning checks", style="text-align: center"> |
43 | - <?php echo $this->Form->postLink("Stop Install mode", ['controller' => 'materiels', 'action'=>'installOff'], ['confirm' => __('Êtes-vous sur ?')]); ?> | 43 | + <?php echo $this->Form->postLink("Stop Install mode", ['controller' => 'configurations', 'action'=>'installOff'], ['confirm' => __('Êtes-vous sur ?')]); ?> |
44 | </div> | 44 | </div> |
45 | <?php Debugger::checkSecurityKeys(); ?> | 45 | <?php Debugger::checkSecurityKeys(); ?> |
46 | <div id="url-rewriting-warning" class="columns large-12 url-rewriting checks"> | 46 | <div id="url-rewriting-warning" class="columns large-12 url-rewriting checks"> |
src/Template/Pages/tools.ctp
@@ -19,7 +19,7 @@ | @@ -19,7 +19,7 @@ | ||
19 | echo '</td></tr>'; | 19 | echo '</td></tr>'; |
20 | 20 | ||
21 | echo '<tr><td>'; | 21 | echo '<tr><td>'; |
22 | - echo $this->Html->link('Configuration générale de l\'application', ['controller' => 'configuration', 'action' => 'view', 0]); | 22 | + echo $this->Html->link('Configuration générale de l\'application', ['controller' => 'configurations', 'action' => 'view', 1]); |
23 | echo '</td></tr>'; | 23 | echo '</td></tr>'; |
24 | 24 | ||
25 | echo '<tr><td>'; | 25 | echo '<tr><td>'; |
@@ -38,11 +38,23 @@ | @@ -38,11 +38,23 @@ | ||
38 | * Mode debug | 38 | * Mode debug |
39 | */ | 39 | */ |
40 | echo '<tr><td>'; | 40 | echo '<tr><td>'; |
41 | - if ($this->request->session()->read('install')) { | ||
42 | - echo $this->Form->postLink("Stopper le mode INSTALL", ['controller' => 'materiels', 'action'=>'installOff'], ['confirm' => __('Êtes-vous sur ?')]); | 41 | + if ($configuration->mode_debug) { |
42 | + echo $this->Form->postLink("Stopper le mode DEBUG", ['controller' => 'configurations', 'action'=>'debugOff'], ['confirm' => __('Êtes-vous sur ?')]); | ||
43 | } | 43 | } |
44 | else { | 44 | else { |
45 | - echo $this->Form->postLink("Passer en mode INSTALL", ['controller' => 'materiels', 'action'=>'installOn'], ['confirm' => __('Êtes-vous sur ?')]); | 45 | + echo $this->Form->postLink("Passer en mode DEBUG", ['controller' => 'configurations', 'action'=>'debugOn'], ['confirm' => __('Êtes-vous sur ?')]); |
46 | + } | ||
47 | + echo '</td></tr>'; | ||
48 | + | ||
49 | + /* | ||
50 | + * Mode install | ||
51 | + */ | ||
52 | + echo '<tr><td>'; | ||
53 | + if ($configuration->mode_install) { | ||
54 | + echo $this->Form->postLink("Stopper le mode INSTALL", ['controller' => 'configurations', 'action'=>'installOff'], ['confirm' => __('Êtes-vous sur ?')]); | ||
55 | + } | ||
56 | + else { | ||
57 | + echo $this->Form->postLink("Passer en mode INSTALL", ['controller' => 'configurations', 'action'=>'installOn'], ['confirm' => __('Êtes-vous sur ?')]); | ||
46 | } | 58 | } |
47 | echo '</td></tr>'; | 59 | echo '</td></tr>'; |
48 | 60 |
@@ -0,0 +1,76 @@ | @@ -0,0 +1,76 @@ | ||
1 | +<?php | ||
2 | +namespace App\Test\Fixture; | ||
3 | + | ||
4 | +use Cake\TestSuite\Fixture\TestFixture; | ||
5 | + | ||
6 | +/** | ||
7 | + * ConfigurationsFixture | ||
8 | + * | ||
9 | + */ | ||
10 | +class ConfigurationsFixture extends TestFixture | ||
11 | +{ | ||
12 | + | ||
13 | + /** | ||
14 | + * Fields | ||
15 | + * | ||
16 | + * @var array | ||
17 | + */ | ||
18 | + // @codingStandardsIgnoreStart | ||
19 | + public $fields = [ | ||
20 | + 'id' => ['type' => 'integer', 'length' => 11, 'unsigned' => false, 'null' => false, 'default' => null, 'comment' => '', 'autoIncrement' => true, 'precision' => null], | ||
21 | + 'nom' => ['type' => 'string', 'length' => 45, 'null' => false, 'default' => null, 'comment' => 'obligatoire (et unique)', 'precision' => null, 'fixed' => null], | ||
22 | + 'mode_install' => ['type' => 'boolean', 'length' => null, 'null' => true, 'default' => null, 'comment' => '', 'precision' => null], | ||
23 | + 'mode_debug' => ['type' => 'boolean', 'length' => null, 'null' => true, 'default' => null, 'comment' => '', 'precision' => null], | ||
24 | + 'use_ldap' => ['type' => 'boolean', 'length' => null, 'null' => true, 'default' => null, 'comment' => '', 'precision' => null], | ||
25 | + 'host_ldap' => ['type' => 'string', 'length' => 30, 'null' => true, 'default' => null, 'comment' => '', 'precision' => null, 'fixed' => null], | ||
26 | + 'port_ldap' => ['type' => 'string', 'length' => 10, 'null' => true, 'default' => null, 'comment' => '', 'precision' => null, 'fixed' => null], | ||
27 | + 'authentificationType_ldap' => ['type' => 'string', 'length' => 30, 'null' => true, 'default' => null, 'comment' => '', 'precision' => null, 'fixed' => null], | ||
28 | + 'baseDn_ldap' => ['type' => 'string', 'length' => 30, 'null' => true, 'default' => null, 'comment' => '', 'precision' => null, 'fixed' => null], | ||
29 | + 'filter_ldap' => ['type' => 'string', 'length' => 30, 'null' => true, 'default' => null, 'comment' => '', 'precision' => null, 'fixed' => null], | ||
30 | + 'labName' => ['type' => 'string', 'length' => 30, 'null' => true, 'default' => null, 'comment' => '', 'precision' => null, 'fixed' => null], | ||
31 | + 'labNameShort' => ['type' => 'string', 'length' => 20, 'null' => true, 'default' => null, 'comment' => '', 'precision' => null, 'fixed' => null], | ||
32 | + 'labPresent' => ['type' => 'string', 'length' => 10, 'null' => true, 'default' => null, 'comment' => '', 'precision' => null, 'fixed' => null], | ||
33 | + 'labUmr' => ['type' => 'string', 'length' => 30, 'null' => true, 'default' => null, 'comment' => '', 'precision' => null, 'fixed' => null], | ||
34 | + 'hasPrinter' => ['type' => 'boolean', 'length' => null, 'null' => true, 'default' => null, 'comment' => '', 'precision' => null], | ||
35 | + 'emailGuest1' => ['type' => 'string', 'length' => 45, 'null' => true, 'default' => null, 'comment' => '', 'precision' => null, 'fixed' => null], | ||
36 | + 'emailGuest2' => ['type' => 'string', 'length' => 45, 'null' => true, 'default' => null, 'comment' => '', 'precision' => null, 'fixed' => null], | ||
37 | + 'emailGuest3' => ['type' => 'string', 'length' => 45, 'null' => true, 'default' => null, 'comment' => '', 'precision' => null, 'fixed' => null], | ||
38 | + '_constraints' => [ | ||
39 | + 'primary' => ['type' => 'primary', 'columns' => ['id'], 'length' => []], | ||
40 | + 'nom_UNIQUE' => ['type' => 'unique', 'columns' => ['nom'], 'length' => []], | ||
41 | + ], | ||
42 | + '_options' => [ | ||
43 | + 'engine' => 'InnoDB', | ||
44 | + 'collation' => 'latin1_swedish_ci' | ||
45 | + ], | ||
46 | + ]; | ||
47 | + // @codingStandardsIgnoreEnd | ||
48 | + | ||
49 | + /** | ||
50 | + * Records | ||
51 | + * | ||
52 | + * @var array | ||
53 | + */ | ||
54 | + public $records = [ | ||
55 | + [ | ||
56 | + 'id' => 1, | ||
57 | + 'nom' => 'Lorem ipsum dolor sit amet', | ||
58 | + 'mode_install' => 1, | ||
59 | + 'mode_debug' => 1, | ||
60 | + 'use_ldap' => 1, | ||
61 | + 'host_ldap' => 'Lorem ipsum dolor sit amet', | ||
62 | + 'port_ldap' => 'Lorem ip', | ||
63 | + 'authentificationType_ldap' => 'Lorem ipsum dolor sit amet', | ||
64 | + 'baseDn_ldap' => 'Lorem ipsum dolor sit amet', | ||
65 | + 'filter_ldap' => 'Lorem ipsum dolor sit amet', | ||
66 | + 'labName' => 'Lorem ipsum dolor sit amet', | ||
67 | + 'labNameShort' => 'Lorem ipsum dolor ', | ||
68 | + 'labPresent' => 'Lorem ip', | ||
69 | + 'labUmr' => 'Lorem ipsum dolor sit amet', | ||
70 | + 'hasPrinter' => 1, | ||
71 | + 'emailGuest1' => 'Lorem ipsum dolor sit amet', | ||
72 | + 'emailGuest2' => 'Lorem ipsum dolor sit amet', | ||
73 | + 'emailGuest3' => 'Lorem ipsum dolor sit amet' | ||
74 | + ], | ||
75 | + ]; | ||
76 | +} |
tests/Fixture/UtilisateursFixture.php deleted
@@ -1,56 +0,0 @@ | @@ -1,56 +0,0 @@ | ||
1 | -<?php | ||
2 | -namespace App\Test\Fixture; | ||
3 | - | ||
4 | -use Cake\TestSuite\Fixture\TestFixture; | ||
5 | - | ||
6 | -/** | ||
7 | - * UtilisateursFixture | ||
8 | - * | ||
9 | - */ | ||
10 | -class UtilisateursFixture extends TestFixture | ||
11 | -{ | ||
12 | - | ||
13 | - /** | ||
14 | - * Fields | ||
15 | - * | ||
16 | - * @var array | ||
17 | - */ | ||
18 | - // @codingStandardsIgnoreStart | ||
19 | - public $fields = [ | ||
20 | - 'id' => ['type' => 'integer', 'length' => 11, 'unsigned' => false, 'null' => false, 'default' => null, 'comment' => '', 'autoIncrement' => true, 'precision' => null], | ||
21 | - 'nom' => ['type' => 'string', 'length' => 45, 'null' => true, 'default' => null, 'comment' => '', 'precision' => null, 'fixed' => null], | ||
22 | - 'login' => ['type' => 'string', 'length' => 45, 'null' => true, 'default' => null, 'comment' => '', 'precision' => null, 'fixed' => null], | ||
23 | - 'email' => ['type' => 'string', 'length' => 45, 'null' => true, 'default' => null, 'comment' => '', 'precision' => null, 'fixed' => null], | ||
24 | - 'role' => ['type' => 'string', 'length' => 45, 'null' => true, 'default' => null, 'comment' => '', 'precision' => null, 'fixed' => null], | ||
25 | - 'groupes_metier_id' => ['type' => 'integer', 'length' => 11, 'unsigned' => false, 'null' => true, 'default' => null, 'comment' => '', 'precision' => null, 'autoIncrement' => null], | ||
26 | - '_indexes' => [ | ||
27 | - 'fk_utilisateurs_groupes_travails1' => ['type' => 'index', 'columns' => ['groupes_metier_id'], 'length' => []], | ||
28 | - ], | ||
29 | - '_constraints' => [ | ||
30 | - 'primary' => ['type' => 'primary', 'columns' => ['id'], 'length' => []], | ||
31 | - 'login_UNIQUE' => ['type' => 'unique', 'columns' => ['login'], 'length' => []], | ||
32 | - 'fk_utilisateurs_groupes_travails1' => ['type' => 'foreign', 'columns' => ['groupes_metier_id'], 'references' => ['groupes_metiers', 'id'], 'update' => 'noAction', 'delete' => 'noAction', 'length' => []], | ||
33 | - ], | ||
34 | - '_options' => [ | ||
35 | - 'engine' => 'InnoDB', | ||
36 | - 'collation' => 'latin1_swedish_ci' | ||
37 | - ], | ||
38 | - ]; | ||
39 | - // @codingStandardsIgnoreEnd | ||
40 | - | ||
41 | - /** | ||
42 | - * Records | ||
43 | - * | ||
44 | - * @var array | ||
45 | - */ | ||
46 | - public $records = [ | ||
47 | - [ | ||
48 | - 'id' => 1, | ||
49 | - 'nom' => 'Lorem ipsum dolor sit amet', | ||
50 | - 'login' => 'Lorem ipsum dolor sit amet', | ||
51 | - 'email' => 'Lorem ipsum dolor sit amet', | ||
52 | - 'role' => 'Lorem ipsum dolor sit amet', | ||
53 | - 'groupes_metier_id' => 1 | ||
54 | - ], | ||
55 | - ]; | ||
56 | -} |
tests/TestCase/Controller/UtilisateursControllerTest.php renamed to tests/TestCase/Controller/ConfigurationsControllerTest.php
100755 → 100644
1 | <?php | 1 | <?php |
2 | namespace App\Test\TestCase\Controller; | 2 | namespace App\Test\TestCase\Controller; |
3 | 3 | ||
4 | -use App\Controller\UtilisateursController; | 4 | +use App\Controller\ConfigurationsController; |
5 | use Cake\TestSuite\IntegrationTestCase; | 5 | use Cake\TestSuite\IntegrationTestCase; |
6 | 6 | ||
7 | /** | 7 | /** |
8 | - * App\Controller\UtilisateursController Test Case | 8 | + * App\Controller\ConfigurationsController Test Case |
9 | */ | 9 | */ |
10 | -class UtilisateursControllerTest extends IntegrationTestCase | 10 | +class ConfigurationsControllerTest extends IntegrationTestCase |
11 | { | 11 | { |
12 | 12 | ||
13 | /** | 13 | /** |
@@ -16,9 +16,7 @@ class UtilisateursControllerTest extends IntegrationTestCase | @@ -16,9 +16,7 @@ class UtilisateursControllerTest extends IntegrationTestCase | ||
16 | * @var array | 16 | * @var array |
17 | */ | 17 | */ |
18 | public $fixtures = [ | 18 | public $fixtures = [ |
19 | - 'app.utilisateurs', | ||
20 | - 'app.groupes_metiers', | ||
21 | - 'app.materiels' | 19 | + 'app.configurations' |
22 | ]; | 20 | ]; |
23 | 21 | ||
24 | /** | 22 | /** |
tests/TestCase/Model/Table/UtilisateursTableTest.php renamed to tests/TestCase/Model/Table/ConfigurationsTableTest.php
100755 → 100644
1 | <?php | 1 | <?php |
2 | namespace App\Test\TestCase\Model\Table; | 2 | namespace App\Test\TestCase\Model\Table; |
3 | 3 | ||
4 | -use App\Model\Table\UtilisateursTable; | 4 | +use App\Model\Table\ConfigurationsTable; |
5 | use Cake\ORM\TableRegistry; | 5 | use Cake\ORM\TableRegistry; |
6 | use Cake\TestSuite\TestCase; | 6 | use Cake\TestSuite\TestCase; |
7 | 7 | ||
8 | /** | 8 | /** |
9 | - * App\Model\Table\UtilisateursTable Test Case | 9 | + * App\Model\Table\ConfigurationsTable Test Case |
10 | */ | 10 | */ |
11 | -class UtilisateursTableTest extends TestCase | 11 | +class ConfigurationsTableTest extends TestCase |
12 | { | 12 | { |
13 | 13 | ||
14 | /** | 14 | /** |
15 | * Test subject | 15 | * Test subject |
16 | * | 16 | * |
17 | - * @var \App\Model\Table\UtilisateursTable | 17 | + * @var \App\Model\Table\ConfigurationsTable |
18 | */ | 18 | */ |
19 | - public $Utilisateurs; | 19 | + public $Configurations; |
20 | 20 | ||
21 | /** | 21 | /** |
22 | * Fixtures | 22 | * Fixtures |
@@ -24,9 +24,7 @@ class UtilisateursTableTest extends TestCase | @@ -24,9 +24,7 @@ class UtilisateursTableTest extends TestCase | ||
24 | * @var array | 24 | * @var array |
25 | */ | 25 | */ |
26 | public $fixtures = [ | 26 | public $fixtures = [ |
27 | - 'app.utilisateurs', | ||
28 | - 'app.groupes_metiers', | ||
29 | - 'app.materiels' | 27 | + 'app.configurations' |
30 | ]; | 28 | ]; |
31 | 29 | ||
32 | /** | 30 | /** |
@@ -37,8 +35,8 @@ class UtilisateursTableTest extends TestCase | @@ -37,8 +35,8 @@ class UtilisateursTableTest extends TestCase | ||
37 | public function setUp() | 35 | public function setUp() |
38 | { | 36 | { |
39 | parent::setUp(); | 37 | parent::setUp(); |
40 | - $config = TableRegistry::exists('Utilisateurs') ? [] : ['className' => 'App\Model\Table\UtilisateursTable']; | ||
41 | - $this->Utilisateurs = TableRegistry::get('Utilisateurs', $config); | 38 | + $config = TableRegistry::exists('Configurations') ? [] : ['className' => 'App\Model\Table\ConfigurationsTable']; |
39 | + $this->Configurations = TableRegistry::get('Configurations', $config); | ||
42 | } | 40 | } |
43 | 41 | ||
44 | /** | 42 | /** |
@@ -48,7 +46,7 @@ class UtilisateursTableTest extends TestCase | @@ -48,7 +46,7 @@ class UtilisateursTableTest extends TestCase | ||
48 | */ | 46 | */ |
49 | public function tearDown() | 47 | public function tearDown() |
50 | { | 48 | { |
51 | - unset($this->Utilisateurs); | 49 | + unset($this->Configurations); |
52 | 50 | ||
53 | parent::tearDown(); | 51 | parent::tearDown(); |
54 | } | 52 | } |