Commit 3ab8435bee8536ef1c0017dd9cb516bdc44afa25
1 parent
90643979
Exists in
master
and in
3 other branches
Version: 2.4.6.4
!!! Se placer dans ./database/update et exécuter le script database/update/db-update-2016-06-22.sh !!! calcul date suivi + ajout sender configurations Demande (terminé) : https://projects.irap.omp.eu/issues/3805 Version majeure en cours (2.4): https://projects.irap.omp.eu/versions/107 ROADMAP: https://projects.irap.omp.eu/projects/labinvent/roadmap
Showing
18 changed files
with
168 additions
and
43 deletions
Show diff stats
README-LABINVENT.md
... | ... | @@ -50,13 +50,14 @@ Logiciel testé et validé sur les configurations suivantes : |
50 | 50 | |
51 | 51 | VERSION ACTUELLE |
52 | 52 | |
53 | -Date: 21/06/2016 | |
54 | -Version: 2.4.6.3 | |
53 | +Date: 23/06/2016 | |
54 | +Version: 2.4.6.4 | |
55 | 55 | |
56 | -Materiels (date_archivage) + materiel (fonctionnent responsable si gmétier OU gthématique) | |
56 | +!!! Se placer dans ./database/update et exécuter le script database/update/db-update-2016-06-22.sh !!! | |
57 | 57 | |
58 | -Demande (terminé) : https://projects.irap.omp.eu/issues/3803 | |
59 | - https://projects.irap.omp.eu/issues/3808 | |
58 | +calcul date suivi + ajout sender configurations | |
59 | + | |
60 | +Demande (terminé) : https://projects.irap.omp.eu/issues/3805 | |
60 | 61 | |
61 | 62 | Version majeure en cours (2.4): https://projects.irap.omp.eu/versions/107 |
62 | 63 | |
... | ... | @@ -92,7 +93,9 @@ Liste complète des évolutions: https://gitlab.irap.omp.eu/epallier/labinvent/c |
92 | 93 | |
93 | 94 | MODIFICATIONS STRUCTURELLES A FAIRE MANUELLEMENT APRES LA MISE A JOUR (git pull) |
94 | 95 | |
95 | -20/06/16 (v2.4.6.0) Exécuter le script database/update/db-update-2016-06-20.sh | |
96 | +23/06/16 (v2.4.6.4) Se placer dans ./database/update et exécuter le script database/update/db-update-2016-06-22.sh | |
97 | + | |
98 | +20/06/16 (v2.4.6.0) Se placer dans ./database/update et exécuter le script database/update/db-update-2016-06-20.sh | |
96 | 99 | |
97 | 100 | 17/06/16 (v2.4.4.4) (Exceptionnel) Exécuter les lignes suivantes (à la racine) : |
98 | 101 | cp -p config/app.php ../config/app.php.ORIG |
... | ... |
config/app.default.php
... | ... | @@ -188,20 +188,20 @@ return [ |
188 | 188 | 'tls' => null, |
189 | 189 | 'url' => env('EMAIL_TRANSPORT_DEFAULT_URL', null), |
190 | 190 | ], |
191 | - 'dev' => [ | |
192 | - 'className' => 'Smtp', | |
193 | - 'host' => 'ssl://smtp.gmail.com', | |
194 | - 'port' => 465, | |
195 | - 'username' => 'labinvent2@gmail.com', | |
196 | - 'password' => 'cakephp3', | |
197 | - 'context' => [ | |
198 | - 'ssl' => [ | |
199 | - 'verify_peer' => false, | |
200 | - 'verify_peer_name' => false, | |
201 | - 'allow_self_signed' => true | |
202 | - ] | |
203 | - ] | |
204 | - ], | |
191 | + 'dev' => [ | |
192 | + 'className' => 'Smtp', | |
193 | + 'host' => 'ssl://smtp.gmail.com', | |
194 | + 'port' => 465, | |
195 | + 'username' => 'xxxxxxxxxxxxxxxxxxxxx', | |
196 | + 'password' => 'xxxxxxxxxxxxxxxxxxxxx', | |
197 | + 'context' => [ | |
198 | + 'ssl' => [ | |
199 | + 'verify_peer' => false, | |
200 | + 'verify_peer_name' => false, | |
201 | + 'allow_self_signed' => true | |
202 | + ] | |
203 | + ] | |
204 | + ], | |
205 | 205 | ], |
206 | 206 | |
207 | 207 | /** |
... | ... |
database/labinvent_2.1_12-05-16.sql
... | ... | @@ -335,7 +335,7 @@ CREATE TABLE IF NOT EXISTS `configurations` ( |
335 | 335 | `nom_groupe_thematique` varchar(50) DEFAULT 'Groupe thematique', |
336 | 336 | `nom_groupe_metier` varchar(50) DEFAULT 'Groupe metier', |
337 | 337 | `envoi_mail_management_dev` tinyint(1) DEFAULT NULL, |
338 | - `from_mail` varchar(200) DEFAULT 'localhost.com', | |
338 | + `sender_mail` varchar(500) DEFAULT 'labinvent@irap.omp.eu', | |
339 | 339 | `emailGuest1` varchar(45) DEFAULT NULL, |
340 | 340 | `emailGuest2` varchar(45) DEFAULT NULL, |
341 | 341 | `emailGuest3` varchar(45) DEFAULT NULL, |
... | ... |
... | ... | @@ -0,0 +1,18 @@ |
1 | +#!/bin/bash | |
2 | + | |
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) | |
7 | + | |
8 | +cp -p ./script_sql/db-update-2016-06-22.sql ./script_sql/db-update-2016-06-22-build.sql | |
9 | + | |
10 | +sed -e "s/database/$database/" -i ./script_sql/db-update-2016-06-22-build.sql | |
11 | +mysql --user=$username --password=$password -h $host < ./script_sql/db-update-2016-06-22-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/update_Donnees_IAS_Labinvent2.sql
... | ... | @@ -183,7 +183,7 @@ CREATE TABLE IF NOT EXISTS `configurations` ( |
183 | 183 | `nom_groupe_thematique` varchar(50) DEFAULT 'Groupe thematique', |
184 | 184 | `nom_groupe_metier` varchar(50) DEFAULT 'Groupe metier', |
185 | 185 | `envoi_mail_management_dev` tinyint(1) DEFAULT NULL, |
186 | - `from_mail` varchar(200) DEFAULT 'localhost.com', | |
186 | + `sender_mail` varchar(500) DEFAULT 'labinvent@irap.omp.eu', | |
187 | 187 | `emailGuest1` varchar(45) DEFAULT NULL, |
188 | 188 | `emailGuest2` varchar(45) DEFAULT NULL, |
189 | 189 | `emailGuest3` varchar(45) DEFAULT NULL, |
... | ... |
src/Controller/AppController.php
... | ... | @@ -80,7 +80,7 @@ class AppController extends Controller |
80 | 80 | if($role == 'Super Administrateur') return true; |
81 | 81 | |
82 | 82 | //Pour tout le monde |
83 | - if (in_array($action, ['index', 'find', 'view', 'creer', 'add'])) return true; | |
83 | + if (in_array($action, ['index', 'find', 'view', 'creer', 'add', 'getNextDate'])) return true; | |
84 | 84 | |
85 | 85 | |
86 | 86 | // Par défaut refuser |
... | ... | @@ -211,15 +211,17 @@ class AppController extends Controller |
211 | 211 | if (filter_var($to, FILTER_VALIDATE_EMAIL)) { |
212 | 212 | $email = new Email(); |
213 | 213 | |
214 | + $etiquetteFrom = explode("@", $configuration->sender_mail); | |
215 | + | |
214 | 216 | if($configuration->envoi_mail_management_dev) { |
215 | 217 | $email->transport('dev') |
216 | - ->from(["labinvent2@".$configuration->from_mail => "Labinvent2"]) | |
218 | + ->from([$configuration->sender_mail => $etiquetteFrom[0]]) | |
217 | 219 | ->to($to) |
218 | 220 | ->subject("[LabInvent] ".$subject) |
219 | 221 | ->send($message); |
220 | 222 | } else { |
221 | 223 | $email->transport('default') |
222 | - ->from(["labinvent2@".$configuration->from_mail => "Labinvent2"]) | |
224 | + ->from([$configuration->sender_mail => $etiquetteFrom[0]]) | |
223 | 225 | ->to($to) |
224 | 226 | ->subject("[LabInvent] ".$subject) |
225 | 227 | ->send($message); |
... | ... |
src/Controller/SuivisController.php
... | ... | @@ -256,5 +256,29 @@ class SuivisController extends AppController |
256 | 256 | } |
257 | 257 | } |
258 | 258 | |
259 | + // called from Javascript (Ajax) | |
260 | + public function getNextDate($date, $frequence, $typeFrequence) { | |
261 | + $date_next = date_create_from_format('d-m-Y', $date); | |
262 | + | |
263 | + switch($typeFrequence) { | |
264 | + case "Jours": | |
265 | + date_add($date_next, date_interval_create_from_date_string($frequence.' days')); | |
266 | + break; | |
267 | + case "Semaines": | |
268 | + date_add($date_next, date_interval_create_from_date_string((7*$frequence).' days')); | |
269 | + break; | |
270 | + case "Mois": | |
271 | + date_add($date_next, date_interval_create_from_date_string($frequence.' months')); | |
272 | + break; | |
273 | + case "Ans": | |
274 | + date_add($date_next, date_interval_create_from_date_string($frequence.' years')); | |
275 | + break; | |
276 | + } | |
277 | + | |
278 | + $this->set ('date', date_format($date_next, 'd-m-Y')); | |
279 | + | |
280 | + | |
281 | + $this->viewBuilder()->layout = 'ajax'; | |
282 | + } | |
259 | 283 | |
260 | 284 | } |
... | ... |
src/Model/Entity/Configuration.php
... | ... | @@ -24,7 +24,7 @@ use Cake\ORM\Entity; |
24 | 24 | * @property string $nom_groupe_thematique |
25 | 25 | * @property string $nom_groupe_metier |
26 | 26 | * @property bool $envoi_mail_management_dev |
27 | - * @property string $from_mail | |
27 | + * @property string $sender_mail | |
28 | 28 | * @property string $emailGuest1 |
29 | 29 | * @property string $emailGuest2 |
30 | 30 | * @property string $emailGuest3 |
... | ... |
src/Model/Table/AppTable.php
... | ... | @@ -23,7 +23,9 @@ class AppTable extends Table |
23 | 23 | return (bool) preg_match('/^['.$this->string.'?%!:,&*><\-\+\="\''.']*$/', $check); |
24 | 24 | } |
25 | 25 | |
26 | - | |
26 | + public function check_mail2($check) { | |
27 | + return (bool) filter_var($check, FILTER_VALIDATE_EMAIL); | |
28 | + } | |
27 | 29 | |
28 | 30 | |
29 | 31 | } |
... | ... |
src/Model/Table/ConfigurationsTable.php
... | ... | @@ -11,7 +11,7 @@ use Cake\Validation\Validator; |
11 | 11 | * Configurations Model |
12 | 12 | * |
13 | 13 | */ |
14 | -class ConfigurationsTable extends Table | |
14 | +class ConfigurationsTable extends AppTable | |
15 | 15 | { |
16 | 16 | |
17 | 17 | /** |
... | ... | @@ -99,12 +99,12 @@ class ConfigurationsTable extends Table |
99 | 99 | ->allowEmpty('envoi_mail_management_dev'); |
100 | 100 | |
101 | 101 | $validator |
102 | - ->notEmpty('from_mail'); | |
103 | - | |
104 | - | |
102 | + ->notEmpty('sender_mail') | |
103 | + ->add('sender_mail', 'valid', ['rule' => 'check_mail2', 'message' => 'Le champ doit être une adresse email.', 'provider' => 'table']); | |
104 | + | |
105 | 105 | $validator |
106 | 106 | ->allowEmpty('emailGuest1'); |
107 | - | |
107 | + | |
108 | 108 | $validator |
109 | 109 | ->allowEmpty('emailGuest2'); |
110 | 110 | |
... | ... |
src/Template/Configurations/edit.ctp
... | ... | @@ -23,7 +23,7 @@ |
23 | 23 | |
24 | 24 | |
25 | 25 | echo $this->Form->input('envoi_mail_management_dev', ['label' => 'Ne pas envoyer les mails de management en local']); |
26 | - echo $this->Form->input('from_mail', ['label' => 'Attribut "from" ']); | |
26 | + echo $this->Form->input('sender_mail', ['label' => 'Attribut "sender" (mail)']); | |
27 | 27 | echo $this->Form->input('emailGuest1', ['label' => 'Mail guest 1']); |
28 | 28 | echo $this->Form->input('emailGuest2', ['label' => 'Mail guest 2']); |
29 | 29 | echo $this->Form->input('emailGuest3', ['label' => 'Mail guest 3']); |
... | ... |
src/Template/Configurations/view.ctp
... | ... | @@ -54,7 +54,7 @@ |
54 | 54 | $displayElement(__('Seuil (prix) Matériel administratif'), h($configuration->prix_inventaire_administratif)); |
55 | 55 | |
56 | 56 | $displayElement(__('Envoi des mails de management en local'), $local); |
57 | - $displayElement(__('Attribut "from"'), h($configuration->from_mail)); | |
57 | + $displayElement(__('Attribut "sender" (mail)'), h($configuration->sender_mail)); | |
58 | 58 | $displayElement(__('Mail guest 1'), h($configuration->emailGuest1)); |
59 | 59 | $displayElement(__('Mail guest 2'), h($configuration->emailGuest2)); |
60 | 60 | $displayElement(__('Mail guest 3'), h($configuration->emailGuest3)); |
... | ... |
src/Template/Layout/default.ctp
... | ... | @@ -12,7 +12,7 @@ |
12 | 12 | * @since 0.10.0 |
13 | 13 | * @license http://www.opensource.org/licenses/mit-license.php MIT License |
14 | 14 | */ |
15 | -$cakeDescription = 'Labinvent 2.0'; | |
15 | +$cakeDescription = 'Labinvent 2'; | |
16 | 16 | ?> |
17 | 17 | <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> |
18 | 18 | <html xmlns="http://www.w3.org/1999/xhtml"> |
... | ... | @@ -80,7 +80,7 @@ $cakeDescription = 'Labinvent 2.0'; |
80 | 80 | <td id="bugreport"><i> |
81 | 81 | <p> |
82 | 82 | Merci de communiquer remarques et bugs à <a |
83 | - href="mailto:usvn-repo_inventirap@irap.omp.eu">LABINVENT-MAILING-LIST</a> | |
83 | + href="mailto:inventirap@irap.omp.eu">LABINVENT-MAILING-LIST</a> | |
84 | 84 | </p> |
85 | 85 | <?php |
86 | 86 | echo ' |
... | ... | @@ -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.6.3 (21/06/2016)</font> | |
97 | + <font color="black">VERSION 2.4.6.4 (22/06/2016)</font> | |
98 | 98 | </td> |
99 | 99 | </tr> |
100 | 100 | </table> |
... | ... |
src/Template/Suivis/add.ctp
... | ... | @@ -38,7 +38,8 @@ |
38 | 38 | echo $this->Form->input ('type_frequence', [ |
39 | 39 | 'label' => false, |
40 | 40 | 'templates' => ['inputContainer' => '<div class="typeFrequence">{{content}}</div>'], |
41 | - 'options' => ['/ Jours' => '/ Jours', '/ Semaines' => '/ Semaines', '/ Mois' => '/ Mois', '/ Ans' => '/ Ans'] | |
41 | + 'options' => ['/ Jours' => '/ Jours', '/ Semaines' => '/ Semaines', '/ Mois' => '/ Mois', '/ Ans' => '/ Ans'], | |
42 | + 'default' => '/ Mois' | |
42 | 43 | ]); |
43 | 44 | echo '</td></tr></table>'; |
44 | 45 | |
... | ... | @@ -67,4 +68,38 @@ |
67 | 68 | echo $this->element('menu'); |
68 | 69 | echo $this->element('menu_form', [ 'pluralHumanName' => 'Suivis' ]); |
69 | 70 | ?> |
70 | -</div> | |
71 | 71 | \ No newline at end of file |
72 | +</div> | |
73 | + | |
74 | +<script type="text/javascript"> | |
75 | + | |
76 | +/** | |
77 | + * Event calcul date prochain controle | |
78 | + */ | |
79 | + $(document).ready(function () { | |
80 | + $("#SuiviFrequence").bind("change", function (event) { | |
81 | + if($("#date-controle").val() != "" && $("#SuiviFrequence").val() != "") { | |
82 | + var url = document.URL; | |
83 | + var reg=new RegExp("(suivis).*$","g"); | |
84 | + var dateUrl = url.replace(reg, "Suivis/getNextDate/"); | |
85 | + $.ajax({ | |
86 | + url: dateUrl + $("#date-controle").val() + "/" + $("#SuiviFrequence").val() + "/" + $("#type-frequence").val().substring(2) | |
87 | + }).done(function(data) { | |
88 | + $("#date-prochain-controle").val(data) | |
89 | + }); | |
90 | + } | |
91 | + }); | |
92 | + $("#type-frequence").bind("change", function (event) { | |
93 | + if($("#date-controle").val() != "" && $("#SuiviFrequence").val() != "") { | |
94 | + var url = document.URL; | |
95 | + var reg=new RegExp("(suivis).*$","g"); | |
96 | + var dateUrl = url.replace(reg, "Suivis/getNextDate/"); | |
97 | + $.ajax({ | |
98 | + url: dateUrl + $("#date-controle").val() + "/" + $("#SuiviFrequence").val() + "/" + $("#type-frequence").val().substring(2) | |
99 | + }).done(function(data) { | |
100 | + $("#date-prochain-controle").val(data) | |
101 | + }); | |
102 | + } | |
103 | + }); | |
104 | + }); | |
105 | + | |
106 | +</script> | |
... | ... |
src/Template/Suivis/edit.ctp
... | ... | @@ -44,7 +44,8 @@ |
44 | 44 | echo $this->Form->input ('type_frequence', [ |
45 | 45 | 'label' => false, |
46 | 46 | 'templates' => ['inputContainer' => '<div class="typeFrequence">{{content}}</div>'], |
47 | - 'options' => ['/ Jours' => '/ Jours', '/ Semaines' => '/ Semaines', '/ Mois' => '/ Mois', '/ Ans' => '/ Ans'] | |
47 | + 'options' => ['/ Jours' => '/ Jours', '/ Semaines' => '/ Semaines', '/ Mois' => '/ Mois', '/ Ans' => '/ Ans'], | |
48 | + 'default' => '/ Mois' | |
48 | 49 | ]); |
49 | 50 | echo '</td></tr></table>'; |
50 | 51 | |
... | ... | @@ -73,4 +74,38 @@ |
73 | 74 | echo $this->element('menu'); |
74 | 75 | echo $this->element('menu_form', [ 'pluralHumanName' => 'Suivis' ]); |
75 | 76 | ?> |
76 | -</div> | |
77 | 77 | \ No newline at end of file |
78 | +</div> | |
79 | + | |
80 | +<script type="text/javascript"> | |
81 | + | |
82 | +/** | |
83 | + * Event calcul date prochain controle | |
84 | + */ | |
85 | + $(document).ready(function () { | |
86 | + $("#SuiviFrequence").bind("change", function (event) { | |
87 | + if($("#date-controle").val() != "" && $("#SuiviFrequence").val() != "") { | |
88 | + var url = document.URL; | |
89 | + var reg=new RegExp("(suivis).*$","g"); | |
90 | + var dateUrl = url.replace(reg, "Suivis/getNextDate/"); | |
91 | + $.ajax({ | |
92 | + url: dateUrl + $("#date-controle").val() + "/" + $("#SuiviFrequence").val() + "/" + $("#type-frequence").val().substring(2) | |
93 | + }).done(function(data) { | |
94 | + $("#date-prochain-controle").val(data) | |
95 | + }); | |
96 | + } | |
97 | + }); | |
98 | + $("#type-frequence").bind("change", function (event) { | |
99 | + if($("#date-controle").val() != "" && $("#SuiviFrequence").val() != "") { | |
100 | + var url = document.URL; | |
101 | + var reg=new RegExp("(suivis).*$","g"); | |
102 | + var dateUrl = url.replace(reg, "Suivis/getNextDate/"); | |
103 | + $.ajax({ | |
104 | + url: dateUrl + $("#date-controle").val() + "/" + $("#SuiviFrequence").val() + "/" + $("#type-frequence").val().substring(2) | |
105 | + }).done(function(data) { | |
106 | + $("#date-prochain-controle").val(data) | |
107 | + }); | |
108 | + } | |
109 | + }); | |
110 | + }); | |
111 | + | |
112 | +</script> | |
78 | 113 | \ No newline at end of file |
... | ... |
tests/Fixture/ConfigurationsFixture.php
... | ... | @@ -35,7 +35,7 @@ class ConfigurationsFixture extends TestFixture |
35 | 35 | 'nom_groupe_thematique' => ['type' => 'string', 'length' => 45, 'null' => true, 'default' => null, 'comment' => '', 'precision' => null, 'fixed' => null], |
36 | 36 | 'nom_groupe_metier' => ['type' => 'string', 'length' => 45, 'null' => true, 'default' => null, 'comment' => '', 'precision' => null, 'fixed' => null], |
37 | 37 | 'envoi_mail_management_dev' => ['type' => 'boolean', 'length' => null, 'null' => true, 'default' => null, 'comment' => '', 'precision' => null], |
38 | - 'from_mail' => ['type' => 'string', 'length' => 200, 'null' => true, 'default' => null, 'comment' => '', 'precision' => null, 'fixed' => null], | |
38 | + 'sender_mail' => ['type' => 'string', 'length' => 500, 'null' => true, 'default' => null, 'comment' => '', 'precision' => null, 'fixed' => null], | |
39 | 39 | 'emailGuest1' => ['type' => 'string', 'length' => 45, 'null' => true, 'default' => null, 'comment' => '', 'precision' => null, 'fixed' => null], |
40 | 40 | 'emailGuest2' => ['type' => 'string', 'length' => 45, 'null' => true, 'default' => null, 'comment' => '', 'precision' => null, 'fixed' => null], |
41 | 41 | 'emailGuest3' => ['type' => 'string', 'length' => 45, 'null' => true, 'default' => null, 'comment' => '', 'precision' => null, 'fixed' => null], |
... | ... | @@ -84,7 +84,7 @@ class ConfigurationsFixture extends TestFixture |
84 | 84 | 'nom_groupe_thematique' => 'Lorem ipsum dolor sit amet', |
85 | 85 | 'nom_groupe_metier' => 'Lorem ipsum dolor sit amet', |
86 | 86 | 'envoi_mail_management_dev' => 1, |
87 | - 'from_mail' => '@localhost.com', | |
87 | + 'sender_mail' => 'ezarear@localhost.com', | |
88 | 88 | 'emailGuest1' => 'Lorem ipsum dolor sit amet', |
89 | 89 | 'emailGuest2' => 'Lorem ipsum dolor sit amet', |
90 | 90 | 'emailGuest3' => 'Lorem ipsum dolor sit amet', |
... | ... |