From bf9cb46aad9368c3c390afe939940d2440abd1ff Mon Sep 17 00:00:00 2001 From: BENKE Charlie Date: Fri, 4 Dec 2015 11:16:49 +0100 Subject: [PATCH] update dateo and datee based on fichinterdet we update fields datee and dateo based on fichinterdet like this we can show on fichinter the start and the end of the intervention --- htdocs/fichinter/class/fichinter.class.php | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/htdocs/fichinter/class/fichinter.class.php b/htdocs/fichinter/class/fichinter.class.php index c1e7a3aaca2..336e023c0ac 100644 --- a/htdocs/fichinter/class/fichinter.class.php +++ b/htdocs/fichinter/class/fichinter.class.php @@ -1264,7 +1264,7 @@ class FichinterLigne extends CommonObjectLine $this->db->begin(); - $sql = "SELECT SUM(duree) as total_duration"; + $sql = "SELECT SUM(duree) as total_duration, min(date) as dateo, max(date) as datee "; $sql.= " FROM ".MAIN_DB_PREFIX."fichinterdet"; $sql.= " WHERE fk_fichinter=".$this->fk_fichinter; @@ -1278,6 +1278,8 @@ class FichinterLigne extends CommonObjectLine $sql = "UPDATE ".MAIN_DB_PREFIX."fichinter"; $sql.= " SET duree = ".$total_duration; + $sql.= " , dateo = ".(! empty($obj->dateo)?"'".$this->db->idate($obj->dateo)."'":"null"); + $sql.= " , datee = ".(! empty($obj->datee)?"'".$this->db->idate($obj->datee)."'":"null"); $sql.= " WHERE rowid = ".$this->fk_fichinter; $sql.= " AND entity = ".$conf->entity;