Fix: Generated doc in wrong dir

This commit is contained in:
Laurent Destailleur 2011-03-07 00:17:20 +00:00
parent 0317ae75de
commit f07557f6ec
5 changed files with 14 additions and 11 deletions

View File

@ -208,7 +208,7 @@ if ($modulepart)
{
$accessallowed=1;
}
$original_file=$conf->fournisseur->dir_output.'/commande/'.$original_file;
$original_file=$conf->fournisseur->commande->dir_output.'/'.$original_file;
$sqlprotectagainstexternals = "SELECT fk_soc as fk_soc FROM ".MAIN_DB_PREFIX."commande_fournisseur WHERE ref='".$refname."' AND entity=".$conf->entity;
}
@ -219,7 +219,7 @@ if ($modulepart)
{
$accessallowed=1;
}
$original_file=$conf->fournisseur->dir_output.'/facture/'.$original_file;
$original_file=$conf->fournisseur->facture->dir_output.'/'.$original_file;
$sqlprotectagainstexternals = "SELECT fk_soc as fk_soc FROM ".MAIN_DB_PREFIX."facture_fourn WHERE facnumber='".$refname."' AND entity=".$conf->entity;
}

View File

@ -69,7 +69,8 @@ if ($_POST['sendit'] && ! empty($conf->global->MAIN_UPLOAD_DOC))
$facture = new FactureFournisseur($db);
if ($facture->fetch($facid))
{
$upload_dir = $conf->fournisseur->dir_output.'/facture/'.get_exdir($facture->id,2).$facture->id;
$ref=dol_sanitizeFileName($facture->ref);
$upload_dir = $conf->fournisseur->facture->dir_output.'/'.$ref;
if (create_exdir($upload_dir) >= 0)
{
@ -106,7 +107,8 @@ if ($action=='delete')
$facture = new FactureFournisseur($db);
if ($facture->fetch($facid))
{
$upload_dir = $conf->fournisseur->dir_output.'/facture/'.get_exdir($facture->id,2).$facture->id;
$ref=dol_sanitizeFileName($facture->ref);
$upload_dir = $conf->fournisseur->facture->dir_output.'/'.$ref;
$file = $upload_dir . '/' . $_GET['urlfile']; // Do not use urldecode here ($_GET and $_REQUEST are already decoded by PHP).
dol_delete_file($file);
@ -130,7 +132,8 @@ if ($facid > 0)
{
$facture->fetch_thirdparty();
$upload_dir = $conf->fournisseur->dir_output.'/facture/'.get_exdir($facture->id,2).$facture->id;
$ref=dol_sanitizeFileName($facture->ref);
$upload_dir = $conf->fournisseur->facture->dir_output.'/'.$ref;
$head = facturefourn_prepare_head($facture);
dol_fiche_head($head, 'documents', $langs->trans('SupplierInvoice'), 0, 'bill');

View File

@ -1795,8 +1795,8 @@ else
*/
$ref=dol_sanitizeFileName($fac->ref);
$subdir = get_exdir($fac->id,2).$ref;
$filedir = $conf->fournisseur->facture->dir_output.'/'.get_exdir($fac->id,2).$ref;
$subdir = $ref;
$filedir = $conf->fournisseur->facture->dir_output.'/'.$ref;
$urlsource=$_SERVER['PHP_SELF'].'?facid='.$fac->id;
$genallowed=$user->rights->fournisseur->facture->creer;
$delallowed=$user->rights->fournisseur->facture->supprimer;

View File

@ -127,13 +127,13 @@ class pdf_canelle extends ModelePDFSuppliersInvoices
// Definition de $dir et $file
if ($object->specimen)
{
$dir = $conf->fournisseur->dir_output.'/facture';
$dir = $conf->fournisseur->facture->dir_output;
$file = $dir . "/SPECIMEN.pdf";
}
else
{
$objectref = dol_sanitizeFileName($object->ref);
$dir = $conf->fournisseur->facture->dir_output.'/'.get_exdir($object->id,2).$objectref;
$dir = $conf->fournisseur->facture->dir_output.'/'.$objectref;
$file = $dir . "/" . $objectref . ".pdf";
}

View File

@ -128,13 +128,13 @@ class pdf_muscadet extends ModelePDFSuppliersOrders
// Definition de $dir et $file
if ($object->specimen)
{
$dir = $conf->fournisseur->dir_output.'/commande';
$dir = $conf->fournisseur->commande->dir_output;
$file = $dir . "/SPECIMEN.pdf";
}
else
{
$objectref = dol_sanitizeFileName($object->ref);
$dir = $conf->fournisseur->dir_output . "/commande/" . $objectref;
$dir = $conf->fournisseur->commande->dir_output . "/" . $objectref;
$file = $dir . "/" . $objectref . ".pdf";
}