Skip to content
Snippets Groups Projects
Commit e897a6b7 authored by Laurent Destailleur's avatar Laurent Destailleur
Browse files

Fix: Tlchargement fichiers joints aux actions corrig

parent 3b18af80
Branches
Tags
No related merge requests found
...@@ -228,7 +228,7 @@ if ($_GET["id"] > 0) ...@@ -228,7 +228,7 @@ if ($_GET["id"] > 0)
$var=!$var; $var=!$var;
print '<tr '.$bc[$var].'>'; print '<tr '.$bc[$var].'>';
print '<td>'; print '<td>';
echo '<a href="'.DOL_URL_ROOT.'/document.php?modulepart=ationscomm&file='.$act->id.'/'.urlencode($file).'">'.$file.'</a>'; echo '<a href="'.DOL_URL_ROOT.'/document.php?modulepart=actions&file='.$act->id.'/'.urlencode($file).'">'.$file.'</a>';
print "</td>\n"; print "</td>\n";
print '<td align="right">'.filesize($upload_dir.'/'.$file). ' bytes</td>'; print '<td align="right">'.filesize($upload_dir.'/'.$file). ' bytes</td>';
print '<td align="center">'.strftime('%d %b %Y %H:%M:%S',filemtime($upload_dir.'/'.$file)).'</td>'; print '<td align="center">'.strftime('%d %b %Y %H:%M:%S',filemtime($upload_dir.'/'.$file)).'</td>';
......
...@@ -44,6 +44,9 @@ if (eregi('\.html',$original_file)) { $type='text/html'; $attachment = false; } ...@@ -44,6 +44,9 @@ if (eregi('\.html',$original_file)) { $type='text/html'; $attachment = false; }
if (eregi('\.csv',$original_file)) { $type='text/csv'; $attachment = true; } if (eregi('\.csv',$original_file)) { $type='text/csv'; $attachment = true; }
if (eregi('\.pdf',$original_file)) { $type='application/pdf'; $attachment = true; } if (eregi('\.pdf',$original_file)) { $type='application/pdf'; $attachment = true; }
if (eregi('\.xls',$original_file)) { $type='application/x-msexcel'; $attachment = true; } if (eregi('\.xls',$original_file)) { $type='application/x-msexcel'; $attachment = true; }
if (eregi('\.jpg',$original_file)) { $type='image/jpeg'; $attachment = true; }
if (eregi('\.png',$original_file)) { $type='image/jpeg'; $attachment = true; }
if (eregi('\.tiff',$original_file)) { $type='image/tiff'; $attachment = true; }
//Suppression de la chaine de caractre ../ dans $original_file //Suppression de la chaine de caractre ../ dans $original_file
$original_file = str_replace("../","/", "$original_file"); $original_file = str_replace("../","/", "$original_file");
...@@ -184,16 +187,15 @@ if ($modulepart) ...@@ -184,16 +187,15 @@ if ($modulepart)
$original_file=$conf->telephonie->dir_output.'/'.$original_file; $original_file=$conf->telephonie->dir_output.'/'.$original_file;
} }
// Wrapping pour les actions // Wrapping pour les actions
if ($modulepart == 'actionscomm') if ($modulepart == 'actions')
{ {
$user->getrights('commercial'); $user->getrights('commercial');
//if ($user->rights->commercial->lire) // Ce droit n'existe pas encore //if ($user->rights->commercial->lire) // Ce droit n'existe pas encore
//{ //{
$accessallowed=1; $accessallowed=1;
//} //}
$original_file=$conf->commercial->dir_output.'/'.$original_file; $original_file=$conf->actionscomm->dir_output.'/'.$original_file;
} }
// Wrapping pour les produits et services // Wrapping pour les produits et services
...@@ -238,9 +240,10 @@ if (! $accessallowed) ...@@ -238,9 +240,10 @@ if (! $accessallowed)
// Ouvre et renvoi fichier // Ouvre et renvoi fichier
clearstatcache(); clearstatcache();
$filename = basename($original_file); $filename = basename($original_file);
dolibarr_syslog("document.php download $original_file $filename content-type=$type");
if (! file_exists($original_file)) if (! file_exists($original_file))
{ {
dolibarr_print_error(0,$langs->trans("FileDoesNotExist",$original_file)); dolibarr_print_error(0,$langs->trans("FileDoesNotExist",$original_file));
...@@ -249,7 +252,6 @@ if (! file_exists($original_file)) ...@@ -249,7 +252,6 @@ if (! file_exists($original_file))
// Les drois sont ok et fichier trouv, on l'envoie // Les drois sont ok et fichier trouv, on l'envoie
dolibarr_syslog("document.php download $filename content-type=$type");
if ($type) header('Content-type: '.$type); if ($type) header('Content-type: '.$type);
if ($attachment) header('Content-Disposition: attachment; filename="'.$filename.'"'); if ($attachment) header('Content-Disposition: attachment; filename="'.$filename.'"');
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment