diff --git a/htdocs/fichinter/card.php b/htdocs/fichinter/card.php index 3fd45013ab5..17f304fbd58 100644 --- a/htdocs/fichinter/card.php +++ b/htdocs/fichinter/card.php @@ -5,7 +5,7 @@ * Copyright (C) 2011-2013 Juanjo Menent * Copyright (C) 2013 Florian Henry * Copyright (C) 2014-2015 Ferran Marcet - * Copyright (C) 201 Charlie Benke + * Copyright (C) 2014-2015 Charlie Benke * Copyright (C) 2015 Abbes Bahfir * * This program is free software; you can redistribute it and/or modify @@ -1275,6 +1275,41 @@ else if ($id > 0 || ! empty($ref)) print ''.$langs->trans("TotalDuration").''; print ''.convertSecondToTime($object->duration, 'all', $conf->global->MAIN_DURATION_OF_WORKDAY).''; print ''; + + // Date create + print ''.$langs->trans("Datec").''; + print ''; + print $object->datec ? dol_print_date($object->datec, 'daytext') : ' '; + print ''; + print ''; + + // Date Validation + print ''.$langs->trans("Datev").''; + print ''; + print $object->datev ? dol_print_date($object->datev, 'daytext') : ' '; + print ''; + print ''; + + // Date Start + print ''.$langs->trans("Dateo").''; + print ''; + print $object->dateo ? dol_print_date($object->dateo, 'daytext') : ' '; + print ''; + print ''; + + // Date End + print ''.$langs->trans("Datee").''; + print ''; + print $object->datee ? dol_print_date($object->datee, 'daytext') : ' '; + print ''; + print ''; + + // Date Terminate/close + print ''.$langs->trans("Datet").''; + print ''; + print $object->datet ? dol_print_date($object->datet, 'daytext') : ' '; + print ''; + print ''; } // Description (must be a textarea and not html must be allowed (used in list view) diff --git a/htdocs/fichinter/class/fichinter.class.php b/htdocs/fichinter/class/fichinter.class.php index c1e7a3aaca2..ca698c55d5c 100644 --- a/htdocs/fichinter/class/fichinter.class.php +++ b/htdocs/fichinter/class/fichinter.class.php @@ -4,6 +4,7 @@ * Copyright (C) 2005-2012 Regis Houssin * Copyright (C) 2011-2013 Juanjo Menent * Copyright (C) 2015 Marcos García + * Copyright (C) 2015 Charlie Benke * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -48,9 +49,12 @@ class Fichinter extends CommonObject var $author; var $datec; var $datev; + var $dateo; + var $datee; + var $datet; var $datem; var $duration; - var $statut; // 0=draft, 1=validated, 2=invoiced + var $statut; // 0=draft, 1=validated, 2=invoiced, 3=Terminate var $description; var $fk_contrat; var $extraparams=array(); @@ -74,12 +78,15 @@ class Fichinter extends CommonObject $this->statuts[0]='Draft'; $this->statuts[1]='Validated'; $this->statuts[2]='StatusInterInvoiced'; + $this->statuts[3]='Close'; $this->statuts_short[0]='Draft'; $this->statuts_short[1]='Validated'; $this->statuts_short[2]='StatusInterInvoiced'; + $this->statuts_short[3]='Close'; $this->statuts_logo[0]='statut0'; - $this->statuts_logo[1]='statut4'; + $this->statuts_logo[1]='statut1'; $this->statuts_logo[2]='statut6'; + $this->statuts_logo[3]='statut4'; } @@ -277,7 +284,7 @@ class Fichinter extends CommonObject function fetch($rowid,$ref='') { $sql = "SELECT f.rowid, f.ref, f.description, f.fk_soc, f.fk_statut,"; - $sql.= " f.datec,"; + $sql.= " f.datec, f.dateo, f.datee, f.datet,"; $sql.= " f.date_valid as datev,"; $sql.= " f.tms as datem,"; $sql.= " f.duree, f.fk_projet, f.note_public, f.note_private, f.model_pdf, f.extraparams, fk_contrat"; @@ -300,6 +307,9 @@ class Fichinter extends CommonObject $this->statut = $obj->fk_statut; $this->duration = $obj->duree; $this->datec = $this->db->jdate($obj->datec); + $this->datee = $this->db->jdate($obj->dateo); + $this->dateo = $this->db->jdate($obj->datee); + $this->datet = $this->db->jdate($obj->datet); $this->datev = $this->db->jdate($obj->datev); $this->datem = $this->db->jdate($obj->datem); $this->fk_project = $obj->fk_projet; @@ -1264,7 +1274,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 +1288,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; diff --git a/htdocs/install/mysql/migration/3.8.0-3.9.0.sql b/htdocs/install/mysql/migration/3.8.0-3.9.0.sql index 7c372a5c394..3de2654e132 100755 --- a/htdocs/install/mysql/migration/3.8.0-3.9.0.sql +++ b/htdocs/install/mysql/migration/3.8.0-3.9.0.sql @@ -22,6 +22,11 @@ -- -- VMYSQL4.1 DELETE FROM llx_usergroup_user WHERE fk_usergroup NOT IN (SELECT rowid from llx_usergroup); +-- Was done into a 3.8 fix, so we must do it also in 3.9 +ALTER TABLE llx_fichinter ADD COLUMN datet date after duree; +ALTER TABLE llx_fichinter ADD COLUMN datee date after duree; +ALTER TABLE llx_fichinter ADD COLUMN dateo date after duree; + -- Was done into a 3.8 fix, so we must do it also in 3.9 ALTER TABLE llx_don ADD COLUMN fk_country integer NOT NULL DEFAULT 0 after country; diff --git a/htdocs/install/mysql/tables/llx_fichinter.sql b/htdocs/install/mysql/tables/llx_fichinter.sql index 58f953c7196..b3e2001f9c3 100644 --- a/htdocs/install/mysql/tables/llx_fichinter.sql +++ b/htdocs/install/mysql/tables/llx_fichinter.sql @@ -34,6 +34,9 @@ create table llx_fichinter fk_user_modif integer, -- user making last change fk_user_valid integer, -- valideur de la fiche fk_statut smallint DEFAULT 0, + dateo date, -- date de début d'intervention + datee date, -- date de fin d'intervention + datet date, -- date de terminaison de l'intervention duree real, -- duree totale de l'intervention description text, note_private text,