Commit a87adffc33d848443851252a6252c3d42752f332

Authored by Etienne Pallier
1 parent 94fb1e94
Exists in master and in 1 other branch dev

v5.2.9-3.7.9

- Bugfix Ajout materiel
CHANGELOG
... ... @@ -399,6 +399,10 @@ Commencer à implémenter le nouveau workflow v5 :
399 399 ======= CHANGES =======
400 400  
401 401 -------
  402 +14/09/2021 v5.2.9-3.7.9
  403 + - Bugfix Ajout materiel
  404 +
  405 +-------
402 406 13/09/2021 v5.2.8-3.7.9
403 407 - Bugfix TESTS : Tests: 193, Assertions: 3181, Errors: 1, Failures: 46, Incomplete: 16
404 408 - donner valeur par défaut à budgets dans fixtures...
... ...
README.md
... ... @@ -52,8 +52,8 @@ Logiciel testé et validé sur les configurations suivantes :
52 52  
53 53 --------------------------------------------------------------------------------------------
54 54  
55   -Date: 13/09/2021
56   -Version: v5.2.8-3.7.9
  55 +Date: 14/09/2021
  56 +Version: v5.2.9-3.7.9
57 57  
58 58  
59 59  
... ...
src/Controller/MaterielsController.php
... ... @@ -11,8 +11,8 @@ use App\Model\Entity\User;
11 11 use Cake\I18n\FrozenDate;
12 12 use Cake\Database\Expression\QueryExpression;
13 13 use Cake\Database\Query;
14   -use phpDocumentor\Reflection\Types\True_;
15 14 use App\Model\Table\MaterielsTable;
  15 +//use phpDocumentor\Reflection\Types\True_;
