From 605cd43fb70c72037fa7c3fba72439846aef1d0a Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sun, 22 Jan 2006 18:48:36 +0000 Subject: [PATCH] Fix: Lien sur le download des exports --- htdocs/document.php | 16 +++++++++++++--- htdocs/exports/export.php | 3 +-- htdocs/html.form.class.php | 5 +++-- 3 files changed, 17 insertions(+), 7 deletions(-) diff --git a/htdocs/document.php b/htdocs/document.php index ddd039b0d4c..ca5fe498382 100644 --- a/htdocs/document.php +++ b/htdocs/document.php @@ -1,6 +1,6 @@ - * Copyright (C) 2004-2005 Laurent Destailleur + * Copyright (C) 2004-2006 Laurent Destailleur * Copyright (C) 2005 Simon Tosser * * This program is free software; you can redistribute it and/or modify @@ -41,6 +41,7 @@ $modulepart = urldecode($_GET["modulepart"]); // Défini type et attachment $type = urldecode($_GET["type"]); $attachment = true; if (eregi('\.html',$original_file)) { $type='text/html'; $attachment = false; } +if (eregi('\.csv',$original_file)) { $type='text/csv'; $attachment = true; } if (eregi('\.pdf',$original_file)) { $type='application/pdf'; $attachment = true; } //Suppression de la chaine de caractère ../ dans $original_file @@ -151,7 +152,7 @@ if ($modulepart) } - // Wrapping pour la telephonie + // Wrapping pour les actions if ($modulepart == 'actionscomm') { $user->getrights('commercial'); @@ -173,7 +174,7 @@ if ($modulepart) $original_file=$conf->produit->dir_output.'/'.$original_file; } - // Wrapping pour les factures + // Wrapping pour les dons if ($modulepart == 'don') { $user->getrights('don'); @@ -184,6 +185,15 @@ if ($modulepart) $original_file=$conf->don->dir_output.'/'.$original_file; } + // Wrapping pour les exports + if ($modulepart == 'export') + { + // Aucun test necessaire car on force le rep de doanwload sur + // le rep export qui est propre à l'utilisateur + $accessallowed=1; + $original_file=$conf->export->dir_ouput.'/'.$user->id.'/'.$original_file; + } + } // Limite accès si droits non corrects diff --git a/htdocs/exports/export.php b/htdocs/exports/export.php index 09a5cf7b58d..cf8924c2496 100644 --- a/htdocs/exports/export.php +++ b/htdocs/exports/export.php @@ -466,8 +466,7 @@ if ($step == 4 && $datatoexport) // Affiche liste des documents // NB: La fonction show_documents rescanne les modules qd genallowed=1 - $filename=$datatoexport; - $htmlform->show_documents('export',$filename,$conf->export->dir_ouput.'/'.$user->id,$_SERVER["PHP_SELF"].'?step=4&datatoexport='.$datatoexport,$liste,1,'csv'); + $htmlform->show_documents('export','',$conf->export->dir_ouput.'/'.$user->id,$_SERVER["PHP_SELF"].'?step=4&datatoexport='.$datatoexport,$liste,1,'csv'); print ' '; print ''; diff --git a/htdocs/html.form.class.php b/htdocs/html.form.class.php index 567253c7671..6c678655122 100644 --- a/htdocs/html.form.class.php +++ b/htdocs/html.form.class.php @@ -1888,8 +1888,9 @@ class Form // Défini chemin relatif par rapport au module pour lien download $relativepath=$filename."/".$file; - if ($modulepart == 'expedition') { $relativepath = get_exdir("${filename}")."${file}"; } - if ($modulepart == 'don') { $relativepath = get_exdir("${filename}")."${file}"; } + if ($modulepart == 'expedition') { $relativepath = get_exdir($filename).$file; } + if ($modulepart == 'don') { $relativepath = get_exdir($filename).$file; } + if ($modulepart == 'export') { $relativepath = $file; } // Défini le type MIME du document if (eregi('\.([^\.]+)$',$file,$reg)) $extension=$reg[1];