From 26369079480505eb00692931cb34985306b86e37 Mon Sep 17 00:00:00 2001 From: Etienne Pallier Date: Thu, 2 Jul 2020 18:26:09 +0200 Subject: [PATCH] debug --- src/Model/Entity/Emprunt.php | 19 +++++++++++++++++-- src/Template/Emprunts/view.ctp | 1 + 2 files changed, 18 insertions(+), 2 deletions(-) diff --git a/src/Model/Entity/Emprunt.php b/src/Model/Entity/Emprunt.php index 8fb2dc8..16c0918 100755 --- a/src/Model/Entity/Emprunt.php +++ b/src/Model/Entity/Emprunt.php @@ -1,8 +1,12 @@ format('d/m/y'); - $date_emprunt = new \DateTime(strtr($this->_properties['date_emprunt'],'/','-')) ; //->format('d/m/y'); + //$date_emprunt = new \DateTime(strtr($this->_properties['date_emprunt'],'/','-')) ; //->format('d/m/y'); + $date_emprunt = new \DateTime(strtr($this->date_emprunt,'/','-')) ; //->format('d/m/y'); + // on ajoute 23h59m59s à date_retour pour autoriser le retour jqa la fin de la journée - $date_retour = new \DateTime(strtr($this->_properties['date_retour_emprunt'],'/','-')); + //$date_retour = new \DateTime(strtr($this->_properties['date_retour_emprunt'],'/','-')); + $date_retour = new \DateTime(strtr($this->date_retour_emprunt,'/','-')); + if (DEBUG) { + debug($today->format('d/m/yy')); + debug($date_emprunt->format('d/m/yy')); + debug($date_retour->format('d/m/yy')); + } $date_retour->add(new \DateInterval('PT23H59M59S')); //->format('d/m/y'); + if (DEBUG) debug($date_retour->format('d/m/yy')); $delay = $today->diff($date_emprunt)->days; + if (DEBUG) debug("delay $delay"); if ($today < $date_emprunt) { $status = "A VENIR"; $delay = "dans " . ($delay==0?1:$delay); @@ -65,6 +79,7 @@ class Emprunt extends Entity { else { $status = "TERMINÉ"; $delay = $today->diff($date_retour)->days; + if (DEBUG) debug("delay $delay"); } $delay = "depuis " . ($delay==0?1:$delay); } diff --git a/src/Template/Emprunts/view.ctp b/src/Template/Emprunts/view.ctp index dfef4dc..b6f7b1c 100755 --- a/src/Template/Emprunts/view.ctp +++ b/src/Template/Emprunts/view.ctp @@ -108,6 +108,7 @@ $status = $entity->status_from_dates; */ // Champ virtuel (calculé) statut + //debug($status); $style_red = 'style="color: red"'; //$displayElement(__('Statut'), "$status ($delay jour(s))", $status=="EN COURS" ? $style_red : ''); $displayElement(__('Statut'), "$status[0] ($status[1] jour(s))", $status[0]=="EN COURS" ? $style_red : ''); -- libgit2 0.21.2