Merge pull request #4025 from ndrosis/3.8
FIX utf-8 characters in the mask mercure does not break counter
This commit is contained in:
commit
45d6635bf6
@ -814,7 +814,14 @@ function get_next_value($db,$mask,$table,$field,$where='',$objsoc='',$date='',$m
|
|||||||
//print "masktri=".$masktri." maskcounter=".$maskcounter." maskraz=".$maskraz." maskoffset=".$maskoffset."<br>\n";
|
//print "masktri=".$masktri." maskcounter=".$maskcounter." maskraz=".$maskraz." maskoffset=".$maskoffset."<br>\n";
|
||||||
|
|
||||||
// Define $sqlstring
|
// Define $sqlstring
|
||||||
$posnumstart=strrpos($maskwithnocode,$maskcounter); // Pos of counter in final string (from 0 to ...)
|
if (function_exists('mb_strrpos'))
|
||||||
|
{
|
||||||
|
$posnumstart=mb_strrpos($maskwithnocode,$maskcounter, 'UTF-8');
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
$posnumstart=strrpos($maskwithnocode,$maskcounter);
|
||||||
|
} // Pos of counter in final string (from 0 to ...)
|
||||||
if ($posnumstart < 0) return 'ErrorBadMaskFailedToLocatePosOfSequence';
|
if ($posnumstart < 0) return 'ErrorBadMaskFailedToLocatePosOfSequence';
|
||||||
$sqlstring='SUBSTRING('.$field.', '.($posnumstart+1).', '.dol_strlen($maskcounter).')';
|
$sqlstring='SUBSTRING('.$field.', '.($posnumstart+1).', '.dol_strlen($maskcounter).')';
|
||||||
|
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user