diff --git a/htdocs/admin/tools/dolibarr_export.php b/htdocs/admin/tools/dolibarr_export.php
index b5f4a5fde29..74fd46d9c7d 100644
--- a/htdocs/admin/tools/dolibarr_export.php
+++ b/htdocs/admin/tools/dolibarr_export.php
@@ -503,44 +503,32 @@ echo $file;
Compression :
-
-
+
-
--->
+$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"))
+);
- $val)
{
-?>
-
-
-
-
-
-
-
-';
+ print ' ';
+ }
+ else
+ {
+ print '';
+ print ' ';
+ print ' ('.$langs->trans("NotAvailable").')';
+ }
+ print ' ';
}
+
?>
diff --git a/htdocs/compta/dons/fiche.php b/htdocs/compta/dons/fiche.php
index bb87fdb5a0d..99c257d29f4 100644
--- a/htdocs/compta/dons/fiche.php
+++ b/htdocs/compta/dons/fiche.php
@@ -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;
diff --git a/htdocs/expedition/expedition.class.php b/htdocs/expedition/expedition.class.php
index 6eba15a658c..8156e12adb6 100644
--- a/htdocs/expedition/expedition.class.php
+++ b/htdocs/expedition/expedition.class.php
@@ -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;
diff --git a/htdocs/fourn/facture/document.php b/htdocs/fourn/facture/document.php
index 011a40b7679..5aa08f73dad 100644
--- a/htdocs/fourn/facture/document.php
+++ b/htdocs/fourn/facture/document.php
@@ -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 = ''.$langs->trans('FileWasRemoved').'
';
@@ -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 '';
print '| ';
- echo ''.$file.'';
+ echo ''.$file.'';
print " | \n";
print ''.filesize($upload_dir.'/'.$file). ' bytes | ';
print ''.strftime('%d %b %Y %H:%M:%S',filemtime($upload_dir.'/'.$file)).' | ';
diff --git a/htdocs/fourn/product/photos.php b/htdocs/fourn/product/photos.php
index b6a226de1da..20e237f8a1e 100644
--- a/htdocs/fourn/product/photos.php
+++ b/htdocs/fourn/product/photos.php
@@ -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 '
';
diff --git a/htdocs/html.form.class.php b/htdocs/html.form.class.php
index 8e39741aced..5be365366ef 100644
--- a/htdocs/html.form.class.php
+++ b/htdocs/html.form.class.php
@@ -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
diff --git a/htdocs/includes/modules/dons/html_cerfafr.modules.php b/htdocs/includes/modules/dons/html_cerfafr.modules.php
index a345adbce7c..db63b00f181 100644
--- a/htdocs/includes/modules/dons/html_cerfafr.modules.php
+++ b/htdocs/includes/modules/dons/html_cerfafr.modules.php
@@ -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";
}
diff --git a/htdocs/langs/en_US/companies.lang b/htdocs/langs/en_US/companies.lang
index 93683938b90..01f26c6086f 100644
--- a/htdocs/langs/en_US/companies.lang
+++ b/htdocs/langs/en_US/companies.lang
@@ -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
diff --git a/htdocs/langs/fr_FR/companies.lang b/htdocs/langs/fr_FR/companies.lang
index d1bbe7501dc..e232b73dc78 100644
--- a/htdocs/langs/fr_FR/companies.lang
+++ b/htdocs/langs/fr_FR/companies.lang
@@ -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
diff --git a/htdocs/lib/functions.inc.php b/htdocs/lib/functions.inc.php
index 87070da78c1..b1b3cbd0372 100644
--- a/htdocs/lib/functions.inc.php
+++ b/htdocs/lib/functions.inc.php
@@ -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 '';
}
/**
diff --git a/htdocs/livraison/livraison.class.php b/htdocs/livraison/livraison.class.php
index 59dd9e6f16a..b9c31030720 100644
--- a/htdocs/livraison/livraison.class.php
+++ b/htdocs/livraison/livraison.class.php
@@ -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;
diff --git a/htdocs/product.class.php b/htdocs/product.class.php
index beb7dde6bb0..e55256c4d7a 100644
--- a/htdocs/product.class.php
+++ b/htdocs/product.class.php
@@ -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;
diff --git a/htdocs/product/photos.php b/htdocs/product/photos.php
index 69e70169ec6..978cc3d6285 100644
--- a/htdocs/product/photos.php
+++ b/htdocs/product/photos.php
@@ -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 '
';