From 48c36ebd35c6b7e5e323565a9b5562bd25dcf77a Mon Sep 17 00:00:00 2001 From: konrad Date: Sat, 1 Jan 2011 16:23:23 +0000 Subject: [PATCH] further tuning of address parser git-svn-id: https://silmor.de/svn/softmagic/smoke/trunk@702 6e3c4bff-ac9f-4ac1-96c5-d2ea494d3e33 --- www/inc/db/dbupgrade.php | 10 ++++++---- 1 files changed, 6 insertions(+), 4 deletions(-) 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"]); -- 1.7.2.5