From 3c5afdd783508a8be75b0d79ae2e338d671e3520 Mon Sep 17 00:00:00 2001 From: Regis Houssin Date: Wed, 31 Mar 2010 06:47:27 +0000 Subject: [PATCH] Fix: mask problem --- htdocs/lib/functions2.lib.php | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/htdocs/lib/functions2.lib.php b/htdocs/lib/functions2.lib.php index e08a364874f..541c25a24aa 100644 --- a/htdocs/lib/functions2.lib.php +++ b/htdocs/lib/functions2.lib.php @@ -463,11 +463,11 @@ function get_next_value($db,$mask,$table,$field,$where='',$objsoc='',$date='') $maskLike = dol_string_nospecial($mask); $maskLike = str_replace("%","_",$maskLike); // Replace protected special codes with matching number of _ as wild card caracter - $maskLike = str_replace(dol_string_nospecial('{yyyy}'),'____',$maskLike); - $maskLike = str_replace(dol_string_nospecial('{yy}'),'__',$maskLike); - $maskLike = str_replace(dol_string_nospecial('{y}'),'_',$maskLike); - $maskLike = str_replace(dol_string_nospecial('{mm}'),'__',$maskLike); - $maskLike = str_replace(dol_string_nospecial('{dd}'),'__',$maskLike); + $maskLike = preg_replace('/\{yyyy\}/i','____',$maskLike); + $maskLike = preg_replace('/\{yy\}/i','__',$maskLike); + $maskLike = preg_replace('/\{y\}/i','_',$maskLike); + $maskLike = preg_replace('/\{mm\}/i','__',$maskLike); + $maskLike = preg_replace('/\{dd\}/i','__',$maskLike); $maskLike = str_replace(dol_string_nospecial('{'.$masktri.'}'),str_pad("",strlen($maskcounter),"_"),$maskLike); if ($maskrefclient) $maskLike = str_replace(dol_string_nospecial('{'.$maskrefclient.'}'),str_pad("",strlen($maskrefclient),"_"),$maskLike); //if ($masktype) $maskLike = str_replace(dol_string_nospecial('{'.$masktype.'}'),str_pad("",strlen($masktype),"_"),$maskLike);