diff --git a/htdocs/core/lib/project.lib.php b/htdocs/core/lib/project.lib.php index 602f45db67d..925dba1fd67 100644 --- a/htdocs/core/lib/project.lib.php +++ b/htdocs/core/lib/project.lib.php @@ -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 "\n"; + if (! empty($conf->global->PROJECT_LINES_PERWEEK_SHOW_THIRDPARTY)) + { + // Thirdparty + print ''; + $thirdpartystatic->id=$lines[$i]->socid; + $thirdpartystatic->name=$lines[$i]->thirdparty_name; + print $thirdpartystatic->getNomUrl(1, 'project', 10); + print ''; + } + // Project print ''.$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 ""; diff --git a/htdocs/projet/activity/perweek.php b/htdocs/projet/activity/perweek.php index 53b9ba151b4..13d3610b0cc 100644 --- a/htdocs/projet/activity/perweek.php +++ b/htdocs/projet/activity/perweek.php @@ -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 '
'; print ''; print ''; +if (! empty($conf->global->PROJECT_LINES_PERWEEK_SHOW_THIRDPARTY)) +{ + print ''; +} print ''; print ''; print ''; diff --git a/htdocs/projet/class/project.class.php b/htdocs/projet/class/project.class.php index ef4d4d7d20f..8791028beda 100644 --- a/htdocs/projet/class/project.class.php +++ b/htdocs/projet/class/project.class.php @@ -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?'
':'').'' . $langs->trans('Ref') . ': ' . $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?'
':'').'' . $langs->trans('Label') . ': ' . $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?'
':'').'' . $langs->trans('ThirdParty') . ': ' . $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?'
':'').'' . $langs->trans('DateStart') . ': ' . 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)) diff --git a/htdocs/projet/class/task.class.php b/htdocs/projet/class/task.class.php index 631b2684246..40b5667c9c0 100644 --- a/htdocs/projet/class/task.class.php +++ b/htdocs/projet/class/task.class.php @@ -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++;
'.$langs->trans("ThirdParty").''.$langs->trans("Project").''.$langs->trans("RefTask").''.$langs->trans("LabelTask").'