From 450a51a5d3250ce8d158ee89d8edc3333ea29ee9 Mon Sep 17 00:00:00 2001 From: Etienne Pallier Date: Mon, 14 Sep 2020 17:15:59 +0200 Subject: [PATCH] bugfix (en cours) pour PHP 5 !!!!!!!!!!!!!!!!! --- src/Controller/MaterielsController.php | 21 +++++++++++++++++++++ src/Template/Projets/view.ctp | 7 ++++++- 2 files changed, 27 insertions(+), 1 deletion(-) diff --git a/src/Controller/MaterielsController.php b/src/Controller/MaterielsController.php index afc606f..7792723 100755 --- a/src/Controller/MaterielsController.php +++ b/src/Controller/MaterielsController.php @@ -1595,6 +1595,27 @@ class MaterielsController extends AppController { $materiel = $this->Materiels->patchEntity($materiel, $this->request->getData()); //debug($materiel); exit; + // AVIRER + // BUGFIX temporaire pour php5 !!! + if ($this->isLabinventDebugMode()) { + $d2 = $materiel->date_reception; + $d1 = $materiel->date_acquisition; + $tz = new \DateTimeZone('Europe/Paris'); + $d1 = new \DateTime(strtr($d1,'/','-'),$tz); + $d2 = new \DateTime(strtr($d2,'/','-'),$tz); + debug("d1 achat:"); debug($d1); + debug("d2 recep:"); debug($d2); + if ($d2 < $d1) debug("d2 < d1 !!!"); + // $d2 > $d1 oui mais pas trop... + $diff = $d2->diff($d1); + //debug($diff->y); + debug("diff:"); debug($diff); + debug("diff->y:"); debug($diff->y); + debug("diff->days:"); debug($diff->days); + exit; + } + // FIN BUGFIX + // ADD : Set the user_id from the session. //$materiel->user_id = $this->Auth->user('id'); // EDIT : Added: Disable modification of user_id. diff --git a/src/Template/Projets/view.ctp b/src/Template/Projets/view.ctp index 7ea6f87..057c890 100644 --- a/src/Template/Projets/view.ctp +++ b/src/Template/Projets/view.ctp @@ -6,7 +6,12 @@ $projet = $projet; //debug($projet); ?> -Html->link(__('Edit Projet'), ['action' => 'edit', $projet->id]) ?> + +Html->link("Voir tous les projets (liste)", ['action'=>'index']) ?> +
+
+ +Html->link(__('Editer Projet'), ['action' => 'edit', $projet->id]) ?>