From 2c95344f05784cac7b55385e402ae7a482522231 Mon Sep 17 00:00:00 2001 From: BENKE Charlie Date: Fri, 4 Dec 2015 11:09:05 +0100 Subject: [PATCH 01/11] Add date start and end of intervention --- htdocs/install/mysql/tables/llx_fichinter.sql | 2 ++ 1 file changed, 2 insertions(+) diff --git a/htdocs/install/mysql/tables/llx_fichinter.sql b/htdocs/install/mysql/tables/llx_fichinter.sql index 58f953c7196..544e5da7c21 100644 --- a/htdocs/install/mysql/tables/llx_fichinter.sql +++ b/htdocs/install/mysql/tables/llx_fichinter.sql @@ -34,6 +34,8 @@ 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 duree real, -- duree totale de l'intervention description text, note_private text, From bf9cb46aad9368c3c390afe939940d2440abd1ff Mon Sep 17 00:00:00 2001 From: BENKE Charlie Date: Fri, 4 Dec 2015 11:16:49 +0100 Subject: [PATCH 02/11] 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; From f3ff8c5951f4d0ef4a91d0fc2c315354e28e286f Mon Sep 17 00:00:00 2001 From: BENKE Charlie Date: Fri, 4 Dec 2015 11:25:07 +0100 Subject: [PATCH 03/11] add dates of intervention --- htdocs/fichinter/card.php | 38 +++++++++++++++++++++++++++++++++++++- 1 file changed, 37 insertions(+), 1 deletion(-) diff --git a/htdocs/fichinter/card.php b/htdocs/fichinter/card.php index 403f1411dc8..81b33594317 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,42 @@ 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 End + print ''.$langs->trans("Datee").''; + print ''; + print $object->datee ? dol_print_date($object->datee, '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 ''; + } // Description (must be a textarea and not html must be allowed (used in list view) From 7ea3df4d063108c6ac543206951ed017d4483f0a Mon Sep 17 00:00:00 2001 From: BENKE Charlie Date: Fri, 4 Dec 2015 11:28:28 +0100 Subject: [PATCH 04/11] add date start and end of intervention add dateo (date open/start) and datee (date end) of intervention this date are filled by the fichinterdet date and can be displayed on planning --- htdocs/fichinter/class/fichinter.class.php | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/htdocs/fichinter/class/fichinter.class.php b/htdocs/fichinter/class/fichinter.class.php index 336e023c0ac..4201d952501 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,6 +49,8 @@ class Fichinter extends CommonObject var $author; var $datec; var $datev; + var $dateo; + var $datee; var $datem; var $duration; var $statut; // 0=draft, 1=validated, 2=invoiced @@ -277,7 +280,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,"; $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 +303,8 @@ 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->datev = $this->db->jdate($obj->datev); $this->datem = $this->db->jdate($obj->datem); $this->fk_project = $obj->fk_projet; From 46aaf9c270c150c3012ad4f1f784984b9cc97974 Mon Sep 17 00:00:00 2001 From: BENKE Charlie Date: Fri, 4 Dec 2015 12:34:17 +0100 Subject: [PATCH 05/11] Update 3.8.0-3.9.0.sql --- htdocs/install/mysql/migration/3.8.0-3.9.0.sql | 4 ++++ 1 file changed, 4 insertions(+) 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 e83eff0ce4d..d0105c9273c 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,10 @@ -- -- 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 datee date after duration; +ALTER TABLE llx_fichinter ADD COLUMN dateo date after duration; + -- 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; From 1da6b066059bfe040b4858096cf431b28bfd3113 Mon Sep 17 00:00:00 2001 From: BENKE Charlie Date: Fri, 4 Dec 2015 13:23:13 +0100 Subject: [PATCH 06/11] Update 3.8.0-3.9.0.sql --- htdocs/install/mysql/migration/3.8.0-3.9.0.sql | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) 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 d0105c9273c..5eac3db5386 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 @@ -23,8 +23,8 @@ -- Was done into a 3.8 fix, so we must do it also in 3.9 -ALTER TABLE llx_fichinter ADD COLUMN datee date after duration; -ALTER TABLE llx_fichinter ADD COLUMN dateo date after duration; +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; From 02f4c9879bab0399890de1b8b3134a30131419e4 Mon Sep 17 00:00:00 2001 From: BENKE Charlie Date: Sat, 5 Dec 2015 10:16:56 +0100 Subject: [PATCH 07/11] Update card.php --- htdocs/fichinter/card.php | 7 ------- 1 file changed, 7 deletions(-) diff --git a/htdocs/fichinter/card.php b/htdocs/fichinter/card.php index 81b33594317..b25c8b38b0d 100644 --- a/htdocs/fichinter/card.php +++ b/htdocs/fichinter/card.php @@ -1289,13 +1289,6 @@ else if ($id > 0 || ! empty($ref)) print $object->datev ? dol_print_date($object->datev, 'daytext') : ' '; print ''; print ''; - - // Date End - print ''.$langs->trans("Datee").''; - print ''; - print $object->datee ? dol_print_date($object->datee, 'daytext') : ' '; - print ''; - print ''; // Date Start print ''.$langs->trans("Dateo").''; From 3e8c670e84fc7fd1eba33269363d814c446b4fbe Mon Sep 17 00:00:00 2001 From: BENKE Charlie Date: Tue, 15 Dec 2015 11:46:20 +0100 Subject: [PATCH 08/11] Update 3.8.0-3.9.0.sql --- htdocs/install/mysql/migration/3.8.0-3.9.0.sql | 1 + 1 file changed, 1 insertion(+) 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 5eac3db5386..0323b77c782 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 @@ -23,6 +23,7 @@ -- 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; From 85344aa955d8fca4dece409e9acc6297fb1b1d61 Mon Sep 17 00:00:00 2001 From: BENKE Charlie Date: Tue, 15 Dec 2015 11:46:56 +0100 Subject: [PATCH 09/11] Update llx_fichinter.sql --- htdocs/install/mysql/tables/llx_fichinter.sql | 1 + 1 file changed, 1 insertion(+) diff --git a/htdocs/install/mysql/tables/llx_fichinter.sql b/htdocs/install/mysql/tables/llx_fichinter.sql index 544e5da7c21..b3e2001f9c3 100644 --- a/htdocs/install/mysql/tables/llx_fichinter.sql +++ b/htdocs/install/mysql/tables/llx_fichinter.sql @@ -36,6 +36,7 @@ create table llx_fichinter 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, From ad7c90fc19076c3190d6103520d94b9958e0dbf4 Mon Sep 17 00:00:00 2001 From: BENKE Charlie Date: Tue, 15 Dec 2015 11:52:11 +0100 Subject: [PATCH 10/11] Update fichinter.class.php --- htdocs/fichinter/class/fichinter.class.php | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/htdocs/fichinter/class/fichinter.class.php b/htdocs/fichinter/class/fichinter.class.php index 4201d952501..ca698c55d5c 100644 --- a/htdocs/fichinter/class/fichinter.class.php +++ b/htdocs/fichinter/class/fichinter.class.php @@ -51,9 +51,10 @@ class Fichinter extends CommonObject 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(); @@ -77,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'; } @@ -280,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, f.dateo, f.datee,"; + $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"; @@ -305,6 +309,7 @@ class Fichinter extends CommonObject $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; From 2405276a362c67585d0ce693ea40e533efeb84b0 Mon Sep 17 00:00:00 2001 From: BENKE Charlie Date: Tue, 15 Dec 2015 11:54:00 +0100 Subject: [PATCH 11/11] Update card.php --- htdocs/fichinter/card.php | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/htdocs/fichinter/card.php b/htdocs/fichinter/card.php index b25c8b38b0d..dbfcc96ebe4 100644 --- a/htdocs/fichinter/card.php +++ b/htdocs/fichinter/card.php @@ -1304,6 +1304,12 @@ else if ($id > 0 || ! empty($ref)) 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)