From: konrad Date: Sat, 1 Jan 2011 16:23:23 +0000 (+0000) Subject: further tuning of address parser X-Git-Url: http://git.silmor.de/gitweb/?a=commitdiff_plain;h=48c36ebd35c6b7e5e323565a9b5562bd25dcf77a;p=web%2Fkonrad%2Fsmoke.git further tuning of address parser git-svn-id: https://silmor.de/svn/softmagic/smoke/trunk@702 6e3c4bff-ac9f-4ac1-96c5-d2ea494d3e33 --- diff --git a/www/inc/db/dbupgrade.php b/www/inc/db/dbupgrade.php index 5bb0013..1747628 100644 --- a/www/inc/db/dbupgrade.php +++ b/www/inc/db/dbupgrade.php @@ -147,14 +147,16 @@ class DBUpgrade "title"=>"","name"=>$c["name"],"firstname"=>""); //parse name $ns=explode(" ",$c["name"]); - while(in_array($ns[0],$titles)) + while(in_array($ns[0],$titles)){ + if($ci["title"]!="")$ci["title"].=" "; $ci["title"].=array_shift($ns); + } $nm=implode(" ",$ns); $ns=explode(",",$nm); if(count($ns)==2){ - $ci["name"]=$ns[0]; - $ci["firstname"]=$ns[1]; - }else $ci["name"]=$nm; + $ci["name"]=trim($ns[0]); + $ci["firstname"]=trim($ns[1]); + }else $ci["name"]=trim($nm); self::insert("customer",$ci); //copy/parse address self::mkaddress($c["customerid"],$c["address"]);