1 <% encode_json($return) %>
4 local $SIG{__DIE__}; #disable Mason error trap
8 my $conf = new FS::Conf;
10 my $sub = $cgi->param('sub');
12 warn $cgi->param('arg') if $DEBUG;
14 my %old = %{ decode_json($cgi->param('arg')) }
15 or die "bad argument '".$cgi->param('arg')."'";
21 @prefixes = ('ship_');
22 } elsif ( $old{same} ) {
23 @prefixes = ('bill_');
25 @prefixes = ('bill_', 'ship_');
28 foreach my $pre ( @prefixes ) {
31 map { $_ => $old{$pre.$_} }
32 qw( company address1 address2 city state zip country )
35 my $cache = eval { FS::GeocodeCache->standardize($location) };
37 # don't do set_censustract here, though censustract may be set by now
39 foreach ( keys(%$cache) ) {
40 $new{$pre.$_} = $cache->get($_);
43 foreach ( qw(address1 address2 city state zip country) ) {
44 $all_same = 0 if ( $new{$pre.$_} ne $old{$pre.$_} );
49 my $return = { old => \%old, new => \%new, all_same => $all_same };
50 warn "result:\n".encode_json($return) if $DEBUG;