2
0
forked from Wavyzz/dolibarr
This commit is contained in:
ldestailleur
2025-02-24 16:55:51 +01:00
parent e1e8a76805
commit e16b13442f

View File

@@ -11851,6 +11851,25 @@ function dolExplodeIntoArray($string, $delimiter = ';', $kv = '=')
return array();
}
/**
* Generate natural SQL search string for a criteria (this criteria can be tested on one or several fields)
*
* @param string $input String to explode
* @return array<string> Array of string values
*/
function dolExplodeKeepIfQuotes($input)
{
// Use regexp to capture words and section in quotes
$matches = array();
preg_match_all('/"([^"]*)"|\'([^\']*)\'|(\S+)/', $input, $matches);
// Merge result and delete empty values
// @phan-suppress-next-line PhanPluginUnknownClosureParamType
return array_filter(array_map(function ($a, $b, $c) {
return $a ?: ($b ?: $c);
}, $matches[1], $matches[2], $matches[3]));
}
/**
* Set focus onto field with selector (similar behaviour of 'autofocus' HTML5 tag)
@@ -11881,26 +11900,6 @@ function dol_getmypid()
}
}
/**
* Generate natural SQL search string for a criteria (this criteria can be tested on one or several fields)
*
* @param string $input String to explode
* @return array<string> Array of string values
*/
function dolExplodeKeepIfQuotes($input)
{
// Use regexp to capture words and section in quotes
$matches = array();
preg_match_all('/"([^"]*)"|\'([^\']*)\'|(\S+)/', $input, $matches);
// Merge result and delete empty values
return array_filter(array_map(function ($a, $b, $c) {
// @phan-suppress-current-line PhanPluginUnknownClosureParamType
return $a ?: ($b ?: $c);
}, $matches[1], $matches[2], $matches[3]));
}
/**
* Generate natural SQL search string for a criteria (this criteria can be tested on one or several fields)
*