diff options
author | ivan <ivan> | 2010-10-31 19:22:03 +0000 |
---|---|---|
committer | ivan <ivan> | 2010-10-31 19:22:03 +0000 |
commit | 5311b0441b84bf1bd1cd2aba73092905d352f706 (patch) | |
tree | b3c71889ffb9ee7e390760d81d34731230eccc10 /bin | |
parent | a22ee6a5bbf86485d0c65adfbe9b742b9bfbe7f3 (diff) |
adding, RT#10376
Diffstat (limited to 'bin')
-rwxr-xr-x | bin/cust_main-find_bogus_geocode | 36 |
1 files changed, 36 insertions, 0 deletions
diff --git a/bin/cust_main-find_bogus_geocode b/bin/cust_main-find_bogus_geocode new file mode 100755 index 000000000..04a38a9c4 --- /dev/null +++ b/bin/cust_main-find_bogus_geocode @@ -0,0 +1,36 @@ +#!/usr/bin/perl -w + +use strict; +use FS::UID qw(adminsuidsetup); +use FS::Record qw( qsearch ); +use FS::cust_main; + +my $user = shift or die "usage: cust_main-find_bogus_geocode username\n"; +adminsuidsetup $user; + +my @cust_main = qsearch({ + 'table' => 'cust_main', + 'extra_sql' => 'WHERE geocode IS NOT NULL', +}); + +foreach my $cust_main ( @cust_main ) { + + my $db_geocode = $cust_main->geocode; + + $cust_main->set('geocode', ''); + + my $calc_geocode = $cust_main->geocode('cch'); + + next unless $calc_geocode; + + my $cust = $cust_main->custnum.': '. $cust_main->name. "\n"; + + if ( $db_geocode eq $calc_geocode ) { + warn "unnecessary geocode override for $cust"; + } else { + warn "bogus geocode override $db_geocode overrides $calc_geocode for $cust"; + } + +} + +1; |