From: Bill Erickson Date: Tue, 24 Jul 2018 21:05:48 +0000 (-0400) Subject: JBAS-1925 eCard address normalizer repair X-Git-Url: https://old-git.evergreen-ils.org/?a=commitdiff_plain;h=bee8bf1418c6e4c20b11f7084c82921237a8f035;p=working%2FEvergreen.git JBAS-1925 eCard address normalizer repair Signed-off-by: Bill Erickson --- diff --git a/Open-ILS/src/perlmods/lib/OpenILS/WWW/EGCatLoader/Ecard.pm b/Open-ILS/src/perlmods/lib/OpenILS/WWW/EGCatLoader/Ecard.pm index a53806b32a..f6db282a3f 100644 --- a/Open-ILS/src/perlmods/lib/OpenILS/WWW/EGCatLoader/Ecard.pm +++ b/Open-ILS/src/perlmods/lib/OpenILS/WWW/EGCatLoader/Ecard.pm @@ -458,18 +458,27 @@ sub add_addresses { $user->billing_address(-1); $user->mailing_address(-1); - ($cgi->{billing_street1}, $cgi->{billing_street2}) = + my ($s1, $s2) = OpenILS::Utils::KCLSNormalize::normalize_address_street( - $cgi->{billing_street1}, - $cgi->{billing_street2} + $cgi->param('billing_street1'), + $cgi->param('billing_street2') ); + # Toss the normalized values back into CGI to simplify the steps below. + $cgi->param('billing_street1', $s1); + + if ($s2) { + $cgi->param('billing_street2', $s2); + } else { + $cgi->delete('billing_street2'); + } + # Confirm we have values for all of the required fields. # Apply values to our in-progress address object. for my $field_info (@api_fields) { my $field = $field_info->{name}; next unless $field =~ /billing/; - next if $field eq 'billing_street1_name'; + next if $field =~ /billing_street1_/; my $val = $cgi->param($field);