mirror of
https://github.com/Dolibarr/dolibarr.git
synced 2025-02-20 13:46:52 +01:00
FIX missing "multidir_output" for project sharing (Multicompany)
This commit is contained in:
parent
7fbfbae366
commit
7a12ba9c20
|
|
@ -2813,7 +2813,7 @@ function dol_check_secure_access_document($modulepart, $original_file, $entity,
|
|||
}
|
||||
$original_file = $conf->commande->multidir_output[$entity].'/'.$original_file;
|
||||
$sqlprotectagainstexternals = "SELECT fk_soc as fk_soc FROM ".MAIN_DB_PREFIX."commande WHERE ref='".$db->escape($refname)."' AND entity IN (".getEntity('order').")";
|
||||
} elseif ($modulepart == 'project' && !empty($conf->project->dir_output)) {
|
||||
} elseif ($modulepart == 'project' && !empty($conf->project->multidir_output[$entity])) {
|
||||
// Wrapping pour les projets
|
||||
if ($fuser->rights->projet->{$lire} || preg_match('/^specimen/i', $original_file)) {
|
||||
$accessallowed = 1;
|
||||
|
|
@ -2825,9 +2825,9 @@ function dol_check_secure_access_document($modulepart, $original_file, $entity,
|
|||
$accessallowed = checkUserAccessToObject($user, array('projet'), $tmpproject->id, 'projet&project', '', '', 'rowid', '');
|
||||
}
|
||||
}
|
||||
$original_file = $conf->project->dir_output.'/'.$original_file;
|
||||
$original_file = $conf->project->multidir_output[$entity].'/'.$original_file;
|
||||
$sqlprotectagainstexternals = "SELECT fk_soc as fk_soc FROM ".MAIN_DB_PREFIX."projet WHERE ref='".$db->escape($refname)."' AND entity IN (".getEntity('project').")";
|
||||
} elseif ($modulepart == 'project_task' && !empty($conf->project->dir_output)) {
|
||||
} elseif ($modulepart == 'project_task' && !empty($conf->project->multidir_output[$entity])) {
|
||||
if ($fuser->rights->projet->{$lire} || preg_match('/^specimen/i', $original_file)) {
|
||||
$accessallowed = 1;
|
||||
// If we known $id of project, call checkUserAccessToObject to check permission on properties and contact of project
|
||||
|
|
@ -2838,7 +2838,7 @@ function dol_check_secure_access_document($modulepart, $original_file, $entity,
|
|||
$accessallowed = checkUserAccessToObject($user, array('projet_task'), $tmptask->id, 'projet_task&project', '', '', 'rowid', '');
|
||||
}
|
||||
}
|
||||
$original_file = $conf->project->dir_output.'/'.$original_file;
|
||||
$original_file = $conf->project->multidir_output[$entity].'/'.$original_file;
|
||||
$sqlprotectagainstexternals = "SELECT fk_soc as fk_soc FROM ".MAIN_DB_PREFIX."projet WHERE ref='".$db->escape($refname)."' AND entity IN (".getEntity('project').")";
|
||||
} elseif (($modulepart == 'commande_fournisseur' || $modulepart == 'order_supplier') && !empty($conf->fournisseur->commande->dir_output)) {
|
||||
// Wrapping pour les commandes fournisseurs
|
||||
|
|
|
|||
|
|
@ -275,7 +275,7 @@ function project_prepare_head(Project $project, $moreparam = '')
|
|||
} else {
|
||||
require_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/core/class/link.class.php';
|
||||
$upload_dir = $conf->project->dir_output."/".dol_sanitizeFileName($project->ref);
|
||||
$upload_dir = $conf->project->multidir_output[$project->entity]."/".dol_sanitizeFileName($project->ref);
|
||||
$nbFiles = count(dol_dir_list($upload_dir, 'files', 0, '', '(\.meta|_preview.*\.png)$'));
|
||||
$nbLinks = Link::count($db, $project->element, $project->id);
|
||||
$totalAttached = $nbFiles + $nbLinks;
|
||||
|
|
@ -401,7 +401,7 @@ function task_prepare_head($object)
|
|||
}
|
||||
|
||||
$head[$h][0] = DOL_URL_ROOT.'/projet/tasks/document.php?id='.$object->id.(GETPOST('withproject') ? '&withproject=1' : '');
|
||||
$filesdir = $conf->project->dir_output."/".dol_sanitizeFileName($object->project->ref).'/'.dol_sanitizeFileName($object->ref);
|
||||
$filesdir = $conf->project->multidir_output[$object->entity]."/".dol_sanitizeFileName($object->project->ref).'/'.dol_sanitizeFileName($object->ref);
|
||||
include_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php';
|
||||
include_once DOL_DOCUMENT_ROOT.'/core/class/link.class.php';
|
||||
$nbFiles = count(dol_dir_list($filesdir, 'files', 0, '', '(\.meta|_preview.*\.png)$'));
|
||||
|
|
|
|||
|
|
@ -195,11 +195,11 @@ class pdf_baleine extends ModelePDFProjects
|
|||
// Load traductions files required by page
|
||||
$outputlangs->loadLangs(array("main", "dict", "companies", "projects"));
|
||||
|
||||
if ($conf->project->dir_output) {
|
||||
if ($conf->project->multidir_output[$object->entity]) {
|
||||
//$nblines = count($object->lines); // This is set later with array of tasks
|
||||
|
||||
$objectref = dol_sanitizeFileName($object->ref);
|
||||
$dir = $conf->project->dir_output;
|
||||
$dir = $conf->project->multidir_output[$object->entity];
|
||||
if (!preg_match('/specimen/i', $objectref)) {
|
||||
$dir .= "/".$objectref;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -242,11 +242,11 @@ class pdf_beluga extends ModelePDFProjects
|
|||
// Load traductions files required by page
|
||||
$outputlangs->loadLangs(array("main", "dict", "companies", "projects"));
|
||||
|
||||
if ($conf->project->dir_output) {
|
||||
if ($conf->project->multidir_output[$object->entity]) {
|
||||
//$nblines = count($object->lines); // This is set later with array of tasks
|
||||
|
||||
$objectref = dol_sanitizeFileName($object->ref);
|
||||
$dir = $conf->project->dir_output;
|
||||
$dir = $conf->project->multidir_output[$object->entity];
|
||||
if (!preg_match('/specimen/i', $objectref)) {
|
||||
$dir .= "/".$objectref;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -195,11 +195,11 @@ class pdf_timespent extends ModelePDFProjects
|
|||
// Load traductions files required by page
|
||||
$outputlangs->loadLangs(array("main", "dict", "companies", "projects"));
|
||||
|
||||
if ($conf->project->dir_output) {
|
||||
if ($conf->project->multidir_output[$object->entity]) {
|
||||
//$nblines = count($object->lines); // This is set later with array of tasks
|
||||
|
||||
$objectref = dol_sanitizeFileName($object->ref);
|
||||
$dir = $conf->project->dir_output;
|
||||
$dir = $conf->project->multidir_output[$object->entity];
|
||||
if (!preg_match('/specimen/i', $objectref)) {
|
||||
$dir .= "/".$objectref;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -390,7 +390,7 @@ if (empty($reshook)) {
|
|||
require_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php';
|
||||
|
||||
$langs->load("other");
|
||||
$upload_dir = $conf->project->dir_output;
|
||||
$upload_dir = $conf->project->multidir_output[$object->entity];
|
||||
$file = $upload_dir.'/'.GETPOST('file');
|
||||
$ret = dol_delete_file($file, 0, 0, 0, $object);
|
||||
if ($ret) {
|
||||
|
|
@ -1402,12 +1402,12 @@ if ($action == 'create' && $user->rights->projet->creer) {
|
|||
* Generated documents
|
||||
*/
|
||||
$filename = dol_sanitizeFileName($object->ref);
|
||||
$filedir = $conf->project->dir_output."/".dol_sanitizeFileName($object->ref);
|
||||
$filedir = $conf->project->multidir_output[$object->entity]."/".dol_sanitizeFileName($object->ref);
|
||||
$urlsource = $_SERVER["PHP_SELF"]."?id=".$object->id;
|
||||
$genallowed = ($user->rights->projet->lire && $userAccess > 0);
|
||||
$delallowed = ($user->rights->projet->creer && $userWrite > 0);
|
||||
|
||||
print $formfile->showdocuments('project', $filename, $filedir, $urlsource, $genallowed, $delallowed, $object->model_pdf);
|
||||
print $formfile->showdocuments('project', $filename, $filedir, $urlsource, $genallowed, $delallowed, $object->model_pdf, 1, 0, 0, 0, 0, '', '', '', '', '', $object);
|
||||
|
||||
print '</div><div class="fichehalfright">';
|
||||
|
||||
|
|
@ -1426,7 +1426,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;
|
||||
|
||||
|
|
|
|||
|
|
@ -274,6 +274,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,";
|
||||
|
|
@ -318,6 +319,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;
|
||||
|
|
|
|||
|
|
@ -49,7 +49,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
|
||||
|
|
@ -109,7 +109,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');
|
||||
|
|
|
|||
|
|
@ -110,7 +110,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';
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user