';
@@ -1629,7 +1620,7 @@ if ($action == 'create' && $user->rights->projet->creer) {
// Presend form
$modelmail = 'project';
$defaulttopic = 'SendProjectRef';
- $diroutput = $conf->project->dir_output;
+ $diroutput = $conf->project->multidir_output[$object->entity];
$autocopy = 'MAIN_MAIL_AUTOCOPY_PROJECT_TO'; // used to know the automatic BCC to add
$trackid = 'proj'.$object->id;
diff --git a/htdocs/projet/class/project.class.php b/htdocs/projet/class/project.class.php
index b3c0c142f7a..9f00d4ce3c0 100644
--- a/htdocs/projet/class/project.class.php
+++ b/htdocs/projet/class/project.class.php
@@ -1422,6 +1422,7 @@ class Project extends CommonObject
// Initialise parameters
$this->id = 0;
$this->ref = 'SPECIMEN';
+ $this->entity = $conf->entity;
$this->specimen = 1;
$this->socid = 1;
$this->date_c = $now;
diff --git a/htdocs/projet/class/task.class.php b/htdocs/projet/class/task.class.php
index b8821fbd486..fe00eb671d9 100644
--- a/htdocs/projet/class/task.class.php
+++ b/htdocs/projet/class/task.class.php
@@ -203,7 +203,7 @@ class Task extends CommonObjectLine
$sql .= ", progress";
$sql .= ", budget_amount";
$sql .= ") VALUES (";
- $sql .= ((int) $conf->entity);
+ $sql .= (!empty($this->entity) ? (int) $this->entity : (int) $conf->entity);
$sql .= ", ".((int) $this->fk_project);
$sql .= ", ".(!empty($this->ref) ? "'".$this->db->escape($this->ref)."'" : 'null');
$sql .= ", ".((int) $this->fk_task_parent);
@@ -279,6 +279,7 @@ class Task extends CommonObjectLine
$sql = "SELECT";
$sql .= " t.rowid,";
$sql .= " t.ref,";
+ $sql .= " t.entity,";
$sql .= " t.fk_projet as fk_project,";
$sql .= " t.fk_task_parent,";
$sql .= " t.label,";
@@ -323,6 +324,7 @@ class Task extends CommonObjectLine
$this->id = $obj->rowid;
$this->ref = $obj->ref;
+ $this->entity = $obj->entity;
$this->fk_project = $obj->fk_project;
$this->fk_task_parent = $obj->fk_task_parent;
$this->label = $obj->label;
diff --git a/htdocs/projet/contact.php b/htdocs/projet/contact.php
index 43fdb1a3ca2..b0fece54827 100644
--- a/htdocs/projet/contact.php
+++ b/htdocs/projet/contact.php
@@ -247,6 +247,10 @@ if (empty($reshook)) {
* View
*/
+$form = new Form($db);
+$contactstatic = new Contact($db);
+$userstatic = new User($db);
+
$title = $langs->trans('ProjectContact').' - '.$object->ref.' '.$object->name;
if (!empty($conf->global->MAIN_HTML_TITLE) && preg_match('/projectnameonly/', $conf->global->MAIN_HTML_TITLE) && $object->name) {
$title = $object->ref.' '.$object->name.' - '.$langs->trans('ProjectContact');
@@ -256,18 +260,12 @@ $help_url = 'EN:Module_Projects|FR:Module_Projets|ES:Módulo_Proyectos|DE:
llxHeader('', $title, $help_url);
-$form = new Form($db);
-$contactstatic = new Contact($db);
-$userstatic = new User($db);
-/* *************************************************************************** */
-/* */
-/* Edition and view mode */
-/* */
-/* *************************************************************************** */
-
if ($id > 0 || !empty($ref)) {
+ /*
+ * View
+ */
if (!empty($conf->global->PROJECT_ALLOW_COMMENT_ON_PROJECT) && method_exists($object, 'fetchComments') && empty($object->comments)) {
$object->fetchComments();
}
@@ -300,10 +298,11 @@ if ($id > 0 || !empty($ref)) {
$morehtmlref = '
';
// Title
- $morehtmlref .= $object->title;
+ $morehtmlref .= dol_escape_htmltag($object->title);
+ $morehtmlref .= '
';
// Thirdparty
if (!empty($object->thirdparty->id) && $object->thirdparty->id > 0) {
- $morehtmlref .= '
'.$object->thirdparty->getNomUrl(1, 'project');
+ $morehtmlref .= $object->thirdparty->getNomUrl(1, 'project');
}
$morehtmlref .= '
';
@@ -365,26 +364,25 @@ if ($id > 0 || !empty($ref)) {
}
print '';
- if (!empty($conf->global->PROJECT_USE_OPPORTUNITIES) && $object->opp_status) {
+ if (!empty($conf->global->PROJECT_USE_OPPORTUNITIES) && !empty($object->usage_opportunity)) {
// Opportunity status
print '
| '.$langs->trans("OpportunityStatus").' | ';
$code = dol_getIdFromCode($db, $object->opp_status, 'c_lead_status', 'rowid', 'code');
if ($code) {
print $langs->trans("OppStatus".$code);
}
- print ' |
';
// Opportunity percent
- print '
| '.$langs->trans("OpportunityProbability").' | ';
+ print ' / ';
if (strcmp($object->opp_percent, '')) {
- print price($object->opp_percent, '', $langs, 1, 0).' %';
+ print price($object->opp_percent, 0, $langs, 1, 0).' %';
}
- print ' |
';
+ print '';
// Opportunity Amount
print '
| '.$langs->trans("OpportunityAmount").' | ';
if (strcmp($object->opp_amount, '')) {
- print ''.price($object->opp_amount, '', $langs, 0, 0, 0, $conf->currency).'';
+ print ''.price($object->opp_amount, 0, $langs, 1, 0, -1, $conf->currency).'';
if (strcmp($object->opp_percent, '')) {
print ' '.$langs->trans("Weighted").': '.price($object->opp_amount * $object->opp_percent / 100, 0, $langs, 1, 0, -1, $conf->currency).'';
}
@@ -395,7 +393,7 @@ if ($id > 0 || !empty($ref)) {
// Budget
print ' |
| '.$langs->trans("Budget").' | ';
if (!is_null($object->budget_amount) && strcmp($object->budget_amount, '')) {
- print ''.price($object->budget_amount, '', $langs, 0, 0, 0, $conf->currency).'';
+ print ''.price($object->budget_amount, 0, $langs, 1, 0, 0, $conf->currency).'';
}
print ' |
';
@@ -404,7 +402,7 @@ if ($id > 0 || !empty($ref)) {
$start = dol_print_date($object->date_start, 'day');
print ($start ? $start : '?');
$end = dol_print_date($object->date_end, 'day');
- print ' - ';
+ print '
- ';
print ($end ? $end : '?');
if ($object->hasDelay()) {
print img_warning("Late");
@@ -425,7 +423,7 @@ if ($id > 0 || !empty($ref)) {
// Description
print '
'.$langs->trans("Description").' | ';
- print nl2br($object->description);
+ print dol_htmlentitiesbr($object->description);
print ' | ';
// Categories
diff --git a/htdocs/projet/document.php b/htdocs/projet/document.php
index bb50bf0def6..4e7620476c4 100644
--- a/htdocs/projet/document.php
+++ b/htdocs/projet/document.php
@@ -50,7 +50,7 @@ if (!empty($conf->global->PROJECT_ALLOW_COMMENT_ON_PROJECT) && method_exists($ob
}
if ($id > 0 || !empty($ref)) {
- $upload_dir = $conf->project->dir_output."/".dol_sanitizeFileName($object->ref);
+ $upload_dir = $conf->project->multidir_output[$object->entity]."/".dol_sanitizeFileName($object->ref);
}
// Get parameters
@@ -110,7 +110,7 @@ llxHeader('', $title, $help_url);
$form = new Form($db);
if ($object->id > 0) {
- $upload_dir = $conf->project->dir_output.'/'.dol_sanitizeFileName($object->ref);
+ $upload_dir = $conf->project->multidir_output[$object->entity].'/'.dol_sanitizeFileName($object->ref);
// To verify role of users
//$userAccess = $object->restrictedProjectArea($user,'read');
diff --git a/htdocs/projet/element.php b/htdocs/projet/element.php
index 3dcbbbbcddf..a737ffce640 100644
--- a/htdocs/projet/element.php
+++ b/htdocs/projet/element.php
@@ -341,7 +341,7 @@ print '
';
// Description
print '| '.$langs->trans("Description").' | ';
-print nl2br($object->description);
+print dol_htmlentitiesbr($object->description);
print ' | ';
// Categories
diff --git a/htdocs/projet/tasks.php b/htdocs/projet/tasks.php
index 9e448b6cf45..f0f98e3df6c 100644
--- a/htdocs/projet/tasks.php
+++ b/htdocs/projet/tasks.php
@@ -344,6 +344,7 @@ if ($action == 'createtask' && $user->rights->projet->creer) {
$task = new Task($db);
$task->fk_project = $projectid;
+ $task->entity = $object->entity; // Task have the same entity of project
$task->ref = $taskref;
$task->label = $label;
$task->description = $description;
@@ -668,7 +669,7 @@ if ($id > 0 || !empty($ref)) {
// Description
print ''.$langs->trans("Description").' | ';
- print nl2br($object->description);
+ print dol_htmlentitiesbr($object->description);
print ' | ';
// Categories
diff --git a/htdocs/projet/tasks/document.php b/htdocs/projet/tasks/document.php
index 6a62e973a62..b8c6fd863c5 100644
--- a/htdocs/projet/tasks/document.php
+++ b/htdocs/projet/tasks/document.php
@@ -111,7 +111,7 @@ if ($id > 0 || !empty($ref)) {
$object->project = clone $projectstatic;
- $upload_dir = $conf->project->dir_output.'/'.dol_sanitizeFileName($projectstatic->ref).'/'.dol_sanitizeFileName($object->ref);
+ $upload_dir = $conf->project->multidir_output[$projectstatic->entity].'/'.dol_sanitizeFileName($projectstatic->ref).'/'.dol_sanitizeFileName($object->ref);
}
include DOL_DOCUMENT_ROOT.'/core/actions_linkedfiles.inc.php';
diff --git a/htdocs/projet/tasks/time.php b/htdocs/projet/tasks/time.php
index fe7d2a093fd..12eb7c573ce 100644
--- a/htdocs/projet/tasks/time.php
+++ b/htdocs/projet/tasks/time.php
@@ -1051,7 +1051,7 @@ if (($id > 0 || !empty($ref)) || $projectidforalltimes > 0 || $allprojectforuser
// Description
print ''.$langs->trans("Description").' | ';
- print nl2br($projectstatic->description);
+ print dol_htmlentitiesbr($projectstatic->description);
print ' | ';
// Categories