forked from Wavyzz/dolibarr
NEW_extrafield_in_project_mask
This commit is contained in:
22
htdocs/core/lib/functions2.lib.php
Normal file → Executable file
22
htdocs/core/lib/functions2.lib.php
Normal file → Executable file
@@ -711,7 +711,7 @@ function array2table($data,$tableMarkup=1,$tableoptions='',$troptions='',$tdopti
|
||||
*/
|
||||
function get_next_value($db,$mask,$table,$field,$where='',$objsoc='',$date='',$mode='next', $bentityon=true)
|
||||
{
|
||||
global $conf;
|
||||
global $conf,$user;
|
||||
|
||||
if (! is_object($objsoc)) $valueforccc=$objsoc;
|
||||
else if($table == "commande_fournisseur" || $table == "facture_fourn" ) $valueforccc=$objsoc->code_fournisseur;
|
||||
@@ -790,7 +790,16 @@ function get_next_value($db,$mask,$table,$field,$where='',$objsoc='',$date='',$m
|
||||
$maskpersonew[$regKey[1]]=str_pad('', '_', $regKey[2], STR_PAD_RIGHT);
|
||||
$tmpmask=preg_replace('/\{'.$regKey[1].'\-'.$regKey[2].'\}/i', $maskpersonew, $tmpmask);
|
||||
}*/
|
||||
|
||||
|
||||
if(strstr($mask,'extra_')){
|
||||
|
||||
$start = "{extra_";
|
||||
$end = "\}";
|
||||
$extra= get_string_between($mask, "extra_", "}");
|
||||
if(!empty($user->array_options['options_'.$extra])){
|
||||
$mask = preg_replace('#('.($start).')(.*?)('.($end).')#si', $user->array_options['options_'.$extra], $mask);
|
||||
}
|
||||
}
|
||||
$maskwithonlyymcode=$mask;
|
||||
$maskwithonlyymcode=preg_replace('/\{(0+)([@\+][0-9\-\+\=]+)?([@\+][0-9\-\+\=]+)?\}/i',$maskcounter,$maskwithonlyymcode);
|
||||
$maskwithonlyymcode=preg_replace('/\{dd\}/i','dd',$maskwithonlyymcode);
|
||||
@@ -1110,7 +1119,14 @@ function get_next_value($db,$mask,$table,$field,$where='',$objsoc='',$date='',$m
|
||||
dol_syslog("functions2::get_next_value return ".$numFinal,LOG_DEBUG);
|
||||
return $numFinal;
|
||||
}
|
||||
|
||||
function get_string_between($string, $start, $end){
|
||||
$string = " ".$string;
|
||||
$ini = strpos($string,$start);
|
||||
if ($ini == 0) return "";
|
||||
$ini += strlen($start);
|
||||
$len = strpos($string,$end,$ini) - $ini;
|
||||
return substr($string,$ini,$len);
|
||||
}
|
||||
/**
|
||||
* Check value
|
||||
*
|
||||
|
||||
Reference in New Issue
Block a user