Works on enhancement of project tasks
This commit is contained in:
parent
354fa8a605
commit
a71e75c7c7
@ -117,7 +117,8 @@ ALTER TABLE llx_projet_task ADD COLUMN dateo datetime AFTER tms;
|
|||||||
ALTER TABLE llx_projet_task ADD COLUMN datee datetime AFTER dateo;
|
ALTER TABLE llx_projet_task ADD COLUMN datee datetime AFTER dateo;
|
||||||
ALTER TABLE llx_projet_task ADD COLUMN datev datetime AFTER datee;
|
ALTER TABLE llx_projet_task ADD COLUMN datev datetime AFTER datee;
|
||||||
ALTER TABLE llx_projet_task CHANGE title label varchar(255) NOT NULL;
|
ALTER TABLE llx_projet_task CHANGE title label varchar(255) NOT NULL;
|
||||||
ALTER TABLE llx_projet_task ADD COLUMN description varchar(255) AFTER label;
|
ALTER TABLE llx_projet_task ADD COLUMN description text AFTER label;
|
||||||
|
ALTER TABLE llx_projet_task MODIFY description text;
|
||||||
ALTER TABLE llx_projet_task ADD COLUMN progress integer DEFAULT 0 AFTER duration_effective;
|
ALTER TABLE llx_projet_task ADD COLUMN progress integer DEFAULT 0 AFTER duration_effective;
|
||||||
ALTER TABLE llx_projet_task ADD COLUMN priority integer DEFAULT 0 AFTER progress;
|
ALTER TABLE llx_projet_task ADD COLUMN priority integer DEFAULT 0 AFTER progress;
|
||||||
ALTER TABLE llx_projet_task ADD COLUMN fk_user_modif integer AFTER fk_user_creat;
|
ALTER TABLE llx_projet_task ADD COLUMN fk_user_modif integer AFTER fk_user_creat;
|
||||||
@ -143,4 +144,7 @@ insert into llx_c_type_contact(rowid, element, source, code, libelle, active ) v
|
|||||||
insert into llx_c_type_contact(rowid, element, source, code, libelle, active ) values (190, 'project_task', 'external', 'TASKEXECUTIVE', 'Responsable', 1);
|
insert into llx_c_type_contact(rowid, element, source, code, libelle, active ) values (190, 'project_task', 'external', 'TASKEXECUTIVE', 'Responsable', 1);
|
||||||
insert into llx_c_type_contact(rowid, element, source, code, libelle, active ) values (191, 'project_task', 'external', 'CONTRIBUTOR', 'Intervenant', 1);
|
insert into llx_c_type_contact(rowid, element, source, code, libelle, active ) values (191, 'project_task', 'external', 'CONTRIBUTOR', 'Intervenant', 1);
|
||||||
|
|
||||||
|
ALTER TABLE llx_projet ADD COLUMN description text AFTER title;
|
||||||
|
ALTER TABLE llx_projet CHANGE note note_private text;
|
||||||
|
ALTER TABLE llx_projet ADD COLUMN note_public text AFTER note_private;
|
||||||
|
ALTER TABLE llx_projet CHANGE fk_statut smallint DEFAULT 0 NOT NULL;
|
||||||
|
|||||||
@ -24,26 +24,26 @@ create table llx_facturedet
|
|||||||
(
|
(
|
||||||
rowid integer AUTO_INCREMENT PRIMARY KEY,
|
rowid integer AUTO_INCREMENT PRIMARY KEY,
|
||||||
fk_facture integer NOT NULL,
|
fk_facture integer NOT NULL,
|
||||||
fk_product integer NULL, -- Doit pouvoir etre nul pour ligne detail sans produits
|
fk_product integer NULL, -- Doit pouvoir etre nul pour ligne detail sans produits
|
||||||
description text,
|
description text,
|
||||||
tva_taux real, -- Taux tva produit/service (exemple 19.6)
|
tva_taux real, -- Taux tva produit/service (exemple 19.6)
|
||||||
qty real, -- Quantity (exemple 2)
|
qty real, -- Quantity (exemple 2)
|
||||||
remise_percent real DEFAULT 0, -- % de la remise ligne (exemple 20%)
|
remise_percent real DEFAULT 0, -- % de la remise ligne (exemple 20%)
|
||||||
remise real DEFAULT 0, -- Montant calcul<75> de la remise % sur PU HT (exemple 20)
|
remise real DEFAULT 0, -- Montant calcule de la remise % sur PU HT (exemple 20)
|
||||||
fk_remise_except integer NULL, -- Lien vers table des remises fixes
|
fk_remise_except integer NULL, -- Lien vers table des remises fixes
|
||||||
subprice real, -- P.U. HT (exemple 100)
|
subprice real, -- P.U. HT (exemple 100)
|
||||||
price real, -- P.U. HT apres remise % de ligne
|
price real, -- P.U. HT apres remise % de ligne
|
||||||
total_ht real, -- Total HT de la ligne toute quantit<69> et incluant remise ligne et globale
|
total_ht real, -- Total HT de la ligne toute quantite et incluant remise ligne et globale
|
||||||
total_tva real, -- Total TVA de la ligne toute quantit<69> et incluant remise ligne et globale
|
total_tva real, -- Total TVA de la ligne toute quantite et incluant remise ligne et globale
|
||||||
total_ttc real, -- Total TTC de la ligne toute quantit<69> et incluant remise ligne et globale
|
total_ttc real, -- Total TTC de la ligne toute quantite et incluant remise ligne et globale
|
||||||
product_type integer DEFAULT 0,
|
product_type integer DEFAULT 0,
|
||||||
date_start datetime DEFAULT NULL, -- date debut si service
|
date_start datetime DEFAULT NULL, -- date debut si service
|
||||||
date_end datetime DEFAULT NULL, -- date fin si service
|
date_end datetime DEFAULT NULL, -- date fin si service
|
||||||
info_bits integer DEFAULT 0, -- TVA NPR ou non
|
info_bits integer DEFAULT 0, -- TVA NPR ou non
|
||||||
fk_code_ventilation integer DEFAULT 0 NOT NULL,
|
fk_code_ventilation integer DEFAULT 0 NOT NULL,
|
||||||
fk_export_compta integer DEFAULT 0 NOT NULL,
|
fk_export_compta integer DEFAULT 0 NOT NULL,
|
||||||
special_code integer UNSIGNED DEFAULT 0, -- code pour les lignes speciales
|
special_code integer UNSIGNED DEFAULT 0, -- code pour les lignes speciales
|
||||||
rang integer DEFAULT 0, -- ordre d'affichage
|
rang integer DEFAULT 0, -- ordre d'affichage
|
||||||
import_key varchar(14)
|
import_key varchar(14)
|
||||||
)type=innodb;
|
)type=innodb;
|
||||||
|
|
||||||
|
|||||||
@ -1,5 +1,6 @@
|
|||||||
-- ===========================================================================
|
-- ===========================================================================
|
||||||
-- Copyright (C) 2002 Rodolphe Quiedeville <rodolphe@quiedeville.org>
|
-- Copyright (C) 2002 Rodolphe Quiedeville <rodolphe@quiedeville.org>
|
||||||
|
-- Copyright (C) 2010 Regis Houssin <regis@dolibarr.fr>
|
||||||
--
|
--
|
||||||
-- This program is free software; you can redistribute it and/or modify
|
-- 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
|
-- it under the terms of the GNU General Public License as published by
|
||||||
@ -22,15 +23,17 @@ create table llx_projet
|
|||||||
(
|
(
|
||||||
rowid integer AUTO_INCREMENT PRIMARY KEY,
|
rowid integer AUTO_INCREMENT PRIMARY KEY,
|
||||||
fk_soc integer,
|
fk_soc integer,
|
||||||
fk_statut smallint NOT NULL,
|
datec date, -- date creation project
|
||||||
datec date, -- date creation project
|
|
||||||
tms timestamp,
|
tms timestamp,
|
||||||
dateo date, -- date start project
|
dateo date, -- date start project
|
||||||
datee date, -- date end project
|
datee date, -- date end project
|
||||||
ref varchar(50),
|
ref varchar(50),
|
||||||
entity integer DEFAULT 1 NOT NULL, -- multi company id
|
entity integer DEFAULT 1 NOT NULL, -- multi company id
|
||||||
title varchar(255),
|
title varchar(255) NOT NULL,
|
||||||
fk_user_creat integer, -- createur du projet
|
description text,
|
||||||
note text,
|
fk_user_creat integer, -- createur du projet
|
||||||
|
fk_statut smallint DEFAULT 0 NOT NULL,
|
||||||
|
note_private text,
|
||||||
|
note_public text,
|
||||||
model_pdf varchar(50)
|
model_pdf varchar(50)
|
||||||
)type=innodb;
|
)type=innodb;
|
||||||
|
|||||||
@ -30,7 +30,7 @@ create table llx_projet_task
|
|||||||
datee datetime, -- date end task
|
datee datetime, -- date end task
|
||||||
datev datetime, -- date validation
|
datev datetime, -- date validation
|
||||||
label varchar(255) NOT NULL,
|
label varchar(255) NOT NULL,
|
||||||
description varchar(255),
|
description text,
|
||||||
duration_effective real NOT NULL,
|
duration_effective real NOT NULL,
|
||||||
progress integer DEFAULT 0, -- percentage increase
|
progress integer DEFAULT 0, -- percentage increase
|
||||||
priority integer DEFAULT 0, -- priority
|
priority integer DEFAULT 0, -- priority
|
||||||
|
|||||||
@ -77,6 +77,7 @@ if ($_POST["action"] == 'add' && $user->rights->projet->creer)
|
|||||||
$project->ref = $_POST["ref"];
|
$project->ref = $_POST["ref"];
|
||||||
$project->title = $_POST["title"];
|
$project->title = $_POST["title"];
|
||||||
$project->socid = $_POST["socid"];
|
$project->socid = $_POST["socid"];
|
||||||
|
$project->description = $_POST["description"];
|
||||||
$project->user_resp_id = $_POST["officer_project"];
|
$project->user_resp_id = $_POST["officer_project"];
|
||||||
$project->datec=dol_now('tzserver');
|
$project->datec=dol_now('tzserver');
|
||||||
$project->dateo=dol_mktime(12,0,0,$_POST['projectmonth'],$_POST['projectday'],$_POST['projectyear']);
|
$project->dateo=dol_mktime(12,0,0,$_POST['projectmonth'],$_POST['projectday'],$_POST['projectyear']);
|
||||||
@ -125,7 +126,7 @@ if ($_POST["action"] == 'update' && ! $_POST["cancel"] && $user->rights->projet-
|
|||||||
$project->ref = $_POST["ref"];
|
$project->ref = $_POST["ref"];
|
||||||
$project->title = $_POST["title"];
|
$project->title = $_POST["title"];
|
||||||
$project->socid = $_POST["socid"];
|
$project->socid = $_POST["socid"];
|
||||||
$project->user_resp_id = $_POST["officer_project"];
|
$project->description = $_POST["description"];
|
||||||
$project->date_start = dol_mktime(12,0,0,$_POST['projectmonth'],$_POST['projectday'],$_POST['projectyear']);
|
$project->date_start = dol_mktime(12,0,0,$_POST['projectmonth'],$_POST['projectday'],$_POST['projectyear']);
|
||||||
$project->date_end = dol_mktime(12,0,0,$_POST['projectendmonth'],$_POST['projectendday'],$_POST['projectendyear']);
|
$project->date_end = dol_mktime(12,0,0,$_POST['projectendmonth'],$_POST['projectendday'],$_POST['projectendyear']);
|
||||||
|
|
||||||
@ -230,6 +231,8 @@ llxHeader("",$langs->trans("Projects"),$help_url);
|
|||||||
$html = new Form($db);
|
$html = new Form($db);
|
||||||
$formfile = new FormFile($db);
|
$formfile = new FormFile($db);
|
||||||
|
|
||||||
|
$userstatic=new User($db);
|
||||||
|
|
||||||
if ($_GET["action"] == 'create' && $user->rights->projet->creer)
|
if ($_GET["action"] == 'create' && $user->rights->projet->creer)
|
||||||
{
|
{
|
||||||
/*
|
/*
|
||||||
@ -259,7 +262,7 @@ if ($_GET["action"] == 'create' && $user->rights->projet->creer)
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Ref
|
// Ref
|
||||||
print '<tr><td>'.$langs->trans("Ref").'*</td><td><input size="8" type="text" name="ref" value="'.($_POST["ref"]?$_POST["ref"]:$defaultref).'"></td></tr>';
|
print '<tr><td>'.$langs->trans("Ref").'*</td><td><input size="12" type="text" name="ref" value="'.($_POST["ref"]?$_POST["ref"]:$defaultref).'"></td></tr>';
|
||||||
|
|
||||||
// Label
|
// Label
|
||||||
print '<tr><td>'.$langs->trans("Label").'*</td><td><input size="30" type="text" name="title" value="'.$_POST["title"].'"></td></tr>';
|
print '<tr><td>'.$langs->trans("Label").'*</td><td><input size="30" type="text" name="title" value="'.$_POST["title"].'"></td></tr>';
|
||||||
@ -292,6 +295,12 @@ if ($_GET["action"] == 'create' && $user->rights->projet->creer)
|
|||||||
print $html->select_date(-1,'projectend');
|
print $html->select_date(-1,'projectend');
|
||||||
print '</td></tr>';
|
print '</td></tr>';
|
||||||
|
|
||||||
|
// Description
|
||||||
|
print '<tr><td valign="top">'.$langs->trans("Description").'</td>';
|
||||||
|
print '<td>';
|
||||||
|
print '<textarea name="description" wrap="soft" cols="80" rows="'.ROWS_3.'">'.$_POST["description"].'</textarea>';
|
||||||
|
print '</td></tr>';
|
||||||
|
|
||||||
print '<tr><td colspan="2" align="center"><input type="submit" class="button" value="'.$langs->trans("Create").'"></td></tr>';
|
print '<tr><td colspan="2" align="center"><input type="submit" class="button" value="'.$langs->trans("Create").'"></td></tr>';
|
||||||
print '</table>';
|
print '</table>';
|
||||||
print '</form>';
|
print '</form>';
|
||||||
@ -349,19 +358,41 @@ else
|
|||||||
print '<table class="border" width="100%">';
|
print '<table class="border" width="100%">';
|
||||||
|
|
||||||
// Ref
|
// Ref
|
||||||
print '<tr><td width="30%">'.$langs->trans("Ref").'</td><td><input size="8" name="ref" value="'.$project->ref.'"></td></tr>';
|
print '<tr><td width="30%">'.$langs->trans("Ref").'</td>';
|
||||||
|
print '<td><input size="12" name="ref" value="'.$project->ref.'"></td></tr>';
|
||||||
|
|
||||||
// Label
|
// Label
|
||||||
print '<tr><td>'.$langs->trans("Label").'</td><td><input size="30" name="title" value="'.$project->title.'"></td></tr>';
|
print '<tr><td>'.$langs->trans("Label").'</td>';
|
||||||
|
print '<td><input size="30" name="title" value="'.$project->title.'"></td></tr>';
|
||||||
|
|
||||||
// Customer
|
// Customer
|
||||||
print '<tr><td>'.$langs->trans("Company").'</td><td>';
|
print '<tr><td>'.$langs->trans("Company").'</td><td>';
|
||||||
print $html->select_societes($project->societe->id,'socid','',1,1);
|
print $html->select_societes($project->societe->id,'socid','',1,1);
|
||||||
print '</td></tr>';
|
print '</td></tr>';
|
||||||
|
|
||||||
// Responsable du projet
|
// Project leader
|
||||||
print '<tr><td>'.$langs->trans("OfficerProject").'</td><td>';
|
print '<tr><td>'.$langs->trans("OfficerProject").'</td><td>';
|
||||||
$html->select_users($project->user_resp_id,'officer_project',1);
|
$contact = $project->liste_contact(4,'internal');
|
||||||
|
$num=sizeof($contact);
|
||||||
|
if ($num)
|
||||||
|
{
|
||||||
|
$i = 0;
|
||||||
|
while ($i < $num)
|
||||||
|
{
|
||||||
|
if ($contact[$i]['code'] == 'PROJECTLEADER')
|
||||||
|
{
|
||||||
|
$userstatic->id = $contact[$i]['id'];
|
||||||
|
$userstatic->fetch();
|
||||||
|
print $userstatic->getNomUrl(1);
|
||||||
|
print '<br>';
|
||||||
|
}
|
||||||
|
$i++;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
print $langs->trans('SharedProject');
|
||||||
|
}
|
||||||
print '</td></tr>';
|
print '</td></tr>';
|
||||||
|
|
||||||
// Statut
|
// Statut
|
||||||
@ -377,6 +408,12 @@ else
|
|||||||
print $html->select_date($project->date_end?$project->date_end:-1,'projectend');
|
print $html->select_date($project->date_end?$project->date_end:-1,'projectend');
|
||||||
print '</td></tr>';
|
print '</td></tr>';
|
||||||
|
|
||||||
|
// Description
|
||||||
|
print '<tr><td valign="top">'.$langs->trans("Description").'</td>';
|
||||||
|
print '<td>';
|
||||||
|
print '<textarea name="description" wrap="soft" cols="80" rows="'.ROWS_3.'">'.$project->description.'</textarea>';
|
||||||
|
print '</td></tr>';
|
||||||
|
|
||||||
print '<tr><td align="center" colspan="2">';
|
print '<tr><td align="center" colspan="2">';
|
||||||
print '<input name="update" class="button" type="submit" value="'.$langs->trans("Modify").'"> ';
|
print '<input name="update" class="button" type="submit" value="'.$langs->trans("Modify").'"> ';
|
||||||
print '<input type="submit" class="button" name="cancel" Value="'.$langs->trans("Cancel").'"></td></tr>';
|
print '<input type="submit" class="button" name="cancel" Value="'.$langs->trans("Cancel").'"></td></tr>';
|
||||||
@ -385,7 +422,6 @@ else
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
$userstatic=new User($db);
|
|
||||||
|
|
||||||
print '<table class="border" width="100%">';
|
print '<table class="border" width="100%">';
|
||||||
|
|
||||||
@ -441,6 +477,11 @@ else
|
|||||||
print dol_print_date($project->date_end,'day');
|
print dol_print_date($project->date_end,'day');
|
||||||
print '</td></tr>';
|
print '</td></tr>';
|
||||||
|
|
||||||
|
// Description
|
||||||
|
print '<td valign="top">'.$langs->trans("Description").'</td><td>';
|
||||||
|
print nl2br($project->description);
|
||||||
|
print '</td></tr>';
|
||||||
|
|
||||||
print '</table>';
|
print '</table>';
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -40,6 +40,7 @@ class Project extends CommonObject
|
|||||||
|
|
||||||
var $id;
|
var $id;
|
||||||
var $ref;
|
var $ref;
|
||||||
|
var $description;
|
||||||
var $statut;
|
var $statut;
|
||||||
var $title;
|
var $title;
|
||||||
var $date_c;
|
var $date_c;
|
||||||
@ -48,6 +49,8 @@ class Project extends CommonObject
|
|||||||
var $date_end;
|
var $date_end;
|
||||||
var $socid;
|
var $socid;
|
||||||
var $user_resp_id;
|
var $user_resp_id;
|
||||||
|
var $note_private;
|
||||||
|
var $note_public;
|
||||||
|
|
||||||
var $statuts_short;
|
var $statuts_short;
|
||||||
var $statuts;
|
var $statuts;
|
||||||
@ -80,15 +83,25 @@ class Project extends CommonObject
|
|||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
$sql = "INSERT INTO ".MAIN_DB_PREFIX."projet (ref, title, fk_soc, fk_user_creat, fk_user_resp, datec, dateo, datee, fk_statut)";
|
$sql = "INSERT INTO ".MAIN_DB_PREFIX."projet (";
|
||||||
$sql.= " VALUES ('".addslashes($this->ref)."', '".addslashes($this->title)."',";
|
$sql.= "ref";
|
||||||
$sql.= " ".($this->socid > 0?$this->socid:"null").",";
|
$sql.= ", title";
|
||||||
$sql.= " ".$user->id.",";
|
$sql.= ", description";
|
||||||
$sql.= " ".($this->user_resp_id>0?$this->user_resp_id:'null').",";
|
$sql.= ", fk_soc";
|
||||||
$sql.= " ".($this->datec!=''?$this->db->idate($this->datec):'null').",";
|
$sql.= ", fk_user_creat";
|
||||||
$sql.= " ".($this->dateo!=''?$this->db->idate($this->dateo):'null').",";
|
$sql.= ", datec";
|
||||||
$sql.= " ".($this->datee!=''?$this->db->idate($this->datee):'null').",";
|
$sql.= ", dateo";
|
||||||
$sql.= " 0)";
|
$sql.= ", datee";
|
||||||
|
$sql.= ") VALUES (";
|
||||||
|
$sql.= "'".addslashes($this->ref)."'";
|
||||||
|
$sql.= ", '".addslashes($this->title)."'";
|
||||||
|
$sql.= ", '".addslashes($this->description)."'";
|
||||||
|
$sql.= ", ".($this->socid > 0?$this->socid:"null");
|
||||||
|
$sql.= ", ".($this->user_resp_id>0?$this->user_resp_id:'null');
|
||||||
|
$sql.= ", ".($this->datec!=''?$this->db->idate($this->datec):'null');
|
||||||
|
$sql.= ", ".($this->dateo!=''?$this->db->idate($this->dateo):'null');
|
||||||
|
$sql.= ", ".($this->datee!=''?$this->db->idate($this->datee):'null');
|
||||||
|
$sql.= ")";
|
||||||
|
|
||||||
dol_syslog("Project::create sql=".$sql,LOG_DEBUG);
|
dol_syslog("Project::create sql=".$sql,LOG_DEBUG);
|
||||||
$resql=$this->db->query($sql);
|
$resql=$this->db->query($sql);
|
||||||
@ -116,13 +129,17 @@ class Project extends CommonObject
|
|||||||
*/
|
*/
|
||||||
function update($user)
|
function update($user)
|
||||||
{
|
{
|
||||||
|
// Clean parameters
|
||||||
|
$this->title = trim($this->title);
|
||||||
|
$this->description = trim($this->description);
|
||||||
|
|
||||||
if (strlen(trim($this->ref)) > 0)
|
if (strlen(trim($this->ref)) > 0)
|
||||||
{
|
{
|
||||||
$sql = "UPDATE ".MAIN_DB_PREFIX."projet";
|
$sql = "UPDATE ".MAIN_DB_PREFIX."projet SET";
|
||||||
$sql.= " SET ref='".$this->ref."'";
|
$sql.= " ref='".$this->ref."'";
|
||||||
$sql.= ", title = '".$this->title."'";
|
$sql.= ", title = '".addslashes($this->title)."'";
|
||||||
|
$sql.= ", description = '".addslashes($this->description)."'";
|
||||||
$sql.= ", fk_soc = ".($this->socid > 0?$this->socid:"null");
|
$sql.= ", fk_soc = ".($this->socid > 0?$this->socid:"null");
|
||||||
$sql.= ", fk_user_resp = ".$this->user_resp_id;
|
|
||||||
$sql.= ", fk_statut = ".$this->statut;
|
$sql.= ", fk_statut = ".$this->statut;
|
||||||
$sql.= ", datec=".($this->date_c!=''?$this->db->idate($this->date_c):'null');
|
$sql.= ", datec=".($this->date_c!=''?$this->db->idate($this->date_c):'null');
|
||||||
$sql.= ", dateo=".($this->date_start!=''?$this->db->idate($this->date_start):'null');
|
$sql.= ", dateo=".($this->date_start!=''?$this->db->idate($this->date_start):'null');
|
||||||
@ -161,7 +178,8 @@ class Project extends CommonObject
|
|||||||
{
|
{
|
||||||
if (empty($id) && empty($ref)) return -1;
|
if (empty($id) && empty($ref)) return -1;
|
||||||
|
|
||||||
$sql = "SELECT rowid, ref, title, datec, tms, dateo, datee, fk_soc, fk_user_creat, fk_statut, note";
|
$sql = "SELECT rowid, ref, title, description, datec";
|
||||||
|
$sql.= ", tms, dateo, datee, fk_soc, fk_user_creat, fk_statut, note_private, note_public";
|
||||||
$sql.= " FROM ".MAIN_DB_PREFIX."projet";
|
$sql.= " FROM ".MAIN_DB_PREFIX."projet";
|
||||||
if ($ref) $sql.= " WHERE ref='".$ref."'";
|
if ($ref) $sql.= " WHERE ref='".$ref."'";
|
||||||
else $sql.= " WHERE rowid=".$id;
|
else $sql.= " WHERE rowid=".$id;
|
||||||
@ -178,13 +196,15 @@ class Project extends CommonObject
|
|||||||
$this->ref = $obj->ref;
|
$this->ref = $obj->ref;
|
||||||
$this->title = $obj->title;
|
$this->title = $obj->title;
|
||||||
$this->titre = $obj->title; // TODO deprecated
|
$this->titre = $obj->title; // TODO deprecated
|
||||||
|
$this->description = $obj->description;
|
||||||
$this->date_c = $this->db->jdate($obj->datec);
|
$this->date_c = $this->db->jdate($obj->datec);
|
||||||
$this->datec = $this->db->jdate($obj->datec); // TODO deprecated
|
$this->datec = $this->db->jdate($obj->datec); // TODO deprecated
|
||||||
$this->date_m = $this->db->jdate($obj->tms);
|
$this->date_m = $this->db->jdate($obj->tms);
|
||||||
$this->datem = $this->db->jdate($obj->tms); // TODO deprecated
|
$this->datem = $this->db->jdate($obj->tms); // TODO deprecated
|
||||||
$this->date_start = $this->db->jdate($obj->dateo);
|
$this->date_start = $this->db->jdate($obj->dateo);
|
||||||
$this->date_end = $this->db->jdate($obj->datee);
|
$this->date_end = $this->db->jdate($obj->datee);
|
||||||
$this->note = $obj->note;
|
$this->note_private = $obj->note_private;
|
||||||
|
$this->note_public = $obj->note_public;
|
||||||
$this->socid = $obj->fk_soc;
|
$this->socid = $obj->fk_soc;
|
||||||
$this->societe->id = $obj->fk_soc; // TODO For backward compatibility
|
$this->societe->id = $obj->fk_soc; // TODO For backward compatibility
|
||||||
$this->user_author_id = $obj->fk_user_creat;
|
$this->user_author_id = $obj->fk_user_creat;
|
||||||
@ -218,7 +238,8 @@ class Project extends CommonObject
|
|||||||
|
|
||||||
$projects = array();
|
$projects = array();
|
||||||
|
|
||||||
$sql = "SELECT rowid, title FROM ".MAIN_DB_PREFIX."projet";
|
$sql = "SELECT rowid, title";
|
||||||
|
$sql.= " FROM ".MAIN_DB_PREFIX."projet";
|
||||||
$sql.= " WHERE entity = ".$conf->entity;
|
$sql.= " WHERE entity = ".$conf->entity;
|
||||||
if (! empty($socid)) $sql.= " AND fk_soc = ".$socid;
|
if (! empty($socid)) $sql.= " AND fk_soc = ".$socid;
|
||||||
|
|
||||||
@ -423,83 +444,6 @@ class Project extends CommonObject
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* \brief Create a task into project
|
|
||||||
* \param user Id user that create
|
|
||||||
* \param title Title of task
|
|
||||||
* \param parent Id task parent
|
|
||||||
* \param id_resp Id of responsible user
|
|
||||||
* \return int Task id if succes, <0 if KO
|
|
||||||
* @obsolete now use task.class.php
|
|
||||||
*/
|
|
||||||
function CreateTask($user, $title, $parent=0, $id_resp=0)
|
|
||||||
{
|
|
||||||
$result = 0;
|
|
||||||
$task_id = -1;
|
|
||||||
|
|
||||||
if (trim($title))
|
|
||||||
{
|
|
||||||
$this->db->begin();
|
|
||||||
|
|
||||||
$sql = "INSERT INTO ".MAIN_DB_PREFIX."projet_task (fk_projet, title, fk_user_creat, fk_task_parent, duration_effective)";
|
|
||||||
$sql.= " VALUES (".$this->id.",'".addslashes($title)."', ".$user->id.",".($parent>0?$parent:'0').", 0)";
|
|
||||||
|
|
||||||
dol_syslog("Project::CreateTask sql=".$sql, LOG_DEBUG);
|
|
||||||
if ($this->db->query($sql))
|
|
||||||
{
|
|
||||||
$task_id = $this->db->last_insert_id(MAIN_DB_PREFIX."projet_task");
|
|
||||||
$result = $task_id;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
$this->error=$this->db->lasterror();
|
|
||||||
dol_syslog("Project::CreateTask error -1 ".$this->error, LOG_ERR);
|
|
||||||
$result = -1;
|
|
||||||
}
|
|
||||||
|
|
||||||
if ($result >= 0)
|
|
||||||
{
|
|
||||||
if ($id_resp > 0)
|
|
||||||
{
|
|
||||||
$sql = "INSERT INTO ".MAIN_DB_PREFIX."projet_task_actors (fk_projet_task, fk_user)";
|
|
||||||
$sql.= " VALUES (".$task_id.",".($id_resp>0?$id_resp:'null').")";
|
|
||||||
|
|
||||||
dol_syslog("Project::CreateTask sql=".$sql, LOG_DEBUG);
|
|
||||||
if ($this->db->query($sql) )
|
|
||||||
{
|
|
||||||
$this->db->commit();
|
|
||||||
return $task_id;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
$this->error=$this->db->lasterror();
|
|
||||||
dol_syslog("Project::CreateTask error -3 ".$this->error, LOG_ERR);
|
|
||||||
$this->db->rollback();
|
|
||||||
return -3;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
$this->db->commit();
|
|
||||||
return $task_id;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
dol_syslog("Project::CreateTask error -2 ".$this->error,LOG_ERR);
|
|
||||||
$this->db->rollback();
|
|
||||||
return -2;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
dol_syslog("Project::CreateTask error -1 ref null");
|
|
||||||
$result = -1;
|
|
||||||
}
|
|
||||||
|
|
||||||
return $result;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* \brief Return status label of object
|
* \brief Return status label of object
|
||||||
* \param mode 0=long label, 1=short label, 2=Picto + short label, 3=Picto, 4=Picto + long label, 5=Short label + Picto
|
* \param mode 0=long label, 1=short label, 2=Picto + short label, 3=Picto, 4=Picto + long label, 5=Short label + Picto
|
||||||
|
|||||||
@ -82,8 +82,6 @@ class Task extends CommonObject
|
|||||||
// Clean parameters
|
// Clean parameters
|
||||||
$this->label = trim($this->label);
|
$this->label = trim($this->label);
|
||||||
$this->description = trim($this->description);
|
$this->description = trim($this->description);
|
||||||
$this->note_private = trim($this->note_private);
|
|
||||||
$this->note_public = trim($this->note_public);
|
|
||||||
|
|
||||||
// Check parameters
|
// Check parameters
|
||||||
// Put here code to add control on parameters values
|
// Put here code to add control on parameters values
|
||||||
@ -164,6 +162,8 @@ class Task extends CommonObject
|
|||||||
$sql.= " t.fk_user_creat,";
|
$sql.= " t.fk_user_creat,";
|
||||||
$sql.= " t.fk_user_valid,";
|
$sql.= " t.fk_user_valid,";
|
||||||
$sql.= " t.fk_statut,";
|
$sql.= " t.fk_statut,";
|
||||||
|
$sql.= " t.progress,";
|
||||||
|
$sql.= " t.priority,";
|
||||||
$sql.= " t.note_private,";
|
$sql.= " t.note_private,";
|
||||||
$sql.= " t.note_public";
|
$sql.= " t.note_public";
|
||||||
$sql.= " FROM ".MAIN_DB_PREFIX."projet_task as t";
|
$sql.= " FROM ".MAIN_DB_PREFIX."projet_task as t";
|
||||||
@ -190,6 +190,8 @@ class Task extends CommonObject
|
|||||||
$this->fk_user_creat = $obj->fk_user_creat;
|
$this->fk_user_creat = $obj->fk_user_creat;
|
||||||
$this->fk_user_valid = $obj->fk_user_valid;
|
$this->fk_user_valid = $obj->fk_user_valid;
|
||||||
$this->fk_statut = $obj->fk_statut;
|
$this->fk_statut = $obj->fk_statut;
|
||||||
|
$this->progress = $obj->progress;
|
||||||
|
$this->priority = $obj->priority;
|
||||||
$this->note_private = $obj->note_private;
|
$this->note_private = $obj->note_private;
|
||||||
$this->note_public = $obj->note_public;
|
$this->note_public = $obj->note_public;
|
||||||
}
|
}
|
||||||
|
|||||||
@ -27,6 +27,7 @@
|
|||||||
|
|
||||||
require("./pre.inc.php");
|
require("./pre.inc.php");
|
||||||
require_once(DOL_DOCUMENT_ROOT."/lib/project.lib.php");
|
require_once(DOL_DOCUMENT_ROOT."/lib/project.lib.php");
|
||||||
|
require_once(DOL_DOCUMENT_ROOT."/html.formother.class.php");
|
||||||
|
|
||||||
if (!$user->rights->projet->lire) accessforbidden();
|
if (!$user->rights->projet->lire) accessforbidden();
|
||||||
|
|
||||||
@ -68,17 +69,15 @@ if ($_POST["action"] == 'confirm_delete' && $_POST["confirm"] == "yes" && $user-
|
|||||||
llxHeader("",$langs->trans("Task"));
|
llxHeader("",$langs->trans("Task"));
|
||||||
|
|
||||||
$html = new Form($db);
|
$html = new Form($db);
|
||||||
|
$formother = new FormOther($db);
|
||||||
|
|
||||||
$projectstatic = new Project($db);
|
$projectstatic = new Project($db);
|
||||||
|
|
||||||
|
|
||||||
if ($_GET["id"] > 0)
|
if ($_GET["id"] > 0)
|
||||||
{
|
{
|
||||||
/*
|
|
||||||
* Fiche projet en mode visu
|
|
||||||
*
|
|
||||||
*/
|
|
||||||
$task = new Task($db);
|
$task = new Task($db);
|
||||||
|
|
||||||
if ($task->fetch($_GET["id"]) >= 0 )
|
if ($task->fetch($_GET["id"]) >= 0 )
|
||||||
{
|
{
|
||||||
$projet = new Project($db);
|
$projet = new Project($db);
|
||||||
@ -89,103 +88,171 @@ if ($_GET["id"] > 0)
|
|||||||
|
|
||||||
dol_fiche_head($head, 'task', $langs->trans("Task"),0,'projecttask');
|
dol_fiche_head($head, 'task', $langs->trans("Task"),0,'projecttask');
|
||||||
|
|
||||||
if ($mesg) print $mesg.'<br>';
|
if ($_GET["action"] == 'edit' && $user->rights->projet->creer)
|
||||||
|
|
||||||
if ($_GET["action"] == 'delete')
|
|
||||||
{
|
{
|
||||||
$ret=$html->form_confirm($_SERVER["PHP_SELF"]."?id=".$_GET["id"],$langs->trans("DeleteATask"),$langs->trans("ConfirmDeleteATask"),"confirm_delete");
|
print '<form method="POST" action="fiche.php?id='.$projet->id.'">';
|
||||||
if ($ret == 'html') print '<br>';
|
print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
|
||||||
|
print '<input type="hidden" name="action" value="createtask">';
|
||||||
|
print '<table class="border" width="100%">';
|
||||||
|
|
||||||
|
if ($mesg) print $mesg.'<br>';
|
||||||
|
|
||||||
|
// Ref
|
||||||
|
print '<tr><td width="30%">';
|
||||||
|
print $langs->trans("Ref");
|
||||||
|
print '</td><td colspan="3">';
|
||||||
|
print $html->showrefnav($task,'id','',1,'rowid','ref','','');
|
||||||
|
print '</td>';
|
||||||
|
print '</tr>';
|
||||||
|
|
||||||
|
// Label
|
||||||
|
print '<tr><td>'.$langs->trans("Label").'</td><td colspan="3">'.$task->label.'</td></tr>';
|
||||||
|
|
||||||
|
print '<tr><td>'.$langs->trans("Project").'</td><td colspan="3">';
|
||||||
|
print $projet->getNomUrl(1);
|
||||||
|
print '</td></tr>';
|
||||||
|
|
||||||
|
print '<td>'.$langs->trans("Company").'</td><td colspan="3">';
|
||||||
|
if ($projet->societe->id) print $projet->societe->getNomUrl(1);
|
||||||
|
else print ' ';
|
||||||
|
print '</td></tr>';
|
||||||
|
|
||||||
|
// Date start
|
||||||
|
print '<tr><td>'.$langs->trans("DateStart").'</td><td colspan="3">';
|
||||||
|
print dol_print_date($task->date_start,'day');
|
||||||
|
print '</td></tr>';
|
||||||
|
|
||||||
|
// Date end
|
||||||
|
print '<tr><td>'.$langs->trans("DateEnd").'</td><td colspan="3">';
|
||||||
|
print dol_print_date($task->date_end,'day');
|
||||||
|
print '</td></tr>';
|
||||||
|
|
||||||
|
// Progress
|
||||||
|
print '<tr><td>'.$langs->trans("Progress").'</td><td colspan="3">';
|
||||||
|
print $formother->select_percent($task->progress,'progress');
|
||||||
|
print '</td></tr>';
|
||||||
|
|
||||||
|
// Description
|
||||||
|
print '<td>'.$langs->trans("Description").'</td><td colspan="3">';
|
||||||
|
print nl2br($task->description);
|
||||||
|
print '</td></tr>';
|
||||||
|
|
||||||
|
print '</table></form>';
|
||||||
|
print '</div>';
|
||||||
}
|
}
|
||||||
|
else
|
||||||
print '<form method="POST" action="fiche.php?id='.$projet->id.'">';
|
|
||||||
print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
|
|
||||||
print '<input type="hidden" name="action" value="createtask">';
|
|
||||||
print '<table class="border" width="100%">';
|
|
||||||
|
|
||||||
// Ref
|
|
||||||
print '<tr><td width="30%">';
|
|
||||||
print $langs->trans("Ref");
|
|
||||||
print '</td><td colspan="3">';
|
|
||||||
print $html->showrefnav($task,'id','',1,'rowid','ref','','');
|
|
||||||
print '</td>';
|
|
||||||
print '</tr>';
|
|
||||||
|
|
||||||
// Label
|
|
||||||
print '<tr><td>'.$langs->trans("Label").'</td><td colspan="3">'.$task->label.'</td></tr>';
|
|
||||||
|
|
||||||
print '<tr><td>'.$langs->trans("Project").'</td><td colspan="3">';
|
|
||||||
print $projet->getNomUrl(1);
|
|
||||||
print '</td></tr>';
|
|
||||||
|
|
||||||
print '<td>'.$langs->trans("Company").'</td><td colspan="3">';
|
|
||||||
if ($projet->societe->id) print $projet->societe->getNomUrl(1);
|
|
||||||
else print ' ';
|
|
||||||
print '</td></tr>';
|
|
||||||
|
|
||||||
// Date start
|
|
||||||
print '<tr><td>'.$langs->trans("DateStart").'</td><td colspan="3">';
|
|
||||||
print dol_print_date($task->date_start,'day');
|
|
||||||
print '</td></tr>';
|
|
||||||
|
|
||||||
// Date end
|
|
||||||
print '<tr><td>'.$langs->trans("DateEnd").'</td><td colspan="3">';
|
|
||||||
print dol_print_date($task->date_end,'day');
|
|
||||||
print '</td></tr>';
|
|
||||||
|
|
||||||
// Description
|
|
||||||
print '<td>'.$langs->trans("Description").'</td><td colspan="3">';
|
|
||||||
print nl2br($task->description);
|
|
||||||
print '</td></tr>';
|
|
||||||
|
|
||||||
/* List of time spent */
|
|
||||||
|
|
||||||
$sql = "SELECT t.task_date, t.task_duration, t.fk_user, u.login, u.rowid";
|
|
||||||
$sql .= " FROM ".MAIN_DB_PREFIX."projet_task_time as t";
|
|
||||||
$sql .= " , ".MAIN_DB_PREFIX."user as u";
|
|
||||||
$sql .= " WHERE t.fk_task =".$task->id;
|
|
||||||
$sql .= " AND t.fk_user = u.rowid";
|
|
||||||
$sql .= " ORDER BY t.task_date DESC";
|
|
||||||
|
|
||||||
$var=true;
|
|
||||||
$resql = $db->query($sql);
|
|
||||||
if ($resql)
|
|
||||||
{
|
{
|
||||||
$num = $db->num_rows($resql);
|
/*
|
||||||
$i = 0;
|
* Fiche tache en mode visu
|
||||||
$tasks = array();
|
*/
|
||||||
while ($i < $num)
|
|
||||||
|
if ($_GET["action"] == 'delete')
|
||||||
{
|
{
|
||||||
$row = $db->fetch_object($resql);
|
$ret=$html->form_confirm($_SERVER["PHP_SELF"]."?id=".$_GET["id"],$langs->trans("DeleteATask"),$langs->trans("ConfirmDeleteATask"),"confirm_delete");
|
||||||
$tasks[$i] = $row;
|
if ($ret == 'html') print '<br>';
|
||||||
$i++;
|
|
||||||
}
|
}
|
||||||
$db->free($resql);
|
|
||||||
|
print '<table class="border" width="100%">';
|
||||||
|
|
||||||
|
// Ref
|
||||||
|
print '<tr><td width="30%">';
|
||||||
|
print $langs->trans("Ref");
|
||||||
|
print '</td><td colspan="3">';
|
||||||
|
print $html->showrefnav($task,'id','',1,'rowid','ref','','');
|
||||||
|
print '</td>';
|
||||||
|
print '</tr>';
|
||||||
|
|
||||||
|
// Label
|
||||||
|
print '<tr><td>'.$langs->trans("Label").'</td><td colspan="3">'.$task->label.'</td></tr>';
|
||||||
|
|
||||||
|
print '<tr><td>'.$langs->trans("Project").'</td><td colspan="3">';
|
||||||
|
print $projet->getNomUrl(1);
|
||||||
|
print '</td></tr>';
|
||||||
|
|
||||||
|
print '<td>'.$langs->trans("Company").'</td><td colspan="3">';
|
||||||
|
if ($projet->societe->id) print $projet->societe->getNomUrl(1);
|
||||||
|
else print ' ';
|
||||||
|
print '</td></tr>';
|
||||||
|
|
||||||
|
// Date start
|
||||||
|
print '<tr><td>'.$langs->trans("DateStart").'</td><td colspan="3">';
|
||||||
|
print dol_print_date($task->date_start,'day');
|
||||||
|
print '</td></tr>';
|
||||||
|
|
||||||
|
// Date end
|
||||||
|
print '<tr><td>'.$langs->trans("DateEnd").'</td><td colspan="3">';
|
||||||
|
print dol_print_date($task->date_end,'day');
|
||||||
|
print '</td></tr>';
|
||||||
|
|
||||||
|
// Progress
|
||||||
|
print '<tr><td>'.$langs->trans("Progress").'</td><td colspan="3">';
|
||||||
|
print $task->progress.' %';
|
||||||
|
print '</td></tr>';
|
||||||
|
|
||||||
|
// Description
|
||||||
|
print '<td>'.$langs->trans("Description").'</td><td colspan="3">';
|
||||||
|
print nl2br($task->description);
|
||||||
|
print '</td></tr>';
|
||||||
|
|
||||||
|
/* List of time spent */
|
||||||
|
|
||||||
|
$sql = "SELECT t.task_date, t.task_duration, t.fk_user, u.login, u.rowid";
|
||||||
|
$sql.= " FROM ".MAIN_DB_PREFIX."projet_task_time as t";
|
||||||
|
$sql.= ", ".MAIN_DB_PREFIX."user as u";
|
||||||
|
$sql.= " WHERE t.fk_task =".$task->id;
|
||||||
|
$sql.= " AND t.fk_user = u.rowid";
|
||||||
|
$sql.= " ORDER BY t.task_date DESC";
|
||||||
|
|
||||||
|
$var=true;
|
||||||
|
$resql = $db->query($sql);
|
||||||
|
if ($resql)
|
||||||
|
{
|
||||||
|
$num = $db->num_rows($resql);
|
||||||
|
$i = 0;
|
||||||
|
$tasks = array();
|
||||||
|
while ($i < $num)
|
||||||
|
{
|
||||||
|
$row = $db->fetch_object($resql);
|
||||||
|
$tasks[$i] = $row;
|
||||||
|
$i++;
|
||||||
|
}
|
||||||
|
$db->free($resql);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
dol_print_error($db);
|
||||||
|
}
|
||||||
|
|
||||||
|
print '</table></form>';
|
||||||
|
print '</div>';
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Actions
|
||||||
|
*/
|
||||||
|
print '<div class="tabsAction">';
|
||||||
|
|
||||||
|
// Modify
|
||||||
|
if ($user->rights->projet->creer)
|
||||||
|
{
|
||||||
|
print '<a class="butAction" href="'.$_SERVER['PHP_SELF'].'?id='.$task->id.'&action=edit">'.$langs->trans('Modify').'</a>';
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
print '<a class="butActionRefused" href="#" title="'.$langs->trans("NotAllowed").'">'.$langs->trans('Modify').'</a>';
|
||||||
|
}
|
||||||
|
|
||||||
|
// Delete
|
||||||
|
if ($user->rights->projet->supprimer)
|
||||||
|
{
|
||||||
|
print '<a class="butActionDelete" href="'.$_SERVER['PHP_SELF'].'?id='.$task->id.'&action=delete">'.$langs->trans('Delete').'</a>';
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
print '<a class="butActionRefused" href="#" title="'.$langs->trans("NotAllowed").'">'.$langs->trans('Delete').'</a>';
|
||||||
|
}
|
||||||
|
|
||||||
|
print '</div>';
|
||||||
}
|
}
|
||||||
else
|
|
||||||
{
|
|
||||||
dol_print_error($db);
|
|
||||||
}
|
|
||||||
|
|
||||||
print '</table></form>';
|
|
||||||
print '</div>';
|
|
||||||
|
|
||||||
|
|
||||||
/*
|
|
||||||
* Actions
|
|
||||||
*/
|
|
||||||
print '<div class="tabsAction">';
|
|
||||||
|
|
||||||
if ($user->rights->projet->supprimer)
|
|
||||||
{
|
|
||||||
print '<a class="butActionDelete" href="'.$_SERVER['PHP_SELF'].'?id='.$task->id.'&action=delete">'.$langs->trans('Delete').'</a>';
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
print '<a class="butActionRefused" href="#" title="'.$langs->trans("NotAllowed").'">'.$langs->trans('Delete').'</a>';
|
|
||||||
}
|
|
||||||
|
|
||||||
print '</div>';
|
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user