Merge pull request #2140 from frederic34/patch-4
Truncate label different for small or big screen
This commit is contained in:
commit
806fdf731f
@ -1720,11 +1720,11 @@ class Form
|
|||||||
else if ($objp->stock <= 0) $opt.= ' class="product_line_stock_too_low"';
|
else if ($objp->stock <= 0) $opt.= ' class="product_line_stock_too_low"';
|
||||||
}
|
}
|
||||||
$opt.= '>';
|
$opt.= '>';
|
||||||
$opt.= $objp->ref.' - '.dol_trunc($label,32).' - ';
|
$opt.= $objp->ref.' - '.dol_trunc($label, 99, '', '', 1).' - ';
|
||||||
|
|
||||||
$objRef = $objp->ref;
|
$objRef = $objp->ref;
|
||||||
if (! empty($filterkey) && $filterkey != '') $objRef=preg_replace('/('.preg_quote($filterkey).')/i','<strong>$1</strong>',$objRef,1);
|
if (! empty($filterkey) && $filterkey != '') $objRef=preg_replace('/('.preg_quote($filterkey).')/i','<strong>$1</strong>',$objRef,1);
|
||||||
$outval.=$objRef.' - '.dol_trunc($label,32).' - ';
|
$outval.=$objRef.' - '.dol_trunc($label, 99, '', '', 1).' - ';
|
||||||
|
|
||||||
$found=0;
|
$found=0;
|
||||||
|
|
||||||
@ -2004,8 +2004,8 @@ class Form
|
|||||||
$outval.=$objRef;
|
$outval.=$objRef;
|
||||||
if (! empty($objp->idprodfournprice)) $outval.=' ('.$objRefFourn.')';
|
if (! empty($objp->idprodfournprice)) $outval.=' ('.$objRefFourn.')';
|
||||||
$outval.=' - ';
|
$outval.=' - ';
|
||||||
$opt.=dol_trunc($objp->label,18).' - ';
|
$opt.=dol_trunc($label, 72).' - ';
|
||||||
$outval.=dol_trunc($label,18).' - ';
|
$outval.=dol_trunc($label, 72).' - ';
|
||||||
|
|
||||||
if (! empty($objp->idprodfournprice))
|
if (! empty($objp->idprodfournprice))
|
||||||
{
|
{
|
||||||
|
|||||||
@ -1782,14 +1782,16 @@ function dol_print_graph($htmlid,$width,$height,$data,$showlegend=0,$type='pie',
|
|||||||
* @param string $trunc Where to trunc: right, left, middle (size must be a 2 power), wrap
|
* @param string $trunc Where to trunc: right, left, middle (size must be a 2 power), wrap
|
||||||
* @param string $stringencoding Tell what is source string encoding
|
* @param string $stringencoding Tell what is source string encoding
|
||||||
* @param int $nodot Truncation do not add ... after truncation. So it's an exact truncation.
|
* @param int $nodot Truncation do not add ... after truncation. So it's an exact truncation.
|
||||||
|
* @param int $display Trunc is use to display and can be changed for small screen
|
||||||
* @return string Truncated string
|
* @return string Truncated string
|
||||||
*/
|
*/
|
||||||
function dol_trunc($string,$size=40,$trunc='right',$stringencoding='UTF-8',$nodot=0)
|
function dol_trunc($string,$size=40,$trunc='right',$stringencoding='UTF-8',$nodot=0, $display=0)
|
||||||
{
|
{
|
||||||
global $conf;
|
global $conf;
|
||||||
|
|
||||||
if ($size==0 || ! empty($conf->global->MAIN_DISABLE_TRUNC)) return $string;
|
if ($size==0 || ! empty($conf->global->MAIN_DISABLE_TRUNC)) return $string;
|
||||||
|
// reduce for small screen
|
||||||
|
if ($conf->dol_optimize_smallscreen==1 && $display==1) $size = round($size/3);
|
||||||
// We go always here
|
// We go always here
|
||||||
if ($trunc == 'right')
|
if ($trunc == 'right')
|
||||||
{
|
{
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user