Commit 8061770ca71ecaedf76efe887aad49a2092876c3

Authored by Thibaud Ajas
1 parent 9e64b15e

changement indentation

src/Controller/DocumentsController.php
... ... @@ -238,7 +238,6 @@ class DocumentsController extends AppController {
238 238 ]);
239 239 } else {
240 240 // Ajout de doc au matériel
241   - $materiel->documents = $materiel->documents + 1;
242 241 // $this->sendEmailToManagementWith('[LabInvent] Ajout d\'un document', $userName.' (email = '.$userEmail.') a ajouté un document de type "'.$nomType.'" au matériel "'.$materiel->designation.'" (id = '.$materiel->id.').');
243 242 $this->sendEmail(null, '[LabInvent] Ajout d\'un document', $userName . ' a ajouté un document de type "' . $nomType . '" au matériel "' . $materiel->designation . '" (id = ' . $materiel->id . ').');
244 243 return $this->redirect([
... ... @@ -410,7 +409,6 @@ class DocumentsController extends AppController {
410 409 $id
411 410 ]);
412 411 } else {
413   - $materiel->documents = $materiel->documents - 1;
414 412 return $this->redirect([
415 413 'controller' => 'materiels',
416 414 'action' => 'view',
... ...
src/Controller/MaterielsController.php
... ... @@ -327,7 +327,7 @@ class MaterielsController extends AppController {
327 327 * @throws \Cake\Datasource\Exception\RecordNotFoundException When record not found.
328 328 */
329 329 public function view($id = null) {
330   - var_dump($this);
  330 + // var_dump($this);
331 331 $materiel = $this->Materiels->get($id, [
332 332 'contain' => [
333 333 'SurCategories',
... ...
src/Model/Table/MaterielsTable.php
... ... @@ -80,7 +80,7 @@ class MaterielsTable extends AppTable {
80 80 $this->belongsTo('Fournisseurs', [
81 81 'foreignKey' => 'fournisseur_id'
82 82 ]);
83   -
  83 +
84 84 // EP 9/6/17 added :
85 85 $this->belongsTo('Users', [
86 86 'foreignKey' => 'gestionnaire_id'
... ... @@ -122,11 +122,9 @@ class MaterielsTable extends AppTable {
122 122 'message' => 'Le statut doit prendre une des 4 valeurs CREATED, VALIDATED, TOBEARCHIVED, ou ARCHIVED',
123 123 'provider' => 'table'
124 124 ]);
125   - $configuration = TableRegistry::get('Configurations')->find()
126   - ->where([
  125 + $configuration = TableRegistry::get('Configurations')->find()->where([
127 126 'id =' => 1
128   - ])
129   - ->first();
  127 + ])->first();
130 128 if ($configuration->date_commande_facultative) {
131 129 $validator->allowEmpty('date_acquisition');
132 130 } else {
... ... @@ -137,9 +135,7 @@ class MaterielsTable extends AppTable {
137 135 'message' => 'Ce champ contient des caractères interdits',
138 136 'provider' => 'table'
139 137 ]);
140   - $validator->numeric('prix_ht')
141   - ->allowEmpty('prix_ht')
142   - ->add('prix_ht', 'valid', [
  138 + $validator->numeric('prix_ht')->allowEmpty('prix_ht')->add('prix_ht', 'valid', [
143 139 'rule' => 'check_string',
144 140 'message' => 'Ce champ contient des caractères interdits',
145 141 'provider' => 'table'
... ... @@ -216,30 +212,24 @@ class MaterielsTable extends AppTable {
216 212 * @return \Cake\ORM\RulesChecker
217 213 */
218 214 public function buildRules(RulesChecker $rules) {
219   - $configuration = TableRegistry::get('Configurations')->find()
220   - ->where([
  215 + $configuration = TableRegistry::get('Configurations')->find()->where([
221 216 'id =' => 1
222   - ])
223   - ->first();
  217 + ])->first();
224 218 $checkAtLeastOneChecked = function ($entity) {
225 219 return ($entity->materiel_administratif || $entity->materiel_technique);
226 220 };
227 221 // return if price >= $configuration->prix_inventaire_administratif € then must be checked as "administratif"
228 222 $checkIfIsAdministratifWhenShouldBe = function ($entity) {
229   - $configuration = TableRegistry::get('Configurations')->find()
230   - ->where([
  223 + $configuration = TableRegistry::get('Configurations')->find()->where([
231 224 'id =' => 1
232   - ])
233   - ->first();
  225 + ])->first();
234 226 return ! (isset($entity->prix_ht) && $entity->prix_ht >= $configuration->prix_inventaire_administratif && ! $entity->materiel_administratif);
235 227 };
236 228 // return if price <800€ then must NOT be checked as "administratif"
237 229 $checkIfIsNotAdministratifWhenShouldNotBe = function ($entity) {
238   - $configuration = TableRegistry::get('Configurations')->find()
239   - ->where([
  230 + $configuration = TableRegistry::get('Configurations')->find()->where([
240 231 'id =' => 1
241   - ])
242   - ->first();
  232 + ])->first();
243 233 return ! (isset($entity->prix_ht) && $entity->prix_ht < $configuration->prix_inventaire_administratif && $entity->materiel_administratif);
244 234 };
245 235 // return if checked as "administratif" price MUST be set
... ... @@ -297,11 +287,9 @@ class MaterielsTable extends AppTable {
297 287 $entity->set('nom_responsable', $entity->get('nom_ancien_responsable'));
298 288 }
299 289 // numero_laboratoire generator (QC changed this in Jan 2015)
300   - $configuration = TableRegistry::get('Configurations')->find()
301   - ->where([
  290 + $configuration = TableRegistry::get('Configurations')->find()->where([
302 291 'id =' => 1
303   - ])
304   - ->first();
  292 + ])->first();
305 293 if ($configuration->numero_labo_sans_annee) {
306 294 if (empty($entity->get('numero_laboratoire'))) {
307 295 $labShortName = $configuration->labNameShort;
... ...