Commit e9a0cc5683111bbdada39e4f34d8e8d93ffc5e15
1 parent
3ef8f907
Exists in
master
and in
3 other branches
Version: 2.4.6.0
!!! Mise à jour : Exécuter le script db-update-2016-06-20.sh (en se plaçant dans le dossier ./database/update) !!! Suivis (ajout groupe thematique et metier) + bouton TBA pour responsable (materiels/index) + recherche de suivi + réglages attribut from mail + bugfixes (recherche date, probleme config mail 1-10, ...) Demande (terminé) : https://projects.irap.omp.eu/issues/3784 https://projects.irap.omp.eu/issues/3782 https://projects.irap.omp.eu/issues/3788 Version majeure en cours (2.4): https://projects.irap.omp.eu/versions/107 ROADMAP: https://projects.irap.omp.eu/projects/labinvent/roadmap
Showing
48 changed files
with
508 additions
and
60 deletions
Show diff stats
README-LABINVENT.md
... | ... | @@ -51,18 +51,16 @@ Logiciel testé et validé sur les configurations suivantes : |
51 | 51 | VERSION ACTUELLE |
52 | 52 | |
53 | 53 | Date: 20/06/2016 |
54 | -Version: 2.4.5.0 | |
55 | - | |
56 | -guide utilisateur + bouton retour (form) + liste autres (menu) + garde fou materiel/edit (partie admin) + attribut panne (suivi) + bugfixes | |
57 | - | |
58 | -Demande (terminé) : https://projects.irap.omp.eu/issues/3842 | |
59 | - https://projects.irap.omp.eu/issues/3798 | |
60 | - https://projects.irap.omp.eu/issues/3786 | |
61 | - https://projects.irap.omp.eu/issues/3792 | |
62 | - https://projects.irap.omp.eu/issues/3802 | |
63 | - https://projects.irap.omp.eu/issues/3806 | |
64 | - | |
65 | - | |
54 | +Version: 2.4.6.0 | |
55 | + | |
56 | +!!! Mise à jour : Exécuter le script db-update-2016-06-20.sh (en se plaçant dans le dossier ./database/update) !!! | |
57 | + | |
58 | +Suivis (ajout groupe thematique et metier) + bouton TBA pour responsable (materiels/index) + recherche de suivi + réglages attribut from mail + bugfixes (recherche date, probleme config mail 1-10, ...) | |
59 | + | |
60 | +Demande (terminé) : https://projects.irap.omp.eu/issues/3784 | |
61 | + https://projects.irap.omp.eu/issues/3782 | |
62 | + https://projects.irap.omp.eu/issues/3788 | |
63 | + | |
66 | 64 | Version majeure en cours (2.4): https://projects.irap.omp.eu/versions/107 |
67 | 65 | |
68 | 66 | ROADMAP: https://projects.irap.omp.eu/projects/labinvent/roadmap |
... | ... | @@ -97,6 +95,8 @@ Liste complète des évolutions: https://gitlab.irap.omp.eu/epallier/labinvent/c |
97 | 95 | |
98 | 96 | MODIFICATIONS STRUCTURELLES A FAIRE MANUELLEMENT APRES LA MISE A JOUR (git pull) |
99 | 97 | |
98 | +20/06/16 (v2.4.6.0) Exécuter le script database/update/db-update-2016-06-20.sh | |
99 | + | |
100 | 100 | 17/06/16 (v2.4.4.4) (Exceptionnel) Exécuter les lignes suivantes (à la racine) : |
101 | 101 | cp -p config/app.php ../config/app.php.ORIG |
102 | 102 | cp config/app.default.php ../config/app.php | ... | ... |
config/app.default.php
... | ... | @@ -233,7 +233,7 @@ return [ |
233 | 233 | 'className' => 'Cake\Database\Connection', |
234 | 234 | 'driver' => 'Cake\Database\Driver\Mysql', |
235 | 235 | 'persistent' => false, |
236 | - 'host' => 'localhost', | |
236 | + /*d*/'host' => 'localhost', | |
237 | 237 | /** |
238 | 238 | * CakePHP will use the default DB port based on the driver selected |
239 | 239 | * MySQL on MAMP uses port 8889, MAMP users will want to uncomment |
... | ... | @@ -278,7 +278,7 @@ return [ |
278 | 278 | 'className' => 'Cake\Database\Connection', |
279 | 279 | 'driver' => 'Cake\Database\Driver\Mysql', |
280 | 280 | 'persistent' => false, |
281 | - 'host' => 'localhost', | |
281 | + /*t*/'host' => 'localhost', | |
282 | 282 | //'port' => 'non_standard_port_number', |
283 | 283 | /*t*/'username' => 'test_username', |
284 | 284 | /*t*/'password' => 'test_password', | ... | ... |
database/labinvent_2.1_12-05-16.sql
... | ... | @@ -250,6 +250,8 @@ CREATE TABLE IF NOT EXISTS `suivis` ( |
250 | 250 | `type_frequence` varchar(30) DEFAULT NULL, |
251 | 251 | `commentaire` varchar(100) DEFAULT NULL, |
252 | 252 | `panne_resolu` tinyint(1) DEFAULT 1, |
253 | + `groupes_thematique_id` int(11) DEFAULT NULL, | |
254 | + `groupes_metier_id` int(11) DEFAULT NULL, | |
253 | 255 | `nom_createur` varchar(45) DEFAULT NULL COMMENT 'nom du createur de la fiche', |
254 | 256 | `nom_modificateur` varchar(45) DEFAULT NULL COMMENT 'nom du modificateur de la fiche', |
255 | 257 | `created` datetime DEFAULT NULL COMMENT 'date et heure de creation de la fiche', |
... | ... | @@ -398,6 +400,9 @@ ALTER TABLE `suivis` |
398 | 400 | ADD CONSTRAINT `fk_admi_material_histories_admi_materials1` FOREIGN KEY (`materiel_id`) REFERENCES `materiels` (`id`) ON DELETE NO ACTION ON UPDATE NO ACTION, |
399 | 401 | ADD CONSTRAINT `fk_suivis_type_suivi_id` FOREIGN KEY (`type_suivi_id`) REFERENCES `type_suivis` (`id`) ON DELETE NO ACTION ON UPDATE NO ACTION; |
400 | 402 | |
403 | +ALTER TABLE `suivis` ADD CONSTRAINT `fk_suivis_groupe_thematique` FOREIGN KEY (`groupes_thematique_id`) REFERENCES `groupes_thematiques` (`id`) ON DELETE NO ACTION ON UPDATE NO ACTION; | |
404 | +ALTER TABLE `suivis` ADD CONSTRAINT `fk_suivis_groupe_metier` FOREIGN KEY (`groupes_metier_id`) REFERENCES `groupes_metiers` (`id`) ON DELETE NO ACTION ON UPDATE NO ACTION; | |
405 | + | |
401 | 406 | -- |
402 | 407 | -- Contraintes pour la table `users` |
403 | 408 | -- | ... | ... |
database/labinvent_mode_update.sql renamed to database/labinvent_add_base_testsql
100644 → 100755
... | ... | @@ -0,0 +1,40 @@ |
1 | +#!/bin/bash | |
2 | + | |
3 | +cp -p ../../config/app.php ../../config/app.php.ORIG | |
4 | +cp ../../config/app.default.php ../../config/app.php | |
5 | + | |
6 | +username=$(grep "/\*d\*/'username'" ../../config/app.php.ORIG | cut -d"'" -f4) | |
7 | +password=$(grep "/\*d\*/'password'" ../../config/app.php.ORIG | cut -d"'" -f4) | |
8 | +database=$(grep "/\*d\*/'database'" ../../config/app.php.ORIG | cut -d"'" -f4) | |
9 | + | |
10 | +usernameTEST=$(grep "/\*t\*/'username'" ../../config/app.php.ORIG | cut -d"'" -f4) | |
11 | +passwordTEST=$(grep "/\*t\*/'password'" ../../config/app.php.ORIG | cut -d"'" -f4) | |
12 | +databaseTEST=$(grep "/\*t\*/'database'" ../../config/app.php.ORIG | cut -d"'" -f4) | |
13 | + | |
14 | +sed -e "s/'database' => 'database'/'database' => '$database'/" -i ../../config/app.php | |
15 | +sed -e "s/'username' => 'username'/'username' => '$username'/" -i ../../config/app.php | |
16 | +sed -e "s/'password' => 'password'/'password' => '$password'/" -i ../../config/app.php | |
17 | + | |
18 | +sed -e "s/'database' => 'test_database'/'database' => '$databaseTEST'/" -i ../../config/app.php | |
19 | +sed -e "s/'username' => 'test_username'/'username' => '$usernameTEST'/" -i ../../config/app.php | |
20 | +sed -e "s/'password' => 'test_password'/'password' => '$passwordTEST'/" -i ../../config/app.php | |
21 | + | |
22 | +sed -e "s/'debug' => filter_var(env('DEBUG', true/'debug' => filter_var(env('DEBUG', false/" -i ../../config/app.php | |
23 | + | |
24 | + | |
25 | +username=$(grep "/\*d\*/'username'" ../../config/app.php | cut -d"'" -f4) | |
26 | +password=$(grep "/\*d\*/'password'" ../../config/app.php | cut -d"'" -f4) | |
27 | +database=$(grep "/\*d\*/'database'" ../../config/app.php | cut -d"'" -f4) | |
28 | +host=$(grep "/\*d\*/'host'" ../../config/app.php | cut -d"'" -f4) | |
29 | + | |
30 | +cp -p ./script_sql/db-update-2016-06-20.sql ./script_sql/db-update-2016-06-20-build.sql | |
31 | + | |
32 | +sed -e "s/database/$database/" -i ./script_sql/db-update-2016-06-20-build.sql | |
33 | +mysql --user=$username --password=$password -h $host < ./script_sql/db-update-2016-06-20-build.sql | |
34 | + | |
35 | +sudo rm ../../tmp/cache/models/* | |
36 | +sudo rm ../../tmp/cache/persistent/* | |
37 | + | |
38 | +sudo chmod -R 777 ../../tmp | |
39 | +sudo chmod -R 777 ../../vendor | |
40 | +sudo chmod -R 777 ../../webroot | ... | ... |
database/update/db-update-modele.sh
1 | 1 | #!/bin/bash |
2 | 2 | |
3 | -username=$(grep "/\*d\*/'username'" ../../config/app.php.ORIG | cut -d"'" -f4) | |
4 | -password=$(grep "/\*d\*/'password'" ../../config/app.php.ORIG | cut -d"'" -f4) | |
5 | -database=$(grep "/\*d\*/'database'" ../../config/app.php.ORIG | cut -d"'" -f4) | |
3 | +username=$(grep "/\*d\*/'username'" ../../config/app.php | cut -d"'" -f4) | |
4 | +password=$(grep "/\*d\*/'password'" ../../config/app.php | cut -d"'" -f4) | |
5 | +database=$(grep "/\*d\*/'database'" ../../config/app.php | cut -d"'" -f4) | |
6 | +host=$(grep "/\*d\*/'host'" ../../config/app.php | cut -d"'" -f4) | |
6 | 7 | |
7 | -mysql --user=$username --password=$password -h $database < ./db-update-xxxx-xx-xx.sql | |
8 | +cp -p ./script_sql/db-update-xxxx-xx-xx.sql ./script_sql/db-update-xxxx-xx-xx-build.sql | |
8 | 9 | |
9 | -rm ../../tmp/cache/models/* | |
10 | -rm ../../tmp/cache/persistent/* | |
10 | +sed -e "s/database/$database/" -i ./script_sql/db-update-xxxx-xx-xx-build.sql | |
11 | +mysql --user=$username --password=$password -h $host < ./script_sql/db-update-xxxx-xx-xx-build.sql | |
12 | + | |
13 | +sudo rm ../../tmp/cache/models/* | |
14 | +sudo rm ../../tmp/cache/persistent/* | |
15 | + | |
16 | +sudo chmod -R 777 ../../tmp | |
17 | +sudo chmod -R 777 ../../vendor | |
18 | +sudo chmod -R 777 ../../webroot | ... | ... |
database/update/db-update-2015-07-27.sql renamed to database/update/script_sql/db-update-2015-07-27.sql
database/update/db-update-2015-08-15.sql renamed to database/update/script_sql/db-update-2015-08-15.sql
database/update/db-update-2016-04-25.sql renamed to database/update/script_sql/db-update-2016-04-25.sql
database/update/db-update-2016-05-09.sql renamed to database/update/script_sql/db-update-2016-05-09.sql
100644 → 100755
database/update/db-update-2016-05-12.sql renamed to database/update/script_sql/db-update-2016-05-12.sql
database/update/db-update-2016-06-01.sql renamed to database/update/script_sql/db-update-2016-06-01.sql
100644 → 100755
database/update/db-update-2016-06-03.sql renamed to database/update/script_sql/db-update-2016-06-03.sql
100644 → 100755
database/update/db-update-2016-06-06.sql renamed to database/update/script_sql/db-update-2016-06-06.sql
100644 → 100755
database/update/db-update-2016-06-07.sql renamed to database/update/script_sql/db-update-2016-06-07.sql
database/update/db-update-2016-06-08.sql renamed to database/update/script_sql/db-update-2016-06-08.sql
100644 → 100755
database/update/db-update-2016-06-13.sql renamed to database/update/script_sql/db-update-2016-06-13.sql
100644 → 100755
database/update/db-update-2016-06-15.sql renamed to database/update/script_sql/db-update-2016-06-15.sql
100644 → 100755
... | ... | @@ -0,0 +1,9 @@ |
1 | +use database; | |
2 | + | |
3 | +set foreign_key_checks=0; | |
4 | + | |
5 | +ALTER TABLE `suivis` ADD `groupes_metier_id` int(11) DEFAULT NULL; | |
6 | +ALTER TABLE `suivis` ADD `groupes_thematique_id` int(11) DEFAULT NULL; | |
7 | + | |
8 | +ALTER TABLE `suivis` ADD CONSTRAINT `fk_suivis_groupe_thematique` FOREIGN KEY (`groupes_thematique_id`) REFERENCES `groupes_thematiques` (`id`) ON DELETE NO ACTION ON UPDATE NO ACTION; | |
9 | +ALTER TABLE `suivis` ADD CONSTRAINT `fk_suivis_groupe_metier` FOREIGN KEY (`groupes_metier_id`) REFERENCES `groupes_metiers` (`id`) ON DELETE NO ACTION ON UPDATE NO ACTION; | ... | ... |
database/update/update_Donnees_IRAP_Labinvent2.sql renamed to database/update/script_sql/update_Donnees_IRAP_Labinvent2.sql
100644 → 100755
database/update/update_Donnees_IAS_Labinvent2.sql
... | ... | @@ -266,5 +266,11 @@ update materiels set date_archivage = NULL where date_archivage = '1970-01-01'; |
266 | 266 | update materiels set date_reception = NULL where date_reception = '1970-01-01'; |
267 | 267 | |
268 | 268 | |
269 | +ALTER TABLE `suivis` ADD `groupes_metier_id` int(11) DEFAULT NULL; | |
270 | +ALTER TABLE `suivis` ADD `groupes_thematique_id` int(11) DEFAULT NULL; | |
271 | + | |
272 | +ALTER TABLE `suivis` ADD CONSTRAINT `fk_suivis_groupe_thematique` FOREIGN KEY (`groupes_thematique_id`) REFERENCES `groupes_thematiques` (`id`) ON DELETE NO ACTION ON UPDATE NO ACTION; | |
273 | +ALTER TABLE `suivis` ADD CONSTRAINT `fk_suivis_groupe_metier` FOREIGN KEY (`groupes_metier_id`) REFERENCES `groupes_metiers` (`id`) ON DELETE NO ACTION ON UPDATE NO ACTION; | |
274 | + | |
269 | 275 | |
270 | 276 | COMMIT; | ... | ... |
install/update-app-php.sh
... | ... | @@ -6,18 +6,22 @@ cp ../config/app.default.php ../config/app.php |
6 | 6 | username=$(grep "/\*d\*/'username'" ../config/app.php.ORIG | cut -d"'" -f4) |
7 | 7 | password=$(grep "/\*d\*/'password'" ../config/app.php.ORIG | cut -d"'" -f4) |
8 | 8 | database=$(grep "/\*d\*/'database'" ../config/app.php.ORIG | cut -d"'" -f4) |
9 | +host=$(grep "/\*d\*/'host'" ../config/app.php.ORIG | cut -d"'" -f4) | |
9 | 10 | |
10 | 11 | usernameTEST=$(grep "/\*t\*/'username'" ../config/app.php.ORIG | cut -d"'" -f4) |
11 | 12 | passwordTEST=$(grep "/\*t\*/'password'" ../config/app.php.ORIG | cut -d"'" -f4) |
12 | 13 | databaseTEST=$(grep "/\*t\*/'database'" ../config/app.php.ORIG | cut -d"'" -f4) |
14 | +hostTEST=$(grep "/\*t\*/'host'" ../config/app.php.ORIG | cut -d"'" -f4) | |
13 | 15 | |
14 | 16 | sed -e "s/'database' => 'database'/'database' => '$database'/" -i ../config/app.php |
15 | 17 | sed -e "s/'username' => 'username'/'username' => '$username'/" -i ../config/app.php |
16 | 18 | sed -e "s/'password' => 'password'/'password' => '$password'/" -i ../config/app.php |
19 | +sed -e "s/'host' => 'localhost'/'host' => '$host'/" -i ../config/app.php | |
17 | 20 | |
18 | 21 | sed -e "s/'database' => 'test_database'/'database' => '$databaseTEST'/" -i ../config/app.php |
19 | 22 | sed -e "s/'username' => 'test_username'/'username' => '$usernameTEST'/" -i ../config/app.php |
20 | 23 | sed -e "s/'password' => 'test_password'/'password' => '$passwordTEST'/" -i ../config/app.php |
24 | +sed -e "s/'host' => 'localhost'/'host' => '$hostTEST'/" -i ../config/app.php | |
21 | 25 | |
22 | 26 | sed -e "s/'debug' => filter_var(env('DEBUG', true/'debug' => filter_var(env('DEBUG', false/" -i ../config/app.php |
23 | 27 | ... | ... |
src/Controller/AppController.php
... | ... | @@ -205,13 +205,13 @@ class AppController extends Controller |
205 | 205 | |
206 | 206 | if($configuration->envoi_mail_management_dev) { |
207 | 207 | $email->transport('dev') |
208 | - ->from(["labinvent2@localhost.com" => "Labinvent2"]) | |
208 | + ->from(["labinvent2@inventirap.irap.omp.eu" => "Labinvent2"]) | |
209 | 209 | ->to($to) |
210 | 210 | ->subject("[LabInvent] ".$subject) |
211 | 211 | ->send($message); |
212 | 212 | } else { |
213 | 213 | $email->transport('default') |
214 | - ->from(["labinvent2@localhost.com" => "Labinvent2"]) | |
214 | + ->from(["labinvent2@inventirap.irap.omp.eu" => "Labinvent2"]) | |
215 | 215 | ->to($to) |
216 | 216 | ->subject("[LabInvent] ".$subject) |
217 | 217 | ->send($message); |
... | ... | @@ -299,27 +299,30 @@ class AppController extends Controller |
299 | 299 | $configuration = TableRegistry::get('Configurations')->find()->where(['id =' => 1])->first(); |
300 | 300 | $materiel = TableRegistry::get('Materiels')->find()->where(['id =' => $id])->first(); |
301 | 301 | |
302 | + $createurName = $this->LdapAuth->user('givenname')[0].' '.$this->LdapAuth->user('sn')[0]; | |
303 | + $createurEmail = $this->LdapAuth->user('mail')[0]; | |
304 | + $toEmail = $materiel->email_responsable; | |
302 | 305 | |
303 | - $userEmail = $materiel->email_responsable; | |
304 | - $createurName = $materiel->nom_createur; | |
305 | 306 | $role = TableRegistry::get('Users')->find()->where(['username' => $this->LdapAuth->user($configuration->authentificationType_ldap)[0]])->first()['role']; |
306 | 307 | if($role == null) $role = 'Utilisateur'; |
307 | 308 | |
308 | 309 | $subject = 'Ajout d\'un matériel'; |
309 | - $message = $createurName.' (role = '.$role.') a ajouté le matériel "'.$materiel->designation.'" et vous a nommé propriétaire de ce matériel.'; | |
310 | + $message = $createurName.' (email = '.$createurEmail.', role = '.$role.') a ajouté le matériel "'.$materiel->designation.'" et vous a nommé propriétaire de ce matériel.'; | |
310 | 311 | |
311 | - if ($userEmail != null && !$configuration->test) { | |
312 | - if (filter_var($userEmail, FILTER_VALIDATE_EMAIL)) { | |
312 | + if ($toEmail != null && !$configuration->test) { | |
313 | + if (filter_var($toEmail, FILTER_VALIDATE_EMAIL)) { | |
313 | 314 | $email = new Email(); |
314 | 315 | |
315 | 316 | if($configuration->envoi_mail_management_dev) { |
316 | 317 | $email->transport('dev') |
317 | - ->to($userEmail) | |
318 | + ->from(["labinvent2@inventirap.irap.omp.eu" => "Labinvent2"]) | |
319 | + ->to($toEmail) | |
318 | 320 | ->subject("[LabInvent] ".$subject) |
319 | 321 | ->send($message); |
320 | 322 | } else { |
321 | 323 | $email->transport('default') |
322 | - ->to($userEmail) | |
324 | + ->from(["labinvent2@inventirap.irap.omp.eu" => "Labinvent2"]) | |
325 | + ->to($toEmail) | |
323 | 326 | ->subject("[LabInvent] ".$subject) |
324 | 327 | ->send($message); |
325 | 328 | } | ... | ... |
src/Controller/DocumentsController.php
... | ... | @@ -180,8 +180,7 @@ class DocumentsController extends AppController |
180 | 180 | $userName = $this->LdapAuth->user('username'); |
181 | 181 | $numeroLab = $materiel->numero_laboratoire; |
182 | 182 | $dateAcquisition = $materiel->date_acquisition; |
183 | - // convert to French format dd-mm-yyyy : | |
184 | - $dateAcquisition = date ( "d-m-Y", strtotime ( $dateAcquisition ) ); | |
183 | + $dateAcquisition = $dateAcquisition; | |
185 | 184 | $numeroCommande = $materiel->numero_commande; |
186 | 185 | $designation = $materiel->designation; |
187 | 186 | if(isset($materiel->organisme_id) && !empty($materiel->organisme_id)) { | ... | ... |
src/Controller/GroupesMetiersController.php
... | ... | @@ -72,6 +72,8 @@ class GroupesMetiersController extends AppController |
72 | 72 | $utilisateurs = TableRegistry::get('Users')->find('all')->where(['groupes_metier_id =' => $id]); |
73 | 73 | $this->set('utilisateurs', $utilisateurs); |
74 | 74 | |
75 | + $suivis = TableRegistry::get('Suivis')->find('all')->where(['groupes_metier_id =' => $id]); | |
76 | + $this->set('suivis', $suivis); | |
75 | 77 | |
76 | 78 | |
77 | 79 | $this->set('groupesMetier', $groupesMetier); | ... | ... |
src/Controller/GroupesThematiquesController.php
... | ... | @@ -73,6 +73,9 @@ class GroupesThematiquesController extends AppController |
73 | 73 | $utilisateurs = TableRegistry::get('Users')->find('all')->where(['groupe_thematique_id =' => $id]); |
74 | 74 | $this->set('utilisateurs', $utilisateurs); |
75 | 75 | |
76 | + $suivis = TableRegistry::get('Suivis')->find('all')->where(['groupes_thematique_id =' => $id]); | |
77 | + $this->set('suivis', $suivis); | |
78 | + | |
76 | 79 | $this->set('groupesThematique', $groupesThematique); |
77 | 80 | $this->set('_serialize', ['groupesThematique']); |
78 | 81 | } | ... | ... |
src/Controller/MaterielsController.php
... | ... | @@ -414,7 +414,9 @@ class MaterielsController extends AppController |
414 | 414 | $s_groupes_metiers = $this->Materiels->GroupesMetiers->find('list', [ 'keyField' => 'id', 'valueField' => 'nom', 'order' => 'GroupesMetiers.nom']); |
415 | 415 | $s_organismes = $this->Materiels->Organismes->find('list', [ 'keyField' => 'id', 'valueField' => 'nom', 'order' => 'Organismes.nom']); |
416 | 416 | |
417 | - $this->set(compact('s_sur_categories', 's_categories', 's_sous_categories', 's_groupes_thematiques', 's_groupes_metiers', 's_organismes')); | |
417 | + $categories = $this->Materiels->Categories; | |
418 | + | |
419 | + $this->set(compact('s_sur_categories', 's_categories', 's_sous_categories', 's_groupes_thematiques', 's_groupes_metiers', 's_organismes', 'categories')); | |
418 | 420 | |
419 | 421 | $resultTri = $this->request->session()->read("resultTri"); |
420 | 422 | |
... | ... | @@ -498,11 +500,14 @@ class MaterielsController extends AppController |
498 | 500 | } |
499 | 501 | |
500 | 502 | $periode_acquisitionRequest = NULL; |
503 | + $date_acquisition = NULL; | |
501 | 504 | if ($this->request->data['s_periode_acquisition1'] != '') |
502 | - $periode_acquisitionRequest['Materiels.date_acquisition >='] = $this->request->data['s_periode_acquisition1']; | |
503 | - if ($this->request->data['s_periode_acquisition2'] != '') | |
504 | - $periode_acquisitionRequest['Materiels.date_acquisition <='] = $this->request->data['s_periode_acquisition2']; | |
505 | - | |
505 | + $periode_acquisitionRequest['Materiels.date_acquisition >='] = date('Y-m-d', strtotime(str_replace('/', '-', $this->request->data['s_periode_acquisition1']))); | |
506 | + if ($this->request->data['s_periode_acquisition2'] != '') | |
507 | + $periode_acquisitionRequest['Materiels.date_acquisition <='] = date('Y-m-d', strtotime(str_replace('/', '-', $this->request->data['s_periode_acquisition2']))); | |
508 | + if ($this->request->data['s_date_acquisition'] != '') | |
509 | + $date_acquisition['Materiels.date_acquisition LIKE'] = '%'.date('Y-m-d', strtotime(str_replace('/', '-', $this->request->data['s_date_acquisition']))).'%'; | |
510 | + | |
506 | 511 | $montantRequest = []; |
507 | 512 | if ($this->request->data['s_prix_ht_inf'] != '') |
508 | 513 | $montantRequest['Materiels.prix_ht <='] = $this->request->data['s_prix_ht_inf']; |
... | ... | @@ -513,7 +518,7 @@ class MaterielsController extends AppController |
513 | 518 | 'Materiels.designation LIKE' => '%'.$this->request->data['s_designation'].'%', |
514 | 519 | 'Materiels.numero_laboratoire LIKE' => '%'.$this->request->data['s_numero_laboratoire'].'%', |
515 | 520 | $this->getConditionForField('numero_commande'), |
516 | - 'Materiels.date_acquisition LIKE' => '%'.$this->request->data['s_date_acquisition'].'%', | |
521 | + $date_acquisition, | |
517 | 522 | $periode_acquisitionRequest, |
518 | 523 | $this->getConditionForFieldNumber('prix_ht'), |
519 | 524 | $montantRequest, |
... | ... | @@ -922,7 +927,6 @@ class MaterielsController extends AppController |
922 | 927 | |
923 | 928 | $numeroInventaireOrganisme = $materiel->numero_inventaire_organisme; |
924 | 929 | $dateAcquisition = $materiel->date_acquisition; |
925 | - $dateAcquisition = date("d-m-Y", strtotime($dateAcquisition)); | |
926 | 930 | |
927 | 931 | $filename = 'inventirap_label.label'; |
928 | 932 | $file = fopen('php://output', 'w'); | ... | ... |
src/Controller/SuivisController.php
... | ... | @@ -72,7 +72,7 @@ class SuivisController extends AppController |
72 | 72 | public function view($id = null) |
73 | 73 | { |
74 | 74 | $suivi = $this->Suivis->get($id, [ |
75 | - 'contain' => ['Materiels', 'Documents', 'TypeSuivis'] | |
75 | + 'contain' => ['Materiels', 'Documents', 'TypeSuivis', 'GroupesThematiques', 'GroupesMetiers'] | |
76 | 76 | ]); |
77 | 77 | |
78 | 78 | $this->set('suivi', $suivi); |
... | ... | @@ -100,11 +100,14 @@ class SuivisController extends AppController |
100 | 100 | } |
101 | 101 | $materiels = $this->Suivis->Materiels->find('list'); |
102 | 102 | |
103 | - $numMateriel = $this->Suivis->Materiels->find()->select('numero_laboratoire')->where(['id =' => $this->passedArgs[0]])->first()['numero_laboratoire']; | |
103 | + $materiel = $this->Suivis->Materiels->find()->where(['id =' => $this->passedArgs[0]])->first(); | |
104 | 104 | |
105 | 105 | $typeSuivis = $this->Suivis->TypeSuivis->find('list', [ 'keyField' => 'id', 'valueField' => 'nom']); |
106 | 106 | |
107 | - $this->set(compact('suivi', 'materiels', 'typeSuivis', 'numMateriel')); | |
107 | + $groupesThematiques = $this->Suivis->GroupesThematiques->find('list', [ 'keyField' => 'id', 'valueField' => 'nom', 'order' => 'GroupesThematiques.nom']); | |
108 | + $groupesMetiers = $this->Suivis->GroupesMetiers->find('list', [ 'keyField' => 'id', 'valueField' => 'nom', 'order' => 'GroupesMetiers.nom']); | |
109 | + | |
110 | + $this->set(compact('suivi', 'materiels', 'typeSuivis', 'materiel', 'groupesThematiques', 'groupesMetiers')); | |
108 | 111 | $this->set('_serialize', ['suivi']); |
109 | 112 | } |
110 | 113 | |
... | ... | @@ -135,7 +138,10 @@ class SuivisController extends AppController |
135 | 138 | |
136 | 139 | $typeSuivis = $this->Suivis->TypeSuivis->find('list', [ 'keyField' => 'id', 'valueField' => 'nom']); |
137 | 140 | |
138 | - $this->set(compact('suivi', 'materiels', 'typeSuivis', 'numMateriel')); | |
141 | + $groupesThematiques = $this->Suivis->GroupesThematiques->find('list', [ 'keyField' => 'id', 'valueField' => 'nom', 'order' => 'GroupesThematiques.nom']); | |
142 | + $groupesMetiers = $this->Suivis->GroupesMetiers->find('list', [ 'keyField' => 'id', 'valueField' => 'nom', 'order' => 'GroupesMetiers.nom']); | |
143 | + | |
144 | + $this->set(compact('suivi', 'materiels', 'typeSuivis', 'numMateriel', 'groupesThematiques', 'groupesMetiers')); | |
139 | 145 | $this->set('_serialize', ['suivi']); |
140 | 146 | } |
141 | 147 | |
... | ... | @@ -157,4 +163,91 @@ class SuivisController extends AppController |
157 | 163 | } |
158 | 164 | return $this->redirect(['action' => 'index']); |
159 | 165 | } |
166 | + | |
167 | + /** | |
168 | + * GetConditionForField method | |
169 | + * | |
170 | + * @param unknown $fieldName | |
171 | + * @return string[]|NULL | |
172 | + */ | |
173 | + private function getConditionForField($fieldName) { | |
174 | + $searchFieldName = 's_' . $fieldName; | |
175 | + if ( isset($this->request->data[$searchFieldName]) && ($this->request->data[$searchFieldName] != '')) return ["Suivis.$fieldName LIKE" => '%'.$this->request->data[$searchFieldName].'%']; | |
176 | + return NULL; | |
177 | + } | |
178 | + | |
179 | + | |
180 | + /** | |
181 | + * GetConditionForFieldNumber method | |
182 | + * | |
183 | + * @param unknown $fieldName | |
184 | + * @return $string[]|NULL | |
185 | + */ | |
186 | + private function getConditionForFieldNumber($fieldName) { | |
187 | + $searchFieldName = 's_' . $fieldName; | |
188 | + if ( isset($this->request->data[$searchFieldName]) && ($this->request->data[$searchFieldName] != '')) return ["Suivis.$fieldName =" => $this->request->data[$searchFieldName]]; | |
189 | + return NULL; | |
190 | + } | |
191 | + | |
192 | + | |
193 | + /** | |
194 | + * Find method | |
195 | + */ | |
196 | + public function find() { | |
197 | + | |
198 | + $s_groupes_thematiques = $this->Suivis->GroupesThematiques->find('list', [ 'keyField' => 'id', 'valueField' => 'nom', 'order' => 'GroupesThematiques.nom']); | |
199 | + $s_groupes_metiers = $this->Suivis->GroupesMetiers->find('list', [ 'keyField' => 'id', 'valueField' => 'nom', 'order' => 'GroupesMetiers.nom']); | |
200 | + $s_type_suivis = $this->Suivis->TypeSuivis; | |
201 | + $materiels = $this->Suivis->Materiels; | |
202 | + | |
203 | + $this->set(compact('s_groupes_thematiques', 's_groupes_metiers', 's_type_suivis', 'materiels')); | |
204 | + | |
205 | + $resultTri = $this->request->session()->read("resultTri"); | |
206 | + | |
207 | + if ($this->request->is('post')) { | |
208 | + $specificFieldsConditions = NULL; | |
209 | + | |
210 | + $periode_interventionRequest = NULL; | |
211 | + $date_intervention = NULL; | |
212 | + if ($this->request->data['s_periode_controle1'] != '') $periode_interventionRequest['Suivis.date_controle >='] = date('Y-m-d', strtotime(str_replace('/', '-', $this->request->data['s_periode_controle1']))); | |
213 | + if ($this->request->data['s_periode_controle2'] != '') $periode_interventionRequest['Suivis.date_controle <='] = date('Y-m-d', strtotime(str_replace('/', '-', $this->request->data['s_periode_controle2']))); | |
214 | + if ($this->request->data['s_date_controle'] != '') $date_intervention['Suivis.date_controle ='] = date('Y-m-d', strtotime(str_replace('/', '-', $this->request->data['s_date_controle']))); | |
215 | + | |
216 | + $specificFieldsConditions = [ | |
217 | + $date_intervention, | |
218 | + $periode_interventionRequest, | |
219 | + $this->getConditionForFieldNumber('type_suivi_id'), | |
220 | + $this->getConditionForField('organisme'), | |
221 | + $this->getConditionForFieldNumber('groupes_metier_id'), | |
222 | + $this->getConditionForFieldNumber('groupes_thematique_id'), | |
223 | + ]; | |
224 | + | |
225 | + // CONSTRUCTION DE LA REQUETE SQL COMPLETE = $specificFieldsConditions | |
226 | + // by default, no sort | |
227 | + $lastResults = $this->Suivis->find('all', ['conditions' => $specificFieldsConditions]); | |
228 | + | |
229 | + $this->paginate = ['limit' => 1000]; | |
230 | + $_results = $this->paginate($lastResults); | |
231 | + $this->set(compact('_results')); | |
232 | + | |
233 | + } // end if() | |
234 | + else if (isset($resultTri) && strstr($this->request->here(), 'sort') != false && strstr($this->request->here(), 'direction') != false) { | |
235 | + $findedSuivis = []; | |
236 | + | |
237 | + foreach($resultTri as $r) { | |
238 | + array_push($findedSuivis, $r->id); | |
239 | + } | |
240 | + $res = $this->Suivis->find('all', ['limit' => 1000]); | |
241 | + for($i = 0; $i < sizeof($findedSuivis); $i++) { | |
242 | + $res->orWhere(['id =' => $findedSuivis[$i]]); | |
243 | + } | |
244 | + | |
245 | + $this->paginate = ['limit' => 1000]; | |
246 | + $_results = $this->paginate($res); | |
247 | + $this->set(compact('_results')); | |
248 | + | |
249 | + } | |
250 | + } | |
251 | + | |
252 | + | |
160 | 253 | } | ... | ... |
src/Model/Entity/GroupesMetier.php
... | ... | @@ -10,6 +10,7 @@ use Cake\ORM\Entity; |
10 | 10 | * @property string $nom |
11 | 11 | * @property string $description |
12 | 12 | * @property \App\Model\Entity\Materiel[] $materiels |
13 | + * @property \App\Model\Entity\Suivi[] $suivis | |
13 | 14 | * @property \App\Model\Entity\User[] $users |
14 | 15 | */ |
15 | 16 | class GroupesMetier extends Entity | ... | ... |
src/Model/Entity/GroupesThematique.php
... | ... | @@ -10,6 +10,7 @@ use Cake\ORM\Entity; |
10 | 10 | * @property string $nom |
11 | 11 | * @property string $description |
12 | 12 | * @property \App\Model\Entity\Materiel[] $materiels |
13 | + * @property \App\Model\Entity\Suivi[] $suivis | |
13 | 14 | * @property \App\Model\Entity\User[] $users |
14 | 15 | */ |
15 | 16 | class GroupesThematique extends Entity | ... | ... |
src/Model/Entity/Suivi.php
... | ... | @@ -15,6 +15,10 @@ use Cake\ORM\Entity; |
15 | 15 | * @property int $frequence |
16 | 16 | * @property string $type_frequence |
17 | 17 | * @property int $type_suivi_id |
18 | + * @property int $groupes_thematique_id | |
19 | + * @property \App\Model\Entity\GroupesThematique $groupes_thematique | |
20 | + * @property int $groupes_metier_id | |
21 | + * @property \App\Model\Entity\GroupesMetier $groupes_metier | |
18 | 22 | * @property string $commentaire |
19 | 23 | * @property string $nom_createur |
20 | 24 | * @property string $nom_modificateur | ... | ... |
src/Model/Table/GroupesMetiersTable.php
... | ... | @@ -33,6 +33,11 @@ class GroupesMetiersTable extends AppTable |
33 | 33 | $this->hasMany('Materiels', [ |
34 | 34 | 'foreignKey' => 'groupes_metier_id' |
35 | 35 | ]); |
36 | + | |
37 | + $this->hasMany('Suivis', [ | |
38 | + 'foreignKey' => 'groupes_metier_id' | |
39 | + ]); | |
40 | + | |
36 | 41 | $this->hasMany('Users', [ |
37 | 42 | 'foreignKey' => 'groupes_metier_id' |
38 | 43 | ]); | ... | ... |
src/Model/Table/GroupesThematiquesTable.php
... | ... | @@ -33,6 +33,9 @@ class GroupesThematiquesTable extends AppTable |
33 | 33 | $this->hasMany('Materiels', [ |
34 | 34 | 'foreignKey' => 'groupes_thematique_id' |
35 | 35 | ]); |
36 | + $this->hasMany('Suivis', [ | |
37 | + 'foreignKey' => 'groupes_thematique_id' | |
38 | + ]); | |
36 | 39 | $this->hasMany('Users', [ |
37 | 40 | 'foreignKey' => 'groupe_thematique_id' |
38 | 41 | ]); | ... | ... |
src/Model/Table/SuivisTable.php
... | ... | @@ -12,6 +12,8 @@ use Cake\Validation\Validator; |
12 | 12 | * |
13 | 13 | * @property \Cake\ORM\Association\BelongsTo $Materiels |
14 | 14 | * @property \Cake\ORM\Association\BelongsTo $TypeSuivis |
15 | + * @property \Cake\ORM\Association\BelongsTo $GroupesThematiques | |
16 | + * @property \Cake\ORM\Association\BelongsTo $GroupesMetiers | |
15 | 17 | * @property \Cake\ORM\Association\HasMany $Documents |
16 | 18 | */ |
17 | 19 | class SuivisTable extends AppTable |
... | ... | @@ -42,6 +44,14 @@ class SuivisTable extends AppTable |
42 | 44 | 'foreignKey' => 'type_suivi_id' |
43 | 45 | ]); |
44 | 46 | |
47 | + $this->belongsTo('GroupesMetiers', [ | |
48 | + 'foreignKey' => 'groupes_metier_id' | |
49 | + ]); | |
50 | + | |
51 | + $this->belongsTo('GroupesThematiques', [ | |
52 | + 'foreignKey' => 'groupes_thematique_id' | |
53 | + ]); | |
54 | + | |
45 | 55 | $this->hasMany('Documents', [ |
46 | 56 | 'foreignKey' => 'suivi_id' |
47 | 57 | ]); |
... | ... | @@ -127,6 +137,8 @@ class SuivisTable extends AppTable |
127 | 137 | |
128 | 138 | $rules->add($rules->existsIn(['materiel_id'], 'Materiels')); |
129 | 139 | $rules->add($rules->existsIn(['type_suivi_id'], 'TypeSuivis')); |
140 | + $rules->add($rules->existsIn(['groupes_thematique_id'], 'GroupesThematiques')); | |
141 | + $rules->add($rules->existsIn(['groupes_metier_id'], 'GroupesMetiers')); | |
130 | 142 | return $rules; |
131 | 143 | } |
132 | 144 | ... | ... |
src/Template/Configurations/edit.ctp
... | ... | @@ -28,11 +28,11 @@ |
28 | 28 | echo $this->Form->input('emailGuest3', ['label' => 'Mail guest 3']); |
29 | 29 | echo $this->Form->input('emailGuest4', ['label' => 'Mail guest 4']); |
30 | 30 | echo $this->Form->input('emailGuest5', ['label' => 'Mail guest 5']); |
31 | - echo $this->Form->input('emailGuest1', ['label' => 'Mail guest 6']); | |
32 | - echo $this->Form->input('emailGuest2', ['label' => 'Mail guest 7']); | |
33 | - echo $this->Form->input('emailGuest3', ['label' => 'Mail guest 8']); | |
34 | - echo $this->Form->input('emailGuest4', ['label' => 'Mail guest 9']); | |
35 | - echo $this->Form->input('emailGuest5', ['label' => 'Mail guest 10']); | |
31 | + echo $this->Form->input('emailGuest6', ['label' => 'Mail guest 6']); | |
32 | + echo $this->Form->input('emailGuest7', ['label' => 'Mail guest 7']); | |
33 | + echo $this->Form->input('emailGuest8', ['label' => 'Mail guest 8']); | |
34 | + echo $this->Form->input('emailGuest9', ['label' => 'Mail guest 9']); | |
35 | + echo $this->Form->input('emailGuest10', ['label' => 'Mail guest 10']); | |
36 | 36 | |
37 | 37 | echo $this->Form->input('use_ldap', ['label' => 'Utilisation du LDAP', 'onchange' => 'display_ldap();']); |
38 | 38 | echo '<div id="ldap" style="border-top: 1px solid #CCC; border-bottom: 1px solid #CCC; margin-bottom: 0; background: #EEE; '.$disp.'">'; | ... | ... |
src/Template/Element/menu.ctp
... | ... | @@ -7,13 +7,17 @@ |
7 | 7 | |
8 | 8 | <?php if(isset($username) && $username != " "): ?> |
9 | 9 | |
10 | + <li><?= $this->Html->link('<i class="icon-plus"></i> Nouveau matériel', | |
11 | + ['controller' => 'Materiels', 'action' => 'add'], | |
12 | + ['escape' => false]);?></li> | |
13 | + | |
10 | 14 | <li><?= $this->Html->link(__('<i class="icon-search"></i> Rechercher un matériel'), |
11 | 15 | ['controller' => 'materiels', 'action' => 'find'], |
12 | 16 | ['escape' => false]); ?></li> |
13 | 17 | |
14 | - <li><?= $this->Html->link('<i class="icon-plus"></i> Nouveau matériel', | |
15 | - ['controller' => 'Materiels', 'action' => 'add'], | |
16 | - ['escape' => false]);?></li> | |
18 | + <li><?= $this->Html->link(__('<i class="icon-search"></i> Rechercher un suivi'), | |
19 | + ['controller' => 'suivis', 'action' => 'find'], | |
20 | + ['escape' => false]); ?></li> | |
17 | 21 | |
18 | 22 | <li><?= $this->Html->link(__('<i class="icon-list"></i> Liste des matériels'), |
19 | 23 | ['controller' => 'Materiels', 'action' => 'index'], | ... | ... |
src/Template/GroupesMetiers/view.ctp
... | ... | @@ -38,7 +38,7 @@ |
38 | 38 | <?php if (!empty($utilisateurs)) { ?> |
39 | 39 | <table> |
40 | 40 | <tr> |
41 | - <th><?= __('Désignation') ?></th> | |
41 | + <th><?= __('Nom') ?></th> | |
42 | 42 | <th style="width:50px;"><?= __('Détail') ?></th> |
43 | 43 | </tr> |
44 | 44 | <?php foreach ($utilisateurs as $utilisateur): ?> |
... | ... | @@ -56,6 +56,34 @@ |
56 | 56 | </div> |
57 | 57 | |
58 | 58 | |
59 | + <h3 id="t_suivis" style="cursor: pointer;"> | |
60 | + <i class="icon-chevron-down" style="font-size: 14px;" id="i_suivis"></i> | |
61 | + <span style="text-decoration: underline;">Suivis associées (<?= $suivis->count()?>)</span> | |
62 | + </h3> | |
63 | + <div id="suivis" style="margin-bottom: 20px;"> | |
64 | + | |
65 | + <?php if (!empty($suivis)) { ?> | |
66 | + <table> | |
67 | + <tr> | |
68 | + <th><?= __('N° suivi') ?></th> | |
69 | + <th style="width:50px;"><?= __('Détail') ?></th> | |
70 | + </tr> | |
71 | + <?php foreach ($suivis as $suivi): ?> | |
72 | + <tr> | |
73 | + | |
74 | + <td><?= $this->Html->link('Suivi '.h($suivi->id), ['controller' => 'Suivis', 'action' => 'view', h($suivi->id)]); ?></td> | |
75 | + | |
76 | + <td class="actions"> | |
77 | + <?= $this->Html->link(__('<i class="icon-search"></i>'), ['controller' => 'Suivis', 'action' => 'view', $suivi->id], ['escape' => false, 'style' => 'margin:0']) ?> | |
78 | + </td> | |
79 | + </tr> | |
80 | + <?php endforeach; ?> | |
81 | + </table> | |
82 | + <?php }else { echo 'Aucun suivi lié à ce '.$configuration->nom_groupe_metier; } ?> | |
83 | + </div> | |
84 | + | |
85 | + | |
86 | + | |
59 | 87 | <h3 id="t_suivis" style="cursor: pointer;"> |
60 | 88 | <i class="icon-chevron-down" style="font-size: 14px;" id="i_suivis"></i> |
61 | 89 | <span style="text-decoration: underline;">Materiels associées (<?= $materiels->count()?>)</span> | ... | ... |
src/Template/GroupesThematiques/view.ctp
... | ... | @@ -38,7 +38,7 @@ |
38 | 38 | <?php if (!empty($utilisateurs)) { ?> |
39 | 39 | <table> |
40 | 40 | <tr> |
41 | - <th><?= __('Désignation') ?></th> | |
41 | + <th><?= __('Nom') ?></th> | |
42 | 42 | <th style="width:50px;"><?= __('Détail') ?></th> |
43 | 43 | </tr> |
44 | 44 | <?php foreach ($utilisateurs as $utilisateur): ?> |
... | ... | @@ -56,7 +56,34 @@ |
56 | 56 | </div> |
57 | 57 | |
58 | 58 | |
59 | - <h3 id="t_suivis" style="cursor: pointer;"> | |
59 | + <h3 id="t_suivis" style="cursor: pointer;"> | |
60 | + <i class="icon-chevron-down" style="font-size: 14px;" id="i_suivis"></i> | |
61 | + <span style="text-decoration: underline;">Suivis associées (<?= $suivis->count()?>)</span> | |
62 | + </h3> | |
63 | + <div id="suivis" style="margin-bottom: 20px;"> | |
64 | + | |
65 | + <?php if (!empty($suivis)) { ?> | |
66 | + <table> | |
67 | + <tr> | |
68 | + <th><?= __('N° suivi') ?></th> | |
69 | + <th style="width:50px;"><?= __('Détail') ?></th> | |
70 | + </tr> | |
71 | + <?php foreach ($suivis as $suivi): ?> | |
72 | + <tr> | |
73 | + | |
74 | + <td><?= $this->Html->link('Suivi '.h($suivi->id), ['controller' => 'Suivis', 'action' => 'view', h($suivi->id)]); ?></td> | |
75 | + | |
76 | + <td class="actions"> | |
77 | + <?= $this->Html->link(__('<i class="icon-search"></i>'), ['controller' => 'Suivis', 'action' => 'view', $suivi->id], ['escape' => false, 'style' => 'margin:0']) ?> | |
78 | + </td> | |
79 | + </tr> | |
80 | + <?php endforeach; ?> | |
81 | + </table> | |
82 | + <?php }else { echo 'Aucun suivi lié à ce '.$configuration->nom_groupe_thematique; } ?> | |
83 | + </div> | |
84 | + | |
85 | + | |
86 | + <h3 id="t_suivis" style="cursor: pointer;"> | |
60 | 87 | <i class="icon-chevron-down" style="font-size: 14px;" id="i_suivis"></i> |
61 | 88 | <span style="text-decoration: underline;">Materiels associées (<?= $materiels->count()?>)</span> |
62 | 89 | </h3> | ... | ... |
src/Template/Layout/default.ctp
... | ... | @@ -94,7 +94,7 @@ $cakeDescription = 'Labinvent 2.0'; |
94 | 94 | </i></td> |
95 | 95 | <td id="version"> |
96 | 96 | <!-- VERSION M.m.f.b (version (M)ajeure, version (m)ineure, numero de nouvelle (f)onctionnalite, numero de (b)ugfix) --> |
97 | - <font color="black">VERSION 2.4.5.0 (20/06/2016)</font> | |
97 | + <font color="black">VERSION 2.4.6.0 (20/06/2016)</font> | |
98 | 98 | </td> |
99 | 99 | </tr> |
100 | 100 | </table> | ... | ... |
src/Template/Materiels/find.ctp
... | ... | @@ -236,11 +236,13 @@ if ($r) { |
236 | 236 | echo '<td class="smallText">'; |
237 | 237 | echo $material->numero_laboratoire; |
238 | 238 | echo '</td>'; |
239 | + | |
240 | + $cat = $categories->find()->where(['id =' => $material->categorie_id])->first(); | |
239 | 241 | echo '<td class="smallText">'; |
240 | - echo $this->Html->link ( $material->nom, [ | |
242 | + echo $this->Html->link ( $cat['nom'], [ | |
241 | 243 | 'controller' => 'categories', |
242 | 244 | 'action' => 'view', |
243 | - $material->id | |
245 | + $cat['id'] | |
244 | 246 | ]); |
245 | 247 | echo '</td>'; |
246 | 248 | echo '<td class="smallText">'; |
... | ... | @@ -250,7 +252,7 @@ if ($r) { |
250 | 252 | echo $material->status; |
251 | 253 | echo '</td>'; |
252 | 254 | echo '<td class="smallText">'; |
253 | - echo date ( "d-m-Y", strtotime ( $material->date_acquisition )); | |
255 | + echo $material->date_acquisition; | |
254 | 256 | echo '</td>'; |
255 | 257 | |
256 | 258 | /* | ... | ... |
src/Template/Materiels/view.ctp
... | ... | @@ -259,7 +259,7 @@ |
259 | 259 | <?php if (!empty($materiel->suivis)) { ?> |
260 | 260 | <table> |
261 | 261 | <tr> |
262 | - <th><?= __('Organisme') ?></th> | |
262 | + <th><?= __('Prestataire') ?></th> | |
263 | 263 | <th><?= __('Date du contrôle') ?></th> |
264 | 264 | <th><?= __('Date prochain contrôle') ?></th> |
265 | 265 | <th><?= __('Type d\'intervention') ?></th> | ... | ... |
src/Template/Suivis/add.ctp
... | ... | @@ -8,7 +8,7 @@ |
8 | 8 | |
9 | 9 | echo $this->Form->input ('materiel_numero_laboratoire', [ |
10 | 10 | 'label' => 'N° materiel labo', |
11 | - 'default' => $numMateriel, | |
11 | + 'default' => $materiel['numero_laboratoire'], | |
12 | 12 | 'disabled' => TRUE |
13 | 13 | ]); |
14 | 14 | |
... | ... | @@ -49,6 +49,10 @@ |
49 | 49 | 'class' => 'datepicker' |
50 | 50 | ]); |
51 | 51 | echo $this->Form->input('organisme', ['label' => 'Prestataire']); |
52 | + | |
53 | + echo $this->Form->input('groupes_thematique_id', ['label' => $configuration->nom_groupe_thematique, 'options' => $groupesThematiques, 'default' => $materiel['groupes_thematique_id']]); | |
54 | + echo $this->Form->input('groupes_metier_id', ['label' => $configuration->nom_groupe_metier, 'options' => $groupesMetiers, 'default' => $materiel['groupes_metier_id']]); | |
55 | + | |
52 | 56 | echo $this->Form->input('commentaire', ['type' => 'textarea']); |
53 | 57 | |
54 | 58 | echo $this->Form->hidden('nom_createur', ['value' => $username ]); | ... | ... |
src/Template/Suivis/edit.ctp
... | ... | @@ -55,6 +55,10 @@ |
55 | 55 | 'class' => 'datepicker' |
56 | 56 | ]); |
57 | 57 | echo $this->Form->input('organisme', ['label' => 'Prestataire']); |
58 | + | |
59 | + echo $this->Form->input('groupes_thematique_id', ['label' => $configuration->nom_groupe_thematique, 'options' => $groupesThematiques, 'default' => 1]); | |
60 | + echo $this->Form->input('groupes_metier_id', ['label' => $configuration->nom_groupe_metier, 'options' => $groupesMetiers, 'default' => 1]); | |
61 | + | |
58 | 62 | echo $this->Form->input('commentaire', ['type' => 'textarea']); |
59 | 63 | |
60 | 64 | echo $this->Form->hidden('nom_modificateur', ['value' => $username ]); | ... | ... |
... | ... | @@ -0,0 +1,157 @@ |
1 | + | |
2 | +<div class="index"> | |
3 | + <h2> | |
4 | + <i class="icon-search"></i> Recherche de suivi | |
5 | + </h2> | |
6 | +<?php | |
7 | +$r = isset ($_results); | |
8 | +?> | |
9 | + | |
10 | + <h3 id="t_filter" style="cursor: pointer;"> | |
11 | + <i | |
12 | + class=<?php if ($r) echo '"icon-chevron-up"'; echo '"icon-chevron-down"'; ?> | |
13 | + style="font-size: 14px;" id="i_filter"></i> <span | |
14 | + style="text-decoration: underline;">Filtres</span> | |
15 | + </h3> | |
16 | + | |
17 | + <div id="filter" <?php if ($r) echo 'style="display: none;"'; ?>><?php | |
18 | + if (isset ( $_results )) | |
19 | + $selected = []; | |
20 | + else | |
21 | + $selected = [ | |
22 | + 'selected' => '' | |
23 | + ]; | |
24 | + | |
25 | + | |
26 | + // FORMULAIRE DE RECHERCHE | |
27 | + echo $this->Form->create(); | |
28 | + | |
29 | + // Type suivi | |
30 | + echo $this->Form->input ( 's_type_suivi_id', [ | |
31 | + 'label' => 'Type de suivi', | |
32 | + 'empty' => 'Tous', | |
33 | + $selected, | |
34 | + 'options' => $s_type_suivis->find('list', [ 'keyField' => 'id', 'valueField' => 'nom', 'order' => 'TypeSuivis.nom']), | |
35 | + 'style' => 'width: 200px' | |
36 | + ]); | |
37 | + | |
38 | + | |
39 | + // Groupe metier et thematique | |
40 | + echo $this->Form->input ( 's_groupes_metier_id', [ | |
41 | + 'label' => $configuration->nom_groupe_metier, | |
42 | + 'empty' => 'Tous', | |
43 | + $selected, | |
44 | + 'options' => $s_groupes_metiers, | |
45 | + 'style' => 'width: 200px' | |
46 | + ]); | |
47 | + echo $this->Form->input ( 's_groupes_thematique_id', [ | |
48 | + 'label' => $configuration->nom_groupe_thematique, | |
49 | + 'empty' => 'Tous', | |
50 | + $selected, | |
51 | + 'options' => $s_groupes_thematiques, | |
52 | + 'style' => 'width: 200px' | |
53 | + ]); | |
54 | + | |
55 | + | |
56 | + echo $this->Form->input ( 's_organisme', [ | |
57 | + 'label' => 'Nom du prestataire' | |
58 | + ]); | |
59 | + | |
60 | + // Date intervention | |
61 | + echo "<u>DATE d'intervention:</u>"; | |
62 | + echo $this->Form->input ( 's_date_controle', [ | |
63 | + 'placeholder' => 'Cliquez pour selectionner une date', | |
64 | + 'label' => '- Date exacte', | |
65 | + 'class' => 'datepicker' | |
66 | + ]); | |
67 | + echo $this->Form->input ( 's_periode_controle1', [ | |
68 | + 'placeholder' => 'Cliquez pour selectionner une date', | |
69 | + 'label' => '- Date Début', | |
70 | + 'class' => 'datepicker' | |
71 | + ]); | |
72 | + echo $this->Form->input ( 's_periode_controle2', [ | |
73 | + 'placeholder' => 'Cliquez pour selectionner une date', | |
74 | + 'label' => '- Date Fin', | |
75 | + 'class' => 'datepicker' | |
76 | + ]); | |
77 | + | |
78 | + | |
79 | + // -------Bouton recherche Bas--------- | |
80 | + echo $this->Form->submit('Rechercher', ['style' => 'width: 20%']); | |
81 | + echo '<br/><br/><br/>'; | |
82 | + ?> | |
83 | + </div> | |
84 | + <!-- RESULT DISPLAY --> | |
85 | + <h3 id="t_result" style="cursor: pointer;"> | |
86 | + <i | |
87 | + class=<?php if ($r) echo '"icon-chevron-down"'; echo '"icon-chevron-up"'; ?> | |
88 | + style="font-size: 14px;" id="i_result"></i> <span | |
89 | + style="text-decoration: underline;">Résultats <?php if ($r) echo '('.sizeof($_results).')'; ?></span> | |
90 | + </h3> | |
91 | + <div id="result" <?php if (!$r) echo 'style="display: none;"'; ?>> | |
92 | + <?php if (isset($_results) && sizeof($_results) != 0) { | |
93 | + | |
94 | + $this->request->session()->write("resultTri", $_results); | |
95 | + | |
96 | + ?> | |
97 | + <table cellpadding="0" cellspacing="0"> | |
98 | + <thead> | |
99 | + <tr> | |
100 | + <th><?= $this->Paginator->sort('id', 'N°') ?></th> | |
101 | + <th><?= $this->Paginator->sort('materiel', 'Matériel') ?></th> | |
102 | + <th><?= $this->Paginator->sort('materiel', 'N° interne (labo)') ?></th> | |
103 | + <th><?= $this->Paginator->sort('date_controle', 'Date intervention') ?></th> | |
104 | + <th><?= $this->Paginator->sort('date_prochain_controle', 'Date prochaine intervention') ?></th> | |
105 | + <th><?= $this->Paginator->sort('type_suivi_id', "Type d'intervention") ?></th> | |
106 | + <th style="width: 20px;"></th> | |
107 | + <th style="width: 20px;"></th> | |
108 | + <th style="width: 20px;"></th> | |
109 | + </tr> | |
110 | + </thead> | |
111 | + <tbody> | |
112 | + <!-- Affichage des lignes de données --> | |
113 | + <?php | |
114 | + foreach ( $_results as $suivi ) : | |
115 | + echo '<tr>'; | |
116 | + | |
117 | + $mat = $materiels->find()->where(['id =' => $suivi->materiel_id])->first(); | |
118 | + ?> | |
119 | + | |
120 | + <td class="smallText"><?php echo $this->Html->link('Suivi '.$this->Number->format($suivi->id), ['action' => 'view', $suivi->id])?></td> | |
121 | + <td class="smallText"><?= $this->Html->link($mat['designation'], ['controller' => 'Materiels', 'action' => 'view', $mat['id']])?></td> | |
122 | + <td class="smallText"><?= $mat['numero_laboratoire'] ?></td> | |
123 | + <td class="smallText"><?= h($suivi->date_controle) ?></td> | |
124 | + <td class="smallText"><?= h($suivi->date_prochain_controle) ?></td> | |
125 | + <td class="smallText"><?= $s_type_suivis->find()->where(['id =' => h($suivi->type_suivi_id)])->first()['nom'] ?></td> | |
126 | + | |
127 | + <?php | |
128 | + echo '<td class="actions" style="padding: 6px 0;">'; | |
129 | + $this->Html->link(__('<i class="icon-eye-open"></i>'), ['action' => 'view', $suivi->id], ['title' => 'Visualiser', 'style' => 'margin: 0 2px', 'escape' => false ]); | |
130 | + if(($role == 'Utilisateur' && in_array($username, [$suivi->nom_createur])) || (in_array($role, ['Responsable', 'Administration', 'Administration Plus', 'Super Administrateur']))) { | |
131 | + $this->Html->link(__('<i class="icon-pencil"></i>'), ['action' => 'edit', $suivi->id], ['title' => 'Editer', 'style' => 'margin: 0 2px', 'escape' => false ]); | |
132 | + $this->Form->postLink(__('<i class="icon-trash"></i>'), ['action' => 'delete', $suivi->id], ['title' => 'Supprimer', 'style' => 'margin: 0 2px', 'escape' => false, 'confirm' => __('Êtes-vous sur de vouloir supprimer # {0}?', $suivi->id)]); | |
133 | + } | |
134 | + echo '</td>'; | |
135 | + | |
136 | + echo '<tr>'; | |
137 | + endforeach; | |
138 | + echo '</tbody>'; | |
139 | + echo '</table>'; | |
140 | + | |
141 | + } else { | |
142 | + echo 'Aucun résultats pour cette recherche.'; | |
143 | + } | |
144 | + ?> | |
145 | + </div> | |
146 | + | |
147 | + | |
148 | + <?php | |
149 | + echo $this->Form->end(); | |
150 | + ?> | |
151 | +</div> | |
152 | + | |
153 | + | |
154 | +<div class="actions"> | |
155 | + <?php echo $this->element('menu') ?> | |
156 | +</div> | |
157 | + | ... | ... |
src/Template/Suivis/view.ctp
... | ... | @@ -44,8 +44,12 @@ |
44 | 44 | $displayElement(__('Panne résolue'), $resolu); |
45 | 45 | } |
46 | 46 | |
47 | - $displayElement(__('Fournisseur'), h($suivi->organisme)); | |
47 | + $displayElement(__('Prestataire'), h($suivi->organisme)); | |
48 | 48 | $displayElement(__('Fréquence'), h($suivi->frequence).' '.h($suivi->type_frequence)); |
49 | + | |
50 | + $displayElement(__($configuration->nom_groupe_thematique), $suivi->has('groupes_thematique') ? $this->Html->link($suivi->groupes_thematique->nom, ['controller' => 'GroupesThematiques', 'action' => 'view', $suivi->groupes_thematique->id]) : ''); | |
51 | + $displayElement(__($configuration->nom_groupe_metier), $suivi->has('groupes_metier') ? $this->Html->link($suivi->groupes_metier->nom, ['controller' => 'GroupesMetiers', 'action' => 'view', $suivi->groupes_metier->id]) : ''); | |
52 | + | |
49 | 53 | $displayElement(__('Commentaire'), h($suivi->commentaire)); |
50 | 54 | $displayElement(__('Date création'), h($suivi->created)); |
51 | 55 | $displayElement(__('Nom du créateur'), h($suivi->nom_createur)); | ... | ... |
tests/Fixture/SuivisFixture.php
... | ... | @@ -22,6 +22,8 @@ class SuivisFixture extends TestFixture |
22 | 22 | 'date_controle' => ['type' => 'date', 'length' => null, 'null' => true, 'default' => null, 'comment' => '', 'precision' => null], |
23 | 23 | 'date_prochain_controle' => ['type' => 'date', 'length' => null, 'null' => true, 'default' => null, 'comment' => '', 'precision' => null], |
24 | 24 | 'type_suivi_id' => ['type' => 'integer', 'length' => 11, 'unsigned' => false, 'null' => false, 'default' => null, 'comment' => '', 'precision' => null, 'autoIncrement' => null], |
25 | + 'groupes_metier_id' => ['type' => 'integer', 'length' => 11, 'unsigned' => false, 'null' => false, 'default' => null, 'comment' => '', 'precision' => null, 'autoIncrement' => null], | |
26 | + 'groupes_thematique_id' => ['type' => 'integer', 'length' => 11, 'unsigned' => false, 'null' => false, 'default' => null, 'comment' => '', 'precision' => null, 'autoIncrement' => null], | |
25 | 27 | 'organisme' => ['type' => 'string', 'length' => 50, 'null' => true, 'default' => null, 'comment' => '', 'precision' => null, 'fixed' => null], |
26 | 28 | 'frequence' => ['type' => 'integer', 'length' => 11, 'unsigned' => false, 'null' => true, 'default' => null, 'comment' => '', 'precision' => null, 'autoIncrement' => null], |
27 | 29 | 'type_frequence' => ['type' => 'string', 'length' =>30, 'null' => true, 'default' => null, 'comment' => '', 'precision' => null, 'fixed' => null], |
... | ... | @@ -38,6 +40,8 @@ class SuivisFixture extends TestFixture |
38 | 40 | 'primary' => ['type' => 'primary', 'columns' => ['id'], 'length' => []], |
39 | 41 | 'fk_admi_material_histories_admi_materials1' => ['type' => 'foreign', 'columns' => ['materiel_id'], 'references' => ['materiels', 'id'], 'update' => 'noAction', 'delete' => 'noAction', 'length' => []], |
40 | 42 | 'fk_suivis_type_suivi_id' => ['type' => 'foreign', 'columns' => ['type_suivi_id'], 'references' => ['type_suivis', 'id'], 'update' => 'noAction', 'delete' => 'noAction', 'length' => []], |
43 | + 'fk_suivis_groupe_metier' => ['type' => 'foreign', 'columns' => ['groupes_metier_id'], 'references' => ['groupes_metiers', 'id'], 'update' => 'noAction', 'delete' => 'noAction', 'length' => []], | |
44 | + 'fk_suivis_groupe_thematique' => ['type' => 'foreign', 'columns' => ['groupes_thematique_id'], 'references' => ['groupes_thematiques', 'id'], 'update' => 'noAction', 'delete' => 'noAction', 'length' => []], | |
41 | 45 | ], |
42 | 46 | '_options' => [ |
43 | 47 | 'engine' => 'InnoDB', |
... | ... | @@ -58,6 +62,8 @@ class SuivisFixture extends TestFixture |
58 | 62 | 'date_controle' => '2016-04-19', |
59 | 63 | 'date_prochain_controle' => '2016-04-19', |
60 | 64 | 'type_suivi_id' => 1, |
65 | + 'groupes_metier_id' => 1, | |
66 | + 'groupes_thematique_id' => 1, | |
61 | 67 | 'organisme' => 'Lorem ipsum dolor sit amet', |
62 | 68 | 'frequence' => 1, |
63 | 69 | 'type_frequence' => '/ Jours', |
... | ... | @@ -73,6 +79,8 @@ class SuivisFixture extends TestFixture |
73 | 79 | 'date_controle' => '2016-04-19', |
74 | 80 | 'date_prochain_controle' => '2016-04-19', |
75 | 81 | 'type_suivi_id' => 1, |
82 | + 'groupes_metier_id' => 1, | |
83 | + 'groupes_thematique_id' => 1, | |
76 | 84 | 'organisme' => 'Lorem ipsum dolor sit amet', |
77 | 85 | 'frequence' => 1, |
78 | 86 | 'type_frequence' => '/ Jours', | ... | ... |
tests/TestCase/Controller/MaterielsControllerTest.php
... | ... | @@ -448,6 +448,8 @@ class MaterielsControllerTest extends IntegrationTestCase |
448 | 448 | 'date_controle' => '2016-04-19', |
449 | 449 | 'date_prochain_controle' => '2016-04-19', |
450 | 450 | 'type_suivi_id' => 1, |
451 | + 'groupes_metier_id' => 1, | |
452 | + 'groupes_thematique_id' => 1, | |
451 | 453 | 'organisme' => 'Lorem ipsum dolor sit amet', |
452 | 454 | 'frequence' => 1, |
453 | 455 | 'type_frequence' => '/ Jours', |
... | ... | @@ -463,6 +465,8 @@ class MaterielsControllerTest extends IntegrationTestCase |
463 | 465 | 'date_controle' => '2016-04-19', |
464 | 466 | 'date_prochain_controle' => '2016-04-19', |
465 | 467 | 'type_suivi_id' => 1, |
468 | + 'groupes_metier_id' => 1, | |
469 | + 'groupes_thematique_id' => 1, | |
466 | 470 | 'organisme' => 'Lorem ipsum dolor sit amet', |
467 | 471 | 'frequence' => 1, |
468 | 472 | 'type_frequence' => '/ Jours', | ... | ... |
tests/TestCase/Controller/SuivisControllerTest.php
... | ... | @@ -96,6 +96,8 @@ class SuivisControllerTest extends IntegrationTestCase |
96 | 96 | 'date_controle' => '2016-04-19', |
97 | 97 | 'date_prochain_controle' => '2016-04-19', |
98 | 98 | 'type_suivi_id' => 1, |
99 | + 'groupes_metier_id' => 1, | |
100 | + 'groupes_thematique_id' => 1, | |
99 | 101 | 'organisme' => 'Lorem ipsum dolor sit amet', |
100 | 102 | 'frequence' => 1, |
101 | 103 | 'type_frequence' => '/ Jours', |
... | ... | @@ -126,6 +128,8 @@ class SuivisControllerTest extends IntegrationTestCase |
126 | 128 | 'date_controle' => '2016-04-19', |
127 | 129 | 'date_prochain_controle' => '2016-04-19', |
128 | 130 | 'type_suivi_id' => 1, |
131 | + 'groupes_metier_id' => 1, | |
132 | + 'groupes_thematique_id' => 1, | |
129 | 133 | 'organisme' => 'Lorem ipsum dolor sit amet', |
130 | 134 | 'frequence' => 1, |
131 | 135 | 'type_frequence' => '/ Jours', | ... | ... |