script to reset svc_broadband coordinates, RT#74147
authorIvan Kohler <ivan@freeside.biz>
Tue, 17 Jan 2017 16:57:58 +0000 (08:57 -0800)
committerIvan Kohler <ivan@freeside.biz>
Tue, 17 Jan 2017 16:57:58 +0000 (08:57 -0800)
bin/svc_broadband.reset_coords [new file with mode: 0755]

diff --git a/bin/svc_broadband.reset_coords b/bin/svc_broadband.reset_coords
new file mode 100755 (executable)
index 0000000..23b41fd
--- /dev/null
@@ -0,0 +1,31 @@
+#!/usr/bin/perl
+
+use strict;
+use Text::CSV_XS;
+use FS::UID qw( adminsuidsetup );
+use FS::Record qw( qsearch );
+use FS::svc_broadband;
+
+my $user = shift or die &usage;
+adminsuidsetup $user;
+
+foreach my $svc_broadband (
+  qsearch({
+    'table'     => 'svc_broadband',
+    'hashref'   => {},
+    #'extra_sql' => 'WHERE latitude IS NOT NULL OR longitude IS NOT NULL',
+  })
+) {
+  $svc_broadband->latitude('');
+  $svc_broadband->longitude('');
+  my $error = $svc_broadband->replace;
+  die $error if $error;
+}
+
+sub usage {
+  "Usage:
+  svc_broadband.reset_coords user
+";
+}
+
+1;