diff --git a/htdocs/core/class/html.formmail.class.php b/htdocs/core/class/html.formmail.class.php
index 3dc2743adf1..40496ee7fa9 100644
--- a/htdocs/core/class/html.formmail.class.php
+++ b/htdocs/core/class/html.formmail.class.php
@@ -792,6 +792,7 @@ class FormMail extends Form
if (count($listofpaths)) {
foreach ($listofpaths as $key => $val) {
$relativepathtofile = substr($val, (strlen(DOL_DATA_ROOT) - strlen($val)));
+
if ($conf->entity > 1) {
$relativepathtofile = str_replace($conf->entity.'/', '', $relativepathtofile);
}
@@ -802,6 +803,7 @@ class FormMail extends Form
$out .= '
';
// Preview of attachment
$out .= img_mime($listofnames[$key]).' '.$listofnames[$key];
+
$out .= $formfile->showPreview(array(), $formfile_params[2], $formfile_params[4]);
if (!$this->withfilereadonly) {
$out .= ' ';
diff --git a/htdocs/core/lib/files.lib.php b/htdocs/core/lib/files.lib.php
index 43ad95157dc..613f7f2d8a8 100644
--- a/htdocs/core/lib/files.lib.php
+++ b/htdocs/core/lib/files.lib.php
@@ -2707,13 +2707,14 @@ function dol_check_secure_access_document($modulepart, $original_file, $entity,
if ($fuser->rights->expedition->{$lire} || preg_match('/^specimen/i', $original_file)) {
$accessallowed = 1;
}
- $original_file = $conf->expedition->dir_output."/sending/".$original_file;
+ $original_file = $conf->expedition->dir_output."/".(strpos('sending/', $original_file) == 0 ? '' : 'sending/').$original_file;
+ //$original_file = $conf->expedition->dir_output."/".$original_file;
} elseif (($modulepart == 'livraison' || $modulepart == 'delivery') && !empty($conf->expedition->dir_output)) {
// Delivery Note Wrapping
if ($fuser->rights->expedition->delivery->{$lire} || preg_match('/^specimen/i', $original_file)) {
$accessallowed = 1;
}
- $original_file = $conf->expedition->dir_output."/receipt/".$original_file;
+ $original_file = $conf->expedition->dir_output."/".(strpos('receipt/', $original_file) == 0 ? '' : 'receipt/').$original_file;
} elseif ($modulepart == 'actions' && !empty($conf->agenda->dir_output)) {
// Wrapping pour les actions
if ($fuser->rights->agenda->myactions->{$read} || preg_match('/^specimen/i', $original_file)) {
diff --git a/htdocs/core/tpl/massactions_pre.tpl.php b/htdocs/core/tpl/massactions_pre.tpl.php
index f9c74dd7085..91fc11ac217 100644
--- a/htdocs/core/tpl/massactions_pre.tpl.php
+++ b/htdocs/core/tpl/massactions_pre.tpl.php
@@ -99,12 +99,9 @@ if ($massaction == 'presend') {
print '';
- include_once DOL_DOCUMENT_ROOT.'/core/class/html.formmail.class.php';
- $formmail = new FormMail($db);
-
print dol_get_fiche_head(null, '', '');
- // Cree l'objet formulaire mail
+ // Create mail form
include_once DOL_DOCUMENT_ROOT.'/core/class/html.formmail.class.php';
$formmail = new FormMail($db);
$formmail->withform = -1;
diff --git a/htdocs/expedition/card.php b/htdocs/expedition/card.php
index 902914c4327..3d2b995233a 100644
--- a/htdocs/expedition/card.php
+++ b/htdocs/expedition/card.php
@@ -2552,8 +2552,8 @@ if ($action == 'create') {
// Presend form
$modelmail = 'shipping_send';
- $defaulttopic = 'SendShippingRef';
- $diroutput = $conf->expedition->dir_output;
+ $defaulttopic = $langs->trans('SendShippingRef');
+ $diroutput = $conf->expedition->dir_output.'/sending';
$trackid = 'shi'.$object->id;
include DOL_DOCUMENT_ROOT.'/core/tpl/card_presend.tpl.php';