Fix: Cheque receipts was not stored in correct directory

This commit is contained in:
Laurent Destailleur 2009-06-29 18:33:05 +00:00
parent f1fd0e5da7
commit 2901b18fa6
5 changed files with 13 additions and 9 deletions

View File

@ -55,6 +55,8 @@ if ($page < 0) { $page = 0 ; }
$limit = $conf->liste_limit;
$offset = $limit * $page ;
$dir=$conf->banque->dir_output.'/bordereau/';
/*
* Actions
@ -454,9 +456,9 @@ if ($_GET['action'] != 'new')
{
if ($remisecheque->statut == 1)
{
$dir = $conf->comptabilite->dir_output.'/bordereau/'.get_exdir($remisecheque->number);
$dirchequereceipts = $dir.get_exdir($remisecheque->number,2,1).'/'.$remisecheque->ref;
$gen = array('blochet'=>'blochet');
$formfile->show_documents("remisecheque","",$dir,$_SERVER["PHP_SELF"].'?id='.$remisecheque->id,$gen,1);
$formfile->show_documents("remisecheque","",$dirchequereceipts,$_SERVER["PHP_SELF"].'?id='.$remisecheque->id,$gen,1);
}
}

View File

@ -38,7 +38,7 @@ if ($user->societe_id > 0)
{
$action = '';
$socid = $user->societe_id;
$dir = DOL_DATA_ROOT.'/private/'.$user->id.'/compta';
$dir = $conf->facture->dir_output.'/payments/private/'.$user->id;
}
$year = $_GET["year"];

View File

@ -212,8 +212,8 @@ if ($modulepart)
{
$accessallowed=1;
}
if ($user->societe_id > 0) $original_file=DOL_DATA_ROOT.'/private/'.$user->id.'/compta/'.$original_file;
else $original_file=$conf->compta->dir_output.'/payments/'.$original_file;
if ($user->societe_id > 0) $original_file=$conf->facture->dir_output.'/payments/private/'.$user->id.'/'.$original_file;
else $original_file=$conf->facture->dir_output.'/payments/'.$original_file;
//$sqlprotectagainstexternals = "SELECT fk_soc as fk_soc FROM ".MAIN_DB_PREFIX."fichinter WHERE ref='$refname'";
}

View File

@ -95,7 +95,7 @@ class BordereauChequeBlochet extends FPDF
$outputlangs->load("bills");
$outputlangs->load("products");
$dir = $_dir . "/".get_exdir($number);
$dir = $_dir . "/".get_exdir($number,2,1)."/".$number;
if (! is_dir($dir))
{
@ -110,7 +110,7 @@ class BordereauChequeBlochet extends FPDF
$month = sprintf("%02d",$month);
$year = sprintf("%04d",$year);
$_file = $dir . "bordereau-00".$number.".pdf"; //Todo: r<>paration provisoire, ajout de 2 zero
$_file = $dir . "/bordereau-".$number.".pdf";
// Protection et encryption du pdf
if ($conf->global->PDF_SECURITY_ENCRYPTION)

View File

@ -2376,11 +2376,13 @@ function yn($yesno, $case=1, $color=0)
* \remarks Examples: 1->"0/0/1/", 15->"0/1/5/"
* \param $num Id to develop
* \param $level Level of development (1, 2 or 3 level)
* \param $alpha Use alpha ref
*/
function get_exdir($num,$level=3)
function get_exdir($num,$level=3,$alpha=0)
{
$path = '';
$num = eregi_replace('[^0-9]','',$num);
if (empty($alpha)) $num = eregi_replace('[^0-9]','',$num);
else $num = eregi_replace('^.*\-','',$num);
$num = substr("000".$num, -$level);
if ($level == 1) $path = substr($num,0,1).'/';
if ($level == 2) $path = substr($num,1,1).'/'.substr($num,0,1).'/';