From e2838aa074db1531d38884f99646b8c17414a2d6 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sun, 15 Apr 2018 17:58:13 +0200 Subject: [PATCH] NEW Show also size in bytes in tooltip if visible unit is not bytes --- htdocs/core/class/html.formfile.class.php | 13 ++++++++++++- htdocs/core/lib/functions.lib.php | 2 +- htdocs/core/modules/modVariants.class.php | 4 +--- htdocs/product/stock/productlot_list.php | 2 +- htdocs/variants/list.php | 11 +++++++---- 5 files changed, 22 insertions(+), 10 deletions(-) diff --git a/htdocs/core/class/html.formfile.class.php b/htdocs/core/class/html.formfile.class.php index e64271b7c0e..24b06065a5b 100644 --- a/htdocs/core/class/html.formfile.class.php +++ b/htdocs/core/class/html.formfile.class.php @@ -990,6 +990,7 @@ class FormFile global $user, $conf, $langs, $hookmanager; global $sortfield, $sortorder, $maxheightmini; global $dolibarr_main_url_root; + global $form; // Define relative path used to store the file if (empty($relativepath)) @@ -1034,6 +1035,8 @@ class FormFile } else { + if (! is_object($form)) $form=new Form($this->db); + if (! preg_match('/&id=/', $param) && isset($object->id)) $param.='&id='.$object->id; $relativepathwihtoutslashend=preg_replace('/\/$/', '', $relativepath); if ($relativepathwihtoutslashend) $param.= '&file='.urlencode($relativepathwihtoutslashend); @@ -1161,7 +1164,15 @@ class FormFile print "\n"; // Size - print ''.dol_print_size($file['size'],1,1).''; + $sizetoshow = dol_print_size($file['size'],1,1); + $sizetoshowbytes = dol_print_size($file['size'],0,1); + + print ''; + if ($sizetoshow == $sizetoshowbytes) print $sizetoshow; + else { + print $form->textwithpicto($sizetoshow, $sizetoshowbytes, -1); + } + print ''; // Date print ''.dol_print_date($file['date'],"dayhour","tzuser").''; diff --git a/htdocs/core/lib/functions.lib.php b/htdocs/core/lib/functions.lib.php index 9a5033b76c9..e90ce6e88ad 100644 --- a/htdocs/core/lib/functions.lib.php +++ b/htdocs/core/lib/functions.lib.php @@ -2040,7 +2040,7 @@ function dol_now($mode='gmt') * * @param int $size Size to print * @param int $shortvalue Tell if we want long value to use another unit (Ex: 1.5Kb instead of 1500b) - * @param int $shortunit Use short value of size unit + * @param int $shortunit Use short label of size unit (for example 'b' instead of 'bytes') * @return string Link */ function dol_print_size($size,$shortvalue=0,$shortunit=0) diff --git a/htdocs/core/modules/modVariants.class.php b/htdocs/core/modules/modVariants.class.php index 87a2e2ce491..4160e0e0639 100644 --- a/htdocs/core/modules/modVariants.class.php +++ b/htdocs/core/modules/modVariants.class.php @@ -75,9 +75,7 @@ class modVariants extends DolibarrModules $this->dirs = array(); // Config pages. Put here list of php page, stored into mymodule/admin directory, to use to setup module. - $this->config_page_url = array( - 'admin.php@variants' - ); + $this->config_page_url = array('admin.php@variants'); // Dependencies $this->hidden = false; // A condition to hide module diff --git a/htdocs/product/stock/productlot_list.php b/htdocs/product/stock/productlot_list.php index 1d1f6a89478..5e1888e6bbe 100644 --- a/htdocs/product/stock/productlot_list.php +++ b/htdocs/product/stock/productlot_list.php @@ -295,7 +295,7 @@ if ($resql) print ''; print ''; - print_barre_liste($title, $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, '', $num, $nbtotalofrecords, 'title_companies', 0, '', '', $limit); + print_barre_liste($title, $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, '', $num, $nbtotalofrecords, 'title_products', 0, '', '', $limit); $topicmail="Information"; $modelmail="productlot"; diff --git a/htdocs/variants/list.php b/htdocs/variants/list.php index 74fb252147d..a1ece93d71d 100644 --- a/htdocs/variants/list.php +++ b/htdocs/variants/list.php @@ -18,7 +18,7 @@ require '../main.inc.php'; require DOL_DOCUMENT_ROOT.'/variants/class/ProductAttribute.class.php'; -$id = GETPOST('id'); +$id = GETPOST('id','int'); $action = GETPOST('action','aZ09'); $object = new ProductAttribute($db); @@ -57,9 +57,12 @@ $variants = $object->fetchAll(); llxHeader('', $title); -$buttonadd=''.$langs->trans('Create').''; - -print load_fiche_titre($title, $buttonadd); +$newcardbutton=''; +if ($user->rights->produit->creer) +{ + $newcardbutton=''.$langs->trans('Create').''; +} +print load_fiche_titre($title, $newcardbutton, 'title_products'); $forcereloadpage=empty($conf->global->MAIN_FORCE_RELOAD_PAGE)?0:1; ?>