NEW Add option PROJECT_LINES_PERWEEK_SHOW_THIRDPARTY to show thirdparty

on page to submit time.
This commit is contained in:
Laurent Destailleur 2016-07-20 18:02:33 +02:00
parent 135bebd9a0
commit 699f857a5e
4 changed files with 30 additions and 6 deletions

View File

@ -744,8 +744,8 @@ function projectLinesPerDay(&$inc, $parent, $fuser, $lines, &$level, &$projectsr
*/
function projectLinesPerWeek(&$inc, $firstdaytoshow, $fuser, $parent, $lines, &$level, &$projectsrole, &$tasksrole, $mine, $restricteditformytask=1, $var=false)
{
global $db, $user, $bc, $langs;
global $form, $formother, $projectstatic, $taskstatic;
global $conf, $db, $user, $bc, $langs;
global $form, $formother, $projectstatic, $taskstatic, $thirdpartystatic;
$numlines=count($lines);
@ -791,12 +791,23 @@ function projectLinesPerWeek(&$inc, $firstdaytoshow, $fuser, $parent, $lines, &$
print "<tr ".$bc[$var].">\n";
if (! empty($conf->global->PROJECT_LINES_PERWEEK_SHOW_THIRDPARTY))
{
// Thirdparty
print '<td class="nowrap">';
$thirdpartystatic->id=$lines[$i]->socid;
$thirdpartystatic->name=$lines[$i]->thirdparty_name;
print $thirdpartystatic->getNomUrl(1, 'project', 10);
print '</td>';
}
// Project
print '<td class="nowrap">'.$var;
$projectstatic->id=$lines[$i]->fk_project;
$projectstatic->ref=$lines[$i]->projectref;
$projectstatic->title=$lines[$i]->projectlabel;
$projectstatic->public=$lines[$i]->public;
$projectstatic->thirdparty_name=$lines[$i]->thirdparty_name;
print $projectstatic->getNomUrl(1,'',0,$langs->transnoentitiesnoconv("YourRole").': '.$projectsrole[$lines[$i]->fk_project]);
print "</td>";

View File

@ -262,6 +262,7 @@ $formproject=new FormProjets($db);
$projectstatic=new Project($db);
$project = new Project($db);
$taskstatic = new Task($db);
$thirdpartystatic = new Societe($db);
$title=$langs->trans("TimeSpent");
if ($mine) $title=$langs->trans("MyTimeSpent");
@ -371,6 +372,10 @@ print '<div class="clearboth" style="padding-bottom: 8px;"></div>';
print '<table class="noborder" width="100%">';
print '<tr class="liste_titre">';
if (! empty($conf->global->PROJECT_LINES_PERWEEK_SHOW_THIRDPARTY))
{
print '<td>'.$langs->trans("ThirdParty").'</td>';
}
print '<td>'.$langs->trans("Project").'</td>';
print '<td>'.$langs->trans("RefTask").'</td>';
print '<td>'.$langs->trans("LabelTask").'</td>';

View File

@ -54,7 +54,10 @@ class Project extends CommonObject
var $date_start;
var $date_end;
var $date_close;
var $socid;
var $socid; // To store id of thirdparty
var $thirdparty_name; // To store name of thirdparty (defined only in some cases)
var $user_author_id; //!< Id of project creator. Not defined if shared project.
var $user_close_id;
var $public; //!< Tell if this is a public or private project
@ -893,6 +896,8 @@ class Project extends CommonObject
$label .= ($label?'<br>':'').'<b>' . $langs->trans('Ref') . ': </b>' . $this->ref; // The space must be after the : to not being explode when showing the title in img_picto
if (! empty($this->title))
$label .= ($label?'<br>':'').'<b>' . $langs->trans('Label') . ': </b>' . $this->title; // The space must be after the : to not being explode when showing the title in img_picto
if (! empty($this->thirdparty_name))
$label .= ($label?'<br>':'').'<b>' . $langs->trans('ThirdParty') . ': </b>' . $this->thirdparty_name; // The space must be after the : to not being explode when showing the title in img_picto
if (! empty($this->dateo))
$label .= ($label?'<br>':'').'<b>' . $langs->trans('DateStart') . ': </b>' . dol_print_date($this->dateo, 'day'); // The space must be after the : to not being explode when showing the title in img_picto
if (! empty($this->datee))

View File

@ -573,10 +573,12 @@ class Task extends CommonObject
// List of tasks (does not care about permissions. Filtering will be done later)
$sql = "SELECT p.rowid as projectid, p.ref, p.title as plabel, p.public, p.fk_statut as projectstatus,";
$sql.= " t.rowid as taskid, t.ref as taskref, t.label, t.description, t.fk_task_parent, t.duration_effective, t.progress, t.fk_statut as status,";
$sql.= " t.dateo as date_start, t.datee as date_end, t.planned_workload, t.rang";
$sql.= " t.dateo as date_start, t.datee as date_end, t.planned_workload, t.rang,";
$sql.= " s.nom as thirdparty_name";
$sql.= " FROM ".MAIN_DB_PREFIX."projet as p";
$sql.= " LEFT JOIN ".MAIN_DB_PREFIX."societe as s ON p.fk_soc = s.rowid";
if ($mode == 0)
{
$sql.= " FROM ".MAIN_DB_PREFIX."projet as p";
if ($filteronprojuser > 0)
{
$sql.= ", ".MAIN_DB_PREFIX."element_contact as ec";
@ -593,7 +595,6 @@ class Task extends CommonObject
}
elseif ($mode == 1)
{
$sql.= " FROM ".MAIN_DB_PREFIX."projet as p";
if ($filteronprojuser > 0)
{
$sql.= ", ".MAIN_DB_PREFIX."element_contact as ec";
@ -689,6 +690,8 @@ class Task extends CommonObject
$tasks[$i]->date_start = $this->db->jdate($obj->date_start);
$tasks[$i]->date_end = $this->db->jdate($obj->date_end);
$tasks[$i]->rang = $obj->rang;
$tasks[$i]->thirdparty_name = $obj->thirdparty_name;
}
$i++;