Fix: La ref utilis pour stocker les documents joint d'une facture fournisseurs n'tant pas unique, les documents se retrouvs mlangs.
On utilise maintenant l'id de la facture fournisseur. L'arobrescence de dcoupage de sockage des propales est mis sur 2 niveaux au lieu de 3
This commit is contained in:
parent
72f6daf973
commit
1f900a8f6a
@ -503,44 +503,32 @@ echo $file;
|
||||
|
||||
<div class="formelementrow">
|
||||
Compression :
|
||||
<input type="radio" name="compression" value="none"
|
||||
id="radio_compression_none"
|
||||
onclick="document.getElementById('checkbox_dump_asfile').checked = true;"
|
||||
checked="checked" />
|
||||
<label for="radio_compression_none">aucune</label>
|
||||
<?php
|
||||
|
||||
<!-- No zip support (not open source)
|
||||
<input type="radio" name="compression" value="zip"
|
||||
id="radio_compression_zip"
|
||||
onclick="document.getElementById('checkbox_dump_asfile').checked = true;"
|
||||
/>
|
||||
<label for="radio_compression_zip">"zippé"</label>
|
||||
-->
|
||||
$compression=array(
|
||||
'none' => array('function' => '', 'id' => 'radio_compression_none', 'label' => $langs->trans("None")),
|
||||
// 'zip' => array('function' => 'zip_open', 'id' => 'radio_compression_zip', 'label' => $langs->trans("Zip")), Not open source
|
||||
'gz' => array('function' => 'gz_open', 'id' => 'radio_compression_gzip', 'label' => $langs->trans("Gzip")),
|
||||
'bz' => array('function' => 'bz_open', 'id' => 'radio_compression_bzip', 'label' => $langs->trans("Bzip2"))
|
||||
);
|
||||
|
||||
<?php
|
||||
if (function_exists('gz_open'))
|
||||
foreach($compression as $key => $val)
|
||||
{
|
||||
?>
|
||||
<input type="radio" name="compression" value="gz"
|
||||
id="radio_compression_gzip"
|
||||
onclick="document.getElementById('checkbox_dump_asfile').checked = true;"
|
||||
/>
|
||||
<label for="radio_compression_gzip">"gzippé"</label>
|
||||
<?php
|
||||
}
|
||||
?>
|
||||
<?php
|
||||
if (function_exists('bz_open'))
|
||||
{
|
||||
?>
|
||||
<input type="radio" name="compression" value="bz"
|
||||
id="radio_compression_bzip"
|
||||
onclick="document.getElementById('checkbox_dump_asfile').checked = true;"
|
||||
/>
|
||||
<label for="radio_compression_bzip">"bzippé"</label>
|
||||
</div>
|
||||
<?php
|
||||
if (! $val['function'] || function_exists($val['function']))
|
||||
{
|
||||
print '<input type="radio" name="compression" value="'.$key.'" id="'.$val['id'].'"';
|
||||
print ' onclick="document.getElementById(\'checkbox_dump_asfile\').checked = true;" checked="checked" />';
|
||||
print ' <label for="radio_compression_none">'.$val['label'].'</label>';
|
||||
}
|
||||
else
|
||||
{
|
||||
print '<input type="radio" name="compression" value="'.$key.'" id="'.$val['id'].'" disabled="true">';
|
||||
print ' <label for="radio_compression_none">'.$val['label'].'</label>';
|
||||
print ' ('.$langs->trans("NotAvailable").')';
|
||||
}
|
||||
print ' ';
|
||||
}
|
||||
|
||||
?>
|
||||
|
||||
</fieldset>
|
||||
|
||||
@ -429,7 +429,7 @@ if ($_GET["rowid"] && $_GET["action"] != 'edit')
|
||||
* Documents générés
|
||||
*/
|
||||
$filename=sanitize_string($don->id);
|
||||
$filedir=$conf->don->dir_output . '/' . get_exdir($filename);
|
||||
$filedir=$conf->don->dir_output . '/' . get_exdir($filename,2);
|
||||
$urlsource=$_SERVER['PHP_SELF'].'?rowid='.$don->id;
|
||||
// $genallowed=($fac->statut == 1 && ($fac->paye == 0 || $user->admin) && $user->rights->facture->creer);
|
||||
// $delallowed=$user->rights->facture->supprimer;
|
||||
|
||||
@ -273,7 +273,7 @@ class Expedition extends CommonObject
|
||||
return -1;
|
||||
}
|
||||
|
||||
$file = $conf->expedition->dir_output . "/" .get_exdir($expedition->id) . "/" . $this->id.".pdf";
|
||||
$file = $conf->expedition->dir_output . "/" .get_exdir($expedition->id,2) . "/" . $this->id.".pdf";
|
||||
$this->pdf_filename = $file;
|
||||
|
||||
return 1;
|
||||
|
||||
@ -59,7 +59,7 @@ if ($_POST['sendit'] && $conf->upload)
|
||||
if ($facture->fetch($facid))
|
||||
{
|
||||
$ref = sanitize_string($facture->ref);
|
||||
$upload_dir = $conf->fournisseur->facture->dir_output . '/' . $ref;
|
||||
$upload_dir = $conf->fournisseur->facture->dir_output.'/'.get_exdir($facture->id,2).$facture->id;
|
||||
if (! is_dir($upload_dir)) create_exdir($upload_dir);
|
||||
|
||||
if (is_dir($upload_dir))
|
||||
@ -87,7 +87,7 @@ if ($action=='delete')
|
||||
if ($facture->fetch($facid))
|
||||
{
|
||||
$ref = sanitize_string($facture->ref);
|
||||
$upload_dir = $conf->fournisseur->facture->dir_output . '/' . $ref;
|
||||
$upload_dir = $conf->fournisseur->facture->dir_output.'/'.get_exdir($facture->id,2).$facture->id;
|
||||
$file = $upload_dir . '/' . urldecode($_GET['urlfile']);
|
||||
dol_delete_file($file);
|
||||
$mesg = '<div class="ok">'.$langs->trans('FileWasRemoved').'</div>';
|
||||
@ -109,7 +109,7 @@ if ($facid > 0)
|
||||
{
|
||||
$facref = sanitize_string($facture->ref);
|
||||
|
||||
$upload_dir = $conf->fournisseur->facture->dir_output.'/'.$facref;
|
||||
$upload_dir = $conf->fournisseur->facture->dir_output.'/'.get_exdir($facture->id,2).$facture->id;
|
||||
|
||||
$societe = new Societe($db);
|
||||
$societe->fetch($facture->socidp);
|
||||
@ -200,7 +200,7 @@ if ($facid > 0)
|
||||
$var=!$var;
|
||||
print '<tr '.$bc[$var].'>';
|
||||
print '<td>';
|
||||
echo '<a href="'.DOL_URL_ROOT.'/document.php?modulepart=facture_fournisseur&file='.$facref.'/'.urlencode($file).'">'.$file.'</a>';
|
||||
echo '<a href="'.DOL_URL_ROOT.'/document.php?modulepart=facture_fournisseur&file='.get_exdir($facture->id,2).'/'.urlencode($file).'">'.$file.'</a>';
|
||||
print "</td>\n";
|
||||
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>';
|
||||
|
||||
@ -145,7 +145,7 @@ if ($_GET["id"])
|
||||
$nbphoto=0;
|
||||
$nbbyrow=5;
|
||||
|
||||
$pdir = get_exdir($product->id) . $product->id ."/photos/";
|
||||
$pdir = get_exdir($product->id,2) . $product->id ."/photos/";
|
||||
$dir = $conf->produit->dir_output . '/'. $pdir;
|
||||
|
||||
print '<br><table width="100%" valign="top" align="center" border="0" cellpadding="2" cellspacing="2">';
|
||||
|
||||
@ -2567,7 +2567,7 @@ class Form
|
||||
$relativepath=$file["name"]; // Cas general
|
||||
if ($filename) $relativepath=$filename."/".$file["name"]; // Cas prpal, facture...
|
||||
// Autre cas
|
||||
if ($modulepart == 'don') { $relativepath = get_exdir($filename).$file["name"]; }
|
||||
if ($modulepart == 'don') { $relativepath = get_exdir($filename,2).$file["name"]; }
|
||||
if ($modulepart == 'export') { $relativepath = $file["name"]; }
|
||||
|
||||
// Défini le type MIME du document
|
||||
|
||||
@ -94,7 +94,7 @@ class html_cerfafr extends ModeleDon
|
||||
else
|
||||
{
|
||||
$donref = sanitize_string($don->ref);
|
||||
$dir = $conf->don->dir_output . "/" . get_exdir($donref);
|
||||
$dir = $conf->don->dir_output . "/" . get_exdir($donref,2);
|
||||
$file = $dir . "/" . $donref . ".html";
|
||||
}
|
||||
|
||||
|
||||
@ -15,6 +15,7 @@ NewSocGroup=Nouveau companies group
|
||||
ProspectionArea=Prospection area
|
||||
SocGroup=Group of companies
|
||||
IdCompany=Company Id
|
||||
IdContact=Contact Id
|
||||
Company=Company
|
||||
CompanyName=Company name
|
||||
Companies=Companies
|
||||
|
||||
@ -15,6 +15,7 @@ NewSocGroup=Nouveau groupement de soci
|
||||
ProspectionArea=Espace prospection
|
||||
SocGroup=Groupement de sociétés
|
||||
IdCompany=Id société
|
||||
IdContact=Id contact
|
||||
Company=Société
|
||||
CompanyName=Raison sociale
|
||||
Companies=Sociétés
|
||||
|
||||
@ -1917,12 +1917,16 @@ function departement_rowid($db,$code, $pays_id)
|
||||
/**
|
||||
* \brief Renvoi un chemin de classement répertoire en fonction d'un id
|
||||
* Examples: 1->"0/0/1/", 15->"0/1/5/"
|
||||
* \param $num id à décomposer
|
||||
* \param $num Id à décomposer
|
||||
* \param $level Niveau de decoupage (1, 2 ou 3 niveaux)
|
||||
*/
|
||||
function get_exdir($num)
|
||||
function get_exdir($num,$level=3)
|
||||
{
|
||||
$num = substr("000".$num, -3);
|
||||
return substr($num, 0,1).'/'.substr($num, 1,1).'/'.substr($num, 2,1).'/';
|
||||
$num = substr("000".$num, -$level);
|
||||
if ($level == 1) return substr($num,0,1).'/';
|
||||
if ($level == 2) return substr($num,1,1).'/'.substr($num,0,1).'/';
|
||||
if ($level == 3) return substr($num,2,1).'/'.substr($num,1,1).'/'.substr($num,0,1).'/';
|
||||
return '';
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@ -240,7 +240,7 @@ class Livraison extends CommonObject
|
||||
|
||||
if ($this->statut == 0) $this->brouillon = 1;
|
||||
|
||||
$file = $conf->livraison->dir_output . "/" .get_exdir($livraison->id) . "/" . $this->id.".pdf";
|
||||
$file = $conf->livraison->dir_output . "/" .get_exdir($livraison->id,2) . "/" . $this->id.".pdf";
|
||||
$this->pdf_filename = $file;
|
||||
|
||||
return 1;
|
||||
|
||||
@ -2002,7 +2002,7 @@ function get_each_prod()
|
||||
*/
|
||||
function add_photo($sdir, $files)
|
||||
{
|
||||
$dir = $sdir .'/'. get_exdir($this->id) . $this->id ."/";
|
||||
$dir = $sdir .'/'. get_exdir($this->id,2) . $this->id ."/";
|
||||
$dir .= "photos/";
|
||||
|
||||
if (! file_exists($dir))
|
||||
@ -2029,7 +2029,7 @@ function get_each_prod()
|
||||
*/
|
||||
function is_photo_available($sdir)
|
||||
{
|
||||
$pdir = get_exdir($this->id) . $this->id ."/photos/";
|
||||
$pdir = get_exdir($this->id,2) . $this->id ."/photos/";
|
||||
$dir = $sdir . '/'. $pdir;
|
||||
|
||||
$nbphoto=0;
|
||||
@ -2056,7 +2056,7 @@ function get_each_prod()
|
||||
*/
|
||||
function show_photos($sdir,$size=0,$nbmax=0,$nbbyrow=5)
|
||||
{
|
||||
$pdir = get_exdir($this->id) . $this->id ."/photos/";
|
||||
$pdir = get_exdir($this->id,2) . $this->id ."/photos/";
|
||||
$dir = $sdir . '/'. $pdir;
|
||||
|
||||
$nbphoto=0;
|
||||
|
||||
@ -178,7 +178,7 @@ if ($_GET["id"] || $_GET["ref"])
|
||||
$nbphoto=0;
|
||||
$nbbyrow=5;
|
||||
|
||||
$pdir = get_exdir($product->id) . $product->id ."/photos/";
|
||||
$pdir = get_exdir($product->id,2) . $product->id ."/photos/";
|
||||
$dir = $conf->produit->dir_output . '/'. $pdir;
|
||||
|
||||
print '<br>';
|
||||
|
||||
Loading…
Reference in New Issue
Block a user