Fix: use "multidir_output" instead "dir_output"

This commit is contained in:
Regis Houssin 2018-02-25 17:43:19 +01:00
parent 003827eb06
commit 093ea49cc6
16 changed files with 55 additions and 49 deletions

View File

@ -631,7 +631,7 @@ print "<tr class=\"liste_titre\">\n";
print " <td>".$langs->trans("Name")."</td>\n"; print " <td>".$langs->trans("Name")."</td>\n";
print " <td>".$langs->trans("Value")."</td>\n"; print " <td>".$langs->trans("Value")."</td>\n";
print "</tr>\n"; print "</tr>\n";
print "<tr ".$bc[false].">\n <td width=\"140\">".$langs->trans("PathDirectory")."</td>\n <td>".$conf->propal->dir_output."</td>\n</tr>\n"; print "<tr ".$bc[false].">\n <td width=\"140\">".$langs->trans("PathDirectory")."</td>\n <td>".$conf->propal->multidir_output[$conf->entity]."</td>\n</tr>\n";
print "</table>\n<br>"; print "</table>\n<br>";

View File

@ -306,7 +306,7 @@ class Documents extends DolibarrApi
throw new RestException(404, 'Proposal not found'); throw new RestException(404, 'Proposal not found');
} }
$upload_dir = $conf->propal->dir_output . "/" . get_exdir(0, 0, 0, 1, $object, 'propal'); $upload_dir = $conf->propal->multidir_output[$object->entity] . "/" . get_exdir(0, 0, 0, 1, $object, 'propal');
} }
else if ($modulepart == 'commande' || $modulepart == 'order') else if ($modulepart == 'commande' || $modulepart == 'order')
{ {

View File

@ -676,8 +676,8 @@ if (! empty($conf->propal->enabled) && $user->rights->propal->lire)
{ {
$langs->load("propal"); $langs->load("propal");
$sql = "SELECT s.nom as name, s.rowid, p.rowid as propalid, p.total as total_ttc, p.total_ht, p.tva as total_tva, p.ref, p.ref_client, p.fk_statut, p.datep as dp, p.fin_validite as dfv"; $sql = "SELECT s.nom as name, s.rowid, s.code_client";
$sql.= ", s.code_client"; $sql.= ", p.rowid as propalid, p.entity, p.total as total_ttc, p.total_ht, p.tva as total_tva, p.ref, p.ref_client, p.fk_statut, p.datep as dp, p.fin_validite as dfv";
$sql.= " FROM ".MAIN_DB_PREFIX."societe as s"; $sql.= " FROM ".MAIN_DB_PREFIX."societe as s";
$sql.= ", ".MAIN_DB_PREFIX."propal as p"; $sql.= ", ".MAIN_DB_PREFIX."propal as p";
if (! $user->rights->societe->client->voir && ! $socid) $sql.= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc"; if (! $user->rights->societe->client->voir && ! $socid) $sql.= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc";
@ -726,7 +726,7 @@ if (! empty($conf->propal->enabled) && $user->rights->propal->lire)
print '</td>'; print '</td>';
print '<td width="16" align="center" class="nobordernopadding">'; print '<td width="16" align="center" class="nobordernopadding">';
$filename=dol_sanitizeFileName($obj->ref); $filename=dol_sanitizeFileName($obj->ref);
$filedir=$conf->propal->dir_output . '/' . dol_sanitizeFileName($obj->ref); $filedir=$conf->propal->multidir_output[$obj->entity] . '/' . dol_sanitizeFileName($obj->ref);
$urlsource=$_SERVER['PHP_SELF'].'?id='.$obj->propalid; $urlsource=$_SERVER['PHP_SELF'].'?id='.$obj->propalid;
print $formfile->getDocumentsLink($propalstatic->element, $filename, $filedir); print $formfile->getDocumentsLink($propalstatic->element, $filename, $filedir);
print '</td></tr></table>'; print '</td></tr></table>';

View File

@ -1292,7 +1292,7 @@ if (empty($reshook))
} }
// Actions to build doc // Actions to build doc
$upload_dir = $conf->propal->dir_output; $upload_dir = $conf->propal->multidir_output[$object->entity];
$permissioncreate=$user->rights->propal->creer; $permissioncreate=$user->rights->propal->creer;
include DOL_DOCUMENT_ROOT.'/core/actions_builddoc.inc.php'; include DOL_DOCUMENT_ROOT.'/core/actions_builddoc.inc.php';
@ -2425,7 +2425,7 @@ if ($action == 'create')
* Documents generes * Documents generes
*/ */
$filename = dol_sanitizeFileName($object->ref); $filename = dol_sanitizeFileName($object->ref);
$filedir = $conf->propal->dir_output . "/" . dol_sanitizeFileName($object->ref); $filedir = $conf->propal->multidir_output[$object->entity] . "/" . dol_sanitizeFileName($object->ref);
$urlsource = $_SERVER["PHP_SELF"] . "?id=" . $object->id; $urlsource = $_SERVER["PHP_SELF"] . "?id=" . $object->id;
$genallowed = $user->rights->propal->lire; $genallowed = $user->rights->propal->lire;
$delallowed = $user->rights->propal->creer; $delallowed = $user->rights->propal->creer;
@ -2466,7 +2466,7 @@ if ($action == 'create')
// Presend form // Presend form
$modelmail='propal_send'; $modelmail='propal_send';
$defaulttopic='SendPropalRef'; $defaulttopic='SendPropalRef';
$diroutput = $conf->propal->dir_output; $diroutput = $conf->propal->multidir_output[$object->entity];
$trackid = 'pro'.$object->id; $trackid = 'pro'.$object->id;
include DOL_DOCUMENT_ROOT.'/core/tpl/card_presend.tpl.php'; include DOL_DOCUMENT_ROOT.'/core/tpl/card_presend.tpl.php';

View File

@ -1749,8 +1749,8 @@ class Propal extends CommonObject
// to not lose the linked files // to not lose the linked files
$oldref = dol_sanitizeFileName($this->ref); $oldref = dol_sanitizeFileName($this->ref);
$newref = dol_sanitizeFileName($num); $newref = dol_sanitizeFileName($num);
$dirsource = $conf->propal->dir_output.'/'.$oldref; $dirsource = $conf->propal->multidir_output[$this->entity].'/'.$oldref;
$dirdest = $conf->propal->dir_output.'/'.$newref; $dirdest = $conf->propal->multidir_output[$this->entity].'/'.$newref;
if (file_exists($dirsource)) if (file_exists($dirsource))
{ {
@ -1759,7 +1759,7 @@ class Propal extends CommonObject
{ {
dol_syslog("Rename ok"); dol_syslog("Rename ok");
// Rename docs starting with $oldref with $newref // Rename docs starting with $oldref with $newref
$listoffiles=dol_dir_list($conf->propal->dir_output.'/'.$newref, 'files', 1, '^'.preg_quote($oldref,'/')); $listoffiles=dol_dir_list($dirdest, 'files', 1, '^'.preg_quote($oldref,'/'));
foreach($listoffiles as $fileentry) foreach($listoffiles as $fileentry)
{ {
$dirsource=$fileentry['name']; $dirsource=$fileentry['name'];
@ -2815,9 +2815,9 @@ class Propal extends CommonObject
{ {
// We remove directory // We remove directory
$ref = dol_sanitizeFileName($this->ref); $ref = dol_sanitizeFileName($this->ref);
if ($conf->propal->dir_output && !empty($this->ref)) if ($conf->propal->multidir_output[$this->entity] && !empty($this->ref))
{ {
$dir = $conf->propal->dir_output . "/" . $ref ; $dir = $conf->propal->multidir_output[$this->entity] . "/" . $ref ;
$file = $dir . "/" . $ref . ".pdf"; $file = $dir . "/" . $ref . ".pdf";
if (file_exists($file)) if (file_exists($file))
{ {

View File

@ -75,7 +75,7 @@ $object->fetch($id,$ref);
if ($object->id > 0) if ($object->id > 0)
{ {
$object->fetch_thirdparty(); $object->fetch_thirdparty();
$upload_dir = $conf->propal->dir_output.'/'.dol_sanitizeFileName($object->ref); $upload_dir = $conf->propal->multidir_output[$object->entity].'/'.dol_sanitizeFileName($object->ref);
include_once DOL_DOCUMENT_ROOT . '/core/actions_linkedfiles.inc.php'; include_once DOL_DOCUMENT_ROOT . '/core/actions_linkedfiles.inc.php';
} }
@ -90,7 +90,7 @@ $form = new Form($db);
if ($object->id > 0) if ($object->id > 0)
{ {
$upload_dir = $conf->propal->dir_output.'/'.dol_sanitizeFileName($object->ref); $upload_dir = $conf->propal->multidir_output[$object->entity].'/'.dol_sanitizeFileName($object->ref);
$head = propal_prepare_head($object); $head = propal_prepare_head($object);
dol_fiche_head($head, 'document', $langs->trans('Proposal'), -1, 'propal'); dol_fiche_head($head, 'document', $langs->trans('Proposal'), -1, 'propal');

View File

@ -216,7 +216,7 @@ $max=5;
* Last modified proposals * Last modified proposals
*/ */
$sql = "SELECT c.rowid, c.ref, c.fk_statut, s.nom as socname, s.rowid as socid, s.canvas, s.client,"; $sql = "SELECT c.rowid, c.entity, c.ref, c.fk_statut, s.nom as socname, s.rowid as socid, s.canvas, s.client,";
$sql.= " date_cloture as datec"; $sql.= " date_cloture as datec";
$sql.= " FROM ".MAIN_DB_PREFIX."propal as c"; $sql.= " FROM ".MAIN_DB_PREFIX."propal as c";
$sql.= ", ".MAIN_DB_PREFIX."societe as s"; $sql.= ", ".MAIN_DB_PREFIX."societe as s";
@ -262,7 +262,7 @@ if ($resql)
print '<td width="16" align="right" class="nobordernopadding">'; print '<td width="16" align="right" class="nobordernopadding">';
$filename=dol_sanitizeFileName($obj->ref); $filename=dol_sanitizeFileName($obj->ref);
$filedir=$conf->propal->dir_output . '/' . dol_sanitizeFileName($obj->ref); $filedir=$conf->propal->multidir_output[$obj->entity] . '/' . dol_sanitizeFileName($obj->ref);
$urlsource=$_SERVER['PHP_SELF'].'?id='.$obj->rowid; $urlsource=$_SERVER['PHP_SELF'].'?id='.$obj->rowid;
print $formfile->getDocumentsLink($propalstatic->element, $filename, $filedir); print $formfile->getDocumentsLink($propalstatic->element, $filename, $filedir);
print '</td></tr></table>'; print '</td></tr></table>';
@ -296,7 +296,8 @@ if (! empty($conf->propal->enabled) && $user->rights->propale->lire)
$now=dol_now(); $now=dol_now();
$sql = "SELECT s.nom as socname, s.rowid as socid, s.canvas, s.client, p.rowid as propalid, p.total as total_ttc, p.total_ht, p.ref, p.fk_statut, p.datep as dp, p.fin_validite as dfv"; $sql = "SELECT s.nom as socname, s.rowid as socid, s.canvas, s.client";
$sql.= ", p.rowid as propalid, p.entity, p.total as total_ttc, p.total_ht, p.ref, p.fk_statut, p.datep as dp, p.fin_validite as dfv";
$sql.= " FROM ".MAIN_DB_PREFIX."societe as s"; $sql.= " FROM ".MAIN_DB_PREFIX."societe as s";
$sql.= ", ".MAIN_DB_PREFIX."propal as p"; $sql.= ", ".MAIN_DB_PREFIX."propal as p";
if (!$user->rights->societe->client->voir && !$socid) $sql.= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc"; if (!$user->rights->societe->client->voir && !$socid) $sql.= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc";
@ -341,7 +342,7 @@ if (! empty($conf->propal->enabled) && $user->rights->propale->lire)
print '</td>'; print '</td>';
print '<td width="16" align="center" class="nobordernopadding">'; print '<td width="16" align="center" class="nobordernopadding">';
$filename=dol_sanitizeFileName($obj->ref); $filename=dol_sanitizeFileName($obj->ref);
$filedir=$conf->propal->dir_output . '/' . dol_sanitizeFileName($obj->ref); $filedir=$conf->propal->multidir_output[$obj->entity] . '/' . dol_sanitizeFileName($obj->ref);
$urlsource=$_SERVER['PHP_SELF'].'?id='.$obj->propalid; $urlsource=$_SERVER['PHP_SELF'].'?id='.$obj->propalid;
print $formfile->getDocumentsLink($propalstatic->element, $filename, $filedir); print $formfile->getDocumentsLink($propalstatic->element, $filename, $filedir);
print '</td></tr></table>'; print '</td></tr></table>';

View File

@ -110,7 +110,7 @@ if (! empty($socid))
} }
$result = restrictedArea($user, $module, $objectid, $dbtable); $result = restrictedArea($user, $module, $objectid, $dbtable);
$diroutputmassaction=$conf->propal->dir_output . '/temp/massgeneration/'.$user->id; $diroutputmassaction=$conf->propal->multidir_output[$conf->entity] . '/temp/massgeneration/'.$user->id;
// Initialize technical object to manage hooks of page. Note that conf->hooks_modules contains array of hook context // Initialize technical object to manage hooks of page. Note that conf->hooks_modules contains array of hook context
$hookmanager->initHooks(array('propallist')); $hookmanager->initHooks(array('propallist'));
@ -214,7 +214,7 @@ if (empty($reshook))
$objectlabel='Proposals'; $objectlabel='Proposals';
$permtoread = $user->rights->propal->lire; $permtoread = $user->rights->propal->lire;
$permtodelete = $user->rights->propal->supprimer; $permtodelete = $user->rights->propal->supprimer;
$uploaddir = $conf->propal->dir_output; $uploaddir = $conf->propal->multidir_output[$conf->entity];
include DOL_DOCUMENT_ROOT.'/core/actions_massactions.inc.php'; include DOL_DOCUMENT_ROOT.'/core/actions_massactions.inc.php';
} }
@ -242,7 +242,7 @@ if ($sall || $search_product_category > 0) $sql = 'SELECT DISTINCT';
$sql.= ' s.rowid as socid, s.nom as name, s.email, s.town, s.zip, s.fk_pays, s.client, s.code_client, '; $sql.= ' s.rowid as socid, s.nom as name, s.email, s.town, s.zip, s.fk_pays, s.client, s.code_client, ';
$sql.= " typent.code as typent_code,"; $sql.= " typent.code as typent_code,";
$sql.= " state.code_departement as state_code, state.nom as state_name,"; $sql.= " state.code_departement as state_code, state.nom as state_name,";
$sql.= ' p.rowid, p.note_private, p.total_ht, p.tva as total_vat, p.total as total_ttc, p.localtax1, p.localtax2, p.ref, p.ref_client, p.fk_statut, p.fk_user_author, p.datep as dp, p.fin_validite as dfv,'; $sql.= ' p.rowid, p.entity, p.note_private, p.total_ht, p.tva as total_vat, p.total as total_ttc, p.localtax1, p.localtax2, p.ref, p.ref_client, p.fk_statut, p.fk_user_author, p.datep as dp, p.fin_validite as dfv,';
$sql.= ' p.datec as date_creation, p.tms as date_update,'; $sql.= ' p.datec as date_creation, p.tms as date_update,';
$sql.= " pr.rowid as project_id, pr.ref as project_ref,"; $sql.= " pr.rowid as project_id, pr.ref as project_ref,";
if (! $user->rights->societe->client->voir && ! $socid) $sql .= " sc.fk_soc, sc.fk_user,"; if (! $user->rights->societe->client->voir && ! $socid) $sql .= " sc.fk_soc, sc.fk_user,";
@ -663,7 +663,7 @@ if ($resql)
// Other picto tool // Other picto tool
print '<td width="16" align="right" class="nobordernopadding">'; print '<td width="16" align="right" class="nobordernopadding">';
$filename=dol_sanitizeFileName($obj->ref); $filename=dol_sanitizeFileName($obj->ref);
$filedir=$conf->propal->dir_output . '/' . dol_sanitizeFileName($obj->ref); $filedir=$conf->propal->multidir_output[$obj->entity] . '/' . dol_sanitizeFileName($obj->ref);
$urlsource=$_SERVER['PHP_SELF'].'?id='.$obj->rowid; $urlsource=$_SERVER['PHP_SELF'].'?id='.$obj->rowid;
print $formfile->getDocumentsLink($objectstatic->element, $filename, $filedir); print $formfile->getDocumentsLink($objectstatic->element, $filename, $filedir);
print '</td></tr></table>'; print '</td></tr></table>';

View File

@ -310,7 +310,7 @@ class Conf
// For user storage // For user storage
$this->user->multidir_output = array($this->entity => $rootfordata."/users"); $this->user->multidir_output = array($this->entity => $rootfordata."/users");
$this->user->multidir_temp = array($this->entity => $rootfordata."/users/temp"); $this->user->multidir_temp = array($this->entity => $rootfordata."/users/temp");
// For backward compatibility // For backward compatibility
$this->user->dir_output=$rootforuser."/users"; $this->user->dir_output=$rootforuser."/users";
$this->user->dir_temp=$rootforuser."/users/temp"; $this->user->dir_temp=$rootforuser."/users/temp";
@ -320,6 +320,9 @@ class Conf
$this->usergroup->dir_temp=$rootforuser."/usergroups/temp"; $this->usergroup->dir_temp=$rootforuser."/usergroups/temp";
// For propal storage // For propal storage
$this->propal->multidir_output = array($this->entity => $rootfordata."/propale");
$this->propal->multidir_temp = array($this->entity => $rootfordata."/propale/temp");
// For backward compatibility
$this->propal->dir_output=$rootfordata."/propale"; $this->propal->dir_output=$rootfordata."/propale";
$this->propal->dir_temp=$rootfordata."/propale/temp"; $this->propal->dir_temp=$rootfordata."/propale/temp";

View File

@ -299,6 +299,9 @@ class FormFile
return $this->getDocumentsLink($modulepart, $modulesubdir, $filedir); return $this->getDocumentsLink($modulepart, $modulesubdir, $filedir);
} }
// Add entity in $param
$param.= 'entity='.(!empty($object->entity)?$object->entity:$conf->entity);
$printer=0; $printer=0;
if (in_array($modulepart,array('facture','supplier_proposal','propal','proposal','order','commande','expedition', 'commande_fournisseur', 'expensereport'))) // The direct print feature is implemented only for such elements if (in_array($modulepart,array('facture','supplier_proposal','propal','proposal','order','commande','expedition', 'commande_fournisseur', 'expensereport'))) // The direct print feature is implemented only for such elements
{ {

View File

@ -392,13 +392,13 @@ class Notify
break; break;
case 'PROPAL_VALIDATE': case 'PROPAL_VALIDATE':
$link='/comm/propal/card.php?id='.$object->id; $link='/comm/propal/card.php?id='.$object->id;
$dir_output = $conf->propal->dir_output; $dir_output = $conf->propal->multidir_output[$object->entity];
$object_type = 'propal'; $object_type = 'propal';
$mesg = $langs->transnoentitiesnoconv("EMailTextProposalValidated",$newref); $mesg = $langs->transnoentitiesnoconv("EMailTextProposalValidated",$newref);
break; break;
case 'PROPAL_CLOSE_SIGNED': case 'PROPAL_CLOSE_SIGNED':
$link='/comm/propal/card.php?id='.$object->id; $link='/comm/propal/card.php?id='.$object->id;
$dir_output = $conf->propal->dir_output; $dir_output = $conf->propal->multidir_output[$object->entity];
$object_type = 'propal'; $object_type = 'propal';
$mesg = $langs->transnoentitiesnoconv("EMailTextProposalClosedSigned",$newref); $mesg = $langs->transnoentitiesnoconv("EMailTextProposalClosedSigned",$newref);
break; break;
@ -574,13 +574,13 @@ class Notify
break; break;
case 'PROPAL_VALIDATE': case 'PROPAL_VALIDATE':
$link='/comm/propal/card.php?id='.$object->id; $link='/comm/propal/card.php?id='.$object->id;
$dir_output = $conf->propal->dir_output; $dir_output = $conf->propal->multidir_output[$object->entity];
$object_type = 'propal'; $object_type = 'propal';
$mesg = $langs->transnoentitiesnoconv("EMailTextProposalValidated",$newref); $mesg = $langs->transnoentitiesnoconv("EMailTextProposalValidated",$newref);
break; break;
case 'PROPAL_CLOSE_SIGNED': case 'PROPAL_CLOSE_SIGNED':
$link='/comm/propal/card.php?id='.$object->id; $link='/comm/propal/card.php?id='.$object->id;
$dir_output = $conf->propal->dir_output; $dir_output = $conf->propal->multidir_output[$object->entity];
$object_type = 'propal'; $object_type = 'propal';
$mesg = $langs->transnoentitiesnoconv("EMailTextProposalClosedSigned",$newref); $mesg = $langs->transnoentitiesnoconv("EMailTextProposalClosedSigned",$newref);
break; break;

View File

@ -2147,10 +2147,10 @@ function dol_check_secure_access_document($modulepart, $original_file, $entity,
$original_file=$conf->facture->dir_output.'/'.$original_file; $original_file=$conf->facture->dir_output.'/'.$original_file;
} }
// Wrapping pour les apercu propal // Wrapping pour les apercu propal
elseif ($modulepart == 'apercupropal' && !empty($conf->propal->dir_output)) elseif ($modulepart == 'apercupropal' && !empty($conf->propal->multidir_output[$entity]))
{ {
if ($fuser->rights->propale->{$lire}) $accessallowed=1; if ($fuser->rights->propale->{$lire}) $accessallowed=1;
$original_file=$conf->propal->dir_output.'/'.$original_file; $original_file=$conf->propal->multidir_output[$entity].'/'.$original_file;
} }
// Wrapping pour les apercu commande // Wrapping pour les apercu commande
elseif ($modulepart == 'apercucommande' && !empty($conf->commande->dir_output)) elseif ($modulepart == 'apercucommande' && !empty($conf->commande->dir_output))
@ -2195,10 +2195,10 @@ function dol_check_secure_access_document($modulepart, $original_file, $entity,
$original_file=$conf->expensereport->dir_output.'/'.$original_file; $original_file=$conf->expensereport->dir_output.'/'.$original_file;
} }
// Wrapping pour les images des stats propales // Wrapping pour les images des stats propales
elseif ($modulepart == 'propalstats' && !empty($conf->propal->dir_temp)) elseif ($modulepart == 'propalstats' && !empty($conf->propal->multidir_temp[$entity]))
{ {
if ($fuser->rights->propale->{$lire}) $accessallowed=1; if ($fuser->rights->propale->{$lire}) $accessallowed=1;
$original_file=$conf->propal->dir_temp.'/'.$original_file; $original_file=$conf->propal->multidir_temp[$entity].'/'.$original_file;
} }
// Wrapping pour les images des stats commandes // Wrapping pour les images des stats commandes
elseif ($modulepart == 'orderstats' && !empty($conf->commande->dir_temp)) elseif ($modulepart == 'orderstats' && !empty($conf->commande->dir_temp))
@ -2362,13 +2362,13 @@ function dol_check_secure_access_document($modulepart, $original_file, $entity,
$sqlprotectagainstexternals = "SELECT fk_soc as fk_soc FROM ".MAIN_DB_PREFIX."facture WHERE ref='".$db->escape($refname)."' AND entity=".$conf->entity; $sqlprotectagainstexternals = "SELECT fk_soc as fk_soc FROM ".MAIN_DB_PREFIX."facture WHERE ref='".$db->escape($refname)."' AND entity=".$conf->entity;
} }
// Wrapping for mass actions // Wrapping for mass actions
else if ($modulepart == 'massfilesarea_proposals' && !empty($conf->propal->dir_output)) else if ($modulepart == 'massfilesarea_proposals' && !empty($conf->propal->multidir_output[$entity]))
{ {
if ($fuser->rights->propal->{$lire} || preg_match('/^specimen/i',$original_file)) if ($fuser->rights->propal->{$lire} || preg_match('/^specimen/i',$original_file))
{ {
$accessallowed=1; $accessallowed=1;
} }
$original_file=$conf->propal->dir_output.'/temp/massgeneration/'.$user->id.'/'.$original_file; $original_file=$conf->propal->multidir_output[$entity].'/temp/massgeneration/'.$user->id.'/'.$original_file;
} }
else if ($modulepart == 'massfilesarea_orders') else if ($modulepart == 'massfilesarea_orders')
{ {
@ -2402,7 +2402,7 @@ function dol_check_secure_access_document($modulepart, $original_file, $entity,
} }
$original_file=$conf->ficheinter->dir_output.'/temp/massgeneration/'.$user->id.'/'.$original_file; $original_file=$conf->ficheinter->dir_output.'/temp/massgeneration/'.$user->id.'/'.$original_file;
} }
else if ($modulepart == 'massfilesarea_supplier_proposal' && !empty($conf->propal->dir_output)) else if ($modulepart == 'massfilesarea_supplier_proposal' && !empty($conf->supplier_proposal->dir_output))
{ {
if ($fuser->rights->supplier_proposal->{$lire} || preg_match('/^specimen/i',$original_file)) if ($fuser->rights->supplier_proposal->{$lire} || preg_match('/^specimen/i',$original_file))
{ {
@ -2457,14 +2457,13 @@ function dol_check_secure_access_document($modulepart, $original_file, $entity,
//$sqlprotectagainstexternals = "SELECT fk_soc as fk_soc FROM ".MAIN_DB_PREFIX."fichinter WHERE ref='".$db->escape($refname)."' AND entity=".$conf->entity; //$sqlprotectagainstexternals = "SELECT fk_soc as fk_soc FROM ".MAIN_DB_PREFIX."fichinter WHERE ref='".$db->escape($refname)."' AND entity=".$conf->entity;
} }
// Wrapping pour les propales // Wrapping pour les propales
else if ($modulepart == 'propal' && !empty($conf->propal->dir_output)) else if ($modulepart == 'propal' && !empty($conf->propal->multidir_output[$entity]))
{ {
if ($fuser->rights->propale->{$lire} || preg_match('/^specimen/i',$original_file)) if ($fuser->rights->propale->{$lire} || preg_match('/^specimen/i',$original_file))
{ {
$accessallowed=1; $accessallowed=1;
} }
$original_file=$conf->propal->multidir_output[$entity].'/'.$original_file;
$original_file=$conf->propal->dir_output.'/'.$original_file;
$sqlprotectagainstexternals = "SELECT fk_soc as fk_soc FROM ".MAIN_DB_PREFIX."propal WHERE ref='".$db->escape($refname)."' AND entity=".$conf->entity; $sqlprotectagainstexternals = "SELECT fk_soc as fk_soc FROM ".MAIN_DB_PREFIX."propal WHERE ref='".$db->escape($refname)."' AND entity=".$conf->entity;
} }

View File

@ -7108,7 +7108,7 @@ function getAdvancedPreviewUrl($modulepart, $relativepath, $alldata=0, $param=''
if ($alldata == 1) if ($alldata == 1)
{ {
if ($num_mime !== false) return array('target'=>'_blank', 'css'=>'documentpreview', 'url'=>DOL_URL_ROOT.'/document.php?modulepart='.$modulepart.'&attachment=0&file='.urlencode($relativepath), 'mime'=>dol_mimetype($relativepath), ); if ($num_mime !== false) return array('target'=>'_blank', 'css'=>'documentpreview', 'url'=>DOL_URL_ROOT.'/document.php?modulepart='.$modulepart.'&attachment=0&file='.urlencode($relativepath).($param?'&'.$param:''), 'mime'=>dol_mimetype($relativepath), );
else return array(); else return array();
} }

View File

@ -35,7 +35,7 @@ function propal_prepare_head($object)
$langs->load("propal"); $langs->load("propal");
$langs->load("compta"); $langs->load("compta");
$langs->load("companies"); $langs->load("companies");
$h = 0; $h = 0;
$head = array(); $head = array();
@ -86,7 +86,7 @@ function propal_prepare_head($object)
require_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php'; require_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php';
require_once DOL_DOCUMENT_ROOT.'/core/class/link.class.php'; require_once DOL_DOCUMENT_ROOT.'/core/class/link.class.php';
$upload_dir = $conf->propal->dir_output . "/" . dol_sanitizeFileName($object->ref); $upload_dir = $conf->propal->multidir_output[$object->entity] . "/" . dol_sanitizeFileName($object->ref);
$nbFiles = count(dol_dir_list($upload_dir,'files',0,'','(\.meta|_preview.*\.png)$')); $nbFiles = count(dol_dir_list($upload_dir,'files',0,'','(\.meta|_preview.*\.png)$'));
$nbLinks=Link::count($db, $object->element, $object->id); $nbLinks=Link::count($db, $object->element, $object->id);
$head[$h][0] = DOL_URL_ROOT.'/comm/propal/document.php?id='.$object->id; $head[$h][0] = DOL_URL_ROOT.'/comm/propal/document.php?id='.$object->id;

View File

@ -246,7 +246,7 @@ class doc_generic_proposal_odt extends ModelePDFPropales
$outputlangs->load("companies"); $outputlangs->load("companies");
$outputlangs->load("bills"); $outputlangs->load("bills");
if ($conf->propal->dir_output) if ($conf->propal->multidir_output[$conf->entity])
{ {
// If $object is id instead of object // If $object is id instead of object
if (! is_object($object)) if (! is_object($object))
@ -261,7 +261,7 @@ class doc_generic_proposal_odt extends ModelePDFPropales
} }
} }
$dir = $conf->propal->dir_output; $dir = $conf->propal->multidir_output[$object->entity];
$objectref = dol_sanitizeFileName($object->ref); $objectref = dol_sanitizeFileName($object->ref);
if (! preg_match('/specimen/i',$objectref)) $dir.= "/" . $objectref; if (! preg_match('/specimen/i',$objectref)) $dir.= "/" . $objectref;
$file = $dir . "/" . $objectref . ".odt"; $file = $dir . "/" . $objectref . ".odt";
@ -303,7 +303,7 @@ class doc_generic_proposal_odt extends ModelePDFPropales
//print "file=".$file; //print "file=".$file;
//print "conf->propal->dir_temp=".$conf->propal->dir_temp; //print "conf->propal->dir_temp=".$conf->propal->dir_temp;
dol_mkdir($conf->propal->dir_temp); dol_mkdir($conf->propal->multidir_temp[$object->entity]);
// If CUSTOMER contact defined on proposal, we use it // If CUSTOMER contact defined on proposal, we use it
@ -357,7 +357,7 @@ class doc_generic_proposal_odt extends ModelePDFPropales
$odfHandler = new odf( $odfHandler = new odf(
$srctemplatepath, $srctemplatepath,
array( array(
'PATH_TO_TMP' => $conf->propal->dir_temp, 'PATH_TO_TMP' => $conf->propal->multidir_temp[$object->entity],
'ZIP_PROXY' => 'PclZipProxy', // PhpZipProxy or PclZipProxy. Got "bad compression method" error when using PhpZipProxy. 'ZIP_PROXY' => 'PclZipProxy', // PhpZipProxy or PclZipProxy. Got "bad compression method" error when using PhpZipProxy.
'DELIMITER_LEFT' => '{', 'DELIMITER_LEFT' => '{',
'DELIMITER_RIGHT' => '}' 'DELIMITER_RIGHT' => '}'

View File

@ -230,7 +230,7 @@ class pdf_azur extends ModelePDFPropales
if (count($realpatharray) == 0) $this->posxpicture=$this->posxtva; if (count($realpatharray) == 0) $this->posxpicture=$this->posxtva;
if ($conf->propal->dir_output) if ($conf->propal->multidir_output[$conf->entity])
{ {
$object->fetch_thirdparty(); $object->fetch_thirdparty();
@ -239,13 +239,13 @@ class pdf_azur extends ModelePDFPropales
// Definition of $dir and $file // Definition of $dir and $file
if ($object->specimen) if ($object->specimen)
{ {
$dir = $conf->propal->dir_output; $dir = $conf->propal->multidir_output[$conf->entity];
$file = $dir . "/SPECIMEN.pdf"; $file = $dir . "/SPECIMEN.pdf";
} }
else else
{ {
$objectref = dol_sanitizeFileName($object->ref); $objectref = dol_sanitizeFileName($object->ref);
$dir = $conf->propal->dir_output . "/" . $objectref; $dir = $conf->propal->multidir_output[$object->entity] . "/" . $objectref;
$file = $dir . "/" . $objectref . ".pdf"; $file = $dir . "/" . $objectref . ".pdf";
} }
@ -1501,7 +1501,7 @@ class pdf_azur extends ModelePDFPropales
{ {
$top_shift = $pdf->getY() - $current_y; $top_shift = $pdf->getY() - $current_y;
} }
if ($showaddress) if ($showaddress)
{ {
// Sender properties // Sender properties