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
This commit is contained in:
BENKE Charlie 2015-12-04 11:16:49 +01:00
parent 2c95344f05
commit bf9cb46aad

View File

@ -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;