"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"]);