Merge pull request #4150 from defrance/patch-84
Add date start and end of intervention
This commit is contained in:
commit
66c5d7c9ce
@ -5,7 +5,7 @@
|
||||
* Copyright (C) 2011-2013 Juanjo Menent <jmenent@2byte.es>
|
||||
* Copyright (C) 2013 Florian Henry <florian.henry@open-concept.pro>
|
||||
* Copyright (C) 2014-2015 Ferran Marcet <fmarcet@2byte.es>
|
||||
* Copyright (C) 201 Charlie Benke <charlies@patas-monkey.com>
|
||||
* Copyright (C) 2014-2015 Charlie Benke <charlie@patas-monkey.com>
|
||||
* Copyright (C) 2015 Abbes Bahfir <bafbes@gmail.com>
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
@ -1275,6 +1275,41 @@ else if ($id > 0 || ! empty($ref))
|
||||
print '<tr><td>'.$langs->trans("TotalDuration").'</td>';
|
||||
print '<td colspan="3">'.convertSecondToTime($object->duration, 'all', $conf->global->MAIN_DURATION_OF_WORKDAY).'</td>';
|
||||
print '</tr>';
|
||||
|
||||
// Date create
|
||||
print '<tr><td>'.$langs->trans("Datec").'</td>';
|
||||
print '<td colspan="3">';
|
||||
print $object->datec ? dol_print_date($object->datec, 'daytext') : ' ';
|
||||
print '</td>';
|
||||
print '</tr>';
|
||||
|
||||
// Date Validation
|
||||
print '<tr><td>'.$langs->trans("Datev").'</td>';
|
||||
print '<td colspan="3">';
|
||||
print $object->datev ? dol_print_date($object->datev, 'daytext') : ' ';
|
||||
print '</td>';
|
||||
print '</tr>';
|
||||
|
||||
// Date Start
|
||||
print '<tr><td>'.$langs->trans("Dateo").'</td>';
|
||||
print '<td colspan="3">';
|
||||
print $object->dateo ? dol_print_date($object->dateo, 'daytext') : ' ';
|
||||
print '</td>';
|
||||
print '</tr>';
|
||||
|
||||
// Date End
|
||||
print '<tr><td>'.$langs->trans("Datee").'</td>';
|
||||
print '<td colspan="3">';
|
||||
print $object->datee ? dol_print_date($object->datee, 'daytext') : ' ';
|
||||
print '</td>';
|
||||
print '</tr>';
|
||||
|
||||
// Date Terminate/close
|
||||
print '<tr><td>'.$langs->trans("Datet").'</td>';
|
||||
print '<td colspan="3">';
|
||||
print $object->datet ? dol_print_date($object->datet, 'daytext') : ' ';
|
||||
print '</td>';
|
||||
print '</tr>';
|
||||
}
|
||||
|
||||
// Description (must be a textarea and not html must be allowed (used in list view)
|
||||
|
||||
@ -4,6 +4,7 @@
|
||||
* Copyright (C) 2005-2012 Regis Houssin <regis.houssin@capnetworks.com>
|
||||
* Copyright (C) 2011-2013 Juanjo Menent <jmenent@2byte.es>
|
||||
* Copyright (C) 2015 Marcos García <marcosgdf@gmail.com>
|
||||
* Copyright (C) 2015 Charlie Benke <charlie@patas-monkey.com>
|
||||
*
|
||||
* 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;
|
||||
|
||||
|
||||
@ -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;
|
||||
|
||||
|
||||
@ -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,
|
||||
|
||||
Loading…
Reference in New Issue
Block a user