Commit a5909c57f482b343e5fa4b3fbc5d5b33f2bb9bfd
1 parent
4f202783
Exists in
master
and in
2 other branches
bugfix ldap goes on... (+ optim & refactor)
Showing
7 changed files
with
181 additions
and
83 deletions
Show diff stats
README.md
... | ... | @@ -53,12 +53,14 @@ Logiciel testé et validé sur les configurations suivantes : |
53 | 53 | |
54 | 54 | VERSION ACTUELLE |
55 | 55 | |
56 | -Date: 13/02/2019 | |
57 | -Version: 2.10.9.bugfix1 | |
56 | +Date: 14/02/2019 | |
57 | +Version: 2.10.10.bugfix2 | |
58 | 58 | Author: EP |
59 | - Bugfix LDAP anonyme et refactorisation | |
59 | + (version IRAP only) Bugfix LDAP anonyme, refactorisation, et optimisation | |
60 | + | |
61 | + - LDAP anonyme se faisait sans vérifier le mot de passe utilisateur !!! | |
62 | + - Optimisation update email sur changement de responsable => LDAP et AJAX inutile, on fait avec un tableau local | |
60 | 63 | |
61 | - LDAP anonyme se faisait sans vérifier le mot de passe utilisateur !!! | |
62 | 64 | IMPORTANT: |
63 | 65 | - Pour connaitre la version actuelle, taper "./VERSION" |
64 | 66 | - Pour mettre à jour le code, utiliser ./UPDATE depuis la racine du projet (ne plus se contenter de faire "git pull") | ... | ... |
src/Controller/MaterielsController.php
... | ... | @@ -805,24 +805,20 @@ class MaterielsController extends AppController |
805 | 805 | $domaineresp = false; |
806 | 806 | $utilisateurconnect = TableRegistry::get('Users')->find('all')->toArray(); |
807 | 807 | |
808 | - $users = TableRegistry::get('LdapConnections')->getListUsers(); | |
809 | - //sort($users); | |
810 | - | |
808 | + // TODO: code redondant avec edit(), à factoriser | |
809 | + // HOWTO: https://book.cakephp.org/3.0/en/orm.html | |
810 | + //$users = TableRegistry::get('LdapConnections')->getListUsers(); | |
811 | 811 | //$users = TableRegistry::get('LdapConnections')->getUsersWithNameAndEmail(); |
812 | - //$user_names = array_keys($users); | |
813 | - //sort($user_names); | |
814 | - // tri des utilisateurs par nom | |
815 | - //sort($users); | |
816 | - //debug($users); | |
817 | - $utilisateurs = $users; | |
818 | - /* | |
819 | - $utilisateurs = []; | |
820 | - for ($i = 0; $i < sizeof($users); $i ++) { | |
821 | - // $utilisateurs["Etienne Pallier"] = "Etienne Pallier" | |
822 | - $utilisateurs[$users[$i]] = $users[$i]; | |
812 | + $users_name_and_email = TableRegistry::getTableLocator()->get('LdapConnections')->getUsersWithNameAndEmail(); | |
813 | + $users_name = array_keys($users_name_and_email); | |
814 | + $users_option_list = []; | |
815 | + for ($i = 0; $i < sizeof($users_name); $i ++) { | |
816 | + // $users_option_list["Etienne Pallier"] = "Etienne Pallier" | |
817 | + $users_option_list[$users_name[$i]] = $users_name[$i]; | |
823 | 818 | } |
824 | - */ | |
825 | - | |
819 | + // no more needed | |
820 | + $users_name = NULL; //unset($users_name); | |
821 | + | |
826 | 822 | // Ne pas commenter la ligne suivante, on en a besoin dans add.cpt |
827 | 823 | $mail_responsable = TableRegistry::get('Users')->find() |
828 | 824 | ->select('email') |
... | ... | @@ -846,9 +842,7 @@ class MaterielsController extends AppController |
846 | 842 | 'groupesThematiques', 'groupesMetiers', |
847 | 843 | 'organismes', 'sites', |
848 | 844 | 'mail_responsable', 'domaineresp', 'lieu_detail', 'fournisseurs', |
849 | - //'users', | |
850 | - //'user_names', | |
851 | - 'utilisateurs' | |
845 | + 'users_name_and_email', 'users_option_list' | |
852 | 846 | )); |
853 | 847 | $this->set('_serialize', [ |
854 | 848 | 'materiel' |
... | ... | @@ -1000,26 +994,35 @@ class MaterielsController extends AppController |
1000 | 994 | ]) |
1001 | 995 | ->first()['role']; |
1002 | 996 | |
997 | + /* NUL, franchement faudrait reflechir un peu quand meme, ya des limites !!! | |
1003 | 998 | if ($dom == $domaines) |
1004 | 999 | $domaineresp = true; |
1005 | 1000 | else |
1006 | 1001 | $domaineresp = false; |
1007 | - $users = TableRegistry::get('LdapConnections')->getListUsers(); | |
1008 | - | |
1009 | - // tri des utilisateurs par nom | |
1010 | - sort($users); | |
1011 | - $utilisateurs = []; | |
1012 | - for ($i = 0; $i < sizeof($users); $i ++) { | |
1013 | - $utilisateurs[$users[$i]] = $users[$i]; | |
1002 | + */ | |
1003 | + $domaineresp = ($dom == $domaines); | |
1004 | + | |
1005 | + // TODO: code redondant avec add(), à factoriser | |
1006 | + // HOWTO: https://book.cakephp.org/3.0/en/orm.html | |
1007 | + //$users = TableRegistry::get('LdapConnections')->getListUsers(); | |
1008 | + //$users = TableRegistry::get('LdapConnections')->getUsersWithNameAndEmail(); | |
1009 | + $users_name_and_email = TableRegistry::getTableLocator()->get('LdapConnections')->getUsersWithNameAndEmail(); | |
1010 | + $users_name = array_keys($users_name_and_email); | |
1011 | + $users_option_list = []; | |
1012 | + for ($i = 0; $i < sizeof($users_name); $i ++) { | |
1013 | + // $users_option_list["Etienne Pallier"] = "Etienne Pallier" | |
1014 | + $users_option_list[$users_name[$i]] = $users_name[$i]; | |
1014 | 1015 | } |
1015 | - | |
1016 | + | |
1016 | 1017 | if (! empty($materiel->get('nom_responsable'))) { |
1017 | - if (! in_array($materiel->get('nom_responsable'), $utilisateurs)) { | |
1018 | + //if (! in_array($materiel->get('nom_responsable'), $utilisateurs)) { | |
1019 | + if (! in_array($materiel->get('nom_responsable'), $users_name)) { | |
1018 | 1020 | $nom_ancien_responsable = $materiel->get('nom_responsable'); |
1019 | 1021 | $this->set(compact('nom_ancien_responsable')); |
1020 | 1022 | } |
1021 | 1023 | } |
1022 | - $mail_responsable = TableRegistry::get('Users')->find() | |
1024 | + //$mail_responsable = TableRegistry::get('Users')->find() | |
1025 | + $mail_responsable = TableRegistry::getTableLocator()->get('Users')->find() | |
1023 | 1026 | ->select('email') |
1024 | 1027 | ->where([ |
1025 | 1028 | 'username =' => $this->LdapAuth->user($this->request->getSession() |
... | ... | @@ -1044,7 +1047,15 @@ class MaterielsController extends AppController |
1044 | 1047 | 'TOBEARCHIVED', |
1045 | 1048 | 'ARCHIVED' |
1046 | 1049 | ])); |
1047 | - $this->set(compact('materiel', 'surCategories', 'categories', 'sousCategories', 'groupesThematiques', 'groupesMetiers', 'organismes', 'sites', 'utilisateurs', 'mail_responsable', 'role', 'domaineresp', 'designation_edit', 'designation', 'lieu_detail', 'lieu_detail_edit', 'fournisseurs')); | |
1050 | + $this->set(compact( | |
1051 | + 'materiel', | |
1052 | + 'surCategories', 'categories', 'sousCategories', | |
1053 | + 'groupesThematiques', 'groupesMetiers', | |
1054 | + 'organismes', 'sites', | |
1055 | + 'mail_responsable', 'role', 'domaineresp', 'designation_edit', 'designation', 'lieu_detail', 'lieu_detail_edit', 'fournisseurs', | |
1056 | + //'utilisateurs', | |
1057 | + 'users_name_and_email', 'users_option_list' | |
1058 | + )); | |
1048 | 1059 | $this->set('_serialize', [ |
1049 | 1060 | 'materiel' |
1050 | 1061 | ]); | ... | ... |
src/Controller/UsersController.php
src/Model/Table/LdapConnectionsTable.php
... | ... | @@ -256,7 +256,7 @@ class LdapConnectionsTable extends AppTable |
256 | 256 | } |
257 | 257 | |
258 | 258 | |
259 | - | |
259 | + // TODO: avirer, VIEUX CODE, à remplacer par getLdap1UserOrAllUsersAttributes() | |
260 | 260 | // $userName = login |
261 | 261 | public function getUserAttributes($userName) |
262 | 262 | { |
... | ... | @@ -268,10 +268,12 @@ class LdapConnectionsTable extends AppTable |
268 | 268 | ldap_set_option($ldapConnection, LDAP_OPT_PROTOCOL_VERSION, 3); |
269 | 269 | $results = ldap_search($ldapConnection, $this->baseDn, '(' . $this->authenticationType . '=' . $userName . ')'); |
270 | 270 | return ldap_get_entries($ldapConnection, $results); |
271 | - } else | |
271 | + } | |
272 | + else { | |
272 | 273 | return array( |
273 | 274 | $this->getFakeLdapUser($userName) |
274 | 275 | ); |
276 | + } | |
275 | 277 | } |
276 | 278 | } catch (Exception $e) {} |
277 | 279 | |
... | ... | @@ -290,7 +292,8 @@ class LdapConnectionsTable extends AppTable |
290 | 292 | */ |
291 | 293 | //public function getUserAttributes($userName, $ldapConnection='', $filter='', $just_these=[]) |
292 | 294 | //public function getUserAttributes($ldapConnection='', $filter='', $just_these=[], $userName=NULL) |
293 | - public function getLdapUsersAttributes($ldapConnection, $filter='', $just_these=[]) | |
295 | + //public function getLdapUsersAttributes($ldapConnection, $filter='', $just_these=[]) | |
296 | + public function getLdap1UserOrAllUsersAttributes($ldapConnection, $filter='', $just_these=[]) | |
294 | 297 | { |
295 | 298 | try { |
296 | 299 | if ($this->checkConfiguration()) { |
... | ... | @@ -369,7 +372,7 @@ class LdapConnectionsTable extends AppTable |
369 | 372 | $usersWithNameAndEmail[ $u[$i]['sn'][0].' '.$u[$i]['givenname'][0] ] = $u[$i]['mail'][0]; |
370 | 373 | //debug($usersWithNameAndEmail); |
371 | 374 | // Sort users (without modifying the keys, don't use sort() but asort() !!!!!!!!!!!!!) |
372 | - asort($usersWithNameAndEmail); | |
375 | + ksort($usersWithNameAndEmail); | |
373 | 376 | return $usersWithNameAndEmail; |
374 | 377 | } |
375 | 378 | |
... | ... | @@ -524,7 +527,7 @@ class LdapConnectionsTable extends AppTable |
524 | 527 | // SEARCH |
525 | 528 | if ($ldapbind) { |
526 | 529 | //$search = $this->getLdapUserAttributes($ldapConnection, $filter, $just_these, $user_login); |
527 | - $search = $this->getLdapUsersAttributes($ldapConnection, $filter, $just_these); | |
530 | + $search = $this->getLdap1UserOrAllUsersAttributes($ldapConnection, $filter, $just_these); | |
528 | 531 | if ($search === false) die("Could not get user attributes from LDAP server, response was: " . ldap_error($ldapConnection) ); |
529 | 532 | //return $search[0]; |
530 | 533 | return $search; |
... | ... | @@ -609,6 +612,7 @@ class LdapConnectionsTable extends AppTable |
609 | 612 | return TRUE; |
610 | 613 | } |
611 | 614 | |
615 | + | |
612 | 616 | |
613 | 617 | /* |
614 | 618 | * @param string $user_login |
... | ... | @@ -630,7 +634,7 @@ class LdapConnectionsTable extends AppTable |
630 | 634 | $ldapConnection = ldap_connect($this->host, $this->port); |
631 | 635 | ldap_set_option($ldapConnection, LDAP_OPT_PROTOCOL_VERSION, 3); |
632 | 636 | if (@ldap_bind($ldapConnection, $this->authenticationType . '=' . $user_login . ',' . $this->baseDn, $user_password)) { |
633 | - return $this->getUserAttributes($login)[0]; | |
637 | + return $this->getUserAttributes($user_login)[0]; | |
634 | 638 | /* |
635 | 639 | * } else { |
636 | 640 | * return false; |
... | ... | @@ -653,6 +657,8 @@ class LdapConnectionsTable extends AppTable |
653 | 657 | |
654 | 658 | // FAKE LDAP |
655 | 659 | else { |
660 | + //debug($this->USE_LDAP); | |
661 | + //debug($this->baseDn); | |
656 | 662 | $user = $this->getFakeLdapUser($user_login); |
657 | 663 | // debug($user); |
658 | 664 | if ($user === false) |
... | ... | @@ -670,9 +676,8 @@ class LdapConnectionsTable extends AppTable |
670 | 676 | } |
671 | 677 | |
672 | 678 | } catch (Exception $e) { |
673 | - echo 'Exception LDAP : ', $e->getMessage(), "\n"; | |
679 | + //echo 'Exception LDAP : ', $e->getMessage(), "\n"; | |
674 | 680 | } |
675 | - | |
676 | 681 | // Il y a eu un problème, l'utilisateur n'est pas reconnu |
677 | 682 | return FALSE; |
678 | 683 | ... | ... |
src/Template/Materiels/add.ctp
1 | 1 | <?php |
2 | 2 | |
3 | -//debug($utilisateurs); | |
3 | +/* | |
4 | + * (EP) | |
5 | + * Variables passed to this view by the Controller : | |
6 | + */ | |
7 | +$users_option_list = $users_option_list; | |
8 | +$users_name_and_email = $users_name_and_email; | |
9 | +// TODO: yena d'autres... il faut les lister toutes ici, pour plus de clarté | |
4 | 10 | |
5 | -//debug($users); | |
6 | -//$user_names= array_keys($users); | |
7 | -//debug($username); | |
8 | -//debug($user_names); | |
11 | +//debug($users_option_list); | |
12 | +//debug($users_name_and_email); | |
9 | 13 | |
10 | 14 | use Cake\ORM\TableRegistry; |
11 | 15 | if (isset($cpMateriel)) { |
... | ... | @@ -208,8 +212,8 @@ if (isset($cpMateriel)) { |
208 | 212 | 'label' => 'Nom de l\'utilisateur', |
209 | 213 | 'empty' => 'Choisir un utilisateur', |
210 | 214 | 'default' => $username, |
211 | - 'options' => $utilisateurs | |
212 | - //'options' => $user_names | |
215 | + //'options' => $utilisateurs | |
216 | + 'options' => $users_option_list | |
213 | 217 | ]); |
214 | 218 | echo $this->Form->control('email_responsable', [ |
215 | 219 | 'label' => 'Email de l\'utilisateur', |
... | ... | @@ -350,6 +354,17 @@ echo $this->element('menu_form', [ |
350 | 354 | */ |
351 | 355 | |
352 | 356 | $(document).ready(function() { |
357 | + | |
358 | + // Convert (once for all) PHP $users_name_and_email array to JAVASCRIPT array | |
359 | + //Implode Method | |
360 | + //var array = [INF?php echo implode($array, ","); ?SUP]; | |
361 | + //JSON Method | |
362 | + var users_name_and_email = <?php echo json_encode($users_name_and_email); ?>; | |
363 | + | |
364 | + /** | |
365 | + * | |
366 | + * Event SURCATEGORIE change => update Categories | |
367 | + */ | |
353 | 368 | $("#sur-categorie-id").bind("change", function(event) { |
354 | 369 | var domaineId = $("#sur-categorie-id :selected").val(); |
355 | 370 | var domaineresp = "<?=$domaineresp?>"; |
... | ... | @@ -382,23 +397,43 @@ $(document).ready(function() { |
382 | 397 | else { |
383 | 398 | updateSelectOptionsFromAnother("#sous-categorie-id", "#categorie-id", "SousCategories/getByCategorie", "Choisir une sous-catégorie " + categLabel); |
384 | 399 | updateSelectOptionsFromAnother("#sur-categorie-id", "#categorie-id", "SurCategories/getFromCategorie", ""); |
385 | - } | |
400 | + }; | |
386 | 401 | return false; |
387 | 402 | }); |
388 | 403 | |
404 | + | |
389 | 405 | /** |
390 | - * Event Mail change | |
406 | + * | |
407 | + * Event "Nom utilisateur" change => "Email" change | |
408 | + * | |
409 | + * TODO: Code commun avec edit.ctp => factoriser quelque part, mais comment, vu qu'on a besoin du tableau users_name_and_email ??? | |
410 | + * (EP) New method, quicker, get email directly from PHP $users_name_and_email array | |
411 | + * (OLD code is below, "fetch email via AJAX request to UsersController.getLdapEmail") | |
391 | 412 | */ |
392 | 413 | $("#nom-responsable").bind("change", function(event) { |
393 | - var url = document.URL; | |
394 | - var reg = new RegExp("(materiels).*$", "g"); | |
395 | - var emailUrl = url.replace(reg, "Users/getLdapEmail/"); | |
396 | - $.ajax({ | |
397 | - url: emailUrl + $("#nom-responsable").val() | |
398 | - }).done(function(data) { | |
414 | + var nom_resp = $("#nom-responsable").val(); | |
415 | + var new_email = users_name_and_email[nom_resp]; | |
416 | + $("#email-responsable").val(new_email); | |
417 | + }); | |
418 | + | |
419 | + | |
420 | +}); // end document.ready | |
421 | + | |
422 | + | |
423 | +/* | |
424 | +// OLD method, fetch email via AJAX request to UsersController.getLdapEmail() | |
425 | +$("#nom-responsable").bind("change", function(event) { | |
426 | + var url = document.URL; | |
427 | + var reg = new RegExp("(materiels).*$", "g"); | |
428 | + var emailUrl = url.replace(reg, "Users/getLdapEmail/"); | |
429 | + $.ajax( | |
430 | + { url: emailUrl + $("#nom-responsable").val() } | |
431 | + ).done( | |
432 | + function(data) { | |
399 | 433 | $("#email-responsable").val(data) |
400 | - }); | |
434 | + } | |
435 | + ); | |
401 | 436 | }); |
402 | -}); | |
403 | - | |
437 | +*/ | |
438 | + | |
404 | 439 | </script> |
405 | 440 | \ No newline at end of file | ... | ... |
src/Template/Materiels/edit.ctp
1 | 1 | <?php |
2 | + | |
3 | + | |
4 | +/* | |
5 | + * (EP) | |
6 | + * Variables passed to this view by the Controller : | |
7 | + */ | |
8 | +$users_option_list = $users_option_list; | |
9 | +$users_name_and_email = $users_name_and_email; | |
10 | +// TODO: yena d'autres... il faut les lister toutes ici, pour plus de clarté | |
11 | + | |
12 | +//debug($users_option_list); | |
13 | +//debug($users_name_and_email); | |
14 | + | |
15 | + | |
2 | 16 | use Cake\ORM\TableRegistry; |
3 | 17 | |
4 | 18 | $USER_IS_UTILISATEUR_AND_CREATOR_OR_OWNER = $USER_IS_UTILISATEUR && in_array($username, [ |
... | ... | @@ -271,7 +285,8 @@ if ($IS_VALIDATED && $materiel->numero_serie) |
271 | 285 | 'label' => 'Nom de l\'utilisateur', |
272 | 286 | 'empty' => 'Choisir un utilisateur', |
273 | 287 | 'default' => $username, |
274 | - 'options' => $utilisateurs | |
288 | + //'options' => $utilisateurs | |
289 | + 'options' => $users_option_list | |
275 | 290 | ]); |
276 | 291 | |
277 | 292 | if (isset($nom_ancien_responsable)) { |
... | ... | @@ -378,8 +393,9 @@ if ($USER_IS_SUPERADMIN) { |
378 | 393 | echo $this->Form->control('nom_createur', [ |
379 | 394 | 'label' => 'Nom du créateur', |
380 | 395 | 'disabled' => true, |
381 | - 'options' => $utilisateurs | |
382 | - ]); | |
396 | + //'options' => $utilisateurs | |
397 | + 'options' => $users_option_list | |
398 | + ]); | |
383 | 399 | |
384 | 400 | echo $this->Form->control('created', [ |
385 | 401 | 'label' => 'Date de création', |
... | ... | @@ -443,6 +459,12 @@ echo $this->element('menu_form', [ |
443 | 459 | |
444 | 460 | $(document).ready(function () { |
445 | 461 | |
462 | + // Convert (once for all) PHP $users_name_and_email array to JAVASCRIPT array | |
463 | + //Implode Method | |
464 | + //var array = [INF?php echo implode($array, ","); ?SUP]; | |
465 | + //JSON Method | |
466 | + var users_name_and_email = <?php echo json_encode($users_name_and_email); ?>; | |
467 | + | |
446 | 468 | /** |
447 | 469 | * Event DOMAINE change |
448 | 470 | * |
... | ... | @@ -497,29 +519,26 @@ $(document).ready(function () { |
497 | 519 | } |
498 | 520 | return false; |
499 | 521 | }); |
500 | -}); | |
501 | 522 | |
502 | -/** | |
503 | - * Event Mail change | |
504 | - */ | |
505 | - $(document).ready(function () { | |
506 | - $("#nom-responsable").bind("change", function (event) { | |
507 | - var url = document.URL; | |
508 | - var reg=new RegExp("(materiels).*$","g"); | |
509 | - var emailUrl = url.replace(reg, "Users/getLdapEmail/"); | |
510 | - $.ajax({ | |
511 | - url: emailUrl + $("#nom-responsable").val() | |
512 | - }).done(function(data) { | |
513 | - $("#email-responsable").val(data) | |
514 | - }); | |
515 | - }); | |
516 | - }); | |
523 | + | |
524 | + /** | |
525 | + * | |
526 | + * Event "Nom utilisateur" change => "Email" change | |
527 | + * | |
528 | + * TODO: Code commun avec edit.ctp => factoriser quelque part, mais comment, vu qu'on a besoin du tableau users_name_and_email ??? | |
529 | + * (EP) New method, quicker, get email directly from PHP $users_name_and_email array | |
530 | + * (OLD code is below (at the end), "fetch email via AJAX request to UsersController.getLdapEmail") | |
531 | + */ | |
532 | + $("#nom-responsable").bind("change", function(event) { | |
533 | + var nom_resp = $("#nom-responsable").val(); | |
534 | + var new_email = users_name_and_email[nom_resp]; | |
535 | + $("#email-responsable").val(new_email); | |
536 | + }); | |
517 | 537 | |
518 | 538 | |
519 | 539 | /** |
520 | 540 | * Event calcul date fin de garantie |
521 | 541 | */ |
522 | - $(document).ready(function () { | |
523 | 542 | $("#duree-garantie").bind("change", function (event) { |
524 | 543 | if($("#date-reception").val() != "" && $("#duree-garantie").val() != "") { |
525 | 544 | var url = document.URL; |
... | ... | @@ -532,6 +551,7 @@ $(document).ready(function () { |
532 | 551 | }); |
533 | 552 | } |
534 | 553 | }); |
554 | + | |
535 | 555 | $("#unite-duree-garantie").bind("change", function (event) { |
536 | 556 | if($("#date-reception").val() != "" && $("#duree-garantie").val() != "") { |
537 | 557 | var url = document.URL; |
... | ... | @@ -543,9 +563,14 @@ $(document).ready(function () { |
543 | 563 | $("#date-fin-garantie").val(data) |
544 | 564 | }); |
545 | 565 | } |
546 | - }); | |
547 | -}); | |
566 | + }); | |
567 | + | |
568 | + }); // end document.ready | |
569 | + | |
548 | 570 | |
571 | + | |
572 | + | |
573 | + // (EP) Pourquoi c'est pas dans document.ready ca ??? | |
549 | 574 | function changeAdminEdit() { |
550 | 575 | if (document.getElementById('eotp').disabled) { |
551 | 576 | document.getElementById('eotp').disabled=false; |
... | ... | @@ -564,5 +589,23 @@ $(document).ready(function () { |
564 | 589 | document.getElementById('num_labo').disabled=true; |
565 | 590 | } |
566 | 591 | } |
592 | + | |
593 | + | |
594 | +/* | |
595 | + // OLD method, fetch email via AJAX request to UsersController.getLdapEmail() | |
596 | + $("#nom-responsable").bind("change", function(event) { | |
597 | + var url = document.URL; | |
598 | + var reg = new RegExp("(materiels).*$", "g"); | |
599 | + var emailUrl = url.replace(reg, "Users/getLdapEmail/"); | |
600 | + $.ajax( | |
601 | + { url: emailUrl + $("#nom-responsable").val() } | |
602 | + ).done( | |
603 | + function(data) { | |
604 | + $("#email-responsable").val(data) | |
605 | + } | |
606 | + ); | |
607 | + }); | |
608 | +*/ | |
609 | + | |
567 | 610 | |
568 | 611 | </script> | ... | ... |
webroot/js/Verifications_dates_materiels.js
... | ... | @@ -2,6 +2,7 @@ $(document).ready(function () { |
2 | 2 | /** |
3 | 3 | * Event Mail change |
4 | 4 | */ |
5 | + /* | |
5 | 6 | $("#nom-responsable").bind("change", function(event) { |
6 | 7 | if ($("#nom-responsable").val() == "") { |
7 | 8 | $("#email-responsable").val(""); |
... | ... | @@ -16,6 +17,7 @@ $(document).ready(function () { |
16 | 17 | }); |
17 | 18 | } |
18 | 19 | }); |
20 | + */ | |
19 | 21 | |
20 | 22 | |
21 | 23 | /** | ... | ... |