diff --git a/htdocs/comm/propal.php b/htdocs/comm/propal.php index a7a3442bcd90f1aa8a9b1e10fea5cd984d671d97..caea6c52d2a9aad82ea8dd12aee364306557a16f 100644 --- a/htdocs/comm/propal.php +++ b/htdocs/comm/propal.php @@ -907,7 +907,7 @@ $companystatic=new Societe($db); $now=gmmktime(); -$id = $_GET['propalid']; +$id = $_GET['propalid']?$_GET['propalid']:$_GET['id']; $ref= $_GET['ref']; if ($id > 0 || ! empty($ref)) { @@ -920,7 +920,7 @@ if ($id > 0 || ! empty($ref)) $product_static=new Product($db); $propal = new Propal($db); - $propal->fetch($_GET['propalid'],$_GET['ref']); + $propal->fetch($id,$ref); $societe = new Societe($db); $societe->fetch($propal->socid); diff --git a/htdocs/comm/propal/document.php b/htdocs/comm/propal/document.php index e6fb8936c63ded2596595d543d5bc396f46b7e0e..6900369691ab3c166881418e35db5b45abc59c49 100644 --- a/htdocs/comm/propal/document.php +++ b/htdocs/comm/propal/document.php @@ -116,7 +116,7 @@ llxHeader(); $html = new Form($db); -$id = $_GET['propalid']; +$id = $_GET['propalid']?$_GET['propalid']:$_GET['id']; $ref= $_GET['ref']; if ($id > 0 || ! empty($ref)) { diff --git a/htdocs/compta/facture/document.php b/htdocs/compta/facture/document.php index f00c9e1e1cd33190e1b33fd9f9db5a753662de4c..193ad718d41c54457eb3c2f6e42744ffc48ff592 100644 --- a/htdocs/compta/facture/document.php +++ b/htdocs/compta/facture/document.php @@ -117,7 +117,7 @@ llxHeader(); $html = new Form($db); -$id = $_GET['facid']; +$id = $_GET['facid']?$_GET['facid']:$_GET['id']; $ref= $_GET['ref']; if ($id > 0 || ! empty($ref)) { diff --git a/htdocs/ecm/index.php b/htdocs/ecm/index.php index 94006bf3aa0b658c980f5df7bb6ccf49e19187e1..17b0286d22abea1c2e35d5a83b0a1ba8182386e4 100644 --- a/htdocs/ecm/index.php +++ b/htdocs/ecm/index.php @@ -256,7 +256,7 @@ if (empty($action) || $action == 'file_manager' || eregi('refresh',$action) || $ print '<tr class="liste_titre">'; print '<td class="liste_titre" align="left">'.$langs->trans("ECMSections").'</td>'; print '<td class="liste_titre" colspan="5" align="right">'; - print '<a href="'.$_SERVER["PHP_SELF"].'?action=refreshmanual'.($section?'&section='.$section:'').'">'.img_picto($langs->trans("Refresh"),'refresh').'</a> '; + print '<a href="'.$_SERVER["PHP_SELF"].'?action=refreshmanual'.($section?'&section='.$section:'').'">'.img_picto($langs->trans("Refresh"),'refresh').'</a>'; print '</td>'; print '</tr>'; diff --git a/htdocs/fourn/facture/note.php b/htdocs/fourn/facture/note.php index 69621964908b0254878aada31114490d47ef929d..4465db388eb9ad4a07a3d8ccff500b8d842634c2 100644 --- a/htdocs/fourn/facture/note.php +++ b/htdocs/fourn/facture/note.php @@ -100,7 +100,7 @@ if ($_GET["facid"]) print '<table class="border" width="100%">'; // Ref - print '<tr><td width="30%" nowrap="nowrap">'.$langs->trans("Ref").'</td><td colspan="3">'; + print '<tr><td width="20%" nowrap="nowrap">'.$langs->trans("Ref").'</td><td colspan="3">'; print $html->showrefnav($fac,'facid','',1,'rowid','ref',$morehtmlref); print '</td>'; print "</tr>\n"; diff --git a/htdocs/html.formfile.class.php b/htdocs/html.formfile.class.php index 44bfb2c308a5157344f3042e2bdca9dc7641c56f..55ba868c6d104c54a5eac37b524621d7cd936ef8 100644 --- a/htdocs/html.formfile.class.php +++ b/htdocs/html.formfile.class.php @@ -431,7 +431,7 @@ class FormFile if (empty($useinecm)) print_titre($langs->trans("AttachedFiles")); else { $bc[true]=''; $bc[false]=''; }; $url=$_SERVER["PHP_SELF"]; - print '<table width="100%" class="noborder">'; + print '<table width="100%" class="nobordernopadding">'; print '<tr class="liste_titre">'; print_liste_field_titre($langs->trans("Documents2"),$_SERVER["PHP_SELF"],"name","",$param,'align="left"',$sortfield,$sortorder); print_liste_field_titre($langs->trans("Size"),$_SERVER["PHP_SELF"],"size","",$param,'align="right"',$sortfield,$sortorder); @@ -457,14 +457,15 @@ class FormFile $var=!$var; print "<tr $bc[$var]><td>"; + //print "XX".$file['name']; //$file['name'] must be utf8 print '<a href="'.DOL_URL_ROOT.'/document.php?modulepart='.$modulepart; if ($forcedownload) print '&type=application/binary'; print '&file='.urlencode($relativepath.$file['name']).'">'; - print img_mime($file['name']).' '; - print htmlentities(dol_trunc($file['name'],$maxlength,'middle')); + print img_mime($file['name'],$file['name'].' ('.dol_print_size($file['size'],0,0).')').' '; + print dol_trunc($file['name'],$maxlength,'middle'); print '</a>'; print "</td>\n"; - print '<td align="right">'.dol_print_size($file['size']).'</td>'; + print '<td align="right">'.dol_print_size($file['size'],1,1).'</td>'; print '<td align="center">'.dol_print_date($file['date'],"dayhour").'</td>'; print '<td align="right">'; //print ' '; diff --git a/htdocs/langs/en_US/main.lang b/htdocs/langs/en_US/main.lang index aefd418c652385fb96faab4bd398ef9175ec50ad..34836c9112aedb2e8f1ef76b2b1ea6136e23de68 100644 --- a/htdocs/langs/en_US/main.lang +++ b/htdocs/langs/en_US/main.lang @@ -231,6 +231,13 @@ MonthOfDay=Month of the day HourShort=H Rate=Rate Bytes=Bytes +KiloBytes=Kilobytes +MegaBytes=Megabytes +GigaBytes=Gigabytes +b=b. +Kb=Kb +Mb=Mb +Gb=Gb Cut=Cut Copy=Copy Paste=Paste diff --git a/htdocs/langs/fr_FR/main.lang b/htdocs/langs/fr_FR/main.lang index cbcd05638b5a6fa10d1bcff530bfbbd1ac6b1785..f3be801a66e91681e07ed545efa8d03266510db8 100644 --- a/htdocs/langs/fr_FR/main.lang +++ b/htdocs/langs/fr_FR/main.lang @@ -230,6 +230,13 @@ MonthOfDay=Mois du jour HourShort=H Rate=Taux Bytes=Octets +KiloBytes=Kilooctets +MegaBytes=Megaoctets +GigaBytes=Gigaoctets +b=o. +Kb=Ko +Mb=Mo +Gb=Go Cut=Couper Copy=Copier Paste=Coller diff --git a/htdocs/langs/fr_FR/other.lang b/htdocs/langs/fr_FR/other.lang index 229bcf005e082559204071e87b89f9d0d2127ecf..9e89208a27e8a9f5d23baed2e15529d2c52ad14b 100644 --- a/htdocs/langs/fr_FR/other.lang +++ b/htdocs/langs/fr_FR/other.lang @@ -31,7 +31,7 @@ Notify_NOTIFY_VAL_FAC=Validation facture Notify_NOTIFY_APP_ORDER_SUPPLIER=Approbation commande fournisseur Notify_NOTIFY_REF_ORDER_SUPPLIER=Refus commande fournisseur NbOfAttachedFiles=Nombre de fichiers/documents liés -TotalSizeOfAttachedFiles=Taille total des fichiers/documents liés +TotalSizeOfAttachedFiles=Taille total fichiers/documents liés MaxSize=Taille maximum AttachANewFile=Ajouter un nouveau fichier/document LinkedObject=Objet lié diff --git a/htdocs/lib/files.lib.php b/htdocs/lib/files.lib.php index a2baf32a1b6d5952a470a51ad2ff6caf45bac062..443e87d323f6065756b635dbbb8e2cbe056d8f3c 100644 --- a/htdocs/lib/files.lib.php +++ b/htdocs/lib/files.lib.php @@ -1,5 +1,5 @@ <?php -/* Copyright (C) 2008 Laurent Destailleur <eldy@users.sourceforge.net> +/* Copyright (C) 2008-2009 Laurent Destailleur <eldy@users.sourceforge.net> * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -24,7 +24,7 @@ */ /** - * \brief Scan a directory and return a list of files/directories + * \brief Scan a directory and return a list of files/directories. Content for string is UTF8. * \param $path Starting path from which to search * \param $types Can be "directories", "files", or "all" * \param $recursive Determines whether subdirectories are searched @@ -43,7 +43,7 @@ function dol_dir_list($path, $types="all", $recursive=0, $filter="", $excludefil $loadsize=$mode?true:false; // Clean parameters - $path=eregi_replace('[\\/]+$','',$path); + $path=eregi_replace('[\\/]+$','',utf8_check($path)?utf8_decode($path):$path); if (! is_dir($path)) return array(); @@ -52,6 +52,9 @@ function dol_dir_list($path, $types="all", $recursive=0, $filter="", $excludefil $file_list = array(); while (false !== ($file = readdir($dir))) { + // readdir return value in ISO and we want UTF8 in memory + if (! utf8_check($file)) $file=utf8_encode($file); + $qualified=1; // Check if file is qualified @@ -64,8 +67,8 @@ function dol_dir_list($path, $types="all", $recursive=0, $filter="", $excludefil if (is_dir($path."/".$file) && (($types=="directories") || ($types=="all"))) { // Add entry into file_list array - if ($loaddate || $sortcriteria == 'date') $filedate=filemtime($path."/".$file); - if ($loadsize || $sortcriteria == 'size') $filesize=filesize($path."/".$file); + if ($loaddate || $sortcriteria == 'date') $filedate=filemtime(utf8_check($path."/".$file)?utf8_decode($path."/".$file):$path."/".$file); + if ($loadsize || $sortcriteria == 'size') $filesize=filesize(utf8_check($path."/".$file)?utf8_decode($path."/".$file):$path."/".$file); if (! $filter || eregi($filter,$path.'/'.$file)) { @@ -87,8 +90,8 @@ function dol_dir_list($path, $types="all", $recursive=0, $filter="", $excludefil else if (! is_dir($path."/".$file) && (($types == "files") || ($types == "all"))) { // Add file into file_list array - if ($loaddate || $sortcriteria == 'date') $filedate=filemtime($path."/".$file); - if ($loadsize || $sortcriteria == 'size') $filesize=filesize($path."/".$file); + if ($loaddate || $sortcriteria == 'date') $filedate=filemtime(utf8_check($path."/".$file)?utf8_decode($path."/".$file):$path."/".$file); + if ($loadsize || $sortcriteria == 'size') $filesize=filesize(utf8_check($path."/".$file)?utf8_decode($path."/".$file):$path."/".$file); if (! $filter || eregi($filter,$path.'/'.$file)) { $file_list[] = array( @@ -193,19 +196,18 @@ function dol_mimetype($file) */ function dol_dir_is_emtpy($folder) { - if (is_dir($folder)) + $newfolder=utf8_check($folder)?utf8_decode($folder):$folder; // The opendir need ISO strings + if (is_dir($newfolder)) { - $handle = opendir($folder); - while( (gettype( $name = readdir($handle)) != "boolean")){ + $handle = opendir($newfolder); + while ((gettype( $name = readdir($handle)) != "boolean")) + { $name_array[] = $name; } - foreach($name_array as $temp) - $folder_content .= $temp; + foreach($name_array as $temp) $folder_content .= $temp; - if($folder_content == "...") - return true; - else - return false; + if ($folder_content == "...") return true; + else return false; closedir($handle); } @@ -221,16 +223,18 @@ function dol_dir_is_emtpy($folder) function dol_count_nb_of_line($file) { $nb=0; + + $newfile=utf8_check($file)?utf8_decode($file):$file; // The fopen need ISO strings //print 'x'.$file; - $fp=fopen($file,'r'); + $fp=fopen($newfile,'r'); if ($fp) { - while (!feof($fp)) - { - $line=fgets($fp); - $nb++; - } - fclose($fp); + while (!feof($fp)) + { + $line=fgets($fp); + $nb++; + } + fclose($fp); } else { diff --git a/htdocs/lib/functions.lib.php b/htdocs/lib/functions.lib.php index 7d42fa1c9429d5dde87b0676a7368b08ccec59fb..858b518715e487410433a26a3d49fcef24bb73ba 100644 --- a/htdocs/lib/functions.lib.php +++ b/htdocs/lib/functions.lib.php @@ -698,13 +698,33 @@ function dol_date($fmt, $timestamp, $gm=0) /** * \brief Return string with formated size * \param size Size to print + * \param shortvalue Tell if we want long value to use another unit (Ex: 1.5Kb instead of 1500b) + * \param shortunit Use short value of size unit * \return string Link */ -function dol_print_size($size) +function dol_print_size($size,$shortvalue=0,$shortunit=0) { global $langs; + $level=1024; - return $size.' '.$langs->trans("Bytes"); + // Set value text + if (empty($shortvalue) || $size < ($level*10)) + { + $ret=$size; + $textunitshort=$langs->trans("b"); + $textunitlong=$langs->trans("Bytes"); + } + else + { + $ret=round($size/$level,0); + $textunitshort=$langs->trans("Kb"); + $textunitlong=$langs->trans("KiloBytes"); + } + // Use long or short text unit + if (empty($shortunit)) { $ret.=' '.$textunitlong; } + else { $ret.=' '.$textunitshort; } + + return $ret; } /** @@ -2111,11 +2131,12 @@ function print_fleche_navigation($page,$file,$options='',$nextpage,$betweenarrow function dol_delete_file($file) { $ok=true; - foreach (glob($file) as $filename) + $newfile=utf8_check($file)?utf8_decode($file):$file; // glob function accepts only ISO string + foreach (glob($newfile) as $filename) { $ok=unlink($filename); - if ($ok) dol_syslog("Removed file $filename",LOG_DEBUG); - else dol_syslog("Failed to remove file $filename",LOG_ERR); + if ($ok) dol_syslog("Removed file ".$filename,LOG_DEBUG); + else dol_syslog("Failed to remove file ".$filename,LOG_ERR); } return $ok; } @@ -2128,7 +2149,8 @@ function dol_delete_file($file) */ function dol_delete_dir($dir) { - return rmdir($dir); + $newdir=utf8_check($dir)?utf8_decode($dir):$dir; + return rmdir($newdir); } /** @@ -2140,7 +2162,8 @@ function dol_delete_dir($dir) function dol_delete_dir_recursive($dir,$count=0) { //dol_syslog("functions.lib:dol_delete_dir_recursive ".$dir,LOG_DEBUG); - if ($handle = opendir("$dir")) + $newdir=utf8_check($dir)?utf8_decode($dir):$dir; + if ($handle = opendir("$newdir")) { while (false !== ($item = readdir($handle))) {