diff --git a/htdocs/admin/tools/dolibarr_export.php b/htdocs/admin/tools/dolibarr_export.php index b5f4a5fde29d7c74df4158e68b703f7e618bd1d5..74fd46d9c7d350a736a7d6806bf040b45c0bf7c8 100644 --- a/htdocs/admin/tools/dolibarr_export.php +++ b/htdocs/admin/tools/dolibarr_export.php @@ -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')) -{ -?> - <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')) +foreach($compression as $key => $val) { -?> - <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> diff --git a/htdocs/compta/dons/fiche.php b/htdocs/compta/dons/fiche.php index bb87fdb5a0d03980ddde04a1f0b0aff60c3a4137..99c257d29f46738fa72176b65d1cf72383566e41 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 6eba15a658cf4af4cb061747c191573c16c13d16..8156e12adb69f8a2833d79842b8dbdf9a262e174 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 011a40b7679f34f3bafff72d2e95ed684cbfbf8b..5aa08f73dad37427d913452fd6abfc0d900d1e25 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 = '<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>'; diff --git a/htdocs/fourn/product/photos.php b/htdocs/fourn/product/photos.php index b6a226de1da042b78d4424077772b00ae87c8f9a..20e237f8a1e3283195006595f888c03c2c38d71f 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 '<br><table width="100%" valign="top" align="center" border="0" cellpadding="2" cellspacing="2">'; diff --git a/htdocs/html.form.class.php b/htdocs/html.form.class.php index 8e39741aceddd1f6f52872df7ad51e82e8719f04..5be365366eff4743e14237d21db492e63514e3af 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 a345adbce7c6267f5c4959fce6a3ee7587f84971..db63b00f18149297033f953272f92e4e1e5c66b0 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 93683938b90ae8db4300749fb793afb9e80ef8a0..01f26c6086f9b57dd4701860625d8496c3a54968 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 d1bbe7501dcb70347461c08bf870373b3d35be1e..e232b73dc783ac80c741ae161975a851731a631e 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 87070da78c12989679a3bc6bc995f179a29dc585..b1b3cbd0372a24ed7c0e458091f7ac2ef57f01e4 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 59dd9e6f16ae281c2b98911861bfc1405ef499c2..b9c31030720e76d44123ae1483349ce12907b2bf 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 beb7dde6bb0fbb1a2de730cf603cb89fca1bba13..e55256c4d7a138689d8a72f57abdab116f8979ef 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 69e70169ec6d21e8dbf680ba700633e0665b272d..978cc3d62852cdf109be0e30d133f8b9d98c3bd8 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 '<br>';