From 0317ae75decfa3205911a6ff26101db507546f8d Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sun, 6 Mar 2011 23:45:47 +0000 Subject: [PATCH] Fix: Generated doc in wrong dir --- htdocs/core/class/html.formfile.class.php | 4 ++-- htdocs/fourn/facture/fiche.php | 15 +++++++-------- .../supplier_invoice/pdf/pdf_canelle.modules.php | 3 ++- 3 files changed, 11 insertions(+), 11 deletions(-) diff --git a/htdocs/core/class/html.formfile.class.php b/htdocs/core/class/html.formfile.class.php index 7414ab93fb7..d95323fbfc0 100644 --- a/htdocs/core/class/html.formfile.class.php +++ b/htdocs/core/class/html.formfile.class.php @@ -128,7 +128,7 @@ class FormFile /** * Show the box with list of available documents for object * @param modulepart propal, facture, facture_fourn, ... - * @param filename Sub dir to scan (Example: '9/9', 'FA9999'). Use '' if filedir already complete) + * @param filename Sub dir to scan (Example: '0/1/10', 'FA/DD/MM/YY/9999'). Use '' if filedir already complete) * @param filedir Dir to scan * @param urlsource Url of origin page (for return) * @param genallowed Generation is allowed (1/0 or array of formats) @@ -161,7 +161,7 @@ class FormFile $forcenomultilang=0; } - $filename = dol_sanitizeFileName($filename); + //$filename = dol_sanitizeFileName($filename); //Must be sanitized before calling show_documents $headershown=0; $showempty=0; $i=0; diff --git a/htdocs/fourn/facture/fiche.php b/htdocs/fourn/facture/fiche.php index e1693d3ba08..814fa32d209 100644 --- a/htdocs/fourn/facture/fiche.php +++ b/htdocs/fourn/facture/fiche.php @@ -1402,13 +1402,13 @@ else if ($mysoc->localtax1_assuj=="1") //Localtax1 RE { print ''.$langs->transcountry("AmountLT1",$mysoc->pays_code).''; - print ''.price($propal->total_localtax1).''; + print ''.price($fac->total_localtax1).''; print ''.$langs->trans("Currency".$conf->monnaie).''; } if ($mysoc->localtax2_assuj=="1") //Localtax2 IRPF { print ''.$langs->transcountry("AmountLT2",$mysoc->pays_code).''; - print ''.price($propal->total_localtax2).''; + print ''.price($fac->total_localtax2).''; print ''.$langs->trans("Currency".$conf->monnaie).''; } } @@ -1794,16 +1794,15 @@ else * Documents generes */ - $facfournref=dol_sanitizeFileName($fac->ref); - $file=$conf->fournisseur->dir_output.'/facture/'. $facfournref . '/' . $facfournref . '.pdf'; - $relativepath = $facfournref.'/'.$facfournref.'.pdf'; - $filedir = $conf->fournisseur->dir_output . '/facture/' . $facfournref; + $ref=dol_sanitizeFileName($fac->ref); + $subdir = get_exdir($fac->id,2).$ref; + $filedir = $conf->fournisseur->facture->dir_output.'/'.get_exdir($fac->id,2).$ref; $urlsource=$_SERVER['PHP_SELF'].'?facid='.$fac->id; $genallowed=$user->rights->fournisseur->facture->creer; $delallowed=$user->rights->fournisseur->facture->supprimer; print '
'; - $somethingshown=$formfile->show_documents('facture_fournisseur',$facfournref,$filedir,$urlsource,$genallowed,$delallowed,$fac->modelpdf); + $somethingshown=$formfile->show_documents('facture_fournisseur',$subdir,$filedir,$urlsource,$genallowed,$delallowed,$fac->modelpdf); $object=$fac; @@ -1840,7 +1839,7 @@ else if ($_GET['action'] == 'presend') { $ref = dol_sanitizeFileName($fac->ref); - $file = $conf->fournisseur->facture->dir_output . '/' . $ref . '/' . $ref . '.pdf'; + $file = $conf->fournisseur->facture->dir_output.'/'.get_exdir($fac->id,2).$ref.'.pdf'; print '
'; print_titre($langs->trans('SendBillByMail')); diff --git a/htdocs/includes/modules/supplier_invoice/pdf/pdf_canelle.modules.php b/htdocs/includes/modules/supplier_invoice/pdf/pdf_canelle.modules.php index 0460b55ae26..0c5b8094b31 100755 --- a/htdocs/includes/modules/supplier_invoice/pdf/pdf_canelle.modules.php +++ b/htdocs/includes/modules/supplier_invoice/pdf/pdf_canelle.modules.php @@ -133,7 +133,7 @@ class pdf_canelle extends ModelePDFSuppliersInvoices else { $objectref = dol_sanitizeFileName($object->ref); - $dir = $conf->fournisseur->dir_output . "/facture/" . $objectref; + $dir = $conf->fournisseur->facture->dir_output.'/'.get_exdir($object->id,2).$objectref; $file = $dir . "/" . $objectref . ".pdf"; } @@ -382,6 +382,7 @@ class pdf_canelle extends ModelePDFSuppliersInvoices */ function _tableau_tot(&$pdf, $object, $deja_regle, $posy, $outputlangs) { + global $conf,$mysoc; $default_font_size = pdf_getPDFFontSize($outputlangs); $tab2_top = $posy;