16 16  
17 17 // (2021 08) EP added to read new config files (config/app_mandatory_fields, ...)
18 18 use Cake\Core\Configure;
... ... @@ -1003,7 +1003,7 @@ class MaterielsController extends AppController {
1003 1003 /**
1004 1004 * Index method
1005 1005 *
1006   - * @return \Cake\Network\Response|null
  1006 + * @return \Cake\Http\Response|null
1007 1007 */
1008 1008 public function index()
1009 1009 {
... ... @@ -1554,7 +1554,7 @@ class MaterielsController extends AppController {
1554 1554 *
1555 1555 * @param string|null $id
1556 1556 * Materiel id.
1557   - * @return \Cake\Network\Response|null
  1557 + * @return \Cake\Http\Response|null
1558 1558 * @throws \Cake\Datasource\Exception\RecordNotFoundException When record not found.
1559 1559 */
1560 1560 public function view($id = null)
... ... @@ -1935,7 +1935,7 @@ class MaterielsController extends AppController {
1935 1935 * (https://docs.google.com/document/d/1-OhEeoi96j6ueUl5NQCQ9ZsTfbJTFw3ZVaWU2iYly_o/edit?pli=1#heading=h.uqfpcjutghc7)
1936 1936 *
1937 1937 * @param $IS_ADD: True = add ; False = edit
1938   - * @return \Cake\Network\Response|void Redirects on successful add/edit, renders view otherwise.
  1938 + * @return \Cake\Http\Response|void Redirects on successful add/edit, renders view otherwise.
1939 1939 */
1940 1940 //protected function add_or_edit($IS_ADD, $id=null, $valeurs=null, $erreurs=null,
1941 1941 protected function add_or_edit($IS_ADD, $id=null, $erreurs=null,
... ... @@ -2703,9 +2703,10 @@ class MaterielsController extends AppController {
2703 2703  
2704 2704 //debug($this->Materiels->getUneditableFieldsForMaterielStatus($status)); exit;
2705 2705 $this->set('readonlyFields', $IS_ADD ? [] : $this->Materiels->getUneditableFieldsForMaterielStatus($materiel->status));
2706   - $this->set('CAN_PRINT_LABEL', $this->isAuthorizedActionForCurrentUser('printLabelRuban', $id));
  2706 + //$this->set('CAN_PRINT_LABEL', $this->isAuthorizedActionForCurrentUser('printLabelRuban', $id));
  2707 + $this->set('CAN_PRINT_LABEL', $IS_ADD ? $this->confLabinvent->hasPrinter : $this->isAuthorizedActionForCurrentUser('printLabelRuban'));
2707 2708  
2708   - /* (EP) INUTILE (sauf pour faire du json ou xml) !!!
  2709 + /* (EP) INUTILE (sauf pour faire du j-son ou x-ml) !!!
2709 2710 $this->set('_serialize', [
2710 2711 'materiel',
2711 2712 ]);
... ... @@ -2713,25 +2714,25 @@ class MaterielsController extends AppController {
2713 2714  
2714 2715 } //add_or_edit()
2715 2716  
2716   -
  2717 +
2717 2718 /**
2718 2719 * Add method
2719 2720 *
2720   - * @return \Cake\Network\Response|void Redirects on successful add, renders view otherwise.
  2721 + * @return \Cake\Http\Response | void Redirects on successful add, renders view otherwise.
2721 2722 */
2722 2723 public function add($valeurs = null, $erreurs = null) {
2723 2724 //$this->add_or_edit(TRUE, null, $valeurs, $erreurs);
2724 2725 $this->add_or_edit(TRUE, $valeurs, $erreurs);
2725 2726 }
2726 2727  
2727   -
  2728 +
2728 2729 /**
2729 2730 * Edit method
2730 2731 *
2731 2732 * @param string|null $id
2732 2733 * Materiel id.
2733   - * @return \Cake\Network\Response|void Redirects on successful edit, renders view otherwise.
2734   - * @throws \Cake\Network\Exception\NotFoundException When record not found.
  2734 + * @return \Cake\Http\Response|void Redirects on successful edit, renders view otherwise.
  2735 + * @throws \Cake\Http\Exception\NotFoundException When record not found.
2735 2736 */
2736 2737 public function edit($id = null) {
2737 2738 $this->add_or_edit(FALSE, $id);
... ... @@ -2742,8 +2743,8 @@ class MaterielsController extends AppController {
2742 2743 *
2743 2744 * @param string|null $id
2744 2745 * Materiel id.
2745   - * @return \Cake\Network\Response|void Redirects on successful edit, renders view otherwise.
2746   - * @throws \Cake\Network\Exception\NotFoundException When record not found.
  2746 + * @return \Cake\Http\Response|void Redirects on successful edit, renders view otherwise.
  2747 + * @throws \Cake\Http\Exception\NotFoundException When record not found.
2747 2748 */
2748 2749 public function administrer($id = null)
2749 2750 {
... ... @@ -2851,7 +2852,7 @@ class MaterielsController extends AppController {
2851 2852 *
2852 2853 * @param string|null $id
2853 2854 * Materiel id.
2854   - * @return \Cake\Network\Response|null Redirects to index.
  2855 + * @return \Cake\Http\Response|null Redirects to index.
2855 2856 * @throws \Cake\Datasource\Exception\RecordNotFoundException When record not found.
2856 2857 */
2857 2858 public function delete($id = null)
... ... @@ -2906,7 +2907,7 @@ class MaterielsController extends AppController {
2906 2907 * @param string $message
2907 2908 * @param string $id
2908 2909 * @param string $from
2909   - * @return \Cake\Network\Response|NULL
  2910 + * @return \Cake\Http\Response|NULL
2910 2911 */
2911 2912 private function _statusSetTo($newStatus, $message, $id = null, $from = 'index', $onlyOneMateriel = True) {
2912 2913  
... ... @@ -3317,7 +3318,7 @@ class MaterielsController extends AppController {
3317 3318 /**
3318 3319 * GetConditionForField method
3319 3320 *
3320   - * @param unknown $fieldName
  3321 + * @param $fieldName string
3321 3322 * @return string[]|NULL
3322 3323 */
3323 3324 private function getConditionForField($fieldName)
... ... @@ -3331,8 +3332,8 @@ class MaterielsController extends AppController {
3331 3332 /**
3332 3333 * GetConditionForFieldNumber method
3333 3334 *
3334   - * @param unknown $fieldName
3335   - * @return $string[]|NULL
  3335 + * @param $fieldName string
  3336 + * @return string[]|NULL
3336 3337 */
3337 3338 private function getConditionForFieldNumber($fieldName)
3338 3339 {
... ... @@ -4652,7 +4653,7 @@ class MaterielsController extends AppController {
4652 4653 * @param string $id
4653 4654 * @param string $from
4654 4655 * @param string $printed
4655   - * @return \Cake\Network\Response|NULL
  4656 + * @return \Cake\Http\Response|NULL
4656 4657 */
4657 4658 private function _setLabelIsPlacedOrNotPlaced($id, $from=null, $printed = TRUE)
4658 4659 {
... ...
src/Template/Materiels/add_edit.ctp
... ... @@ -798,7 +798,7 @@ if (isset($cpMateriel)) {
798 798 //'options' => $utilisateurs
799 799 //'readonly' => $IS_EDIT ? false : $readonly,
800 800 //'readonly' => $readonly,
801   - 'disabled' => $readonly || $isReadonlyField($f, $readonlyFields)
  801 + 'disabled' => $readonly || ( $IS_ADD ? false : $isReadonlyField($f, $readonlyFields) ),
802 802 ]);
803 803  
804 804 // EDIT only
... ... @@ -911,7 +911,7 @@ if (isset($cpMateriel)) {
911 911 - $disabled = ''; // enabled
912 912 */
913 913 $disabled = ''; // enabled
914   - if ($isReadonlyField($f, $readonlyFields)) $disabled = 'disabled';
  914 + if ( $IS_EDIT && $isReadonlyField($f, $readonlyFields) ) $disabled = 'disabled';
915 915  
916 916 ?>
917 917 <div class="form-group text">
... ...