diff --git a/CHANGELOG b/CHANGELOG index 607de4c..34b0b5a 100644 --- a/CHANGELOG +++ b/CHANGELOG @@ -399,6 +399,10 @@ Commencer à implémenter le nouveau workflow v5 : ======= CHANGES ======= ------- +14/09/2021 v5.2.9-3.7.9 + - Bugfix Ajout materiel + +------- 13/09/2021 v5.2.8-3.7.9 - Bugfix TESTS : Tests: 193, Assertions: 3181, Errors: 1, Failures: 46, Incomplete: 16 - donner valeur par défaut à budgets dans fixtures... diff --git a/README.md b/README.md index aeb9c65..507092a 100644 --- a/README.md +++ b/README.md @@ -52,8 +52,8 @@ Logiciel testé et validé sur les configurations suivantes : -------------------------------------------------------------------------------------------- -Date: 13/09/2021 -Version: v5.2.8-3.7.9 +Date: 14/09/2021 +Version: v5.2.9-3.7.9 diff --git a/src/Controller/MaterielsController.php b/src/Controller/MaterielsController.php index 5765057..4543896 100755 --- a/src/Controller/MaterielsController.php +++ b/src/Controller/MaterielsController.php @@ -11,8 +11,8 @@ use App\Model\Entity\User; use Cake\I18n\FrozenDate; use Cake\Database\Expression\QueryExpression; use Cake\Database\Query; -use phpDocumentor\Reflection\Types\True_; use App\Model\Table\MaterielsTable; +//use phpDocumentor\Reflection\Types\True_; // (2021 08) EP added to read new config files (config/app_mandatory_fields, ...) use Cake\Core\Configure; @@ -1003,7 +1003,7 @@ class MaterielsController extends AppController { /** * Index method * - * @return \Cake\Network\Response|null + * @return \Cake\Http\Response|null */ public function index() { @@ -1554,7 +1554,7 @@ class MaterielsController extends AppController { * * @param string|null $id * Materiel id. - * @return \Cake\Network\Response|null + * @return \Cake\Http\Response|null * @throws \Cake\Datasource\Exception\RecordNotFoundException When record not found. */ public function view($id = null) @@ -1935,7 +1935,7 @@ class MaterielsController extends AppController { * (https://docs.google.com/document/d/1-OhEeoi96j6ueUl5NQCQ9ZsTfbJTFw3ZVaWU2iYly_o/edit?pli=1#heading=h.uqfpcjutghc7) * * @param $IS_ADD: True = add ; False = edit - * @return \Cake\Network\Response|void Redirects on successful add/edit, renders view otherwise. + * @return \Cake\Http\Response|void Redirects on successful add/edit, renders view otherwise. */ //protected function add_or_edit($IS_ADD, $id=null, $valeurs=null, $erreurs=null, protected function add_or_edit($IS_ADD, $id=null, $erreurs=null, @@ -2703,9 +2703,10 @@ class MaterielsController extends AppController { //debug($this->Materiels->getUneditableFieldsForMaterielStatus($status)); exit; $this->set('readonlyFields', $IS_ADD ? [] : $this->Materiels->getUneditableFieldsForMaterielStatus($materiel->status)); - $this->set('CAN_PRINT_LABEL', $this->isAuthorizedActionForCurrentUser('printLabelRuban', $id)); + //$this->set('CAN_PRINT_LABEL', $this->isAuthorizedActionForCurrentUser('printLabelRuban', $id)); + $this->set('CAN_PRINT_LABEL', $IS_ADD ? $this->confLabinvent->hasPrinter : $this->isAuthorizedActionForCurrentUser('printLabelRuban')); - /* (EP) INUTILE (sauf pour faire du json ou xml) !!! + /* (EP) INUTILE (sauf pour faire du j-son ou x-ml) !!! $this->set('_serialize', [ 'materiel', ]); @@ -2713,25 +2714,25 @@ class MaterielsController extends AppController { } //add_or_edit() - + /** * Add method * - * @return \Cake\Network\Response|void Redirects on successful add, renders view otherwise. + * @return \Cake\Http\Response | void Redirects on successful add, renders view otherwise. */ public function add($valeurs = null, $erreurs = null) { //$this->add_or_edit(TRUE, null, $valeurs, $erreurs); $this->add_or_edit(TRUE, $valeurs, $erreurs); } - + /** * Edit method * * @param string|null $id * Materiel id. - * @return \Cake\Network\Response|void Redirects on successful edit, renders view otherwise. - * @throws \Cake\Network\Exception\NotFoundException When record not found. + * @return \Cake\Http\Response|void Redirects on successful edit, renders view otherwise. + * @throws \Cake\Http\Exception\NotFoundException When record not found. */ public function edit($id = null) { $this->add_or_edit(FALSE, $id); @@ -2742,8 +2743,8 @@ class MaterielsController extends AppController { * * @param string|null $id * Materiel id. - * @return \Cake\Network\Response|void Redirects on successful edit, renders view otherwise. - * @throws \Cake\Network\Exception\NotFoundException When record not found. + * @return \Cake\Http\Response|void Redirects on successful edit, renders view otherwise. + * @throws \Cake\Http\Exception\NotFoundException When record not found. */ public function administrer($id = null) { @@ -2851,7 +2852,7 @@ class MaterielsController extends AppController { * * @param string|null $id * Materiel id. - * @return \Cake\Network\Response|null Redirects to index. + * @return \Cake\Http\Response|null Redirects to index. * @throws \Cake\Datasource\Exception\RecordNotFoundException When record not found. */ public function delete($id = null) @@ -2906,7 +2907,7 @@ class MaterielsController extends AppController { * @param string $message * @param string $id * @param string $from - * @return \Cake\Network\Response|NULL + * @return \Cake\Http\Response|NULL */ private function _statusSetTo($newStatus, $message, $id = null, $from = 'index', $onlyOneMateriel = True) { @@ -3317,7 +3318,7 @@ class MaterielsController extends AppController { /** * GetConditionForField method * - * @param unknown $fieldName + * @param $fieldName string * @return string[]|NULL */ private function getConditionForField($fieldName) @@ -3331,8 +3332,8 @@ class MaterielsController extends AppController { /** * GetConditionForFieldNumber method * - * @param unknown $fieldName - * @return $string[]|NULL + * @param $fieldName string + * @return string[]|NULL */ private function getConditionForFieldNumber($fieldName) { @@ -4652,7 +4653,7 @@ class MaterielsController extends AppController { * @param string $id * @param string $from * @param string $printed - * @return \Cake\Network\Response|NULL + * @return \Cake\Http\Response|NULL */ private function _setLabelIsPlacedOrNotPlaced($id, $from=null, $printed = TRUE) { diff --git a/src/Template/Materiels/add_edit.ctp b/src/Template/Materiels/add_edit.ctp index eb17207..f1a9632 100644 --- a/src/Template/Materiels/add_edit.ctp +++ b/src/Template/Materiels/add_edit.ctp @@ -798,7 +798,7 @@ if (isset($cpMateriel)) { //'options' => $utilisateurs //'readonly' => $IS_EDIT ? false : $readonly, //'readonly' => $readonly, - 'disabled' => $readonly || $isReadonlyField($f, $readonlyFields) + 'disabled' => $readonly || ( $IS_ADD ? false : $isReadonlyField($f, $readonlyFields) ), ]); // EDIT only @@ -911,7 +911,7 @@ if (isset($cpMateriel)) { - $disabled = ''; // enabled */ $disabled = ''; // enabled - if ($isReadonlyField($f, $readonlyFields)) $disabled = 'disabled'; + if ( $IS_EDIT && $isReadonlyField($f, $readonlyFields) ) $disabled = 'disabled'; ?>