2
0
forked from Wavyzz/dolibarr

FIX Attachment of pdf into shipment when sending email

This commit is contained in:
Laurent Destailleur
2021-10-11 20:04:45 +02:00
parent 4fba60d2bb
commit 4e9c7c9efb
4 changed files with 8 additions and 8 deletions

View File

@@ -792,6 +792,7 @@ class FormMail extends Form
if (count($listofpaths)) { if (count($listofpaths)) {
foreach ($listofpaths as $key => $val) { foreach ($listofpaths as $key => $val) {
$relativepathtofile = substr($val, (strlen(DOL_DATA_ROOT) - strlen($val))); $relativepathtofile = substr($val, (strlen(DOL_DATA_ROOT) - strlen($val)));
if ($conf->entity > 1) { if ($conf->entity > 1) {
$relativepathtofile = str_replace($conf->entity.'/', '', $relativepathtofile); $relativepathtofile = str_replace($conf->entity.'/', '', $relativepathtofile);
} }
@@ -802,6 +803,7 @@ class FormMail extends Form
$out .= '<div id="attachfile_'.$key.'">'; $out .= '<div id="attachfile_'.$key.'">';
// Preview of attachment // Preview of attachment
$out .= img_mime($listofnames[$key]).' '.$listofnames[$key]; $out .= img_mime($listofnames[$key]).' '.$listofnames[$key];
$out .= $formfile->showPreview(array(), $formfile_params[2], $formfile_params[4]); $out .= $formfile->showPreview(array(), $formfile_params[2], $formfile_params[4]);
if (!$this->withfilereadonly) { if (!$this->withfilereadonly) {
$out .= ' <input type="image" style="border: 0px;" src="'.DOL_URL_ROOT.'/theme/'.$conf->theme.'/img/delete.png" value="'.($key + 1).'" class="removedfile" id="removedfile_'.$key.'" name="removedfile_'.$key.'" />'; $out .= ' <input type="image" style="border: 0px;" src="'.DOL_URL_ROOT.'/theme/'.$conf->theme.'/img/delete.png" value="'.($key + 1).'" class="removedfile" id="removedfile_'.$key.'" name="removedfile_'.$key.'" />';

View File

@@ -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)) { if ($fuser->rights->expedition->{$lire} || preg_match('/^specimen/i', $original_file)) {
$accessallowed = 1; $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)) { } elseif (($modulepart == 'livraison' || $modulepart == 'delivery') && !empty($conf->expedition->dir_output)) {
// Delivery Note Wrapping // Delivery Note Wrapping
if ($fuser->rights->expedition->delivery->{$lire} || preg_match('/^specimen/i', $original_file)) { if ($fuser->rights->expedition->delivery->{$lire} || preg_match('/^specimen/i', $original_file)) {
$accessallowed = 1; $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)) { } elseif ($modulepart == 'actions' && !empty($conf->agenda->dir_output)) {
// Wrapping pour les actions // Wrapping pour les actions
if ($fuser->rights->agenda->myactions->{$read} || preg_match('/^specimen/i', $original_file)) { if ($fuser->rights->agenda->myactions->{$read} || preg_match('/^specimen/i', $original_file)) {

View File

@@ -99,12 +99,9 @@ if ($massaction == 'presend') {
print '<input type="hidden" name="massaction" value="confirm_presend">'; print '<input type="hidden" name="massaction" value="confirm_presend">';
include_once DOL_DOCUMENT_ROOT.'/core/class/html.formmail.class.php';
$formmail = new FormMail($db);
print dol_get_fiche_head(null, '', ''); 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'; include_once DOL_DOCUMENT_ROOT.'/core/class/html.formmail.class.php';
$formmail = new FormMail($db); $formmail = new FormMail($db);
$formmail->withform = -1; $formmail->withform = -1;

View File

@@ -2552,8 +2552,8 @@ if ($action == 'create') {
// Presend form // Presend form
$modelmail = 'shipping_send'; $modelmail = 'shipping_send';
$defaulttopic = 'SendShippingRef'; $defaulttopic = $langs->trans('SendShippingRef');
$diroutput = $conf->expedition->dir_output; $diroutput = $conf->expedition->dir_output.'/sending';
$trackid = 'shi'.$object->id; $trackid = 'shi'.$object->id;
include DOL_DOCUMENT_ROOT.'/core/tpl/card_presend.tpl.php'; include DOL_DOCUMENT_ROOT.'/core/tpl/card_presend.tpl.php';