tbrehm
2009-10-06 cc215651fbe04d53a22b6fb4d93c5921caa34a77
Fixed: FS#843 - replacePrefix just returns last result (tools.inc.php)
1 files modified
16 ■■■■ changed files
interface/web/sites/tools.inc.php 16 ●●●● patch | view | raw | blame | history
interface/web/sites/tools.inc.php
@@ -28,26 +28,26 @@
*/
function replacePrefix($name, $dataRecord){
    // No input -> no possible output -> go out!
    if ($name=="") return "";
    // Array containing keys to search
    $keywordlist=array('CLIENTNAME','CLIENTID');
    if ($name != '') {
    // Try to match the key within the string
        foreach ($keywordlist as $keyword) {
            if (substr_count($name, '['.$keyword.']') > 0) {
                switch ($keyword) {
                    case 'CLIENTNAME':
                        $res=str_replace('['.$keyword.']', getClientName($dataRecord), $name);
                    $name=str_replace('['.$keyword.']', getClientName($dataRecord),$name);
                        break;
                    case 'CLIENTID':
                        $res=str_replace('['.$keyword.']', getClientID($dataRecord), $name);
                    $name=str_replace('['.$keyword.']', getClientID($dataRecord),$name);
                        break;
                }
            }
        }
    } else {
        $res='';
    }
    return $res;
    return $name;
}
function getClientName($dataRecord) {