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