develop_dict
This commit is contained in:
Regis Houssin
2017-07-11 19:10:22 +02:00
2445 changed files with 23967 additions and 10111 deletions

View File

@@ -432,7 +432,7 @@ function GETPOST($paramname, $check='', $method=0, $filter=NULL, $options=NULL)
break;
case 'aZ09':
$out=trim($out);
if (preg_match('/[^a-z0-9_\-]+/i',$out)) $out='';
if (preg_match('/[^a-z0-9_\-\.]+/i',$out)) $out='';
break;
case 'array':
if (! is_array($out) || empty($out)) $out=array();
@@ -2466,12 +2466,12 @@ function dol_print_graph($htmlid,$width,$height,$data,$showlegend=0,$type='pie',
* MAIN_DISABLE_TRUNC=1 can disable all truncings
*
* @param string $string String to truncate
* @param int $size Max string size visible. 0 for no limit. Final string size can be 1 more (if size was max+1) or 3 more (if we added ...)
* @param int $size Max string size visible (excluding ...). 0 for no limit. WARNING: Final string size can have 3 more chars (if we added ..., or if size was max+1 or max+2 or max+3 so it does not worse to replace with ...)
* @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 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. TODO Remove this param (must be dealt with CSS)
* @return string Truncated string
* @return string Truncated string. WARNING: length is never higher than $size if $nodot is set, but can be 3 chars higher otherwise.
*/
function dol_trunc($string,$size=40,$trunc='right',$stringencoding='UTF-8',$nodot=0, $display=0)
{
@@ -2487,9 +2487,10 @@ function dol_trunc($string,$size=40,$trunc='right',$stringencoding='UTF-8',$nodo
if ($trunc == 'right')
{
$newstring=dol_textishtml($string)?dol_string_nohtmltag($string,1):$string;
if (dol_strlen($newstring,$stringencoding) > ($size+($nodot?0:1)))
if (dol_strlen($newstring,$stringencoding) > ($size+($nodot?0:3))) // If nodot is 0 and size is 1,2 or 3 chars more, we don't trunc and don't add ...
return dol_substr($newstring,0,$size,$stringencoding).($nodot?'':'...');
else
//return 'u'.$size.'-'.$newstring.'-'.dol_strlen($newstring,$stringencoding).'-'.$string;
return $string;
}
elseif ($trunc == 'middle')
@@ -2507,7 +2508,7 @@ function dol_trunc($string,$size=40,$trunc='right',$stringencoding='UTF-8',$nodo
elseif ($trunc == 'left')
{
$newstring=dol_textishtml($string)?dol_string_nohtmltag($string,1):$string;
if (dol_strlen($newstring,$stringencoding) > ($size+1))
if (dol_strlen($newstring,$stringencoding) > ($size+($nodot?0:3))) // If nodot is 0 and size is 1,2 or 3 chars more, we don't trunc and don't add ...
return '...'.dol_substr($newstring,dol_strlen($newstring,$stringencoding) - $size,$size,$stringencoding);
else
return $string;
@@ -4163,7 +4164,7 @@ function getTaxesFromId($vatrate, $buyer=null, $seller=null, $firstparamisid=1)
* @param Societe $buyer Company object
* @param Societe $seller Company object
* @param int $firstparamisid 1 if first param is id into table (use this if you can)
* @return array array(localtax_type1(1-6/0 if not found), rate localtax1, localtax_type1, rate localtax2, accountancycodecust, accountancycodesupp)
* @return array array(localtax_type1(1-6/0 if not found), rate localtax1, localtax_type2, rate localtax2, accountancycodecust, accountancycodesupp)
* @see getTaxesFromId
*/
function getLocalTaxesFromRate($vatrate, $local, $buyer, $seller, $firstparamisid=0)