diff --git a/README-LABINVENT.md b/README-LABINVENT.md index 9334559..46bcd5c 100755 --- a/README-LABINVENT.md +++ b/README-LABINVENT.md @@ -50,10 +50,23 @@ Logiciel testé et validé sur les configurations suivantes : VERSION ACTUELLE -Date: 16/06/2016 -Version: 2.4.4.3 +Date: 17/06/2016 +Version: 2.4.4.4 -Demande (en terminé) : bugfixes users (mail et login auto) +!!! +Exécuter les lignes suivantes (à la racine) : +cp -p config/app.php ../config/app.php.ORIG +cp config/app.default.php ../config/app.php + +Puis completez app.php (datasources => default & test (username, password, database)) avec app.php.ORIG +!!! + +Qrcode (url) + modele script update bd & cache + script copie app.php + +Demande (terminé) : https://projects.irap.omp.eu/issues/3841 + +Demande (en cours) : https://projects.irap.omp.eu/issues/3843 + Version majeure en cours (2.4): https://projects.irap.omp.eu/versions/107 @@ -89,7 +102,11 @@ Liste complète des évolutions: https://gitlab.irap.omp.eu/epallier/labinvent/c MODIFICATIONS STRUCTURELLES A FAIRE MANUELLEMENT APRES LA MISE A JOUR (git pull) -Note: après chaque mise à jour de la BD, il faut repasser l'application en mode debug = true (au début du fichier config/app.php) pour mettre à jour le cache (puis repasser ensuite en mode debug = false) +17/06/16 (v2.4.4.4) (Exceptionnel) Exécuter les lignes suivantes (à la racine) : + cp -p config/app.php ../config/app.php.ORIG + cp config/app.default.php ../config/app.php + Puis completez app.php (datasources => default & test (username, password, database)) avec app.php.ORIG + 15/06/16 (v2.4.4.0) Adapter la BD en exécutant le script sql database/update/db-update-2016-06-15.sql diff --git a/config/app.default.php b/config/app.default.php index a2d25d3..d912968 100755 --- a/config/app.default.php +++ b/config/app.default.php @@ -240,9 +240,9 @@ return [ * the following line and set the port accordingly */ //'port' => 'non_standard_port_number', - 'username' => 'username', - 'password' => 'password', - 'database' => 'database', + /*d*/'username' => 'username', + /*d*/'password' => 'password', + /*d*/'database' => 'database', 'encoding' => 'utf8', 'timezone' => 'UTC', 'flags' => [], @@ -280,9 +280,9 @@ return [ 'persistent' => false, 'host' => 'localhost', //'port' => 'non_standard_port_number', - 'username' => 'test_username', - 'password' => 'test_password', - 'database' => 'test_database', + /*t*/'username' => 'test_username', + /*t*/'password' => 'test_password', + /*t*/'database' => 'test_database', 'encoding' => 'utf8', 'timezone' => 'UTC', 'cacheMetadata' => true, diff --git a/database/update/db-update-modele.sh b/database/update/db-update-modele.sh new file mode 100755 index 0000000..f9f1118 --- /dev/null +++ b/database/update/db-update-modele.sh @@ -0,0 +1,10 @@ +#!/bin/bash + +username=$(grep "/\*d\*/'username'" ../../config/app.php.ORIG | cut -d"'" -f4) +password=$(grep "/\*d\*/'password'" ../../config/app.php.ORIG | cut -d"'" -f4) +database=$(grep "/\*d\*/'database'" ../../config/app.php.ORIG | cut -d"'" -f4) + +mysql --user=$username --password=$password -h $database < ./db-update-xxxx-xx-xx.sql + +rm ../../tmp/cache/models/* +rm ../../tmp/cache/persistent/* diff --git a/install/update-app-php.sh b/install/update-app-php.sh new file mode 100755 index 0000000..38a5fd2 --- /dev/null +++ b/install/update-app-php.sh @@ -0,0 +1,23 @@ +#!/bin/bash + +cp -p ../config/app.php ../config/app.php.ORIG +cp ../config/app.default.php ../config/app.php + +username=$(grep "/\*d\*/'username'" ../config/app.php.ORIG | cut -d"'" -f4) +password=$(grep "/\*d\*/'password'" ../config/app.php.ORIG | cut -d"'" -f4) +database=$(grep "/\*d\*/'database'" ../config/app.php.ORIG | cut -d"'" -f4) + +usernameTEST=$(grep "/\*t\*/'username'" ../config/app.php.ORIG | cut -d"'" -f4) +passwordTEST=$(grep "/\*t\*/'password'" ../config/app.php.ORIG | cut -d"'" -f4) +databaseTEST=$(grep "/\*t\*/'database'" ../config/app.php.ORIG | cut -d"'" -f4) + +sed -e "s/'database' => 'database'/'database' => '$database'/" -i ../config/app.php +sed -e "s/'username' => 'username'/'username' => '$username'/" -i ../config/app.php +sed -e "s/'password' => 'password'/'password' => '$password'/" -i ../config/app.php + +sed -e "s/'database' => 'test_database'/'database' => '$databaseTEST'/" -i ../config/app.php +sed -e "s/'username' => 'test_username'/'username' => '$usernameTEST'/" -i ../config/app.php +sed -e "s/'password' => 'test_password'/'password' => '$passwordTEST'/" -i ../config/app.php + +sed -e "s/'debug' => filter_var(env('DEBUG', true/'debug' => filter_var(env('DEBUG', false/" -i ../config/app.php + diff --git a/src/Controller/MaterielsController.php b/src/Controller/MaterielsController.php index 6be5b75..fd11775 100755 --- a/src/Controller/MaterielsController.php +++ b/src/Controller/MaterielsController.php @@ -219,7 +219,13 @@ class MaterielsController extends AppController $organismes = $this->Materiels->Organismes->find('list', [ 'keyField' => 'id', 'valueField' => 'nom', 'order' => 'Organismes.nom']); $sites = $this->Materiels->Sites->find('list', [ 'keyField' => 'id', 'valueField' => 'nom', 'order' => 'Sites.nom']); - $utilisateurs = TableRegistry::get('LdapConnections')->getListUsers(); + $users = TableRegistry::get('LdapConnections')->getListUsers(); + //tri des utilisateurs par nom + sort($users); + $utilisateurs = []; + for($i = 0; $i < sizeof($users); $i++) { + $utilisateurs[$users[$i]] = $users[$i]; + } $mail_responsable = TableRegistry::get('Users')->find()->select('email')->where(['username =' => $this->LdapAuth->user($this->request->session()->read('authType'))[0]])->first()['email']; @@ -263,7 +269,13 @@ class MaterielsController extends AppController $organismes = $this->Materiels->Organismes->find('list', [ 'keyField' => 'id', 'valueField' => 'nom', 'order' => 'Organismes.nom']); $sites = $this->Materiels->Sites->find('list', [ 'keyField' => 'id', 'valueField' => 'nom', 'order' => 'Sites.nom']); - $utilisateurs = TableRegistry::get('LdapConnections')->getListUsers(); + $users = TableRegistry::get('LdapConnections')->getListUsers(); + //tri des utilisateurs par nom + sort($users); + $utilisateurs = []; + for($i = 0; $i < sizeof($users); $i++) { + $utilisateurs[$users[$i]] = $users[$i]; + } if(!empty($materiel->get('nom_responsable'))){ if(!in_array($materiel->get('nom_responsable'), $utilisateurs)){ diff --git a/src/Controller/QrCodesController.php b/src/Controller/QrCodesController.php index 0ae9fc2..5bd1a26 100644 --- a/src/Controller/QrCodesController.php +++ b/src/Controller/QrCodesController.php @@ -7,16 +7,21 @@ use QRcode; class QrCodesController extends AppController { - public function creer($message) { + public function creer($message = null) { $fileName = $this->request->session()->id().'.png'; $cakephpPath = str_replace('webroot/index.php', '', $_SERVER['SCRIPT_FILENAME']); $qrCodePath = $cakephpPath . 'webroot/img/qrcodes/' . $fileName; - $this->request->session()->write('filename', $fileName); $this->request->session()->write('qrCodePath', $qrCodePath); - return QRcode::png($message, $qrCodePath); + + if($message == null) { + return QRcode::png($this->request->session()->read('qrUrl'), $qrCodePath); + } else { + return QRcode::png($message, $qrCodePath); + } + } } \ No newline at end of file diff --git a/src/Controller/UsersController.php b/src/Controller/UsersController.php index 88342d1..4794d7a 100755 --- a/src/Controller/UsersController.php +++ b/src/Controller/UsersController.php @@ -127,7 +127,13 @@ class UsersController extends AppController $groupesMetiers = $this->Users->GroupesMetiers->find('list', [ 'keyField' => 'id', 'valueField' => 'nom']); $groupesThematiques = $this->Users->GroupesThematiques->find('list', [ 'keyField' => 'id', 'valueField' => 'nom']); - $utilisateurs = TableRegistry::get('LdapConnections')->getListUsers(); + $users = TableRegistry::get('LdapConnections')->getListUsers(); + //tri des utilisateurs par nom + sort($users); + $utilisateurs = []; + for($i = 0; $i < sizeof($users); $i++) { + $utilisateurs[$users[$i]] = $users[$i]; + } $this->set(compact('user', 'groupesMetiers', 'utilisateurs', 'groupesThematiques')); $this->set('_serialize', ['user']); diff --git a/src/Model/Table/LdapConnectionsTable.php b/src/Model/Table/LdapConnectionsTable.php index 282a1df..019c8ae 100755 --- a/src/Model/Table/LdapConnectionsTable.php +++ b/src/Model/Table/LdapConnectionsTable.php @@ -188,15 +188,7 @@ class LdapConnectionsTable extends AppTable { } } - //tri des utilisateurs par nom - sort($utilisateurs); - - $users = []; - for($i = 0; $i < sizeof($utilisateurs); $i++) { - $users[$utilisateurs[$i]] = $utilisateurs[$i]; - } - - return $users; + return $utilisateurs; } /** diff --git a/src/Template/Documents/fiche_materiel.ctp b/src/Template/Documents/fiche_materiel.ctp index 4db6aaa..ca6038e 100644 --- a/src/Template/Documents/fiche_materiel.ctp +++ b/src/Template/Documents/fiche_materiel.ctp @@ -7,7 +7,7 @@ $this->layout = 'pdf_print'; // Nouvelle page de document $fpdf->AddPage(); -$this->requestAction('/QrCodes/creer/'.$materiel->numero_laboratoire); +$this->requestAction('/QrCodes/creer/'); $qrCode=$this->request->session()->read("qrCodePath"); $fpdf->Image($qrCode,180,10,-100); diff --git a/src/Template/Layout/default.ctp b/src/Template/Layout/default.ctp index cf4ea76..44f9001 100755 --- a/src/Template/Layout/default.ctp +++ b/src/Template/Layout/default.ctp @@ -94,7 +94,7 @@ $cakeDescription = 'Labinvent 2.0';